When performing object detection with Raspberry Pi, I compared the detection speed and detection accuracy of each source of YOLO (You only look once), which is one of the main object detection methods, so I will summarize it.
Regarding the mechanism of YOLO, it was easy to understand [History of object detection method: Introduction of YOLO].
As a pet camera for cats, I want to distinguish between four cats! The pattern is different for all four! I only think about what to distinguish and what to do, such as monitoring the state of the cat and controlling the remote control of the air conditioner, or looking at the amount of activity and using it for health management.
--MUST: You can change the number of classes to identify and create your own learning model (outside the scope of this article). --MAY: I want to judge once a second if possible
![RaspberryPi-RaspberryPi4 ModelB (4GB)](https://img.shields.io/badge/Raspberry Pi-RaspberryPi4 ModelB (4GB) --brightgreen)![OS-Raspbian 32bit (2020.5.27 version)](https:: //img.shields.io/badge/OS-Raspbian 32bit (2020.5.27 version) --brightgreen)
The evaluation target is the COCO dataset (80 classes), YOLO author's site: YOLO: Real-Time Object Detection and [AlexeyAB](https:: //github.com/AlexeyAB/darknet) uses the weights of the trained model distributed. Each model has a "Tiny" that prioritizes detection time.
Below is the result of Source x Model. The explanation, the image of the result, and the impression will be described later.
Source | Model | Detection time | Detection accuracy |
---|---|---|---|
pjreddie | v2 | 477 seconds | ○ |
pjreddie | v2-Tiny | 42 seconds | × |
AlexeyAB | v2 | 33 seconds | ○ |
AlexeyAB | v2-Tiny | 6.6 seconds | △ |
AlexeyAB | v3 | 74 seconds | ◎ |
AlexeyAB | v3-Tiny | 6.7 seconds | ○ |
AlexeyAB | v4 | 152 seconds | ◎ |
AlexeyAB | v4-Tiny | 7.8 seconds | ○ |
keras-yolo3 | v3 | 12 seconds | ◎ |
keras-yolo3 | v3-Tiny | 0.75 seconds | ○ |
Tensorflow-YOLOv3 | v3 | 8.9 seconds | ◎ |
Tensorflow-YOLOv3 | v3-Tiny | 3.4 seconds | ○ |
yolov3-tf2 | v3 | 5.6 seconds | ◎ |
yolov3-tf2 | v3-Tiny | 0.67 seconds | ○ |
The detection accuracy is subjective, but it is based on the recognition rate of the main object in each image. ◎ (90% -100%), 〇 (70% -90%), △ (50% -70%), × (unrecognizable).
pjreddie/darknet https://pjreddie.com/ https://github.com/pjreddie/darknet
Segmentation fault
. (Environmental problem because it can be detected by Google Colaboratory)
――V2-Tiny didn't seem to be able to detect the object. (This is also an environmental problem because it can be detected by Google Colaboratory)Model | dog | person |
---|---|---|
v2 | ||
v2-tiny |
AlexeyAB/darknet https://github.com/AlexeyAB/darknet
--The inherited version of pjreddie. Compatible with YOLO v4. --You can download the weights of the trained model of YOLO v4 from here. --C language --It is possible to run it on GPU by changing the parameters of the make file, but it is difficult with Raspberry Pi. --The CPU usage rate during object detection is transitioning from 25 to 35%, and the CPU usage efficiency is poor.
Model | dog | person |
---|---|---|
v2 | ||
v2-tiny | ||
v3 | ||
v3-tiny | ||
v4 | ||
v4-tiny |
qqwweee/keras-yolo3 https://github.com/qqwweee/keras-yolo3
--keras version --You can convert and use pjreddie / darknet weights. --Since the image of the detection result cannot be output by default, the processing was added by referring to I moved YOLO-v3 of Keras. --The CPU usage rate during object detection is 100%
Model | dog | person |
---|---|---|
v3 | ||
v3-tiny |
neuralassembly/Tensorflow-YOLOv3 https://github.com/neuralassembly/Tensorflow-YOLOv3 Try object detection with YOLO v3-Tiny / YOLO v3 on Raspberry Pi
--Tensorflow 1 series --You can convert and use pjreddie / darknet weights. --Since the detection time is not output, measure the time before and after sess.run (). --The CPU usage rate during object detection is 100%
Model | dog | person |
---|---|---|
v3 | ||
v3-tiny |
zzh8829/yolov3-tf2 https://github.com/zzh8829/yolov3-tf2
--tensorflow2 system (using tf.keras)
--You can convert and use pjreddie / darknet weights.
--In RaspberryPi, pip install tensorflow
did not include tensorflow2, so download and install tensorflow-2.2.0-cp37-cp37m-linux_armv7l.whl
from https://github.com/PINTO0309/Tensorflow-bin.
--CPU usage during object detection is 75-85%
Model | dog | person |
---|---|---|
v3 | ||
v3-tiny |
――To satisfy "I want to judge once a second", the detection accuracy drops a little, but it is difficult only with Python v3-tiny. ――When I use it, the number of classes will be small, so I hope that it will improve the accuracy.
--For learning, build Alexey AB on the GPU version and run it on Google Colaboratory. 1000 epochs for Tiny: about 7 minutes. ――For object detection, decide which one to use based on the ease of diversion from the Python system. (Is zzh8829 / yolov3-tf2 safe considering the future?) ――I have to take a picture of the cat. ..
Using Darknet with Raspberry Pi YOLOv3 dissertation translation
qqwweee/keras-yolo3 -I tried object detection with YOLO (keras-yolo3)! -I moved YOLO-v3 of Keras -Engineer's sleepless night [object detection] how to use keras-yolo3
zzh8829/yolov3-tf2 -Use yolov3-tf2 to easily try real-time object detection. / Tensorflow v2 ・ keras
Recommended Posts