chaofengc / IQA-PyTorch

👁️ 🖼️ 🔥PyTorch Toolbox for Image Quality Assessment, including PSNR, SSIM, LPIPS, FID, NIQE, NRQM(Ma), MUSIQ, TOPIQ, NIMA, DBCNN, BRISQUE, PI and more...
https://iqa-pytorch.readthedocs.io/
Other
2.02k stars 175 forks source link

Troubles with load_weights #181

Open egoravv opened 3 months ago

egoravv commented 3 months ago

I try to train TOPIQ by your functionality on slightly updated Koniq10k (i added some distortions and recalculate labels):

After all i try to test my model: iqa_metric = pyiqa.create_metric('topiq_nr', device=device) iqa_metric.load_weights('path/to/net_best.pth', weight_keys='params') ... score = iqa_metric(image_tensor)

But i get Error: 'NoneType' object is not callable When i try to print my iqa_metric, this returns: InferenceModel((net): None)

What i do wrong?

chaofengc commented 2 months ago

Sorry that there is a bug in the load_weights function. I have fixed it in the latest commit. You may also manually load the weight with the following example, instead of using the load_weights function:

iqa_metric.net.load_state_dict(torch.load(path/to/weight)['params'])