Skip to content

Get ready to activate Secure Access! This app uses face recognition and tracking on live video feed to only allow access to authorized personnel to access a device or premises.

License

Notifications You must be signed in to change notification settings

HaiderAbasi/OpenCV-Secure-Access

Repository files navigation

Secure Access System

This is a Python-based secure access system that uses facial recognition and tracking to authenticate authorized personnel.

alt text

Features

  • Only allow device/premises access 🔓 to authorized individuals.

  • Annoy 😠 kids away by disrupting their mouse/keyboard commands.

  • Lockout crucial files/folders 🚫 from specified individuals.

(To-do) - Gather complete activity-data for selected users.

Requirements

To run this project, you need to have the following Python packages installed:

  • For Ubuntu

    • Install python 3.8 using the following steps (Ref)
      sudo add-apt-repository ppa:deadsnakes/ppa -y
      sudo apt install python3.8
      sudo apt install python3.8-distutils
      sudo apt install python3.8-dev
      sudo apt install python3.8-tk
    • Setup and activate virtual environment inside the repository
      sudo apt install pip -y
      python3 -m pip install --user virtualenv
      python3 -m virtualenv sa_venv -p /usr/bin/python3.8
      source sa_venv/bin/activate
    • Install required modules using the following two commands.
      pip install -r prequirements.txt
      pip install -r requirements.txt
    • Test the application by running core.py
  • For Windows 10

    • Download and install Python 3.8.10.- x64

    • Setup a virtual environment and activate it inside the repository.

      python -m pip install --user virtualenv
      python -m virtualenv sa_venv -p C:/Users/cripplegen/AppData/Local/Programs/Python/Python38/python.exe
      cd .\sa_venv\Scripts\
      activate
    • You can install required packages by running the following command:

      pip install -r win_requirements.txt
    • Select the virutal environment Python in VScode

    • Run core.py (Use config.py to switch between debug/live)

Usage

To activate the secure access system, call the activate_sa method of the secure_access_cv class with the following arguments:

  • vid_id: The ID of the camera/webcam device to capture frames from or the path of the video file to use.
  • dataset_dir: The path to the directory containing the folders of image/s of authorized personnel to use for training the face recognition model.

Here's an example:

from core import secure_access_cv

sas = secure_access_cv()
sas.activate_sa(vid_id=0, dataset_dir="authorized_personnels")

File structure

The main file of the secure access system is core.py, which contains the secure_access_cv class.

|
+──authorized_personnels > (Authorized personnel images)
│   ├──Person #1 > (folder storing image/s of person 1)
│   └──Person #2
| 
|──data > data folder containing test images and video for debugging
│  └──test
|
+──models  > (Detection + Recognition + Embeddings)
│  ├──dlib_face_recognition_resnet_model_v1.dat
│  ├──known-live_embeddings-face_enc
│  ├──mmod_human_face_detector.dat
│  ├──shape_predictor_5_face_landmarks.dat
│  └──shape_predictor_68_face_landmarks.dat
|
├──.gitignore
├──LICENSE
|
|──config.py > (control variables for secure access)
├──tree.MD
|
|──requirements.txt > (required modules to run)
├──core.spec > (File for pyinstaller to generate executable for app)
|
+──core.py    > (Main file to run Secure Access App)
├──multi_object_tracking.py
├──recognition.py
└──utilities.py

Standalone executable (pyinstaller) Ref

# 1) Install pyinstaller module
pip install --upgrade pyinstaller

# 2) Configure core.spec according to your requirements

# 3) Create executable using pyinstaller
pyinstaller .\core.spec

Star History

Star History Chart

Contribution

If you'd like to contribute to this project, please fork the repository and make a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Thanks

Thank you 👏 ageitgey.

Your work has made using face recognition in projects a walk in the park.

Also, thanks to Davis King (@nulhom) for creating dlib and for providing the trained facial feature detection and face encoding models used in this library.

Keep the OpenSource torch lit! 🔥

About

Get ready to activate Secure Access! This app uses face recognition and tracking on live video feed to only allow access to authorized personnel to access a device or premises.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages