Lightweight YOLOv8 Optimized Deep Neural Network for Real-Time Weapon Detection on Raspberry Pi 5 in Smart Surveillance Systems
Amah Gideon Gbaden, Jonathan A. Enokela, David O. Agbo, Tersoo E. Iorkyase
Journal of Engineering Research and Reports · pp. 99–112 · Published 25 Oct 2025
10.9734/jerr/2025/v27i111688Abstract
Background: The increasing prevalence for public safety threats necessitates the development of intelligent surveillance systems that are capable of real-time weapon detection. These conventional deep learning models achieve high accuracy but are mostly computationally intensive, limiting their deployment on edge devices. The deep learning models have proven to be great, particularly the, you only look once version (YOLOv8) algorithm when applied on Raspberry Pi 5 and web camera. Aims: This research proposes a lightweight and optimized YOLOv8-based deep neural network, specifically tailored for deployment on the Raspberry Pi 5. Study Design: The model is designed using raspberry pi, USB web camera with Google colab baseline. Place and Duration of Study: Sample: Department of Electrical and Electronics Engineering, Joseph Sarwuan Tarka University Makurdi, Nigeria and Department of Computer Engineering Technology, Federal Polytechnic Wannune Nigeria, between June 2024 and January 2025. Methodology: The study used a dataset comprising custom images of six (6) classes and corresponding annotations and labeling specifically tailored for weapon detection. The datasets were captured using USB web camera on raspberry pi 5 using some algorithms of the API and terminal of the raspberry pi5 to have the web camera capture the images in a saved folder. The images were pre-processed and augmented as necessary using algorithms to launch labelimg on raspberry pi 5 platforms to annotate and label the images. Because of the memory and the available TPU on google colab, a google drive was created to upload the datasets and had the model trained using the google colab. The datasets were split on a ratio of 70%, 20% and 10% on train, validate and test respectively with a yaml file of train and val on a class of six (6). It was then proceeded to train the YOLOv8 model, a state-of-the-art object detection architecture, on this dataset. The model was trained, validated and tested using standard evaluation metrics such as precision, recall, and mean Average Precision (MAP). Next, the model (best.pt) was deployed on raspberry pi 5 using an algorithm developed as a user-friendly interface to test the images on the model with the aid of the USB web camera. Results: The dataset after annotation and label was uploaded to google drive and google colab was used for the training of the model after downloading and installing ultralytics and all the dependencies. A yaml file was created with the train and val datasets with their respective paths. The study also shows the result samples of train/box, losses metrics: recall, precision, validation/box, losses and metrices/mAP at _0.5 and metricsmAP_05:0,95 with result showing experimental validation demonstrates that the optimized YOLOv8 model achieves real-time inference at over (axe = 97 %, daga = 97 %, handgun = 93 %, knife = 97 %, matchet = 99 % and picer = 99 %) with a mean average precision (mAP) of 96 % accuracy. Conclusion: The implementation of YOLOv8 for weapon detection on the Raspberry Pi 5 represents a significant advancement in both deep learning algorithms and edge device capabilities. YOLOv8’s improvement over previous versions and the enhanced computational power of the Raspberry Pi 5 provides a robust platform for real-time weapon detection. Future research should continue to address the challenges of deploying advanced models on edge devices and explore innovative solutions to enhance detection accuracy and efficiency.
Cited by 0
No indexed citations yet.
Related research
- Ecological Studies and Epidemiological Aspects of Leptospirosis in the Northeast Region of Brazil — shares topic coverage
- Disease Dynamics and Surveillance of Malaria in Malwa Region of Punjab and Evaluation of RDT Test — shares topic coverage
- Monkeypox Disease with Predominant Genital Symptoms: A Nigerian Case Report — shares topic coverage
- Epidemiological Investigation, Monitoring and Surveillance; Strategies in Public Health Sustenance — shares topic coverage
- High Serotype Diversity of Non-polio Enteroviruses Isolated in Ghana during Acute Flaccid Paralysis Surveillance, 2010-2014 — shares topic coverage
Article metrics
Real usage data collected on this platform.
10
Page views
0
PDF downloads
0
Outbound clicks
0
Citations
Views over time
Views by country
Approximate, from request IP at view time — not citizenship or institution. Countries with fewer than 5 views are grouped as "Other".
Traffic sources
Referring site, by host.
Views and downloads exclude known bots/crawlers. Citations combines this platform's own DOI-resolved index with each external source's own reported total — see Cited by above for individually listed citing works. Last refreshed 0 seconds ago.