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

HI,I have confirmed "main.py" and "dataset path". But there is a bug happening. #1

Open
Jackyinuo opened this issue Apr 21, 2021 · 4 comments

Comments

@Jackyinuo
Copy link

Can you help me? or showing more detailing configs file.
Traceback (most recent call last):
File "main.py", line 15, in
loader = data.Data(args) ## data loader
File "E:\SMSR-master\data_init_.py", line 9, in init
trainset = getattr(module_train, args.data_train)(args) ## load the dataset, args.data_train is the dataset name
File "E:\SMSR-master\data\div2k.py", line 6, in init
super(DIV2K, self).init(
File "E:\SMSR-master\data\multiscalesrdata.py", line 84, in init
self.repeat = args.test_every // (len(self.images_hr) // args.batch_size)
ZeroDivisionError: integer division or modulo by zero

@LongguangWang
Copy link
Member

Hi @Jackyinuo, sorry for the late response.
It seems the reason is that len(self.images_hr) equals 0. Please re-check the training images are correctly organized and confirm dir_data (the parent path to the folder DIV2K) is updated in option.py.

image

@ymtupup
Copy link

ymtupup commented May 11, 2021

Have you slove this problem? I also have this problem.

@X-rap-rose
Copy link

我也遇到了上面的问题,文件目录没有放错。

@msx-123
Copy link

msx-123 commented Jan 3, 2022

已解决:
1.首先将下载下载的数据集进入DIV2K文件夹内将DIV2K_train_HR和DIV2K_train_LR_bicubic文件名改为HR和LR_bicubic
2.其次将LR_bicubic/X2,X3,X4内部的文件全部命名为与HR文件内部一样的名字,也就是说将图片名称中的x2,x3,x4全部去掉,下面我放了重命名的代码,你们可以用,注意修改路径。
3.最后将--dir_data改成你DIV2K文件前一个目录的绝对路径,就可以了

import os
import glob
from PIL import Image
file_root = r'E:\SMSR\SMSR-master\trainset\DIV2K\LR_bicubic\X2'
for root, dirs, files in os.walk(file_root):
for file in files:
srcFile = os.path.join(file_root, file)
dstFile = os.path.join(file_root, file.replace('x2', ''))
os.rename(srcFile, dstFile)

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

5 participants