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
a76bc125
Commit
a76bc125
authored
Jan 10, 2020
by
Allen Wang
Committed by
A. Unique TensorFlower
Jan 10, 2020
Browse files
Internal Changes.
PiperOrigin-RevId: 289172941
parent
7124ed12
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
official/vision/image_classification/imagenet_preprocessing.py
...ial/vision/image_classification/imagenet_preprocessing.py
+7
-4
No files found.
official/vision/image_classification/imagenet_preprocessing.py
View file @
a76bc125
...
...
@@ -143,7 +143,7 @@ def get_filenames(is_training, data_dir):
for
i
in
range
(
128
)]
def
_
parse_example_proto
(
example_serialized
):
def
parse_example_proto
(
example_serialized
):
"""Parses an Example proto containing a training example of an image.
The output of the build_image_data.py image preprocessing script is a dataset
...
...
@@ -228,7 +228,7 @@ def parse_record(raw_record, is_training, dtype):
Returns:
Tuple with processed image tensor and one-hot-encoded label tensor.
"""
image_buffer
,
label
,
bbox
=
_
parse_example_proto
(
raw_record
)
image_buffer
,
label
,
bbox
=
parse_example_proto
(
raw_record
)
image
=
preprocess_image
(
image_buffer
=
image_buffer
,
...
...
@@ -256,7 +256,8 @@ def input_fn(is_training,
input_context
=
None
,
drop_remainder
=
False
,
tf_data_experimental_slack
=
False
,
training_dataset_cache
=
False
):
training_dataset_cache
=
False
,
filenames
=
None
):
"""Input function which provides batches for train or eval.
Args:
...
...
@@ -276,10 +277,12 @@ def input_fn(is_training,
training_dataset_cache: Whether to cache the training dataset on workers.
Typically used to improve training performance when training data is in
remote storage and can fit into worker memory.
filenames: Optional field for providing the file names of the TFRecords.
Returns:
A dataset that can be used for iteration.
"""
if
filenames
is
None
:
filenames
=
get_filenames
(
is_training
,
data_dir
)
dataset
=
tf
.
data
.
Dataset
.
from_tensor_slices
(
filenames
)
...
...
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