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
87252d5a
Commit
87252d5a
authored
Aug 03, 2017
by
Derek Chow
Browse files
Clean up slim/datasets.
parent
5afeec21
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
131 additions
and
28 deletions
+131
-28
slim/BUILD
slim/BUILD
+114
-23
slim/datasets/dataset_utils.py
slim/datasets/dataset_utils.py
+16
-2
slim/datasets/download_and_convert_cifar10.py
slim/datasets/download_and_convert_cifar10.py
+1
-1
slim/datasets/download_and_convert_flowers.py
slim/datasets/download_and_convert_flowers.py
+0
-1
slim/download_and_convert_data.py
slim/download_and_convert_data.py
+0
-1
No files found.
slim/BUILD
View file @
87252d5a
# Description:
# Description:
# Contains files for loading, training and evaluating TF-Slim-based models.
# Contains files for loading, training and evaluating TF-Slim-based models.
package
(
default_visibility
=
[
package
(
default_visibility
=
[
":public"
])
"//visibility:public"
,
])
licenses
([
"notice"
])
# Apache 2.0
licenses
([
"notice"
])
# Apache 2.0
...
@@ -14,24 +12,36 @@ package_group(name = "internal")
...
@@ -14,24 +12,36 @@ package_group(name = "internal")
py_library
(
py_library
(
name
=
"dataset_utils"
,
name
=
"dataset_utils"
,
srcs
=
[
"datasets/dataset_utils.py"
],
srcs
=
[
"datasets/dataset_utils.py"
],
deps
=
[
"//tensorflow"
,
],
)
)
py_library
(
py_library
(
name
=
"download_and_convert_cifar10"
,
name
=
"download_and_convert_cifar10"
,
srcs
=
[
"datasets/download_and_convert_cifar10.py"
],
srcs
=
[
"datasets/download_and_convert_cifar10.py"
],
deps
=
[
":dataset_utils"
],
deps
=
[
":dataset_utils"
,
"//tensorflow"
,
],
)
)
py_library
(
py_library
(
name
=
"download_and_convert_flowers"
,
name
=
"download_and_convert_flowers"
,
srcs
=
[
"datasets/download_and_convert_flowers.py"
],
srcs
=
[
"datasets/download_and_convert_flowers.py"
],
deps
=
[
":dataset_utils"
],
deps
=
[
":dataset_utils"
,
"//tensorflow"
,
],
)
)
py_library
(
py_library
(
name
=
"download_and_convert_mnist"
,
name
=
"download_and_convert_mnist"
,
srcs
=
[
"datasets/download_and_convert_mnist.py"
],
srcs
=
[
"datasets/download_and_convert_mnist.py"
],
deps
=
[
":dataset_utils"
],
deps
=
[
":dataset_utils"
,
"//tensorflow"
,
],
)
)
py_binary
(
py_binary
(
...
@@ -47,25 +57,37 @@ py_binary(
...
@@ -47,25 +57,37 @@ py_binary(
py_binary
(
py_binary
(
name
=
"cifar10"
,
name
=
"cifar10"
,
srcs
=
[
"datasets/cifar10.py"
],
srcs
=
[
"datasets/cifar10.py"
],
deps
=
[
":dataset_utils"
],
deps
=
[
":dataset_utils"
,
"//tensorflow"
,
],
)
)
py_binary
(
py_binary
(
name
=
"flowers"
,
name
=
"flowers"
,
srcs
=
[
"datasets/flowers.py"
],
srcs
=
[
"datasets/flowers.py"
],
deps
=
[
":dataset_utils"
],
deps
=
[
":dataset_utils"
,
"//tensorflow"
,
],
)
)
py_binary
(
py_binary
(
name
=
"imagenet"
,
name
=
"imagenet"
,
srcs
=
[
"datasets/imagenet.py"
],
srcs
=
[
"datasets/imagenet.py"
],
deps
=
[
":dataset_utils"
],
deps
=
[
":dataset_utils"
,
"//tensorflow"
,
],
)
)
py_binary
(
py_binary
(
name
=
"mnist"
,
name
=
"mnist"
,
srcs
=
[
"datasets/mnist.py"
],
srcs
=
[
"datasets/mnist.py"
],
deps
=
[
":dataset_utils"
],
deps
=
[
":dataset_utils"
,
"//tensorflow"
,
],
)
)
py_library
(
py_library
(
...
@@ -82,33 +104,51 @@ py_library(
...
@@ -82,33 +104,51 @@ py_library(
py_library
(
py_library
(
name
=
"model_deploy"
,
name
=
"model_deploy"
,
srcs
=
[
"deployment/model_deploy.py"
],
srcs
=
[
"deployment/model_deploy.py"
],
deps
=
[
"//tensorflow"
,
],
)
)
py_test
(
py_test
(
name
=
"model_deploy_test"
,
name
=
"model_deploy_test"
,
srcs
=
[
"deployment/model_deploy_test.py"
],
srcs
=
[
"deployment/model_deploy_test.py"
],
srcs_version
=
"PY2AND3"
,
srcs_version
=
"PY2AND3"
,
deps
=
[
":model_deploy"
],
deps
=
[
":model_deploy"
,
"//tensorflow"
,
],
)
)
py_library
(
py_library
(
name
=
"cifarnet_preprocessing"
,
name
=
"cifarnet_preprocessing"
,
srcs
=
[
"preprocessing/cifarnet_preprocessing.py"
],
srcs
=
[
"preprocessing/cifarnet_preprocessing.py"
],
deps
=
[
"//tensorflow"
,
],
)
)
py_library
(
py_library
(
name
=
"inception_preprocessing"
,
name
=
"inception_preprocessing"
,
srcs
=
[
"preprocessing/inception_preprocessing.py"
],
srcs
=
[
"preprocessing/inception_preprocessing.py"
],
deps
=
[
"//tensorflow"
,
],
)
)
py_library
(
py_library
(
name
=
"lenet_preprocessing"
,
name
=
"lenet_preprocessing"
,
srcs
=
[
"preprocessing/lenet_preprocessing.py"
],
srcs
=
[
"preprocessing/lenet_preprocessing.py"
],
deps
=
[
"//tensorflow"
,
],
)
)
py_library
(
py_library
(
name
=
"vgg_preprocessing"
,
name
=
"vgg_preprocessing"
,
srcs
=
[
"preprocessing/vgg_preprocessing.py"
],
srcs
=
[
"preprocessing/vgg_preprocessing.py"
],
deps
=
[
"//tensorflow"
,
],
)
)
py_library
(
py_library
(
...
@@ -119,6 +159,7 @@ py_library(
...
@@ -119,6 +159,7 @@ py_library(
":inception_preprocessing"
,
":inception_preprocessing"
,
":lenet_preprocessing"
,
":lenet_preprocessing"
,
":vgg_preprocessing"
,
":vgg_preprocessing"
,
"//tensorflow"
,
],
],
)
)
...
@@ -150,12 +191,18 @@ py_test(
...
@@ -150,12 +191,18 @@ py_test(
size
=
"medium"
,
size
=
"medium"
,
srcs
=
[
"nets/alexnet_test.py"
],
srcs
=
[
"nets/alexnet_test.py"
],
srcs_version
=
"PY2AND3"
,
srcs_version
=
"PY2AND3"
,
deps
=
[
":alexnet"
],
deps
=
[
":alexnet"
,
"//tensorflow"
,
],
)
)
py_library
(
py_library
(
name
=
"cifarnet"
,
name
=
"cifarnet"
,
srcs
=
[
"nets/cifarnet.py"
],
srcs
=
[
"nets/cifarnet.py"
],
deps
=
[
"//tensorflow"
,
],
)
)
py_library
(
py_library
(
...
@@ -225,7 +272,10 @@ py_test(
...
@@ -225,7 +272,10 @@ py_test(
srcs
=
[
"nets/inception_v1_test.py"
],
srcs
=
[
"nets/inception_v1_test.py"
],
shard_count
=
3
,
shard_count
=
3
,
srcs_version
=
"PY2AND3"
,
srcs_version
=
"PY2AND3"
,
deps
=
[
":inception"
],
deps
=
[
":inception"
,
"//tensorflow"
,
],
)
)
py_test
(
py_test
(
...
@@ -234,7 +284,10 @@ py_test(
...
@@ -234,7 +284,10 @@ py_test(
srcs
=
[
"nets/inception_v2_test.py"
],
srcs
=
[
"nets/inception_v2_test.py"
],
shard_count
=
3
,
shard_count
=
3
,
srcs_version
=
"PY2AND3"
,
srcs_version
=
"PY2AND3"
,
deps
=
[
":inception"
],
deps
=
[
":inception"
,
"//tensorflow"
,
],
)
)
py_test
(
py_test
(
...
@@ -243,7 +296,10 @@ py_test(
...
@@ -243,7 +296,10 @@ py_test(
srcs
=
[
"nets/inception_v3_test.py"
],
srcs
=
[
"nets/inception_v3_test.py"
],
shard_count
=
3
,
shard_count
=
3
,
srcs_version
=
"PY2AND3"
,
srcs_version
=
"PY2AND3"
,
deps
=
[
":inception"
],
deps
=
[
":inception"
,
"//tensorflow"
,
],
)
)
py_test
(
py_test
(
...
@@ -252,7 +308,10 @@ py_test(
...
@@ -252,7 +308,10 @@ py_test(
srcs
=
[
"nets/inception_v4_test.py"
],
srcs
=
[
"nets/inception_v4_test.py"
],
shard_count
=
3
,
shard_count
=
3
,
srcs_version
=
"PY2AND3"
,
srcs_version
=
"PY2AND3"
,
deps
=
[
":inception"
],
deps
=
[
":inception"
,
"//tensorflow"
,
],
)
)
py_test
(
py_test
(
...
@@ -261,12 +320,18 @@ py_test(
...
@@ -261,12 +320,18 @@ py_test(
srcs
=
[
"nets/inception_resnet_v2_test.py"
],
srcs
=
[
"nets/inception_resnet_v2_test.py"
],
shard_count
=
3
,
shard_count
=
3
,
srcs_version
=
"PY2AND3"
,
srcs_version
=
"PY2AND3"
,
deps
=
[
":inception"
],
deps
=
[
":inception"
,
"//tensorflow"
,
],
)
)
py_library
(
py_library
(
name
=
"lenet"
,
name
=
"lenet"
,
srcs
=
[
"nets/lenet.py"
],
srcs
=
[
"nets/lenet.py"
],
deps
=
[
"//tensorflow"
,
],
)
)
py_library
(
py_library
(
...
@@ -283,6 +348,7 @@ py_test(
...
@@ -283,6 +348,7 @@ py_test(
srcs_version
=
"PY2AND3"
,
srcs_version
=
"PY2AND3"
,
deps
=
[
deps
=
[
":mobilenet_v1"
,
":mobilenet_v1"
,
"//tensorflow"
,
],
],
)
)
...
@@ -297,7 +363,10 @@ py_test(
...
@@ -297,7 +363,10 @@ py_test(
size
=
"medium"
,
size
=
"medium"
,
srcs
=
[
"nets/overfeat_test.py"
],
srcs
=
[
"nets/overfeat_test.py"
],
srcs_version
=
"PY2AND3"
,
srcs_version
=
"PY2AND3"
,
deps
=
[
":overfeat"
],
deps
=
[
":overfeat"
,
"//tensorflow"
,
],
)
)
py_library
(
py_library
(
...
@@ -319,8 +388,12 @@ py_test(
...
@@ -319,8 +388,12 @@ py_test(
name
=
"resnet_v1_test"
,
name
=
"resnet_v1_test"
,
size
=
"medium"
,
size
=
"medium"
,
srcs
=
[
"nets/resnet_v1_test.py"
],
srcs
=
[
"nets/resnet_v1_test.py"
],
shard_count
=
2
,
srcs_version
=
"PY2AND3"
,
srcs_version
=
"PY2AND3"
,
deps
=
[
":resnet_v1"
],
deps
=
[
":resnet_v1"
,
"//tensorflow"
,
],
)
)
py_library
(
py_library
(
...
@@ -336,8 +409,12 @@ py_test(
...
@@ -336,8 +409,12 @@ py_test(
name
=
"resnet_v2_test"
,
name
=
"resnet_v2_test"
,
size
=
"medium"
,
size
=
"medium"
,
srcs
=
[
"nets/resnet_v2_test.py"
],
srcs
=
[
"nets/resnet_v2_test.py"
],
shard_count
=
2
,
srcs_version
=
"PY2AND3"
,
srcs_version
=
"PY2AND3"
,
deps
=
[
":resnet_v2"
],
deps
=
[
":resnet_v2"
,
"//tensorflow"
,
],
)
)
py_library
(
py_library
(
...
@@ -351,21 +428,31 @@ py_test(
...
@@ -351,21 +428,31 @@ py_test(
size
=
"medium"
,
size
=
"medium"
,
srcs
=
[
"nets/vgg_test.py"
],
srcs
=
[
"nets/vgg_test.py"
],
srcs_version
=
"PY2AND3"
,
srcs_version
=
"PY2AND3"
,
deps
=
[
":vgg"
],
deps
=
[
":vgg"
,
"//tensorflow"
,
],
)
)
py_library
(
py_library
(
name
=
"nets_factory"
,
name
=
"nets_factory"
,
srcs
=
[
"nets/nets_factory.py"
],
srcs
=
[
"nets/nets_factory.py"
],
deps
=
[
":nets"
],
deps
=
[
":nets"
,
"//tensorflow"
,
],
)
)
py_test
(
py_test
(
name
=
"nets_factory_test"
,
name
=
"nets_factory_test"
,
size
=
"medium"
,
size
=
"medium"
,
srcs
=
[
"nets/nets_factory_test.py"
],
srcs
=
[
"nets/nets_factory_test.py"
],
shard_count
=
2
,
srcs_version
=
"PY2AND3"
,
srcs_version
=
"PY2AND3"
,
deps
=
[
":nets_factory"
],
deps
=
[
":nets_factory"
,
"//tensorflow"
,
],
)
)
py_binary
(
py_binary
(
...
@@ -376,6 +463,7 @@ py_binary(
...
@@ -376,6 +463,7 @@ py_binary(
":model_deploy"
,
":model_deploy"
,
":nets_factory"
,
":nets_factory"
,
":preprocessing_factory"
,
":preprocessing_factory"
,
"//tensorflow"
,
],
],
)
)
...
@@ -387,6 +475,7 @@ py_binary(
...
@@ -387,6 +475,7 @@ py_binary(
":model_deploy"
,
":model_deploy"
,
":nets_factory"
,
":nets_factory"
,
":preprocessing_factory"
,
":preprocessing_factory"
,
"//tensorflow"
,
],
],
)
)
...
@@ -396,6 +485,7 @@ py_binary(
...
@@ -396,6 +485,7 @@ py_binary(
deps
=
[
deps
=
[
":dataset_factory"
,
":dataset_factory"
,
":nets_factory"
,
":nets_factory"
,
"//tensorflow"
,
],
],
)
)
...
@@ -410,5 +500,6 @@ py_test(
...
@@ -410,5 +500,6 @@ py_test(
deps
=
[
deps
=
[
":export_inference_graph"
,
":export_inference_graph"
,
":nets_factory"
,
":nets_factory"
,
"//tensorflow"
,
],
],
)
)
slim/datasets/dataset_utils.py
View file @
87252d5a
...
@@ -34,7 +34,7 @@ def int64_feature(values):
...
@@ -34,7 +34,7 @@ def int64_feature(values):
values: A scalar or list of values.
values: A scalar or list of values.
Returns:
Returns:
a
TF-Feature.
A
TF-Feature.
"""
"""
if
not
isinstance
(
values
,
(
tuple
,
list
)):
if
not
isinstance
(
values
,
(
tuple
,
list
)):
values
=
[
values
]
values
=
[
values
]
...
@@ -48,11 +48,25 @@ def bytes_feature(values):
...
@@ -48,11 +48,25 @@ def bytes_feature(values):
values: A string.
values: A string.
Returns:
Returns:
a
TF-Feature.
A
TF-Feature.
"""
"""
return
tf
.
train
.
Feature
(
bytes_list
=
tf
.
train
.
BytesList
(
value
=
[
values
]))
return
tf
.
train
.
Feature
(
bytes_list
=
tf
.
train
.
BytesList
(
value
=
[
values
]))
def
float_feature
(
values
):
"""Returns a TF-Feature of floats.
Args:
values: A scalar of list of values.
Returns:
A TF-Feature.
"""
if
not
isinstance
(
values
,
(
tuple
,
list
)):
values
=
[
values
]
return
tf
.
train
.
Feature
(
float_list
=
tf
.
train
.
FloatList
(
value
=
values
))
def
image_to_tfexample
(
image_data
,
image_format
,
height
,
width
,
class_id
):
def
image_to_tfexample
(
image_data
,
image_format
,
height
,
width
,
class_id
):
return
tf
.
train
.
Example
(
features
=
tf
.
train
.
Features
(
feature
=
{
return
tf
.
train
.
Example
(
features
=
tf
.
train
.
Features
(
feature
=
{
'image/encoded'
:
bytes_feature
(
image_data
),
'image/encoded'
:
bytes_feature
(
image_data
),
...
...
slim/datasets/download_and_convert_cifar10.py
View file @
87252d5a
...
@@ -26,12 +26,12 @@ from __future__ import absolute_import
...
@@ -26,12 +26,12 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
division
from
__future__
import
print_function
from
__future__
import
print_function
from
six.moves
import
cPickle
import
os
import
os
import
sys
import
sys
import
tarfile
import
tarfile
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
cPickle
from
six.moves
import
urllib
from
six.moves
import
urllib
import
tensorflow
as
tf
import
tensorflow
as
tf
...
...
slim/datasets/download_and_convert_flowers.py
View file @
87252d5a
...
@@ -209,4 +209,3 @@ def run(dataset_dir):
...
@@ -209,4 +209,3 @@ def run(dataset_dir):
_clean_up_temporary_files
(
dataset_dir
)
_clean_up_temporary_files
(
dataset_dir
)
print
(
'
\n
Finished converting the Flowers dataset!'
)
print
(
'
\n
Finished converting the Flowers dataset!'
)
slim/download_and_convert_data.py
View file @
87252d5a
...
@@ -71,4 +71,3 @@ def main(_):
...
@@ -71,4 +71,3 @@ def main(_):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
tf
.
app
.
run
()
tf
.
app
.
run
()
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