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
ced8330e
Commit
ced8330e
authored
Nov 18, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FasterRCNN] fix type mismatch (#494)
parent
7510f165
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
examples/FasterRCNN/model.py
examples/FasterRCNN/model.py
+9
-7
No files found.
examples/FasterRCNN/model.py
View file @
ced8330e
...
@@ -66,8 +66,8 @@ def rpn_losses(anchor_labels, anchor_boxes, label_logits, box_logits):
...
@@ -66,8 +66,8 @@ def rpn_losses(anchor_labels, anchor_boxes, label_logits, box_logits):
with
tf
.
device
(
'/cpu:0'
):
with
tf
.
device
(
'/cpu:0'
):
valid_mask
=
tf
.
stop_gradient
(
tf
.
not_equal
(
anchor_labels
,
-
1
))
valid_mask
=
tf
.
stop_gradient
(
tf
.
not_equal
(
anchor_labels
,
-
1
))
pos_mask
=
tf
.
stop_gradient
(
tf
.
equal
(
anchor_labels
,
1
))
pos_mask
=
tf
.
stop_gradient
(
tf
.
equal
(
anchor_labels
,
1
))
nr_valid
=
tf
.
stop_gradient
(
tf
.
count_nonzero
(
valid_mask
),
name
=
'num_valid_anchor'
)
nr_valid
=
tf
.
stop_gradient
(
tf
.
count_nonzero
(
valid_mask
,
dtype
=
tf
.
int32
),
name
=
'num_valid_anchor'
)
nr_pos
=
tf
.
count_nonzero
(
pos_mask
,
name
=
'num_pos_anchor'
)
nr_pos
=
tf
.
count_nonzero
(
pos_mask
,
dtype
=
tf
.
int32
,
name
=
'num_pos_anchor'
)
valid_anchor_labels
=
tf
.
boolean_mask
(
anchor_labels
,
valid_mask
)
valid_anchor_labels
=
tf
.
boolean_mask
(
anchor_labels
,
valid_mask
)
valid_label_logits
=
tf
.
boolean_mask
(
label_logits
,
valid_mask
)
valid_label_logits
=
tf
.
boolean_mask
(
label_logits
,
valid_mask
)
...
@@ -79,14 +79,16 @@ def rpn_losses(anchor_labels, anchor_boxes, label_logits, box_logits):
...
@@ -79,14 +79,16 @@ def rpn_losses(anchor_labels, anchor_boxes, label_logits, box_logits):
for
th
in
[
0.5
,
0.2
,
0.1
]:
for
th
in
[
0.5
,
0.2
,
0.1
]:
valid_prediction
=
tf
.
cast
(
valid_label_prob
>
th
,
tf
.
int32
)
valid_prediction
=
tf
.
cast
(
valid_label_prob
>
th
,
tf
.
int32
)
nr_pos_prediction
=
tf
.
reduce_sum
(
valid_prediction
,
name
=
'num_pos_prediction'
)
nr_pos_prediction
=
tf
.
reduce_sum
(
valid_prediction
,
name
=
'num_pos_prediction'
)
pos_prediction_corr
=
tf
.
count_nonzero
(
tf
.
logical_and
(
pos_prediction_corr
=
tf
.
count_nonzero
(
tf
.
logical_and
(
valid_label_prob
>
th
,
valid_label_prob
>
th
,
tf
.
equal
(
valid_prediction
,
valid_anchor_labels
)))
tf
.
equal
(
valid_prediction
,
valid_anchor_labels
)),
dtype
=
tf
.
int32
)
summaries
.
append
(
tf
.
truediv
(
summaries
.
append
(
tf
.
truediv
(
pos_prediction_corr
,
pos_prediction_corr
,
nr_pos
,
name
=
'recall_th{}'
.
format
(
th
)))
nr_pos
,
name
=
'recall_th{}'
.
format
(
th
)))
precision
=
tf
.
t
ruediv
(
pos_prediction_corr
,
nr_pos_prediction
)
precision
=
tf
.
t
o_float
(
tf
.
truediv
(
pos_prediction_corr
,
nr_pos_prediction
)
)
precision
=
tf
.
where
(
tf
.
equal
(
nr_pos_prediction
,
0
),
0
,
precision
,
name
=
'precision_th{}'
.
format
(
th
))
precision
=
tf
.
where
(
tf
.
equal
(
nr_pos_prediction
,
0
),
0
.0
,
precision
,
name
=
'precision_th{}'
.
format
(
th
))
summaries
.
append
(
precision
)
summaries
.
append
(
precision
)
label_loss
=
tf
.
nn
.
sigmoid_cross_entropy_with_logits
(
label_loss
=
tf
.
nn
.
sigmoid_cross_entropy_with_logits
(
...
...
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