distraction_detection icon indicating copy to clipboard operation
distraction_detection copied to clipboard

A Distraction Detector using OpenCV and Keras

Distraction Detector

Originally created for the Vancouver School of AI Image Classification Workshop Code Challenge.

demo

The Distraction Detector works as follows:

  1. Uses the default OpenCV Haar Cascade Face Detector to detect a person's face.

  2. Within a detected face, the person's eyes are located using the OpenCV Haar Cascade Eye Detector.

  3. For each detected eye, a pretrained Convolutional Neural Network(CNN) is used to predict whether a person is distracted or not(binary classifier). The default CNN was trained on eye images created by the get_data.py script (which essentially saves detected eyes as individual images).

Below table contains all the important scripts in this repo.

File Description
get_data.py Creates training data for Distraction Classifier
train.py Creates and trains Distraction Classifier using Keras
distraction_detector.py Detects distraction using OpenCV and Keras