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
Resdnn inference #2520
Resdnn inference #2520
Conversation
Wow, Thank you for doing this! I started this morning to reshape, rebase, etc #2123. Should I continue? Otherwise, I can do a PR on your PR for some changes. Concerning this PR, you need to put Tensorflow as an optional dependency and add some tests. |
Can you tell us more ? |
Hello @frheault, Thank you for updating !
Comment last updated at 2022-03-08 22:02:25 UTC |
@skoudoro I think this PR should be the main one, I removed the training and changed the organization of the files. As for the test, I can't seem to run pytest on my computer. |
@frheault : this is often the sign of a borked numpy installation. What version of numpy are you running there? What happens if you upgrade numpy in that env? |
Also, have you seen my PR in your branch ? frheault#1 Just doing some small correction Otherwise, I agree with @arokem, Can you share your file to see if we reproduce the same issue. |
@skoudoro the test file is now in the PR (dipy 1.21, tensorflow 2.8, the rest is attached) The test are running fine without (I tried reinstalling numpy --with-binary and did not change a thing) |
…nto pr/frheault/2520
I do not succeed to generate your issue. When I do Also, do not forget to look and merge at some of my corrections in your PR frheault#1 |
@skoudoro I will merge your PR, but keep the nibabel load/save. |
Interesting feedback, you are not the first one, can you tell me why? What is the biggest pain or misleading information with these 2 functions? |
Resdnn Inference: Fix importing and update code
Also, the goal is to keep all tutorials consistent, using the same functionality for now. |
In your list, I see
From a search around the net, it seems that the issue you're seeing usually arises with tensorflow and numpy<1.16. I wonder if there is an issue with versions higher than some number as well... @skoudoro : what version of numpy are you working with? |
just created a new env. So |
Codecov Report
@@ Coverage Diff @@
## master #2520 +/- ##
==========================================
+ Coverage 84.89% 85.09% +0.20%
==========================================
Files 128 129 +1
Lines 17482 17578 +96
Branches 2982 2994 +12
==========================================
+ Hits 14841 14958 +117
+ Misses 1962 1924 -38
- Partials 679 696 +17
|
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.
tmp_sf = sh_to_sf(sh=tmp_sh, sphere=sphere, | ||
basis_type=self.basis_type, | ||
sh_order=self.sh_order) | ||
tmp_sf[tmp_sf < 0] = 0 | ||
tmp_sh = sf_to_sh(tmp_sf, sphere, smooth=0.0006, | ||
basis_type=self.basis_type, | ||
sh_order=self.sh_order) |
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.
this is strange to me. Why do you need to convert it and then come back?
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.
The model does predict negative fodf value (as SF), simply because this was not a constrained included in the original training/model.
But from SH you cannot remove negative value on SF, so you need to evaluate the SH, threshold, then fit new SH again.
Sub-optimal, yes. But necessary (I 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.
Thanks for implementing this. Can't wait to try this out.
I had a few comments and suggestions
@skoudoro I added the |
Is there any additional comment for this PR? |
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.
Here is the PR frheault#2 @frheault, Feel free to merge it. |
Address Elef comment to RESDNN
Thank you @frheault for this work. All concerns have been addressed so I am going ahead a merge this PR. |
This PR is replacing #2123 and contains only the inference, no training.
It contains a model for [1] to predict fODF from raw DWI signal (as SH). It is not a local model like CSD or DTI, but the class has a fit function to make it easy to use on whole volumes.
This PR contains a fetcher for the weights, the predict/fit functions in the class, an example and simple tests.
[1] Nath, V., Schilling, K. G., Parvathaneni, P., Hansen, C. B., Hainline, A. E., Huo, Y., ... & Stepniewska, I. (2019). Deep learning reveals untapped information for local white-matter fiber reconstruction in diffusion-weighted MRI. Magnetic resonance imaging, 62, 220-227.
PS: I tried to run pytest, but I had difficulties. How can I efficiently check if the docstring and tests are right and up to the standard?