Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.

Smile Detection project for CS1602 (2019 Fall) with my code

License

Notifications You must be signed in to change notification settings

junqi-xie/SmileDetection

 
 

Repository files navigation

SmileDetection

Smile Detection project codes for course CS124, SJTU. (I am one of the students taking this course. I forked this project from TA Jiaoping Hu.)

  • Note: The changes committed by me is licensed under the GNU General Public License v3.0. Remember to state license and copyright notice, state changes, disclose source and use the same license when using this project :)

Problem Description

Given a picture of a person, could you tell me whether he/she is smiling? Please let your computer to give the answer.

Getting Started

Installation

  • This code was tested with Python 3.7, windows 10
  • Dataset GENKI-4K should be downloaded to train the models.
  • data_faces are face images gernerated from orignal GENKI-4K (using opencv face detector).
  • xmls containes the xml file from opencv to detect faces.
  • img_label.txt is the face image names and their labels. The images that cannot be detected faces by opencv are discarded.
  • Clone this repo:
git clone https://github.com/junqi-xie/SmileDetection
cd SmileDetection

Preparing

pip3 install numpy
pip3 install opencv-python
pip3 install scikit-learn
pip3 install scikit-image
pip3 install pillow

Task 1: Face Detection with Opencv

  • Run face_detection.py to detect face in example.jpg.
  • Run face_detection.py --use_camera True to detect faces from your camera real-time.

Task 2: Smile Detection Models Training

  • Run train_smile_detection_model.py to train smile detection models. 10-fold cross validation is utilized.
  • Run train_smile_detection_model.py --use_hog True to use HOG features.
  • Note: This program will save the trained SVC models to model_x.svc, and the predict results to predicted_x.txt.

Task 3: Real-time Smile Detection

  • Run realtime_detect_smiles.py --model model_lbp.svc to detect smiles.
  • Run realtime_detect_smiles.py --model model_hog.svc --use_hog True to use HOG-based SVC models.
  • Note: You have to specify the SVC model explicitly.

About

Smile Detection project for CS1602 (2019 Fall) with my code

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • Python 100.0%