# darknet_scripts
**Repository Path**: kaluo_zZ/darknet_scripts
## Basic Information
- **Project Name**: darknet_scripts
- **Description**: Auxilary scripts to work with (YOLO) darknet deep learning famework. AKA -> How to generate YOLO anchors?
- **Primary Language**: Python
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-06-29
- **Last Updated**: 2021-06-29
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# darknet_scripts
This repo contains my auxilary scripts to work with darknet deep learning famework
1. [How to compute/reproduce YOLOv2 anchors for yolo-voc.cfg?](#how-to-reproduce-yolov2-anchors-for-yolo-voccfg)
2. [How to visualize genereted anchors?](#how-to-visualize-genereted-anchors)
3. [Is gen_anchors.py same as YOLOv2 anchor computation?](#is-gen_anchorspy-same-as-yolov2-anchor-computation)
4. [How to get anchors if My input for network is bigger than 416?](#how-to-get-anchors-if-my-input-for-network-is-bigger-than-416)
5. [How to plot YOLO loss](#how-to-plot-yolo-loss)
6. [YOLO and Anchors tutorial](http://christopher5106.github.io/object/detectors/2017/08/10/bounding-box-object-detectors-understanding-yolo.html)
### How to compute/reproduce YOLOv2 anchors for yolo-voc.cfg?
1. Download The Pascal VOC Data and unpack it to directory `build\darknet\x64\data\voc` will be created dir `build\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 dir `build\darknet\x64\data\voc`: http://pjreddie.com/media/files/voc_label.py
2. Download and install Python for Windows: https://www.python.org/ftp/python/2.7.9/python-2.7.9rc1.amd64.msi
3. 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)
4. Run command: `type 2007_train.txt 2007_val.txt 2012_*.txt > train.txt`
5. Obtain anchors5.txt in generated_anchors/voc-reproduce folder by executing:
```cmd
python gen_anchors.py -filelist //path//to//voc//filelist/list//train.txt -output_dir generated_anchors/voc-reproduce -num_clusters 5
```
### How to visualize genereted anchors?
After completing the steps above, execute
```cmd
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
### Is gen_anchors.py same as YOLOv2 anchor computation?