-
Notifications
You must be signed in to change notification settings - Fork 8k
Train Detector on MS COCO (trainvalno5k 2014) dataset
Note: For using Mosaic data augmentation and to avoid the bottleneck of CPU performance for data augmentation, compile Darknet with OpenCV.
-
yolov4.cfg
- https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/yolov4.cfg(change
width=512 height=512
in cfg-file)mini_batch_size = batch / subdivisions
, so higher subdivisions= - lower accuracy (AP):-
for 32 GB GPU-VRAM set
subdivisions=8
in cfg-file (yolov4.weights is trained on V100-32GB) -
for 16-24 GPU-VRAM set
subdivisions=16
in cfg-file -
for 8-12 GB GPU-VRAM set
subdivisions=32
in cfg-file (if Out Of Memory occurs - setrandom=1.34
for[yolo]
layers) -
if you compiled Darknet without OpenCV and disabled
mosaic=0
then accuracy may be~2%
lower
-
-
csdarknet53-omega.conv.105
- The first 105 layers from the pre-trained weights on ImageNet (ILSVRC2012):- download weights
csdarknet53-omega_final.weights
for Classifier: https://drive.google.com/open?id=18jCwaL4SJ-jOvXrZNGHJ5yz44g9zi8Hm - get only the first 105 layers
./darknet partial cfg/csdarknet53-omega.cfg csdarknet53-omega_final.weights csdarknet53-omega.conv.105 105
- download weights
-
data/coco.names
- with names of objects https://raw.githubusercontent.com/AlexeyAB/darknet/master/data/coco.names -
bash-script to get MS COCO training dataset and unzip archives (20 GB): https://raw.githubusercontent.com/AlexeyAB/darknet/master/scripts/get_coco_dataset.sh
-
trainvalno5k.txt
- paths to Training images -
train2014.zip
andval2014.zip
- Training images (trainvalno5k 2014)
-
-
cfg/coco.data
- with content (testdev2017.txt isn't required for training):
classes= 80
train = <replace with your path>/trainvalno5k.txt
valid = <replace with your path>/testdev2017.txt
names = data/coco.names
backup = backup
eval=coco
Note: The results in the paper were obtained using training on 1 GPU (all parameters in yolov4.cfg by default, except for width=512 height=512)
- Training command:
./darknet detector train cfg/coco.data cfg/yolov4.cfg csdarknet53-omega.conv.105
- Continue training:
./darknet detector train cfg/coco.data cfg/yolov4.cfg backup/yolov4_last.weights
You will get files
-
chart.png
with Loss chart -
backup/yolov4_last.weights
- trained last weights file -
backup/yolov4_final.weights
- trained final weights file (when training is complete)
Detect on the image:
./darknet detector test cfg/coco.data cfg/yolov4.cfg backup/yolov4_final.weights dog.jpg -ext_output
Detect on the video-file:
./darknet detector demo cfg/coco.data cfg/yolov4.cfg backup/yolov4_final.weights test.mp4 -ext_output
Detect on the video-file by using GPU-1:
./darknet detector demo cfg/coco.data cfg/yolov4.cfg backup/yolov4_final.weights test.mp4 -ext_output -i 1
Detect on the RTSP/HTTP video-camera:
./darknet detector demo cfg/coco.data cfg/yolov4.cfg backup/yolov4_final.weights http://192.168.0.80:8080/video?dummy=param.mjpg -ext_output