ellisdg / 3DUnetCNN

Pytorch 3D U-Net Convolution Neural Network (CNN) designed for medical image segmentation
MIT License
1.89k stars 648 forks source link

Error #283

Closed antdelmas closed 3 years ago

antdelmas commented 3 years ago

Dear all,

Thenk you a lot for your impressive work, for me, who begin in deep learning and work on medical image segmentation, it is a priceless source of information. I am firstly trying to apply your model to a simple dataset of brain mask: training on 256x256x256 nii MRI image and target on 256x256x256 segmented brain masks. I get the config json from autoimplant2020 example and have this error: """"""""""""""""""""""""

File "E:\Documents\Workspace\3DUnetCNN_github\unet3d\scripts\train.py", line 217, in main()

File "E:\Documents\Workspace\3DUnetCNN_github\unet3d\scripts\train.py", line 208, in main run_training(package, config, namespace.model_filename, namespace.training_log_filename,

File "E:\Documents\Workspace\3DUnetCNN_github\unet3d\train\train.py", line 17, in run_training_with_package return run_training(*args, **kwargs)

File "E:\Documents\Workspace\3DUnetCNN_github\unet3d\train\pytorch.py", line 152, in run_pytorch_training train(model=model, optimizer=optimizer, criterion=criterion, n_epochs=config["n_epochs"], verbose=bool(verbose),

File "E:\Documents\Workspace\3DUnetCNN_github\unet3d\train\pytorch.py", line 209, in train loss = epoch_training(training_loader, model, criterion, optimizer=optimizer, epoch=epoch, n_gpus=n_gpus,

File "E:\Documents\Workspace\3DUnetCNN_github\unet3d\train\pytorch_training_utils.py", line 33, in epoch_training for i, (images, target) in enumerate(train_loader):

File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 352, in iter return self._get_iterator()

File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 294, in _get_iterator return _MultiProcessingDataLoaderIter(self)

File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 801, in init w.start()

File "C:\ProgramData\Anaconda3\lib\multiprocessing\process.py", line 121, in start self._popen = self._Popen(self)

File "C:\ProgramData\Anaconda3\lib\multiprocessing\context.py", line 224, in _Popen return _default_context.get_context().Process._Popen(process_obj)

File "C:\ProgramData\Anaconda3\lib\multiprocessing\context.py", line 327, in _Popen return Popen(process_obj)

File "C:\ProgramData\Anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 93, in init reduction.dump(process_obj, to_child)

File "C:\ProgramData\Anaconda3\lib\multiprocessing\reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj)

AttributeError: Can't pickle local object 'normalization_name_to_function..' """""""""""""""""""""""""""

Do you have an idea of the problem?

Nextly, I try to run the autoimplant 2020 example. After downloading the dataset I have an error concerning the num_samples on the dataset. """"""""""""""""""""""""

File "E:\Documents\Workspace\3DUnetCNN_github\unet3d\scripts\train.py", line 217, in main()

File "E:\Documents\Workspace\3DUnetCNN_github\unet3d\scripts\train.py", line 208, in main run_training(package, config, namespace.model_filename, namespace.training_log_filename,

File "E:\Documents\Workspace\3DUnetCNN_github\unet3d\train\train.py", line 17, in run_training_with_package return run_training(*args, **kwargs)

File "E:\Documents\Workspace\3DUnetCNN_github\unet3d\train\pytorch.py", line 107, in run_pytorch_training training_loader = DataLoader(training_dataset,

File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 262, in init sampler = RandomSampler(dataset, generator=generator) # type: ignore

File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\sampler.py", line 103, in init raise ValueError("num_samples should be a positive integer "

ValueError: num_samples should be a positive integer value, but got num_samples=0 """""""""""""""""""""""" Do you have any idea about it to ?

Thank you for your attention. Best regards

ellisdg commented 3 years ago

"ValueError: num_samples should be a positive integer value, but got num_samples=0" comes up when the script can't find the data to train on. It usually can be fixed by modifying the "generate_filenames_kwargs" part of the config file.

ellisdg commented 3 years ago

As for the "_AttributeError: Can't pickle local object 'normalization_name_to_function..'", I'm not sure.

antdelmas commented 3 years ago

Thanks a lot !

SantaFlang commented 3 years ago

Do you solve the AttributeError? I have met the same problem, THX a lot

Nowavsun commented 1 year ago

“ValueError: num_samples should be a positive integer value, but got num_samples=0” 当脚本找不到要训练的数据时出现。它通常可以通过修改配置文件的“generate_filenames_kwargs”部分来修复。

how to modifying the "generate_filenames_kwargs" part of the config file,can u show the details? Thank you。

ellisdg commented 1 year ago

Can you try using the “--debug" flag? That will show you if files are not being found on your system.

I am happy to show you an example config file too if you still have questions.

From: Nowavsun @.> Date: Friday, April 7, 2023 at 1:32 AM To: ellisdg/3DUnetCNN @.> Cc: Ellis, David G @.>, Comment @.> Subject: Re: [ellisdg/3DUnetCNN] Error (#283) Non-UNMC email “ValueError: num_samples should be a positive integer value, but got num_samples=0” 当脚本找不到要训练的数据时出现。它通常可以通过修改配置文件的“generate_filenames_kwargs”部分来修复。 how to modifying the "generate_filenames_kwargs" part of the config file,can u show the details?

“ValueError: num_samples should be a positive integer value, but got num_samples=0” 当脚本找不到要训练的数据时出现。它通常可以通过修改配置文件的“generate_filenames_kwargs”部分来修复。

how to modifying the "generate_filenames_kwargs" part of the config file,can u show the details? Thank you。

— Reply to this email directly, view it on GitHub [github.com]https://urldefense.com/v3/__https:/github.com/ellisdg/3DUnetCNN/issues/283*issuecomment-1499986242__;Iw!!JkUDQA!M1iOzWjSOaU61gDcNaBq7D2wSeJu6FzSgodYuHmytq-v0sqmFt8bzv5oA8GTmG3fsw6pgjVqZYsvTRZvLCz41UmmlEE$, or unsubscribe [github.com]https://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/ACBJTEZ3X7LDCAJDXCPWWILW76YHVANCNFSM43IAT5AA__;!!JkUDQA!M1iOzWjSOaU61gDcNaBq7D2wSeJu6FzSgodYuHmytq-v0sqmFt8bzv5oA8GTmG3fsw6pgjVqZYsvTRZvLCz4FIOQ3D0$. You are receiving this because you commented.Message ID: @.***>

The information in this e-mail may be privileged and confidential, intended only for the use of the addressee(s) above. Any unauthorized use or disclosure of this information is prohibited. If you have received this e-mail by mistake, please delete it and immediately contact the sender.