Skip to content

vshantam/EraGenes-Prediction

Repository files navigation

EraGenes-Prediction

Introduction

EraGenes is basically the combination of two latin words Era means age and Genes means gender.
This project is basically about Extracting the basic key features from Human faces in Real time.

Use this link to download this project directly from google drive which consist of 5 minutes of demo vedio in high resolution:

    https://drive.google.com/open?id=16TT7O2Kb20PA_Fw46uqiIIFpt1L7GNtC

Project Architecture

1.Introduction
2.Project Specification
3.Installing Dependencies
4.Strategy
5.Python files
6.How to run
7.Output Snapshot

Project Specification:

Built on

  1.python3
  2.Linux based Platform (works on windows too).
  3.Requires high level of computational processor.
  4.must have updated gnu-g++ compiler.
  5.Cmake (latest version)

Requirements

  1.scikit-learn
  2.dlib
  3.matplotlib
  4.opencv(cv2)
  5.keras
  6.math
  7.h5py

How to install Dependencies

Before installing the dependencies i would suggest to update and uprade to your system by the following command:

sudo apt-get update && dist-ugrade;

Method 1

use of pip command

1.pip install package_name --upgrade

Method 2

use the below command

pip install -r spec.txt

The above command will install all the required dependencies using spec.txt file.

Project Strategy

Face Detection

The first step is to detect the face in the given Image or a frame.
The best way is to Use Haarcascade classifier algorithm .

alt_tag

The algorithm itself can be hard to understand but actually it is following the basic strategy i.e finding a feature pixel by pixel.
wheh it finds the first features it goes for onother one with more confidence .the algorithm runs in a loop until frame size is finshed.if all the facial features are found then it returns the coordinates TOP LEFT AND BOOTOM RIGHT.

The working of the above algorithm looks somewhat like this:
alt_tag
Now the face is been detected its time to move the next strategy.

Extract Facial Features

To extract the facial features we are using convolution neural network.It is a advanced machine learning algorithm that is used in the feild of computer vision.
alt_tag

This features are used to define the age and gender classification.

Facial Landmark Detection

What is facial key points and landmarks?

ans

alt_tag

Python Files

This section is about the different python files used for building the project. $ipython3 dataset.py this python file is used to build a raw dataset form bunch of image dataset.

CONFUSED?


Well let me explain you .
If you take a image you will find out that the each image is set of pixels and each pixels are in the form of [ R, G, B] so, it is hard to do the analysis.which brings us to the file.
this python code follows certain steps:

1.face cropping
using below python file:
$ipython3 cropfunc.py

The image is been cropped and resised to (64 x 64) dimension of image.
alt_tag

2.grayscale conversion

alt-tag

3.wirting the pixels to the dataset

alt_tag

Now that we have created our dataset it is the time for machne learnng analysis for that we are using the follwing python code:

    $clf.py

Analysis

dataset variation with pixels

alt_tag

alt_tag

Pie chart

alt_tag

Machine learning (Regression)

    X axis : Learning Acuuracy
    Y axis : Learning Loss

alt_tag

How to run

Before running the program make sure you have provided the corect path of haarcascade and the other classifiers.
Here are the lis of classifier used in the project :

1.haarcascade_eye.xml
2.haarcascade_frontalface_default.xml
# 1 and two used in demo.py file and main.py file
3.gclf.pkl 
# used in main.py file
4.shape_predictor_68_face_landmarks.dat used in main and demo.py file
5 pretrained model file used in demo.py file.\

Note :do not need to change the path of file except the demo.py file if you want to use the pretrained files.

finally to run the file make sure you have updated system with installed all the dependencies with webcam connected.
run the below command:

$ ipython3 newmain.py

if all went well you will see the desired responses.
NOTE: I am using ipython3 version to run the program .if you want you can use others too such as : python,python3 etc.

Output snapshot

If all went well you will see the output like below.

alt_tag

alt_tag

As you can see the output is working with slightly variance, this can be happening because of some reasons such as :

    1.Bad Training.
    2.Bad Feature Selection.
    3.Noise.

But as you can see the facial key points are very much accurate.when i kept my mouth closed , fitted properly but when i tried to open it,the facial key points moved accordingly .
I guess that is the beauty of Machine intelligence .

About

EraGenes is basically the combination of two latin words Era means age and Genes means gender. This project is basically about Extracting the basic key features from Human faces in Real time.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages