Add random crop transform
See original GitHub issue🚀 Feature
Add random crop as a transformer apart from the LabelSampler
.
Motivation
I’m doing patch based segmentation. My images are relatively large 512x512x512 and I only take patches of size 128x128x64. I’m now currently applying random affine on the entire image, but this process is too slow. Therefore, it would be nice to apply a random crop to get images of size 256x256x128, then apply a random affine, then extract patches.
Or is there any other better way to reduce the compute here?
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
RandomCrop — Torchvision main documentation - PyTorch
class torchvision.transforms.RandomCrop(size, padding=None, pad_if_needed=False, fill=0, ... Crop the given image at a random location.
Read more >Why and How to Implement Random Crop Data Augmentation
Random crop is a data augmentation technique wherein we create a random subset of an original image. This helps our model generalize better ......
Read more >PyTorch – How to crop an image at a random location?
Steps · Import the required libraries. · Read the input image. · Define a transform to crop the image at random location. ·...
Read more >How to crop an image at random location in PyTorch
Cropping is a technique of removal of unwanted outer areas from an image to achieve this we use a method in python that...
Read more >Crop transforms (augmentations.crops.transforms)
* If a tuple of two int s with values a and b , then each side will be cropped/padded by a random...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
hmm… interesting. I want to give it shot and try to make a PR.
Hi @fepegar, thanks for the quick reply! Yes this example sounds enough for my application. Will try it and let you know if it works still!