Skip to content

Face detection and recognition into 6 classes of some famous personalities.

Notifications You must be signed in to change notification settings

sid0407/Face_Recognition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Face_Recognition

Face detection and recognition into 6 classes of some famous personalities.

Step 1: Dataset collection -

Train Data

Gathered 60 images of famous celebrities for training set.
Validation Data

Gathered 18 images of the same celebrities for the validation set.

Step 2: Detect Faces -

Using dlib cnn face detector find faces in image and crop faces and store them in separate folders sorting by individual person. Download 'mmod_human_face_detector' to use as 'dlib cnn face detector'

! wget http://dlib.net/files/mmod_human_face_detector.dat.bz2 
!bzip2 -dk mmod_human_face_detector.dat.bz2

The directory structure should look like this -

Directory structure :
|Images /
|  |-- (60 images)
|Images_crop /
|  |--ayushmaan/
|     |--(10 images)
|  |--carry/ 
|     |--(10 images)
|  |--deep/ 
|         |--(10 imgaes)
|  |-- sush/ (10 images)
|  |--kriti / (10 images) 
|  |--modi / (10 images)
|Images_test / 
|  |-- .. / (18 images)
|Images_test_crop / 
|  |--ayushmaan / (3 images)
|  |--carry / (3 images)
|  |--deep / (3 imgaes)
|  |--kriti / (3 images)
|  |--modi / (3 images)
|  |--sush / (3 images) 
|Upload_your_images /
|  |--Here you can put your own images to test the model
|Your_predictions /
|  |--The result
|Face_Recognition.ipynb
|mmod_human_face_detector.dat

Step 3: Download the model weights

Download weights using ! gdown https://drive.google.com/uc?id=1CPSeum3HpopfomUEK1gybeuIVoeJT_Eo
Define vgg-face model architecture and load weights.

Step 4: Train Softmax regressor for 6 person classification from embeddings.

Prepare train data and test data from the embeddings and feed into a simple softmax regressor with 3 layers containing first layer with 100 units and tanh activation function , second layer with 10 units and tanh activation function and third layer with 6 units for each person with softmax activation.

Predictions
For an image(may contain multiple faces) extract each face,get embeddings,get prediction from classifier network,make bounding box around face and write person name.

Some Predicted Image Results
maxresdefault 911831-kritisanon-motivationalquote ayushsu1-1592394645 DwnavjPUYAAqEh2 kriti_3 modi_2 sush_1 ayushmaan_1 carry_1 deep_1