Skip to content

IndikaUdagedara/frec

Repository files navigation

FREC - A Face RECognition program


Overview

This is a little Face RECognition program written with C++ and OpenCV.

The purpose of this program is to provide an extensible platform to develop different face recognition and image pre-processing algorithms and test them with ease.

Currently this includes a couple of basic image pre-processing algorithms and Eigen Method based face recognition system.

This can be run in interactive mode and in self test mode.


Eigen Method based recognition system Overview

The outputs are - Gnuplot scripts and related data files, - normalized eigen images and eigen vector in xml format

Gnuplot scripts needs to be loaded later and observed by a human, there is no automatic report generation or comparison as yet.

Current plot files include - projection into eigen space of each image - average projection of face class(Person) - projection of input images to average projection


How to use

** Don't worry it is really easy to setup, PLEASE READ CAREFULLY **

  1. Organize images of different persons into different directories eg. $ls Images/ John Jane

    Images/ containes John's and Jane's images

  2. Run from source dir $./scripts/tolist.sh /path/to/Images/

    This will create following files in /path/to/Images/ - names.db - names.list And following file in John/ and Jane/ - files.list

"names.db" A unique ID is given to each Person, ie. John = 0, Jane = 1 , ... This file contains which directory contains which Person's ID in a format eg. /path/to/Images/John/, 0 /path/to/Images/Jane/, 1 ....

"names.list" This file contains a formatted directory listing which needs to be included to the system configuration file frec.conf

"files.list" This file contains the images of the particular directory for the person. eg. /path/to/Images/John/files.list will contain John_1.jpg, 0 John_2.jpg, 0 ....

/path/to/Images/Jane/files.list will contain Jane_1.jpg, 1 Jane_2.jpg, 1 ....

** In case if images per person is not kept in directories, create a file files.list in the direcotory where all images reside and write the entries according to above format

John_1.jpg, 0 John_2.jpg, 0 Jane_1.jpg, 1 Jane_2.jpg, 1 ....

  1. Edit configuration file frec.conf

  2. Run Modes - ./frec with no arguments will give all Run Modes

0 - Initialize face database - This mode reads all directories mentioned in "RawImgDir_xx" and then - pass them through FaceDetector - pass them through pre-processing pipeline - save them to "OutImgDir" - "OutImgDir" will contain a "files.list" file in above format - Human intervention is required to double check whether the detector has detected the images correctly and edit "files.list" manually False detections should be removed from "files.list" file - TODO what about a web UI? - This needs to be done only once

1 - Initialize Recognizer - This mode will read already pre-processed and detected images from "ProcessedImgDir_xx" "ProcessedImgDir_xx" should be "OutImgDir" generated in [Run Mode 0] There can be several "ProcessedImgDir_xx" entries and will load from all these - Recognizer is given callbacks to do its initialization stuff and store any data in disk files, so that during normal operation minimal memory and computations are used

2 - Normal operation - interactive mode - Pre-processed and detected images will be loaded as was done in [Run Mode 1] - Recognizer can load its structures from files - There will be interactive prompt to input images - TODO - Output will be generated by Recognizer, eg. EigenMethod will store several data files and plot scripts

3 - Self Test - Pre-processed and detected images will be loaded as was done in [Run Mode 1] - Recognizer is given full control of the database and will generate output eg. EigenMethod will train the system with all images excluding one image per person each time, and try to recognize the excluded image within the Persons in the database It will output data files and plot scripts per each input image and store them in different dirs of its "EigenMethod_DataDir". Beware of thousands of files.

5 - Cleanup data files - Cleanup the stored data and "SavedImgDir" - After this need to start from [Run Mode 0]


TODO

  • use autotools and make this installable
  • scripts to do blackbox testing
  • a web UI to easily configure system config files. ie. "files.list"
  • getopt stuff
  • cleanup RunLoop()
  • seperate lib and app clearly
  • keep a .doc file with results

Copyright

See LICENCE for details

FREC - A Face RECognition program Copyright (C) 2008 Indika Udagedara email: indika.udagedara@gmail.com


Appendix A - EigenMethod

:: Self Test :: Algorithm: - Take each person - X - Exclude one face of that person - Y for all faces of the person - input = Y, database = Z (all except Y) - Produce output as below - Do this for each person

Output:

  • DataDir/SelfTest_X (X for each person)
    • Face_Y (for excluding each face)
      • input_Y.dat (coefficients of Y)
      • person_Z_coeff.dat (coefficients of person Z's faces)
      • person_Z_avg.dat (avg of person Z's coeffs)
      • person_Z_plot.p (plot script of person Z's coeffs)
      • avg_with_input_X.p (plot script for avgs with input coeff of Y)
      • person_avg.p (all avgs of persons)

:: Normal Run ::

Output: