sanghyun-son / EDSR-PyTorch

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

ValueError: num_samples should be a positive integer value, but got num_samples=0 #259

Open rohitdavas opened 4 years ago

rohitdavas commented 4 years ago

I am getting the ValueError: num_samples should be a positive integer value, but got num_samples=0 while running demo.sh

Traceback (most recent call last): File "main.py", line 33, in <module> main() File "main.py", line 22, in main loader = data.Data(args) File "/mnt/Study_Storage/Documents/Study/Projects/Stonybrook_Multimedia_AI/SuperResolution/EDSR-PyTorch/src/data/__init__.py", line 31, in __init__ num_workers=args.n_threads, File "/home/rohit/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 213, in __init__ sampler = RandomSampler(dataset) File "/home/rohit/anaconda3/lib/python3.7/site-packages/torch/utils/data/sampler.py", line 94, in __init__ "value, but got num_samples={}".format(self.num_samples)) ValueError: num_samples should be a positive integer value, but got num_samples=0

LiuDHS commented 4 years ago

I got the same error with you. Just check your dataset dir. For example, your dataset dir is '/dataset/DIV2K', then you should set the parameter '--dir_data' with '/dataset'.

FlaShBlazer commented 4 years ago

I got the same error with you. Just check your dataset dir. For example, your dataset dir is '/dataset/DIV2K', then you should set the parameter '--dir_data' with '/dataset'.

Can you please mention where to do it? I didn't completely got your point that's why.

FlaShBlazer commented 4 years ago

I am getting the ValueError: num_samples should be a positive integer value, but got num_samples=0 while running demo.sh

Traceback (most recent call last): File "main.py", line 33, in <module> main() File "main.py", line 22, in main loader = data.Data(args) File "/mnt/Study_Storage/Documents/Study/Projects/Stonybrook_Multimedia_AI/SuperResolution/EDSR-PyTorch/src/data/__init__.py", line 31, in __init__ num_workers=args.n_threads, File "/home/rohit/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 213, in __init__ sampler = RandomSampler(dataset) File "/home/rohit/anaconda3/lib/python3.7/site-packages/torch/utils/data/sampler.py", line 94, in __init__ "value, but got num_samples={}".format(self.num_samples)) ValueError: num_samples should be a positive integer value, but got num_samples=0

have you solved it?

LiuDHS commented 4 years ago

@FlaShBlazer You should open the src/option.py and modify the value of '--dir_data'.

young169 commented 4 years ago

@FlaShBlazer You should open the src/option.py and modify the value of '--dir_data'.

I still don't get how to solve it. According to the author, you just put some pictures under "*/EDSR-PyTorch-master/test/" folder and run demo.sh. And I changed the 'dir_data' and 'dir_demo' args all to '../test/', still not work

wayne1627 commented 4 years ago

same question

Victor-Future commented 4 years ago

I encountered the same problem above when testing ERGAN

Vahe987 commented 4 years ago

I have the same error, when I want to train it, but I see some people are trying to just test, that one works for me. The thing is, that in the demo.sh file un-commented line is the first command, which is right, put a # and comment that out. The line you are looking for is down in the file

Test your own images

python main.py --data_test Demo --scale 4 --pre_train download --test_only --save_results

un-comment that command or simply run it in the terminal (without demo.sh)

marnie007 commented 4 years ago

I have the same error, when I want to train it, but I see some people are trying to just test, that one works for me. The thing is, that in the demo.sh file un-commented line is the first command, which is right, put a # and comment that out. The line you are looking for is down in the file

Test your own images

python main.py --data_test Demo --scale 4 --pre_train download --test_only --save_results

un-comment that command or simply run it in the terminal (without demo.sh)

hello, I want to test for my own image, but I dont know where I put it, it is for anyway?

marnie007 commented 4 years ago

@Vahe987 I put the image in the test file and named as Demo(I new it), and download the EDSR_x4.pt in the download file that I creat new one. but when I run the code, I got the error ImportError: No module named 'data.'

JaChouSSS commented 3 years ago

add the '--test_only' after your test commend

ulfailliyina commented 2 years ago

@FlaShBlazer You should open the src/option.py and modify the value of '--dir_data'.

hi @FlaShBlazer do you know, how to fix this? https://github.com/sanghyun-son/EDSR-PyTorch/issues/319#issue-996722398

qsibmini-khu commented 2 years ago

I had this error because in my datapath I had "/DIV2K". But apparently, I should have only put the data directory until just before that. So for example if my DIV2K folder is inside a folder called example_folder, then the datapath in the option.py should be

parser.add_argument('--dir_data', type=str, default='/home/~/~/example_folder', help='dataset directory')