Youtube: watch
Try it out: download
- Window 10 OS
Install Python version 3.9.6 and run the following command to install all required python packages
pip install -r requirements.txt
Drowsiness custom dataset is generated by running prepare.py
script and are placed under data
folder. There are three labels for the drowsiness data:
- Awake
- Background
- Drowsy
Background
label indicates situation whenever user is not sitting in front of the screen.
-
prepare_data.py
- Creating custom drowsiness dataset where user has to sit in front of webcam to capture his/her face with the background
-
finetune_model.py
- Fine-tuning and training pretrained MobineNet_V2 model
-
detect_drowsiness.py
- Evaluating the model performance by detecting user whether is drowsy
-
entry_point/app.py
- Entry point of the desktop application to launch
-
entry_point/main.py
- Implementation of window logic and model integration logic for the app
-
build.py
- Run this script to use PyInstaller to compile everything to a stand-alone executable.
-
model
folder- model with best accuracy after running
finetune_model.py
is placed over here
- model with best accuracy after running
-
sound
folder- a list of sounds or ringtones are placed here which are used to rouse user.
First, remove all .gitkeep
file which are placed inside data
and their children folders. Then run prepare_data.py
and follow the instruction there. You may change the dataset size
from the script.
python finetune.py
Notes: The model state is checkpoint and metrics are logged under runs
folder during training phase
python detect_drowsiness.py --on-gpu --model your/path/to/best/model
Set --on-gpu
flag if you want to evaluate model on GPU device
python build.py
-
Option 1: A
dist
folder is generated after runningbuild.py
or you may get it here. Insidedist
folder, go tobin
folder and locateapp.exe
. Simply double click it to launch and you are good to go. You may go tosound
folder to change your choice of sounds/ringtones. -
Option 2: On console
cd entry_point
python app.py