chaofengc / IQA-PyTorch

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

Troubles with load_weights #181

Open egoravv opened 1 month ago

egoravv commented 1 month 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 1 month 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'])