The repo is a coalesced work of the original [darkflow] repo and the Currently the repo contains only Darknet-based YOLO models converted to TensorFlow using Darkflow and a hands-on tutorial by Zoltan Szabo.
YOLO Model | Train Dataset | mAP | FPS | Frozen Model (.pb) | Metafile |
---|---|---|---|---|---|
Darknet19 (448x448) | VOC-1000 | 76.4 | - | pb | meta |
v2-tiny | COCO | - | 200 | pb | meta |
v2-tiny | VOC | 57.1 | 207 | failed | failed |
- Install Dependencies
!apt-get update
!pip3 install numpy
!apt-get install python-opencv -y
!pip install cython
- Clone and install Darkflow
# Clone the repository
!git clone https://github.com/thtrieu/darkflow
# Change into the darkflow dir and install darkflow with pip
%cd darkflow
!python setup.py build_ext --inplace
- Fix assertion issue by modifying the
loader.py
Note: may not always be needed but it won't cause any issue
#Change directory to darkflow
%cd /content/darkflow
!sed -i "s/self.offset = 16/self.offset = 20/g" ./darkflow/utils/loader.py
- Download the model files (
cfg
file +weights
file)
!wget -O "cfg/yolo-v2-tiny-coco.cfg" "https://raw.githubusercontent.com/pjreddie/darknet/master/cfg/yolov2-tiny.cfg"
!wget -O "weights/yolo-v2-tiny-coco.weights" "https://pjreddie.com/media/files/yolov2-tiny.weights"
- Convert using
flow
and generate frozen graph (.pb
) Note: We keep cfg files in the darkflow/cfg directory and the weights in the darkflow/weights directory
#syntax: $ !./flow --model path_to_cfg_file --load path_to_weights --savepb
!./flow --model cfg/yolo-v2-tiny-coco.cfg --load weights/yolo-v2-tiny-coco.weights --savepb
Done ! You should be able to find your converted frozen graph in the darkflow/built_graph
directory