Skip to content
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

Finalize APIs for RandomCropAndResize and RandomlyZoomedCrop #826

Open
LukeWood opened this issue Sep 23, 2022 · 6 comments
Open

Finalize APIs for RandomCropAndResize and RandomlyZoomedCrop #826

LukeWood opened this issue Sep 23, 2022 · 6 comments

Comments

@LukeWood
Copy link
Contributor

No description provided.

@martin-gorner
Copy link

Can we have consistent names ? Please choose between Random* and Randomly* for naming random layers.
By the way, it looks like the choice has already been made:
RandomCrop
RandomFlip
RandomTranslation
RandomRotation
RandomZoom
RandomHeight
RandomWidth
RandomContrast
RandomBrightness

@martin-gorner
Copy link

martin-gorner commented Sep 23, 2022

For RandomResizedCrop, if the only goal is to offer the same functionality as the existing (and really bad) RandomResizedCrop from TorchVision, then we should keep the same name RandomResizedCrop.
In Albumentations, they also have it and they kept the name:
https://albumentations.ai/docs/api_reference/augmentations/crops/transforms/#albumentations.augmentations.crops.transforms.RandomResizedCrop
"Torchvision's variant of crop a random part of the input and rescale it to some size"

@LukeWood
Copy link
Contributor Author

Can we have consistent names ? Please choose between Random* and Randomly* for naming random layers.
By the way, it looks like the choice has already been made:
RandomCrop
RandomFlip
RandomTranslation
RandomRotation
RandomZoom
RandomHeight
RandomWidth
RandomContrast
RandomBrightness

Thanks Martin good point - what do you recommend we name the zoom variant? RandomCropAndZoom? RandomZoomAndCrop?

@martin-gorner
Copy link

martin-gorner commented Sep 26, 2022 via email

@martin-gorner
Copy link

martin-gorner commented Sep 28, 2022

Thinking a bit more about mirroring:

We already have:
RandomCrop: does not mirror. Disrespects the zoom factor if target size is larger than the image.
RandomZoom: does mirror, or fill with zeros etc is the target size is larger than the original image.

Test Colab here

RandomZoomCrop, when all effects are dialed down, should gradually become RandomCrop (RandomZoom does not crop to a target size so cannot be an "at the limit" bahavior of RandomZoomCrop.

Therefore, to be consistent between RandomCrop and RandomZoomCrop with no zooming, RandomZoomCrop should not mirror.

It is however a valid point that some people might want the mirroring. In that case, they can easily get it by combining:

RandomZoom(height_factor=(0.0, 1.0), fill_mode="reflect") # zoom out between +0% and +100%
RandomZoomCrop(width=128, height=512, zoom_factor=(...))

Thoughts ?

PS:

  • By the way, as I was testing RandomCrom, I found multiple bugs. Filed [here] (RandomCrop bugs #860)

  • And as I was testing RandomZoom, I noticed that it uses different zooming parameters height_factor=(min, max) width_factor=(min, max) with min and max defined as relative zoom factors (no zoom = 0). This is different from what we had in mind for RandomZoomCrop. We should seek consistency.

@sachinprasadhs
Copy link
Collaborator

Thanks for reporting the issue! We have consolidated the development of KerasCV into the new KerasHub package, which supports image, text, and multi-modal models. Please read keras-team/keras-hub#1831. KerasHub will support all the core functionality of KerasCV.

KerasHub can be installed with !pip install -U keras-hub. Documentation and guides are available at keras.io/keras_hub.

With our focus shifted to KerasHub, we are not planning any further development or releases in KerasCV. If you encounter a KerasCV feature that is missing from KerasHub, or would like to propose an addition to the library, please file an issue with KerasHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants