-
-
Notifications
You must be signed in to change notification settings - Fork 617
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
Warnings fixed for test_ssim.py #2360
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bibhabasumohapatra Thank you ! LGTM !
tests/ignite/metrics/test_ssim.py
Outdated
@@ -81,7 +81,7 @@ def _test_ssim(y_pred, y, data_range, kernel_size, sigma, gaussian, use_sample_c | |||
skimg_y, | |||
win_size=kernel_size, | |||
sigma=sigma, | |||
multichannel=True, | |||
channel_axis=-1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding to the doc, channel_axis=-1
is similar to multichannel=False
.
I don’t understand the reason why you replaced channel_axis=3
. Could you give some feedback on that please ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scikit-image/scikit-image#4294
in this discussion they agreed upon,
multichannel=True becomes channel_axis=-1.
multichannel=False becomes channel_axis=None.
and in the test_ssim.py
y_pred = torch.rand(8, 3, 224, 224, device=device)
_test_ssim(
y_pred, y, data_range=1.0, kernel_size=7, sigma=1.5, gaussian=False, use_sample_covariance=True, device=device
)
and inside def _test_ssim():
we are doing,
skimg_pred = y_pred.permute(0, 2, 3, 1).cpu().numpy()
So any ways I do it , whether I do channel_axis = -1 or channel_axis = 3 it would work,
but I think its more professional to write channel_axis = -1 and according to skimage discussion on this topic that I linked,
multichannel was discontinued for the reason that scikit-image/scikit-image#4294 (comment)
its my first try to contribute, please correct me if I read or interpreted anything wrong,
I think channel_axis = -1 is what we should go with,
thanks @sdesrozis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, according to the discussion, I would prefer having channel_axis=3
which seems to be a correct usage in our case.
what do you think ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as we used multichannel = True
its the hard coded version of channel_axis = -1
so that is the reason I changed , anyways its the same , and fixes the warnings and as the members of skiimage treated multichannel
I think we should treat it the same way so if in future someone refers to it, and does not check permute(0, 2, 3, 1)
and(8, 3, 224, 224)
would assume last to represent channel i.e axis = -1
(B,H,W,C) is the form we are using after permute, we say last is 'C' or 3 (4th) of 0,1,2,3 indices is 'C'.
again quoting the general take:
multichannel=True becomes channel_axis=-1.
multichannel=False becomes channel_axis=None.
like if we were using (B,C,H,W) then we would have done channel_axis = 1
,
so my take is if I am writing the code , then I would have kept channel_axis = 3
, as I am changing the depracated multichannel , so I would prefer channel_axis = -1
to be in the continuation wrt past.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the value -1 could be deprecated in the next version since it's like a patch. It's safer to have the correct usage of channel_axis
especially if you have checked the results are the same.
As you mentioned, you would be able to avoid reordering using correctly this parameter and consider the shape (B, C, W, H) with channel_axis=1
. Could you try this please ? Thanks again for your help !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great! I have done that ... lets deprecate the old permute and use channel_axis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A remark to address before approval.
as per @sdesrozis suggestion to use |
@bibhabasumohapatra thanks for the PR. Issues with mypy are unrelated. I'll fix them in #2362. Once it is merged please sync your branch with the master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @bibhabasumohapatra Thank you !
@bibhabasumohapatra @sdesrozis failure on python 3.6 seems related |
but 3.7 and 3.8 are not showing failure if I am not wrong.
.. versionchanged:: 0.16 |
Yes python 3.6 implies an old version of @vfdev-5 What do you think ? |
Removing python 3.6 from CI does not solve a potential issue, right ? OK, I see the issue is related to installed scikit-image version installed for python 3.6. Scikit-image officially dropped py36: https://pypi.org/project/scikit-image/#files Before we drop python 3.6 on our CI, here we can skip this test and merge it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @bibhabasumohapatra !
* first commit * changing channel_axis to -1 for multichannel argument * deprecate permute(0,2,3,1) instead use channel_axis=1 that is (B,C,H,W) Co-authored-by: Sylvain Desroziers <sylvain.desroziers@gmail.com> Co-authored-by: vfdev <vfdev.5@gmail.com>
Fixes #2358
Description: tests/ignite/metrics/test_ssim.py::test_ssim
/home/runner/work/ignite/ignite/tests/ignite/metrics/test_ssim.py:79: FutureWarning:
multichannel
is a deprecated argument name forstructural_similarity
. It will be removed in version 1.0.Please usechannel_axis
instead.Solved : I have changed the multichannel = True to channel_axis = -1, as multichannel is a deprecated argument.
Check list: