This repo contains my auxilary scripts to work with darknet deep learning famework
- How to compute/reproduce YOLOv2 anchors for yolo-voc.cfg?
- How to visualize genereted anchors?
- Is gen_anchors.py same as YOLOv2 anchor computation?
- How to get anchors if My input for network is bigger than 416?
- How to plot YOLO loss
- YOLO and Anchors tutorial
-
Download The Pascal VOC Data and unpack it to directory
build\darknet\x64\data\voc
will be created dirbuild\darknet\x64\data\voc\VOCdevkit\
:- http://pjreddie.com/media/files/VOCtrainval_11-May-2012.tar
- http://pjreddie.com/media/files/VOCtrainval_06-Nov-2007.tar
- http://pjreddie.com/media/files/VOCtest_06-Nov-2007.tar
1.1 Download file
voc_label.py
to dirbuild\darknet\x64\data\voc
: http://pjreddie.com/media/files/voc_label.py -
Download and install Python for Windows: https://www.python.org/ftp/python/2.7.9/python-2.7.9rc1.amd64.msi
-
Run command:
python build\darknet\x64\data\voc\voc_label.py
(to generate files: 2007_test.txt, 2007_train.txt, 2007_val.txt, 2012_train.txt, 2012_val.txt) -
Run command:
type 2007_train.txt 2007_val.txt 2012_*.txt > train.txt
-
Obtain anchors5.txt in generated_anchors/voc-reproduce folder by executing:
python gen_anchors.py -filelist //path//to//voc//filelist/list//train.txt -output_dir generated_anchors/voc-reproduce -num_clusters 5
After completing the steps above, execute
python visualize_anchors.py -anchor_dir generated_anchors/voc-reproduce
Inside the generated_anchors/voc-reproduce directory you will have png visualization of the anchors
- yolo-voc.cfg anchors are provided by the original author
- yolo-voc-reproduce.cfg anchors computed by gen_anchors.py
Simply change the lines here https://github.com/Jumabek/darknet_scripts/blob/master/gen_anchors.py#L17 to your input dimension. Then compute the anchors.
In order to plot a loss, you first need a log of the darknet train command
For example,below command will save the log into log/aggregate-voc-tiny7.log
darknet.exe detector train data/aggregate-voc-tiny7.data cfg/aggregate-voc-tiny7.cfg backup/aggregate-voc-tiny7/aggregate-voc-tiny7_21000.weights >> log/aggregate-voc-tiny7.log -gpus 0,1
Once you have \path\to\log\aggregate-voc-tiny7.log, plot the loss by executing
python plot_yolo_log.py \\path\\to\\log\\aggregate-voc-tiny7.log