An open API service indexing awesome lists of open source software.

https://github.com/data-science-lab-amsterdam/face-recognition

Scripts and app for face recognition
https://github.com/data-science-lab-amsterdam/face-recognition

computer-vision face-detection face-recognition flask multithreading

Last synced: about 2 months ago
JSON representation

Scripts and app for face recognition

Awesome Lists containing this project

README

          

# Face recognition

See this blog post for an in-depth walkthrough: https://medium.com/data-science-lab-amsterdam/face-recognition-with-python-in-an-hour-or-two-d271324cbeb3

The facial recognition works roughly as follows:

![Schema](approach-schema.png)

* Webcam provides an image
* A face detection algorithm (HOG) detects where in the image a face is located
* This part of the image is cut out and serves an input to the model
* The model is a (modified) ResNet CNN encoding the input to a feature vector of length 128
* We have a small database with feature vectors of portraits or our DSL colleagues
* The best match is found using a simple distance metric between the feature vectors

## Installation
* Create an environment and install the requirements.

N.B. Before installing dlib you need to have some other stuff installed. See https://www.pyimagesearch.com/2018/01/22/install-dlib-easy-complete-guide/
* git clone the repo
* Put one picture of each person of interest in the ./images folder

### Running
There are various ways to run the scripts:
* ```python src/main-webcam-simple.py```

Shows the image in a separate window. Cleanest and most simnple version. Not recommended for performance.

*N.B. The camera window doesn't close on a Mac due to some OpenCV bug!*
* ```python src/main-advanced.py -d -s```

The ```-d``` enables a video window

The ```-s``` enables sound

The ```-n``` enables network camera as video source (if you've supplied the right url in the configuration)
* ```python src/dash-app.py```

For a nice dashboard, accessible via http://127.0.0.1:8234/