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

random failure OffsetArray tests for Scale and Zoom #38

Closed
johnnychen94 opened this issue Jan 29, 2020 · 5 comments
Closed

random failure OffsetArray tests for Scale and Zoom #38

johnnychen94 opened this issue Jan 29, 2020 · 5 comments
Labels
Milestone

Comments

@johnnychen94
Copy link
Collaborator

johnnychen94 commented Jan 29, 2020

This bug is identified during the upgrade of Augmentor #31 Since that PR is growing bigger and becoming hard to review, it's better to open an issue here and fix it separately.

julia> using Augmentor, ImageCore, OffsetArrays, ImageDistances

julia> img = rand(Gray{N0f8}, 64, 64);

julia> out1 = Augmentor.applyeager(Scale(1.5), img);

julia> out2 = Augmentor.applyeager(Scale(1.5), OffsetArray(img, -1, -1));

julia> out1 == out2
false

julia> euclidean(out1, out2)
0.044884406f0

This bug might be related to upstream packages: Interpolation and ImageTransformation.jl

Update: downscale (e.g., Scale(0.2) ) is not affected.

@johnnychen94 johnnychen94 added this to the v0.6 milestone Jan 29, 2020
@johnnychen94
Copy link
Collaborator Author

This issue might not be so easy to fix, as far as I can identify at present, the accuracy issue is due to different center generated by toaffinemap. (This might not be the root reason, but I'll just post it here as log to myself)

julia> using Augmentor: toaffinemap

julia> op = Scale(1.5);

julia> img = rand(Gray{N0f8}, 64, 64);

julia> img2 = OffsetArray(img, -1, -1);

julia> toaffinemap(op, img, (1.5, 1.5))
AffineMap([1.5 0.0; 0.0 1.5], [-16.25, -16.25])

julia> toaffinemap(op, img2, (1.5, 1.5))
AffineMap([1.5 0.0; 0.0 1.5], [-15.75, -15.75])

@Evizero
Copy link
Owner

Evizero commented Jan 30, 2020

well but numerical inaccuracy should be expected though, right? The basic idea was to always apply the affine operation around the origin, if I remember correctly.

@johnnychen94
Copy link
Collaborator Author

I guess so, but since I'm not the Augmentor expert :P, I wish I could make the test pass without relaxing them.

I'm actually thinking of a workaround to this inaccuracy, that striping the offsets, applying affine operation, and adding back offsets. But that would be tricky and there might be a performance issue as well.

johnnychen94 added a commit that referenced this issue Jan 30, 2020
OffsetArray might hit accuracy issue for affine
Some affine operations (e.g., scale and zoom) might hit accuracy
issues when images are upsampled

This is a temporarily workaround to issue #38 (by disabling the tests)
johnnychen94 added a commit that referenced this issue Jan 30, 2020
OffsetArray might hit accuracy issue for affine
Some affine operations (e.g., scale and zoom) might hit accuracy
issues when images are upsampled

This is a temporarily workaround to issue #38 (by disabling the tests)
@johnnychen94
Copy link
Collaborator Author

johnnychen94 commented Jan 30, 2020

#43 does not fix this issue; it only relaxes the accuracy requirement for those identified failed test cases. Hence I'll still keep this issue open.

@johnnychen94 johnnychen94 modified the milestones: v0.6, v0.7 Jan 31, 2020
@johnnychen94
Copy link
Collaborator Author

Well, since general machine learning tasks don't really need such accuracy, I'll just close this issue...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants