pnlbwh / CNN-Diffusion-MRIBrain-Segmentation

CNN based brain masking
Other
14 stars 10 forks source link

Issues with latest improvement #41

Closed tashrifbillah closed 2 months ago

tashrifbillah commented 4 months ago

1.

/software/rocky9/CNN-Diffusion-MRIBrain-Segmentation/tests/../pipeline/dwi_masking.py:40: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  import pkg_resources
Use GPU device # 0
2024-03-18 17:23:12.865942: E tensorflow/stream_executor/cuda/cuda_blas.cc:2981] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
File exist

Can we deal with this warnings?

2. I think these warnings are the reason why it uses only CPU and not GPU. Please test in pnl-axon.

tashrifbillah commented 4 months ago

Link PR #40

RyanZurrin commented 4 months ago

Yes will start digging into this tomorrow. I have a feeling you are correct if it did not run on gpu.

tashrifbillah commented 4 months ago

More errors:

Loading sagittal model from disk...
/software/rocky9/miniconda3/envs/dmri_seg/lib/python3.9/site-packages/keras/optimizers/optimizer_v2/adam.py:114: UserWarning: The `lr` argument is deprecated, use `learning_rate` instead.
  super().__init__(name, **kwargs)
40/40 [==============================] - 43s 1s/step
Loading coronal model from disk...
40/40 [==============================] - 43s 1s/step
Loading axial model from disk...
40/40 [==============================] - 43s 1s/step
Masking Time Taken :  2.23  min
Splitting files....
Performing Muti View Aggregation...
Converting file format...
Performing ants inverse transform...
Cleaning up  /software/rocky9/CNN-Diffusion-MRIBrain-Segmentation/tests/data/Prisma/_ep_b0_bse-multi_originalMask.nii.gz
Traceback (most recent call last):
  File "/software/rocky9/CNN-Diffusion-MRIBrain-Segmentation/tests/../pipeline/../src/maskfilter.py", line 3, in <module>
    from scipy.ndimage import binary_erosion, binary_dilation, generate_binary_structure
ModuleNotFoundError: No module named 'scipy'
/software/rocky9/CNN-Diffusion-MRIBrain-Segmentation/tests/data/Prisma/_ep_b0_bse-multi_FilteredMask.nii.gz
Traceback (most recent call last):
  File "/software/rocky9/miniconda3/envs/dmri_seg/lib/python3.9/site-packages/nibabel/loadsave.py", line 100, in load
    stat_result = os.stat(filename)
FileNotFoundError: [Errno 2] No such file or directory: '/software/rocky9/CNN-Diffusion-MRIBrain-Segmentation/tests/data/Prisma/_ep_b0_bse-multi_FilteredMask.nii.gz'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/software/rocky9/CNN-Diffusion-MRIBrain-Segmentation/tests/../pipeline/dwi_masking.py", line 768, in <module>
    brain_mask_multi = npy_to_nifti(list(transformed_cases[i].split()),
  File "/software/rocky9/CNN-Diffusion-MRIBrain-Segmentation/tests/../pipeline/dwi_masking.py", line 353, in npy_to_nifti
    img = nib.load(output_mask_filtered)
  File "/software/rocky9/miniconda3/envs/dmri_seg/lib/python3.9/site-packages/nibabel/loadsave.py", line 102, in load
    raise FileNotFoundError(f"No such file or no access: '{filename}'")
FileNotFoundError: No such file or no access: '/software/rocky9/CNN-Diffusion-MRIBrain-Segmentation/tests/data/Prisma/_ep_b0_bse-multi_FilteredMask.nii.gz'
/software/rocky9/CNN-Diffusion-MRIBrain-Segmentation/tests/../pipeline/dwi_masking.py:40: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  import pkg_resources
Use GPU device # 0
2024-03-18 17:29:17.953745: E tensorflow/stream_executor/cuda/cuda_blas.cc:2981] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
tashrifbillah commented 4 months ago

Ryan, this does not use GPU on pnl-predict either.

tashrifbillah commented 4 months ago

However, I missed the scipy error within the traceback I posted yesterday. It is because of the - scikit-image==0.16.2 package you have unknowingly removed. I am going to solve it now:

ModuleNotFoundError: No module named 'scipy'
RyanZurrin commented 4 months ago

Let me look into what is going on. I know it did use the gpu there at one point, as I was watching it via nvidia-smi use it. Let me double check versions of code I was using and some other things.

tashrifbillah commented 2 months ago

No longer relevant. Thanks to Ryan for providing the correct sequence of package installation.