Automatic smile detector based on step-wise regression.
The algorithm trains a very simple smile classifier that analyzes a grayscale image (24 × 24) and outputs a prediction indicating whether the image is smiling
or not
. It makes decision by combining 5
features of the input image through step-wise regression, each of which is computed as
Step-wise regression is a greedy algorithm: at each round j, choose the jth feature (r1, c1, r2, c2) such that – when it is added to the set of j − 1 features that have already been selected – the accuracy (fPC) of the overall classifier is maximized.
- Python v3.6.4
- NumPy v1.14.0
- Matplotlib v2.0.2
To test out the classifier, run the following command in the terminal:
python3 smile_detector.py 10
It should output the accuracy of the algorithm:
Accuracy: 1.000000
and generate a image of the selected features:
Size of Training Set | Training Accuracy | Testing Accuracy | Selected Features |
---|---|---|---|
400 | 0.827500 | 0.711160 | |
800 | 0.802500 | 0.740700 | |
1200 | 0.798333 | 0.749453 | |
1600 | 0.788750 | 0.763676 | |
2000 | 0.782500 | 0.764223 |
In the figure, as the size of training set increases, the training accuracy decreases. The testing accuracy, however, increases. We can see that the two curves are gradually getting close to each other. The decrease of training accuracy and the increase of testing accuracy indicate that the model is getting less and less overfitted as the size of training set increases.
- Yang Liu - Initial work - byliuyang
This project is licensed under the MIT License