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
1f3247f4
Unverified
Commit
1f3247f4
authored
Mar 27, 2020
by
Ayushman Kumar
Committed by
GitHub
Mar 27, 2020
Browse files
Merge pull request #6 from tensorflow/master
Updated
parents
370a4c8d
0265f59c
Changes
85
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
123 additions
and
130 deletions
+123
-130
official/vision/image_classification/resnet/resnet_config.py
official/vision/image_classification/resnet/resnet_config.py
+61
-0
official/vision/image_classification/resnet/resnet_ctl_imagenet_main.py
...n/image_classification/resnet/resnet_ctl_imagenet_main.py
+2
-2
official/vision/image_classification/resnet/resnet_imagenet_main.py
...ision/image_classification/resnet/resnet_imagenet_main.py
+2
-2
official/vision/image_classification/resnet/resnet_model.py
official/vision/image_classification/resnet/resnet_model.py
+56
-124
official/vision/image_classification/resnet/resnet_runnable.py
...ial/vision/image_classification/resnet/resnet_runnable.py
+2
-2
No files found.
official/vision/image_classification/resnet/resnet_config.py
0 → 100644
View file @
1f3247f4
This diff is collapsed.
Click to expand it.
official/vision/image_classification/resnet/resnet_ctl_imagenet_main.py
View file @
1f3247f4
...
@@ -119,8 +119,8 @@ def run(flags_obj):
...
@@ -119,8 +119,8 @@ def run(flags_obj):
# TODO(anj-s): Set data_format without using Keras.
# TODO(anj-s): Set data_format without using Keras.
data_format
=
flags_obj
.
data_format
data_format
=
flags_obj
.
data_format
if
data_format
is
None
:
if
data_format
is
None
:
data_format
=
(
'channels_first'
data_format
=
(
'channels_first'
if
tf
.
config
.
list_physical_devices
(
'GPU'
)
if
tf
.
test
.
is_built_with_cuda
()
else
'channels_last'
)
else
'channels_last'
)
tf
.
keras
.
backend
.
set_image_data_format
(
data_format
)
tf
.
keras
.
backend
.
set_image_data_format
(
data_format
)
strategy
=
distribution_utils
.
get_distribution_strategy
(
strategy
=
distribution_utils
.
get_distribution_strategy
(
...
...
official/vision/image_classification/resnet/resnet_imagenet_main.py
View file @
1f3247f4
...
@@ -71,8 +71,8 @@ def run(flags_obj):
...
@@ -71,8 +71,8 @@ def run(flags_obj):
data_format
=
flags_obj
.
data_format
data_format
=
flags_obj
.
data_format
if
data_format
is
None
:
if
data_format
is
None
:
data_format
=
(
'channels_first'
data_format
=
(
'channels_first'
if
tf
.
config
.
list_physical_devices
(
'GPU'
)
if
tf
.
test
.
is_built_with_cuda
()
else
'channels_last'
)
else
'channels_last'
)
tf
.
keras
.
backend
.
set_image_data_format
(
data_format
)
tf
.
keras
.
backend
.
set_image_data_format
(
data_format
)
# Configures cluster spec for distribution strategy.
# Configures cluster spec for distribution strategy.
...
...
official/vision/image_classification/resnet/resnet_model.py
View file @
1f3247f4
This diff is collapsed.
Click to expand it.
official/vision/image_classification/resnet/resnet_runnable.py
View file @
1f3247f4
...
@@ -158,9 +158,9 @@ class ResnetRunnable(standard_runnable.StandardTrainable,
...
@@ -158,9 +158,9 @@ class ResnetRunnable(standard_runnable.StandardTrainable,
loss
=
tf
.
reduce_sum
(
prediction_loss
)
*
(
1.0
/
loss
=
tf
.
reduce_sum
(
prediction_loss
)
*
(
1.0
/
self
.
flags_obj
.
batch_size
)
self
.
flags_obj
.
batch_size
)
num_replicas
=
self
.
strategy
.
num_replicas_in_sync
num_replicas
=
self
.
strategy
.
num_replicas_in_sync
l2_weight_decay
=
1e-4
if
self
.
flags_obj
.
single_l2_loss_op
:
if
self
.
flags_obj
.
single_l2_loss_op
:
l2_loss
=
resnet_model
.
L2_WEIGHT_DECAY
*
2
*
tf
.
add_n
([
l2_loss
=
l2_weight_decay
*
2
*
tf
.
add_n
([
tf
.
nn
.
l2_loss
(
v
)
tf
.
nn
.
l2_loss
(
v
)
for
v
in
self
.
model
.
trainable_variables
for
v
in
self
.
model
.
trainable_variables
if
'bn'
not
in
v
.
name
if
'bn'
not
in
v
.
name
...
...
Prev
1
2
3
4
5
Next
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