Ask Your Question

How to train images for smile detection?

asked 2016-02-05 04:26:36 -0500

Tatu gravatar image

I want to do a smile detection project from images in opencv. I have installed opencv-3.1.0 with gcc and cmake. I have downloaded human faces database from AT and T. Now, how do i start training of them? I am quite noob and stuck. So i would appreciate an elaborate explanation to start and work with it from anyone out here.

edit retag flag offensive close merge delete



have you seen opencv's smile-cascade detector ?

what is your plan ?

att_faces might not be the best database for this, you'd have to annotate/label your data manually, and it's probably too small (on its own)

berak gravatar imageberak ( 2016-02-05 05:59:24 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-02-05 06:53:00 -0500

In order to get more images, you can use GENKI-4k Face, Expression, and Pose Dataset [1]

The GENKI-4K dataset contains 4,000 face images spanning a wide range of subjects, facial appearance, illumination, geographical locations, imaging conditions, and camera models. All images are labeled for both Smile content (1=smile, 0=non-smile) and Head Pose (yaw, pitch, and roll parameters, in radians).

I have used this database to train a smile classifier using LBP + SVM approach (some years ago) and results were quite satisfactory. Steps:

  • (1) Face detection
  • (2) Get Local Binary Pattern from the face
  • (3) SVM classification

Step (2) can be decomposed in:

  • crop face region
  • normalize face region based on eye coordinates
  • histogram equalization or something similar
  • Apply LBP to a NxM non-overlapping region

The public GENKI-4K dataset is available for download here [2].



Two sample images:

image description

edit flag offensive delete link more


I would do a mouth detection and classify just the mouth, IMHO the info in the face is not as good as only the info in the mouth area, am I wrong?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2016-02-05 07:09:32 -0500 )edit

You would be surprised how much a smile influences the face region and thus the descriptor!

StevenPuttemans gravatar imageStevenPuttemans ( 2016-02-05 07:11:38 -0500 )edit

Maybe you are right, the eyes shape change, there are some lines that appear...

thdrksdfthmn gravatar imagethdrksdfthmn ( 2016-02-05 07:14:13 -0500 )edit

And even contours/curves that are not so visible like cheecks or eyebrow position.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-02-05 07:31:24 -0500 )edit

I agree with @StevenPuttemans

albertofernandez gravatar imagealbertofernandez ( 2016-02-05 12:30:10 -0500 )edit

Did you use SVM lib of OpenCV or any framework such as: scikit-learn?

hoangnh gravatar imagehoangnh ( 2016-10-17 20:12:19 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-02-05 04:25:06 -0500

Seen: 587 times

Last updated: Feb 05 '16