WongKinYiu / yolov7

Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
GNU General Public License v3.0
13.06k stars 4.13k forks source link

end2end parameter for ONNX export #1132

Open YCAyca opened 1 year ago

YCAyca commented 1 year ago

Hello, I was using

python export.py --weights weights/redbull_reparamed.pt --grid --end2end --topk-all 100 --iou-thres 0.65 --conf-thres 0.35 --img-size 640 640 --max-wh 640

command to export my custom trained and reparametrized model into onnx. I was having the following error:

Starting ONNX export with onnx 1.12.0...
onnxruntime
/home/yca/anaconda3/envs/yolov7/lib/python3.7/site-packages/torch/_tensor.py:1104: UserWarning: The .grad attribute of a Tensor that is not a leaf Tensor is being accessed. Its .grad attribute won't be populated during autograd.backward(). If you indeed want the .grad field to be populated for a non-leaf Tensor, use .retain_grad() on the non-leaf Tensor. If you access the non-leaf Tensor by mistake, make sure you access the leaf Tensor instead. See github.com/pytorch/pytorch/pull/30531 for more informations. (Triggered internally at  aten/src/ATen/core/TensorBody.h:475.)
  return self._grad
ONNX export failure: tuple indices must be integers or slices, not tuple

Until I run the command without --end2end parameter. I don't know what is end2end parameter changes in exporting and if it will affect my results while using onnx but I wanted to share this inform as a bug to inform you.

BroadswordZhang commented 2 weeks ago

I have also meet this problem +1