/YOLOv2-keras

YOLOv2 keras for real-time object detection

Primary LanguagePython

YOLO v2

YOLO is a real-time object detection model based on deep learning.
yolov2 (or YOLO9000) was implemented as keras (tensorflow backend).

Backbone

  1. DarkNet19
  2. DarkNet tiny
  3. MobileNet v1

Todo list:

  • DarkNet19, DarkNet tiny, MobileNet v1
  • SqueezeNet, ResNet, DenseNet backbone
  • Multiscale training
  • mAP Evaluation
  • PostProcessing for real-time process
  • Warmup training
  • revise GT generator (I think this is the cause of the lower performance than the existing model)

How to Training

I have created an annotation file of the form

[file_name / img_wigth / img_height / xmin / ymin / xmax / ymax / class]
2007_001185.jpg 500 375 197 199 289 323 cat
2007_001185.jpg 500 375 78 78 289 375 person
2007_001185.jpg 500 375 204 223 500 375 diningtable
2007_001185.jpg 500 375 452 131 500 253 bottle
2007_001763.jpg 500 375 281 119 500 375 cat
2007_001763.jpg 500 375 1 24 330 366 dog
2007_001763.jpg 500 375 1 48 500 375 sofa
2007_001763.jpg 500 375 83 1 195 16 tvmonitor

annotation example

Then change the image directory and annotation directory in YOLO_parameter.py and run YOLO_train.py

Result

enter image description here

It works well and is processed in real time on the GTX-1080.


And you can see the results of YOLO in the video.
Click on the link below to see three images combined.
From the left is YOLO using DarkNet19, DarkNet tiny, MobileNet.

YOLOv2 Demo


File Description

os : Ubuntu 16.04.4 LTS
GPU : GeForce GTX 1080 (8GB)
Python : 3.5.2
Tensorflow : 1.5.0
Keras : 2.1.3
CUDA, CUDNN : 9.0, 7.0

File Description
Depthwise_conv .py For MobileNet
Losses. py YOLO v2 Loss function
Model. py YOLO v2 Model
(DarkNet19, DarkNet tiny, MobileNet)
YOLO_eval. py Performance evaluation (mAP and recall)
YOLO_parameter. py Parameters used in YOLO v2
YOLO_pred. py Run YOLO v2 on video
YOLO_train. py YOLO v2 training
YOLO_utils. py Utils used in YOLO v2

Training Result:

Test with this implementation on released weights
VOC2007 test mAP 66.2%
Recall 79.2%
mAP 67.6%
Racall 77.5%