1.
问题:
Error(s) in loading state_dict for YOLOX:
size mismatch for head.cls_preds.0.weight: copying a param with shape torch.Size([6, 128, 1, 1]) from checkpoint, the shape in current model is torch.Size([8, 128, 1, 1]).
size mismatch for head.cls_preds.0.bias: copying a param with shape torch.Size([6]) from checkpoint, the shape in current model is torch.Size([8]).
size mismatch for head.cls_preds.1.weight: copying a param with shape torch.Size([6, 128, 1, 1]) from checkpoint, the shape in current model is torch.Size([8, 128, 1, 1]).
size mismatch for head.cls_preds.1.bias: copying a param with shape torch.Size([6]) from checkpoint, the shape in current model is torch.Size([8]).
size mismatch for head.cls_preds.2.weight: copying a param with shape torch.Size([6, 128, 1, 1]) from checkpoint, the shape in current model is torch.Size([8, 128, 1, 1]).
size mismatch for head.cls_preds.2.bias: copying a param with shape torch.Size([6]) from checkpoint, the shape in current model is torch.Size([8]).
原因:
头一天跑的6个类别的数据集得到的权重参数,第二天又跑的8个类别的数据集,测试六个类别数据时发生的错误。看报错说明预训练权重和本地模型不匹配(本地模型是8个类别,权重参数是六个)。
解决办法:
1.把YOLOX/yolox/exp/yolox_base.py中的self.num_classes为6(测试数据的类别总数)
2.命令行输入python setup.py install
2.
问题:
AttributeError: 'NoneType' object has no attribute 'shape'
原因:
数据集路径有中文
解决办法:
把数据路径改过来,或者看看传的图片是否存在