Spaces:
Sleeping
Sleeping
File size: 2,401 Bytes
8bbb872 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | # Eye Open / Closed Classifier (YOLOv11-CLS)
Binary classifier: **open** vs **closed** eyes.
Used as a baseline for eye-tracking, drowsiness, or focus detection.
---
## Model team task
- **Train** the YOLOv11s-cls eye classifier in a **separate notebook** (data split, epochs, GPU, export `best.pt`).
- Provide **trained weights** (`best.pt`) for this repoβs evaluation and inference scripts.
---
## Repo contents
- **notebooks/eye_classifier_colab.ipynb** β Data download (Kaggle), clean, split, undersample, **evaluate** (needs `best.pt` from model team), export.
- **scripts/predict_image.py** β Run classifier on single images (needs `best.pt`).
- **scripts/webcam_live.py** β Live webcam open/closed (needs `best.pt` + optional `weights/face_landmarker.task`).
- **scripts/video_infer.py** β Run on video files.
- **scripts/focus_infer.py** β Focus/attention inference.
- **weights/** β Put `best.pt` here; `face_landmarker.task` is downloaded on first webcam run if missing.
- **docs/** β Extra docs (e.g. UNNECESSARY_FILES.md if present).
---
## Dataset
- **Source:** [Kaggle β open/closed eyes](https://www.kaggle.com/datasets/sehriyarmemmedli/open-closed-eyes-dataset)
- The Colab notebook downloads it via `kagglehub`; no local copy in repo.
---
## Weights
- Put **best.pt** from the model team in **weights/best.pt** (or `runs/classify/runs_cls/eye_open_closed_cpu/weights/best.pt`).
- For webcam: **face_landmarker.task** is downloaded into **weights/** on first run if missing.
---
## Local setup
```bash
pip install ultralytics opencv-python mediapipe "numpy<2"
```
Optional: use a venv. From repo root:
- `python scripts/predict_image.py <image.png>`
- `python scripts/webcam_live.py`
- `python scripts/video_infer.py` (expects 1.mp4 / 2.mp4 in repo root or set `VIDEOS` env)
- `python scripts/focus_infer.py`
---
## Project structure
```
βββ notebooks/
β βββ eye_classifier_colab.ipynb # Data + eval (no training)
βββ scripts/
β βββ predict_image.py
β βββ webcam_live.py
β βββ video_infer.py
β βββ focus_infer.py
βββ weights/ # best.pt, face_landmarker.task
βββ docs/ # extra docs
βββ README.md
βββ venv/ # optional
```
Training and weight generation: **model team, separate notebook.**
|