Skip to content

Celebrity face recognition. Uses the pre-trained face-net model. There is also a flask app built the top of the core model package. Checkout the demo at: poor-mans-rekognition.herokuapp.com

License

Notifications You must be signed in to change notification settings

vijuSR/face_recognition

Repository files navigation

face_recognition

Some results First!

cfr-demo
Checkout the demo

Getting Started

  1. Get the code:

    • Using SSH: git clone git@github.com:vijuSR/face_recognition.git
      OR
    • Using HTTP: git clone https://github.com/vijuSR/face_recognition.git
  2. Setup the Virtual Environment (Recommended):

    • Create the virtual environment
      • python3 -m venv </path/to/venv>
    • Activate your virtual-environment
      • Linux: source </path/to/venv>/bin/activate
      • Windows: cd </path/to/venv> then .\Scripts\activate
    • Install the requirements
      • cd <root-dir-of-project>
      • pip install -I -r requirements.txt

      Install any missing requirement with pip install <package-name>

  3. Setups

  • STEP 0: Configurations

    1. There are two supported databases: sqlite and postgres
    2. Current setting is to use sqlite. For using postgres change SQLALCHEMY_SQLITE in this line to SQLALCHEMY_POSTGRES
    3. Also, if you are using postgres, change the config.ini file accordingly.
    4. In 'config.ini' file and change the path to "haarcascade_frontalface_default.xml" file path on your system. For example on my system it's: > "G:/VENVIRONMENT/computer_vision/Lib/site-packages/cv2/data/haarcascade_frontalface_default.xml" where > "G:/VENVIRONMENT/computer_vision" is my virtual environment path.
  • STEP 1: Database setup

    1. Postgres:
      • Install postgres, create a database and change 'config.ini' file accordingly.
    2. Creating required tables: -cd </to/repo/root/dir>
      • in shell/notebook run

      from database_client.database import Operations
      Operations.create_tables()

You did it. That's all required for the setup. 👏 😃

Using the celebrity face recognition:

You can use this project in two ways:

  1. With flask app:
    1. cd </to/repo/root/dir>
    2. run python3 routes.py
    3. Available endpoints:
      • "/": home page, used to upload image for celebs recognition.
      • "/face_recognition": result of celeb recognition, can't be accessed directly.
      • "/new_celeb": presents a form for adding new celeb in the database.
      • "/add_celeb": adds the celebrity to the database.

      Disabled the public access to the '\new_celeb' endpoint at demo website: poor-mans-rekognition.herokuapp.com

  2. Directly the core model package- Checkout the notebook "demo-sqlite.ipynb" (without flask app):
    1. cd </to/repo/root/dir>
    2. run jupyter notebook
    3. click on "demo-sqlite.ipynb"

Improvements:

  • Transfer learning on celeb dataset with "Siamese network"
  • Accuracy analysis with grayscale facial image captures.
  • Better face detection

Todos:

  • Change the result to json
  • Extend to multiple faces in an image frame.
  • Video processing (recognize celebs in video scenes).
  • Top n matching celebs.
  • Automate deployment.

About

Celebrity face recognition. Uses the pre-trained face-net model. There is also a flask app built the top of the core model package. Checkout the demo at: poor-mans-rekognition.herokuapp.com

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published