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
b86dff8c
Commit
b86dff8c
authored
Dec 08, 2020
by
A. Unique TensorFlower
Browse files
Internal change
PiperOrigin-RevId: 346346141
parent
6d451a79
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletion
+33
-1
official/vision/beta/modeling/backbones/spinenet.py
official/vision/beta/modeling/backbones/spinenet.py
+1
-1
official/vision/beta/modeling/backbones/spinenet_test.py
official/vision/beta/modeling/backbones/spinenet_test.py
+32
-0
No files found.
official/vision/beta/modeling/backbones/spinenet.py
View file @
b86dff8c
...
@@ -178,7 +178,7 @@ class SpineNet(tf.keras.Model):
...
@@ -178,7 +178,7 @@ class SpineNet(tf.keras.Model):
net
=
self
.
_build_stem
(
inputs
=
inputs
)
net
=
self
.
_build_stem
(
inputs
=
inputs
)
net
=
self
.
_build_scale_permuted_network
(
net
=
self
.
_build_scale_permuted_network
(
net
=
net
,
input_width
=
input_specs
.
shape
[
1
])
net
=
net
,
input_width
=
input_specs
.
shape
[
2
])
endpoints
=
self
.
_build_endpoints
(
net
=
net
)
endpoints
=
self
.
_build_endpoints
(
net
=
net
)
self
.
_output_specs
=
{
l
:
endpoints
[
l
].
get_shape
()
for
l
in
endpoints
}
self
.
_output_specs
=
{
l
:
endpoints
[
l
].
get_shape
()
for
l
in
endpoints
}
...
...
official/vision/beta/modeling/backbones/spinenet_test.py
View file @
b86dff8c
...
@@ -60,6 +60,38 @@ class SpineNetTest(parameterized.TestCase, tf.test.TestCase):
...
@@ -60,6 +60,38 @@ class SpineNetTest(parameterized.TestCase, tf.test.TestCase):
[
1
,
input_size
/
2
**
l
,
input_size
/
2
**
l
,
endpoints_num_filters
],
[
1
,
input_size
/
2
**
l
,
input_size
/
2
**
l
,
endpoints_num_filters
],
endpoints
[
str
(
l
)].
shape
.
as_list
())
endpoints
[
str
(
l
)].
shape
.
as_list
())
@
parameterized
.
parameters
(
((
128
,
128
),
(
128
,
128
)),
((
128
,
128
),
(
256
,
256
)),
((
640
,
640
),
(
896
,
1664
)),
)
def
test_load_from_different_input_specs
(
self
,
input_size_1
,
input_size_2
):
"""Test loading checkpoints with different input size."""
def
build_spinenet
(
input_size
):
tf
.
keras
.
backend
.
set_image_data_format
(
'channels_last'
)
input_specs
=
tf
.
keras
.
layers
.
InputSpec
(
shape
=
[
None
,
input_size
[
0
],
input_size
[
1
],
3
])
model
=
spinenet
.
SpineNet
(
input_specs
=
input_specs
,
min_level
=
3
,
max_level
=
7
,
endpoints_num_filters
=
384
,
resample_alpha
=
1.0
,
block_repeats
=
2
,
filter_size_scale
=
0.5
)
return
model
model_1
=
build_spinenet
(
input_size_1
)
model_2
=
build_spinenet
(
input_size_2
)
ckpt_1
=
tf
.
train
.
Checkpoint
(
backbone
=
model_1
)
ckpt_2
=
tf
.
train
.
Checkpoint
(
backbone
=
model_2
)
ckpt_path
=
self
.
get_temp_dir
()
+
'/ckpt'
ckpt_1
.
write
(
ckpt_path
)
ckpt_2
.
restore
(
ckpt_path
).
expect_partial
()
def
test_serialize_deserialize
(
self
):
def
test_serialize_deserialize
(
self
):
# Create a network object that sets all of its config options.
# Create a network object that sets all of its config options.
kwargs
=
dict
(
kwargs
=
dict
(
...
...
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