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
2k stars 175 forks source link

Not implemented load weight from own/custom path #163

Open KirillHiddleston opened 4 months ago

KirillHiddleston commented 4 months ago

Hi, if i want load weight by path i load weight from https://github.com/chaofengc/IQA-PyTorch/releases/tag/v0.1-weights

pyiqa.create_metric('musiq-ava').net.load_state_dict(torch.load('/Users/user/Downloads/musiq_ava_ckpt-e8d3f067.pth'))

but still the model is downloaded from the link

# output
Downloading: "https://github.com/chaofengc/IQA-PyTorch/releases/download/v0.1-weights/musiq_ava_ckpt-e8d3f067.pth" to /Users/user/.cache/torch/hub/checkpoints/musiq_ava_ckpt-e8d3f067.pth

i wanna load weight from own path u hardcode path url in model for example https://github.com/chaofengc/IQA-PyTorch/blob/main/pyiqa/archs/clip_model.py#L15

chaofengc commented 4 months ago

You can safely ignore the downloaded weights because the they are only used in the model initialization and you reload your own weights using load_state_dict.

If you do not want to download original weights, simply use pyiqa.create_metric('musiq-ava', pretrained=False).