Coder Social home page Coder Social logo

neohimu / face-detection-using-cnn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kalyanghosh/face-detection-using-cnn

0.0 1.0 0.0 1.52 MB

This repository contains code base for an end to end implementation of a project titled "Face Detection using CNN"

Python 100.00%

face-detection-using-cnn's Introduction

PROJECT TITLE: FACE DETECTION USING CNN aka ConvNets

DESCRIPTION:


This repository gives budding Deep Learning enthusiats a gentle introduction to the topic of Deep Learning.

In this repository , I will list down all the steps needed to get started with your first project in Deep Learning.

So go ahead, Fork this repo and get started with Deep Learning.

CONTENTS:

  1. Dataset download
  2. Tools & Libraries
  3. Code
  4. Instructions to run the code
  5. Future improvements

EXPLANATIONS & STEPS:

  1. Dataset download:
    For this project we will be using the UMD face dataset which can be downloaded from: UMD Dataset

    UMD Face Dataset

    Go ahead and download the Batch 3 dataset, which will have faces of personalities and and .csv file that contains the annotations to crop out the face from each of the images:
    Batch 3

1.1. Data Preprocessing Input/Output Code-UMD.py:
In the next step, we need to write a code that would read the annotations from the .csv file , crop out the faces to create the positive dataset and crop out the background to create the negative dataset.The code should be self sufficient and modular so that when parameters like "dataset path", "# of train images", "# of test images", "color/gray", the code should perform all the tasks and divide the dataset into a folder structure as below:

Train/Test Folder Structure

2. Tools & Libraries:
2.1 In this project we will be using the Keras Deep Learning Library and we will be running it on top of the Tensorflow backend.
Keras & Tensorflow

Instructions on how to install Keras & Tensorflow on an Ubuntu machine are available online.
2.2 The code editors we will be using are Anaconda with OpenCV,Numpy,Scipy support.

3. Code-CNN_code.py:
The python file CNN_code is the main code which encapsulates the CNN architecture that was used for this project.

The steps performed by the code are as follows:

3.1: In this code, I have used a simplistic CNN architecture as below:

2D CONVOLUTION LAYER->2D MAX POOLING->2D CONVOLUTION LAYER->2D MAX POOLING->2D CONVOLUTION LAYER->2D MAX POOLING->2D CONVOLUTION LAYER->2D MAX POOLING->FULLY CONNECTED->FULLY CONNECTED

3.2: In this code, I have used Binary CrossEntropy as the Loss Function , the RMSProp as the Gradient Descent algorithm:

3.3 The hyperparameters used are as follows:

LEARNING RATE =1e-4

STEPS PER EPOCH =100

EPOCHS =30

VALIDATION STEPS =50

4. HYPER PARAMETER OPTIMIZATION:
The tune the hyperparameters, we run a random search over the hyperparameter space, by sampling the Learning Rate & Regularization from a uniform distribution.

The optimal set of hyperparameters after running a coarse search and fine search are as follows:

COARSE SEARCH:

Maximum Testing Accuracy=96.89%

Minimum Testing Loss=0.094

Value of optimum Learning Rate=4.48e-4

Value of optimum Regularization=2.27e-5


FINE SEARCH:

Maximum Testing Accuracy=97.79%

Minimum Testing Loss=0.1034

Value of optimum Learning Rate=8.29e-4

Value of optimum Regularization=3.91e-3


The plots of TRAINING VS TESTING ACCURACY and TRAINING VS TESTING LOSS:

TRAINING VS TESTING LOSS

TRAINING VS TESTING ACCURACY
5. SETUP INSTRUCTIONS:
The entire setup instructions to run the code can be found in README.txt

face-detection-using-cnn's People

Contributors

kalyanghosh avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.