Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
terasakisatoshi opened this issue Sep 22, 2021 · 2 comments · Fixed by #53
Closed

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

terasakisatoshi opened this issue Sep 22, 2021 · 2 comments · Fixed by #53

Comments

@terasakisatoshi
Copy link

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
Copy link
Author

tfm = RandomCrop

image

@terasakisatoshi
Copy link
Author

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.

@mfalt mfalt mentioned this issue Sep 30, 2021
lorenzoh added a commit that referenced this issue Oct 1, 2021
Fix #52, `CenterCrop` and `RandomCrop` now work on their own as exptected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant