black0017 / MedicalZooPytorch

A pytorch-based deep learning framework for multi-modal 2D/3D medical image segmentation
MIT License
1.72k stars 299 forks source link

'Namespace' object has no attribute 'samples_train' #3

Closed maddy023 closed 4 years ago

maddy023 commented 4 years ago

command: !python test_miccai_2019.py --dataset_name MICCAI_2019_pathology_challenge --nEpochs 2 --opt adam --model UNET2D

output:

2020-05-01 07:37:33.986079: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1
Traceback (most recent call last):
  File "test_miccai_2019.py", line 86, in <module>
    main()
  File "test_miccai_2019.py", line 34, in main
    path='.././datasets')
  File "/content/MedicalZooPytorch/lib/medloaders/__init__.py", line 17, in generate_datasets
    samples_train = args.samples_train
AttributeError: 'Namespace' object has no attribute 'samples_train'

updated command : !python test_miccai_2019.py --dataset_name MICCAI_2019_pathology_challenge --nEpochs 2 --opt adam --model UNET2D --samples_train 10

ouput:

usage: test_miccai_2019.py [-h] [--batchSz BATCHSZ]
                           [--dataset_name DATASET_NAME] [--nEpochs NEPOCHS]
                           [--dim DIM [DIM ...]] [--classes CLASSES]
                           [--inChannels INCHANNELS]
                           [--inModalities INMODALITIES] [--fold_id FOLD_ID]
                           [--lr LR] [--cuda] [--resume PATH]
                           [--model {VNET,VNET2,UNET3D,DENSENET1,DENSENET2,DENSENET3,HYPERDENSENET,UNET2D}]
                           [--opt {sgd,adam,rmsprop}]
test_miccai_2019.py: error: unrecognized arguments: --samples_train 10

Other way around by altering the test_miccai_2019.py code:

medical_loaders.generate_datasets(args, path='.././datasets',samples_train=samples_train,
samples_val=samples_val)

Adding samples_train and Samples_val ,rises error in generate_dataset()

iliasprc commented 4 years ago

Thanks for the comment, these two arguments were missing from the argument parser and we updated the python file test_miccai_2019.py

maddy023 commented 4 years ago

!python test_miccai_2019.py --dataset_name "miccai2019" --nEpochs 2 --opt adam --model VNET

2020-05-01 10:28:53.155633: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1
Traceback (most recent call last):
  File "test_miccai_2019.py", line 88, in <module>
    main()
  File "test_miccai_2019.py", line 34, in main
    path='.././datasets')
  File "/content/MedicalZooPytorch/lib/medloaders/__init__.py", line 40, in generate_datasets
    save=True)
  File "/content/MedicalZooPytorch/lib/medloaders/miccai_2019_pathology.py", line 34, in __init__
    image_paths, label_paths = utils.shuffle_lists(image_paths, label_paths)
  File "/content/MedicalZooPytorch/lib/utils/general.py", line 38, in shuffle_lists
    a, b = zip(*c)
ValueError: not enough values to unpack (expected 2, got 0)
maddy023 commented 4 years ago

!python test_miccai_2019.py --dataset_name ixi --nEpochs 2

2020-05-01 11:06:22.042564: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1
Traceback (most recent call last):
  File "test_miccai_2019.py", line 88, in <module>
    main()
  File "test_miccai_2019.py", line 34, in main
    path='.././datasets')
  File "/content/MedicalZooPytorch/lib/medloaders/__init__.py", line 48, in generate_datasets
    loader = IXIMRIdataset(dataset_path=path, voxels_space=args.dim, modalities=args.inModalities, save=True)
  File "/content/MedicalZooPytorch/lib/medloaders/ixi_t1_t2.py", line 43, in __init__
    self.voxels_space[2])
IndexError: tuple index out of range
black0017 commented 4 years ago

for the miccai dataset you should produce the labels first based on majority voting from the annotators i have included the mode in the miccai 2019 dataloder in lib/medloades but you have to work that out yourself. You can check my old repo here https://github.com/black0017/MICCAI-2019-Prostate-Cancer-segmentation-challenge. Based on the updates, all the rest should work. Please keep in mind that you have to modify some code based on your paths to configure it for your project. Medical data are tricky! All the best. N.A.