albumentations icon indicating copy to clipboard operation
albumentations copied to clipboard

Improve Cutout augmentation

Open kirillbobyrev opened this issue 6 years ago • 4 comments

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_holes and [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 Cutout currently 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.

kirillbobyrev avatar May 20 '19 06:05 kirillbobyrev

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.)

ternaus avatar May 20 '19 22:05 ternaus

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 avatar Aug 09 '19 07:08 ogencoglu

@ogencoglu you can have the desired transform using Lambda

ternaus avatar Aug 09 '19 15:08 ternaus

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

ryanchesler avatar Sep 21 '19 07:09 ryanchesler

CoarseDropout works on all targets, inluding masks, bounding boxes and keypoints

If fill_value = random, generate random noise to fill the hole

ternaus avatar Oct 31 '24 02:10 ternaus