{"id":30061516,"url":"https://github.com/tigo-cmd/vigilant-eye-cam","last_synced_at":"2025-08-08T02:23:54.388Z","repository":{"id":307611911,"uuid":"1029664106","full_name":"Tigo-cmd/Vigilant-Eye-Cam","owner":"Tigo-cmd","description":"🛌 Vigilant Eye Cam – Real-Time Drowsiness Detection","archived":false,"fork":false,"pushed_at":"2025-08-01T05:33:19.000Z","size":177,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-01T07:49:48.803Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://vigilant-eye-cam.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tigo-cmd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-07-31T11:36:36.000Z","updated_at":"2025-08-01T05:33:22.000Z","dependencies_parsed_at":"2025-08-01T08:00:06.006Z","dependency_job_id":null,"html_url":"https://github.com/Tigo-cmd/Vigilant-Eye-Cam","commit_stats":null,"previous_names":["tigo-cmd/vigilant-eye-cam"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Tigo-cmd/Vigilant-Eye-Cam","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tigo-cmd%2FVigilant-Eye-Cam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tigo-cmd%2FVigilant-Eye-Cam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tigo-cmd%2FVigilant-Eye-Cam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tigo-cmd%2FVigilant-Eye-Cam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tigo-cmd","download_url":"https://codeload.github.com/Tigo-cmd/Vigilant-Eye-Cam/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tigo-cmd%2FVigilant-Eye-Cam/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269352138,"owners_count":24402737,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"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":[],"created_at":"2025-08-08T02:23:48.846Z","updated_at":"2025-08-08T02:23:54.375Z","avatar_url":"https://github.com/Tigo-cmd.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🛌 Vigilant Eye Cam – Real-Time Drowsiness Detection\n\n**Vigilant Eye Cam** is a real-time drowsiness detection system built with **React (TypeScript)** on the frontend and a **Flask (Python)** backend. It uses a webcam to monitor a user's face and detect signs of drowsiness using a pre-trained deep learning model. If drowsiness is detected, an alarm is triggered, and a visual warning is displayed.\n\n---\n\n## 🚀 Features\n\n* 🎥 **Live Webcam Feed** – Automatically detects and streams the user's webcam.\n* 🧠 **ML-Based Drowsiness Detection** – Sends frames to a Flask backend with a TensorFlow model for analysis.\n* 🔔 **Real-Time Alert System** – Shows warning banners and plays an alarm if drowsiness is detected.\n* 🧪 **Retry Logic** – Automatically retries failed detection requests.\n* 🖥️ **Mobile-Responsive UI** – Built with Tailwind CSS and React components.\n* 🔇 **Toggleable Alarm** – Easily enable or disable the alarm sound.\n\n---\n\n## 📁 Project Structure\n\n```\nvigilant-eye-cam/\n│\n├── frontend/                # React + TypeScript app\n│   └── src/\n│       └── components/\n│           └── DrowsinessDetector.tsx\n│\n├── backend/                 # Flask backend\n│   ├── app.py\n│   └── drowsiness_model.h5\n│\n├── public/\n├── README.md\n```\n\n---\n\n## 🧠 How It Works\n\n1. The frontend captures a frame every second from the webcam.\n2. Each frame is sent as a JPEG image to the Flask backend.\n3. The backend loads a pre-trained Keras model (`drowsiness_model.h5`) to analyze the image.\n4. The backend responds with:\n\n   ```json\n   { \"drowsy\": true, \"confidence\": 0.92 }\n   ```\n5. If `drowsy` is `true`, the UI shows a warning banner and triggers an alarm.\n\n---\n\n## 🔧 Setup Instructions\n\n### 1. Backend (Python + Flask)\n\n#### 📦 Requirements\n\n* Python 3.7+\n* TensorFlow\n* Flask\n* OpenCV\n* NumPy\n\n#### 🛠 Install Dependencies\n\n```bash\ncd backend\npython -m venv venv\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\npip install -r requirements.txt\n```\n\n**Sample `requirements.txt`:**\n\n```txt\nFlask\ntensorflow\nopencv-python\nnumpy\nflask-cors\n```\n\n#### 🧠 Start the Backend Server\n\n```bash\npython app.py\n```\n\n\u003e Ensure `drowsiness_model.h5` exists in the backend folder.\n\n---\n\n### 2. Frontend (React + Vite + Tailwind)\n\n#### 📦 Requirements\n\n* Node.js 18+\n* npm or yarn\n\n#### 🛠 Install and Start\n\n```bash\ncd frontend\nnpm install\nnpm run dev\n```\n\n\u003e The frontend runs on `http://localhost:5173` and expects the backend at `http://localhost:5000`.\n\n---\n\n## 📱 API Endpoint\n\n### POST `/detect`\n\n* **Headers**: `Content-Type: image/jpeg`\n* **Body**: JPEG image blob\n* **Response**:\n\n  ```json\n  {\n    \"drowsy\": true,\n    \"confidence\": 0.87\n  }\n  ```\n\n---\n\n## ⚙️ Configuration\n\n| Variable           | Default   | Description                        |\n| ------------------ | --------- | ---------------------------------- |\n| `CAPTURE_INTERVAL` | 1000 ms   | Time interval for capturing frames |\n| `CAPTURE_WIDTH`    | 320 px    | Width of the video capture         |\n| `CAPTURE_HEIGHT`   | 240 px    | Height of the video capture        |\n| `BACKEND_URL`      | `/detect` | Flask API URL                      |\n\n---\n\n## 🧪 Testing\n\n1. Start the backend (`localhost:5000`)\n2. Start the frontend (`localhost:5173`)\n3. Grant camera permissions\n4. Click \"Start\"\n5. Test by:\n\n   * Closing your eyes\n   * Leaning your head\n   * Looking drowsy\n\n---\n\n## 🚯 Alarm Control\n\n* Toggle alarm ON/OFF using the \"Alarm\" button\n* Dismiss warning using the \"Dismiss\" button\n* Alarm auto-stops when alertness is regained\n\n---\n\n## 🧠 Model Note\n\n* The `drowsiness_model.h5` must be trained on eye state or facial expression data.\n* Image input size and normalization must match training preprocessing.\n\n---\n\n## 📸 Screenshots\n\n\u003e *(Add screenshots of the working app with warning banner and camera feed)*\n\n---\n\n## 🛡️ Security \u0026 Privacy\n\n* No frames are stored or shared.\n* All processing happens in real-time on the user's device and private backend.\n\n---\n\n## 🤝 Credits\n\n* UI: Tailwind CSS, ShadCN\n* Icons: Lucide React\n* ML: TensorFlow\n* Backend: Flask + OpenCV\n\n---\n\n## 📄 License\n\nMIT License. Feel free to fork and customize for your own use.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftigo-cmd%2Fvigilant-eye-cam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftigo-cmd%2Fvigilant-eye-cam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftigo-cmd%2Fvigilant-eye-cam/lists"}