This repository hosts code to run a yawn counter in your browser. The code uses a pretrained facial keypoint detector model, hosted on the tf-js models repository.
The base code has been taken from the facial landmark detector demo (FLD) page of the repository and has been refactored to work in the browser using Tensorflow-JS 2.4.0.
After the FLD model predicts the keypoint location. Lip keypoints (refer to mesh map) are used to calculate the distance between the upper and lower lips.
The distance is plotted on a line chart for easy visualization. Whenever the distance between both lips rises above below a threshold, a update counter function is called.
The following are some low hanging fruits for you to try:
- Add code to make the yawn counter robust to camera angle changes and duration of yawn.
- Add code for automatic threshold calculation.
Please create an issue on this repository or write to us on [email protected] on any issue/thoughts on this repository.
Follow us on @pretrainedmchns on Twitter and Github.
We are waiting to hear from you.