Bug 259146 - libface doesn't learn new faces (patch)
Summary: libface doesn't learn new faces (patch)
Alias: None
Product: digikam
Classification: Applications
Component: Faces-Detection (show other bugs)
Version: 2.0.0
Platform: openSUSE Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Digikam Developers
Depends on:
Reported: 2010-12-07 17:44 UTC by Teemu Autto
Modified: 2012-06-27 10:32 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.0.0

Patch that makes learning work. Might not be a correct way to work with opencv. (647 bytes, patch)
2010-12-07 17:44 UTC, Teemu Autto

Note You need to log in before you can comment on or make changes to this bug.
Description Teemu Autto 2010-12-07 17:44:20 UTC
Created attachment 54262 [details]
Patch that makes learning work. Might not be a correct way to work with opencv.

Version:           2.0.0 (using KDE 4.5.4) 
OS:                Linux

If trained face contains known face ID,
Eigenfaces::update() calls
d->learn(*it, cvCloneImage(newFaceArr.at(i).getFace()));

to average old face and new face, but in Eigenfaces::EigenfacesPriv::learn() second argument newFace is commented out, and not included into tempFaces for average calculation.

Reproducible: Didn't try

Steps to Reproduce:
Train face database twice with same id.

Actual Results:  
OpenCV throws exception for not being able to calculate average.

Expected Results:  
Average is calculated, and stored.

Current averaging method puts too much value for lastly trained face (50%), and isn't really an "average" of trained faces.
Comment 1 caulier.gilles 2010-12-07 18:49:40 UTC
Marcel, Adithya, this patch is correct ?

Gilles Caulier
Comment 2 Alex 2010-12-09 10:16:57 UTC
Yeah this patch is correct. I forgot to add this line.

It is actually not averaging anymore. To combine previous examples with a new one it projects both new and old images into Eigen space and stores the projected image. Then when another face is added to the same id, once again it projects the new face with the projected face and stores the projected face.

P.S. I will apply the fix ASAP. Thanks for the patch.

Comment 3 caulier.gilles 2010-12-09 11:16:05 UTC
Patch applied to svn.

Gilles Caulier