phanxuanduc1996 / convert_yolo_weights

Summary of methods to convert models in Yolo-v4-v3-v2
73 stars 23 forks source link

convert yolov4 #1

Open shangdibufashi opened 4 years ago

shangdibufashi commented 4 years ago

Great work! Would you please convert yolov4 to onnx ?

phanxuanduc1996 commented 4 years ago

Thanks for your opinion. I'm trying to convert yolov4 to other models. I'll update it asap. Please waiting for me.

phanxuanduc1996 commented 4 years ago

Great work! Would you please convert yolov4 to onnx ?

@jiapinai I converted Yolov4 to some models like tensorflow, keras, mlmodel. I will continue to update it. Please fork this source code to update. Thank you.

shangdibufashi commented 4 years ago

Thank you very much :)

joanesplazaola commented 4 years ago

Heey, thanks for your great work, I am trying to convert the YoloV4 cfg and weights into ONNX, and I have first (succesfully) tried to convert the cfg + weights into keras h5, and after that converting the h5 into ONNX, but I get the error of keras2onnx saying that the mish activation layer is not supported, and i do not know how to add a custom activation function, any idea how could I correct this?

joanesplazaola commented 4 years ago

Moreover, I think it's a good idea to have a requirements.txt file, in order to know which pip packages to install, as I have seen you are using an older approach of keras, instead of using tf.keras

phanxuanduc1996 commented 4 years ago

Moreover, I think it's a good idea to have a requirements.txt file, in order to know which pip packages to install, as I have seen you are using an older approach of keras, instead of using tf.keras @joanesplazaola , You can use the latest version of Keras. And the TensorFlow I'm using is 1.13.1.

phanxuanduc1996 commented 4 years ago

Heey, thanks for your great work, I am trying to convert the YoloV4 cfg and weights into ONNX, and I have first (succesfully) tried to convert the cfg + weights into keras h5, and after that converting the h5 into ONNX, but I get the error of keras2onnx saying that the mish activation layer is not supported, and i do not know how to add a custom activation function, any idea how could I correct this?

@joanesplazaola , I have not done the conversion for Onnx. I will update it soonest. Please check the types of models that have been successfully converted at Readme.md.

joanesplazaola commented 4 years ago

@phanxuanduc1996 , Thanks for the fast reply, if you need any help with the conversion to onnx write me please :)

pake2070 commented 4 years ago

how to convert yolov4.pb to tensorflow serving?

phanxuanduc1996 commented 4 years ago

Hello everyone, Recently I was busy with my personal work so I couldn't check your messages. Very sorry about this. Looking ahead, I will continue to perform some previous bug fixes like the onnx model. @pake2070 , I do not understand you. Please describe it in more detail. For TensorFlow, please check in the tensorflow_convert folder. I have run both methods and it works.

molyswu commented 3 years ago

Hi, Tried to convert yolov4.pt to yolov4.onnx, python convert_pytorch_to_onnx.py

Traceback (most recent call last):

File "convert_pytorch_to_onnx.py", line 25, in './new_models/yolov4.onnx') File "/home/xx/anaconda3/lib/python3.7/site-packages/torch/onnx/init.py", line 208, in export custom_opsets, enable_onnx_checker, use_external_data_format) File "/home/xx/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py", line 92, in export use_external_data_format=use_external_data_format) File "/home/xx/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py", line 517, in _export with select_model_mode_for_export(model, training): File "/home/xx/anaconda3/lib/python3.7/contextlib.py", line 112, in enter return next(self.gen) File "/home/xx/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py", line 36, in select_model_mode_for_export is_originally_training = model.training AttributeError: 'dict' object has no attribute 'training'