- Pratheek Tiruangari
- Ashruj Gautam
A cutting-edge medical diagnostic system leveraging state-of-the-art deep learning models and Large Language Models (LLM) for comprehensive patient analysis. This revolutionary platform combines medical imaging, natural language processing, and structured data analysis to deliver comprehensive medical assessments and tailored prescription recommendations.
- Base Model: DenseNet-121 pretrained on ImageNet
- Transfer Learning Process:
- Initial Training on Stanford's CheXpert dataset (224,316 chest radiographs)
- Domain adaptation using custom loss functions
- Final transfer learning on the target CheXpert small X-ray dataset
- Model Evaluation:
- After Transfer Learning:
- Accuracy: 89.5%
- F1-Score: 0.87
- AUC-ROC: 0.92
- Precision: 0.88
- Recall: 0.86
- After Transfer Learning:
-
Base Model: BioBERT pretrained on PubMed abstracts
-
Transfer Learning Pipeline:
- Initial pretraining on 2M medical documents
- Domain adaptation on 100K radiology reports
- Final transfer learning on the custom dataset
-
Architecture:
- 12 transformer layers
- 768 hidden dimensions
- 12 attention heads
- Medical vocabulary expansion: +18,000 tokens
-
Performance Evaluation:
- After Transfer Learning:
- Accuracy: 67.1%
- F1-Score: 0.87
- Precision: 0.84
- Recall: 0.91
- After Transfer Learning:
Ensemble of specialized models for critical disease detection, each trained on carefully curated datasets:
-
Architecture: Custom Gradient Boosting Classifier
-
Feature Engineering:
- 16 vital health markers optimization
- Advanced correlation analysis
- Custom feature scaling pipeline
-
Model Performance:
- Accuracy: 75.2%
- Precision: 0.73
- Recall: 0.79
- F1-Score: 0.76
- AUC-ROC: 0.83
- Architecture: Enhanced Random Forest with Custom Preprocessing
- Dataset: Chronic Kidney Disease Dataset (400 samples)
- Feature Processing:
- 24 biological markers
- Missing value imputation
- Advanced feature selection
- Model Performance:
- Accuracy: 97.5%
- Precision: 1.0
- Recall: 0.93
- F1-Score: 0.96
- AUC-ROC: 1.0
-
Architecture: Deep Neural Network
- Input Layer: 13 nodes
- Hidden Layers: [256, 128, 64] nodes
- Activation: ReLU + Batch Normalization
- Dropout: 0.3
-
Model Performance:
- Accuracy: 88.5%
- Precision: 0.83
- Recall: 0.92
- F1-Score: 0.88
- AUC-ROC: 0.97
- Model: Locally-hosted Llama2 LLM
- Integration: Custom prompt engineering for medical context
- Capabilities:
- Multi-modal result fusion
- Contextual prescription generation
- Drug interaction analysis
- Patient-specific medication adjustments
- Features:
- Considers comorbidities in prescriptions
- Real-time medication compatibility checks
- Dosage optimization based on patient conditions
- Modern PyQt5-based interface
- Drag-and-drop functionality for X-rays
- Real-time analysis feedback
- Integrated report generation
- Export capabilities for medical records
├── Image/ # Image analysis models and scripts
├── Input/ # Sample input data
├── Scripts/ # Core Python processing scripts
├── Table/ # Tabular data models
│ ├── Diabetes/
│ ├── Heart_Disease/
│ └── Kidney/
└── Text/ # Text analysis models
- Create a Python virtual environment:
python -m venv venv
.\venv\Scripts\Activate.ps1- Install dependencies:
pip install -r requirements.txt- Run the application:
python gui.pyNote: Your system is expected to have Llama 3.2 installed locally.
If not, please download it here.
-
Security:
- Never commit credentials or tokens
- Use only relative paths
- Validate all user inputs
- Properly handle errors
- Follow least privilege principle
-
Data Protection:
- Use anonymized test data only
- Keep models and checkpoints local
- Clean output files of metadata
-
Code Quality:
- Follow PEP 8 style guide
- Add proper documentation
- Include error handling
- Write unit tests
- Framework: PyTorch with CUDA acceleration
- Computing: GPU-optimized for real-time inference
- Memory Management: Efficient batch processing
- Parallelization: Multi-threaded data processing
The primary logic is implemented in run_all_models.py via the MedicalAIPipeline class. It integrates multiple AI models to perform comprehensive patient analysis and treatment recommendations.
- Inputs chest X-ray images
- Uses a DenseNet121 model with attention mechanisms
- Performs multi-label classification for 13 lung diseases
- Implementation:
train_chexagent_model.pyand related files
- Inputs radiology reports
- Uses a BERT-based model fine-tuned on clinical text
- Performs multi-label classification matching image model's outputs
- Includes a fallback keyword-matching system
- Diabetes: XGBoost model on 21 features
- Kidney Disease: Random Forest on 24 features
- Heart Disease: MLP classifier using clinical inputs
- All provide binary classification (Yes/No) with probability outputs
- Merges predictions from image and text models
- Resolves conflicts using confidence scores
- Combines heart, kidney, and diabetes results
- Builds a complete comorbidity risk profile
- Takes merged predictions from all models
- Generates structured medical prompts
- Uses a local LLaMA model for recommendations
- Considers comorbidities and contraindications
- Implements fallback systems (Ollama, GPT4All, LM Studio)
The LLM layer acts as a high-level decision-making system that:
- Integrates predictions from image, text, and tabular models
- Utilizes confidence scores to balance conflicting results
- Analyzes relations between multiple diseases
- Evaluates risks posed by comorbidities like diabetes, heart, and kidney disease
- Applies clinical logic to suggest compatible treatments
- Highlights drug contraindications based on comorbidity status
- Adjusts or recommends alternative medications accordingly
- Prioritizes treatment based on severity
- Balances multiple therapies to avoid medical conflict
- Produces a holistic treatment recommendation plan
sdf.mp4
- Transfer Learning Pipeline:
- Pre-trained on large medical datasets
- Fine-tuned on specialized conditions
- Custom loss functions for medical context
- Custom Medical Knowledge Base:
- Drug interaction database
- Disease comorbidity patterns
- Treatment protocols
- Context-Aware Processing:
- Patient history consideration
- Medication contradiction prevention
- Dynamic dosage adjustment
- Modular design for easy updates
- Parallel processing capabilities
- CPU/GPU flexible deployment
- Containerization support
- Integration with Electronic Health Records
- Mobile application development
- Cloud deployment options
- Additional disease modules
- Enhanced prescription automation
