FluxML / DataAugmentation.jl

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

Make Flips ND compatible and fix ND ScaleKeepAspect, ScaleFixed and PinOrigin #75

Open itan1 opened 1 year ago

itan1 commented 1 year ago

The transforms Rotate and Reflect are still only 2D compatible.

closes #74

itan1 commented 1 year ago

Thank you for the feedback :)

Yes you're right, Zoom is not affected. Only Flip is added and I fixed a small bug in ScaleFixed, ScaleKeepAspect and PinOrigin.

I just added 2 tests for images where the flip dimension has size 1, but I ran into a BoundsError in Interpolations.jl. Applying the flip transform fails, both for 2D and 3D. I could not reproduce the error in the REPL but apparently during tests Julia always uses bounds checking. That explains why it only occurs in the tests. I haven't found the exact reason yet but will have another look.

itan1 commented 1 year ago

The arrays with singleton dimensions did not work well with Interpolations.jl, they give bounds errors during testing.

Instead of the singleton tests I checked the flipped image pixel values by reverse indexing and added a test to check that double flipping results in the original image.

CarloLucibello commented 1 year ago

@lorenzoh can this be merged?