sanghyun-son / EDSR-PyTorch

PyTorch version of the paper 'Enhanced Deep Residual Networks for Single Image Super-Resolution' (CVPRW 2017)
MIT License
2.43k stars 670 forks source link

training error #103

Open kikiki1121 opened 5 years ago

kikiki1121 commented 5 years ago

I will ask you a new question. Is there a problem with torch? Is there a problem with EDSR source code? I am returning 0 to num_samples when preparing dataset. Windows 10

pytorch1.0.0 python3.6

D: EDSR \ src> python main.py --model EDSR --scale 2 --save edsr_x2 - n_resblocks 32 - n_feats 256 - res_scale 0.1 - reset 'rm' is an internal or external command, It is not recognized as an operable program or batch file. Traceback (most recent call last): File "main.py", line 20, in loader = data.Data (args) File "D: \ EDSR \ src \ data \ init.py", line 30, in init pin_memory = not args.cpu File "D: \ EDSR \ src \ dataloader.py", line 167, in init worker_init_fn = worker_init_fn File "C: \ Users \ forStudent \ AppData \ Local \ conda \ conda \ envs \ ib \ site-packages \ torch \ utils \ data \ dataloader.py", line 802, in init sampler = RandomSampler (dataset) File "C: \ Users \ AppData \ Local \ conda \ conda \ envs \ lib \ site-packages \ torch \ utils \ data \ sampler.py", line 64, in init "value, but got num_samples = {}". format (self.num_samples)) ValueError: num_samples should be a positive integeral value, but got num_samples = 0

AbdulMoqeet commented 5 years ago

Facing the same error, when tried on Google Colab.

ValueError: num_samples should be a positive integeral value, but got num_samples = 0

lz28lz28 commented 5 years ago

Maybe your dataset is misplaced. I slove this problem by changing the dir_data argument in src/option.py. For example,your dir_data is '/home/xxx', and your dataset is '/home/xxx/DIV2K/...'

kevinisbest commented 5 years ago

@lz28lz28 can you explain more ? I have the same problem. My own dataset looks like this:

/home/kevin/document/dataset

└──custom2K
   ├──custom2K_train_HR
   │  ├──0000.png
   │  ├──0001.png
   │  └──...
   ├──custom2K_train_LR_bicubic
   │  ├──X2
   │  │  ├──0000x2.png
   │  │  ├──0001x2.png
   │  │  └──...
   │  ├──X3
   │  └──...
   └──custom2K_test_HR

And my option.py looks like this : image Is it correct? Thank you for your reply.

lz28lz28 commented 5 years ago

@kevinisbest Sorry,i don‘t know where your fault is.I hope that my reply may help you. My dataset looks like this: /home/jason/Documents/jason/EDSR-PyTorch-master/DIV2K/... └──DIV2K ├──DIV2K_train_HR │ ├──0000.png │ ├──0001.png │ └──... ├──DIV2K_train_LR_bicubic │ ├──X2 │ │ ├──0000x2.png │ │ ├──0001x2.png │ │ └──... │ ├──X3 │ └──... └──... My option.py looks like this : b59ehc7 bd h6 hh tq

gitman88 commented 5 years ago

Still not able to evaluate the models. De dataset are located correctly but they the PSNR reported for each epoch is NaN.

ZhengCai024 commented 5 years ago

The same problem, I also have faced. image My dataset is: image and src/option.py is: image Thanks for any suggestions.

arvindsaripalli commented 5 years ago

@ZhengCai024, your --dir_data should be "/d/EDSR/EDSR-PyTorch-master/dataset/DIV2K". See if that works for you.

arvindsaripalli commented 5 years ago

@kevinisbest @kikiki1121, I was able to resolve the issue by combining my training and testing sets. The way that the code works is that you specify a split with the --data_range flag that operates on a single folder containing both training and testing data. The assumption is that train data comes before test data, for example 1 - 800 are train and 801 - 810 are test. This implementation is confusing because it differs from how DIV2K is actually laid out.

guiji0812 commented 5 years ago

I will ask you a new question. Is there a problem with torch? Is there a problem with EDSR source code? I am returning 0 to num_samples when preparing dataset. Windows 10

pytorch1.0.0 python3.6

D: EDSR \ src> python main.py --model EDSR --scale 2 --save edsr_x2 - n_resblocks 32 - n_feats 256 - res_scale 0.1 - reset 'rm' is an internal or external command, It is not recognized as an operable program or batch file. Traceback (most recent call last): File "main.py", line 20, in loader = data.Data (args) File "D: \ EDSR \ src \ data \ init.py", line 30, in init pin_memory = not args.cpu File "D: \ EDSR \ src \ dataloader.py", line 167, in init worker_init_fn = worker_init_fn File "C: \ Users \ forStudent \ AppData \ Local \ conda \ conda \ envs \ ib \ site-packages \ torch \ utils \ data \ dataloader.py", line 802, in init sampler = RandomSampler (dataset) File "C: \ Users \ AppData \ Local \ conda \ conda \ envs \ lib \ site-packages \ torch \ utils \ data \ sampler.py", line 64, in init "value, but got num_samples = {}". format (self.num_samples)) ValueError: num_samples should be a positive integeral value, but got num_samples = 0

have you resolved this problem?I also get this error,can you give some advice?

123tanchong commented 5 years ago

Still not able to evaluate the models. De dataset are located correctly but they the PSNR reported for each epoch is NaN.

Have you solved this NaN problem

Ccbov commented 4 years ago

The same problem, I also have faced. image My dataset is: image and src/option.py is: image Thanks for any suggestions.

@kikiki1121 hello,i meet the same problem,could you please give some advise for it?

Ccbov commented 4 years ago

@ZhengCai024 hello,i meet the same problem,could you please give some advise for it?

The same problem, I also have faced. image My dataset is: image and src/option.py is: image Thanks for any suggestions.

I solve the probelm by putting the DIV2K under the dir named dataset, and modify the argument as parser.add_argument('--dir_data', type=str, default='../dataset', help='dataset directory')

zhangmin4215 commented 4 years ago

@kevinisbest Sorry,i don‘t know where your fault is.I hope that my reply may help you. My dataset looks like this: /home/jason/Documents/jason/EDSR-PyTorch-master/DIV2K/... └──DIV2K ├──DIV2K_train_HR │ ├──0000.png │ ├──0001.png │ └──... ├──DIV2K_train_LR_bicubic │ ├──X2 │ │ ├──0000x2.png │ │ ├──0001x2.png │ │ └──... │ ├──X3 │ └──... └──... My option.py looks like this : b59ehc7 bd h6 hh tq

follow this structure and change my own dataset, then I can run the code successfully! Thank you very much!

zhulintao commented 2 months ago

Traceback (most recent call last): File "/Users/a58/super_resolution/EDSR-PyTorch/src/main.py", line 33, in main() File "/Users/a58/super_resolution/EDSR-PyTorch/src/main.py", line 22, in main loader = data.Data(args) ^^^^^^^^^^^^^^^ File "/Users/a58/super_resolution/EDSR-PyTorch/src/data/init.py", line 26, in init self.loader_train = dataloader.DataLoader( ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/a58/super_resolution/EDSR-PyTorch/.venv/lib/python3.12/site-packages/torch/utils/data/dataloader.py", line 350, in init sampler = RandomSampler(dataset, generator=generator) # type: ignore[arg-type] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/a58/super_resolution/EDSR-PyTorch/.venv/lib/python3.12/site-packages/torch/utils/data/sampler.py", line 143, in init raise ValueError(f"num_samples should be a positive integer value, but got num_samples={self.num_samples}") ValueError: num_samples should be a positive integer value, but got num_samples=0