使用deepsort检测自己的数据集时遇到
报错: RuntimeError: Error(s) in loading state_dict for Net:
size mismatch for classifier.4.weight: copying a param with shape torch.Size([23, 256]) from checkpoint, the shape in current model is torch.Size([751, 256]).
size mismatch for classifier.4.bias: copying a param with shape torch.Size([23]) from checkpoint, the shape in current model is torch.Size([751]).
解决方法:
在feature_extractor.py 第12行 改成
def __init__(self, model_path, use_cuda=True):
self.net = Net(num_classes=NUM_CLASSES, reid=True)
方法来源:https://github.com/ZQPei/deep_sort_pytorch/issues/134