Skip to content
/ CFEngage Public

A violence detection module that can inform authorities about the details of individuals present at the site of the incident using face recognition.

Notifications You must be signed in to change notification settings

S-JZ/CFEngage

Repository files navigation

Crime Free

A violence detection module that can inform authorities about the details of individuals present at the location during the incident using face recognition.

Tech Stack Used:

  • Django
  • MySQL
  • Tensorflow
  • Python 3.7
  • OpenCV
  • face_recognition
  • HTML/CSS/JS
  • pywhatkit
  • yagmail
  • git

How to set up the application?

  • Clone the GitHub repository
$ git clone https://github.com/S-JZ/CFEngage.git
  • Change directory to crime_free
$ cd CFEngage/crime_free
  • Set up the virtual environment
$ virtualenv venv
$ source venv/Scripts/activate
  • Install dependencies from requirements.txt
$ pip install -r requirements.txt
  • Set up the Django Server
$ python manage.py makemigrations
$ python manage.py migrate
$ python manage.py runserver
  • Open your web-browser and type in localhost:8000/.

Note: Before testing the application

  • You might want to create a super user for the admin page in Django to add people in the database manually.
$ python manage.py createsuperuser
  • Enter your desired username, email id and password for the same.
$ python manage.py runserver
  • Open your web-browser and type in localhost:8000/admin/. You will be asked to login to the dashboard. Login with the above credentials.
  • Now add in the information about the entries in the faces_db folder in the Persons model from the interface manually. By default, there are two images in the faces_db folder.
  • Create the dummy Aadhar number, Name and Address of these two persons using the interface.
  • You are now set to test the app!

Environment Variables:

The code uses sensitive information like passwords and secret keys which have been stored in the environment variable for security concerns. These can be re-produced on your system by defining the following in a .env file in the crime_free subdirectory:

DJANGO_SECRET_KEY 
DEBUG              #set to True
DB_NAME            # name of the database (for e.g. dummy_faces)
DB_USER            # database username
DB_PSW             # database password
DATABASE_URL       # localhost
DEVELOPMENT_MODE   #set to True
email    #own gmail id for sending mail to authorities
psw      #password of gmail account
polemail #police authorities email id (create a dummy one or supply own)
phone    #police whatsapp number 

Note:

  • Ensure that you are logged in to the web whatsapp on the browser before uploading the video for processing.
  • The mailing feature is by default not activated, if you wish to use it, make sure to enable less secure apps settings in your gmail account and set mail=True in the message function call in smart_patrol/FaceRecognition.py file.
  • It is recommended to use <=360p video files for better performance. You can use the fight2.mp4 file for testing, added in the parent directory of the repository.

Demo Video Link:

The demo video is at: Microsoft Engage 2022 Demo Video

Design Documentation

The following document contains the data flow diagram and a simple tech stack diagram to showcase the architecture of the application.

Weekly Reports: Sprints

The file contains the weekly targets and milestones that I worked on throughout the month of May 2022 for the project. These weekly sprints include researching about different tech-stacks, implementing code, reviewing design and testing the application in each iteration.

The learning sprint involved getting familiar with new tech stacks, and implementing a test driven development for the project.

Future Scope:

  1. Reviewing the design to enable faster processing using multiple threads and process synchronization -> parallel processing.
  2. Automating database connection with face database.

Dataset used for Violence Detection:

The dataset used for model creation and preprocessing the video was RWF2000-Video-Database for Violence Detection which contains 2000 clips and 300,000 frames recorded under surveillance camera.

@inproceedings{cheng2021rwf,
  title={Rwf-2000: An open large scale video database for violence detection},
  author={Cheng, Ming and Cai, Kunjing and Li, Ming},
  booktitle={2020 25th International Conference on Pattern Recognition (ICPR)},
  pages={4183--4190},
  year={2021},
  organization={IEEE}
}

About

A violence detection module that can inform authorities about the details of individuals present at the site of the incident using face recognition.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published