Update README.md
Browse files
README.md
CHANGED
|
@@ -1,74 +1,76 @@
|
|
| 1 |
-
---
|
| 2 |
-
language: en
|
| 3 |
-
license: mit
|
| 4 |
-
library_name: tensorflow
|
| 5 |
-
tags:
|
| 6 |
-
- computer-vision
|
| 7 |
-
- drowsiness-detection
|
| 8 |
-
- driver-safety
|
| 9 |
-
- cnn
|
| 10 |
-
- tensorflow
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
import
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
img =
|
| 41 |
-
img =
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
-
|
| 52 |
-
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
- Conv2D(
|
| 60 |
-
- MaxPooling2D(2x2)
|
| 61 |
-
- Conv2D(
|
| 62 |
-
- MaxPooling2D(2x2)
|
| 63 |
-
-
|
| 64 |
-
-
|
| 65 |
-
|
| 66 |
-
- Dense(
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
license: mit
|
| 4 |
+
library_name: tensorflow
|
| 5 |
+
tags:
|
| 6 |
+
- computer-vision
|
| 7 |
+
- drowsiness-detection
|
| 8 |
+
- driver-safety
|
| 9 |
+
- cnn
|
| 10 |
+
- tensorflow
|
| 11 |
+
model_name: driver-drowsiness-detector
|
| 12 |
+
datasets:
|
| 13 |
+
- ckcl/drowsiness_dataset
|
| 14 |
+
- custom
|
| 15 |
+
metrics:
|
| 16 |
+
- accuracy
|
| 17 |
+
- binary-crossentropy
|
| 18 |
+
pipeline_tag: image-classification
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# Driver Drowsiness Detection Model
|
| 22 |
+
|
| 23 |
+
This model is designed to detect driver drowsiness from facial images using a CNN architecture.
|
| 24 |
+
|
| 25 |
+
## Model Details
|
| 26 |
+
- Architecture: CNN
|
| 27 |
+
- Input: Facial images (64x64x3)
|
| 28 |
+
- Output: Binary classification (drowsy/not drowsy)
|
| 29 |
+
|
| 30 |
+
## Usage
|
| 31 |
+
```python
|
| 32 |
+
import tensorflow as tf
|
| 33 |
+
import cv2
|
| 34 |
+
import numpy as np
|
| 35 |
+
|
| 36 |
+
# Load model
|
| 37 |
+
model = tf.keras.models.load_model('drowsiness_model.h5')
|
| 38 |
+
|
| 39 |
+
# Preprocess image
|
| 40 |
+
img = cv2.imread('face.jpg')
|
| 41 |
+
img = cv2.resize(img, (64, 64))
|
| 42 |
+
img = img / 255.0
|
| 43 |
+
img = np.expand_dims(img, axis=0)
|
| 44 |
+
|
| 45 |
+
# Make prediction
|
| 46 |
+
prediction = model.predict(img)
|
| 47 |
+
is_drowsy = prediction[0][0] > 0.5
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
## Training Details
|
| 51 |
+
- Dataset: Custom driver drowsiness dataset
|
| 52 |
+
- Training method: Binary cross-entropy loss with Adam optimizer
|
| 53 |
+
- Validation split: 20%
|
| 54 |
+
- Early stopping with patience=3
|
| 55 |
+
|
| 56 |
+
## Model Architecture
|
| 57 |
+
- Input Layer: 64x64x3 images
|
| 58 |
+
- Convolutional Layers:
|
| 59 |
+
- Conv2D(32, 3x3) + BatchNorm + ReLU
|
| 60 |
+
- MaxPooling2D(2x2)
|
| 61 |
+
- Conv2D(64, 3x3) + BatchNorm + ReLU
|
| 62 |
+
- MaxPooling2D(2x2)
|
| 63 |
+
- Conv2D(128, 3x3) + BatchNorm + ReLU
|
| 64 |
+
- MaxPooling2D(2x2)
|
| 65 |
+
- Dense Layers:
|
| 66 |
+
- Dense(128) + BatchNorm + ReLU
|
| 67 |
+
- Dropout(0.5)
|
| 68 |
+
- Dense(1) + Sigmoid
|
| 69 |
+
|
| 70 |
+
## Performance
|
| 71 |
+
- Binary classification for drowsiness detection
|
| 72 |
+
- Optimized for real-time inference
|
| 73 |
+
- Suitable for embedded systems and edge devices
|
| 74 |
+
|
| 75 |
+
## License
|
| 76 |
+
This model is released under the MIT License.
|