Metadata-Version: 2.4
Name: safedrive-ai
Version: 0.1.0
Summary: Real-time driver drowsiness detection SDK
Home-page: https://github.com/yourusername/safedrive-ai
Author: SafeDrive AI
Keywords: drowsiness detection,driver monitoring,eye tracking,computer vision,mediapipe,yolo,deep learning,safety,automotive
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Intended Audience :: Developers
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: opencv-python>=4.8.0
Requires-Dist: mediapipe>=0.10.0
Requires-Dist: torch>=2.0.0
Requires-Dist: torchvision>=0.15.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: albumentations>=1.3.0
Provides-Extra: yolo
Requires-Dist: ultralytics>=8.0.0; extra == "yolo"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: build; extra == "dev"
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# SafeDrive AI — Driver Drowsiness Detection SDK

Real-time driver drowsiness and distraction detection.  
Built on MediaPipe + MobileNetV3 (v0.1.0) with YOLOv8 multi-feature detection coming in v0.2.0.

---

## Install

```bash
pip install safedrive-ai
```

---

## Quick Start

```python
from safedrive import DrowsinessDetector

detector = DrowsinessDetector(pipeline="mediapipe")

@detector.on_drowsy
def handle(event):
    print(f"Level {event.level}: {event.message}")

detector.run(camera=0)
```

---

## Alert Levels

| Level | State    | Trigger                              | Action              |
|-------|----------|--------------------------------------|---------------------|
| 1     | WARNING  | Eyes half-open 3s / yawn / head tilt | Soft beep           |
| 2     | ALERT    | Eyes closed 2s / head nod            | Loud beep           |
| 3     | CRITICAL | Face gone 2s / eyes closed 4s        | Continuous alarm    |

**Separate alerts** (independent of drowsiness level):
- **Phone detected** → instant distraction alert
- **Seatbelt removed** → continuous safety alert
- **Smoking detected** → instant distraction alert

---

## Full API

```python
detector = DrowsinessDetector(
    pipeline          = "mediapipe",  # "yolo" coming in v0.2.0
    eye_close_seconds = 2.0,
    face_gone_seconds = 2.0,
    head_tilt_degrees = 15.0,
    detect_phone      = True,
    detect_seatbelt   = True,
    detect_yawn       = True,
    detect_smoking    = True,
    show_window       = True,
    ear_weight        = 0.5,
    cnn_weight        = 0.5,
)

@detector.on_drowsy      # DrowsyEvent
@detector.on_distraction # DistractionEvent
@detector.on_safety      # SafetyEvent
@detector.on_frame       # called every frame with annotated frame + FrameStats

detector.run(camera=0)
detector.stop()
detector.reset_alert()   # manual reset after CRITICAL
```

---

## Roadmap

| Version | Features                                          |
|---------|---------------------------------------------------|
| v0.1.0  | MediaPipe + MobileNetV3 drowsiness detection ✅   |
| v0.2.0  | YOLOv8 pipeline + full multi-feature detection    |
| v1.0.0  | Ensemble mode + benchmark tool + full docs        |

---

## Pipeline Comparison

| Feature          | MediaPipe (v0.1.0) | YOLO (v0.2.0)  |
|------------------|--------------------|----------------|
| Eyes open/closed | ✅                 | ✅             |
| Yawn detection   | ❌                 | ✅             |
| Phone detection  | ❌                 | ✅             |
| Seatbelt         | ❌                 | ✅             |
| Smoking          | ❌                 | ✅             |
| Head pose        | ✅ (both use MediaPipe landmarks) | ✅ |
| Speed            | ~28 FPS            | ~24 FPS        |

---

## License

MIT
