EDSR-PyTorch icon indicating copy to clipboard operation
EDSR-PyTorch copied to clipboard

training error

Open kikiki1121 opened this issue 6 years ago • 14 comments
trafficstars

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

kikiki1121 avatar Dec 27 '18 04:12 kikiki1121

Facing the same error, when tried on Google Colab.

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

AbdulMoqeet avatar Jan 08 '19 03:01 AbdulMoqeet

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/...'

lz28lz28 avatar Jan 14 '19 09:01 lz28lz28

@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.

kevinisbest avatar Jan 16 '19 09:01 kevinisbest

@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

lz28lz28 avatar Jan 18 '19 00:01 lz28lz28

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

gitman88 avatar Feb 10 '19 13:02 gitman88

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

ZhengCai024 avatar Feb 15 '19 09:02 ZhengCai024

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

arvindsaripalli avatar Mar 04 '19 21:03 arvindsaripalli

@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.

arvindsaripalli avatar Mar 05 '19 01:03 arvindsaripalli

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?

guiji0812 avatar May 11 '19 03:05 guiji0812

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

123tanchong avatar May 29 '19 08:05 123tanchong

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 avatar Dec 16 '19 11:12 Ccbov

@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')

Ccbov avatar Dec 16 '19 12:12 Ccbov

@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!

zhangmin4215 avatar Jun 17 '20 14:06 zhangmin4215

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

zhulintao avatar Jul 17 '24 03:07 zhulintao