adrianosantospb / yolov5_ultralytics_to_darnet_format

13 stars 4 forks source link

How to use jupyter Notebook to run the script? #1

Open uestchang opened 3 years ago

uestchang commented 3 years ago

Hello, I am trying to convert yolov5 model.yaml and weight.pt to .cfg and .weights, I found your excellent work here, and finished the steps of project Readme, but I konw nothing about jupyter script, could you help me?

uestchang commented 3 years ago

I see the script that can convert the yolov5x.cfg and yolov5x.pt to yolov5.yaml and yolov5.weights, can this script convert the other yolov5 pytorch model to darknet model?

uestchang commented 3 years ago

Try to use the converted model on opencv and get a error: cv2.error: OpenCV(4.5.2) /tmp/pip-req-build-13uokl4r/opencv/modules/dnn/src/darknet/darknet_io.cpp:900: error: (-212:Parsing error) Unknown layer type: Focus in function 'ReadDarknetFromCfgStream'

adrianosantospb commented 3 years ago

Hello, I am trying to convert yolov5 model.yaml and weight.pt to .cfg and .weights, I found your excellent work here, and finished the steps of project Readme, but I konw nothing about jupyter script, could you help me?

For sure I will :)

adrianosantospb commented 3 years ago

I see the script that can convert the yolov5x.cfg and yolov5x.pt to yolov5.yaml and yolov5.weights, can this script convert the other yolov5 pytorch model to darknet model?

I added this script (https://github.com/adrianosantospb/yolov5_ultralytics_to_darnet_format/blob/master/yolov5_ultralytics_to_darknet.py). You can use it if you want.

adrianosantospb commented 3 years ago

Try to use the converted model on opencv and get a error: cv2.error: OpenCV(4.5.2) /tmp/pip-req-build-13uokl4r/opencv/modules/dnn/src/darknet/darknet_io.cpp:900: error: (-212:Parsing error) Unknown layer type: Focus in function 'ReadDarknetFromCfgStream'

You need to install the opencv-contrib-python library (pip install opencv-contrib-python). I don't know if you installed the dependencies libraries, but you have to.