flyywh / CVPR-2020-Semi-Low-Light

151 stars 22 forks source link

ZeroDivisionError #15

Open Trueman1997 opened 2 years ago

Trueman1997 commented 2 years ago

when I run test.sh in stage2-otherdatasets,some questions happerned:

Making model... Making model... Making model...

Evaluation: 0it [00:00, ?it/s] Traceback (most recent call last): File "main_test.py", line 34, in while not t.terminate(): File "/DRBN/DRBL-stage2-other-datasets/src/trainer_test.py", line 292, in terminate self.test() File "/DRBN/DRBL-stage2-other-datasets/src/trainer_test.py", line 264, in test self.ckp.log[-1, idx_scale] = eval_acc / len(self.loader_test) ZeroDivisionError: division by zero

Trueman1997 commented 2 years ago

I have set absolute path to solve “ZeroDivisionError” problem。 but another problem happened:

Making model... Making model... Making model...

Evaluation: 0%| | 0/200 [00:00<?, ?it/s]Traceback (most recent call last): File "main_test.py", line 34, in while not t.terminate(): File "/gaoren/DRBN/DRBL-stage2-other-datasets/src/trainer_test.py", line 292, in terminate self.test() File "/gaoren/DRBN/DRBL-stage2-other-datasets/src/trainer_test.py", line 205, in test for idximg, (lr, hr, lrr, hq, filename, ) in enumerate(tqdm_test): File "/usr/local/lib/python3.6/dist-packages/tqdm/std.py", line 1081, in iter for obj in iterable: File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 560, in next batch = self.collate_fn([self.dataset[i] for i in indices]) File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 560, in batch = self.collate_fn([self.dataset[i] for i in indices]) File "/gaoren/DRBN/DRBL-stage2-other-datasets/src/data/srdata.py", line 207, in getitem lr, hr, lrr, hq, filename = self._load_file(idx) File "/gaoren/DRBN/DRBL-stage2-other-datasets/src/data/srdata.py", line 236, in _load_file idx_lrr = np.random.randint(1, len(self.images_lrr)-1)-1 File "mtrand.pyx", line 630, in numpy.random.mtrand.RandomState.randint File "bounded_integers.pyx", line 1228, in numpy.random.bounded_integers._rand_int64 ValueError: low >= high 0%| | 0/200 [00:00<?, ?it/s]

it looks like a dataloader problem。but i have replaced a new dataloader which supportted pytorch1.1.0,so i have no idea to solve this problem。anyone helps me

flyywh commented 2 years ago

I think the issue from the len(self.images_lrr)-1 is less than 1. Maybe you can check whether self.images_lrr loads the files from the directory you desire normally.

Trueman1997 commented 2 years ago

I think the issue from the len(self.images_lrr)-1 is less than 1. Maybe you can check whether self.images_lrr loads the files from the directory you desire normally.

Making model... Making model... Making model...

Evaluation: 0%| | 0/44 [00:00<?, ?it/s]Traceback (most recent call last): File "main_test.py", line 34, in while not t.terminate(): File "/DRBN/DRBL-stage2-other-datasets/src/trainer_test.py", line 292, in terminate self.test() File "/DRBN/DRBL-stage2-other-datasets/src/trainer_test.py", line 205, in test for idximg, (lr, hr, lrr, hq, filename, ) in enumerate(tqdm_test): ValueError: not enough values to unpack (expected 6, got 5) 0%| | 0/44 [00:00<?, ?it/s]

flyywh commented 2 years ago

Yeah, the first issue has been addressed.

I did not come across the second issue when I run the code. It works well from my side. It seems that (lr, hr, lrr, hq, filename, _) does not match the one-batch output of the dataloader. You might consider first using a single variable (e.g. var_tmp) to get the whole output of the dataload, see what component var_tmp includes and then remap var_tmp to lr, hr, lrr, hq.

As I did not meet the error, I could not provide a very direct solution. Could you look into the code logic more in detail and figure out it?

syc11-25 commented 2 years ago

I have set absolute path to solve “ZeroDivisionError” problem。 but another problem happened:

Making model... Making model... Making model...

Evaluation: 0%| | 0/200 [00:00<?, ?it/s]Traceback (most recent call last): File "main_test.py", line 34, in while not t.terminate(): File "/gaoren/DRBN/DRBL-stage2-other-datasets/src/trainer_test.py", line 292, in terminate self.test() File "/gaoren/DRBN/DRBL-stage2-other-datasets/src/trainer_test.py", line 205, in test for idximg, (lr, hr, lrr, hq, filename, ) in enumerate(tqdm_test): File "/usr/local/lib/python3.6/dist-packages/tqdm/std.py", line 1081, in iter for obj in iterable: File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 560, in next batch = self.collate_fn([self.dataset[i] for i in indices]) File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 560, in batch = self.collate_fn([self.dataset[i] for i in indices]) File "/gaoren/DRBN/DRBL-stage2-other-datasets/src/data/srdata.py", line 207, in getitem lr, hr, lrr, hq, filename = self._load_file(idx) File "/gaoren/DRBN/DRBL-stage2-other-datasets/src/data/srdata.py", line 236, in _load_file idx_lrr = np.random.randint(1, len(self.images_lrr)-1)-1 File "mtrand.pyx", line 630, in numpy.random.mtrand.RandomState.randint File "bounded_integers.pyx", line 1228, in numpy.random.bounded_integers._rand_int64 ValueError: low >= high 0%| | 0/200 [00:00<?, ?it/s]

it looks like a dataloader problem。but i have replaced a new dataloader which supportted pytorch1.1.0,so i have no idea to solve this problem。anyone helps me

How did you set the absolute path? in which py file? and how did you set the dataset for test only? THX!!

Sunyxg commented 2 years ago

How did you solve your first problem?

userjiangxin commented 1 year ago

When running stage2-otherdatasets, test what path the image should be placed in?