Home

Awesome

Darknet with NNPACK

NNPACK was used to optimize Darknet without using a GPU. It is useful for embedded devices using ARM CPUs.

Build from Raspberry Pi

Log in to Raspberry Pi using SSH.<br/> Install PeachPy and confu

sudo pip install --upgrade git+https://github.com/Maratyszcza/PeachPy
sudo pip install --upgrade git+https://github.com/Maratyszcza/confu

Install Ninja

git clone https://github.com/ninja-build/ninja.git
cd ninja
git checkout release
./configure.py --bootstrap
export NINJA_PATH=$PWD

Install clang

sudo apt-get install clang

Install NNPACK-darknet

git clone https://github.com/digitalbrain79/NNPACK-darknet.git
cd NNPACK-darknet
confu setup
python ./configure.py --backend auto
$NINJA_PATH/ninja
sudo cp -a lib/* /usr/lib/
sudo cp include/nnpack.h /usr/include/
sudo cp deps/pthreadpool/include/pthreadpool.h /usr/include/

Build darknet-nnpack

git clone https://github.com/digitalbrain79/darknet-nnpack.git
cd darknet-nnpack
make

Test

The weight files can be downloaded from the YOLO homepage.

YOLOv2-tiny
./darknet detector test cfg/coco.data cfg/yolov2-tiny.cfg yolov2-tiny.weights data/person.jpg
YOLOv3-tiny
./darknet detector test cfg/coco.data cfg/yolov3-tiny.cfg yolov3-tiny.weights data/person.jpg

Result

DeviceModelBuild OptionsPrediction Time (seconds)
Raspberry Pi 3YOLOv2-tinyNNPACK=1,ARM_NEON=11.8
Raspberry Pi 3YOLOv2-tinyNNPACK=0,ARM_NEON=031
Raspberry Pi 3YOLOv3-tinyNNPACK=1,ARM_NEON=12.0
Raspberry Pi 3YOLOv3-tinyNNPACK=0,ARM_NEON=032
Raspberry Pi 4YOLOv3-tinyNNPACK=1,ARM_NEON=11.4