Nothing Special   »   [go: up one dir, main page]

Major Project Report

Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

1

CROWD SOCIAL DISTANCE AND MASK DETECTION

USING CLASSICAL MACHINE LEARNING

(For the partial fulfilment of Bachelor of Technology Degree in Computer Science &

Engineering)

Submitted by

MAHIMA BISHT

SHUBHAM PARIHAR

ABHISHEK SUYAL

ANKIT NEGI

Under the guidance of

Mr. MUKESH KUMAR

Assistant Professor

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

GRAPHIC ERA HILL UNIVERSITY

May 2023
2

CERTIFICATE

This is to certify that the thesis titled “Crowd Social Distance and Mask Detection”
submitted by Author, to Graphic Era Hill University for the award of the degree of
Bachelor of Technology, is a bona fide record of the research work done by him/her under
our supervision. The contents of this project in full or in parts have not been submitted to any
other Institute or University for the award of any degree or diploma.

Mukesh Kumar
Project Guide
Assistant Professor
GEHU, Dehradun

Place: Dehradun

Date: 11/05/2023
3

ACKNOWLEDGEMENT

We would like to express our special thanks of gratitude to our Guide Mr. Mukesh Kumar as
who gave us the golden opportunity to do this wonderful project on the topic “Crowd Social
Distance and Mask Detection” which also helped us in doing a lot of research and we came to
know about so many new things. We are thankful to him.

Secondly, we would also like to thank our parents and friends who helped us a lot in
finalising this project within the limited time frame. We would like to express special thanks
to our Guide. Any attempt at any level can't be satisfactorily completed without the support
and guidance of our parents and friends.

Mahima Bisht Shubham Parihar

1918443 1918716

Abhishek Suyal Ankit Negi

1918130 1918223
4

ABSTRACT

In light of the ongoing COVID-19 pandemic and its potential impact on public health and
safety, there is an immediate requirement for creative approaches to reduce the virus's
transmission. In this paper, we present a computer vision-based system for detecting social
distancing violations and mask-wearing compliance in crowded public spaces. The system
uses a combination of deep learning algorithms and image processing techniques to analyse
camera feeds and identify violations in real-time. We describe the architecture of the system,
which includes a camera network, edge devices for image processing and analysis, and a
central server for data management and reporting. We also evaluate the accuracy and
efficiency of the system using a dataset of simulated crowd scenarios and real-world tests in
public spaces.

Our results demonstrate that the system is effective in detecting social distancing violations
and mask-wearing compliance with high accuracy and efficiency. We discuss the potential
applications of the system in public health and safety, including its use in monitoring crowds
in public spaces, increasing awareness and adherence to public health guidelines, and alerting
authorities in case of any violations.

Overall, we believe that our "crowd social distancing and mask detection" system has the
potential to become an important tool in the fight against COVID-19 and other infectious
diseases. We hope that our work will inspire further research and development in this area
and contribute to the ongoing efforts to control the spread of COVID-19 and other infectious
diseases.
5

TABLE OF CONTENTS

ACKNOWLEDGEMENT i

ABSTRACT ii

LIST OF TABLES iii

LIST OF FIGURES iv

ABBREVIATIONS v

NOTATIONS vi

1. INTRODUCTION 10

1.1 Motivation 10

1.2 Problem Statement 11

2. LITERATURE SURVEY 12

3. REQUIREMENT ANALYSIS 14

4. DESIGN

4.1. Proposed System

4.2. Libraries used

3.2.1 TensorFlow

3.2.2 OpenCV

3.2.3 Numpy

3.2.4 Matplotlib
6

3.2.5 Pandas

3.2.6 Keras

3.3 Machine Learning Approaches

3.4 Deep Learning

5. RESULT

6. CONCLUSION

FUTURE SCOPE

APPENDIX

REFERENCE
7

LIST OF FIGURES

Figure 1
8

ABBREVIATIONS

CNN Convolutional Neural Network

MTCNN Multi-Task Cascaded Convolutional Neural Network

CCTV Closed-Circuit Television

CPU Central Processing Unit

GPU Graphics Processing Unit


9

CHAPTER 1

INTRODUCTION

1.1 MOTIVATION:
The vaccine that can effectively treat Covid-19 has been developed but the globe did not yet
recover from this epidemic fully. Since the cases of Covid 19 have decreased below a
particular level, various governments have permitted a restricted range of activities to resume,
to lessen the impact of pandemic on the economy of the nations. One of the primary ways to
prevent the spread of the virus is to wear a mask in public spaces. However, compliance with
mask-wearing guidelines has been inconsistent, with some individuals refusing to wear masks
or wearing them improperly. This project aims to address the issue of non-compliance with
mask-wearing guidelines by developing a system for automatic mask detection.

Previous research has explored the use of computer vision for face recognition and detection,
but few studies have focused specifically on mask detection. Our project contributes to the
development of this field by exploring new methods for detecting masks in real-world
settings, and by evaluating the accuracy and reliability of different approaches.

Overall, this project has the potential to make a significant impact on public health and safety
by improving compliance with mask-wearing guidelines. It also contributes to the field of
computer vision by advancing our understanding of mask detection techniques.

1.2 PROBLEM STATEMENT


The objective of the model that we have created is to detect faces of people, whether they are
wearning masks or not. The objective is to detect masks on faces and to detect if the social
distancing is being maintained.
10

CHAPTER 2
REQUIREMENT ANALYSIS
We must split the project into two unique phases, each having a set of related sub-steps, to
train a bespoke face mask detector (as illustrated in Figure 1 above):

Training: First we will load our dataset from disc, train a model on it (by using either Keras
or TensorFlow), then serialise the mask detector to disc in this section.

Deployment: The next step is to load the mask detector, perform face detection, train the face
mask detector, and then categorise each face as having a mask or not.

Figure 1: Steps for building a face mask detector with computer vision and deep learning
using Python language and libraries like OpenCV & TensorFlow/Keras.
11

2.1 FUNCTIONAL REQUIREMENT


1. Crowd detection: The system should be able to detect the presence of a crowd and
count the number of individuals in the crowd.
2. Social distancing detection: The system should be able to detect if individuals are
maintaining social distance from one another and generate an alert if social distancing
is not being followed.
3. Mask detection: The system should be able to detect if individuals are wearing masks
and generate an alert if masks are not being worn.
4. Real-time detection: The system should be able to detect crowds, social distancing,
and mask-wearing in real-time to allow for quick intervention.
5. User-friendly interface: The system should have a user-friendly interface that allows
users to easily navigate and interact with the system.
6. Scalability: The system should be scalable to accommodate different crowd sizes and
configurations.

2.2 SYSTEM CONFIGURATION


The system can be executed on standard hardware. Our team has used an Intel I5 processor
with 8 GB RAM and a 1 GB Nvidia Graphic Processor. The processor has 2 cores running at
the speed of 1.7 GHz and 2.1 GHz respectively. The project has two phases: the training
phase, which takes approximately 10-15 minutes to complete, and the testing phase, which
only takes a few seconds to generate predictions and determine accuracy.

2.3 HARDWARE REQUIREMENTS


• 4GB RAM is used.

• 256GB of storage is used.

• The CPU speed should be 2GHz or more.

• The architecture should be of 32-bit or 64-bit

2.4 SOFTWARE REQUIREMENTS


• Python 3.10is used pre-processing the data, model training of it and making

prediction.

• Operating System ofWindows 8 or later versions, Linux-based operating systems, and MAC
OS.

• Coding Language: Python, JavaScript.


12

CHAPTER 3
DESIGN

3.1 PROPOSED SYSTEM


1. We have used the datasets of people containing images with and without mask to train the
model.

2. After the model training is done, the system can determine if a person is wearing a mask or
not.

3. The system can also determine if social distancing norms are being maintained or not.

4. It can also open the webcam and show the outcome, that is, our face and tell whether we
have our mask on or not.

3.2 LIBRARIES USED


3.2.1 TENSORFLOW

TensorFlow is a software library that is open source and was created by engineers and
researchers. It is used by Google's Machine Intelligence team, known as Google
Brain, for deep neural networks and machine learning research. This library supports
deep learning and regression methods and is written in Python. TensorFlow is a free
and open-source software library for differentiable programming and data flow across
various activities. It is a symbolic maths library used by neural network applications
in machine learning. TensorFlow is used for both research and production and is the
second-generation technology for Google Brain. Version 1.0.0 was made available on
February 11th, and it can run on multiple CPUs and GPUs. TensorFlow is available
on 64-bit Linux, macOS, Windows, and mobile operating systems like Android and
iOS. The library's adaptable design makes it easy to deploy computing across
different platforms, from desktop computers to server clusters to mobile and edge
devices.

3.2.2 OPENCV
13

OpenCV (Open Source Computer Vision) is an open-source library of computer


vision that is used in numerous applications.

Here are some key features and functionalities of OpenCV:

● Object detection: OpenCV includes several pre-trained object detection


algorithms, such as Haar Cascades and HOG (Histogram of Oriented
Gradients), that can be used to detect faces, people vehicles, and other objects
in images and videos.
● Machine learning: OpenCV includes machine learning algorithms such as
decision trees, k-NN, SVM (Support Vector Machines), and more that can be
used for classification and regression tasks.

3.2.3 NUMPY

NumPy (Numerical Python) is a library for Python programming language,


which is widely being used for numerical computing in scientific and data analysis
applications.

Here are some of the key features and functionalities of NumPy:

1. Arrays: NumPy arrays are similar to lists in Python, but they can hold only a single
data type and support vectorized operations for faster computations. Arrays can be
created using the numpy.array() function or by converting other data types to arrays.
2. Mathematical operations: NumPy provides a variety of mathematical functions for
performing basic and advanced mathematical operations on arrays. These include
arithmetic operations, trigonometric functions, logarithmic functions, statistical
functions, and more.
3. Broadcasting: Broadcasting is a feature of NumPy that allows for performing
arithmetic operations between arrays of different shapes and sizes. This eliminates the
need for explicitly reshaping arrays or writing loops to perform element-wise
operations.

NumPy is widely used in various fields such as data science, machine learning,
engineering, and finance due to its fast computation, memory efficiency, and support
for large arrays. It is also a fundamental library for other popular data science libraries
in Python, such as pandas and matplotlib.
14

3.2.4 MATPLOTLIB

Matplotlib is a Python library used for creating visualisations such as graphs, charts,
and plots. It provides a wide range of options for customising visualisations, making it
a popular tool for data visualisation in the scientific and data analysis communities.

Here are some key features and functionalities of Matplotlib:

1. Plotting: Matplotlib provides various types of plots such as line plots, scatter
plots, bar plots, histograms, and more. These can be created using the
matplotlib.pyplot module.
2. Customization: Matplotlib allows for customization of visualisations with a
variety of options such as changing colours, line styles, marker styles, font
styles, and more. These can be achieved using various functions in the library.
3. Subplots: Matplotlib enables creating multiple subplots in a single
visualisation for better organisation and comparison of data. These can be
created using the matplotlib.pyplot.subplot() function.
4. 3D Visualisation: Matplotlib provides support for creating 3D visualisations
such as 3D scatter plots and surface plots. These can be created using the
mpl_toolkits.mplot3d module.
5. Saving visualisations: Matplotlib allows saving visualisations in various
formats such as PNG, PDF, SVG, and more.

Matplotlib is widely used in various fields such as data science, engineering, finance,
and more, due to its flexibility and ability to create complex visualisations with ease.
It is also a fundamental library for other popular data science libraries in Python, such
as pandas and seaborn.

3.2.5 PANDAS

Pandas is an open-source library for the Python programming language that provides
data analysis and data manipulation tools for working with structured data. It is built
on top of the NumPy library, which is used for numerical computing, and provides
data structures such as Series (1-dimensional) and DataFrame (2-dimensional) for
efficient and flexible handling of data.

Here are some key features and functionalities of Pandas:

1. Data Cleaning: Pandas provides tools for data cleaning, such as handling
missing or duplicate data, filling in missing values, and dropping irrelevant
data.
15

2. Data Transformation: Pandas provides functionality for data transformation,


such as merging, joining, and pivoting data. It also provides functionality for
reshaping data, such as stacking and unstacking.

Pandas is widely used in various fields such as data science, finance,


marketing, and more, due to its ability to handle and manipulate large amounts
of structured data efficiently and effectively. It is also a fundamental library
for other popular data science libraries in Python, such as NumPy, Matplotlib,
and scikit-learn.

3.2.6 KERAS

Keras is an open-source neural network library written in Python. It is designed to


enable the creation of complex neural networks with just a few lines of code. Keras
provides a high-level API for building and training neural networks that can run on
top of various deep learning frameworks such as TensorFlow, Theano, and CNTK.

Here are some key features and functionalities of Keras:

1. Easy to Use: Keras provides a user-friendly interface for building and training
neural networks. It allows for building complex models with just a few lines of
code.
2. Modularity: Keras provides a modular design that allows users to easily
combine different types of layers to build complex neural network
architectures.
3. Support for Multiple Backends: Keras can run on top of various deep learning
frameworks such as TensorFlow, Theano, and CNTK, which enables users to
choose the backend that suits their specific requirements.
4. Preprocessing Tools: Keras provides a range of tools for preprocessing data,
including image preprocessing, sequence preprocessing, and text
preprocessing.
5. Built-in Visualization Tools: Keras provides a range of built-in visualisation
tools that allow users to easily visualise their models and their training
progress.

3.3 DEEP LEARNING


Deep learning is an artificial intelligence technique that emulates how the human brain
processes data to detect objects, recognize speech, translate languages, and make decisions.
16

Unlike traditional machine learning, deep learning can learn from unstructured and unlabeled
data without human supervision. A deep learning method called Convolution Neural
Networks (CNN) is used to build a face mask detection system. This technique aims to learn
feature hierarchies, where higher-level features are formed by combining lower-level
features. By automatically learning features at multiple levels of abstraction, deep learning
algorithms can discover good representations directly from data without relying on
human-crafted features. These higher-level learned features are defined in terms of
lower-level features and seek to exploit the unknown structure in the input distribution.

4.4 UML DIAGRAM


4.5.1 USE CASE DIAGRAM

Figure 2

4.5.2 SEQUENCE DIAGRAM


17

Figure 3

4.5.3 BLOCK DIAGRAM

Figure 4

4.5.4 DATA FLOW DIAGRAM

DFD is created using the following:

1. Dataflow: In dataflow, it is shown with the help of the arrows how data flows from source
to destination.
18

2.Process: The Process is shown with the help of a circle.

3.Source: In a data flow diagram (DFD), source refers to the origin or starting point of data or
information in a system. It can represent various sources, such as inputs from users, data from
external systems, or outputs from other processes within the same system
19

CHAPTER 5
RESULT

5.1 DATASET CHARACTERISTICS


This dataset contains two sets of images. One has photos with masks and another without
masks.

With mask: There are a total of 690 images under the with mask folder.

Figure 5

Without mask: There are a total of 686 images under the with mask folder
20

Figure 6

80% of the images are used for training the model and 20% is used for testing.

Real time Output:


21

Figure 7
22

CHAPTER 6
CONCLUSION

Crowd social distancing and mask detection technologies have emerged as promising tools
for promoting public health and safety during the COVID-19 pandemic. By leveraging
computer vision and machine learning algorithms, these systems can automatically detect
individuals who are not wearing masks or standing too close to one another, alerting
authorities, and reminding people to comply with social distancing guidelines. While these
technologies have their limitations, such as the risk of false positives and the potential for
privacy violations, they represent an important step forward in our collective efforts to
combat the spread of infectious diseases. As the pandemic continues to evolve and new
challenges emerge, it is likely that crowd social distancing and mask detection technologies
will play an increasingly important role in ensuring public health and safety.

In conclusion, our "crowd social distancing and mask detection" project aimed to address the
challenges of maintaining public health and safety during the COVID-19 pandemic. By
developing a computer vision-based system that can detect social distancing violations and
mask-wearing compliance, we have demonstrated the potential of technology to assist in
mitigating the spread of the virus in public spaces.

Our project has several benefits, including the ability to monitor large crowds in real-time,
increase awareness and adherence to public health guidelines, and alert authorities in case of
any violations. With further improvements and deployment, this system has the potential to
become an important tool in the fight against COVID-19 and other infectious diseases.

Overall, we believe that our "crowd social distancing and mask detection" project has
demonstrated the potential of computer vision and AI to contribute to public health and safety
in a meaningful way. We hope that our work will inspire further research and development in
this area and contribute to the ongoing efforts to control the spread of COVID-19 and other
infectious diseases.
23

FUTURE SCOPES

1. Integration with public health databases: In the future, our system could be integrated
with public health databases to monitor the spread of infectious diseases in real-time.
This would enable authorities to quickly respond to outbreaks and take proactive
measures to prevent further transmission.

2. Improved accuracy and precision: As the technology behind computer vision and AI
continues to advance, there is potential to improve the accuracy and precision of our
system. This could involve incorporating more advanced algorithms, improving the
quality of cameras and sensors, and conducting more extensive testing and
calibration.

3. Multi-lingual support: To increase the accessibility and usefulness of our system, we


could develop multi-lingual support. This would allow the system to recognize and
respond to social distancing and mask-wearing violations in a variety of languages,
which would be particularly useful in multicultural or multi-lingual settings.

4. Expansion to other public spaces: Our system is currently designed for use in crowded
public spaces, such as train stations and shopping malls. In the future, we could
explore opportunities to expand our system to other types of public spaces, such as
hospitals, schools, and airports.

5. Integration with wearable technology: With the rise of wearable technology, there is
potential to integrate our system with devices such as smartwatches or fitness
trackers. This could allow individuals to monitor their own social distancing and
mask-wearing compliance, and receive real-time feedback on their behaviour.
24

APPENDIX
25

REFERENCES

[1] Puja Gupta, Varsha Sharma, Sunita Varma, “A novel algorithm for mask detection and
recognizing actions of humans”, Expert Systems with Applications, Volume 198, 15 July
2022, 116823, A novel algorithm for mask detection and recognizing actions of human -
ScienceDirect

[2] G. Jignesh Chowdary, Narinder Singh Punn, Sanjay Kumar Sonbhadra & Sonali
Agarwal , “Face Mask Detection Using Transfer Learning of InceptionV3”, 3 January 2021,
Face Mask Detection Using Transfer Learning of InceptionV3 | SpringerLink.

[3] Amit Chavda, Jason Dsouza, Sumeet Badgujar, Ankit Damani, “Multi-Stage CNN
Architecture for Face Mask Detection”, 2021 6th International Conference for Convergence
in Technology (I2CT), Multi-Stage CNN Architecture for Face Mask Detection | IEEE
Conference Publication | IEEE Xplore

[4] Vibhuti, Neeru Jindal, Harpreet Singh & Prashant Singh Rana , “Face mask detection
in COVID-19: a strategic review”, 5 May 2022, Face mask detection in COVID-19: a
strategic review | SpringerLink

[5] Preeti Nagrath a, Rachna Jain a, Agam Madan a, Rohan Arora a, Piyush Kataria a,
Jude Hemanth,“SSDMNV2: A real time DNN-based face mask detection system using single
shot multibox detector and MobileNetV2”, Volume 66, March 2021, 102692, SSDMNV2: A
real time DNN-based face mask detection system using single shot multibox detector and
MobileNetV2 - ScienceDirect

[6] B. QIN and D. Li, “Identifying facemask-wearing condition using image


superresolution with classification network to prevent COVID-19”, May 2020, doi:
10.21203/rs.3.rs-28668/v1.

[7] M.S. Ejaz, M.R. Islam, M. Sifatullah, A. Sarker, “Implementation of principal


component analysis on masked and unmasked face recognition”, in: 2019 1st International
Conference on Advances in Science, Engineering and Robotics Technology (ICASERT),
2019, pp. 1–5,

[8] Jeong-Seon Park, You Hwa Oh, Sang Chul Ahn, and Seong-Whan Lee, Glasses removal
from facial image using recursive error compensation, IEEE Trans. Pattern Anal. Mach.
Intell. 27 (5) (2005) 805–811, doi: 10.1109/TPAMI.2005.103.

[9] C. Li, R. Wang, J. Li, L. Fei, Face detection based on YOLOv3, in:: Recent Trends in
Intelligent Computing, Communication and Devices, Singapore, 2020, pp. 277–284, doi:
10.1007/978-981-13-9406-5_34.
26

[10] N. Ud Din, K. Javed, S. Bae, J. Yi, A novel GAN-based network for unmasking of
masked face, IEEE Access 8 (2020) 44276–44287, https://doi.org/10.1109/
ACCESS.2020.2977386.

[11] A. Nieto-Rodríguez, M. Mucientes, V.M. Brea, System for medical mask detection in the
operating room through facial attributes, Pattern Recogn. Image Anal. Cham (2015) 138–145,
https://doi.org/10.1007/978-3-319-19390-8_16.

You might also like