File Exchange

image thumbnail

Active Appearance Models (AAMs)

A fast but exact version of the Simultaneous Inverse Compositional Algorithm (SIC)

13 Downloads

Updated 10 Dec 2013

View License

Source code for training an Active Appearance Model (AAM) and fitting using the Fast Simultaneous Inverse Compositional Algorithm (Fast-SIC), described in

[1] G. Tzimiropoulos, and M. Pantic, "Optimization problems for fast AAM fitting in-the-wild," ICCV 2013

The code is based on the Inverse Compositional framework of

[2] I. Matthews and S. Baker, “Active Appearance Models Revisited,” IJCV, 60(2), pp. 135–164, 2004.

The provided code implements Fast-SIC, a fast but exact version of the Simultaneous Inverse Compositional Algorithm (SIC). You can use it to fit an AAM to unconstrained (in-the-wild) images. Please see [1] for more details.

Should you use the code, please cite [1]

Code released as is **for research purposes only**
Feel free to modify/distribute but please cite [1]

contact gtzimiropoulos@lincoln.ac.uk

Comments and Ratings (51)

iqra rashid

only the result of 1st image is correct. other landmarks are not there in correct position.
i m using matlab 2013b

how to fix the following problem
Error in train_AAM>Procrustes_analysis (line 169)
[~, mean_shape_new] = procrustes(mean_shape, mean_shape_new);

Error in train_AAM (line 27)
shapes_normal = Procrustes_analysis(shapes);

Error in main_AAM (line 39)
AAM = train_AAM(where, folder, what, AAM);

Hamed

Hamed (view profile)

Hello guys
I've problem with this code. How can I solve it?

Error using svd
Input to SVD must not contain NaN or Inf.

Error in procrustes (line 119)
[L, D, M] = svd(A);

Error in train_AAM>Procrustes_analysis (line 169)
[~, mean_shape_new] = procrustes(mean_shape, mean_shape_new);

Error in train_AAM (line 27)
shapes_normal = Procrustes_analysis(shapes);

Error in main_AAM (line 39)
AAM = train_AAM(where, folder, what, AAM);

line 19,line 106,107,110,111 replace '.' = 'C:/lfpw'

Sri Harshal P

I have downloaded the trainset and testset folders from the link mentioned in the readme file. I am using MATLAB R2016b on an Ubuntu machine.
I am trying to run main_AAM.m but i encounter the following errors :

Warning: Name is nonexistent or not a directory: functions
> In path (line 109)
In addpath (line 88)
In main_AAM (line 14)
Error using svd
Input to SVD must not contain NaN or Inf.

Error in procrustes (line 119)
[L, D, M] = svd(A);

Error in train_AAM>Procrustes_analysis (line 169)
[~, mean_shape_new] = procrustes(mean_shape, mean_shape_new);

Error in train_AAM (line 27)
shapes_normal = Procrustes_analysis(shapes);

Error in main_AAM (line 39)
AAM = train_AAM(where, folder, what, AAM);

How can I generate scl & trans of my own imag

Matt Moore

This is great, however is there a straightforward way to also generate control points around the forehead?

albert chen

pankaj Pankaj

I am working on my project, one of the module is facial expression detection.
I want to use AAMs Toolbox for my own image.
But how can i generate `.pts` file for my image?
Please help me out

Steve

Steve (view profile)

aneeta bhogal

i'm working on my dissertation to create an active appease model with changing makeup styles on the face but stuggling to learn how to get started.
I seem to get errors on this code ;

Error using svd
Input to SVD must not contain NaN or Inf.

Error in procrustes (line 119)
[L, D, M] = svd(A);

Error in train_AAM>Procrustes_analysis (line 169)
[~, mean_shape_new] = procrustes(mean_shape, mean_shape_new);

Error in train_AAM (line 27)
shapes_normal = Procrustes_analysis(shapes);

Error in main_AAM (line 39)
AAM = train_AAM(where, folder, what, AAM);

Mr. Sumon

Mr. Sumon

How can I generate scl & trans of my own image?????

Hani Lee

I download the dataset including two folder trainset and testset.I put them in,but also return mistakes below:
Error using svd
Input to SVD must not contain NaN or Inf.

Error in procrustes (line 119)
[L, D, M] = svd(A);

Error in train_AAM>Procrustes_analysis (line 169)
[~, mean_shape_new] = procrustes(mean_shape, mean_shape_new);

Error in train_AAM (line 27)
shapes_normal = Procrustes_analysis(shapes);

Error in main_AAM (line 39)
AAM = train_AAM(where, folder, what, AAM);
I do not know why.

Hem Regmi

Do you have any idea how to generate the .pts file from the original image automatically or do wee need to generate these landmarks all manually.

Please follow the steps below to generate your own initializations:

1. Download the Zhu and Ramanan detector from http://www.ics.uci.edu/~xzhu/face/

2. Get it to work

3. Re-order the points returned by the detector according to the provided AAM configuration (i.e. the points in Zhu and Ramanan and the points in the provided AAM code are ordered differently)

4. Use the procrustes Matlab built-in function between the detected points (from Zhu and Ramanan) and the mean shape (from AAM).

hope this helps

Rosheen

Rosheen (view profile)

Bai limin

I'm here waiting for you answer,thank you

Bai limin

Thank you for the code.I have the same question with Ashesh Jain. Can someone explain how to generate initializations_LFPW.mat file and get the trans and scl variables in the initializations_LFPW.mat for my own data set? It will be nice if someone (or the author) can post the answer here.

Ashesh Jain

Thanks for the code. Can you please explain how to generate initializations_LFPW.mat file for my own data set? I would like to test your code other data sets as well.

Has anyone else figured the answer to this question? From comments it seems many people share the same question. It will be nice if someone (or the author) can post the answer here.

Qingyue Zhang

Jin

Jin (view profile)

Hi all, Does anybody know how to generate the landmark initialization of other dataset?

smith

smith (view profile)

woon cho

Great jobs. It works well.

Hi, How do I generate "Initializations_LFPW.mat" for my own dataset??

Elangkumaran

any updates on including the face detector?

Hi, I've downloaded the Zhu and Ranaman face detector, what should I do next?

Thank you for the code, it works very well on the LFPW testset.
You have an "initializations_LFPW" here. Can you please clarify what it is and how I can generate this for my own dataset?
I really appreciate it.

Elangkumaran

The training part works fine after I load initializations_LFPW.mat, thanks.
I've changed where and what only because I'm on a Linux machine and wanted to set absolute paths.

However I am still running into other problems when testing my images. I've emailed you the details

you should change where and what only if you want to train using your own images. Otherwise, to reproduce the results in the paper you just need to download the LFPW database from http://ibug.doc.ic.ac.uk/resources/facial-point-annotations/ and follow the instructions in the README file

scl is stored in the initializations_LFPW.mat, have you downloaded the file? It needs to be stored in the same folder as the rest of the code

Send me an email for more details

Elangkumaran

I'm running main_AAM.m for now after changing where and what to proper values.

I get an error about scl:
Undefined function 'scl' for input arguments of type 'double'.
Error in main_AAM (line 145)
current_shape = scl(gg)*reshape(s0, cAAM.num_of_points, 2) +
repmat(trans(gg, :), cAAM.num_of_points, 1);

Sys-Specs: Matlab 2013a, Ubuntu 13.10 64bit

Hi, you need to download the Zhu and Ramanan (CVPR 2012) face detector, please send me an email for more details

Hi, may I know how you produce the initializations_LFPW.mat? I am interest to test your code on other dataset.

Elangkumaran

I'm able to fit the AAM to one of the annotated images in the testset.

How would I go about fitting the AAM to a non-annotated image?

cAAM.mat is generated during training. To train you'd have to download LFPW, please see the comments below

George

Swami

Swami (view profile)

I get an error that there is no file cAAM.mat ?

Please send me an email for more details on the annotation process

How to annotate my own images .. now i want to put the landmarks ?!

Jaime

Jaime (view profile)

Nice and robust implementation

Great work, thank you a lot

To be more precise, I meant that you need to annotate your own images yourself, if you want to train the system with your own images.

Alternatively, you can get .pts files for thousands of face images from here

http://ibug.doc.ic.ac.uk/resources/facial-point-annotations/

Hi Nicole

If you want to use your own images you'd have to annotate the images yourself, drop me an email for more details

George

Nicole Kovacs

I'm new to matlab and I'm trying to use my own images to test it, how do I get the .pts files? Thank you.

Thanks for answer i run the code great work but can you tell me how i can run this code on mouth region images.

Ahmed

You need to download the LFPW data set before training. Please read the README file carefully for more details.

You can get it from here

http://ibug.doc.ic.ac.uk/resources/facial-point-annotations/

George

i'm working on lip reading system and try to use your code on AAM and it return 5 error and i can't fixed it.

Error using svd
Input to SVD must not contain NaN or Inf.

Error in procrustes (line 119)
[L, D, M] = svd(A);

Error in train_AAM>Procrustes_analysis (line 169)
[~, mean_shape_new] = procrustes(mean_shape, mean_shape_new);

Error in train_AAM (line 27)
shapes_normal = Procrustes_analysis(shapes);

Error in main_AAM (line 39)
AAM = train_AAM(where, folder, what, AAM);

Updates

1.1.0.0

minor comment in README file

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux

MATLAB Online Live Editor Challenge

View the winning live scripts from faculty and students who participated in the recent challenge.

Learn more

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video