Skip to content

Latest commit

 

History

History
77 lines (44 loc) · 1.7 KB

README.md

File metadata and controls

77 lines (44 loc) · 1.7 KB

Face Recognition


from face_encoder import FaceEncoder

# Load the module
FE = FaceEncoder('/path/to/main_folder_people/', img_size=160, recognition_threshold=0.3)

# Read images in people folder to create a database
encodes_db = FE.db_prepare(show_face=True, save_file=True, encoding_file_path='./data/encodes_db.pt')

"""--- Different ways to send an input to get results ---"""

# Image path as string
image = FE.recognizer('/path/to/image', encodes_db, pil_write=True)
# PIL.Image
image = FE.recognizer(Image.open('/path/to/image'), encodes_db, pil_write=True)
# numpy image
image = FE.recognizer(np.array(unknown_image), encodes_db, pil_write=True)

Colab

For testing the module yourself, open the prepared jupyter notebook in colab via the following link

Open In Colab


Usage

First: install requirements.txt

$ pip3 install -r requirements.txt

then in your local computer to start Django server run following commands in your terminal:

1- makemigrations

$ python3 manage.py makemigrations

2- migrate

$ python3 manage.py migrate

Optional

  • createsuperuser

    $ python3 manage.py createsuperuser

3- runserver

$ python manage.py runserver 0.0.0.0:8000

Docker

$ docker-compose up --build

UI

img

Reference

For the FaceRecognition module I use the following repo as my reference: https://github.com/miladlink/torch_face