-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added vectorized Auto Contrast implementation. #1394
Added vectorized Auto Contrast implementation. #1394
Conversation
@sebastian-sz any idea why the original is faster in some cases? This is surprising to me, perhaps vectorized-map was performing quite well here? I assume this is still better when they pass bounding boxes in too though - as it would fallback to map_fn. |
Cause it was never in the fallback list for missing You could already run if self.auto_vectorize:
return tf.vectorized_map(func, inputs, fallback_to_while_loop=False, warn=True) |
that explains why its the same speed, but I'm still surprised that its faster. Maybe its vectorizing something we didn't realize we could vectorize. |
yeah they're pretty tiny. Also - the one that relies on vectorized_map will use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you @sebastian-sz!
@LukeWood PTAL and let me know what you think about the a/b testing comment on #1392 as that applies here as well
@@ -90,3 +156,11 @@ def test_auto_contrast_properly_converts_value_range(self): | |||
|
|||
self.assertTrue(tf.math.reduce_any(ys[0] == 0.0)) | |||
self.assertTrue(tf.math.reduce_any(ys[0] == 1.0)) | |||
|
|||
def test_is_consistent_with_non_vectorized_implementation(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sebastian-sz can you please move this test case to the benchmark, instead of this test case?
Then we can merge -- thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ianstenbit done. Moved consistency test to benchmarks.
/gcbrun |
* Added vectorized Auto Contrast implementation. * Fixed typos in fn signatures. * Moved consistency test to benchmarks. * Override random transformation. * Lint code. * Added back the default get_random_transformation_batch.
What does this PR do?
Modifies
AutoContrast
to useVectorized
base image layer.Fixes #1382
Following #1392 I also added the benchmark and numerical check (compare old and new).
Benchmark results:
Before submitting
Pull Request section?
to it if that's the case.
Who can review?
@LukeWood @ianstenbit