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
b0cf164b
Commit
b0cf164b
authored
Aug 30, 2022
by
A. Unique TensorFlower
Committed by
TF Object Detection Team
Aug 30, 2022
Browse files
Optimize data preprocessing for 3-channel images by bypassing concat in _augment_only_rgb_channels.
PiperOrigin-RevId: 471008666
parent
51078b5d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
research/object_detection/core/preprocessor.py
research/object_detection/core/preprocessor.py
+3
-0
No files found.
research/object_detection/core/preprocessor.py
View file @
b0cf164b
...
@@ -1032,6 +1032,9 @@ def random_image_scale(image,
...
@@ -1032,6 +1032,9 @@ def random_image_scale(image,
def
_augment_only_rgb_channels
(
image
,
augment_function
):
def
_augment_only_rgb_channels
(
image
,
augment_function
):
"""Augments only the RGB slice of an image with additional channels."""
"""Augments only the RGB slice of an image with additional channels."""
# Skipping the concat if possible reduces latency.
if
image
.
shape
[
2
]
==
3
:
return
augment_function
(
image
)
rgb_slice
=
image
[:,
:,
:
3
]
rgb_slice
=
image
[:,
:,
:
3
]
augmented_rgb_slice
=
augment_function
(
rgb_slice
)
augmented_rgb_slice
=
augment_function
(
rgb_slice
)
image
=
tf
.
concat
([
augmented_rgb_slice
,
image
[:,
:,
3
:]],
-
1
)
image
=
tf
.
concat
([
augmented_rgb_slice
,
image
[:,
:,
3
:]],
-
1
)
...
...
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