https://github.com/borhanmorphy/smile
Face detection with smiling/neutral classification using opencv haar cascade and LeNet5
https://github.com/borhanmorphy/smile
Last synced: 8 months ago
JSON representation
Face detection with smiling/neutral classification using opencv haar cascade and LeNet5
- Host: GitHub
- URL: https://github.com/borhanmorphy/smile
- Owner: borhanMorphy
- Created: 2020-02-01T18:13:18.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-10-12T23:02:04.000Z (over 4 years ago)
- Last Synced: 2025-03-17T06:49:28.157Z (over 1 year ago)
- Language: Python
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Brief Explanation
Real time (CPU) face detection using opencv haar cascade and a CNN classifier to classify faces that smiles or not.
For classification LeNet5 used and impelented with pytorch
## Dataset
You can obtain the dataset [here](https://github.com/hromi/SMILEsmileD/tree/master/SMILEs)
## Traning
If you have a gpu than you can use like this to train the classifier
```
python3 train.py --batch_size 64 --epochs 15 --model_name lenet -g 0
```
To train on CPU
```
python3 train.py --batch_size 64 --epochs 15 --model_name lenet -g -1
```
There will be 2 model on the models/ directory
best.pt refers that model saved when best eval result on test set achived.
last.pt refers that model saved when last epoch runned.
## Inference
To run the detector and classifier use inference.py
```
python3 inference.py
```
This will cause to open webcam at index 0 and run the classifier with detector using best.pt
## References
[LeNet5](http://yann.lecun.com/exdb/publis/pdf/lecun-98.pdf)
[Dataset](https://github.com/hromi/SMILEsmileD/tree/master/SMILEs)
[Special thanks to Adrian Rosebrock and his awesome book](https://www.pyimagesearch.com/deep-learning-computer-vision-python-book/)