07 May 2013

VOSM 2D model building and fitting for face data

After successful compilation of VOSM we got "test_smbuilding.exe" and "test_smfitting.exe" which are responsible for model building and fitting respectively.
Preparation of database:
From the VOSM website we can download several database: link. For this post, I will use JIAPEI database. Within JIAPEI directory, there are two directories: .\annotations and .\images. The former one contains annotation of landmarks for both training and testing images. The later one contains the corresponding images. For each database there should be a ShapeInfo.txt which describes how the landmarks are connected as shape (with several parts).
Description of building and fitting program:
Type .\test_smbuilding.exe -help and will get:

Usage: test_smbuilding [options] save_directory annotation_directory image_directory shapeinfo_path database channels type levels percentage
options:
   -o    output directory (default './')
   -a    annotation directory (required)
   -i    image directory (required)
   -s    path of the file shapeinfo (required)
   -d    training database (required, IMM, AGING, BIOID, XM2VTS, FRANCK, EMOUNT, JIAPEI )
   -c    channels (1 or 3, default 3)
   -t    statistical model type (SM, TM, AM, IA, FM, SMLTC, SMNDPROFILE. default SMNDPROFILE)
   -l    level of parymid (default 4)
   -p    percentage of shape, texture and appearance PCA (default 0.95)
Note: If you are building SMLTC or SMNDPROFILE, you must specify -c 1, namely, SMLTC and SMNDPROFILE can only deal with gray-level images.

Type .\test_smfitting.exe -help and will get:

Usage: test_smfitting [options] trained_data type testing_images testing_annotations database staticORdynamic recording
options:
   -o    trained data directory (required)
   -t    fitting method to be used (ASM_PROFILEND, ASM_LTC, AAM_BASIC, AAM_CMUICIA, AAM_IAIA. default ASM_PROFILEND )
   -i   testing image directory containing at least one image (required)
   -a   testing annotation directory (can be ignored)
   -d   testing database -- if annotation directory is specified, database should also be specified for further evaluation on fitting performance (can be ignored)
   -s   static image sequence or dynamic image sequence (default value true)
   -r   recording the fitting results or not (default value false)

Note: current smfitting doesn't defaultly afford 1D Profile ASM.
If you would like to try 1D Profile ASM for static images in current smfitting, you have to manually change the code in function VO_Fitting2DSM::VO_StartFitting in file VO_Fitting2DSM.cpp, say, around line 306 of file VO_Fitting2DSM.cpp change the 5th parameter from '2' to '1' of function dynamic_cast<VO_FittingASMNDProfiles*>(this)->VO_ASMNDProfileFitting.

If you would like to try 1D Profile ASM for dynamic image sequence in current smfitting, you have to manually change the code in function main() in file smfitting.cpp, say around line 666 of file smfitting.cpp change the 5th parameter from '2' to '1' of function dynamic_cast<VO_FittingASMNDProfiles*>(fitting2dsm)->VO_ASMNDProfileFitting

Face Detection: current smfitting use Adaboost technology to detect face as well as face components for face location in itialization. Refer to CFaceDetectionAlgs in main(). Default Adaboost detectors installed with OpenCV installation are used in current smfitting You may manually change the Adaboost detectors according to your own cascade file paths

Face Tracking: current smfitting deals with image sequences. If static images are to be tested, there is no point to carry out tracking because for every image, Adaboost detection will be carried out. If dynamic image sequences are to be tested, current smfitting only affords Camshift tracking strategy. Please Refer to CTrackingAlgs() in main(), the default setting of function CTrackingAlgs() is Camshift algorithm

Vision Open doesn't afford the video IO or webcam IO, although the author has done his own IO for all kinds. Users are highly encouraged to use their own video file or webcam IO and use VOSM in their own real-time applications.
Apply building and fitting program:
To train the face model based on the given annotation and images, use command:
test_smbuilding -o ".\JIAPEI_trained" -a "JIAPEI\annotations\training_pts" -i "JIAPEI\images\training_pts" -s "JIAPEI\annotations\training_pts\ShapeInfo.txt" -d "JIAPEI" -c 3 -t "SMNDPROFILE"
To fit the test data and view the result, use command:
test_smfitting -o ".\JIAPEI_trained" -t "ASM_PROFILEND" -i ".\JIAPEI\images\testing" -a ".\JIAPEI\annotations\testing" -d "JIAPEI" -s "true" -r "true"
For each testing image, the fitting result can be shown as:

2 comments:

  1. Hi, since my project don't use AAM I haven't looked into it yet. However, it should be straightforward to use it by modifying the parameters of test_smbuilding.exe and test_smfitting.exe. For example, use AAM_BASIC as the -t parameter of test_smbuilding.exe. If you want to use the libraries with your own data, you better read through the code. The author has well programming habit so the codes are not difficult to understand. Thanks.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete