0% found this document useful (0 votes)
20 views

Weapon Detection and Alerting System Using Deep Learning

The document presents a research study on a real-time weapon detection and alerting system utilizing deep learning, specifically the YOLOv3 algorithm, to enhance public safety by automatically detecting weapons and notifying authorities. The system achieved an accuracy rate between 71% to 78%, with an average of 74%, and includes features such as automated email alerts and evidence capture. Despite its effectiveness, the study acknowledges limitations in low-light conditions and proposes future improvements for better reliability and deployment.

Uploaded by

u12344321g
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
0% found this document useful (0 votes)
20 views

Weapon Detection and Alerting System Using Deep Learning

The document presents a research study on a real-time weapon detection and alerting system utilizing deep learning, specifically the YOLOv3 algorithm, to enhance public safety by automatically detecting weapons and notifying authorities. The system achieved an accuracy rate between 71% to 78%, with an average of 74%, and includes features such as automated email alerts and evidence capture. Despite its effectiveness, the study acknowledges limitations in low-light conditions and proposes future improvements for better reliability and deployment.

Uploaded by

u12344321g
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
You are on page 1/ 5

e-ISSN: 2582-5208

International Research Journal of Modernization in Engineering Technology and Science


( Peer-Reviewed, Open Access, Fully Refereed International Journal )
Volume:07/Issue:04/April-2025 Impact Factor- 8.187 www.irjmets.com
WEAPON DETECTION AND ALERTING SYSTEM USING DEEP LEARNING
Utkarsh Gupta*1
*1Department Of Information Technology, Thakur College Of Science And Commerce, Mumbai,
Maharashtra, India.
ABSTRACT
Security is a crucial aspect for a country to grow Economically and maintain a peaceful environment among its
citizens. For maintaining public security and safety, CCTV’s (closed circuit television) are used to monitor
various illegal activities like robberies, shootings etc. However, CCTV’s also require human supervision, which
comes with a risk of human errors such as missing of crucial information, etc. Despite the advancements in deep
learning algorithms and better hardware, we lack in creating advanced weapon detection and alerting systems.
There were many notable incidents in 2024, including bombings, shootings, and stabbings, it is concerning to
see such a rise in violence despite using the CCTV’s. This work focuses on enhancing the security and reducing
the crimes by detecting weapons in real-time and alerting the officials without the need of human supervision.
This work applies the state-of-art open source deep learning algorithms. A pre-trained dataset available on
Kaggle has been used to train this model. The algorithm used is YOLOv3 (You only look once). The accuracy rate
of this model ranges between 71% to 78% with an average accuracy score of 74% which will be further
increased by using a custom trained dataset for this model.
Keywords: Object Detection, Computer Vision, Gun Detection, Deep Learning, Artificial Intelligence, Knife
Detection.
I. INTRODUCTION
Ensuring public safety has become one of our foremost priority. However, there are significant security threats
in public places. Threats such as violent crimes and terrorist activities continue to rise, which highlights the
urgent need of an innovative solution to overcome such threats and minimize their response time. Traditional
surveillance techniques, such as CCTV’s, relies heavily on human monitoring which may result in human errors
and unable to provide alerts in real time. With advancements in computer vision and machine learning
technologies, objects detection is gaining prominence in various fields. Models based on technologies such as
YOLO (You only look once) has high accuracy for object detection in real time which makes it a suitable option
for its application in weapon detection and alerting system. Public security can be enhanced significantly by
combining AI-based detection system with automated alerting system which will lead to immediate threat
identification and minimizing response time. Regardless of technological advancements, existing surveillance
systems struggle with real time weapon detection. Also, the existing security infrastructure lacks the ability of
sending automated real-time notification upon detecting a weapon. Considering all these problems, there is a
need of a system which can detect weapons in real time and automatically sends an alert to prevent weapon
related incidents. This research aims to bridge this gap by leveraging deep learning and computer vision
technologies.
The objectives of this research are:
i) Developing a real-time weapon detection system.
ii) Sending a real-time email based notification upon weapon detection.
iii) Automatically capturing the frames in which the weapons are detected and storing it in the designated
folder.
iv) Enhancing public safety by reducing weapon related incidents.
II. RELATED WORK
Advancements in Deep learning technologies has lead to development of various weapon detecting systems.
Jain et al.[1] and Hashmi et al.[3] showed the usage of Artificial intelligence for weapon detection, and their
primary focus was on finding model accuracy and detection techniques. Bhatti et al. [2] and Warsi et al. [5]
implemented real-time weapon detection on CCTV footage using YOLO model, but their models lacked the
functionalities of alerting mechanism and automated frame capturing. Yeddula and Reddy [6] and Kumar et al.

www.irjmets.com @International Research Journal of Modernization in Engineering, Technology and Science


[2757]
e-ISSN: 2582-5208
International Research Journal of Modernization in Engineering Technology and Science
( Peer-Reviewed, Open Access, Fully Refereed International Journal )
Volume:07/Issue:04/April-2025 Impact Factor- 8.187 www.irjmets.com
[7] also used YOLO architecture for effective weapon detection, but did not add the functionalities of automated
alerting and evidence capturing in their models. A few researchers like Qi et al. [4] proposed systems which
supported real time alerting, but explicit notification system and evidence storage were not discussed in detail.
Deshpande et al. [8] implemented YOLOv8 for more efficient weapon detection, but did not emphasize on
alerting and storing of evidence. Thus, while there are many existing weapon detection systems with promising
accuracy, they clearly lack the functionalities of real-time alerting and automated evidence capturing which are
essential for practical, real world deployment of weapon detection systems. This research aims at bridging this
gap by creating a system that not only detects the weapon in real time but also sends the automated alerting
notifications and storing the frame in which the weapon has been detected for further analysis and evidence.
III. METHODOLOGY
3.1 Dataset
The dataset used to train this model is a pre-trained dataset collected from Kaggle (Kaggle is an online platform
which provides datasets and tools for data science and machine learning projects).
The contents of the dataset are discussed below in detail:
The weight file of this dataset was trained on 2000 epochs

Total Images 724

Primary Images 224

Secondary Images 500

Class = Weapons
Weapon types:
Knife
Pistols
Rifles
3.2 Processing
The configuration and weight files were loaded using OpenCV’s DNN module (yolov3weapon.cfg and
yolov3weapon.weights). The webcam was the primary source for taking video input, each frame of the video
was converted into blob, resized to 416x416 pixels and passed to yolov3 model for object detection. If the
detected object had a confidence score above 0.5, it classifies the object as weapon and draws a red bounding
box labelled as ‘weapon’ around the object in the video feed. After detection, the screenshot of the frame is
captured and stored in a designated folder. For real time response, the system is also integrated with automated
alerting mechanism. When a weapon is detected, an email is sent using SMTP protocol to the predefined
recipient.

IV. MODELLING AND ANALYSIS


cv2
The cv2 library is a python interface for OpenCV (Open Source Computer Vision Library) which provides
multiple features for reading, writing and manipulating images and videos. It is a widely used library for image
transformations, object detection, contour analysis, etc.

www.irjmets.com @International Research Journal of Modernization in Engineering, Technology and Science


[2758]
e-ISSN: 2582-5208
International Research Journal of Modernization in Engineering Technology and Science
( Peer-Reviewed, Open Access, Fully Refereed International Journal )
Volume:07/Issue:04/April-2025 Impact Factor- 8.187 www.irjmets.com
Model Architecture
The system employs YOLOv3 (You Only Look Once), a state-of-the-art real-time object detection architecture for
weapon detection from the image. YOLOv3 is a single-stage detector which means it can process the entire
image in a single pass instead of processing it multiple stage like in R-CNN models which makes it a suitable
option for real time processing systems. YOLOv3 uses a deeper network known as Darknet-53, which is
composed of 53 neural networks. The weights used in this system were pre-trained on a dataset containing
weapon images and trained on 2000 epochs.
Image Processing Flow
Each frame captured using the webcam goes through the following stage:
i) Capturing: Live video input is taken from the webcam.
ii) Preprocessing: Each image frame from video is resized into a blob, which make the frame a standard input
for YOLO.
iii) Forward Pass: The blob is passed through YOLOv3 network for generating a set of predictions.
iv) Confidence score checking: For each detected object, the model calculates confidence score, if the score is
more than 0.5 it considers the object as a valid object.
v) Bounding Box: The detected objected is marked with a red bounding box and labelled in the video feed itself.
vi) Post detection processing: After detection of a weapon, two immediate actions are performed – frame is
stored as evidence and an alerting email is sent.
This entire process runs on a loop to ensure real-time surveillance.
Threshold and detection logic
A threshold value of 0.5 for detection is applied, means the objects having confidence score above 0.5 are
identified as weapon which reduces the false positive outputs and false alarms.
V. RESULTS AND DISCUSSION
The weapon detection and alerting system was tested on multiple sets of video frames to test its performance
on various metrics like accuracy, reliability, latency, etc. The detection accuracy varied between 71% to 78%
with an average accuracy score of 74% across different testing conditions like lighting, object distance and
image quality. The accuracy score was calculated using the following formula.
(False Positive + False Negative) / Total Number of Images Tested
The false positives and false negative images were verified manually against ground truth to make this
calculation metric more reliable.
This level of accuracy score indicates that the system is fairly effective for identifying weapons in real time, but
still there can be improvement made in the system. During testing, we observed that the system performs well
in good lighting conditions and clear visibility. On the other hand, it gave more number of false negative and
false positive outputs in low lighting conditions and when the weapon was partially obscured. This issue can be
addressed by training the model with diverse datasets which will include more challenging scenarios.
Despite these limitations, the real-time performance of the system remained consistent. The model was able to
detect weapons within 1 to 1.5 seconds, a screenshot was captured within 0.5 to 1 second of detection and an
alert email was sent within 2 to 3 seconds of detection.
Tabular representation of accuracy scores and test conditions.

Total weapons
Test Condition Correct Detections Incorrect Detections Accuracy
present in video

Good-lighting
50 39 11 78%
condition

Low-lighting
50 36 14 72%
condition

www.irjmets.com @International Research Journal of Modernization in Engineering, Technology and Science


[2759]
e-ISSN: 2582-5208
International Research Journal of Modernization in Engineering Technology and Science
( Peer-Reviewed, Open Access, Fully Refereed International Journal )
Volume:07/Issue:04/April-2025 Impact Factor- 8.187 www.irjmets.com
Partial weapon
50 36 14 72%
visibility

Cluttered
50 37 13 74%
background

Overall Average 200 148 52 74%

Total email delayed = 11 (average delay time of ~3 to 5 seconds)


Total screenshot missed before capturing = 6

Screenshot of frame captured Email Alert


VI. CONCLUSION
This research explored the design and implementation of a real-time weapon detection and alerting system,
which aims to reduce real world weapon related incidents, ensuring public safety and security. The YOLOv3
model was used for weapon detection due to its speed and accuracy, as these are crucial factors for any real-
time operating system. The methodology involved using a pre-trained dataset sourced from Kaggle to train this
system. A standout feature of this model is its functionality of automated alerting mechanism. Whenever a
weapon was detected in the frame, the system captured a screenshot of the frame and sent an alerting email to a
predefined email address. This functionality makes this system an active surveillance assistant, useful for
making real-time alerts. The accuracy of this system ranged between 71% to 78% with an average accuracy
score of 74%, which was tested on various test cases like different lighting conditions, distance of object and
image clarity. While the system demonstrated a fair accuracy rate there is still room for improvement, future
enhancements will include creating a custom-trained dataset, refining the alerting mechanism and reducing the
detection errors which will increase the reliability of this system and make it more suitable for real world
deployment.
ACKNOWLEDGEMENTS
A Sincere Thanks to my mother Mrs. Ranjana D. Gupta and my father Mr. Dharmendra Gupta for their constant
support and encouragement. Their support played a crucial role in helping me to complete this research paper.
VII. REFERENCES
[1] Jain H, Vikram A, Kashyap A, Jain A. Weapon detection using artificial intelligence and deep learning for
security applications. In2020 International conference on electronics and sustainable communication
systems (ICESC) 2020 Jul 2 (pp. 193-198). IEEE.
[2] Bhatti MT, Khan MG, Aslam M, Fiaz MJ. Weapon detection in real-time cctv videos using deep learning.
Ieee Access. 2021 Feb 12;9:34366-82.
[3] Hashmi TS, Haq NU, Fraz MM, Shahzad M. Application of deep learning for weapons detection in
surveillance videos. In2021 international conference on digital futures and transformative technologies
(ICoDT2) 2021 May 20 (pp. 1-6). IEEE.
[4] Qi D, Tan W, Liu Z, Yao Q, Liu J. A dataset and system for real-time gun detection in surveillance video
using deep learning. In2021 IEEE international conference on systems, man, and cybernetics (SMC)
2021 Oct 17 (pp. 667 672). IEEE.
www.irjmets.com @International Research Journal of Modernization in Engineering, Technology and Science
[2760]
e-ISSN: 2582-5208
International Research Journal of Modernization in Engineering Technology and Science
( Peer-Reviewed, Open Access, Fully Refereed International Journal )
Volume:07/Issue:04/April-2025 Impact Factor- 8.187 www.irjmets.com
[5] Warsi A, Abdullah M, Husen MN, Yahya M, Khan S, Jawaid N. Gun detection system using YOLOv3.
In2019 IEEE International Conference on Smart Instrumentation, Measurement and Application
(ICSIMA) 2019 Aug 27 (pp. 1 4). IEEE.
[6] Yeddula N, Reddy BE. Effective deep learning technique for weapon detection in CCTV Footage. In2022
IEEE 2nd International Conference on Mobile Networks and Wireless Communications (ICMNWC)
2022 Dec 2 (pp. 1-6). IEEE.
[7] Kumar JA, Dhivya G, Selvaraj P, Karthikeyan VG, Ramesh SP, Lakshmi SJ, Saravanakumar R. Weapon
Detection Identification and Classification for DCNN and YOLO-V5 Techniques. In2024 International
Conference on IoT Based Control Networks and Intelligent Systems (ICICNIS) 2024 Dec 17 (pp. 1317-
1323). IEEE.
[8] Deshpande D, Jain M, Jajoo A, Kadam D, Kadam H, Kashyap A. Next-gen security: YOLOv8 for real-time
weapon detection. In2023 7th International Conference on I-SMAC (IoT in Social, Mobile, Analytics and
Cloud)(I-SMAC) 2023 Oct 11 (pp. 1055-1060). IEEE.

www.irjmets.com @International Research Journal of Modernization in Engineering, Technology and Science


[2761]

You might also like