Skip to content

Python-Spb2021/face-identification-tpe

 
 

Repository files navigation

Face identification using CNN + TPE

NOTE: This repository is archived and will no longer be updated.

This repository contains an implementation of the Triplet Probabilistic Embedding for Face Verification and Clustering paper.

demo application screenshot

Installation

git clone https://github.com/meownoid/face-identification-tpe.git
cd face-identification-tpe
python -m pip install -r requirements.txt

Usage

NOTE: Pre-trained model was trained using very small dataset and achieves poor performance. It can't be used in any real-world application and is intended for education purposes only.

To start application with the pre-trained weights download all assets and put them to the model directory (default path) or to the any other directory.

Then you can start the application.

python application.py

If you placed assets to the other directory, specify path with the --model-path argument.

python application.py --model-path /path/to/assets/

Training

NOTE: Training code was written a long time ago and have a lot of hard-coded constants in it. Using it now on new dataset will be very difficult, so please, don't try. You can read it and use it as a reference or you can just use CNN and TPE definitions and write custom training code.

I'm leaving this here just for the sake of history.

  1. Download assets face_template.npy and shape_predictor_68_face_landmarks.dat from here and put them to the model dir.

  2. Place train, test and evaluation (named dev) data to the data folder using following structure.

data\
    dev\
        person_0\
            1.jpg
            2.jpg
            ...
        person_1\
            1.jpg
            2.jpg
            ...
        ...
    test\
        person_0\
            1.jpg
            2.jpg
            ...
        person_1\
            1.jpg
            2.jpg
            ...
        ...
    train\
        person_0\
            1.jpg
            2.jpg
            ...
        person_1\
            1.jpg
            2.jpg
            ...
        ...

All images in the person_{i} folder inside train and test directories must contain faces of the same person.

  1. Run python 0_load_data.py
  2. Train the CNN with python 1_train_cnn.py
  3. Optionally test the CNN with python 2_test_cnn.py
  4. Train the TPE with python 3_train_tpe.py
  5. Optionally test the TPE with python 4_test_tpe.py

About

Face identification with CNN + TPE using Keras

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%