Improve Cutout augmentation
Random Erasing (Paper, Code) is an interesting augmentation which would be nice-to-have. Since Cutout already has similar functionality, I am proposing to extend it in several ways to allow more flexibility and improve user experience. There are several ways Cutout could be improved:
- [x] Allow cutting out a random number of regions of random size (sample
num_holesand[height, width]from uniform random distribution). - [x] Support more targets such as masks, bounding boxes and keypoints.
- [ ] Allow user to specify the patch modification: e.g. just zero out (like
Cutoutcurrently does), fill each channel with it's mean or take user-provided mean values as an argument (this is how Random Erasure is currently done). I'm not sure whether it fits the API of Cutout or not, but it would be even better to support applying other augmentations to the region: e.g. use color jitter/blur/any other distortion.
Allow cutting out a random number of regions of random size (sample num_holes and [height, width] from uniform random distribution). is implemented => good enough.
Let's merge it and work on the other modifications like extra targets and patch modifications later. (You may keep this feature request so that we would not forget.)
Can we fill the regions with random noise (pixel-level) instead of a value? From the documentation it seems like it just accepts a scalar value to fill in.
@ogencoglu you can have the desired transform using Lambda
Very interested in extending cutout to be applied to masks. Seems like it would be trivial to implement. Is there any reason for this not already being an option? I can spend some time implementing it if need be and send a pull request
CoarseDropout works on all targets, inluding masks, bounding boxes and keypoints
If fill_value = random, generate random noise to fill the hole