Pongpisit-Thanasutives / Variations-of-SFANet-for-Crowd-Counting

The official implementation of "Encoder-Decoder Based Convolutional Neural Networks with Multi-Scale-Aware Modules for Crowd Counting"
https://ieeexplore.ieee.org/document/9413286
GNU General Public License v3.0
110 stars 32 forks source link

How do I use the weights trained on ShanghaiTech? #33

Closed li-bowen-official closed 1 year ago

li-bowen-official commented 1 year ago

How do I use the .pth files ShanghaiTech A and B datasets, like checkpoint_best_MSFANet_B.pth for inference? I am able to use your Getting Started script to infer on M_SFANet_UCF_QNRF.py and best_M-SFANet__UCF_QNRF.pth file, to get headcount and heatmap. But for the ShanghaiTech weights, is there a corresponding .py file with the Model class to put in /models? So far using the ShanghaiTech weights gives some error regarding state_dict.

Thanks for your great work!

Pongpisit-Thanasutives commented 1 year ago

I have just uploaded Visualization_ShanghaiTech.ipynb, which demonstrates how to work with the .pth files for ShanghaiTech A and B datasets. Note that you can access the state_dict by torch.load(path_to_pth)["model"].

Thank you for your interest in this research!

li-bowen-official commented 1 year ago

Thank you, works for me and I can adapt it