Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

50 changes: 35 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Face Recognition using OpenCV
- Create dataset of face images
- - Detect faces using ```deploy.prototxt``` and ```res10_300x300_ssd_iter_140000.caffemodel```. (Learn more about [face detection](https://github.com/aakashjhawar/face-detection))
- Extract face embeddings for each face present in the image using pretrained [OpenFace](https://cmusatyalab.github.io/openface/) model ```openface_nn4.small2.v1.t7```.
- Train a SVM model on the face embeddings to recognize faces
# Face recognition module

**Forked from [aakashjhawar/face-recognition-using-deep-learning](https://github.com/aakashjhawar/face-recognition-using-deep-learning)**

*The following content is copied from aakashjhawar/face-recognition-using-deep-learning*

- Create dataset of face images
- - Detect faces using ``deploy.prototxt`` and ``res10_300x300_ssd_iter_140000.caffemodel``. (Learn more about [face detection](https://github.com/aakashjhawar/face-detection))
- Extract face embeddings for each face present in the image using pretrained [OpenFace](https://cmusatyalab.github.io/openface/) model ``openface_nn4.small2.v1.t7``.
- Train a SVM model on the face embeddings to recognize faces

## Overview of OpenFace for a single input image

1. Detect faces with a pre-trained models from dlib or OpenCV.
2. Transform the face for the neural network. This repository uses dlib's real-time pose estimation with OpenCV's affine transformation to try to make the eyes and bottom lip appear in the same location on each image.
3. Use a deep neural network to represent (or embed) the face on a 128-dimensional unit hypersphere. The embedding is a generic representation for anybody's face. Unlike other face representations, this embedding has the nice property that a larger distance between two face embeddings means that the faces are likely not of the same person. This property makes clustering, similarity detection, and classification tasks easier than other face recognition techniques where the Euclidean distance between features is not meaningful.
Expand All @@ -14,31 +20,45 @@
![Working of OpenCV Face detector](https://github.com/aakashjhawar/face-recognition-using-opencv/blob/master/images/openface.jpg)

## Getting Started

How to use
```

```
git clone https://github.com/aakashjhawar/face-recognition-using-opencv
cd face-recognition-using-opencv
```
- Create dataset of face images.
- Place the face images in dataset folder.
- Extract facial embeddings.
```python extract_embeddings.py```
- Train the SVM model
```python train_model.py```
- Test the model
```python recognize_video.py```

- Create dataset of face images.
- Place the face images in dataset folder.
- Extract facial embeddings.
``python extract_embeddings.py``
- Train the SVM model
``python train_model.py``
- Test the model
``python recognize_video.py``

## Prerequisites

- Python 3.5
- OpenCV

```
sudo apt-get install python-opencv
```

## Results
## Results

#### Detect and recognize faces from video camera-

![Result](https://github.com/aakashjhawar/face-recognition-using-opencv/blob/master/images/output1.png)


## Changelog of this fork :


- Added a method to create a directory for the user.
- Added a method to implement the dataset for face recognition.
- Added a progress bar to the method to implement the dataset.
- Added a method to train the model.
- Added a method to recognize the face.
- Added a method to extract the face.
Binary file added __pycache__/facerecognition.cpython-310.pyc
Binary file not shown.
Binary file removed dataset/aakash/00000.png
Binary file not shown.
Binary file removed dataset/aakash/00001.png
Binary file not shown.
Binary file removed dataset/aakash/00002.png
Binary file not shown.
Binary file removed dataset/aakash/00003.png
Binary file not shown.
Binary file removed dataset/aakash/00077.png
Binary file not shown.
Binary file removed dataset/aakash/00078.png
Binary file not shown.
Binary file removed dataset/aakash/00084.png
Binary file not shown.
Binary file removed dataset/bagaria/00000.png
Binary file not shown.
Binary file removed dataset/bagaria/00001.png
Binary file not shown.
Binary file removed dataset/bagaria/00020.png
Binary file not shown.
Binary file removed dataset/bagaria/00027.png
Binary file not shown.
Binary file removed dataset/bagaria/00028.png
Binary file not shown.
Binary file removed dataset/bagaria/00046.png
Binary file not shown.
Binary file removed dataset/bagaria/00048.png
Binary file not shown.
Binary file removed dataset/bhatia/00000.png
Binary file not shown.
Binary file removed dataset/bhatia/00001.png
Binary file not shown.
Binary file removed dataset/bhatia/00002.png
Binary file not shown.
Binary file removed dataset/bhatia/00012.png
Binary file not shown.
Binary file removed dataset/bhatia/00014.png
Binary file not shown.
Binary file removed dataset/modi/00000.png
Binary file not shown.
Binary file removed dataset/modi/00001.png
Binary file not shown.
Binary file removed dataset/modi/00002.png
Binary file not shown.
Binary file removed dataset/modi/00003.png
Binary file not shown.
Binary file removed dataset/modi/00004.png
Binary file not shown.
Binary file removed dataset/modi/00005.png
Binary file not shown.
Binary file removed dataset/modi/00006.png
Diff not rendered.
Binary file removed dataset/modi/00007.png
Diff not rendered.
Binary file removed dataset/modi/00008.png
Diff not rendered.
Binary file removed dataset/modi/00009.png
Diff not rendered.
Binary file removed dataset/modi/00010.png
Diff not rendered.
Binary file removed dataset/modi/00011.png
Diff not rendered.
Binary file removed dataset/modi/00012.png
Diff not rendered.
Binary file removed dataset/modi/00013.png
Diff not rendered.
Binary file removed dataset/modi/00014.png
Diff not rendered.
Binary file removed dataset/modi/00015.png
Diff not rendered.
Binary file removed dataset/modi/00016.png
Diff not rendered.
Binary file removed dataset/modi/00017.png
Diff not rendered.
Binary file removed dataset/modi/00018.png
Diff not rendered.
Binary file removed dataset/modi/00019.png
Diff not rendered.
Binary file removed dataset/modi/00020.png
Diff not rendered.
Binary file removed dataset/modi/00021.png
Diff not rendered.
Binary file removed dataset/modi/00022.png
Diff not rendered.
Binary file removed dataset/modi/00023.png
Diff not rendered.
Binary file removed dataset/modi/00024.png
Diff not rendered.
Binary file removed dataset/modi/00025.png
Diff not rendered.
Binary file removed dataset/modi/00026.png
Diff not rendered.
Binary file removed dataset/modi/00027.png
Diff not rendered.
Binary file removed dataset/modi/00028.png
Diff not rendered.
Binary file removed dataset/modi/00029.png
Diff not rendered.
Binary file removed dataset/modi/00030.png
Diff not rendered.
Binary file removed dataset/modi/00031.png
Diff not rendered.
Binary file removed dataset/modi/00032.png
Diff not rendered.
Binary file removed dataset/modi/00033.png
Diff not rendered.
Binary file removed dataset/modi/00034.png
Diff not rendered.
Binary file removed dataset/modi/00035.png
Diff not rendered.
Binary file removed dataset/modi/00036.png
Diff not rendered.
Binary file removed dataset/modi/00037.png
Diff not rendered.
Binary file removed dataset/modi/00038.png
Diff not rendered.
Binary file removed dataset/modi/00039.png
Diff not rendered.
Binary file removed dataset/modi/00040.png
Diff not rendered.
Binary file removed dataset/modi/00041.png
Diff not rendered.
Binary file removed dataset/modi/00042.png
Diff not rendered.
Binary file removed dataset/modi/00043.png
Diff not rendered.
Binary file removed dataset/modi/00044.png
Diff not rendered.
Binary file removed dataset/modi/00045.png
Diff not rendered.
Binary file removed dataset/modi/00046.png
Diff not rendered.
Binary file removed dataset/modi/00047.png
Diff not rendered.
Binary file removed dataset/modi/00048.png
Diff not rendered.
Binary file removed dataset/modi/00049.png
Diff not rendered.
Binary file removed dataset/modi/00050.png
Diff not rendered.
Binary file removed dataset/modi/00051.png
Diff not rendered.
Binary file removed dataset/modi/00052.png
Diff not rendered.
Binary file removed dataset/modi/00053.png
Diff not rendered.
Binary file removed dataset/modi/00054.png
Diff not rendered.
Binary file removed dataset/modi/00055.png
Diff not rendered.
Binary file removed dataset/modi/00056.png
Diff not rendered.
Binary file removed dataset/modi/00057.png
Diff not rendered.
Binary file removed dataset/modi/00058.png
Diff not rendered.
Binary file removed dataset/modi/00059.png
Diff not rendered.
Binary file removed dataset/modi/00060.png
Diff not rendered.
Binary file removed dataset/modi/00061.png
Diff not rendered.
Binary file removed dataset/modi/00062.png
Diff not rendered.
Binary file removed dataset/modi/00063.png
Diff not rendered.
Binary file removed dataset/modi/00064.png
Diff not rendered.
Binary file removed dataset/modi/00065.png
Diff not rendered.
Binary file removed dataset/modi/00066.png
Diff not rendered.
Binary file removed dataset/modi/00067.png
Diff not rendered.
Binary file removed dataset/modi/00068.png
Diff not rendered.
Binary file removed dataset/modi/00069.png
Diff not rendered.
Binary file removed dataset/modi/00070.png
Diff not rendered.
Binary file removed dataset/modi/00071.png
Diff not rendered.
Binary file removed dataset/modi/00072.png
Diff not rendered.
Binary file removed dataset/modi/00073.png
Diff not rendered.
Binary file removed dataset/modi/00074.png
Diff not rendered.
Binary file removed dataset/modi/00075.png
Diff not rendered.
Binary file removed dataset/modi/00076.png
Diff not rendered.
Binary file removed dataset/modi/00077.png
Diff not rendered.
Binary file removed dataset/modi/00078.png
Diff not rendered.
Binary file removed dataset/modi/00079.png
Diff not rendered.
Binary file removed dataset/rathi/00001.png
Diff not rendered.
Binary file removed dataset/rathi/00002.png
Diff not rendered.
Binary file removed dataset/rathi/00024.png
Diff not rendered.
Binary file removed dataset/rathi/00028.png
Diff not rendered.
Binary file removed dataset/rathi/00037.png
Diff not rendered.
Binary file removed dataset/unknown/alan_grant.jpg
Diff not rendered.
Binary file removed dataset/unknown/claire_dearing.jpg
Diff not rendered.
Binary file removed dataset/unknown/ellie_sattler.jpg
Diff not rendered.
Binary file removed dataset/unknown/ian_malcolm.jpg
Diff not rendered.
Binary file removed dataset/unknown/john_hammond.jpg
Diff not rendered.
Binary file removed dataset/unknown/own_grady.jpg
Diff not rendered.
Binary file added dataset/unknown/unknown.jpg
88 changes: 0 additions & 88 deletions extract_embeddings.py

This file was deleted.

Loading