ttanzhiqiang / onnx_tensorrt_project

Support Yolov5(4.0)/Yolov5(5.0)/YoloR/YoloX/Yolov4/Yolov3/CenterNet/CenterFace/RetinaFace/Classify/Unet. use darknet/libtorch/pytorch/mxnet to onnx to tensorrt
211 stars 43 forks source link

yolov3-ocr.cfg does not have down_stride #12

Open chenscottus opened 3 years ago

chenscottus commented 3 years ago

Hi, I tried to transfer yolo3-spp pt file to onnx, and here is the error:

Traceback (most recent call last): File "Libtorch_yolo_to_onnx.py", line 779, in main() File "Libtorch_yolo_to_onnx.py", line 771, in main model_def = builder.build_onnx_graph( File "Libtorch_yolo_to_onnx.py", line 353, in build_onnx_graph major_node_specs = self._make_onnx_node(layer_name, layer_dict) File "Libtorch_yolo_to_onnx.py", line 426, in _make_onnx_node node_creators[layer_type](layer_name, layer_dict) File "Libtorch_yolo_to_onnx.py", line 729, in _make_yolo_node down_stride = int(layer_dict['down_stride']) KeyError: 'down_stride'

many thanks!

-Scott

chenscottus commented 3 years ago

The python file - libtorch_onnx_tensorrt_yolo

ttanzhiqiang commented 3 years ago

look https://github.com/ttanzhiqiang/onnx_tensorrt_project/blob/main/model/darknet_onnx_tensorrt_yolo/yolov3.cfg

chenscottus commented 3 years ago

yolov3 and yolov3-spp are different. yolov3-spp does not have that. In what you provide about Libtorch_yolo_to_onnx.py and yolov3-ocr.cfg also have the same issue.

ttanzhiqiang commented 3 years ago

Using netron, view the network. In your yolo Plugin,add down_stride(down_stride = (input / output_feature)).