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

`tfm = CenterCrop`, `tfm = RandomCrop` does not work as we expected #52

Closed terasakisatoshi closed 2 years ago

terasakisatoshi commented 2 years ago

It seems tfm=CenterCrop does not crop a fixed-size region from the center.

For example, the following code displays the original imagedata, not a cropped image.

using DataAugmentation # v0.2.5
using TestImages

imagedata = testimage("lighthouse")
tfm = CenterCrop((100, 100))
image = Image(imagedata)
apply(tfm, image) |> itemdata

image

I think apply(tfm, image) |> itemdata |> size should show (100, 100).

terasakisatoshi commented 2 years ago

tfm = RandomCrop

image

terasakisatoshi commented 2 years ago

I found the following P is a instance of CoodinateTransformations.IdentityTransformation:

P = getprojection(tfm, bounds; randstate = randstate) 

where the line above is taken from apply function

https://github.com/lorenzoh/DataAugmentation.jl/blob/84838f2a49d901c218ff57b3a382cb6607f94357/src/projective/base.jl#L101-L106

therefore apply(tfm, image) just returns image. I think getprojection function has some bugs.