Object Detection On Raspberry Pi
Object Detection On Raspberry Pi
Joshua Littleton, Xavier Dukes, Arthur Quinney, Tri’Heem Neville, Christopher Rollerson,
Xishuang Dong
Electrical and Computer Engineering Department
Prairie View A&M University
Abstract
Internet of Things (IoT) refers to the billions of edge devices around the world connected to the
internet for various applications such as collecting and analyzing data. Data analytics on these edge
devices can protect user privacy and reduce communication costs. Specifically, computer vision is a
core technique to build such applications on these devices, where object detection is an imperative
task that is to recognize categories of objects and label their locations. This paper presented a senior
design project that implemented object detection on Raspberry Pi via machine learning models. It is
to employ Raspberry Pi Kits and a web-camera to detect predefined objects by running mobile deep
learning models. Moreover, it was extended to recognize weapons in images with transfer learning
techniques, which is to fine-tune the models on new annotated datasets collected from Internet.
Specifically, it applied a Google USB accelerator to improve the detection speed. Preliminary
validation results demonstrate that the models can effectively detect general objects such as person,
keyboard, and laptop, as well as predefined weapons on Raspberry Pi.
Introduction
The Internet of Things (IoT) refers to the billions of edge devices around the world connected to the
internet for collecting and analyzing data, which is evolving rapidly and widening existing
communication systems. It was predicted that more than 50 billion IoT devices will be involved in
IoT1 after 2020 and these devices will be linked with each another to exchange and generate data to
make everyday life easier in different aspects such as healthcare2, military3, smart home4, and
agriculture5 by developing various applications. Specifically, computer vision is a core technique to
build these applications, where object detection is an imperative task in this field that is to recognize
categories of objects and label their locations.
This paper presents a senior design project that implemented object detection on Raspberry Pi by
running deep learning models, where the edge devices include Raspberry Pi 3 and 4, Model B+ (Plus)
Complete Starter Kit1 and a web camera. It consists of three steps: 1) hardware configuration: it is to
configure the Raspberry Pi and mount the web-camera on the Raspberry Pi; 2) software installation:
it is to install necessary software such as TensorFlow and OpenCV; 3) deploying mobile deep learning
models on Raspberry Pi to run object detection. Experimental results demonstrate the effectiveness of
this implementation. Moreover, we leverage the USB accelerator to improve the detection speed.
1
https://www.canakit.com/raspberry-pi-3-model-b-plus-starter-kit.html
Proceedings of the 2022 ASEE Gulf-Southwest Annual Conference
Prairie View A&M University, Prairie View, TX
Copyright ã 2022, American Society for Engineering Education
Finally, we extend this implementation to weapon detection through fine-tuning pretrained deep
learning models on data samples collected and annotated manually.
Project
This project implemented object detection on Raspberry Pi. As a core task in the field of computer
vision, object detection is to detect instances of visual objects with a certain class (such as airplane,
car, or animal) in digital images. It is implemented by developing computational models and
techniques to recognize objects and their locations, which can be applied to many downstream
computer vision tasks. Recent years have witnessed the breakthrough of object detection with the
emergence of deep neural networks (DNNs)6, especially, convolutional neural network (CNN)7.
Compared to traditional techniques, the CNN can extract more specific and advanced features with
deeper architectures layer by layer. Moreover, the expressivity and robust training algorithms allow
CNN to learn informative object representations without the need to design features manually8.
However, these models need
to run with many Input Images Object Class and
computational resources, Web camera Mobile Deep
Location
edge devices for IoT. To Figure 1. Object detection on an edge device with a mobile deep learning model
overcome this challenge,
mobile deep learning models have been implemented on these devices. With this advanced technique,
this project is implemented as Figure 1. Web camera took pictures as input images to the mobile deep
learning models that run on an edge device. Once completing detection, it will output object classes
and corresponding locations on the
image.
Moreover, this project is extended
to detect weapons. It is observed that
a large amount of population
reconciles violence related to various
weapons such as guns and knives all
over the world. Therefore, it will be a
good proactive solution to detect
these weapons in public area to
protect citizens. In this work, we Figure 2. Flow of weapon detection
implemented weapon detection on
images, which is designed as Figure 2. Camera will help obtain the input data that would be video
streams. Then, it will process the video and isolate images with image acquisition. Afterwards, we
will apply mobile deep learning model to detect weapons with image recognition, where the output is
to confirm if there is a weapon. If there is a weapon, it will send a notification. Otherwise, it will
process the next image.
For object detection on Raspberry Pi, we ran SSD-MobileNet on Raspberry Pi 3 to implement object
detection. In addition, we employed accelerator to speed up the detection. Compared to the detection
without this accelerator, the detection speed can be improved from 1.13 frame per second from to
10.51 frame per second on averages. Figure 5 presents three examples of detection results. The left
example indicates that the implementation can detect multiple objects including a person and a phone
even if the person was wearing face mask. In addition, the locations of these two objects are accurate
in terms of bounding boxes. The middle example shows that the implementation can detect the object
with high confidence (96%). The right example presents a more complex case that the locations of
objects have overlaps. For instance, although the phone’s location has overlaps with that of the person,
the implementation can still detect these objects correctly.
For weapon detection on Raspberry Pi, we ran fine-tuned SSD-
MobileNet on Raspberry Pi 4, where Figure 6 presents one example
of detection results. Currently, we utilized the camera on laptop for
this validation. In terms of the preliminary detection results, current
version of implement is able to detect certain weapons such as
handgun. However, the detection speed is not high enough for real-
world applications. In addition, it is still limited with predefined Figure 6. An example of detecting
weapons. weapons
Conclusion
This paper presents preliminary work of the implementation of object detection on Raspberry Pi for a
senior design project. We run a mobile deep learning model, SSD-MobileNet, on Raspberry Pi to
detect various objects. Preliminary valudation results demonstrate the effectiveness of this
implementation. Moreover, the on-going work is to improve weapon detection. Future work will focus
on completing comprehensive and systematical validation on weapon detection in different testing
scenarios.
References
1. Dave, E. (2011). How the next evolution of the internet is changing everything. The Internet of Things.
2. Islam, S. R., Kwak, D., Kabir, M. H., Hossain, M., and Kwak, K. S. (2015). The internet of things for health care: a
comprehensive survey. IEEE access, 3, 678-708.
3. Cohen, A. E., Jiang, G. G., Heide, D. A., Pellegrini, V., and Suri, N. (2018, October). Radio frequency IoT sensors in
Proceedings of the 2022 ASEE Gulf-Southwest Annual Conference
Prairie View A&M University, Prairie View, TX
Copyright ã 2022, American Society for Engineering Education
military operations in a smart city. In MILCOM 2018-2018 IEEE Military Communications Conference
(MILCOM) (pp. 763-767). IEEE.
4. Salman, L., Salman, S., Jahangirian, S., Abraham, M., German, F., Blair, C., and Krenz, P. (2016, December). Energy
efficient IoT-based smart home. In 2016 IEEE 3rd World Forum on Internet of Things (WF-IoT) (pp. 526-529). IEEE.
5. Kjellby, R. A., Cenkeramaddi, L. R., Frøytlog, A., Lozano, B. B., Soumya, J., and Bhange, M. (2019, April). Long-
range & self-powered IoT devices for agriculture & aquaponics based on multi-hop topology. In 2019 IEEE 5th World
Forum on Internet of Things (WF-IoT) (pp. 545-549). IEEE.
6. Kang, K., Li, H., Yan, J., Zeng, X., Yang, B., Xiao, T., and Ouyang, W. (2017). T-cnn: Tubelets with convolutional
neural networks for object detection from videos. IEEE Transactions on Circuits and Systems for Video
Technology, 28(10), 2896-2907.
7. Girshick, R., Donahue, J., Darrell, T., and Malik, J. (2014). Rich feature hierarchies for accurate object detection and
semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition (pp. 580-
587).
8. Goodfellow, I., Bengio, Y., and Courville, A. (2016). Deep learning. MIT press.
9. Ali, 2013 M.,Vlaskamp J.H.A,Eddiny N.N.,Falconer B. and Oram c., Technical Development and Socioeconomic
Implications of the Raspberry Pi as a Learning Tool in Developing Countries,5th Computer Science and Electronic
Engineering Conference (CEEC), pp. 103- 108, 2013.
10. Arabi, Saeed, Arya Haghighat, and Anuj Sharma. A deep learning based solution for construction equipment
detection: from development to deployment. arXiv preprint arXiv:1904.09021 (2019).
11. Upton, L. (2013). The Raspberry Pi in scientific research.
12. Tan, C., Sun, F., Kong, T., Zhang, W., Yang, C., and Liu, C. (2018, October). A survey on deep transfer learning.
In International conference on artificial neural networks (pp. 270-279). Springer, Cham.
13. COCO SSD MobileNet: https://www.tensorflow.org/lite/examples/object_detection/overview
Joshua Littleton, Xavier Dukes, Arthur Quinney, Tri’Heem Neville, and Christopher Rollerson are
senior-level undergraduate students of Electrical and Computer Engineering Department, Roy G.
Perry College of Engineering, Prairie View A&M University.
XISHUANG DONG
Dr. Xishuang Dong currently serves as Assistant Professor of Electrical and Computer Engineering
Department, Roy G. Perry College of Engineering, Prairie View A&M University. His research
interests include deep learning, object detection, natural language processing, computer systems
biology, and Internet of Things.