Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
18b1714c
Commit
18b1714c
authored
Oct 24, 2019
by
Yeqing Li
Committed by
A. Unique TensorFlower
Oct 24, 2019
Browse files
Removes cls_outputs and box_outputs from postprocessing results.
PiperOrigin-RevId: 276586434
parent
8e91adaf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
official/vision/detection/executor/detection_executor.py
official/vision/detection/executor/detection_executor.py
+2
-2
official/vision/detection/modeling/retinanet_model.py
official/vision/detection/modeling/retinanet_model.py
+6
-6
No files found.
official/vision/detection/executor/detection_executor.py
View file @
18b1714c
...
@@ -95,9 +95,9 @@ class DetectionDistributedExecutor(executor.DistributedExecutor):
...
@@ -95,9 +95,9 @@ class DetectionDistributedExecutor(executor.DistributedExecutor):
inputs
,
labels
=
inputs
inputs
,
labels
=
inputs
model_outputs
=
model
(
inputs
,
training
=
False
)
model_outputs
=
model
(
inputs
,
training
=
False
)
if
self
.
_predict_post_process_fn
:
if
self
.
_predict_post_process_fn
:
labels
,
model
_outputs
=
self
.
_predict_post_process_fn
(
labels
,
prediction
_outputs
=
self
.
_predict_post_process_fn
(
labels
,
model_outputs
)
labels
,
model_outputs
)
return
labels
,
model
_outputs
return
labels
,
prediction
_outputs
labels
,
outputs
=
strategy
.
experimental_run_v2
(
labels
,
outputs
=
strategy
.
experimental_run_v2
(
_test_step_fn
,
args
=
(
next
(
iterator
),))
_test_step_fn
,
args
=
(
next
(
iterator
),))
...
...
official/vision/detection/modeling/retinanet_model.py
View file @
18b1714c
...
@@ -40,10 +40,8 @@ class COCOMetrics(object):
...
@@ -40,10 +40,8 @@ class COCOMetrics(object):
self
.
_evaluator
=
eval_factory
.
evaluator_generator
(
params
.
eval
)
self
.
_evaluator
=
eval_factory
.
evaluator_generator
(
params
.
eval
)
def
update_state
(
self
,
y_true
,
y_pred
):
def
update_state
(
self
,
y_true
,
y_pred
):
labels
,
outputs
=
y_true
,
y_pred
labels
=
tf
.
nest
.
map_structure
(
lambda
x
:
x
.
numpy
(),
y_true
)
outputs
=
tf
.
nest
.
map_structure
(
lambda
x
:
x
.
numpy
(),
y_pred
)
labels
=
tf
.
nest
.
map_structure
(
lambda
x
:
x
.
numpy
(),
labels
)
outputs
=
tf
.
nest
.
map_structure
(
lambda
x
:
x
.
numpy
(),
outputs
)
groundtruths
=
{}
groundtruths
=
{}
predictions
=
{}
predictions
=
{}
for
key
,
val
in
outputs
.
items
():
for
key
,
val
in
outputs
.
items
():
...
@@ -161,14 +159,16 @@ class RetinanetModel(base_model.Model):
...
@@ -161,14 +159,16 @@ class RetinanetModel(base_model.Model):
boxes
,
scores
,
classes
,
valid_detections
=
self
.
_generate_detections_fn
(
boxes
,
scores
,
classes
,
valid_detections
=
self
.
_generate_detections_fn
(
inputs
=
(
outputs
[
'box_outputs'
],
outputs
[
'cls_outputs'
],
inputs
=
(
outputs
[
'box_outputs'
],
outputs
[
'cls_outputs'
],
labels
[
'anchor_boxes'
],
labels
[
'image_info'
][:,
1
:
2
,
:]))
labels
[
'anchor_boxes'
],
labels
[
'image_info'
][:,
1
:
2
,
:]))
outputs
.
update
({
# Discards the old output tensors to save memory. The `cls_outputs` and
# `box_outputs` are pretty big and could potentiall lead to memory issue.
outputs
=
{
'source_id'
:
labels
[
'groundtruths'
][
'source_id'
],
'source_id'
:
labels
[
'groundtruths'
][
'source_id'
],
'image_info'
:
labels
[
'image_info'
],
'image_info'
:
labels
[
'image_info'
],
'num_detections'
:
valid_detections
,
'num_detections'
:
valid_detections
,
'detection_boxes'
:
boxes
,
'detection_boxes'
:
boxes
,
'detection_classes'
:
classes
,
'detection_classes'
:
classes
,
'detection_scores'
:
scores
,
'detection_scores'
:
scores
,
}
)
}
if
'groundtruths'
in
labels
:
if
'groundtruths'
in
labels
:
labels
[
'source_id'
]
=
labels
[
'groundtruths'
][
'source_id'
]
labels
[
'source_id'
]
=
labels
[
'groundtruths'
][
'source_id'
]
...
...
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