sanghyun-son / EDSR-PyTorch

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

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

Closed hktalent closed 1 year ago

hktalent commented 1 year ago

Mac OS i7 cpu

conda deactivate
conda remove --name EDSR --all -y
conda create -n EDSR -y python=3.6
conda activate EDSR
conda init zsh
export PATH="$HOME/anaconda3/envs/EDSR/bin:$PATH"
which pip python
python -V
$ pip list
Package             Version            
------------------- -------------------
certifi             2016.9.26          
cycler              0.11.0             
dataclasses         0.8                
decorator           4.4.2              
imageio             2.15.0             
importlib-resources 5.4.0              
kiwisolver          1.3.1              
matplotlib          3.3.4              
networkx            2.5.1              
numpy               1.19.5             
Pillow              8.4.0              
pip                 20.0.2             
pyparsing           3.0.9              
python-dateutil     2.8.2              
PyWavelets          1.1.1              
scikit-image        0.17.2             
scipy               1.5.4              
setuptools          49.6.0.post20210108
six                 1.16.0             
tifffile            2020.9.3           
torch               1.10.2             
tqdm                4.64.1             
typing-extensions   4.1.1              
wheel               0.36.2             
zipp                3.6.0              

sh 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 "/Users/51pwn/MyWork/EDSR-PyTorch/src/data/__init__.py", line 31, in __init__
    num_workers=args.n_threads,
  File "/Users/51pwn/anaconda3/envs/EDSR/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 268, in __init__
    sampler = RandomSampler(dataset, generator=generator)
  File "/Users/51pwn/anaconda3/envs/EDSR/lib/python3.6/site-packages/torch/utils/data/sampler.py", line 103, 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
hktalent commented 1 year ago
python main.py --model EDSR --scale 2 --patch_size 96 --save EDSR_x4 --reset --cpu  --n_threads 4
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 "/Users/51pwn/MyWork/EDSR-PyTorch/src/data/__init__.py", line 31, in __init__
    num_workers=args.n_threads,
  File "/Users/51pwn/anaconda3/envs/EDSR/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 268, in __init__
    sampler = RandomSampler(dataset, generator=generator)
  File "/Users/51pwn/anaconda3/envs/EDSR/lib/python3.6/site-packages/torch/utils/data/sampler.py", line 103, 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

$ python main.py --model EDSR --scale 2 --patch_size 96 --save EDSR_x4 --reset --cpu
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 "/Users/51pwn/MyWork/EDSR-PyTorch/src/data/__init__.py", line 31, in __init__
    num_workers=args.n_threads,
  File "/Users/51pwn/anaconda3/envs/EDSR/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 268, in __init__
    sampler = RandomSampler(dataset, generator=generator)
  File "/Users/51pwn/anaconda3/envs/EDSR/lib/python3.6/site-packages/torch/utils/data/sampler.py", line 103, 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
AndrewKeYanzhe commented 4 months ago

I'm getting the same error, @hktalent did you manage to solve this?

AndrewKeYanzhe commented 4 months ago

I found the solution here https://github.com/sanghyun-son/EDSR-PyTorch/issues/217

hktalent commented 4 months ago

@AndrewKeYanzhe thanks