1.首先换源
教程地址:https://www.jianshu.com/p/768f0181672b
darknet-nnpack
由于github上git代码特别慢,网上有个教程:
https://blog.csdn.net/weixin_37910453/article/details/86655613
构建步骤:
sudo apt-get install python-pip
sudo pip install --upgrade git+https://github.com/Maratyszcza/PeachPy
sudo pip install --upgrade git+https://github.com/Maratyszcza/confu
apt-get install re2c //科大的源才能下载这个软件。配源教程:https://www.jianshu.com/p/768f0181672b
git clone https://github.com/ninja-build/ninja.git
cd ninja
git checkout release
./configure.py --bootstrap
export NINJA_PATH=$PWD
安装clang(我不知道为什么我们需要这个,除非你专门针对它,否则NNPACK不会使用它)。
sudo apt-get install clang
git clone https://github.com/shizukachan/NNPACK
cd NNPACK
confu setup
Pi Zero,请运行python ./configure.py --backend scalar,否则运行python ./configure.py --backend auto
$NINJA_PATH/ninja
bin/convolution-inference-smoketest
sudo cp -a lib/* /usr/lib/
sudo cp include/nnpack.h /usr/include/
sudo cp deps/pthreadpool/include/pthreadpool.h /usr/include/
git下载darknet-nnpack:
git clone https://github.com/shizukachan/darknet-nnpack.git
make
树莓派上测试:
在darknet-nnpack下运行:
Tiny-YOLO
./darknet detector test cfg/voc.data cfg/tiny-yolo-voc.cfg tiny-yolo-voc.weights data/person.jpg
就可以查看到识别后的照片。