Professional Documents
Culture Documents
ON
Bachelor of Technology
Information Technology
DECLARATION
University.
Samridhi Bhandari
2
00113303119-Samridhi Bhandari
ACKNOWLEDGEMENT
The successful completion of this project mark the beginning of an ever - going
learning experience of converting ideas and concepts into real life, practical
system. This project was a quite a learning experience for me at each and every
step. At the same time it has given me confidence to work in professional setup.
I feel the experience gained during the project will lead me to gain the bright
prospect in the future. First of all I would like to give thanks to Head,
participate and undergo training and internship program , which not only has
increased our awareness about latest fields but also taught me the importance of
team building. With the deep sense of gratitude, I express my sincere thanks to Dr.
Isha Singh for her active support and continuous guidance without which it would
have been difficult for me to complete this project. I will also like to thank the
other working staff teachers at FOSS CELL,BPIT,Delhi for taking keen interest
SAMRIDHI
BHANDARI
00113303119
BTech (IT)
3
00113303119-Samridhi Bhandari
CERTIFICATE
4
00113303119-Samridhi Bhandari
5
00113303119-Samridhi Bhandari
ABSTRACT
violence rate concerning guns and harmful weapons every year, becoming a challenge for
law enforcement agencies to deal with this issue on time. There are many places where the
crime rate caused by guns or knives is very high, especially in places where there are no gun
control laws. The early detection of violent crime is of paramount importance for citizens'
security. One way to prevent these situations is by detecting the presence of dangerous
weapons such as handguns and knives through surveillance videos. Present surveillance and
control systems still require manual monitoring and intervention. Here, we present a system
of automatic detection of weapons in the video, which is appropriate for surveillance and
control purposes. We have used the python code along with OpenCV for the detection of
weapons in real-time video. It focuses on a specific area of the image and trains each
component separately. The dataset is trained for classifying three classes of weapons
Handgun, Knife, and Heavy Guns. Once the weapon is detected, an alert beep will be sent to
authorities who can act accordingly and reduce the violent crimes before they take place.
6
00113303119-Samridhi Bhandari
CONTENTS
DECLARATION 2
ACKNOWLEDGEMENT 3
CERTIFICATE 4
ABSTRACT 5
CONTENTS 6
CHAPTER 1-INTRODUCTION
8
00113303119-Samridhi Bhandari
CHAPTER 5-TESTING
CHAPTER 6-CODES
CHAPTER 7-IMPLEMENTATION
BIBLIOGRAPHY… .......................................................................................................... 47
9
00113303119-Samridhi Bhandari
CHAPTER 1
INTRODUCTION
1.1.1 ABOUT
International Centre for Free and Open Source Software (ICFOSS) is an autonomous
organization set up by the Government of Kerala, India and having the combined mandate of
popularizing Free and Open Source Software for universal use; consolidating the early FOSS
work done in Kerala; and networking with different nations, communities and governments
Software enthusiasts, advocates, developers and supporters in the state of Kerala and outside.
Recognizing the strides made by the FOSS community in Kerala, and sensing a need to do
more, the Government of Kerala, in 2008, had set up a Committee headed by Prof Rahul De
of IIM Bangalore to recommend what further could be done to support the cause of FOSS.
10
00113303119-Samridhi Bhandari
The FOSS Cell Programme of ICFOSS aims to provide promotional services of FOSS to
1.1.2 Vision
The vision of the FOSS Cell is to encourage and promote the use of Free and Open
Source Software and related areas such as Open Hardware, amongst the students and
1.1.3 Mission
The FOSS Cell shall carry this out through associating with ICFOSS and its programmes, as
well as with other FOSS community, industry and research organizations, and taking up
programmes including training & capacity building, student projects, lectures & seminars,
The Student Ambassadors of ICFOSS will support this mission. Where student 11
00113303119-Samridhi Bhandari
ambassadors are not available for a particular institution, ICFOSS will directly assist to the
extent possible.
1.1.4 Objectives
• Identify and quantify the political, cultural and economic benefits for India as a result of
FOSS. This would not just be restricted to software but also to issues like patents,
• Develop an action plan aimed at making India a global leader in the open source
collaboration and shared ownership of intellectual resources to bridge the digital divide
• Create a road-map for open source software development for India's software export
industry
• Take the lead role in identifying technologies for different applications for the
12
00113303119-Samridhi Bhandari
ICFOSS trainings and workshops are mainly aimed at the development and promotion of
FOSS initiatives among the students, Faculty, professionals and Government employees to
make them competent and aware of the benefits of using FOSS applications and tools in tune
with the e-policy of Governments. It also popularize and familiarise the concept and use of
Open Source Operating Systems and softwares to improve operational skills of people.
ICFOSS has started trainings on the above concepts and currently within emphasis to FOSS
based support services to public as well as private sector employees, innovators, young
graduates and students. We are also providing capacity building programmes for
people from the year 2017. We are also engage in conducting various FDPs (Faculty
To promote the use of FOSS (Free and Open Source Software) technologies and
applications among students and faculties and to encore them in contributing towards the
educational institutions, in the year 2015. The Cell’s activities are bound in participation
with the members of the institutions and ICFOSS. These deeds of the Cell aim in promoting
FOSS activities through a group of interested students and teachers (Faculty Development
13
00113303119-Samridhi Bhandari
1.2.1 INTRODUCTION
During my course duration I had built a project based on Machine Learning in python language.
Below is a gist of the project along with running code and attached output. In brief the project lets
a user detect the number of time gun I detected in a frame during the whole duration of video.
Latest Research papers and articles based on Criminal Activity Detection project were
deeply studied and in this section a brief summary about the same is provided.
Major Technologies used for making this project are Machine learning and python
programming.
which focuses on making predictions using computers; but not all machine
machine learning.
Facebook, Google and Uber, make machine learning a central part of their
become more accurate in its predictions. There are four basic approaches:
algorithms with labeled training data and define the variables they want the
algorithm to assess for correlations. Both the input and the output of the algorithm
is specified.
that train on unlabeled data. The algorithm scans through data sets looking for
15
00113303119-Samridhi Bhandari
any meaningful connection. The data that algorithms train on as well as the
mix of the two preceding types. Data scientists may feed an algorithm mostly
labeled training data, but the model is free to explore the data on its own and
task and give it positive or negative cues as it works out how to complete a
task. But for the most part, the algorithm decides on its own what steps to
Supervised machine learning requires the data scientist to train the algorithm with
both labeled inputs and desired outputs. Supervised learning algorithms are good
answers.
16
00113303119-Samridhi Bhandari
sift through unlabeled data to look for patterns that can be used to group data
points into subsets. Most types of deep learning, including neural networks, are
following tasks:
occur together.
Machine learning has seen use cases ranging from predicting customer
learn associations and help teams tailor product development and marketing
help programmers write clear, logical code for small and large-scale projects.
Guido van Rossum began working on Python in the late 1980s, as a successor to
Python 0.9.0. Python 2.0 was released in 2000 and introduced new features, such
addition to reference counting). Python 3.0 was released in 2008 and was a major
18
00113303119-Samridhi Bhandari
19
00113303119-Samridhi Bhandari
“Criminal Activity Detection” using Python3.6 and OpenCV applying Machine learning
techniques.
A folder is made in which python code of project is stored along with libraries and sample
video/videos in which the gun detection operation is to be performed. Along with these files a
.rar file is been stored to hear audio/beep whenever a gun is detected in the frame during the
running video.
This project works by giving the specific path i.e. name of the video provided in that folder,
then after saving the file we run the python code on python3.6 IDE. For the output part, the
whole video runs on our screen and the algorithm set by us detects the guns in frame by
indicating green color box around the gun in each frame. At left bottom of the video we
could see the exact date and time when the gun was detected in video. With every gun
detection we hear a beep. After the whole video gets over we observe the total number of
20
00113303119-Samridhi Bhandari
During the compilation we are supposed to provide the path of video(the file
path inorder to get desired result.The format of file must me .amp or .mp4
A password key could be included into the system so that only the official
user with valid ID could access the recording and detect the crime.This
The exising system was able to detect only videos with .amp format but now
even .mp4 files with whatsoever duration could also be detected in the given
system. Hence increasing the range of detection i.e. more optimized system.
CCTV cameras, weapon detection in real-time is still a serious challenge. Observing angle
differences, occlusions by the carrier of the firearm and persons around it further enhances
21
00113303119-Samridhi Bhandari
the difficulty of the challenge. This work focuses on providing the user with exact date and
time when the gun is detected in the frame of given sample video. As a gun is detected we
hear a beep sound from our system. After the whole video ends ,we get an output on python
shell indicating the total number of detections .We have implemented binary classification
assuming pistol class as the reference class and relevant confusion objects inclusion concept
is introduced to reduce false positives and false negatives. No standard dataset was available
for real-time scenario so we made our own dataset by making weapon photos from our own
camera, manually collected images from internet, extracted data from YouTube CCTV
videos, through GitHub repositories. Two approaches are used i.e. sliding
window/classification and region proposal/object detection. Precision and recall count the
most rather than accuracy when object detection is performed .The project is executed in
python language.
22
00113303119-Samridhi Bhandari
CHAPTER-2
FEASIBILITY STUDY
the thinking of the analyst is presented to the user for review. When approved, the proposal
initiates feasibility study that describes and evaluates candidate systems and provides
for the selection of best system that meets system performance requirements.
To do a feasibility study, we need to consider the economic, technical factors in system
development. First a project team is formed. The team develops system flowcharts that
identify the characteristics of candidate systems, evaluate the performance of each system,
weigh system performance and cost data and select the best candidate system for the
job. The study culminates in a final report to the management.
INTRODUCTION:
SUMMARY:
1. A feasibility study is conducted to select the best system that meets performance
requirements. This entails an identification description, an evaluation of candidate
systems, and the selection of the best system for the job.
2. A statement of constraints, the identification of specific system objectives and a
description of outputs define a system’s required performance. The analyst is then
ready to evaluate the feasibility of candidate systems to produce these outputs.
3. Three key considerations are involved in feasibility analysis: economic, technical
and behavioral.
23
00113303119-Samridhi Bhandari
24
00113303119-Samridhi Bhandari
behaviors are to be realized. A system design and development requires appropriate and
timely application of engineering and management efforts to meet the previously
mentioned parameters. A system may serve its intended purpose most effectively
when its technical and operating characteristics are engineered into the design. Therefore
operational feasibility is a critical aspect of systems engineering that needs to be an
integral part of the early design phases
i. Economic Feasibility: -The purpose of the economic feasibility
assessment is to determine the positive economic benefits to the
organization that the proposed system will provide. It includes
quantification and identification of all the benefits expected. This
assessment typically involves a cost/ benefits analysis.
25
00113303119-Samridhi Bhandari
1. HARDWARE REQUIREMENT:-
2. SOFTWARE REQUIREMENTS:-
26
00113303119-Samridhi Bhandari
27
00113303119-Samridhi Bhandari
CHAPTER-3
DEVELOPMENT ENVIROMENT
• Its design philosophy emphasizes code readability with its use of significant
indentation.
programmers write clear, logical code for small and large-scale projects.
• Python's simple, easy to learn syntax emphasizes readability and therefore reduces
• Python is easy to understand for writing new software – it’s often possible to write
code faster .
• Python easy to understand it’s also often easier to understand someone else’s code
faster .
• Lots of IT project testers have started using Python to carry out repeatable test
procedures.
Python is a popular and in-demand skill to learn. But what is python programming
28
00113303119-Samridhi Bhandari
used for? We’ve already briefly touched on some of the areas it can be applied to,
Python is such a stable, flexible, and simple programming language, it’s perfect for various
machine learning (ML) and artificial intelligence (AI) projects. In fact, Python is among the
favourite languages among data scientists, and there are many Python machine learning and
Data Analytics
Much like AI and machine learning, data analytics is another rapidly developing field that
utilises Python programming. At a time when we’re creating more data than ever before, there
is a need for those who can collect, manipulate and organise the information. Python for data
science and analytics makes sense. The language is easy-to-learn, flexible, and wellsupported,
meaning it’s relatively quick and easy to use for analysing data. When working with large
amounts of information, it’s useful for manipulating data and carrying out repetitive tasks.
Data Visualisation
Data visualisation is another popular and developing area of interest. Again, it plays into many
of the strengths of Python. As well as its flexibility and the fact it’s open-source, Python
provides a variety of graphing libraries with all kinds of features. Whether you’re looking to
create a simple graphical representation or a more interactive plot, you can find a library to
match your needs. Examples include Pandas Visualization and Plotly. The possibilities are
29
00113303119-Samridhi Bhandari
Programming Applications
You can program all kinds of applications using Python. The general-purpose language can
be used to read and create file directories, create GUIs and APIs, and more. Whether it’s
blockchain applications, audio and video apps, or machine learning applications, you can build
Web development
Python is a great choice for web development. This is largely due to the fact that there are
many Python web development frameworks to choose from, such as Django, Pyramid, and
Flask. These frameworks have been used to create sites and services such as Spotify, Reddit
and Mozilla. The extensive libraries and modules that come with Python frameworks,
functions such as database access, content management, and data authorisation are all possible
and easily accessible. Given its versatility, it’s hardly surprising that Python is so widely used
in web development.
Game development
Although far from an industry-standard in game development, Python does have its uses in
the industry. It’s possible to create simple games using the programming language, which
means it can be a useful tool for quickly developing a prototype. Similarly, certain functions
language that has user-friendly syntax. It is known to have fewer lines of code in
an easy and simple form.
This name ‘Python’ is extracted from a British comedy series, “Monty Python’s Flying
Circus”. It is not named a snake. It is said that this was the favorite series of its inventor Guido
In Python, there can be multiple comparisons at once. It is able to check multiple conditions
at the same time. While in other programming languages, you can not program a chain of
comparison operators.
The comparison operators can be chained randomly. It does not have to follow a particular
order of operators.
Python relies on an interpreter. Unlike other programming languages, it does not need a
compiler.
The code is stored in a .pyc file. This file acts as a dynamic engine for Python eliminating the
31
00113303119-Samridhi Bhandari
Python has incorporated the variants of C and Java such as CPython, Jython, etc. The C variant
is
beneficial in
Unlike other languages, Python is the only language that can use else within for a loop. This
refactoring, and embedded Git. Users can change the theme, keyboard shortcuts,
Visual Studio Code is a source-code editor that can be used with a variety of
programming languages,
the Electron framework, which is used to develop Node.js Web applications that
32
00113303119-Samridhi Bhandari
run on the Blink layout engine. Visual Studio Code employs the same editor
programming languages and a set of features that differs per language. Unwanted
files and folders can be excluded from the project tree via the settings. Many
Visual Studio Code features are not exposed through menus or the user interface
Visual Studio Code can be extended via extensions, available through a central
repository. This includes additions to the editor and language support. A notable
new languages, themes, and debuggers, perform static code analysis, and add code
33
00113303119-Samridhi Bhandari
CodeSnack is the first mobile IDE made from the ground up for iPhone and iPad. It provides
you with fast and easy-to-use tools that make it possible for anyone to create great programs,
learn how to code by samples, and deploy real-world back-end and front-end apps within
CodeSnack is the first mobile IDE made from the ground up for iPhone and
iPad. It provides you with fast and easy-to-use tools that make it possible for
anyone to create great programs, learn how to code by samples, and deploy
Getting started takes seconds, and you don't need to be a strong coder or have
server administrator's skills to learn how to use it. With CodeSnack IDE, you
get all the control and flexibility you need to make things your way without
any compromise.
- Debug program output, and see detailed error logs (in real-time)
- Practice to code with examples library (we have 1000+ examples to check
out)
34
00113303119-Samridhi Bhandari
for coding:
* Java
* Python
*C
* C++
* C#
* Dart
* JavaScript
* TypeScript
* PHP
* Shell
* Swift
35
00113303119-Samridhi Bhandari
* Ruby
* Go
* Kotlin
* Lua
* Haskell
Subscription benefits:
- Up to 8x faster
- No ads
3.4 PyCharm
36
00113303119-Samridhi Bhandari
version control systems (VCSes), and supports web development with Django
Community Edition is released under the Apache License,[7] and there is also
and error highlighting, linter integration, and quick fixesProject and code
navigation: specialized project views, file structure views and quick jumping
rename, extract method, introduce variable, introduce constant, pull up, push
down and othersSupport for web frameworks: Django, web2py and Flask
user interface for Mercurial, Git, Subversion, Perforce and CVS with change
lists and mergeSupport for scientific tools like matplotlib, numpy and scipy .
PyCharm provides an API so that developers can write their own plugins to
extend PyCharm features. Several plugins from other JetBrains IDE also
37
00113303119-Samridhi Bhandari
work with PyCharm. There are more than 1000 plugins which are compatible
with PyCharm.
38
00113303119-Samridhi Bhandari
CHAPTER_4
SYSTEM DESIGN
4.1MODULAR DESCRIPTION
4.1.1 LOGIN AND REGISTRATION: -In this module new student or user
requires to enter his all details that’s has been asked to enter in signup form.
No field be remain unfilled.
All these details gets stored in the database, creating record for each student also
these details can be accessed further.
4.1.2 CHOICE OF SUBJECTS :- Here the students are new and want to
explore their potential. So the choice is given to them in the form of
topic/subjects, in which they can take the quiz in which they are
comfortable, so as to evaluate their performance and enhance their scope of
further improvement
.
4 RESULT GENERATION: At the end of the quiz i.e. the 8 MCQ’s the
result will be generated when the user or student submit his test. The result is
generated based on the student’s performance or his inputs. The result will
enable the user to access his performance and improve it.
39
00113303119-Samridhi Bhandari
CHAPTER-5
TESTING
Testing is the process of exercising software with the intent of finding errors and
ultimately correcting them. The following testing techniques have been used to make this
Content Review
The whole content of the project has been reviewed thoroughly to uncover
Navigation Errors
Different users were allowed to navigate through the project to uncover the navigation
errors. The views of the user regarding the navigation flexibility and user friendliness were
Unit Testing
harness.
Unit testing done to show that the unit does not satisfy the application and
/or its implemented software does not match the intended designed structure.
Integration Testing
40
00113303119-Samridhi Bhandari
components.
System testing
requirements (test characteristics that are only present when entire system is run)
components.
Concern: issues, behaviors that can only be exposed by testing the entire integrated
grid etc.). Hence in case of project in V.B. form are the basic units. Each form is tested
Regression Testing
Each time a new form is added to the project the whole project is tested thoroughly to
rectify any side effects. That might have occurred due to the addition of the new form.
White-Box testing
White-box testing (also known as clear box testing, glass box testing, transparent box
testing and structural testing) tests internal structures or workings of a program, as opposed
41
00113303119-Samridhi Bhandari
perspective of the system, as well as programming skills, are used to design test cases. The
tester chooses inputs to exercise paths through the code and determine the appropriate
outputs.
While white-box testing can be applied at the unit, integration and system levels of the
software testing process, it is usually done at the unit level. It can test paths within a
unit, paths between units during integration, and between subsystems during a system–
level test. Though this method of test design can uncover many errors or problems, it might
Code coverage – creating tests to satisfy some criteria of code coverage (e.g., the
test designer can create tests to cause all statements in the program to be executed at
least once)
testing strategies.
Code coverage tools can evaluate the completeness of a test suite that was created
with any method, including black-box testing. This allows the software team to
examine parts of a system that are rarely tested and ensures that the most important
function points have been tested. Code coverage as a software metric can be reported
as a percentage for:
42
00113303119-Samridhi Bhandari
Statement coverage, which reports on the number of lines executed to complete the test
100% statement coverage ensures that all code paths, or branches (in terms of control
flow) are executed at least once. This is helpful in ensuring correct functionality, but not
sufficient since the same code may process different inputs correctly or incorrectly.
Black-box testing
Black-box testing treats the software as a "black box", examining functionality without
any knowledge of internal implementation. The tester is only aware of what the software
is supposed to do, not how it does it. Black-box testing methods include: equivalence
partitioning, boundary value analysis, all-pairs testing, state transition tables, decision
table testing, fuzz testing, model-based testing, use case testing, exploratory testing and
specification-based testing.
applicable requirements. This level of testing usually requires thorough test cases to be
provided to the tester, who then can simply verify that for a given input, the output
value (or behaviour), either "is" or "is not" the same as the expected value specified in the
test case. Test cases are built around specifications and requirements, i.e., what the
specifications, requirements, and designs to derive test cases. These tests can be functional
One advantage of the black box technique is that no programming knowledge is required.
43
00113303119-Samridhi Bhandari
Whatever biases the programmers may have had, the tester likely has a different set and
may emphasize different areas of functionality. On the other hand, black-box testing has
been said to be "like a walk in a dark labyrinth without a flashlight." Because they do
not examine the source code, there are situations when a tester writes many test cases
to check something that could have been tested by only one test case, or leaves some parts
This method of test can be applied to all levels of software testing: unit, integration, system
and acceptance. It typically comprises most if not all testing at higher levels, but can
Alpha Testing
an independent test team at the developers' site. Alpha testing is often employed for
off-the-shelf software as a form of internal acceptance testing, before the software goes to
beta testing.
Beta Testing
Beta testing comes after alpha testing and can be considered a form of external user
acceptance testing. Versions of the software, known as beta versions, are released to a
limited audience outside of the programming team. The software is released to groups of
people so that further testing can ensure the product has few faults or bugs. Sometimes,
beta versions are made available to the open public to increase the feedback field to a
44
00113303119-Samridhi Bhandari
5.2.1 Debugging
Developers often find themselves in situations where the code they've written
is not working quite right. When that happens, a developer debugs their code
of the application does not match the assumptions of how the code should be
correctly running.
There are bugs in every modest sized or larger application. Every developer
has to learn how to debug code in order to write programs that work as
logic. Debugging is a complex skill that takes time and practice for a
45
00113303119-Samridhi Bhandari
Breakpoints
Trace Points
into IDEs like PyCharm and others that are standalone applications. The
following list contains mostly standalone tools that you can use in
pdb is a debugger built into the Python standard library and is the one most developers
Web-PDB provides a web-based user interface for pdb to make it easier to understand
wdb uses WebSockets to allow you to debug running Python code from a web browser.
Pyflame (source code) is a profiling tool that generates flame graphs for executing Python
program code.
objgraph (source code) uses graphviz to draw the connections between Python objects
running in an application
46
00113303119-Samridhi Bhandari
1.UseBuilt-InFunctions
Built-in function in any language is always useful because you don’t need to write
your code from scratch. The same goes for Python. Python comes with many
useful libraries and built-in functions. These libraries are helpful in writing the
features at several places in your development project. You can write high-quality,
libraries are optimized and tested rigorously (like your code). These built- in
functions are easy to use in your project. You won’t have redundant code in your
item at a time instead of returning the items all at once. Xrange() function is a
you’re using lists, you should write your own generator. Generators give you lazy
evaluation and memory will be used efficiently. Generators are very useful if
you’re reading numerous large files. You can process a single chunk without
3.UseListComprehensions
//
4.Usexrange()Insteadofrange()
square_numbers
In Python = loops
2, to iterate over [] for n
weincan
range(0,10):
use range()ifand
n %xrange()
2 == 1: fun ctions. The
square_numbers.append(n**2)
first function stores all the numbers in the range in memory, and it got linearly
large as range did. Other function xrange() return the generator object. If you loop
47
00113303119-Samridhi Bhandari
The above code returns 560064. If you use xrange with the same range, it will
return 40. If you’re writing your application in Python 2, Then swapping functions
5.UseSetsandUnions
If you’re using too many loops in your code, then you will put unnecessary strain
on your server. This will be the most efficient approach. You can get the
overlapping values in two lists. You can do this using nested for loops, as given
6. BeLazyWithModuleImporting
Experts in Python suggest importing all the modules at the start of your program.
You can sort these alphabetically. This approach will help you in keeping the track
48
00113303119-Samridhi Bhandari
of the dependencies your program has, but the disadvantage is that your imports
loadatstartup.
You can try a different approach? You can load the modules when you need them.
This technique will help you in distributing the loading time for modules evenly,
7. e“in”ifPossible
It is recommended to use the “in” keyword to check the membership of a list. for
All the above code will help you in running your code faster, and this will allow
you to get a better Python performance from your application. As you will progress
with Python, you will find many tips, and you on your own will learn to optimize
your code in Python. You will be using lists, dictionaries, tuples, and many other
things in Python and while building your logic or adding some features, slowly
49
00113303119-Samridhi Bhandari
CHAPTER 6
CODES
import numpy as np
import cv2
import imutils
import datetime
gun_cascade = cv2.CascadeClassifier('cascade.xml')
camera = cv2.VideoCapture('data/gun4_2.mp4')
gun_exist = False
while True:
(grabbed, frame) = camera.read()
# if the frame could not be grabbed, then we have reached the end of the
video
if not grabbed:
break
if len(gun) > 0:
gun_exist = True 50
00113303119-Samridhi Bhandari
if gun_exist:
print("guns detected")
else:
print("guns NOT detected")
51
00113303119-Samridhi Bhandari
CHAPTER-7
IMPLEMENTATION
import numpy as np
import cv2
import imutils
import datetime
gun_cascade = cv2.CascadeClassifier('cascade.xml')
camera = cv2.VideoCapture('data/gun4_2.mp4')
gun_exist = False
while True:
(grabbed, frame) = camera.read()
# if the frame could not be grabbed, then we have reached the end of the
video
if not grabbed:
break
if len(gun) > 0:
gun_exist = True
52
00113303119-Samridhi Bhandari
if gun_exist:
print("guns detected")
else:
print("guns NOT detected")
53
00113303119-Samridhi Bhandari
7.3 Screenshots
OUTPUT
54
00113303119-Samridhi Bhandari
55
00113303119-Samridhi Bhandari
CONCLUSION
The project “ Criminal Activity Detection” aims to detect the authority about guns
detected in a frame along with exact date and time.
This project uses machine learning to detect objects and even .mp4 files could be
detected no matter what length. We are able to hear a beep sound after each gun
spotted. The project is good for security purposes and would surely provide an aid to
detect criminal activities and hence ultimately aims to reduce such activities in future.
This project cover very much every function needed by user in Criminal Activity
Detection.
56
00113303119-Samridhi Bhandari
BIBLIOGRAPHY
1. www.python.org
5. Code.visualstudio.com
6. www.jetbrains.com
7. www.google.com
8. www.wikipedia.org
9. www.codesnack-ide.com
10.www.icfoss.in
57