Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert the darknet yolo model to keras?

I am using yad2k to convert the darknet YOLO model to a keras .h5 format. I have yolov3-voc.cfg, yolov3.weights, and yolov3.cfg all in the directory above the one that contains the yad2k script. When I run the following command:

python3 yad2k.py -p ../yolov3-voc.cfg ../yolov3.weights model_data/yolov3.h5

or:

python3 yad2k.py -p ../yolov3.cfg ../yolov3.weights model_data/yolov3.h5

I get the following error:

    Traceback (most recent call last):
  File "yad2k.py", line 271, in <module>
    _main(parser.parse_args())
  File "yad2k.py", line 90, in _main
    cfg_parser.read_file(unique_config_file)
  File "/Users/tobykrieman/anaconda/lib/python3.6/configparser.py", line 718, in read_file
    self._read(f, source)
  File "/Users/tobykrieman/anaconda/lib/python3.6/configparser.py", line 1080, in _read
    raise MissingSectionHeaderError(fpname, lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: '<???>', line: 7
'<!DOCTYPE html>\n'

How can I fix this?

like image 900
Tob Avatar asked Mar 07 '23 08:03

Tob


1 Answers

You should try the instructions in this Github repository, which is a "A Keras implementation of YOLOv3"

git clone https://github.com/qqwweee/keras-yolo3.git
cd keras-yolo3
wget https://pjreddie.com/media/files/yolov3.weights
python convert.py yolov3.cfg yolov3.weights model_data/yolo.h5
python yolo.py   OR   python yolo_video.py [video_path] [output_path(optional)]
like image 132
jsga Avatar answered Mar 20 '23 01:03

jsga