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
b5286d69
Commit
b5286d69
authored
Apr 14, 2022
by
A. Unique TensorFlower
Browse files
Internal change.
PiperOrigin-RevId: 441761682
parent
471451cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
official/vision/data/create_coco_tf_record.py
official/vision/data/create_coco_tf_record.py
+1
-1
official/vision/data/tfrecord_lib.py
official/vision/data/tfrecord_lib.py
+5
-2
No files found.
official/vision/data/create_coco_tf_record.py
View file @
b5286d69
...
...
@@ -68,7 +68,7 @@ flags.DEFINE_boolean(
'default: False.'
)
flags
.
DEFINE_string
(
'output_file_prefix'
,
'/tmp/train'
,
'Path to output file'
)
flags
.
DEFINE_integer
(
'num_shards'
,
32
,
'Number of shards for output file.'
)
_NUM_PROCESSES
=
flags
.
DEFINE_
string
(
_NUM_PROCESSES
=
flags
.
DEFINE_
integer
(
'num_processes'
,
None
,
(
'Number of parallel processes to use. '
'If set to 0, disables multi-processing.'
))
...
...
official/vision/data/tfrecord_lib.py
View file @
b5286d69
...
...
@@ -26,6 +26,9 @@ import tensorflow as tf
import
multiprocessing
as
mp
LOG_EVERY
=
100
def
convert_to_feature
(
value
,
value_type
=
None
):
"""Converts the given python object to a tf.train.Feature.
...
...
@@ -147,7 +150,7 @@ def write_tf_record_dataset(output_path, annotation_iterator,
total_num_annotations_skipped
=
0
if
multiple_processes
is
None
or
multiple_processes
>
0
:
pool
=
g3_mp
.
get_context
(
g3_mp
.
ABSL_FORKSERVER
)
.
Pool
(
pool
=
mp
.
Pool
(
processes
=
multiple_processes
)
if
unpack_arguments
:
tf_example_iterator
=
pool
.
starmap
(
process_func
,
annotation_iterator
)
...
...
@@ -161,7 +164,7 @@ def write_tf_record_dataset(output_path, annotation_iterator,
for
idx
,
(
tf_example
,
num_annotations_skipped
)
in
enumerate
(
tf_example_iterator
):
if
idx
%
100
==
0
:
if
idx
%
LOG_EVERY
==
0
:
logging
.
info
(
'On image %d'
,
idx
)
total_num_annotations_skipped
+=
num_annotations_skipped
...
...
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