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
bfd15ec1
Commit
bfd15ec1
authored
Apr 07, 2018
by
Zhichao Lu
Committed by
pkulzc
Apr 13, 2018
Browse files
Add learning rate summary in EVAL mode in model.py
PiperOrigin-RevId: 192006190
parent
90cc9baa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
research/object_detection/model_lib.py
research/object_detection/model_lib.py
+7
-1
No files found.
research/object_detection/model_lib.py
View file @
bfd15ec1
...
@@ -280,12 +280,16 @@ def create_model_fn(detection_model_fn, configs, hparams, use_tpu=False):
...
@@ -280,12 +280,16 @@ def create_model_fn(detection_model_fn, configs, hparams, use_tpu=False):
losses
.
append
(
regularization_loss
)
losses
.
append
(
regularization_loss
)
losses_dict
[
'Loss/regularization_loss'
]
=
regularization_loss
losses_dict
[
'Loss/regularization_loss'
]
=
regularization_loss
total_loss
=
tf
.
add_n
(
losses
,
name
=
'total_loss'
)
total_loss
=
tf
.
add_n
(
losses
,
name
=
'total_loss'
)
losses_dict
[
'Loss/total_loss'
]
=
total_loss
if
mode
==
tf
.
estimator
.
ModeKeys
.
TRAIN
:
if
mode
in
[
tf
.
estimator
.
ModeKeys
.
TRAIN
,
tf
.
estimator
.
ModeKeys
.
EVAL
]:
# TODO(rathodv): Stop creating optimizer summary vars in EVAL mode once we
# can write learning rate summaries on TPU without host calls.
global_step
=
tf
.
train
.
get_or_create_global_step
()
global_step
=
tf
.
train
.
get_or_create_global_step
()
training_optimizer
,
optimizer_summary_vars
=
optimizer_builder
.
build
(
training_optimizer
,
optimizer_summary_vars
=
optimizer_builder
.
build
(
train_config
.
optimizer
)
train_config
.
optimizer
)
if
mode
==
tf
.
estimator
.
ModeKeys
.
TRAIN
:
if
use_tpu
:
if
use_tpu
:
training_optimizer
=
tpu_optimizer
.
CrossShardOptimizer
(
training_optimizer
=
tpu_optimizer
.
CrossShardOptimizer
(
training_optimizer
)
training_optimizer
)
...
@@ -362,6 +366,8 @@ def create_model_fn(detection_model_fn, configs, hparams, use_tpu=False):
...
@@ -362,6 +366,8 @@ def create_model_fn(detection_model_fn, configs, hparams, use_tpu=False):
include_metrics_per_category
=
False
)
include_metrics_per_category
=
False
)
for
loss_key
,
loss_tensor
in
iter
(
losses_dict
.
items
()):
for
loss_key
,
loss_tensor
in
iter
(
losses_dict
.
items
()):
eval_metric_ops
[
loss_key
]
=
tf
.
metrics
.
mean
(
loss_tensor
)
eval_metric_ops
[
loss_key
]
=
tf
.
metrics
.
mean
(
loss_tensor
)
for
var
in
optimizer_summary_vars
:
eval_metric_ops
[
str
(
var
.
op
.
name
)]
=
(
var
,
tf
.
no_op
())
if
img_summary
is
not
None
:
if
img_summary
is
not
None
:
eval_metric_ops
[
'Detections_Left_Groundtruth_Right'
]
=
(
eval_metric_ops
[
'Detections_Left_Groundtruth_Right'
]
=
(
img_summary
,
tf
.
no_op
())
img_summary
,
tf
.
no_op
())
...
...
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