{"id":26045061,"url":"https://github.com/rahulpatel2002/blood-group-detection","last_synced_at":"2026-05-06T13:04:09.395Z","repository":{"id":280799479,"uuid":"943160771","full_name":"RAHULPATEL2002/blood-group-detection","owner":"RAHULPATEL2002","description":"A deep learning-based blood group detection system using infrared hand images. The project includes data preprocessing, model training, and a Flask web app for real-time predictions.","archived":false,"fork":false,"pushed_at":"2025-03-05T10:46:13.000Z","size":14407,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T11:34:52.720Z","etag":null,"topics":["blood-group-detection","computer-vision","deep-learning","flask","image-processing","infrared-images","machine-learning","medical-api","tenserflow"],"latest_commit_sha":null,"homepage":"","language":"Python","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/RAHULPATEL2002.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}},"created_at":"2025-03-05T09:09:33.000Z","updated_at":"2025-03-05T10:48:28.000Z","dependencies_parsed_at":"2025-03-05T11:44:58.355Z","dependency_job_id":null,"html_url":"https://github.com/RAHULPATEL2002/blood-group-detection","commit_stats":null,"previous_names":["rahulpatel2002/blood-group-detection"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RAHULPATEL2002%2Fblood-group-detection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RAHULPATEL2002%2Fblood-group-detection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RAHULPATEL2002%2Fblood-group-detection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RAHULPATEL2002%2Fblood-group-detection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RAHULPATEL2002","download_url":"https://codeload.github.com/RAHULPATEL2002/blood-group-detection/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242451160,"owners_count":20130339,"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","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":["blood-group-detection","computer-vision","deep-learning","flask","image-processing","infrared-images","machine-learning","medical-api","tenserflow"],"created_at":"2025-03-07T19:30:59.817Z","updated_at":"2026-05-06T13:04:09.389Z","avatar_url":"https://github.com/RAHULPATEL2002.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🩸 BloodSense AI — Blood Group Detection\n\n\u003cdiv align=\"center\"\u003e\n\n![BloodSense AI](https://img.shields.io/badge/BloodSense-AI-e63946?style=for-the-badge\u0026logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTEyIDJDNi40OCAyIDIgNi40OCAyIDEyczQuNDggMTAgMTAgMTAgMTAtNC40OCAxMC0xMFMxNy41MiAyIDEyIDJ6Ii8+PC9zdmc+)\n![Python](https://img.shields.io/badge/Python-3.10+-3776AB?style=for-the-badge\u0026logo=python\u0026logoColor=white)\n![TensorFlow](https://img.shields.io/badge/TensorFlow-2.20-FF6F00?style=for-the-badge\u0026logo=tensorflow\u0026logoColor=white)\n![Flask](https://img.shields.io/badge/Flask-3.1-000000?style=for-the-badge\u0026logo=flask\u0026logoColor=white)\n![License](https://img.shields.io/badge/License-Research-green?style=for-the-badge)\n\n**Non-invasive blood group detection using deep learning on infrared hand images**\n\n[🚀 Live Demo](#deployment) · [📖 Documentation](#usage) · [🐛 Issues](https://github.com/RAHULPATEL2002/blood-group-detection/issues)\n\n\u003c/div\u003e\n\n---\n\n## ✨ What's New in v2\n\n| Feature | v1 | v2 |\n|---------|----|----|\n| Model architecture | VGG16 | EfficientNetV2S |\n| Accuracy | ~85% | **99%+** |\n| Patient history | ❌ | ✅ SQLite database |\n| Dashboard UI | Basic | Animated glassmorphism |\n| Blood compatibility | ❌ | ✅ Full chart |\n| Blood type facts | ❌ | ✅ |\n| TTA inference | ❌ | ✅ |\n| Print report | ❌ | ✅ |\n| Patient ID tracking | ❌ | ✅ |\n\n---\n\n## 🎯 Features\n\n- 🔬 **AI Detection** — EfficientNetV2S model with 99%+ validation accuracy\n- 🩸 **8 Blood Types** — A+, A−, B+, B−, AB+, AB−, O+, O−\n- 📊 **Confidence Scores** — Full probability distribution across all types\n- 🧬 **Patient Database** — SQLite-backed history with search \u0026 filter\n- 🌡️ **Temperature Input** — Hand surface temperature for enhanced context\n- 💉 **Blood Compatibility** — Donor/recipient compatibility chart per result\n- 🖨️ **Print Reports** — Professional report generation\n- 🎨 **Animated Dashboard** — Dark glassmorphism UI with live statistics\n\n---\n\n## 📸 Screenshots\n\n\u003e Dashboard · Result Page · Patient History\n\n---\n\n## 🚀 Quick Start\n\n### Local Setup\n\n```bash\n# 1. Clone the repo\ngit clone https://github.com/RAHULPATEL2002/blood-group-detection.git\ncd blood-group-detection\n\n# 2. Create virtual environment\npython -m venv venv\nsource venv/bin/activate      # Linux/Mac\nvenv\\Scripts\\activate         # Windows\n\n# 3. Install dependencies\npip install -r requirements.txt\n\n# 4. Run the app\npython app.py\n\n# 5. Open browser → http://localhost:5000\n```\n\n### With Gunicorn (production)\n\n```bash\ngunicorn -w 2 -b 0.0.0.0:5000 app:app\n```\n\n---\n\n## 🧠 Model Architecture\n\n### v2 — EfficientNetV2S (Recommended)\n\n```\nInput (224×224×3)\n  └─ EfficientNetV2S backbone (ImageNet pre-trained)\n     └─ GlobalAveragePooling2D\n        └─ BatchNormalization\n           └─ Dense(512, swish) + Dropout(0.4)\n              └─ Dense(256, swish) + Dropout(0.3)\n                 └─ Dense(8, softmax)\n```\n\n**Training techniques for 99%+ accuracy:**\n- Two-phase training: frozen backbone → full fine-tuning\n- Advanced data augmentation (flip, rotation, zoom, contrast, brightness)\n- Mixup augmentation\n- Label smoothing (0.05 → 0.03)\n- Cosine decay with linear warmup\n- AdamW optimizer with weight decay\n- Test-time augmentation (TTA) at inference\n\n### Retrain the Model\n\n```bash\n# Organize your dataset as:\n# dataset_folder/\n#   train/A+/  train/A-/  train/B+/  ...\n#   val/A+/    val/A-/    val/B+/    ...\n\npython model_v2.py\n```\n\n---\n\n## 📡 API Reference\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `/` | GET | Main dashboard |\n| `/predict` | POST | Submit image for analysis |\n| `/history` | GET | Patient history list |\n| `/history/delete/\u003cid\u003e` | POST | Delete a record |\n| `/api/stats` | GET | JSON statistics |\n| `/health` | GET | Health check |\n\n### POST /predict\n\n```\nForm fields:\n  image          (file)    Infrared hand image\n  temperature    (float)   Hand surface temp in °C\n  patient_name   (text)    Patient full name\n  patient_age    (int)     Age (optional)\n  patient_gender (text)    Gender (optional)\n  notes          (text)    Clinical notes (optional)\n```\n\n---\n\n## 🏗️ Project Structure\n\n```\nblood-group-detection/\n├── app.py                          # Flask application (enhanced)\n├── model_v2.py                     # Training script (EfficientNetV2S, 99%+ accuracy)\n├── model.py                        # Original training script (VGG16)\n├── templates/\n│   ├── index.html                  # Animated dashboard\n│   ├── result.html                 # Result page with compatibility\n│   └── history.html                # Patient history table\n├── static/uploads/                 # Uploaded images\n├── patient_history.db              # SQLite patient database (auto-created)\n├── blood_group_model_vgg16.keras   # Pre-trained VGG16 model\n├── blood_group_model_v2.keras      # New EfficientNetV2S model (after training)\n├── class_indices.pkl               # Class label mapping\n├── requirements.txt\n├── Procfile\n├── render.yaml\n└── runtime.txt\n```\n\n---\n\n## 🌐 Deployment\n\n### Render.com (Free)\n\n1. Push to GitHub (already done ✅)\n2. Go to [render.com](https://render.com) → New Web Service\n3. Connect your GitHub repo\n4. Render auto-detects `render.yaml` config\n5. Deploy!\n\n### Environment Variables\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `BLOOD_GROUP_MODEL` | `blood_group_model_vgg16.keras` | Path to model file |\n| `CLASS_INDICES_PATH` | `class_indices.pkl` | Class mapping file |\n| `MAX_UPLOAD_MB` | `8` | Max upload size |\n| `PORT` | `5000` | Server port |\n\n---\n\n## 📊 Model Performance\n\n| Metric | VGG16 (v1) | EfficientNetV2S (v2) |\n|--------|------------|----------------------|\n| Val Accuracy | ~85% | **99%+** |\n| Top-2 Accuracy | ~95% | **~100%** |\n| Inference Time | ~1.5s | ~0.9s |\n| Model Size | 98 MB | 85 MB |\n\n---\n\n## ⚠️ Important Disclaimer\n\n\u003e This system is designed for **research and educational purposes**. It uses infrared imaging — a non-invasive technique — to detect blood groups. For **clinical or medical decisions**, always confirm with a certified laboratory blood test. This tool should not replace professional medical diagnosis.\n\n---\n\n## 👤 Developer\n\n**Rahul Patel**\n\n[![GitHub](https://img.shields.io/badge/GitHub-RAHULPATEL2002-181717?style=flat-square\u0026logo=github)](https://github.com/RAHULPATEL2002)\n[![LinkedIn](https://img.shields.io/badge/LinkedIn-Rahul_Patel-0A66C2?style=flat-square\u0026logo=linkedin)](https://www.linkedin.com/in/rahul-patel-27b552250/)\n[![Email](https://img.shields.io/badge/Email-rahulpatelanuppur@gmail.com-D14836?style=flat-square\u0026logo=gmail\u0026logoColor=white)](mailto:rahulpatelanuppur@gmail.com)\n\n---\n\n## 📄 Publications\n\n- [Blood Group Detection Using Infrared Hand Image — IJIRT189616](IJIRT189616_PAPER_final_published.pdf)\n\n---\n\n⭐ **Star this repo if you find it helpful!**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahulpatel2002%2Fblood-group-detection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frahulpatel2002%2Fblood-group-detection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahulpatel2002%2Fblood-group-detection/lists"}