AI-powered chest X-ray analysis for diagnostic decision support
This system is for educational and research purposes only. It is NOT a substitute for professional medical diagnosis or treatment. All AI-generated analyses require review by qualified healthcare professionals.
Diagnostic AI Copilot analyzes chest X-rays using deep learning and provides:
- 14 Pathology Detection: Pneumonia, Pneumothorax, Cardiomegaly, Effusion, and more
- Visual Explainability: Grad-CAM heatmaps showing exactly where AI focuses
- Auto-Generated Reports: Structured radiology report drafts
- Uncertainty Quantification: Confidence scores with uncertainty estimates
- DICOM Support: Works with medical imaging formats
- Python 3.11+
- Node.js 18+
- Docker (optional)
cd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run the server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000cd frontend
# Install dependencies
npm install
# Run development server
npm run dev# Build and run all services
docker-compose up --build
# Access the app at http://localhost:3000
# API docs at http://localhost:8000/docsdiagnostic-copilot/
βββ backend/ # FastAPI backend
β βββ app/
β β βββ ml/ # ML models (DenseNet121, Grad-CAM)
β β βββ routers/ # API endpoints
β β βββ schemas/ # Pydantic models
β β βββ utils/ # Report generation, DICOM
β βββ data/
β βββ models/ # Model weights
β
βββ frontend/ # Next.js frontend
β βββ src/
β β βββ app/ # Pages
β β βββ components/ # React components
β β βββ lib/ # API client
β
βββ docker-compose.yml # Container orchestration
- Base Model: DenseNet121 pre-trained on ImageNet
- Fine-tuning: ChestX-ray14 dataset (112,120 images)
- Output: Multi-label classification (14 pathologies)
- Explainability: Grad-CAM attention maps
| Condition | Severity |
|---|---|
| Pneumothorax | π΄ Severe |
| Mass | π΄ Severe |
| Pneumonia | π‘ Moderate |
| Cardiomegaly | π‘ Moderate |
| Effusion | π‘ Moderate |
| Edema | π‘ Moderate |
| Consolidation | π‘ Moderate |
| Nodule | π‘ Moderate |
| Atelectasis | π’ Mild |
| Infiltration | π’ Mild |
| Emphysema | π’ Mild |
| Fibrosis | π’ Mild |
| Pleural Thickening | π’ Mild |
| Hernia | π’ Mild |
POST /api/v1/analysis
Content-Type: multipart/form-data
# Parameters
- file: Image file (JPEG, PNG, DICOM)
- patient_age: Optional patient age
- patient_sex: Optional patient sex (M/F)
- clinical_history: Optional clinical notes
- generate_heatmaps: Generate Grad-CAM (default: true)GET /api/v1/analysis/{analysis_id}/reportGET /healthFull API documentation available at /docs (Swagger UI).
- Medical Disclaimers: Every output includes clear disclaimers
- Uncertainty Quantification: Monte Carlo Dropout for confidence intervals
- Physician Review Required: Explicit flags for human oversight
- Audit Logging: Track all predictions for compliance
- Input Validation: Check image quality before analysis
| Metric | Value |
|---|---|
| Inference Time | ~2-3 seconds (CPU) |
| Model Size | ~30MB |
| Supported Formats | JPEG, PNG, DICOM |
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing) - Open a Pull Request
MIT License - see LICENSE for details.
- NIH ChestX-ray14 Dataset
- Stanford CheXpert Dataset
- PyTorch and torchvision teams
- FastAPI and Next.js communities
Built with β€οΈ for improving healthcare through AI
