Tianxiaomo / pytorch-YOLOv4

PyTorch ,ONNX and TensorRT implementation of YOLOv4
Apache License 2.0
4.48k stars 1.49k forks source link

convert yolov3-tiny to onnx #313

Open NazarovAV opened 3 years ago

NazarovAV commented 3 years ago

Can I convert yolov3-tiny to onnx? When I run darknet2onnx.py with my cfg and weights, I get an error:

convalution havn't activate linear
Traceback (most recent call last):
  File "darknet2onnx.py", line 59, in <module>
    transform_to_onnx(cfgfile, weightfile)
  File "darknet2onnx.py", line 8, in transform_to_onnx
    model = Darknet(cfgfile)
  File "/home/alex/work/repos/pytorch-YOLOv4/tool/darknet2pytorch.py", line 140, in __init__
    self.models = self.create_network(self.blocks)  # merge conv, bn,leaky
  File "/home/alex/work/repos/pytorch-YOLOv4/tool/darknet2pytorch.py", line 405, in create_network
    yolo_layer.scale_x_y = float(block['scale_x_y'])
KeyError: 'scale_x_y'
lswgh commented 3 years ago

same problem! have you solved the error? THANKS!

ROBYER1 commented 3 years ago

Same here, lack of v3 tiny support is an issue

bainro commented 3 years ago

Add "scale_x_y = 1.00" to each [yolo] layer in the cfg file. This is implicit for yolov3, but the parser doesn't know that currently.

https://github.com/ultralytics/yolov3/issues/1121 https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov4-tiny-3l.cfg