Closed bitwalt closed 3 years ago
This error occurs because we saved the model with multi-GPU training and you used a single GPU to load the model. We have updated the single GPU model loading method. You can download the latest code in test.py
, or modify your version by referring to the following code:
from collections import OrderedDict
net = Crowd_locator(netName,GPU_ID,pretrained=True)
net.cuda()
state_dict = torch.load(model_path)
if len(GPU_ID.split(','))>1:
net.load_state_dict(state_dict)
else:
new_state_dict = OrderedDict()
for k, v in state_dict.items():
name = k.replace('module.', '')
new_state_dict[name] = v
net.load_state_dict(new_state_dict)
net.eval()
Thank you very much both, it was that! This is really a great job
Hi, thank you for sharing your code! This model seems very interesting and promising. I was trying to test your model on a video, but unfortunately I was not able to load your pre-trained models. I tried both HR and VGG models, but it always break on load_state_dict() Do you know why?