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
7f55d502
Commit
7f55d502
authored
Nov 17, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FasterRCNN] suppress tf logging; fix nan precision (#494)
parent
39afd64d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
6 deletions
+8
-6
examples/FasterRCNN/data.py
examples/FasterRCNN/data.py
+1
-1
examples/FasterRCNN/model.py
examples/FasterRCNN/model.py
+4
-4
examples/FasterRCNN/utils/box_ops.py
examples/FasterRCNN/utils/box_ops.py
+3
-1
No files found.
examples/FasterRCNN/data.py
View file @
7f55d502
...
@@ -226,7 +226,7 @@ def get_train_dataflow(add_mask=False):
...
@@ -226,7 +226,7 @@ def get_train_dataflow(add_mask=False):
if
not
len
(
boxes
):
if
not
len
(
boxes
):
raise
MalformedData
(
"No valid gt_boxes!"
)
raise
MalformedData
(
"No valid gt_boxes!"
)
except
MalformedData
as
e
:
except
MalformedData
as
e
:
log_once
(
"Input {} is
invali
d for training: {}"
.
format
(
fname
,
str
(
e
)),
'warn'
)
log_once
(
"Input {} is
filtere
d for training: {}"
.
format
(
fname
,
str
(
e
)),
'warn'
)
return
None
return
None
ret
=
[
im
,
fm_labels
,
fm_boxes
,
boxes
,
klass
]
ret
=
[
im
,
fm_labels
,
fm_boxes
,
boxes
,
klass
]
...
...
examples/FasterRCNN/model.py
View file @
7f55d502
...
@@ -78,16 +78,16 @@ def rpn_losses(anchor_labels, anchor_boxes, label_logits, box_logits):
...
@@ -78,16 +78,16 @@ def rpn_losses(anchor_labels, anchor_boxes, label_logits, box_logits):
with
tf
.
device
(
'/cpu:0'
):
with
tf
.
device
(
'/cpu:0'
):
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
.
count_nonzero
(
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
)))
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
)))
summaries
.
append
(
tf
.
truediv
(
precision
=
tf
.
truediv
(
pos_prediction_corr
,
nr_pos_prediction
)
pos_prediction_corr
,
precision
=
tf
.
where
(
tf
.
equal
(
nr_pos_prediction
,
0
),
0
,
precision
,
name
=
'precision_th{}'
.
format
(
th
))
nr_pos_prediction
,
name
=
'precision_th{}'
.
format
(
th
))
)
summaries
.
append
(
precision
)
label_loss
=
tf
.
nn
.
sigmoid_cross_entropy_with_logits
(
label_loss
=
tf
.
nn
.
sigmoid_cross_entropy_with_logits
(
labels
=
tf
.
to_float
(
valid_anchor_labels
),
logits
=
valid_label_logits
)
labels
=
tf
.
to_float
(
valid_anchor_labels
),
logits
=
valid_label_logits
)
...
...
examples/FasterRCNN/utils/box_ops.py
View file @
7f55d502
...
@@ -75,10 +75,12 @@ def get_iou_callable():
...
@@ -75,10 +75,12 @@ def get_iou_callable():
"""
"""
Get a pairwise box iou callable.
Get a pairwise box iou callable.
"""
"""
os
.
environ
[
'CUDA_VISIBLE_DEVICES'
]
=
''
os
.
environ
[
'CUDA_VISIBLE_DEVICES'
]
=
''
# we don't want the dataflow process to touch CUDA
with
tf
.
Graph
()
.
as_default
(),
tf
.
device
(
'/cpu:0'
):
with
tf
.
Graph
()
.
as_default
(),
tf
.
device
(
'/cpu:0'
):
A
=
tf
.
placeholder
(
tf
.
float32
,
shape
=
[
None
,
4
])
A
=
tf
.
placeholder
(
tf
.
float32
,
shape
=
[
None
,
4
])
B
=
tf
.
placeholder
(
tf
.
float32
,
shape
=
[
None
,
4
])
B
=
tf
.
placeholder
(
tf
.
float32
,
shape
=
[
None
,
4
])
iou
=
pairwise_iou
(
A
,
B
)
iou
=
pairwise_iou
(
A
,
B
)
tf
.
logging
.
set_verbosity
(
tf
.
logging
.
FATAL
)
# TF will warn about GPU not found
sess
=
tf
.
Session
(
config
=
get_default_sess_config
())
sess
=
tf
.
Session
(
config
=
get_default_sess_config
())
tf
.
logging
.
set_verbosity
(
tf
.
logging
.
INFO
)
return
sess
.
make_callable
(
iou
,
[
A
,
B
])
return
sess
.
make_callable
(
iou
,
[
A
,
B
])
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