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
b86ffb12
Commit
b86ffb12
authored
Mar 18, 2020
by
Hongkun Yu
Committed by
A. Unique TensorFlower
Mar 18, 2020
Browse files
Internal change
PiperOrigin-RevId: 301639338
parent
febaae9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
5 deletions
+2
-5
official/vision/image_classification/resnet/resnet_model.py
official/vision/image_classification/resnet/resnet_model.py
+2
-5
No files found.
official/vision/image_classification/resnet/resnet_model.py
View file @
b86ffb12
...
@@ -255,9 +255,7 @@ def resnet50(num_classes,
...
@@ -255,9 +255,7 @@ def resnet50(num_classes,
x
=
img_input
x
=
img_input
if
backend
.
image_data_format
()
==
'channels_first'
:
if
backend
.
image_data_format
()
==
'channels_first'
:
x
=
layers
.
Lambda
(
x
=
layers
.
Permute
((
3
,
1
,
2
))(
x
)
lambda
x
:
backend
.
permute_dimensions
(
x
,
(
0
,
3
,
1
,
2
)),
name
=
'transpose'
)(
x
)
bn_axis
=
1
bn_axis
=
1
else
:
# channels_last
else
:
# channels_last
bn_axis
=
3
bn_axis
=
3
...
@@ -382,8 +380,7 @@ def resnet50(num_classes,
...
@@ -382,8 +380,7 @@ def resnet50(num_classes,
block
=
'c'
,
block
=
'c'
,
use_l2_regularizer
=
use_l2_regularizer
)
use_l2_regularizer
=
use_l2_regularizer
)
rm_axes
=
[
1
,
2
]
if
backend
.
image_data_format
()
==
'channels_last'
else
[
2
,
3
]
x
=
layers
.
GlobalAveragePooling2D
()(
x
)
x
=
layers
.
Lambda
(
lambda
x
:
backend
.
mean
(
x
,
rm_axes
),
name
=
'reduce_mean'
)(
x
)
x
=
layers
.
Dense
(
x
=
layers
.
Dense
(
num_classes
,
num_classes
,
kernel_initializer
=
initializers
.
RandomNormal
(
stddev
=
0.01
),
kernel_initializer
=
initializers
.
RandomNormal
(
stddev
=
0.01
),
...
...
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