                       Face Detection Code
                  =============================

Copyright 1995    Kah-Kay Sung (sung@ai.mit.edu) and
                  MIT Artificial Intelligence Lab.
All rights reserved.

Permission to copy and modify this software and its documentation only
for internal use in your organization is hereby granted, provided that
this notice is retained thereon and on all copies.  We make no
representations as too the suitability and operability of this
software for any purpose.  It is provided "as is" without express or
implied warranty.

 ****  PLEASE DO NOT RE-DISTRIBUTE THIS CODE AS IT CONTAINS  ****
 ****      SOURCES FROM KHOROS, WHICH DOES NOT PERMIT        ****
 ****     RE-DISTRIBUTING WITHOUT A LISCENSE AGREEMENT       ****


Acknowledgements:
----------------
This code uses stuff from Khoros.  The Khoros sources, routines and 
headers are found in  the  khoros/  subdirectory.
They are included for the user's convenience.
I urge the user to obtain his/her own copy of the Khoros system, and to
remove everything under the   khoros/  subdirectory thereafter.
The Khoros  Copyright notice is given below:

/*
 *----------------------------------------------------------------------
 *
 * Copyright 1990, 1991, 1992 University of New Mexico.  All rights reserved.
 * Permission to copy and modify this software and its documen-
 * tation only for internal use in your organization is hereby
 * granted, provided that this notice is retained thereon and
 * on all copies.  UNM makes no representations as too the sui-
 * tability and operability of this software for any purpose.
 * It is provided "as is" without express or implied warranty.
 * 
 * UNM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
 * NESS.  IN NO EVENT SHALL UNM BE LIABLE FOR ANY SPECIAL,
 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY OTHER DAMAGES WHAT-
 * SOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PER-
 * FORMANCE OF THIS SOFTWARE.
 * 
 * No other rights, including for example, the right to redis-
 * tribute this software and its documentation or the right to
 * prepare derivative works, are granted unless specifically
 * provided in a separate license agreement.
 *---------------------------------------------------------------------
 */


Code and Organization:
----------------------

The key routines for face detection are found in   face_template.c
with headers in   face_template.h

The code is stored in several files in the main directory
It also depends on some libraries in the subdirectories:  
     templates/  khoros/  delivery-BP/  useful_lib/

There are two sample client applications that make use of the 
routines in   face_template.c

The applications are:  find_face.c  and  main_single_faces.c
These 2 files are NOT needed for your own applications that use
the face detection routines.

The executables can be created using the Makefile.  Also, look
at the Makefile to see the object files and libraries needed to
support the face detection routines.


Compiling
---------

The library files have been compiled for the SUN4 architecture.  You
will need to recompile the libraries if you are using some other
architecture.

Make the library files as follows:

useful_lib/libuseful.a:   go into the useful_lib subdir and use
			  the Makefile

khoros/lib/*.a:	  The source for the 2 library files are in 
		  khoros/vutils/   and   khoros/remote_gis/
		  Go into the 2 directories and type  make.
		  Move the library files into   khoros/lib/

templates/EVect_2_6_75_283:   This is a dynamically linked executable.
                 See the Makefile in templates/  on how to create it
		 for the  SUN4  architecture.
                 You can also compile it as a  .o  file and link it
                 with each application that uses the face detection
	         routines.  Howeever, your executables are going to be
                 really  HUGE !!!

delivery-BP/lib/libBPnet.a:  The source is in the  delivery-BP/source
                 subdir.  Remember to move the library file into the
                 delivery-BP/lib  subdir  after it is made.

The object files to build in the main subdir are:
     face_template.o  cov_eigen_utils.o  template_measurements.o 
     new_face_measurements.o  and  tmpl_eigen.o


False Detects / No Detects
--------------------------

This code has been tested on several image databases and has yielded
very high face detection rates  (approc 95%) for high quality images.
False detects are very rare.  

As described in the paper cited below, the system can be re-trained
with mistakes to attain better results, both in terms of higher
detection rates and fewer false detects.

The original face/non-face databases and the code for re-training the
system has not been included in this distribution.  

Please contact me if the performance of the current system is
unacceptable in your application.  While I cannot guarantee that I can
find the time to personally re-train the system in short notice, I
would be happy to provide advice/code on doing so.


Related Publications:
---------------------

Example-based Learning for View-based Human Face Detection.
 Kah-Kay Sung and Tomaso Poggio.  AIM-1521
 Artificial Intelligence Laboratory, Massachusetts Institute
 of Technology.  Cambridge, MA.  December 1994.

This publication can be retrieved by anonymous ftp to:
	ftp.ai.mit.edu
   /pub/users/sung/face-AIM1521.ps.gz

