Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/paoloripamonti/face-recognition
Face Recognition
https://github.com/paoloripamonti/face-recognition
deep-learning face-alignement face-detection face-encoding face-recognition machine-learning
Last synced: about 2 months ago
JSON representation
Face Recognition
- Host: GitHub
- URL: https://github.com/paoloripamonti/face-recognition
- Owner: paoloripamonti
- Created: 2019-09-26T08:39:11.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-19T12:42:57.000Z (about 1 year ago)
- Last Synced: 2024-11-06T11:52:16.469Z (about 2 months ago)
- Topics: deep-learning, face-alignement, face-detection, face-encoding, face-recognition, machine-learning
- Language: Python
- Size: 1.51 MB
- Stars: 15
- Watchers: 3
- Forks: 12
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Face Recognition
Simple library to recognize faces from given images
[](https://www.kaggle.com/paoloripamonti/face-recogniton)
### Face Recognition pipeline
Below the pipeline for face recognition:
- **Face Detection**: the [MTCNN](https://github.com/ipazc/mtcnn) algorithm is used to do face detection
- **Face Alignement** Align face by eyes line
- **Face Encoding** Extract encoding from face using [FaceNet](https://github.com/faustomorales/keras-facenet)
- **Face Classification** Classify face via eculidean distrances between face encodings### How to install
```git
pip install git+https://github.com/paoloripamonti/face-recognition
```### How to train custom model
Initialize model
```python
from face_recognition import FaceRecognitionfr = FaceRecognition()
```#### Train model with pandas DataFrame:
```python
fr = FaceRecognition()fr.fit_from_dataframe(df)
```where 'df' is pandas DataFrame with column **person** (person name) and column **path** (image path)
#### Train model with folder:
```python
fr = FaceRecognition()fr.fit('/path/root/')
```the root folder must have the following structure:
```
root\
Person_1\
image.jpg
...
image.jpg
Person_2\
image.jpg
...
image.jpg
...
```### Save and load model
you can save and load model as **pickle** file.
```python
fr.save('model.pkl')
``````python
fr = FaceRecognition()fr.load('model.pkl')
```### Predict image
```python
fr.predict('/path/image.jpg')
```Recognize faces from given image.
The output is a JSON with folling structure:```
{
"frame": "image data", # base64 image with bounding boxes
"elapsed_time": time, # elapsed time in seconds
"predictions": [
{
"person": "Person", # person name
"confidence": float, # prediction confidence
"box": (x1, y1, x2, y2) # face bounding box
}
]
}
```### Example
[](https://www.kaggle.com/paoloripamonti/face-recogniton)
[](https://www.kaggle.com/paoloripamonti/face-recogniton)
For more details you can see: [https://www.kaggle.com/paoloripamonti/face-recogniton](https://www.kaggle.com/paoloripamonti/face-recogniton)