Professional Documents
Culture Documents
SMCS2324012 Blackbook
SMCS2324012 Blackbook
ON
BY
AMIRTHAVARSHINI MURUGAN NADAR
NADAR
THE DEGREE
MARCH 2023-24
CERTIFICATE
College Seal
Preface
It gives me great pleasure to present the project on “Outlaws Detection – Face Recognition”
prepared sincerely, punctually and with utmost efforts.
The contents of this book are presented into many chapters, to ease reading. The project has
been illustrated with precise data elucidated with neat UML Diagrams that simplify the
understanding of the project. The project includes software development tools like etc.
Meticulous care has been taken to make this project perfect and useful in every respect.
Amirthavarshini Nadar
Acknowledgment
Preliminary Investigation 6
Organisational Overview 6
What is Face Recognition 6
Problem Statement 7
Existing Process 7
Why Face Recognizer 8
Stakeholders 8
Modules 8
Image Processing 10
OpenCV Model 10
Face Recognition 11
System Flow 12
System Requirements 12
Maintenance & Estimated Cost 13
Benefits of Proposed system 14
Gantt Chart 14
System Analysis 15
Event Table 15
Sequence Diagram 17
Use Case 19
ER Diagram 21
Code 22
Design 30
Organisational Overview
Face detection, also called facial detection, is an artificial intelligence (AI)-based computer
technology used to find and identify human faces in digital images and video. Face detection
technology is often used for surveillance and tracking people in real time. It is used in various
fields including security, biometrics, law enforcement, entertainment and social media.
The process of detecting and locating faces from a single or series of images and identifying
the face is known as face recognition (1)
Biometric Recognition is the statistical data analysis of people's unique behavioural and
physical characteristics which is mainly used for security and identification which includes
fingerprints, facial features, retina, iris, voice, gaits palm print etc. Among these methods face
detection is considered to be most precise and safe. Facial recognition is an activity of
discovering a peep's face by estimating and evaluating motifs on the exclusive facial markers
of the face. Biometric software is used for this purpose (2).
Face recognition is not a new topic it has been already used round the globe in various factors
from unlocking phone by authenticating to Google photos that recognise faces and group
them together.
In this Outlaws detection we will be easily and quickly catch hold of any outlaws and we will
ensure the security. We are mainly focusing on the airport security and alerting system that
can embed our outlaw detecting system. This face detection will be mainly done in the area
where each individual gets checked after metal detecting system, security staff usually checks
them, there is where the process is mainly focused.
Actually, we can make use of this system anywhere the camera placed but for the best
accuracy we are choosing hat particular area.
In short, the process will be like, the passengers get checked themselves by the security staff
the camera will capture the image of passengers and compare it with the images that are
already available in our database. If the image is matched, then system will automatically
alert the administrator and the security staff and if the image is not matched there will be no
buzzers. Administrators are authorised person they can be police or any such higher
organization person, they will be providing the image of the outlaws and their information so
that we will be having the details required prior.
Problem Statement
Existing Process
To recognize the wanted person the process is done manually. The security staff have image
of outlaws and they have to be always alert and have to check each and every passenger. If
some suspicious or wanted person is found, they report their higher department. This process
becomes very difficult when it comes to crowded areas. There is no automation in the
existing way of doing work.
To solve this problem, we will make use of Artificial Intelligence and smart devices. Our
System itself will catch outlaws autonomously.
Why Face Recognizer?
For best accuracy we can go for iris recognizer, but it is not possible while implementing it in
heavily crowded area where there are 1000 flights handled by an airport per day, so imagine
the number of passengers. For iris detection a clear high-quality picture should be taken and
for that it requires best quality camera with proper lighting and it also takes lot of time to
capture proper photo more over processing time is high as well.
Instead we will make use of face recognizer for fast and efficient recognising.
Stakeholders
Admin - They will be providing photos of outlaws and details associated with it. Admin can
be police inspector and any high authorized person.
Airport Security Staff - They will be continuously using outlaws detection to recognize the
outlaw and will be alerted.
Modules
1. Authentication:
2. Admin Management:
3. Suspect Management:
4. Airport Management:
5. Device Management:
6. Notification:
7. Suspect Detection:
Authentication
User should login using their credentials.
Based on user role they will be redirected to admin panel or security panel.
There will be tkinter login page as well for devices that are present on the airport, here
credentials and token will be checked to know details about the device
Admin Management
View All Admins - Displays all admin users only visible to Admin.
Add Admin - Renders the form to add a new admin user.
Edit Admin - Renders the form to edit an admin user.
Delete Admin - Deletes an admin user.
Direct registration will not be provided since one authorized admin will be created by
the developer directly, then this admin can add several admins to ensure safety
Suspect Management
View All Suspects - It is a view that displays Image and Important details of bandit.
Add Suspect – Only Admin can add suspects
View Suspect Details – In Depth information details of each suspect will be displayed
to admin and security staff
Edit Suspect – Only admin can edit the suspect’s details
Delete Suspect – Only admin can remove suspect.
Airport Management
View All Airports – Displays all enrolled airports only visible to airport security staff
Add Airport – Only security staff can add new airports
Edit Airport - Renders the form to edit an airport
Airport Status – Update the status of airport as active or in active
We will use pre-trained model cascade classifier to detect face from a live camera.
Once face is detected we will be converting the image as required for the classifier.
Then match it with each and every bandit images that we have in database.
Device Management
Notifys with image captured by the security staff of bandit and place, date-time such
details
Suspect Detection
Detection is also limited to specific states where suspects are wanted. If a suspect is found at
an airport in a state where they are not wanted, no alert is triggered. This ensures that alerts
are only generated in relevant scenarios, optimizing security measures.
While implementation in real world we will be capturing image automatically when the
boarding pass is scanned.
Image Processing
Image processing is the process of transforming an image into a digital form and performing
certain operations to get some useful information from it.
OpenCV Model
CV component contains the basic image processing and higher-level computer vision
algorithms.
ML is the machine learning library, which includes many statistical classifiers and clustering
tools.
HighGUI contains I/O routines and functions for storing and loading video and images.
Face Recognition
Recognize and manipulate faces from Python or from the command line with
the world’s simplest face recognition library.
Built using dlib’s state-of-the-art face recognition
built with deep learning. The model has an accuracy of 99.38% on the
Labeled Faces in the Wild benchmark.
This also provides a simple face_recognition command line tool that lets
you do face recognition on a folder of images from the command line![5]
System Flow
The initial step is registration of both admin and airport security staff.
For security purpose developer will create the first admin for the authorization.
Once an admin is created then that admin add multiple admins.
While Loging in we authenticate the user and check the role of the user, based on that we
display the required panel.
In admin panel, admin can add outlaws, updated their information and also have notification
view where they can see if there was any wanted person detected.
In airport security panel, security will login with the airport credential and a view will open
up with live camera and a button to capture image, just click the capture button and image
will we captured and in backend processing of image will be done, The model will be
fetching the images of the wanted images and compare these captured images of the
passenger and if image is matched appropriate action will happen.
Like buzzer will alert the area or just a popup notification for the security staff so that they
can have an eye on them.
Alerting particular admin can also be done, so that only the admin that is on control of that
area will be alerted.
System Requirements
Hardware Requirements (Minimum)
Processor : Intel i3 Processor and above.
Primary Memory : 4GB RAM (Random Access Memory) and above.
Storage : 8GB hard disk and above.
Webcam : Screen Size 3.5 Inches & Optical Zoom 4 x
Software Requirements
Operating System : Microsoft Windows (7,8, and 10), Linux, and Mac OS.
Software : Python IDLE, XAMPP.
Software Requirement for Development of Outlaw Detection:
The maintenance costs would be charged after 2 months, i.e., the first 2 months’ maintenance
would be free of cost and charges would apply from the third month onwards (Rs. 50,000).
LIST COST
The estimated cost is approximately calculated, actual cost will be determined by multiple
factors such as the availability of hardware, Infrastructure of airport etc.
Negotiation will be done.
Benefits of outlaw detecting system
Security staff doesn’t have to constantly have to keep track of bandit. They don’t
have to remember each and every bandit face.
The process is automated so no human error will occur.
Respective admin will know if the wanted person is spotted or not.
If bandit is found system will directly notify the admin so we don’t need to wait for
security staff to inform
Quick Processing
High Accuracy – Haar Cascade classifiers gives us 96.24% accuracy which is best till
date.
User-Friendly – For both security staff and admin.
Time Efficient
Gantt Chart
System Analysis
Event Table
Login
Front-end
Security Panel
Registration
Login
Admin Panel
Admin Panel
Security Panel
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\LoginController;
use App\Http\Controllers\AdminController;
use App\Http\Controllers\SuspectController;
use App\Http\Controllers\AirportController;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
Route::get('/', function () {
return view('welcome');
});
require __DIR__.'/auth.php';
Route::middleware('auth.session')->group(function () {
Route::get('/all-admin',[AdminController::class, 'allAdmin']);
Route::get('/add-admin',[AdminController::class, 'addAdmin']);
Route::post('/store-admin',[AdminController::class, 'storeAdmin']);
Route::get('/edit-admin/{id}', [AdminController::class, 'editAdmin']);
Route::post('/update-admin', [AdminController::class, 'updateAdmin']);
Route::get('/delete-admin/{id}', [AdminController::class, 'deleteAdmin']);
Route::get('/all-suspect',[SuspectController::class, 'allSuspect']);
Route::get('/add-suspect',[SuspectController::class, 'addSuspect']);
Route::post('/get-city',[SuspectController::class, 'getCity']);
Route::post('/store-suspect',[SuspectController::class, 'storeSuspect']);
Route::get('/view-suspect/{id}', [SuspectController::class, 'viewSuspect']);
Route::get('/edit-suspect/{id}', [SuspectController::class, 'editSuspect']);
Route::post('/update-suspect', [SuspectController::class, 'updateSuspect']);
Route::get('/delete-suspect/{id}', [SuspectController::class,
'deleteSuspect']);
Route::get('/all-airport',[AirportController::class, 'allAirport']);
Route::get('/add-airport',[AirportController::class, 'addAirport']);
Route::post('/store-airport',[AirportController::class, 'storeAirport']);
Route::get('/status-airport/{id}',[AirportController::class,
'statusAirport']);
Route::get('/edit-airport/{id}', [AirportController::class, 'editAirport']);
Route::post('/update-airport', [AirportController::class, 'updateAirport']);
Route::get('/all-device',[AirportController::class, 'allDevice']);
Route::get('/add-device',[AirportController::class, 'addDevice']);
Route::post('/store-device',[AirportController::class, 'storeDevice']);
Route::get('/status-device/{id}',[AirportController::class, 'statusDevice']);
Route::get('/notification',[SuspectController::class, 'notification']);
Route::get('/get-notification',[SuspectController::class, 'getNotification']);
});
Main.py
mixer.init()
class CameraApp:
def __init__(self, window, window_title):
self.window = window
self.window.title(window_title)
# Create a button
self.btn_snapshot = tk.Button(window, text="Capture", width=20, command=self.snapshot)
self.btn_snapshot.pack(anchor=tk.CENTER, expand=True)
self.update_camera()
self.window.mainloop()
def update_camera(self):
ret, frame = self.cap.read()
if ret:
self.photo = ImageTk.PhotoImage(image=Image.fromarray(cv2.cvtColor(frame,
cv2.COLOR_BGR2RGB)))
self.video_display.config(image=self.photo)
self.video_display.image = self.photo
self.window.after(10, self.update_camera)
def play_sound(self,suspect):
alert=tk.Tk()
alert.title("Alert")
suspect_name=str(suspect[1])
msg="This is an alert! Suspect " + suspect_name + " has been found"
label=tk.Label(alert,text=msg)
label.pack()
button=tk.Button(alert,text="Close",command=lambda: alert.destroy())
button.pack()
mixer.music.load('alarm.wav')
mixer.music.play()
alert.mainloop()
def snapshot(self):
ret, frame = self.cap.read()
if ret:
cv2.imwrite("snapshot.jpg", frame)
folder_path =
"C:\\xampp\\htdocs\\Laravel\\Outlaws_Detection\\storage\\app\\public\\uploads\\suspect"
image_encodings = []
source_image="C:\\Users\\LEGION\\PycharmProjects\\Outlaws_Detection\\snapshot.jpg"
destination_folder="C:\\xampp\\htdocs\\Laravel\\Outlaws_Detection\\storage\\app\\public\\uploads\\f
ound_suspect"
random_name=''.join(
random.choices('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789
0',k=10))
# Construct the destination path with the random name and original extension
destination_image=os.path.join(destination_folder,random_name + file_extension)
# Copy the image to the destination folder with the random name
shutil.copy(source_image,destination_image)
suspect_image_name=os.path.basename(destination_image)
# insert in suspect notification table and alert stuffs
f=open("C:\\xampp\\htdocs\\Laravel\\Outlaws_Detection\\storage\\app\\file.txt","r")
token=f.read()
sql="SELECT * FROM devices WHERE token = %s"
cursor.execute(sql,[token])
devices=cursor.fetchone()
device_id=devices[0]
if (suspect_alert_mode == "buzzer"):
threading.Thread(target=self.play_sound(suspect)).start()
break
else:
alert=tk.Tk()
alert.title("Alert")
suspect_name=str(suspect[1])
msg="This is an alert! Suspect " + suspect_name + " has been found"
label=tk.Label(alert,text=msg)
label.pack()
button=tk.Button(alert,text="Close",command=lambda: alert.destroy())
button.pack()
alert.mainloop()
else:
# continue
print("not found")
if(isNotSuspect):
alert=tk.Tk()
alert.title("")
msg="All Clear!"
label=tk.Label(alert,text=msg)
label.pack()
button=tk.Button(alert,text="Close",command=lambda: alert.destroy())
button.pack()
alert.mainloop()
def validateLogin(username, password):
username = username.get()
password = password.get()
sql = "SELECT * FROM user WHERE username = %s and password = %s and role
='security_staff' and status ='1'"
cursor.execute(sql,[(username),(password)])
# cursor.execute(sql, ['airport1@gmail.com', '1234'])
record = cursor.fetchone()
if record:
f = open("C:\\xampp\\htdocs\\Laravel\\Outlaws_Detection\\storage\\app\\file.txt", "r")
token = f.read()
sql = "SELECT * FROM devices WHERE token = %s and status ='1'"
cursor.execute(sql,[(token)])
record = cursor.fetchone()
if record:
msgLabel = Label(tkWindow, text="Successfully Logged in", fg="green", font=('arial',
12)).grid(row=8, column=1)
tkWindow.destroy()
root = tk.Tk()
app = CameraApp(root, "Camera App")
#Open new window -> open camera and detect
else:
emptyLabel=Label(tkWindow,text="Invalid User",fg="red",font=('arial',12))
emptyLabel.grid(row=4,columnspan=2)
else:
emptyLabel=Label(tkWindow,text="Invalid User",fg="red",font=('arial',12))
emptyLabel.grid(row=4,columnspan=2)
return
token = f.read()
sql = "SELECT a.state_id FROM devices AS d INNER JOIN airport AS a ON d.airport_id = a.id
WHERE d.token = %s"
cursor.execute(sql, [token])
devices = cursor.fetchone()
state_id = devices[0]
sql = "SELECT suspect_id FROM wanted_states WHERE state_id = %s"
cursor.execute(sql,[state_id])
wanted_states = cursor.fetchall()
suspect_ids = [wanted_state[0] for wanted_state in wanted_states]
if(suspect_ids):
sql = "SELECT image_name FROM suspect WHERE status ='1' AND id IN (%s)"
if suspect_ids:
placeholders = ', '.join(['%s' for _ in suspect_ids])
else:
placeholders = '%s'
sql = sql % placeholders
cursor.execute(sql, suspect_ids)
results = cursor.fetchall()
for result in results:
image_names.append(result[0])
# image_names.append()
# Window
tkWindow = Tk()
tkWindow.title('Airport Security Staff Login')
# Heading label
titleLabel = Label(tkWindow, text="Airport Security Staff Login", font=('arial', 14, 'bold'))
titleLabel.grid(row=1, columnspan=2, pady=5)
# Login button
loginButton = Button(tkWindow, text="Login", command=validateLogin, font=('arial', 12))
loginButton.grid(row=5, columnspan=2, pady=10)
tkWindow.mainloop()
Design
Front-end Login Page:
All Suspects
All Admin
Add Suspect
Add Admin
Notification
Edit Suspect
View Suspect
Edit Admin
Add Airport
All Airport
Edit Airport
Add Device
All Device
Security Panel
Login -
Live Camera -
Pop-up Alert -
Future Scope
Since the OpenCV library has high accuracy, we can simply embed the application in any
sector. For home surveillance one can feed the system with intruder images. By using high
quality camera and strong algorithm we can verify the person from distance. More the
security more the safety and less the crime.
To improve even more accuracy, we need to pass many images of same person so that we can
train and test the model, which will be giving high accuracy. As we just pass single image of
a person the model may confuse and may detect wrong person.
To improve the experience, we can check in live basis like there will be no staffs as the
person scans their boarding pass image will be taken and compared against the photos of
bandit that is already available – this is the process that will be everyone looking for.
But to improvise more we can also make our system smarter such as all the CCTV cameras
will capture the data in live basis and check is the bandit is found or not. If found, then
camera will keep track of them and keep on updating the system also admin and security staff
in such a way that bandit will have no idea that others are alert of them.
References
[1] https://www.sciencedirect.com/science/article/pii/S2666285X21000728
[2] https://www.scirp.org/journal/paperinformation.aspx?paperid=108333
[3] https://learningopencv.wordpress.com/2010/05/23/opencv-structure-and-content-
overview/
[4] https://pypi.org/project/face-recognition/