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

NaN in T2w softseg labels #24

Open
uzaymacar opened this issue Aug 1, 2022 · 1 comment
Open

NaN in T2w softseg labels #24

uzaymacar opened this issue Aug 1, 2022 · 1 comment
Assignees

Comments

@uzaymacar
Copy link
Contributor

Upon discovering that T2w training diverges to NaN loss with a multitude of training settings, I explored the preprocessed data and found that the following subjects contain NaN values in their T2w softseg labels:

  • sub-mniS05
  • sub-perform02

This is likely the reason for problem 2 as mentioned in our progress report.

@sandrinebedard
Copy link
Member

From my exploration, NaN values are due to a division of 0 by 0... From the coverage mask and the spinal cord sum of all contrast.

sct_maths -i sum_sc_seg.nii.gz -div sum_coverage.nii.gz -o division.nii.gz

--
Spinal Cord Toolbox (git-sb/3432-csa-pmj-perslice-c7db1123f5f4fae06d570293ebc135078329f94f)

sct_maths -i sum_sc_seg.nii.gz -div sum_coverage.nii.gz -o division.nii.gz
--

/mnt/c/Users/sb199/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_maths.py:377: RuntimeWarning: invalid value encountered in true_divide
  data_out = np.divide(data, np.prod(data_to_div, axis=-1))

I think this is actually the case for more than just those 2 subjects. The NaN values aren't in the spinal cord segmenation, just above, they should be zeros. I'll add a fix in the preprocessing script.

@sandrinebedard sandrinebedard self-assigned this Aug 1, 2022
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

No branches or pull requests

2 participants