-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Vectorize CropAndResize #1439
base: master
Are you sure you want to change the base?
Vectorize CropAndResize #1439
Conversation
839cd0e
to
7adadc2
Compare
97e1537
to
288ad79
Compare
def get_random_transformation( | ||
self, image=None, label=None, bounding_box=None, **kwargs | ||
def get_random_transformation_batch( | ||
self, batch_size, label=None, bounding_box=None, **kwargs |
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.
if not used, removed label
and bounding_box
arguments
input_resized = tf.image.resize(image, self.target_size) | ||
output = layer(image, training=True) | ||
|
||
self.assertNotAllClose(output, input_resized) |
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.
lets instead do:
self.assertNotAllClose(output[0], output[1])
@soma2000-lang looks like the unit tests are failing! |
@LukeWood looking into this.Actually keras-cv is not properly installed in my system because after some system update the pip package did not seem to work.I am trying to fix the problem with pip right now. |
@LukeWood I am trying to fix the pip issue with my system.Till I fix this, I just run the test using Google Colab and it seems to pass. Link -https://colab.research.google.com/drive/1-TZpbQDMp1fe3mrfvouWAqH_PISf9SBh?usp=sharing it will be great if you check it once. |
5ae8c86
to
b62a339
Compare
@soma2000-lang left a comment including a merge conflict. Can you resolve? |
@LukeWood Resolved |
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.
almost ready! Please address remaining comments!
benchmarks/vectorized_crop_resize.py
Outdated
@@ -98,7 +98,7 @@ def __init__( | |||
self.force_output_dense_images = True | |||
|
|||
def get_random_transformation( | |||
self, image=None, label=None, bounding_box=None, **kwargs | |||
self, image=None,**kwargs |
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.
looks like image is also unused!
benchmarks/vectorized_crop_resize.py
Outdated
@@ -98,7 +98,7 @@ def __init__( | |||
self.force_output_dense_images = True | |||
|
|||
def get_random_transformation( | |||
self, image=None, label=None, bounding_box=None, **kwargs | |||
self, image=None,**kwargs |
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.
be sure to run ./shell/format.sh before requesting pull request reviews
9c01ece
to
dc56bf5
Compare
|
||
input_resized = tf.image.resize(image, self.target_size) | ||
output = layer(image, training=True) | ||
output[1] = input_resized |
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.
does this pass without this line?
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.
by adding:
input_resized = tf.image.resize(image, self.target_size)
output = layer(image, training=True)
output[1] = input_resized
you're no longer testing that the images are independently augmented. Please remove the assignment - if it fails it means the layer is not independently augmenting images.
|
||
self.assertAllClose(output, input_resized) | ||
|
||
def random_crop_and_resize_on_batched_image_training(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.
add test_ prefix or the test wont run
@soma2000-lang the goal is to independently augment each image. I think getting this to work will require you to update the logic a bit. |
@LukeWood I made required changes.But some tests are still failing! |
@@ -188,12 +188,12 @@ def test_augment_one_hot_segmentation_mask(self): | |||
self.assertAllClose(output["segmentation_masks"], input_mask_resized) | |||
|
|||
def test_augment_bounding_box_single(self): | |||
image = tf.zeros([20, 20, 3]) | |||
images = tf.zeros([20, 20, 3]) |
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.
this is actually a single image
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.
Yeah sorry ,will do the necessary
It looks like this is a legitimate failure - can you fix the test failures? @soma2000-lang |
@LukeWood I sent you an email 2 days back .The emIl id starts with seckroll16 .I would be really greatfull if you can check out once.😊 Regards |
@james77777778 It would be great if youvcan help me with this.I am stuck on this for long. |
Hi @soma2000-lang https://colab.research.google.com/drive/15ed5Fqn5zrQClmmuvB1DWrDGwMrHA4Ka?usp=sharing I think the vectorizing could be complete by modifying |
@james77777778 Thanks! |
@LukeWood sure!.Also sorry for the delay I will try to finish this pr soon. |
aff34ed
to
de598c8
Compare
@soma2000-lang can you please rebase with master? |
Sure |
#1415
cc @LukeWood @ianstenbit
Results