https://pjreddie.com/darknet/yolo/
I just started doing deep learning detection tasks. After trying https://github.com/rbgirshick/py-faster-rcnn and https://github.com/weiliu89/caffe/tree/ssd , I just saw YOLOv3 come out, It is said to be 3.8 times faster than RetinaNet and 3 times faster than SSD. The speed is amazing, because the task is to do real-time detection on TX1, so hurry up and try it .
1. Darknet configuration should not be too convenient
Download project
git clone https://github.com/pjreddie/darknet
cd darknet
Modify the configuration file
gedit Makefile
Revise
GPU=1
CUDNN = 1
OPENCV=1
NVCC=/usr/local/cuda-8.0/bin/nvcc
compile
make -j16
Download pretrained weights file
wget https://pjreddie.com/media/files/yolov3.weights
Test the picture, the test picture is in the data folder, and the result picture is in the darknet root directory
./darknet detect cfg/yolov3.cfg yolov3.weights data/dog.jpg
Measure the video file, the video file will play a video by itself
./darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights <video file>
2. Train your own VOC data
The labeling part is not mentioned, a labeling project https://github.com/tzutalin/labelImg
Create a new VOCdevkit under the root directory scripts, in which a VOC2007 is built, and three folders are placed in Annotations, ImageSets, and JPEGImages.
Modify scripts/voc_label.py
sets=[ ('2007', 'train'), ('2007', 'val'), ('2007', 'test')]
classes = ["person"]#Modify my class, I only have one class
os.system("cat 2007_train.txt 2007_val.txt 2007_test.txt > train.txt")#Output delete the following sentence
Execute voc_label.py
python voc_label.py
Just get 4 txt under scripts, of which train.txt is all the graphs for training
Download imagenet pretrained model
wget https://pjreddie.com/media/files/darknet53.conv.74
Modify cfg/voc.data
classes= 1#Number of classes train = /xxx/yolov3/darknet/scripts/train.txt valid = /xxx/yolov3/darknet/scripts/2007_test.txt names = data/voc.names backup = /xxx/yolov3/darknet/results/ #Output weight path
Modify data/voc.names
person #own category name
Modify cfg/voc.data, classes is the number of your own categories, filters are 3*(classes+5), and the rest of the hyperparameters are modified as needed.
./darknet detector train cfg/voc.data cfg/yolov3-voc.cfg darknet53.conv.74 -gpus 0,1
测试了一下视频效果,一块1080ti检测352*288的视频,fps在120~180,耗显存700M,对比SSD的fps55~65,耗显存1G,最大帧率上速度确实提高3倍左右。2块1080ti测试视频fps在190~240。
TX1上效果,SSD测试视频4~5fps,YOLOv3测试视频24~35fps。
参考
https://blog.csdn.net/davidlee8086/article/details/79693079
https://blog.csdn.net/sinat_30071459/article/details/53100791