/Yolo-Python

Yolo api by python

Primary LanguageC

Yolo-Python

Step 1: Install DarkNet Support

Official Tutorial

Comiling with CUDA

  • download base
git clone https://github.com/pjreddie/darknet
cd darknet
wget https://pjreddie.com/media/files/yolov3.weights
  • change the first line of Makefile
GPU = 1
  • make
make
  • then test
./darknet -nogpu detect cfg/yolov3.cfg yolov3.weights data/dog.jpg
./darknet -i 1 detect cfg/yolov3.cfg yolov3.weights data/dog.jpg

Step 2 : Yolo with Numpy

make clean & make

Step 3: Yolo-Python

Core Module: DarknetTest

from DarknetTest import Detector


image = ''  	  # (image path or ndarray)
yolov3 = Detector(gpu=1,
                  cfg="/darknet/cfg/yolov3.cfg",
                  weights="/darknet/yolov3.weights",
                  data="/darknet/cfg/coco.data")
result, width_height = yolov3.detect_result(image)