{"id":50799909,"url":"https://github.com/abdubakr77/drowsiness-detection-eye-state-classification","last_synced_at":"2026-06-12T18:33:55.055Z","repository":{"id":355461256,"uuid":"1227398152","full_name":"abdubakr77/drowsiness-detection-eye-state-classification","owner":"abdubakr77","description":"Binary image classification (Awake vs Sleepy) using deep learning on infrared eye images from the MRL Eye Dataset (~85K images). Built with transfer learning for real-time drowsiness detection.","archived":false,"fork":false,"pushed_at":"2026-05-03T17:53:34.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-03T19:32:23.949Z","etag":null,"topics":["binary-classification","computer-vision","deep-learning","drowsiness-detection","eye-state-classification","image-classification","infrared-images","mrl-eye-dataset","pytorch","transfer-learning"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abdubakr77.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-02T16:19:30.000Z","updated_at":"2026-05-03T17:53:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/abdubakr77/drowsiness-detection-eye-state-classification","commit_stats":null,"previous_names":["abdubakr77/drowsiness-detection-eye-state-classification"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/abdubakr77/drowsiness-detection-eye-state-classification","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdubakr77%2Fdrowsiness-detection-eye-state-classification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdubakr77%2Fdrowsiness-detection-eye-state-classification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdubakr77%2Fdrowsiness-detection-eye-state-classification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdubakr77%2Fdrowsiness-detection-eye-state-classification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abdubakr77","download_url":"https://codeload.github.com/abdubakr77/drowsiness-detection-eye-state-classification/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdubakr77%2Fdrowsiness-detection-eye-state-classification/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34258368,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binary-classification","computer-vision","deep-learning","drowsiness-detection","eye-state-classification","image-classification","infrared-images","mrl-eye-dataset","pytorch","transfer-learning"],"created_at":"2026-06-12T18:33:53.158Z","updated_at":"2026-06-12T18:33:55.046Z","avatar_url":"https://github.com/abdubakr77.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Drowsiness Detection — Eye State Classification\n\nBinary classification of infrared eye images into **Awake** and **Sleepy** states using transfer learning on the MRL Eye Dataset (~85K images).\n\n---\n\n## Overview\n\nDriver drowsiness is one of the leading causes of road accidents. This project builds a deep learning classifier that detects eye state (open vs. closed) from infrared images — a core component of any real-time drowsiness detection system.\n\nTwo pretrained models are fine-tuned and compared:\n\n| Model | Epochs | Val AUC |\n|---|---|---|\n| ResNet50 | 10 | ~0.9997 |\n| InceptionV3 | 15 | ~0.9993 |\n\nBoth models converge fast and generalize well, with train/val loss tracking closely — no significant overfitting.\n\n---\n\n## Dataset\n\n**MRL Eye Dataset** (Forked Version) — infrared eye images labeled as Awake or Sleepy.\n\n| Split | Awake | Sleepy | Total |\n|---|---|---|---|\n| Train | 25,770 | 25,167 | 50,937 |\n| Validation | 8,591 | 8,389 | 16,980 |\n| Test | 8,591 | 8,390 | 16,981 |\n\n- 37 subjects · multiple sensors · various lighting conditions  \n- Classes are well-balanced — no resampling needed  \n\nDataset source: [mrl.cs.vsb.cz/eyedataset](http://mrl.cs.vsb.cz/eyedataset)\n\nExpected directory structure:\n\n```\ndata/\n├── train/\n│   ├── awake/\n│   └── sleepy/\n├── val/\n│   ├── awake/\n│   └── sleepy/\n└── test/\n    ├── awake/\n    └── sleepy/\n```\n\n---\n\n## Approach\n\n**Why transfer learning?**  \nEven with ~85K images, pretrained weights (ImageNet) provide low-level features — edges, textures, shapes — that transfer well to infrared eye images and cut training time significantly.\n\n**Augmentation**  \nLight augmentation on train only: Gaussian blur, brightness jitter, horizontal flip, random rotation. The dataset is large enough that heavy augmentation isn't necessary.\n\n---\n\n## Results\n\n### ResNet50\n\n![ResNet Loss \u0026 AUC](results/ResNet_AUC_LOSS_Curves.png)\n\n![ResNet Test Predictions](results/ResNet_test_set_predictions.png)\n\n### InceptionV3\n\n![Inception Loss \u0026 AUC](results/Inception3_AUC_LOSS_Curves.png)\n\n![Inception Test Predictions](results/Inception3_test_set_predictions.png)\n\nBoth models reach **AUC \u003e 0.999** on the validation set. The few misclassified examples (shown in red) are edge cases — heavily shadowed eyes, glare artifacts, or partially closed eyelids that are ambiguous even to a human.\n\n---\n\n## Project Structure\n\n```\n├── Drowsiness_Detection.ipynb   # full pipeline: EDA → training → evaluation\n├── ResNet_AUC_LOSS_Curves.png\n├── ResNet_test_set_predictions.png\n├── Inception3_AUC_LOSS_Curves.png\n├── Inception3_test_set_predictions.png\n└── README.md\n```\n\n---\n\n## Setup\n\n```bash\npip install torch torchvision scikit-learn tqdm seaborn matplotlib\n```\n\nUpdate the dataset paths in the **Configuration** cell of the notebook, then run all cells top to bottom.\n\n---\n\n## Key Design Decisions\n\n- **AdamW optimizer** with a low learning rate (1e-5) to avoid destroying pretrained weights early in training  \n- **Early stopping** on validation AUC with patience=5 to prevent overfitting  \n- **Mixed precision** (`torch.autocast`) for faster GPU training  \n- **Dropout(0.5)** added before the ResNet head as a light regularizer  \n- Grayscale conversion applied *after* augmentation to preserve color-based jitter effects before discarding color\n\n---\n\n## References\n\n- Fusek, R. (2018). *Pupil localization using geodesic distance.* ICIAR 2018. [[paper]](http://mrl.cs.vsb.cz/people/fusek/)  \n- MRL Eye Dataset: [http://mrl.cs.vsb.cz/eyedataset](http://mrl.cs.vsb.cz/eyedataset)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdubakr77%2Fdrowsiness-detection-eye-state-classification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabdubakr77%2Fdrowsiness-detection-eye-state-classification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdubakr77%2Fdrowsiness-detection-eye-state-classification/lists"}