Coder Social home page Coder Social logo

facial-recognition's People

Contributors

gjcchan avatar hamiltonchris avatar imjelley avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

facial-recognition's Issues

Represent input image into vector space

Represent input image in PCA

We need to take a picture of the users face and represent it in term of all the eigenfaces W

Inputs

  1. Matrix W of eigenfaces computed in #1
  2. Mean mu found in #1

Outputs

  1. a vector x which represents the input face in the PCA subspace

Procedure

  1. Create function to take an image from computer camera (opencv can do this)
  2. Create a function to open a pre-existing image
  3. turn image into a flat vector y
  4. compute x = Wy + mu
  5. return value

Input image functions

Input Image

  • Function that loads an input image from file and formats it
  • Function that takes a user's picture using the default camera
    • Add frame to to help user position face in image

Image functions

Image Functions

  • Need a function that can display an input image to screen
  • Need a function to save an image to file

Format input images

Formatting images

We need to take a input face image data set and turn it into a format that can be turned into a
eigenfaces

Input

  1. file location string

Output

  1. a matrix M containing N vectors of M length (M = product of image dimensions)

Procedure

  1. load images from input file
    1. Inputs can be found here:
      1. http://www.cl.cam.ac.uk/research/dtg/attarchive/facedatabase.html
      2. http://vision.ucsd.edu/content/yale-face-database
      3. http://vision.ucsd.edu/~leekc/ExtYaleDatabase/ExtYaleB.html
    2. Images will probably come in a specific format so you may need to figure out how to open them
  2. Make each image a flat vector
  3. Append each image vector to a Matrix M
  4. Return matrix M

Function to display eigenfaces

Need a function to display eigenfaces.
The problem is that the eigenfaces are normalize and contain negative values.
These values need to be remapped to [0-255]

  • find the largest and smallest values in the vector
  • subtract the smallest value from all values in the vector
  • divide all values by the range between the smallest and largest values
    • this puts the values between [0,1]
  • multiply all the values by 255
    • putting them in the range from [0,255]

save projections

We need a function that stores projections into a file format so that they can be retrieved later. These projections need to saved in a key:value format since we need to know which face they belong too.

Compare projections

Need a function that compares projections to find the closest one.

Projections are 1xN arrays where N is the number of component eigenfaces that it's been projected upon.

Construct PCA subspace

Constructing a PCA subspace

We need to have a function that takes a Matrix of vectors and computes an input `k' largest eigenvectors and stores them into some data format (probaby a txt file).

Inputs

  1. matrix M of flat image vectors (n vectors of m length)
  2. k (integer) of largest eignenvectors
  3. filename for subspace output

Outputs

  1. Matrix W of eignevectors

Procedure

  1. compute the mean of the vectors in M
  2. calculate the covariance matrix S using the mean and the vectors in M
  3. compute the eigenvalues and eigenvectors of S
  4. sort eigenvectors by eigenvalue
  5. save k largest eigenvectors into some file format for further use
  6. add file to gitignore
  7. check numpy for an ideal format to use

Inadequate representation

Custom images (taken via webcam) are not able to be represented using eigenfaces. Some possible reasons for this problem are:

  • The lighting in the picture is too different
  • The training set has inadequate variance to represent my face
  • The features are not sensitive to beards
  • Something else?

Possible solutions to this problem:

  • Acquire a bigger and broader data set
  • change the lighting in the room of the picture
  • Shave
  • ?

Image scaler

Need a function to scale images down to make taking small face pictures easier. The function would take an input rows and columns and scale the image down to that size. This function can then be added to create_image to scale down the taken image.

Subspace loader

Subspace Loader

A function in pca.py which will load a subspace from a file. It will output the subspace W as well as it's mean mu, and it's image size.

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.