Huang-ShiRui / Semi-UIR

Official code for "Contrastive Semi-supervised Learning for Underwater Image Restoration via Reliable Bank" (2023 CVPR)
113 stars 10 forks source link

How to train? as_loss=True or as_loss=False #25

Closed QiaoYang-CV closed 5 months ago

QiaoYang-CV commented 5 months ago

when I run train.py, some error was reported:

if score_t[idx] > score_s[idx]:

IndexError: too many indices for array: array is 0-dimensional, but 1 were indexed

but, when I modify one code in trainer.py, ie:

self.iqa_metric = pyiqa.create_metric('musiq', as_loss=True).cuda(),

---->

self.iqa_metric = pyiqa.create_metric('musiq', as_loss=False).cuda(),

this error is disappears and code can be trained.

Specifically, I think this error is caused by "N = teacher_predict.shape[0]". But I don't know if modifying "as_loss" is correct.

Can you explain it to me ? Look forward to your reply.