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
7a02b5ce
Commit
7a02b5ce
authored
Mar 22, 2021
by
Vighnesh Birodkar
Committed by
TF Object Detection Team
Mar 22, 2021
Browse files
Restore dummy computation function.
PiperOrigin-RevId: 364388006
parent
2da86542
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
26 deletions
+26
-26
research/object_detection/model_lib_v2.py
research/object_detection/model_lib_v2.py
+26
-26
No files found.
research/object_detection/model_lib_v2.py
View file @
7a02b5ce
...
@@ -351,32 +351,32 @@ def load_fine_tune_checkpoint(
...
@@ -351,32 +351,32 @@ def load_fine_tune_checkpoint(
features
,
labels
=
iter
(
input_dataset
).
next
()
features
,
labels
=
iter
(
input_dataset
).
next
()
#
@tf.function
@
tf
.
function
#
def _dummy_computation_fn(features, labels):
def
_dummy_computation_fn
(
features
,
labels
):
#
model._is_training = False # pylint: disable=protected-access
model
.
_is_training
=
False
# pylint: disable=protected-access
#
tf.keras.backend.set_learning_phase(False)
tf
.
keras
.
backend
.
set_learning_phase
(
False
)
#
labels = model_lib.unstack_batch(
labels
=
model_lib
.
unstack_batch
(
#
labels, unpad_groundtruth_tensors=unpad_groundtruth_tensors)
labels
,
unpad_groundtruth_tensors
=
unpad_groundtruth_tensors
)
#
return _compute_losses_and_predictions_dicts(
return
_compute_losses_and_predictions_dicts
(
#
model,
model
,
#
features,
features
,
#
labels)
labels
)
#
strategy = tf.compat.v2.distribute.get_strategy()
strategy
=
tf
.
compat
.
v2
.
distribute
.
get_strategy
()
#
if hasattr(tf.distribute.Strategy, 'run'):
if
hasattr
(
tf
.
distribute
.
Strategy
,
'run'
):
#
strategy.run(
strategy
.
run
(
#
_dummy_computation_fn, args=(
_dummy_computation_fn
,
args
=
(
#
features,
features
,
#
labels,
labels
,
#
))
))
#
else:
else
:
#
strategy.experimental_run_v2(
strategy
.
experimental_run_v2
(
#
_dummy_computation_fn, args=(
_dummy_computation_fn
,
args
=
(
#
features,
features
,
#
labels,
labels
,
#
))
))
restore_from_objects_dict
=
model
.
restore_from_objects
(
restore_from_objects_dict
=
model
.
restore_from_objects
(
fine_tune_checkpoint_type
=
checkpoint_type
)
fine_tune_checkpoint_type
=
checkpoint_type
)
...
...
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