Deep Learning Face Recognition: Part 2

Before reading this, please read deep-learning-face-recognition-part-1.html for better understanding

What is Face Detection? (locate and extract faces from each image.)
The ability to detect and locate human faces in a photograph.
Face detection is used for various purposes but here we use it for the only extraction of faces and pass it to the next level of face recognition. (face detection is one of the steps in our pipeline)
Easiest Way to detect face is applying Sliding Window Classifier, It is done in two steps:
  1. Build a face detection model using a machine learning model which can tell whether a given image is a face or not.
  2. Slide the face detector across the large image for faces. If faces are detected it will note the location of it.
Popular face detection algorithms:(Accuracy of detection increase from 1 to 3)
  1. viola jones
    1. Invented by Paul Viola and Michael Jones in the early 2000s.
    2. Uses decision trees to detect faces based on light and dark areas.
    3. Very fast and great for low powered devices.
    4. Not very accurate
  2. Histograms of oriented gradients(HOG)
    1. Invented in 2005
    2. Looks for the shift from light to dark areas in an image.
    3. Slower than Viola-Jones, but more accurate.
    4. runs well on normal computers without special software.
  3. Convolutional neural network
    1. Uses a deep neural network to detect faces.
    2. Very accurate, but requires a lot of training data.
    3. Runs best on computers with dedicated GPUs
Here I am using the HOG algorithm, so I will explain HOG.
  1. Convert the given image into black and white as the HOG algorithm looks for only white and dark areas.
  2. Now we start looking at every single pixel of the image and start measuring which surrounding pixel of it is much darker than it. Then we allocate that direction to it and mark an arrow sign in that direction on that pixel.
  3. After completing every pixel of the image we get a large number of lines on the image which indicates gradients. Each gradient shows how the light flows from a dark area to dark area
    original face image

    The gradient of each pixel in the image
  4. It's a huge number of gradients in the above image. So to reduce them take a small area in the above image and replace that area by the maximum frequency of directions in that area
    the small area selected image of above
    replaced by maximum count direction of the directions in that area
  5. Repeat the above process until the complete image is processed.
    final Image of HOG
Finding faces in images with HOG features:
  1. Collecting training data and converting them to HOG representations of faces.
  2. By using HOG representations of faces we train a machine learning model. (HOG can perform well even with small dataset)
  3. Sliding window classifier on HOG representation of the new image and try to find the face.
why Use Hog?
  1. HOG is a simplified representation of an image that still captures enough details to detect faces
  2. HOG representation is not affected by small changes in lighting.
  3. A HOG representation is not affected by small changes in an object's shape
Now moving to code section of 1:

Output:
If we zoom in for getting each pixel view, we get it as follows:


Training and sliding window classifier is discussed in the next part.


Comments

Popular posts from this blog

Splitting criteria

QUOTATION SERVER AND CLIENT

How to Handle Noisy Data in preprocessing of data?