=> All the output will be saved at experiments/2021-10-29_04-36-07
Setting: {'model_name': 'resnet18', 'method': 'joint', 'layer_mask': None, 'lam': 1.0, 'normalization_mode': 'Z-Score', 'gpu': 0, 'multi_scale': True, 'gem': True, 'num_clinic': 20, 'epoch': 10, 'batch_size': 4, 'k': 3}
train size: 3554, val size: 888
=> Split dataset successfully: train size 3554, val size 888.
The index of validation is [2664, 3551]
=> Jointly training ...
in_features is: 512
Traceback (most recent call last):
File "train.py", line 116, in <module>
train_joint(model, train_loader, val_loader, args=args, out_dir=out_dir, writer=writer)
File "/home/cy/Prediction-on-DME-Patients-Response-to-Anti-VEGF-Treatment/train_utils.py", line 32, in train_joint
for batch_idx, data in enumerate(train_loader):
File "/home/cy/anaconda3/envs/llc/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 435, in __next__
data = self._next_data()
File "/home/cy/anaconda3/envs/llc/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1085, in _next_data
return self._process_data(data)
File "/home/cy/anaconda3/envs/llc/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1111, in _process_data
data.reraise()
File "/home/cy/anaconda3/envs/llc/lib/python3.7/site-packages/torch/_utils.py", line 428, in reraise
raise self.exc_type(msg)
TypeError: Caught TypeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/home/cy/anaconda3/envs/llc/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop
data = fetcher.fetch(index)
File "/home/cy/anaconda3/envs/llc/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/cy/anaconda3/envs/llc/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/cy/anaconda3/envs/llc/lib/python3.7/site-packages/torch/utils/data/dataset.py", line 272, in __getitem__
return self.dataset[self.indices[idx]]
File "/home/cy/Prediction-on-DME-Patients-Response-to-Anti-VEGF-Treatment/dataset.py", line 94, in __getitem__
assert os.path.exists(image_dir)
File "/home/cy/anaconda3/envs/llc/lib/python3.7/genericpath.py", line 19, in exists
os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
代码os.stat(path)的path提示要字符串、字节类型,你的应该是NoneType类型,你print一下这个path看看数据