It's so easy to stare at the screen for too long and forget to blink! So comes this blink detection. But it can only detect and count blinks for now. A reminder will follow if the blink detection engine becomes more efficient. (The CPU burns while it runs!)
All honor goes to Affectiva’s Emotion-as-a-Service API. They do all the effort to recognize facial landmarks and derive measurements of facial features.
Most of the code (including Get Started below) are from Udacity's AIND-CV-Mimic project. The only tweak is to count blinks based on eyeClosure measurement and show the measurement history with ECharts.
Two ways to start:
-
Run locally:
In order to access the webcam stream, modern browsers require you to serve your web app over HTTPS. To run locally, you will need to general an SSL certificate (this is a one-time step):
- Open a terminal or command-prompt, and ensure you are inside the
blink-detection-js
directory. - Run the following shell script:
generate-pemfile.sh
This creates an SSL certificate file named my-ssl-cert.pem
that is used to serve over https.
Now you can launch the server using:
python serve.py
Note: The serve.py
script uses Python 3.
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. Please refer to Udacity Terms of Service for further information.