Code Monkey home page Code Monkey logo

face-recognition's Introduction

README

Structure

  • config.ini : configuration file, required by configparser contains these params:
    • confidence : float representing the confidence level for a face to be recognized. A face with a confidence score less than this parameter will not be considered for recognition (default 8.)
    • threshold : float representing the likelihood that two faces belong to the same person. Calculated as the cosine distance between two output vectors from the CNN. (default 0.35)
    • vgg_path : relative (or absolute) path to the pre-trained CNN model file (default None)
    • haar_path : relative (or absolute) path to the pre-trained HAAR classifier (default cwd, cloned within this repository)
  • arch.py : CNN architecture (VGG16, taken from this source)
  • utils.py : helper functions needed for config parsing and management, timing and handling pickle files used to store previously tagged identities.
  • identificator.py : class defining the Identificator object, whom is delegated to detect and recognize the faces seen in the video.
  • main.py

Requirements

  • Python (>= 3.5)
  • Tensorflow
  • Keras
  • OpenCV
  • SciPy
  • NumPy
  • Pickle
  • Configparser

Files needed :

  • vgg_face.mat : (MATLAB) weights for a 16 layers deep CNN developed and trained by the Visual Geometry Group, as described in this paper. Download from here or follow the instructions in the next section.
  • haarcascade_frontalface_default.xml : pre-trained (frontal) face detection feature-based classifier, stored as an XML file.

TODO : generate requirements.txt file for conda/pip

How to run

  • clone this repo : git clone https://github.com/w00zie/face_recog
  • run main.py
  • once asked for config profile, select 0 - DEFAULT, if any file needed for the execution is missing it'll be downloaded

Two strings are shown on top of every frame :

  • Seen {} different people -> Number of different people seen in this and all the previous sessions (if any). Actual number of different individuals that interacted with the camera.
  • Last seen/recognized : {} -> If there is no previous knowledge provided this string represents the last different person who've been recognized (new person 0, new person 1...), besides it displays the name of the previously-tagged person recognized.

DEMOS

DEFAULT MODE

The default mode is intended for machines that cannot handle a heavy load. Since running a predict() may result in a noticeable lag, this workload-saving mode is a compromise between live recognition and mere detection. Identities are displayed on top of every frame, pointing out the last detected/recognized person.

  • First we ran main.py with our default configuration. No previous knowledge provided.

picture

  • Once 2 new people were detected, we were shown their faces...
    picture picture

... and we've been asked to insert their relative names to tag these newly detected identities.

picture

  • The graph generated by the labelled clusters:

picture

  • On the next execution the previously labelled people are now recognized and tagged.

picture

PERFORMANCE MODE

The main structure is the same as the default mode, however it is intended for machines that can handle the heavier load of making many more predicts per frame. Identities, in fact, are predicted and displayed over every face present in every frame.

  • We ran main.py with our performance default config. No previous knowledge provided.

picture

  • We were shown the graph every 100 nodes. You can notice a predict error near the end of the previous gif, fixed by an automatic run of the Chinese Whispers algorith picture

  • Then we were asked to insert the names relative to the detected faces, named guy_0 and guy_1 respectively.

picture
picture
picture

  • On the next execution the previously labelled people are now recognized and tagged.

picture

  • Enriching the clusters in the graph prediction after prediction

picture

video credit

face-recognition's People

Contributors

ghembs avatar

Stargazers

 avatar

Watchers

 avatar  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.