cszn / KAIR

Image Restoration Toolbox (PyTorch). Training and testing codes for DPIR, USRNet, DnCNN, FFDNet, SRMD, DPSR, BSRGAN, SwinIR
https://cszn.github.io/
MIT License
2.89k stars 619 forks source link

Code is not runnig #181

Open izadi0018 opened 4 months ago

izadi0018 commented 4 months ago

I have the following problem AttributeError: Caught AttributeError in DataLoader worker process 0. Original Traceback (most recent call last):  File "/share/apps/eb/PyTorch/2.2.0-Py3.10.8/lib/python3.10/site-packages/torch/utils/data/_utils/worker.py", line 308, in _worker_loop   data = fetcher.fetch(index)  File "/share/apps/eb/PyTorch/2.2.0-Py3.10.8/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 51, in fetch   data = [self.dataset[idx] for idx in possibly_batched_index]  File "/share/apps/eb/PyTorch/2.2.0-Py3.10.8/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 51, in   data = [self.dataset[idx] for idx in possibly_batched_index]  File "/home/u111197/codes/data/dataset_sr.py", line 42, in getitem   img_H = util.imread_uint(H_path, self.n_channels)  File "/home/u111197/codes/utils/utils_image.py", line 197, in imread_uint   if img.ndim == 2: AttributeError: 'NoneType' object has no attribute 'ndim

schaoyang340 commented 4 months ago

I have the following problem AttributeError: Caught AttributeError in DataLoader worker process 0. Original Traceback (most recent call last): File "/share/apps/eb/PyTorch/2.2.0-Py3.10.8/lib/python3.10/site-packages/torch/utils/data/_utils/worker.py", line 308, in _worker_loop data = fetcher.fetch(index) File "/share/apps/eb/PyTorch/2.2.0-Py3.10.8/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 51, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/share/apps/eb/PyTorch/2.2.0-Py3.10.8/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 51, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/u111197/codes/data/dataset_sr.py", line 42, in getitem img_H = util.imread_uint(H_path, self.n_channels) File "/home/u111197/codes/utils/utils_image.py", line 197, in imread_uint if img.ndim == 2: AttributeError: 'NoneType' object has no attribute 'ndim

Friend, your problem seems to be that the path of the test data is not set correctly. In the KAIR project, the names of the test data files used by different methods are different.

You can view the testset_name attribute in the running code to see which data file name is used by default.