8000 pre builds broken by scipy 1.6.0rc1 · Issue #5130 · scikit-image/scikit-image · GitHub
[go: up one dir, main page]

Skip to content

pre builds broken by scipy 1.6.0rc1 #5130

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

Closed
jni opened this issue Dec 12, 2020 · 4 comments · Fixed by #5131
Closed

pre builds broken by scipy 1.6.0rc1 #5130

jni opened this issue Dec 12, 2020 · 4 comments · Fixed by #5131

Comments

@jni
Copy link
Member
jni commented Dec 12, 2020

Description

The release of scipy 1.6.0rc1 has broken our builds, see e.g. here. The failing test is skimage/segmentation/tests/test_boundaries.py::test_mark_boundaries_subpixel. As I recall that function depends on a rather precise interpretation of the sizes given to ndi.zoom, so I expect that the culprit lies in recent (positive!) changes by @grlee77 to how SciPy handles interpolation. Probably a +1 can be removed somewhere and we can move on! 🤞

@grlee77
Copy link
Contributor
grlee77 commented Dec 12, 2020

It looks like inside mark_boundaries there is a call to ndi.zoom with mode='reflect'. This mode has had a long-standing bug in SciPy that was finally resolved with 1.6 in scipy/scipy#12767. In short the behavior of reflect was fixed from behaving like the top left panel in scipy/scipy#2640 (comment) to the expected behavior in the top middle panel.

Do you know how the expected result for this test was originally generated? If it relied on this erroneous behavior then we probably just need to regenerate the reference. I will take a closer look in a bit, but if it is only this boundary change then the central part of the image should still match the refernce, but a couple pixel width at the border could be different.

@grlee77
Copy link
Contributor
grlee77 commented Dec 12, 2020

The simplest solution is probably to just change from 'reflect' to 'mirror' at this line:

marked = ndi.zoom(marked, [2 - 1/s for s in marked.shape[:-1]] + [1],
mode='reflect')

I verified that this will pass with the existing test data. There is actually a separate issue from the one above in that zoom never requested coordinate locations outside the original image bounds. However, the interpolation kernel does extend past the image boundary. For this case, in SciPy, the boundary mode was previously ALWAYS hardcoded to mirror when the center pixel of the interpolation kernel is within the image, but some portions of the filter kernel extended outside the boundary! In a subsequent commit, this was fixed, so we either have to update the reference result or switch the function to use mode='mirror' to get a result identical to the existing reference.

Let me know which you think is preferred. I don't see a strong reason not to use 'mirror' instead of reflect here, so maybe best to just switch it internally so that user results remain consistent across scikit-image versions.

@jni
Copy link
Member Author
jni commented Dec 12, 2020

I've approved #5131 which implements 'mirror', but writing it here for reference. Thank you @grlee77!

@jni
Copy link
Member Author
jni commented Dec 12, 2020

Specifically, I agree that it makes pretty much no difference to the end result here. =)

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.

2 participants
0