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
Hide 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):
...
@@ -143,7 +143,7 @@ def get_filenames(is_training, data_dir):
for
i
in
range
(
128
)]
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.
"""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
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):
...
@@ -228,7 +228,7 @@ def parse_record(raw_record, is_training, dtype):
Returns:
Returns:
Tuple with processed image tensor and one-hot-encoded label tensor.
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
=
preprocess_image
(
image_buffer
=
image_buffer
,
image_buffer
=
image_buffer
,
...
@@ -256,7 +256,8 @@ def input_fn(is_training,
...
@@ -256,7 +256,8 @@ def input_fn(is_training,
input_context
=
None
,
input_context
=
None
,
drop_remainder
=
False
,
drop_remainder
=
False
,
tf_data_experimental_slack
=
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.
"""Input function which provides batches for train or eval.
Args:
Args:
...
@@ -276,11 +277,13 @@ def input_fn(is_training,
...
@@ -276,11 +277,13 @@ def input_fn(is_training,
training_dataset_cache: Whether to cache the training dataset on workers.
training_dataset_cache: Whether to cache the training dataset on workers.
Typically used to improve training performance when training data is in
Typically used to improve training performance when training data is in
remote storage and can fit into worker memory.
remote storage and can fit into worker memory.
filenames: Optional field for providing the file names of the TFRecords.
Returns:
Returns:
A dataset that can be used for iteration.
A dataset that can be used for iteration.
"""
"""
filenames
=
get_filenames
(
is_training
,
data_dir
)
if
filenames
is
None
:
filenames
=
get_filenames
(
is_training
,
data_dir
)
dataset
=
tf
.
data
.
Dataset
.
from_tensor_slices
(
filenames
)
dataset
=
tf
.
data
.
Dataset
.
from_tensor_slices
(
filenames
)
if
input_context
:
if
input_context
:
...
...
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