Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

train error #16

Open
lxy5513 opened this issue Jan 19, 2021 · 3 comments
Open

train error #16

lxy5513 opened this issue Jan 19, 2021 · 3 comments

Comments

@lxy5513
Copy link

lxy5513 commented Jan 19, 2021

Thanks for your awesome code, I train it by my custom dataset, but some problems happened,

Original Traceback (most recent call last):
  File "/data/computervision/liuxingyu/envs/server31/anaconda3/envs/torch/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop
    data = fetcher.fetch(index)
  File "/data/computervision/liuxingyu/envs/server31/anaconda3/envs/torch/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/data/computervision/liuxingyu/envs/server31/anaconda3/envs/torch/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/data/computervision/liuxingyu/projects/super_resolution/Real-SR/codes/data/LQGT_dataset.py", line 147, in __getitem__
    noise = self.noises[np.random.randint(0, len(self.noises))]
  File "mtrand.pyx", line 746, in numpy.random.mtrand.RandomState.randint
  File "_bounded_integers.pyx", line 1254, in numpy.random._bounded_integers._rand_int64
ValueError: low >= high

Could you give some advice to handle it, Thanks a lot!

@ed-lala
Copy link

ed-lala commented May 3, 2021

When you do np.random.randint(0, len(self.noises)), most likely length of the noises is 0. Check how you specify location of the noise_data in .yml file. It should be:
noise_data: ../datasets/DF2K/Corrupted_noise**/**
Forward slash is important, because in data_loader.py script they rely on it:
self.noise_imgs = sorted(glob.glob(base + '*.png'))

@shiva811
Copy link

shiva811 commented May 24, 2021

The problem is that sorted(glob.glob(base + '*.png')) gives an empty list.
Replace it by ```

self.noise_imgs = [os.path.join(root,name)
             for root, dirs, files in os.walk(base)
             for name in files
             if name.endswith(('png'))]

`This would solve your error. Let me know whether it worked for you. `

@Lcjgh
Copy link

Lcjgh commented Oct 22, 2022

因为提取噪声的图像块的尺寸太大了,默认是256*256,对你输入的图像而言可能太大了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants