_疯_ 2022-04-05 16:22
浏览 275
已结题

将自己数据集训练好的pth文件转化为onnx文件报错

将自己数据集训练好的pth文件转化为onnx文件报错
我输入的命令:python tools/export_onnx.py -n yolox-s -c weights/best_ckpt.pth --output-name weights/best_ckpt.onnx
报错内容:RuntimeError: 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([80, 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([80]).
    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([80, 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([80]).
    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([80, 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([80]).
我的解答思路:好像是我的数据集只有6种分类,但是export_onnx.py默认是80种分类。但是我不知道在哪改这个默认值
我想要达到的结果
  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 4月13日
    • 创建了问题 4月5日

    悬赏问题

    • ¥200 csgo2的viewmatrix值是否还有别的获取方式
    • ¥15 Stable Diffusion,用Ebsynth utility在视频选帧图重绘,第一步报错,蒙版和帧图没法生成,怎么处理啊
    • ¥15 请把下列每一行代码完整地读懂并注释出来
    • ¥15 pycharm运行main文件,显示没有conda环境
    • ¥15 易优eyoucms关于二级栏目调用的问题
    • ¥15 寻找公式识别开发,自动识别整页文档、图像公式的软件
    • ¥15 为什么eclipse不能再下载了?
    • ¥15 编辑cmake lists 明明写了project项目名,但是还是报错怎么回事
    • ¥15 关于#计算机视觉#的问题:求一份高质量桥梁多病害数据集
    • ¥15 特定网页无法访问,已排除网页问题