-
Notifications
You must be signed in to change notification settings - Fork 3
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
Shifted predictions #113
Comments
The shift in the top slices is also presented for v2.3. |
Relevant issue ivadomed/canproco#102 |
One possible cause: the resampling of some highly anisotropic data to 1mm iso. For example, the DWI data from BRNO: We observe a clear shift in the predictions: Interesting observation: when applying the resampling, there is an apparent shift close to the interface between two axial slices: whereas when the resampling happens in the middle of the slice, there is no apparent shift: Note The type of interpolation (linear vs. spline) does not make any difference Next steps:
|
I found something really interesting when trying the different padding options available during inference. Model: contrast-agnostic v2.4 used via SCT's master branch Padding options tested:
What I changed in the code -- these two lines were replaced with:
This is also consistent with my earlier investigations on dcm-zurich and sci-colorado datasets (slides). I think I should set EDIT Also tested on 1mm iso resampled images and it seems that |
Nice! 👍🏻
Do you have a hunch why |
I was surprised about this too then I realized that I wasn't applying the padding at the right step. In the
But turns out that you would have apply the padding in both these lines:
in order to have the desired effect! I have fixed that bug in this commit in my new branch. |
The changes required on the SCT side can be accessed if you checkout to my branch https://github.com/spinalcordtoolbox/spinalcordtoolbox/tree/nk/set-edge-pad-default (will open a PR once it is tested on all dcm-brno subjects and after we see consistent improvement from |
Thank you for the fix, Naga! I tested the updated edge padding on See comparison on 5 subjects (original padding vs updated edge padding): @naga-karthik, maybe you can open a PR and merge the fixed padding to the SCT master branch? |
## Description Currently, test-time preprocessing transforms for the monai models (which, at the moment, is only the contrast-agnostic model), used zero-padding during cropping and padding as in [these lines](https://github.com/spinalcordtoolbox/spinalcordtoolbox/blob/master/spinalcordtoolbox/deepseg/monai.py#L176-L177). However, @valosekj observed that zero-padding DWI images from the `dcm-brno` dataset resulted in [shifted predictions](valosekj/dcm-brno#19 (comment)). Interestingly, the shifts were only observed in the initial and final slices, suggesting that this might be sub-optimal padding issue. I experimented with different padding options as test-time [here](sct-pipeline/contrast-agnostic-softseg-spinalcord#113 (comment)) and found that `edge`-padding fixed the issue with shifted predictions. Hence, this PR updates the default padding (which is zero padding) to `edge` padding. This change should not break anything as `edge` padding is at least as good as the zero-padding (so it is not risky to make it the default). Morever, I noticed that nnUNet has also started to (subtly) make `edge` padding the default, supporting the changes in this PR. --------- Co-authored-by: Joshua Newton <[email protected]>
Some predictions are shifted in the axial plane, see notably: valosekj/dcm-brno#19
The text was updated successfully, but these errors were encountered: