| | ---
|
| | language: en
|
| | license: mit
|
| | library_name: tensorflow
|
| | tags:
|
| | - computer-vision
|
| | - drowsiness-detection
|
| | - driver-safety
|
| | - cnn
|
| | - tensorflow
|
| | datasets:
|
| | - custom
|
| | metrics:
|
| | - accuracy
|
| | - binary-crossentropy
|
| | pipeline_tag: image-classification
|
| | ---
|
| |
|
| | # Driver Drowsiness Detection Model
|
| |
|
| | This model is designed to detect driver drowsiness from facial images using a CNN architecture.
|
| |
|
| | ## Model Details
|
| | - Architecture: CNN
|
| | - Input: Facial images (64x64x3)
|
| | - Output: Binary classification (drowsy/not drowsy)
|
| |
|
| | ## Usage
|
| | ```python
|
| | import tensorflow as tf
|
| | import cv2
|
| | import numpy as np
|
| |
|
| | # Load model
|
| | model = tf.keras.models.load_model('drowsiness_model.h5')
|
| |
|
| | # Preprocess image
|
| | img = cv2.imread('face.jpg')
|
| | img = cv2.resize(img, (64, 64))
|
| | img = img / 255.0
|
| | img = np.expand_dims(img, axis=0)
|
| |
|
| | # Make prediction
|
| | prediction = model.predict(img)
|
| | is_drowsy = prediction[0][0] > 0.5
|
| | ```
|
| |
|
| | ## Training Details
|
| | - Dataset: Custom driver drowsiness dataset
|
| | - Training method: Binary cross-entropy loss with Adam optimizer
|
| | - Validation split: 20%
|
| | - Early stopping with patience=3
|
| |
|
| | ## Model Architecture
|
| | - Input Layer: 64x64x3 images
|
| | - Convolutional Layers:
|
| | - Conv2D(32, 3x3) + BatchNorm + ReLU
|
| | - MaxPooling2D(2x2)
|
| | - Conv2D(64, 3x3) + BatchNorm + ReLU
|
| | - MaxPooling2D(2x2)
|
| | - Conv2D(128, 3x3) + BatchNorm + ReLU
|
| | - MaxPooling2D(2x2)
|
| | - Dense Layers:
|
| | - Dense(128) + BatchNorm + ReLU
|
| | - Dropout(0.5)
|
| | - Dense(1) + Sigmoid
|
| |
|
| | ## Performance
|
| | - Binary classification for drowsiness detection
|
| | - Optimized for real-time inference
|
| | - Suitable for embedded systems and edge devices
|
| |
|
| | ## License
|
| | This model is released under the MIT License.
|
| |
|