主要來自於:AlexeyAB 版本darknetgit
提供window支持github
相較於原版pjreddie版本darknet提高了訓練速度web
添加了二值化網絡,XNOR(bit) ,速度快,準確率稍低https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov3-tiny_xnor.cfgjson
提高7%經過將卷積層和BN層合併爲一個(*_*)不太懂。網絡
多GPU訓練提高dom
修補了[reorg]層ide
添加了mAP, IOU,Precision-Recall計算測試
darknet detector map...
優化
能夠在訓練過程當中畫loss圖像
添加了根據本身數據集的anchor生成
提高視頻檢測,網絡攝像頭,opencv相關問題
提出了一個INT8的網絡,提高了檢測速度,可是準確率稍有降低
GPU=1
to build with CUDA to accelerate by using GPU (CUDA should be in /usr/local/cuda
)CUDNN=1
to build with cuDNN v5-v7 to accelerate training by using GPU (cuDNN should be in /usr/local/cudnn
)CUDNN_HALF=1
to build for Tensor Cores (on Titan V / Tesla V100 / DGX-2 and later) speedup Detection 3x, Training 2xOPENCV=1
to build with OpenCV 3.x/2.4.x - allows to detect on video files and video streams from network cameras or web-camsDEBUG=1
to bould debug version of YoloOPENMP=1
to build with OpenMP support to accelerate Yolo by using multi-core CPULIBSO=1
to build a library darknet.so
and binary runable file uselib
that uses this library. Or you can try to run so LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH ./uselib test.mp4
How to use this SO-library from your own code - you can look at C++ example: https://github.com/AlexeyAB/darknet/blob/master/src/yolo_console_dll.cpp or use in such a way: LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH ./uselib data/coco.names cfg/yolov3.cfg yolov3.weights test.mp4
https://github.com/AlexeyAB/Yolo_mark
何時中止訓練
avg loss再也不降低的時候
一般每一個類須要2000-4000次迭代訓練便可
防止過擬合:須要在Early stopping point中止訓練
使用如下命令:
darknet.exe detector map
...
建議訓練的時候帶上-map
,能夠畫圖
random=1能夠設置適應多分辨率
提高分辨率:416--> 608等必須是32倍數
從新計算你的數據集的anchor:(注意設置的時候計算問題)
darknet.exe detector calc_anchors data/obj.data -num_of_clusters 9 -width 416 -height 416
檢查數據集經過https://github.com/AlexeyAB/Yolo_mark
數據集最好每一個類有2000張圖片,至少須要迭代2000*類的個數
數據集最好有沒有標註的對象,即負樣本,對應空的txt文件,最好有多少樣本就設計多少負樣本。
對於一張圖有不少個樣本的狀況,使用max=200屬性(yolo層或者region層)
for training for small objects - set layers = -1, 11
instead of https://github.com/AlexeyAB/darknet/blob/6390a5a2ab61a0bdf6f1a9a6b4a739c16b36e0d7/cfg/yolov3.cfg#L720 and set stride=4
instead of https://github.com/AlexeyAB/darknet/blob/6390a5a2ab61a0bdf6f1a9a6b4a739c16b36e0d7/cfg/yolov3.cfg#L717
訓練數據須要知足如下條件:
train_network_width * train_obj_width / train_image_width ~= detection_network_width * detection_obj_width / detection_image_width
train_network_height * train_obj_height / train_image_height ~= detection_network_height * detection_obj_height / detection_image_height
爲了加速訓練,能夠作fine-tuning而不是從頭開始訓練,設置stopbackward=1在網絡的結束部分(以####做爲分割)
在訓練完之後,進行目標檢測的時候,能夠提升網絡的分辨率,以便恰好檢測小目標。
爲了小目標:
./darknet detector demo ... -json_port 8070 -mjpeg_port 8090
./darknet detector map ...
./darknet detector train cfg/voc.data cfg/yolo.cfg -dont_show -mjpeg_port 8090 -map
./darknet detector calc_anchors data/voc.data -num_of_clusters 12 -width 608 -height 608
./darknet partial cfg/darknet19_448.cfg darknet19_448.weights darknet19_448.conv.23 23
./darknet imtest data/eagle.jpg
-thresh 0