FluxML / DataAugmentation.jl

Flexible data augmentation library for machine and deep learning
https://fluxml.ai/DataAugmentation.jl/dev/
MIT License
41 stars 18 forks source link

RandomCrop transform msssing one offset position #68

Closed donlzx closed 2 years ago

donlzx commented 2 years ago

RandomCrop returns uneven cropping for small images (e.g. MNIST and CIFAR-10/100), thus yielding sub-optimal performance in training.

For example, cropping 32x32 images from 36x36 images should have bound offsets [0, 1, 2, 3, 4]. However, currently only [0, 1, 2, 3] is used.

Here are 20 images generated using RandomCrop with DataAugmentation v0.2.8. The original images (32x32 in size) are padded by 2 pixels on each edge, randomly cropped to 32x32, and then up-sampled to 128x128 for display.

The left and top edges of the images are randomly padded by either 0/1/2 pixels, while the right edges are only paded by 0/1 pixels.

randcrop_before

lorenzoh commented 2 years ago

Thanks for reporting this! I don't have the time right now myself, unfortunately, but I'd be happy to review a pull request.

lorenzoh commented 2 years ago

Closed by #69