Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
ce84e1c9
Commit
ce84e1c9
authored
May 13, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix loss scale
parent
1fc18a6e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
6 deletions
+4
-6
examples/FasterRCNN/data.py
examples/FasterRCNN/data.py
+2
-2
examples/FasterRCNN/model.py
examples/FasterRCNN/model.py
+2
-4
No files found.
examples/FasterRCNN/data.py
View file @
ce84e1c9
...
...
@@ -141,12 +141,12 @@ def get_anchor_labels(anchors, gt_boxes, crowd_boxes):
overlap_with_crowd
=
cand_inds
[
ious
.
max
(
axis
=
1
)
>
config
.
CROWD_OVERLAP_THRES
]
anchor_labels
[
overlap_with_crowd
]
=
-
1
#
Filter
fg labels: ignore some fg if fg is too many
#
Subsample
fg labels: ignore some fg if fg is too many
target_num_fg
=
int
(
config
.
RPN_BATCH_PER_IM
*
config
.
RPN_FG_RATIO
)
fg_inds
=
filter_box_label
(
anchor_labels
,
1
,
target_num_fg
)
# Note that fg could be fewer than the target ratio
#
filter
bg labels. num_bg is not allowed to be too many
#
Subsample
bg labels. num_bg is not allowed to be too many
old_num_bg
=
np
.
sum
(
anchor_labels
==
0
)
if
old_num_bg
==
0
or
len
(
fg_inds
)
==
0
:
# No valid bg/fg in this image, skip.
...
...
examples/FasterRCNN/model.py
View file @
ce84e1c9
...
...
@@ -99,7 +99,7 @@ def rpn_losses(anchor_labels, anchor_boxes, label_logits, box_logits):
placeholder
=
1.
label_loss
=
tf
.
nn
.
sigmoid_cross_entropy_with_logits
(
labels
=
tf
.
to_float
(
valid_anchor_labels
),
logits
=
valid_label_logits
)
label_loss
=
tf
.
reduce_mean
(
label_loss
)
label_loss
=
label_loss
*
(
1.
/
config
.
RPN_BATCH_PER_IM
)
label_loss
=
tf
.
where
(
tf
.
equal
(
nr_valid
,
0
),
placeholder
,
label_loss
,
name
=
'label_loss'
)
pos_anchor_boxes
=
tf
.
boolean_mask
(
anchor_boxes
,
pos_mask
)
...
...
@@ -108,9 +108,7 @@ def rpn_losses(anchor_labels, anchor_boxes, label_logits, box_logits):
box_loss
=
tf
.
losses
.
huber_loss
(
pos_anchor_boxes
,
pos_box_logits
,
delta
=
delta
,
reduction
=
tf
.
losses
.
Reduction
.
SUM
)
/
delta
box_loss
=
tf
.
div
(
box_loss
,
tf
.
cast
(
nr_valid
,
tf
.
float32
))
box_loss
=
box_loss
*
(
1.
/
config
.
RPN_BATCH_PER_IM
)
box_loss
=
tf
.
where
(
tf
.
equal
(
nr_pos
,
0
),
placeholder
,
box_loss
,
name
=
'box_loss'
)
add_moving_summary
(
label_loss
,
box_loss
,
nr_valid
,
nr_pos
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment