Skip to content

kammirzazad/darknet-nnpack-dreml

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Darknet with support for DREML functions

This repository forks from darknet-nnpack and adds support for DREML functions. These functions are enabled by macros in darknet.h. The macros and their usecases are explained below:

  • CUSTOM_BACKPROP: Enables custom loss functions in backpropogation of region_layer, yolo_layer and softmax_layer
  • DYNAMIC_FMAP_PRUNING: Prevents backpropogation of convolutional layers from calculating weight updates
  • IMG_SEG: Adds support for image segmentation as proposed here, should be undefined for other applications
  • DET_THRESH: Detection threshold used by custom loss functions of region_layer and yolo_layer

If you have a question about this repository or a problem using modified darknet, you can contact Kamyar at [email protected]. Note that, since Confu support for NNPACK is now deprecated, you can build this fork of NNPACK with CMake. The remainder of this README is same as the original repo.

build

Darknet with NNPACK

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

Build from Raspberry Pi 4

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/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

COCO trained weights files can be downloaded from the AlexeyAB/darknet.

COCO
./darknet detector test cfg/coco.data [cfg file] [weights file] [image path]
Pascal VOC
./darknet detector test cfg/voc.data [cfg file] [weights file] [image path]

Results

COCO

cfg Build Options mAP Prediction Time (seconds)
yolov3-tiny.cfg NNPACK=1 33.1 1.1
yolov3-tiny.cfg NNPACK=0 14.5
yolov3-tiny-prn.cfg NNPACK=1 33.1 0.86
yolov3-tiny-prn.cfg NNPACK=0 9.3

Pascal VOC

cfg Build Options mAP Prediction Time (seconds) Weights file
yolov3-tiny-voc.cfg NNPACK=1 65.9 1.0 yolov3-tiny-voc.weights
yolov3-tiny-voc.cfg NNPACK=0 14.0
yolov3-tiny-prn-voc.cfg NNPACK=1 65.2 0.77 yolov3-tiny-prn-voc.weights
yolov3-tiny-prn-voc.cfg NNPACK=0 8.9
Gaussian_yolov3-tiny-voc.cfg NNPACK=1 65.7 1.0 Gaussian_yolov3-tiny-voc.weights

Raspberry Pi OS Image

Download OS image from here

sudo dd bs=4M if=darknet-nnpack.img of=/dev/sdX conv=fsyn

About

Darknet with NNPACK and support for DREML functions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 64.5%
  • Cuda 14.4%
  • C++ 13.0%
  • Python 4.6%
  • CMake 1.4%
  • Batchfile 0.6%
  • Other 1.5%