Skip to content

zoranzhao/darknet-nnpack

 
 

Lightweight Darknet with NNPACK

Forked from https://github.com/digitalbrain79/darknet-nnpack, where NNPACK was used to optimize Darknet without using a GPU. It is useful for embedded devices using ARM CPUs.

Comparing with original version, the modifications/improvements in this version are:

  • Reducing inference memory footprint by removing unnecessary memory allocations.
  • Fixing bugs on loading weight on 32-bit OS (For example, Raspbian)
  • Improving C++ compatibility.

Build from Raspberry Pi 3

Log in to Raspberry Pi using SSH.
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/thomaspark-pkj/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/thomaspark-pkj/darknet-nnpack.git
cd darknet-nnpack
make

Test

The weight files can be downloaded from the YOLO homepage.

YOLOv2
./darknet detector test cfg/coco.data cfg/yolo.cfg yolo.weights data/person.jpg
Tiny-YOLO
./darknet detector test cfg/voc.data cfg/tiny-yolo-voc.cfg tiny-yolo-voc.weights data/person.jpg

Result

Model Build Options Prediction Time (seconds)
YOLOv2 NNPACK=1,ARM_NEON=1 8.2
YOLOv2 NNPACK=0,ARM_NEON=0 156
Tiny-YOLO NNPACK=1,ARM_NEON=1 1.3
Tiny-YOLO NNPACK=0,ARM_NEON=0 38

Releases

No releases published

Packages

No packages published

Languages

  • C 89.6%
  • Cuda 8.3%
  • Other 2.1%