[REF] Resolve rescale mode warnings #134
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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