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
8ddb4f00
Commit
8ddb4f00
authored
Aug 13, 2020
by
Allen Wang
Committed by
A. Unique TensorFlower
Aug 13, 2020
Browse files
Add in ImageNet dataset config info and a try/catch for dataset info in case of connection error.
PiperOrigin-RevId: 326534159
parent
2444a510
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
official/vision/image_classification/dataset_factory.py
official/vision/image_classification/dataset_factory.py
+11
-2
No files found.
official/vision/image_classification/dataset_factory.py
View file @
8ddb4f00
...
...
@@ -143,6 +143,9 @@ class ImageNetConfig(DatasetConfig):
# Note: for large datasets like ImageNet, using records is faster than tfds
builder
:
str
=
'records'
image_size
:
int
=
224
num_channels
:
int
=
3
num_examples
:
int
=
1281167
num_classes
:
int
=
1000
batch_size
:
int
=
128
...
...
@@ -267,8 +270,14 @@ class DatasetBuilder:
@
property
def
info
(
self
)
->
tfds
.
core
.
DatasetInfo
:
"""The TFDS dataset info, if available."""
if
self
.
builder_info
is
None
:
self
.
builder_info
=
tfds
.
builder
(
self
.
config
.
name
).
info
try
:
if
self
.
builder_info
is
None
:
self
.
builder_info
=
tfds
.
builder
(
self
.
config
.
name
).
info
except
ConnectionError
as
e
:
logging
.
error
(
'Failed to use TFDS to load info. Please set dataset info '
'(image_size, num_channels, num_examples, num_classes) in '
'the dataset config.'
)
raise
e
return
self
.
builder_info
def
build
(
self
,
strategy
:
tf
.
distribute
.
Strategy
=
None
)
->
tf
.
data
.
Dataset
:
...
...
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