A Keras implementation of YOLOv3 (Tensorflow backend) inspired by allanzelener/YAD2K. This fork is a continuation of qqwweee/keras-yolo3 with some CI and bug fixing since its parent become inactive...
For package installation use of the following commands
pip install git+https://github.com/Borda/keras-yolo3.git
pip install https://github.com/Borda/keras-yolo3/archive/master.zip
or clone/download repository locally and run python setup.py install
For more model and configuration please see YOLO website and darknet repository.
wget -O ./model_data/yolo3.weights \
https://pjreddie.com/media/files/yolov3.weights \
--progress=bar:force:noscroll
alternatively you can download light version yolov3-tiny.weights
python3 scripts/convert_weights.py \
--config_path ./model_data/yolo.cfg \
--weights_path ./model_data/yolo.weights \
--output_path ./model_data/yolo.h5
python3 scripts/detection.py \
--path_weights ./model_data/yolo.h5 \
--path_anchors ./model_data/yolo_anchors.csv \
--path_classes ./model_data/coco_classes.txt \
--path_output ./results \
--path_image ./model_data/bike-car-dog.jpg \
--path_video person.mp4
For Full YOLOv3, just do in a similar way, just specify model path and anchor path with --path_weights <model_file>
and --path_anchors <anchor_file>
.
--nb_gpu N
to use N GPUs. It is passed to the Keras multi_gpu_model().For training you can use VOC dataset, COCO datset or your own...
image_file_path box1 box2 ... boxN
; x_min,y_min,x_max,y_max,class_id
(no space). scripts/annotation_voc.py
scripts/annotation_coco.py
scripts/annotation_csv.py
path/to/img1.jpg 50,100,150,200,0 30,50,200,120,3
path/to/img2.jpg 120,300,250,600,2
...
python scripts/convert_weights.py <...>
.
The file model_data/yolo_weights.h5
is used to load pre-trained weights.python training.py
.
Use your trained weights or checkpoint weights with command line option --model model_file
when using yolo_interactive.py
.
Remember to modify class path or anchor path, with --classes class_file
and --anchors anchor_file
.If you want to use original pre-trained weights for YOLOv3:
wget https://pjreddie.com/media/files/darknet53.conv.74
darknet53.weights
python convert.py -w darknet53.cfg darknet53.weights model_data/darknet53_weights.h5
model_data/darknet53_weights.h5
in training.py