CBICA / BrainMaGe

Brain extraction in presence of abnormalities, using single and multiple MRI modalities
Other
32 stars 7 forks source link

Error while executing with configs #7

Closed kondratevakate closed 3 years ago

kondratevakate commented 3 years ago

While I am executing

brain_mage_run -params brainmage.cfg -test True -mode Multi-4 -dev 'cpu'

Get an error:


Weight file used : /home/mri/miniconda3/envs/brainmage/lib/python3.6/site-packages/BrainMaGe-1.0.5.dev0-py3.6.egg/BrainMaGe/weights/resunet_multi_4.pt
/home/mri/miniconda3/envs/brainmage/lib/python3.6/site-packages/BrainMaGe-1.0.5.dev0-py3.6.egg/EGG-INFO/scripts/brain_mage_run

Hostname   :None

Start Time :Thu Sep  2 16:59:30 2021

Start Stamp:1630591170.250223
Generating Test csv
Traceback (most recent call last):
  File "/home/mri/miniconda3/envs/brainmage/bin/brain_mage_run", line 4, in <module>
    __import__('pkg_resources').run_script('BrainMaGe==1.0.5.dev0', 'brain_mage_run')
  File "/home/mri/miniconda3/envs/brainmage/lib/python3.6/site-packages/pkg_resources/__init__.py", line 666, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/home/mri/miniconda3/envs/brainmage/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1463, in run_script
    exec(code, namespace, namespace)
  File "/home/mri/miniconda3/envs/brainmage/lib/python3.6/site-packages/BrainMaGe-1.0.5.dev0-py3.6.egg/EGG-INFO/scripts/brain_mage_run", line 215, in <module>
    test_multi_4.infer_multi_4(params_file, DEVICE, args.save_brain, weights)
  File "/home/mri/miniconda3/envs/brainmage/lib/python3.6/site-packages/BrainMaGe-1.0.5.dev0-py3.6.egg/BrainMaGe/tester/test_multi_4.py", line 105, in infer_multi_4
    checkpoint = torch.load(str(params["weights"]))
  File "/home/mri/miniconda3/envs/brainmage/lib/python3.6/site-packages/torch/serialization.py", line 593, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/home/mri/miniconda3/envs/brainmage/lib/python3.6/site-packages/torch/serialization.py", line 763, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, 'v'. 
kondratevakate commented 3 years ago

Same error:

brain_mage_single_run -i '/home/kondrateva/brats/preproc/test/ants_out/T1_to_SRI.nii.gz' -o '/home/kondrateva/brats/preproc/test/brainmage_out/T1_to_SRI_brainmage.nii.gz' -m '/home/kondrateva/brats/preproc/test/brainmage_out/T1_to_SRI_mask.nii.gz'

Geeks-Sid commented 3 years ago

Hi, Can you reinstall BrainMaGe and verify the weights have been downloaded and installed correctly. This error usually occurs when the model is not able to find the weights correctly. If the error still persists, please feel free to contact us again.