-
Notifications
You must be signed in to change notification settings - Fork 7.1k
[proto] Ported all transforms to the new API #6305
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
Conversation
* Added supported/unsupported data checks in the tests for cutmix/mixup * Added RandomRotation, RandomAffine transforms tests * Added tests for RandomZoomOut, Pad * Update test_prototype_transforms.py
* Added GaussianBlur transform and tests * Fixing code format * Copied correctness test
* Added random color transforms and tests * Disable smoke test for RandomSolarize, RandomAdjustSharpness
- replaced real image creation by mocks for other tests
* WIP [proto] Added functional elastic transform with tests * Added more functional tests * WIP on elastic op * Added elastic transform and tests * Added tests * Added tests for ElasticTransform
* Added image_size computation for BoundingBox.rotate if expand * Added tests
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.
Thanks @vfdev-5, looks good overall. I've added a few comments, let me know what you think. I'm not going to check the tests because as you indicate more discussions will be required over the testing strategy.
a5a66d7
to
d226e16
Compare
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, I haven't checked the testing strategy but I know @pmeier's plan is to revise it thoroughly so I'm happy to go with whatever you prefer for now.
|
||
|
||
def has_all(sample: Any, *types: Type) -> bool: | ||
return not bool(set(types) - set(_extract_types(sample))) | ||
flat_sample, _ = tree_flatten(sample) | ||
return not bool(set(types) - set([type(obj) for obj in flat_sample])) |
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 will fail if we subclass one of the types (say we subclass Feature.Image) but since that's not the intention now, we are OK to keep it as-is.
@@ -260,7 +260,7 @@ def _parse_fill( | |||
) -> Dict[str, Optional[Union[float, List[float], Tuple[float, ...]]]]: | |||
|
|||
# Process fill color for affine transforms | |||
num_bands = len(img.getbands()) | |||
num_bands = get_image_num_channels(img) |
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.
Nit: Instead of num_bands
use num_channels
?
Summary: * [proto] Added few transforms tests, part 1 (#6262) * Added supported/unsupported data checks in the tests for cutmix/mixup * Added RandomRotation, RandomAffine transforms tests * Added tests for RandomZoomOut, Pad * Update test_prototype_transforms.py * Added RandomCrop transform and tests (#6271) * [proto] Added GaussianBlur transform and tests (#6273) * Added GaussianBlur transform and tests * Fixing code format * Copied correctness test * [proto] Added random color transforms and tests (#6275) * Added random color transforms and tests * Disable smoke test for RandomSolarize, RandomAdjustSharpness * Added RandomPerspective and tests (#6284) - replaced real image creation by mocks for other tests * Added more functional tests (#6285) * [proto] Added elastic transform and tests (#6295) * WIP [proto] Added functional elastic transform with tests * Added more functional tests * WIP on elastic op * Added elastic transform and tests * Added tests * Added tests for ElasticTransform * Try to format code as in #5106 * Fixed bug in affine get_params test * Implemented RandomErase on PIL input as fallback to tensors (#6309) Added tests * Added image_size computation for BoundingBox.rotate if expand (#6319) * Added image_size computation for BoundingBox.rotate if expand * Added tests * Added erase_image_pil and eager/jit erase_image_tensor test (#6320) * Updates according to the review Reviewed By: NicolasHug Differential Revision: D38351755 fbshipit-source-id: 4b52b530f93c3dfa92326e01803665cb44003a63 Co-authored-by: Vasilis Vryniotis <[email protected]>
Description:
Please merge #6272 before this PRWhat remains
torchvision/prototype/transforms
andtest/test_prototype_*
. Mostly those to implement a missing functionality.Feature.op
for exampleBoundingBox.rotate
as they change metadata likeimage_size
.CI Failures to take into account: