-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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
Add random_sharpness processing layer #20697
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20697 +/- ##
=======================================
Coverage 81.95% 81.95%
=======================================
Files 546 547 +1
Lines 50966 51036 +70
Branches 7884 7893 +9
=======================================
+ Hits 41768 41826 +58
- Misses 7278 7285 +7
- Partials 1920 1925 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
def transform_images(self, images, transformation=None, training=True): | ||
if training: | ||
if self.data_format == "channels_first": | ||
images = self.backend.numpy.swapaxes(images, -3, -1) |
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.
{{function_node __wrapped__DepthwiseConv2dNative_device_/job:localhost/replica:0/task:0/device:CPU:0}} Depthwise convolution on CPU is only supported for NHWC format [Op:DepthwiseConv2dNative] name:
To resolve this error, I adjusted the image axis based on the data_format to ensure compatibility with the depthwise_conv operation. This adjustment was necessary because depthwise convolution on CPU is only supported in the NHWC format.
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.
Your approach of transposing to channels_last and then transposing back again is good.
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 for the contribution!
def transform_images(self, images, transformation=None, training=True): | ||
if training: | ||
if self.data_format == "channels_first": | ||
images = self.backend.numpy.swapaxes(images, -3, -1) |
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.
Your approach of transposing to channels_last and then transposing back again is good.
I implemented the RandomSharpness image processing feature before working on rand_augment, as it includes related image processing functionalities.
Here is my gist