jeya-maria-jose / Medical-Transformer

Official Pytorch Code for "Medical Transformer: Gated Axial-Attention for Medical Image Segmentation" - MICCAI 2021
MIT License
791 stars 176 forks source link

The type of "args.train_dataset" and "args.val_dataset" in test.py is "None" #84

Closed Ytwo2 closed 1 year ago

Ytwo2 commented 1 year ago

When I tested it I entered the following code: python test.py --loaddirec "./my_model.pth" --val_dataset "./img/test/" --direc './test_result/' --batch_size 1 --modelname "gatedaxialunet" --imgsize 128 --gray "no"

And I got: Traceback (most recent call last): File "test.py", line 84, in <module> train_dataset = ImageToImage2D(args.train_dataset, tf_val) File "/home/Medical-Transformer/utils.py", line 130, in __init__ self.input_path = os.path.join(dataset_path, 'img') File "/usr/lib/python3.8/posixpath.py", line 76, in join a = os.fspath(a) TypeError: expected str, bytes or os.PathLike object, not NoneType

So I printed the type of "tf_val" and "args.train_dataset" and the result is as follows: val:<class 'utils.JointTransform2D'> train: None

Is it necessary to solve this problem by adding default to the front parameter design? change parser.add_argument('--train_dataset', type=str) parser.add_argument('--val_dataset', type=str) to parser.add_argument('--train_dataset', default='./path1/', type=str) parser.add_argument('--val_dataset', default='./path2/', type=str)

If so, what path do I need to put in default? Is it 'img' or 'label' or the result of training?