0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Raspberry Pi 4で YOLOv4を動かす

Last updated at Posted at 2021-02-10
  • Raspberry Pi 4 4GB

  • logicool C270N

  • 2021-01-11-raspios-buster-armhf-full

パッケージの更新とスワップ領域の設定

sudo apt update
sudo apt upgrade

sudo nano /etc/dphys-swapfile

/etc/dphys-swapfile
CONF_SWAPSIZE=4096
CONF_MAXSWAP=4096

sudo /etc/init.d/dphys-swapfile stop
sudo /etc/init.d/dphys-swapfile start

各種パッケージのインストール

sudo apt install python-opencv
sudo apt install libopencv-dev
sudo apt install libopm-dev
sudo pip3 install opencv-python

YOLOv4のmake

git clone https://github.com/AlexeyAB/darknet
cd darknet/
nano Makefile

Makefile
 OPENCV=1
 OPENMP=1
 LIBSO=1
 USE_CPP=1

make -j4

ウェイトファイルのダウンロードと動作確認

wget https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4-tiny.weights

静止画の検出
./darknet detector test cfg/coco.data cfg/yolov4-tiny.cfg yolov4-tiny.weights data/dog.jpg

cfg/yolov4-tiny.cfgにて入力画像サイズ(width、height)を変更した時の推論時間
416x416 data/dog.jpg: Predicted in 5673.473000 milli-seconds.
256x256 data/dog.jpg: Predicted in 2625.850000 milli-seconds.
128x128 data/dog.jpg: Predicted in 516.762000 milli-seconds.

128x128 Overclocking:1800MHz
data/dog.jpg: Predicted in 436.980000 milli-seconds.

動画の検出
./darknet detector demo cfg/coco.data cfg/yolov4-tiny.cfg yolov4-tiny.weights -c 0

FPS:1.1 AVG_FPS:1.1

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?