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
f25d4ae8
"torchvision/transforms/_functional_tensor.py" did not exist on "df6a7960920534d53d31f6d06fa89dea90cc1b50"
Commit
f25d4ae8
authored
Apr 05, 2022
by
Fan Yang
Committed by
A. Unique TensorFlower
Apr 05, 2022
Browse files
Internal change
PiperOrigin-RevId: 439732360
parent
580aa3f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
official/projects/pruning/tasks/image_classification_test.py
official/projects/pruning/tasks/image_classification_test.py
+18
-0
No files found.
official/projects/pruning/tasks/image_classification_test.py
View file @
f25d4ae8
...
...
@@ -15,6 +15,7 @@
"""Tests for image classification task."""
# pylint: disable=unused-import
import
os
import
tempfile
from
absl.testing
import
parameterized
...
...
@@ -28,6 +29,7 @@ from official.core import actions
from
official.core
import
exp_factory
from
official.modeling
import
optimization
from
official.projects.pruning.tasks
import
image_classification
as
img_cls_task
from
official.vision.dataloaders
import
tfexample_utils
class
ImageClassificationTaskTest
(
tf
.
test
.
TestCase
,
parameterized
.
TestCase
):
...
...
@@ -88,11 +90,27 @@ class ImageClassificationTaskTest(tf.test.TestCase, parameterized.TestCase):
self
.
assertIn
(
'accuracy'
,
logs
)
self
.
assertIn
(
'top_5_accuracy'
,
logs
)
def
_create_test_tfrecord
(
self
,
test_tfrecord_file
,
num_samples
,
input_image_size
):
example
=
tf
.
train
.
Example
.
FromString
(
tfexample_utils
.
create_classification_example
(
image_height
=
input_image_size
[
0
],
image_width
=
input_image_size
[
1
]))
examples
=
[
example
]
*
num_samples
tfexample_utils
.
dump_to_tfrecord
(
record_file
=
test_tfrecord_file
,
tf_examples
=
examples
)
@
parameterized
.
parameters
((
'resnet_imagenet_pruning'
),
(
'mobilenet_imagenet_pruning'
))
def
testTaskWithUnstructuredSparsity
(
self
,
config_name
):
test_tfrecord_file
=
os
.
path
.
join
(
self
.
get_temp_dir
(),
'cls_test.tfrecord'
)
self
.
_create_test_tfrecord
(
test_tfrecord_file
=
test_tfrecord_file
,
num_samples
=
10
,
input_image_size
=
[
224
,
224
])
config
=
exp_factory
.
get_exp_config
(
config_name
)
config
.
task
.
train_data
.
global_batch_size
=
2
config
.
task
.
validation_data
.
input_path
=
test_tfrecord_file
config
.
task
.
train_data
.
input_path
=
test_tfrecord_file
task
=
img_cls_task
.
ImageClassificationTask
(
config
.
task
)
model
=
task
.
build_model
()
...
...
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