AICONSlab / HyperMapp3r

AICONSlab's white matter hyperintensities (WMH) segmentation algorithm using CNNs
https://hypermapp3r.readthedocs.io/
GNU General Public License v3.0
16 stars 3 forks source link

Error during WMH segmentation in HyperMapp3r #5

Open miguelrivasfdez opened 1 year ago

miguelrivasfdez commented 1 year ago

Dear experts,

First of all, thank you for this tool and making your pre-trained models publicly available. I tried to conduct the WMH segmentation in one subject using a T1w and a FLAIR image of one subject using the HyperMapp3r GUI. However, I received the following warnings and errors.

Could you help me to solve this issue?.

Thank you very much in advance.

Using TensorFlow backend. QPixmap::scaled: Pixmap is a null pixmap Using TensorFlow backend. t1w path: /home/usuario/Escritorio/try/t1_4189.nii flair path: /home/usuario/Escritorio/try/mrfl_4189.nii mask path: mask path: mask path: /home/usuario/Escritorio/try/brainmask_4189.nii

running HyperMapp3r with the following command:

hypermapper seg_wmh --t1w /home/usuario/Escritorio/try/t1_4189.nii --flair /home/usuario/Escritorio/try/mrfl_4189.nii --mask /home/usuario/Escritorio/try/brainmask_4189.nii

Using TensorFlow backend.

input subject: try

pre-processing.......

Warning: input image is not in RPI or LPI orientation.. re-orienting image to standard orientation based on orient tags (please make sure they are correct) LPI

Warning: input image is not in RPI or LPI orientation.. re-orienting image to standard orientation based on orient tags (please make sure they are correct) LPI

pre-processing t1_4189

skull stripping ...

cropping ...

standardization ... mean is:962.13794 std is:315.2472

pre-processing mrfl_4189

Warning: input image is not in RPI or LPI orientation.. re-orienting image to standard orientation based on orient tags (please make sure they are correct) LPI

skull stripping ...

cropping ...

standardization ... mean is:989.2982 std is:353.02637

resmapling ...

resmapling ...

predicting WMH segmentation using MC Dropout with 20 samples 0

loading pre-trained model WARNING:tensorflow:From /home/usuario/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:497: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

WARNING:tensorflow:From /home/usuario/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:3636: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.

WARNING:tensorflow:From /home/usuario/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:228: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.

WARNING:tensorflow:From /home/usuario/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:159: The name tf.get_default_session is deprecated. Please use tf.compat.v1.get_default_session instead.

WARNING:tensorflow:From /home/usuario/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:164: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

WARNING:tensorflow:From /home/usuario/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:169: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

WARNING:tensorflow:From /home/usuario/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:173: The name tf.global_variables is deprecated. Please use tf.compat.v1.global_variables instead.

WARNING:tensorflow:From /home/usuario/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:182: The name tf.is_variable_initialized is deprecated. Please use tf.compat.v1.is_variable_initialized instead.

WARNING:tensorflow:From /home/usuario/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:189: The name tf.variables_initializer is deprecated. Please use tf.compat.v1.variables_initializer instead.

WARNING:tensorflow:From /home/usuario/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:3019: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version. Instructions for updating: Please use rate instead of keep_prob. Rate should be set to rate = 1 - keep_prob. Traceback (most recent call last): File "/home/usuario/anaconda3/bin/hypermapper", line 33, in sys.exit(load_entry_point('HyperMapp3r', 'console_scripts', 'hypermapper')()) File "/home/usuario/HyperMapp3r/hypermapper/cli.py", line 164, in main args.func(args) File "/home/usuario/HyperMapp3r/hypermapper/cli.py", line 37, in run_hypermapper hypermapper.main(args) File "/home/usuario/HyperMapp3r/hypermapper/segment/hypermapper.py", line 384, in main affine=res.affine, output_label_map=True, labels=1) File "/home/usuario/HyperMapp3r/hypermapper/deep/predict.py", line 91, in run_test_case model.load_weights(model_weights) File "/home/usuario/anaconda3/lib/python3.7/site-packages/keras/engine/topology.py", line 2622, in load_weights load_weights_from_hdf5_group(f, self.layers) File "/home/usuario/anaconda3/lib/python3.7/site-packages/keras/engine/topology.py", line 3090, in load_weights_from_hdf5_group original_keras_version = f.attrs['keras_version'].decode('utf8') AttributeError: 'str' object has no attribute 'decode'

annchenknodt commented 10 months ago

I'm trying out this tool now, and ran into the same problem. Posting the solution that worked for me for anyone else who ends up here. it's due to python version differences, as described here

Just swap in your /path/to/site-packages ( /home/usuario/anaconda3/lib/python3.7/site-packages in the above) and run this line: sed -i.bak "s/.decode('utf8')//g" /path/to/site-packages/keras/engine/topology.py