RuntimeError: Error(s) in loading state_dict for Net:

size mismatch for classifier.4.weight: copying a param with shape torch.Size([7, 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([7]) from checkpoint, the shape in current model is torch.Size([751]).

训练deepsort的跟踪权重,默认用的数据集market1501,换成自己数据集,训练出来的权重,进行测试报错如上,更改model.py中num_class改成自己类的数量。(比如我的num_class为7,market1501默认751类)

class Net(nn.Module):
    def __init__(self, num_classes=751, reid=False):#更改训练类的数量

猜你喜欢

转载自blog.csdn.net/weixin_39357271/article/details/121381826