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

[REF] Resolve rescale mode warnings #134

Merged
merged 3 commits into from
Oct 22, 2018
Merged

Conversation

mathieuboudreau
Copy link
Member

@mathieuboudreau mathieuboudreau commented Sep 25, 2018

When running tests and/or calling certain functions, the following warnings appeared:

/Users/mathieuboudreau/anaconda3/envs/ads36_venv/lib/python3.6/site-packages/skimage/transform/_warps.py:84: UserWarning: The default mode, 'constant', will be changed to 'reflect' in skimage 0.15.

This happens in two locations, in our rescaling data augmentation tools, and in raw_img_to_patches function.

I resolved in this branch this by explicitly setting the mode value to constant in the function calls.

However,

by looking at the documentation, it appears to me that setting it to reflect might be the behaviour that we actually want? @perone what do you think?

...

mode : {‘constant’, ‘edge’, ‘symmetric’, ‘reflect’, ‘wrap’}, optional
Points outside the boundaries of the input are filled according to the given mode. Modes match the behaviour of numpy.pad.

...

Notes

Modes ‘reflect’ and ‘symmetric’ are similar, but differ in whether the edge pixels are duplicated during the reflection. As an example, if an array has values [0, 1, 2] and was padded to the right by four values using symmetric, the result would be [0, 1, 2, 2, 1, 0, 0], while for reflect it would be [0, 1, 2, 1, 0, 1, 2].

Edit: mode='constant' is used explicitly in numerous other locations, so let's keep it constant here until we test otherwise. e.g. https://github.com/neuropoly/axondeepseg/blob/03e2a2c3ecd464a0a1c86710121e429489e0eaa4/AxonDeepSeg/data_management/data_augmentation.py#L174-L175

@coveralls
Copy link

coveralls commented Sep 25, 2018

Coverage Status

Coverage decreased (-0.04%) to 80.18% when pulling 03e2a2c on resolve_warnings into 2b2a15b on master.

@mathieuboudreau mathieuboudreau merged commit 476bb3f into master Oct 22, 2018
@mathieuboudreau mathieuboudreau deleted the resolve_warnings branch October 22, 2018 17:04
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 this pull request may close these issues.

3 participants