Upload folder using huggingface_hub
Browse files- README.md +26 -60
- config.json +1 -0
- model_weights.h5 +3 -0
README.md
CHANGED
|
@@ -1,68 +1,34 @@
|
|
| 1 |
-
---
|
| 2 |
-
language: en
|
| 3 |
-
license: mit
|
| 4 |
-
tags:
|
| 5 |
-
- vision
|
| 6 |
-
- image-classification
|
| 7 |
-
- drowsiness-detection
|
| 8 |
-
- driver-monitoring
|
| 9 |
-
- pytorch
|
| 10 |
-
- mobilenetv2
|
| 11 |
-
datasets:
|
| 12 |
-
- custom
|
| 13 |
-
---
|
| 14 |
-
|
| 15 |
# Driver Drowsiness Detection Model
|
| 16 |
|
| 17 |
-
This model
|
| 18 |
-
|
| 19 |
-
## Model Description
|
| 20 |
-
|
| 21 |
-
This model is fine-tuned on a custom dataset of driver face images to detect drowsiness in real-time. It uses a MobileNetV2 architecture for efficient inference.
|
| 22 |
-
|
| 23 |
-
### Model Architecture
|
| 24 |
-
- Base model: MobileNetV2
|
| 25 |
-
- Fine-tuned for binary classification (alert vs. drowsy)
|
| 26 |
-
- Input size: 224x224 RGB images
|
| 27 |
-
|
| 28 |
-
## Training Data
|
| 29 |
-
|
| 30 |
-
The model was trained on custom-labeled face images extracted from driver-facing camera videos. The dataset includes various lighting conditions and driver appearances.
|
| 31 |
-
|
| 32 |
-
## Performance
|
| 33 |
-
|
| 34 |
-
The model can identify signs of drowsiness in drivers with high accuracy. It's designed to be fast enough for real-time inference.
|
| 35 |
|
| 36 |
-
##
|
| 37 |
-
|
| 38 |
-
-
|
| 39 |
-
-
|
| 40 |
-
- Should be used as part of a comprehensive driver monitoring system and not as the sole safety mechanism
|
| 41 |
|
| 42 |
## Usage
|
| 43 |
-
|
| 44 |
```python
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
model =
|
| 51 |
-
|
| 52 |
-
#
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
|
|
|
| 60 |
```
|
| 61 |
|
| 62 |
-
##
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
For questions or feedback, please open an issue on the GitHub repository or contact the author on Hugging Face.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Driver Drowsiness Detection Model
|
| 2 |
|
| 3 |
+
This model is designed to detect driver drowsiness from facial images using a CNN architecture.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
## Model Details
|
| 6 |
+
- Architecture: CNN
|
| 7 |
+
- Input: Facial images (64x64x3)
|
| 8 |
+
- Output: Binary classification (drowsy/not drowsy)
|
|
|
|
| 9 |
|
| 10 |
## Usage
|
|
|
|
| 11 |
```python
|
| 12 |
+
import tensorflow as tf
|
| 13 |
+
import cv2
|
| 14 |
+
import numpy as np
|
| 15 |
+
|
| 16 |
+
# Load model
|
| 17 |
+
model = tf.keras.models.load_model('drowsiness_model.h5')
|
| 18 |
+
|
| 19 |
+
# Preprocess image
|
| 20 |
+
img = cv2.imread('face.jpg')
|
| 21 |
+
img = cv2.resize(img, (64, 64))
|
| 22 |
+
img = img / 255.0
|
| 23 |
+
img = np.expand_dims(img, axis=0)
|
| 24 |
+
|
| 25 |
+
# Make prediction
|
| 26 |
+
prediction = model.predict(img)
|
| 27 |
+
is_drowsy = prediction[0][0] > 0.5
|
| 28 |
```
|
| 29 |
|
| 30 |
+
## Training Details
|
| 31 |
+
- Dataset: Custom driver drowsiness dataset
|
| 32 |
+
- Training method: Binary cross-entropy loss with Adam optimizer
|
| 33 |
+
- Validation split: 20%
|
| 34 |
+
- Early stopping with patience=3
|
|
|
|
|
|
config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"model_type": "drowsiness_detector", "input_shape": [64, 64, 3], "architecture": "CNN", "description": "A CNN model for detecting driver drowsiness from facial images"}
|
model_weights.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:be899dd5a95dad19789a8352a7cbd1523a5c2c182795dd4195b4921dde7a3fb6
|
| 3 |
+
size 4613168
|