Smart Safety and Security Solution For Women Using KNN Algorithm and Iot

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

Proceedings of IEEE Third International Conference on Multimedia Processing, Communication & Information Technology – MPCIT 2020

JNNCE, Shivamogga, Karnataka, India

Smart Safety and Security Solution for Women


2020 Third International Conference on Multimedia Processing, Communication & Information Technology (MPCIT) |978-1-6654-1987-1/20/$31.00 ©2020 IEEE | DOI: 10.1109/MPCIT51588.2020.9350431

using kNN Algorithm and IoT


Bysani Sai Yaswanth, Darshan R S Pavan H, Srinivasa D B B T Venkatesh Murthy
Department of ECE, Department of ECE, Department of ECE, Department of ECE, Department of ECE,
SIT, Tumakuru -572103, SIT, Tumakuru -572103, SIT, Tumakuru -572103, SIT, Tumakuru -572103, Siddaganga Institute of
Karnataka, India Karnataka, India Karnataka, India Karnataka, India Technology,Tumakuru -72103,
1si17ec017@sit.ac.in 1si17ec023@sit.ac.in 1si17ec059@sit.ac.in 1si17ec422@sit.ac.in Karnataka, India
btv_murthy@sit.ac.in

Abstract—In the global scenario, women’s safety is a crucial sensor and Global Positioning System (GPS) module. All the
problem. The security of women has become a greater challenge sensors will keep monitoring the senor values and compare
to many families in their daily life, hence a system is developed it with the threshold values. If any of these values exceed
using rapidly growing technologies to address this problem. This
paper mainly focuses on an IoT based self-security system that the threshold, then the micro-controller will give a signal to
is comfortable, easy to use and wearable, and helps to share the the GSM module to send “HELP” message to the predefined
user location when they feel panic and also help to find the contacts. In [2], the authors have proposed a women’s safety
nearest safe place. The designed system is user friendly and it can device and its application which contains an android app and
be accessed only by a specific person. The system is controlled hardware device. Hardware device contains an emergency
through raspberry pi, and it has two different modes namely
normal mode and security mode. In normal mode, user can button and a hidden camera detector. Hidden camera detector
register their fingerprint, and in security mode, the fingerprint is used to detect spy cameras. In [3], authors designed a
sensor acts as a panic button, and when a fingerprint is detected portable device which resembles a normal belt. It consists of
system shares the location and captures the photo of the culprit Arduino Board, screaming alarm and pressure sensors. When
and stores it in the cloud. The machine learning algorithm gets the threshold of the pressure sensor crosses,the device will
the user location as input and predicts the nearest safe place
location. be activated automatically. The screaming alarm unit will be
Index Terms—Fingerprint scanner, GPS (Global Positioning activated and send sirens asking help In [4], authors proposed
System), GSM(Global system for mobile communication), IoT a system to take care of women in emergency situations, if
(Internet of Things), kNN (K- Nearest Neighbor), Raspberry pi any emergency occurs then it will notify the victims and the
(RPI).
their family members at the same time.This paper [5] is a
brief review on kNN algorithm. It discusses about the old and
I. INTRODUCTION
modified versions of kNN. It helps to understand the usage
In the present scenario, women’s safety has become one of kNN in classifications approach.
of the most common issues in society, even though strict
actions are taken against criminals, the problem still persists. Usage of mobiles and miniature gadgets are increasing in our
Now a days, women has to work in odd hours but, because day to day life. Though the technology is growing. But we
of insecurity they are forced by family members to quit the are not able to stop the attacks on women. During the time of
job. If women want to work in other states, there will be a attack, for a culprit it is easy to find the mobile and throw it
question of her safety and security to their family. Technology away. In case of jacket, it is a wearable thing. So, culprit is
is advanced so much, but still, the problems faced by women not able to find the system embedded inside the jacket. By
are not solved. The present existing technology for women using the smart jacket without knowing to the culprit, user can
security provides the solution to the problem, but some of communicate with their family members through messages
them are bulky and non-wearable if wearable, they can be sent by system. If he/she manages to get escaped from the
easily identified by the attacker and thereby increasing the attacker, system helps the user to find the nearest safe place.
chances of destroying the gadget. Therefore, by keeping all As user location is dynamic, Machine learning under
these in mind, the system is developed which is comfortable, classification approach is one of the best methods to locate
wearable, and easy to use and make the system to access by nearest safe place. Detailed methodology and usage of ML
only authorized person. algorithm are discussed in section III.

After doing through literature survey, the four main objectives


II. RELATED WORKS of the paper are:
In, [1], the authors have proposed women’s safety using (i) Ensuring the gadget used can only be operated by an
IoT which contains ARM 7 LPC2148 micro-controller and authorized person in order to avoid getting false information.
three sensors namely temperature, motion, and heartbeat (ii) Getting the nearest safe location place using Machine

87
978-1-6654-1987-1/20/$31.00 ©2020 IEEE

Authorized licensed use limited to: Raytheon Technologies. Downloaded on May 19,2021 at 11:58:16 UTC from IEEE Xplore. Restrictions apply.
learning (ML). display the ID for that finger. In this mode, the system will
(iii) Image capturing of the attacker and storing it in the be passive and can be used to register the fingerprint of their
cloud. choice.
(iv) Locating the position of women under danger. Descriptions of different sensor modules shown in Fig 1 are as
follows:
III. METHODOLOGY A. Fingerprint module:
The block diagram of the proposed system is shown in Fig. The fingerprint module is used for the authentication
1. It consists of a raspberry pi module interfaced with the process to check whether the user is authorized or not. It
fingerprint sensor, GPS, and GSM module and camera sensor. contains details (fingerprint ID) of the registered users in its
Raspberry pi is connected to the internet via hot spot from memory. Sensor captures the image of finger and stores in the
user mobile. raspberry pi storage. As soon as the user places registered
finger on the fingerprint module, it scans and checks for the
details which had been already stored in the memory. If the
scanned details are matched with the stored details then the
raspberry pi will activate all the sensors. Here the fingerprint
scanner acts as a panic button.
The fingerprint module used here is R307 which is an optical
fingerprint sensor and can store up to 250 fingerprints.
Fingerprint processing includes two parts:

1) Fingerprint enrolment (in normal mode):


• When enrolling, the user needs to scan their finger
two times.
• The system will process the two-time finger images,
generate a template of the finger based on process-
ing results, and store the template.
2) Fingerprint matching:
• When the user scans the finger through an optical
Fig. 1. Block diagram of the proposed system. sensor, the system will generate a template of the
finger and compares it with templates of the finger-
The system has two different modes of operation viz: print library.
1) Security mode • The system will search the whole fingerprint library
2) Normal mode for the matching finger.
1. Security mode: Initially the system will be in security • The system will return results success or failure to

mode. In this mode, the system is active and will be always the raspberry pi.
looking for the inputs from the fingerprint module. Here the B. Camera module:
fingerprint sensor acts as a panic button, whenever the woman
feels unsafe, she has to place her finger on the module thereby Camera module is used to capture the image of the culprit;
activating the whole security system. Then the security system it is connected to RPI through CSI (camera serial interface)
will activate all the sensors interfaced with the raspberry pi . It has a 5MP sensor and is capable of recording HD video
and arduino nano. The camera module will capture the image and can take still photos.
and then stores it in the cloud, then the raspberry pi will send a C. LCD display:
signal to arduino to activate GPS and GSM modules. The GPS
It is used for interactive communication with the user and
module will get coordinates of user location and it will
displays current mode success or failure of fingerprint
serve as input to the machine learning algorithm, the GSM
registration and it also displays a nearby safe place.
module will send user location and SOS message to
caretakers. The ML algorithm takes input as co-ordinates of D. Arduino nano:
the location and it searches for nearby safe location and gives As raspberry pi has only one set of serial communication
google map navigation link to the particular safe place to user ports and is capable to establish serial communication with
mobile through GSM. only one device at a time. To overcome this drawback,
2. Normal mode: The user has to manually switch to normal arduino nano is used. arduino and the raspberry pi are
mode by using the telegram app. In normal mode, the user can connected using I2C protocol; here raspberry pi is master
register the fingerprint by placing their finger two times on the while arduino nano acts as the slave.
module, and once their successful registration, the LCD will Whenever authorized user scans their finger, the fingerprint

88

Authorized licensed use limited to: Raytheon Technologies. Downloaded on May 19,2021 at 11:58:16 UTC from IEEE Xplore. Restrictions apply.
module will send a signal to RPI, and RPI in turn will send a 2) Collection of data set: In this paper, data required as
signal to arduino to fetch GPS location and send the same to input to the Machine learning algorithm is taken from google
register number through Global System for Mobile Commu- maps. Initially we identified the nearest safe places in google
nication (GSM). Arduino will also send current coordinates to maps in a limited area and noted the values of latitude and
master and it will serve as input for ML algorithm. longitude. Repeat the same thing until we get 100 or 200
E. GSM module: points of GPS Coordinates. For demonstration 100 to 120 data
GSM is used to send the current location and SOS message points are enough. The size of the data set in this paper is
to the registered number. The SOS message and mobile 100 samples. Size of input is not limited to only 100 or 200
number are included in the arduino code. And it is also used samples, it can be increased if needed. TABLE. I shows the
to send the nearest safe place location to the user’s mobile sample of the data set.
so that the user could reach the nearest safe place as soon as
possible. TABLE I
SAMPLE REPRESENTATION OF DATA SET
F. GPS module:
Latitude(in degree’s) Longitude(in degree’s) Label
GPS is used to fetch the location of the particular place; 13.326991 77.126098 railway station
it gives the location of the user to arduino nano in terms of 13.326951 77.126091 railway station
13.326986 77.126171 hospital
longitude and latitude.[6-13] 13.327327 77.123751 hospital
13.331041 77.124052 LBS
13.331035 77.127496 LBS
G. Proposed Algorithm for Machine Learning 13.327394 77.127483 EC
In this paper kNN algorithm is used to predict the nearest 13.326303 77.129462 EC
safe place more accurately based on the user location. kNN
stands for k Nearest Neighbor. Initially safe place co-ordinates In TABLE. I, more than one point is considered for each
should be collected and stored inside system as data set. safe place.Because, as data points prediction accuracy is more.
whenever the system is activated, algorithm performs the
different calculations based on user location in the back end.
As data set consists of different safe place locations, algorithm
should be selected in such a way to classify the safe places
and predict the nearest place. As per the requirements
classification of data is required. So, kNN is the one of the
simplest classification algorithms. Safe places such as police
station, bus stand or any crowded areas are considered in data
set. As user location is not constant, so look up table cannot be
used, as it is only for static data points.
1) kNN using python: kNN algorithm is a supervised
learning algorithm. so, input data consists of labels. Using
kNN, classification as well as regression models can be built.
In this paper kNN is used in classification approach. It is used
to predict the label i.e.nearest safe place.
Fig. 2. Accuracy at different k values
Steps for implementation of kNN
• During the step 1 data set is loaded into the training
3) Choosing Suitable K value: value of k in kNN
model.
algorithm is chosen based on the accuracy. In any kNN
• Choose the value of k, it should be integer.
application K value ranges between 1 to 20. It depends on the
• Calculate the distance between the user location and
data set. As data set increases accuracy increases which in
points present in the data set using Euclidean distance turn changes k values. So for choosing the best k value, plot
formula. between different k values and accuracy gives best results
• Sort all the distances in Ascending Order and store it in
instead of changing k value manually. From Fig. 2 as k values
an array. increases accuracy is decreasing. So, k=1 or k=2 gives best
• choose the top k rows in the sorted array.
results for given data set.
• Now assign the output to the test based on the most
frequent class of these rows.[5]
4) Evaluation of kNN Algorithm: From table I it is clear
Euclidean distance is given by
. that points are too near. So, visualization of data by plotting is
d = (x1 − x2) 2+ (y1 − y2) 2 (1) difficult. Hence for evaluating the model, confusion matrix is
used. It is a two-dimensional matrix in which rows of the
x1 and y1 represents the user location. x2 and y2 represents the
matrix represents the predicted outputs and columns of the
each and every point in data set.
matrix represents the actual outputs. Based on the diagonal

89

Authorized licensed use limited to: Raytheon Technologies. Downloaded on May 19,2021 at 11:58:16 UTC from IEEE Xplore. Restrictions apply.
value we can conclude whether label is predicted correctly or
not.

TABLE II
CONFUSION MATRIX

LBS EC CS
LBS 10 1 0
EC 1 5 2
CS 0 1 10

In TABLE.II diagonal elements are 10, 5 and 10. It


represents that Labels LBS and CS are correctly predicted for Fig. 4. Anatomy of the system
ten times and label EC is correctly predicted for 5 times. In
column 1, LBS is wrongly predicted as EC for one time. In
column 2, EC is wrongly predicted as LBS for one time and
CS for 2 times. In column 3, IS is wrongly predicted as EC
for one time. Due to lack of data in the data set these errors
will occur. Increasing the data set resolves this issue.

IV. RESULTS Fig. 5. LCD module displaying security mode.

Fig. 6. LCD module displaying normal/enrollment mode.

Fig. 3. Inside view and arrangement of modules

The designed system is user friendly and can be accessed


only by authorized persons. Fig. 4 shows the anatomy of the Fig. 7. LCD Display showing nearest safe place
system.
The whole system is powered by a power bank and the RPI is Telegram app is used to switch between the modes and is
connected to the internet via user personal mobile hot spot. also used to get the images that have been captured by the
LCD will show the current mode. security mode and Place camera module. Fig. 8 shows the telegram app retrieving the
finger option are shown in Fig. 5 and 6. In normal mode, image. In the security mode whenever the user feels unsafe
fingerprint registration can be done. The fingerprint module and scans their enrolled finger, the SOS message is sent to
can store up to 250 fingerprints. pre-set contacts and the ML algorithm predicts the safe place

90

Authorized licensed use limited to: Raytheon Technologies. Downloaded on May 19,2021 at 11:58:16 UTC from IEEE Xplore. Restrictions apply.
model is giving 95% of accuracy. Except one element all are
predicted correctly.

Fig. 10. Plot between Actual test label and predicted test label
Fig. 8. Telegram app retrieving captured image

In Fig. 10 graph is plotted between labels and data points


from point 0 to point 25. Because only 25% of data is
considered for testing. Red colour represents the actual label at
respective point and Blue colour represents the predicted label
at respective point. Model is giving 95% of accuracy. So,
most of the blue coloured line is overlapping with red
coloured line.
Case - 2
when test data is 50% then training data is also 50%. So,
algorithm gets equal amount of data for predicting results.
In this case algorithm is giving 87.5% of accuracy. In this case
Fig. 9. Output of the camera Module some diagonal elements are zero and some are non-zero. Some
labels are wrongly predicted due to lack of data used for
training the model.
nearest to the current location of the user and displays it in Confusion Matrix
t h e LCD module as shown in Fig. 7.
Accuracy of ML algorithm
In this paper during implementation of kNN, 100 data points
are used. Accuracy of the algorithm is verified by splitting
the data into training and test data in 25% and 50% by fixing k
= 2. Confusion matrices and graphs are shown below

Case - 1 
Confusion Matrix 
 
0 

(2)

Accuracy : 0.96
when test data is 25% training data is 75%. So, algorithm gets Accuracy: 0.875
max amount of data for predicting accurate results. In this case
91

Authorized licensed use limited to: Raytheon Technologies. Downloaded on May 19,2021 at 11:58:16 UTC from IEEE Xplore. Restrictions apply.
[7] S. Karthik, B. Devaraj, A. Keshav Kashyap, M. Avinash and B. T.
Venkatesh Murthy, ”Dynamic Load Shedding Management for Optimiz-
ing Power Distribution,” 2019 International Conference on Communi-
cation and Electronics Systems (ICCES), Coimbatore, India, 2019, pp.
1719-1723.
[8] K. U. Pavan, M. P. V. Sahul and B. T. V. Murthy, ”Implementation of
stereo visual odometry estimation for ground vehicles,” 2017 2nd IEEE
International Conference on Recent Trends in Electronics, Information
and Communication Technology (RTEICT), Bangalore, 2017, pp. 1173-
1177.
[9] Gururaj P. Mathad, Sharath Reddy, C. M. Punith, and B. T. Venkatesh
Murthy, “IoT Based Mobile Charging With Solar Energy by Coin
Insertion,” Proceedings of ISSRD International Conference, 24th June
2018, Bengaluru, India.
[10] G. C. Harikiran, K. Menasinkai and S. Shirol, ”Smart security solution
for women based on Internet Of Things(IoT),” 2016 International
Conference on Electrical, Electronics, and Optimization Techniques
(ICEEOT), Chennai, 2016, pp. 3551-3554.
[11] V. Singh and V. Kharat, ”A Proposed System for Security in Campuses
Fig. 11. Plot between Actual test label and predicted test label using IoT Platform: A Case Study of A Women’s University,” 2017
International Conference on Current Trends in Computer, Electrical,
Electronics and Communication (CTCEEC), Mysore, 2017, pp. 305-
In Fig. 11 graph is plotted between labels and data points 310.
[12] G. C. Harikiran, K. Menasinkai and S. Shirol, ”Smart security
from point 0 to point 45. Because 50% of data is considered solution for women based on Internet Of Things(IOT),” 2016 In-
for testing. Red colour represents the actual label at respective ternational Conference on Electrical, Electronics, and Optimiza-
point and Blue colour represents the predicted label at respec- tion Techniques (ICEEOT), Chennai, 2016, pp. 3551-3554, doi:
10.1109/ICEEOT.2016.7755365.
tive point. Model is giving 87.5% of accuracy. So, some part [13] T. M. R, Aishwarya, C. K. S, D. M. K and N. H, ”IoT Based Smart
of the blue coloured line is not overlapping with red coloured Security Gadget for Women’s Safety,” 2019 1st International Conference
line. on Advances in Information Technology (ICAIT), Chikmagalur, India,
2019, pp. 348-352, doi: 10.1109/ICAIT47043.2019.8987242.

V. CONCLUSION

It is clear that along with legal action if the technology is


also used problems faced by women can be eradicated. The
proposed system gives access only to a specified person. The
system is portable and easy to use. The system cannot be
identified by the culprit so that the chances of destroying the
system are less. The captured image is served as proof in court
and to identify the culprit as soon as possible.

REFERENCES
[1] R. A. Jain, Aditya Patil, Prasenjeet Nikam, Shubham More, Saurabh
Totewar, “Women’s safety using IoT,” (2017). IoT based Smart System
for Human Safety. International Journal of Computer Applications),
179. 1-3. 10.5120/ijca2017916012.
[2] D. G. Monisha, M. Monisha, G. Pavithra, and R. Subhashini, “Women
Safety Device and Application-FEMME,” Indian Journal of Science
and Technology, vol. 9, no. 10, pp. 1-6, March 2016.
[3] Wadhawane, Akash Attar, Amir Ghodke, Priyanka Petkar,
Prasad Thokal, Shital.(2017). IoT based Smart System for Hu-
man Safety. International Journal of Computer Applications.,179. 1-3.
10.5120/ijca2017916012.
[4] S. A. Akash, M. Al-Zihad, T. Adhikary, M. A. Razzaque and A.
Sharmin, ”HearMe: A smart mobile application for mitigating women
harassment,” 2016 IEEE International WIE Conference on Electrical
and Computer Engineering (WIECON-ECE), Pune, 2016, pp. 87-90,
doi: 10.1109/WIECON-ECE.2016.8009093.
[5] K. Taunk, S. De, S. Verma and A. Swetapadma, ”A Brief Re-
view of Nearest Neighbor Algorithm for Learning and Classifica-
tion,” 2019 International Conference on Intelligent Computing and
Control Systems (ICCS), Madurai, India, 2019, pp. 1255-1260, doi:
10.1109/ICCS45141.2019.9065747.
[6] B. Ranjitha, M. N. Nikhitha, K. Aruna, Afreen, and B. T. V. Murthy,
”Solar Powered Autonomous Multipurpose Agricultural Robot Using
Bluetooth/Android App,” 2019 3rd International conference on Elec-
tronics, Communication, and Aerospace Technology (ICECA),
Coimbat- ore, India, 2019, pp. 872-877.

92

Authorized licensed use limited to: Raytheon Technologies. Downloaded on May 19,2021 at 11:58:16 UTC from IEEE Xplore. Restrictions apply.

You might also like