Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.bio.face
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.bio.face
Commits
c22532dd
Commit
c22532dd
authored
3 years ago
by
Amir MOHAMMADI
Browse files
Options
Downloads
Patches
Plain Diff
Fix autotune parameters and remove extra arguments
parent
af806b15
No related branches found
No related tags found
1 merge request
!125
Add support for distributed/multi-gpu training
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/bio/face/tensorflow/preprocessing.py
+6
-10
6 additions, 10 deletions
bob/bio/face/tensorflow/preprocessing.py
with
6 additions
and
10 deletions
bob/bio/face/tensorflow/preprocessing.py
+
6
−
10
View file @
c22532dd
...
@@ -67,8 +67,6 @@ def prepare_dataset(
...
@@ -67,8 +67,6 @@ def prepare_dataset(
output_shape
,
output_shape
,
shuffle
=
False
,
shuffle
=
False
,
augment
=
False
,
augment
=
False
,
autotune
=
tf
.
data
.
experimental
.
AUTOTUNE
,
n_cpus
=
cpu_count
(),
shuffle_buffer
=
int
(
2e4
),
shuffle_buffer
=
int
(
2e4
),
ctx
=
None
,
ctx
=
None
,
):
):
...
@@ -89,15 +87,10 @@ def prepare_dataset(
...
@@ -89,15 +87,10 @@ def prepare_dataset(
augment: bool
augment: bool
autotune: int
n_cpus: int
shuffle_buffer: int
shuffle_buffer: int
ctx: ``tf.distribute.InputContext``
ctx: ``tf.distribute.InputContext``
"""
"""
logger
.
debug
(
f
"
Using
{
n_cpus
}
cpus to prepare the tensorflow dataset
"
)
ds
=
tf
.
data
.
Dataset
.
list_files
(
ds
=
tf
.
data
.
Dataset
.
list_files
(
tf_record_paths
,
shuffle
=
shuffle
if
ctx
is
None
else
False
tf_record_paths
,
shuffle
=
shuffle
if
ctx
is
None
else
False
...
@@ -117,7 +110,10 @@ def prepare_dataset(
...
@@ -117,7 +110,10 @@ def prepare_dataset(
ignore_order
.
experimental_deterministic
=
False
ignore_order
.
experimental_deterministic
=
False
ds
=
ds
.
with_options
(
ignore_order
)
ds
=
ds
.
with_options
(
ignore_order
)
ds
=
ds
.
map
(
partial
(
decode_tfrecords
,
data_shape
=
data_shape
,
num_parallel_calls
=
tf
.
data
.
AUTOTUNE
))
ds
=
ds
.
map
(
partial
(
decode_tfrecords
,
data_shape
=
data_shape
),
num_parallel_calls
=
tf
.
data
.
AUTOTUNE
,
)
if
shuffle
:
if
shuffle
:
ds
=
ds
.
shuffle
(
shuffle_buffer
)
ds
=
ds
.
shuffle
(
shuffle_buffer
)
...
@@ -126,8 +122,8 @@ def prepare_dataset(
...
@@ -126,8 +122,8 @@ def prepare_dataset(
preprocessor
=
get_preprocessor
(
output_shape
)
preprocessor
=
get_preprocessor
(
output_shape
)
ds
=
ds
.
batch
(
batch_size
).
map
(
ds
=
ds
.
batch
(
batch_size
).
map
(
partial
(
preprocess
,
preprocessor
,
augment
=
augment
),
partial
(
preprocess
,
preprocessor
,
augment
=
augment
),
num_parallel_calls
=
autotune
,
num_parallel_calls
=
tf
.
data
.
AUTOTUNE
,
)
)
# Use buffered prefecting on all datasets
# Use buffered prefecting on all datasets
return
ds
.
prefetch
(
buffer_size
=
autotune
)
return
ds
.
prefetch
(
buffer_size
=
tf
.
data
.
AUTOTUNE
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment