Driver fatigue detection model using Inception v3 and LSTM. Model was trained and tested on YawDD dataset.
This project contains a deep neural network model for driver drowsiness detection using video and facial feature.
No human face or facial organ detection is required.
python==3.7
keras==2.3.1
tensorflow-gpu==2.1.0
opencv, numpy
- split original videos with
yawn_split_video.py
inDatasets/YawDD/seg_list/
. - divide training data to train and val dataset with tools in
opr_tools.py
.
- split videos into frames with
data_proc.py
functions.
- run
feature_extract.py
to extract frame features of all training data.
YawDD/
train/
CNN/
train/
normal/
yawning/
val/
normal/
yawning/
lstm/
train/
train_video/
normal/
...
train_frame/
normal/
...
val/
val_video/
normal/
...
val_frame/
normal/
...
test/
test_videos/
normal/
...
test_frames/
normal/
...
- run
cnn_train.py
to train Inception model. In this case, I used only frames from videos with normal/yawning label. - run
lstm_train.py
to train LSTM model.
- run
test.py
to test model on test dataset.
- to train the end to end model, configure model in
ModelConfig.py
and then runImplement.py
.
- trained model weights and preprocessed data will be writen in
./out
- model weights files:
Inception_weight.h5
,lstm_weight.h5
... - preprocessed data:
train_clip_feature_sample.pkl
,val_clip_feature_sample.pkl
...
- model weights files:
- log path of TensorBoard is
./out/tensorboard
- end to end model training will require large amount of computation resources, multi-gpu training is recommended.