WongKinYiu / PyTorch_YOLOv4

PyTorch implementation of YOLOv4
1.89k stars 586 forks source link

torch.jit.trace error #182

Open yuzhiyiliu opened 3 years ago

yuzhiyiliu commented 3 years ago

大佬大佬,请喝阔乐[]~( ̄▽ ̄)~*。 我碰到一个棘手的麻烦,当我生成一个纯净的 trace model 的时候,报错了,然而报错并没有说道点上。我该怎么改呀。

        # type(model): <class 'models.yolo_mix.Model'>
        pred = model(img, augment=opt.augment)[0]
        trace_model = torch.jit.trace(model, torch.randn(1, 3, 640, 640))
        trace_model.save(weights+'.model_only.pt')

Exception has occurred: AssertionError File "/home/byhang/extend/fromCJ/PyTorch_YOLOv4/detect_mix.py", line 63, in detect trace_model = torch.jit.trace(model, torch.randn(1, 3, 640, 640)) File "/home/byhang/extend/fromCJ/PyTorch_YOLOv4/detect_mix.py", line 166, in detect()

yuzhiyiliu commented 3 years ago

@WongKinYiu

yuzhiyiliu commented 3 years ago

這代碼沒人維護麼???

WongKinYiu commented 3 years ago

如果想export onnx的話 可以參考 https://github.com/linghu8812/tensorrt_inference/tree/master/Yolov4https://github.com/linghu8812/tensorrt_inference/tree/master/ScaledYOLOv4

yuzhiyiliu commented 3 years ago

如果想export onnx的話 可以參考 https://github.com/linghu8812/tensorrt_inference/tree/master/Yolov4https://github.com/linghu8812/tensorrt_inference/tree/master/ScaledYOLOv4

不是export onnx,我想從訓練代碼輸出的pt文件中分離出純淨的pt模型,但是分離出來的pt模型用netron顯示出來的模型是一部分亂的,明顯不對。 然後我懷疑是模型問題,就用您代碼生成的連接 下載您的yolov5m.pt來測試,但是下載下來是名爲yolov5m.pt的zip包,解壓出來是一個文件夾,裏邊都是二進制碎片文件,不可用,請問有其他途徑下載yolov5m.pt文件嗎?