The objective of this project is to design a face recognition system for security
control. Our system helps the police to detect events that might otherwise be
overlooked or take a long time to detect manually
Repository
Table of Contents
Criminal Record Management System detects criminals using Artificial Intelligence in real time videos, images and alerts the human supervisor i.e. the police to take the necessary action. Video frames are converted into image frames using OpenCV and these frames are sent to the system where it uses Facial recognition over those frames to identify probable persons in the frame that could match with the trained model. The facial detection is done using KNN algorithm and dlib library.Additional features of the system is that the citizen can register complaints, apply for NOCs (No Objection Certificate) and request an appointment with the higher officials in the police department whereas police can view those complaints, appointment requests and NOC requests.
- Get Byte Stream from Image
- Resize Image with OpenCV
- Frontal Face detection using pre-trained model
- Get 64 Landmarks using pre-trained model
- Convert NumPy arrays into encoded string
- Store the record in the database
- id - criminal Id
- img - original image of the criminal
- key_points - key points (64 facial landmarks of criminal) in the form of encoded string
- Fetch Label & Key Points for each record.
- Train the model using KNN classifier.
encoded_labels = LabelEncoder().fit_transform(labels)
classifier = KNeighborsClassifier(n_neighbors=len(labels),
algorithm='ball_tree',
weights='distance')
classifier.fit(key_pts, encoded_labels)
Screenshots of the application
To get a local copy of this application up and running follow these example steps.
- Python & dlib have to be installed in your local machine.
- For dlib Installation, I have followed this article.
-
Clone the repository
git clone https://github.com/bqwerr/Criminal-Record-Management-System.git
-
In the root project directory, open a terminal and create a virtual environment to install python libraries.
pip install virtualenv virtualenv env env\Scripts\activate
-
Now install python libraries
pip install -r requirements.txt
-
Run the application, using below commands in sequence
python manage.py makemigrations python manage.py migrate python manage.py runserver
- Now the application will be running at http://localhost:8000.
Below are the API endpoints consumed at the frontend.
- Fetch all criminal records
api/records/
- Post URL to add a criminal record to the database
api/add-record/
- Delete a criminal record from the database
api/delete-record/<str:pk>/
- To train a KNN Classifier with the criminal records in the database
api/train/
- Post URL to match an image with the trained model. An image should be included in the request to this endpoint.
api/match/
- Dashboard for Police to get criminal records of suspects.
- KNN Algorithm is used to match the suspect image to the actual criminal record over a database.
- An endpoint is built to accept image frame(s) and provides inputs to the trained model
- Citizen can raise Compliants, NOC Requests and Appointment Requests in the portal.
- Police can view latest requests in the dashboard and contact the users.