lyuwenyu / RT-DETR

[CVPR 2024] Official RT-DETR (RTDETR paddle pytorch), Real-Time DEtection TRansformer, DETRs Beat YOLOs on Real-time Object Detection. 🔥 🔥 🔥
Apache License 2.0
2.31k stars 258 forks source link

Export to onnx get error #374

Closed hongu0603 closed 2 months ago

hongu0603 commented 2 months ago

使用export_onnx.py -c configs\rtdetr\rtdetr_r50vd_m_6x_coco.yml -r output\rtdetr_r50 vd_6x_coco\eval\latest.pth 要把pth 匯出時發生以下錯誤,想問是什麼原因

image

lyuwenyu commented 2 months ago

这个错应该报在加载位置了;;可以check下你加载的权重里的key

https://github.com/lyuwenyu/RT-DETR/blob/main/rtdetr_pytorch/tools/export_onnx.py#L23-L27

hongu0603 commented 2 months ago

我是用以下指令訓練自己的資料集 螢幕擷取畫面 2024-07-17 170149 然後我直接使用

python tools\export_onnx.py -c configs\rtdetr\rtdetr_r50vd_6x_coco.yml -r output\rtdetr_r50vd_6x_coco\eval\latest.pth --check

會顯示以下狀況 螢幕擷取畫面 2024-07-17 170628 我在yaml_utils.py中新增 螢幕擷取畫面 2024-07-17 170704 再跑一次則會出現 KeyError "model " ,checj 權重里的key也的確沒有model ,想請問會是訓練中的哪一個步驟有問題呢 螢幕擷取畫面 2024-07-17 170349

lyuwenyu commented 2 months ago

eval/lastest.pth不是模型 是评估结果; 使用和eval同一级目录的checkpoint-xxxx.pth

hongu0603 commented 2 months ago

謝謝您! 解決了