Update README.md
Browse files
README.md
CHANGED
|
@@ -1,111 +1,111 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Medical Image Analysis Tool
|
| 3 |
-
emoji: 🏥
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: green
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: false
|
| 10 |
-
license: mit
|
| 11 |
-
---
|
| 12 |
-
|
| 13 |
-
# 🏥 Medical Image Analysis Tool
|
| 14 |
-
|
| 15 |
-
An AI-powered medical image analysis application using advanced detection models and large language models for medical image interpretation.
|
| 16 |
-
|
| 17 |
-
## Features
|
| 18 |
-
|
| 19 |
-
- **Advanced Object Detection**: Uses RF-DETR (Real-time Fine-grained Detection Transformer) for precise object detection
|
| 20 |
-
- **Medical AI Analysis**: Integrates MedGemma, a specialized medical vision-language model
|
| 21 |
-
- **Interactive Interface**: Built with Gradio for easy web-based interaction
|
| 22 |
-
- **Configurable Thresholds**: Adjustable confidence thresholds for detection sensitivity
|
| 23 |
-
- **Model Size Selection**: Choose between MedGemma 4B (faster) or 27B (more accurate) models
|
| 24 |
-
- **GPU Acceleration**: Optimized for GPU usage when available with 4-bit quantization
|
| 25 |
-
- **Automatic Model Downloads**: Models download automatically from Hugging Face Hub
|
| 26 |
-
|
| 27 |
-
## Models Used
|
| 28 |
-
|
| 29 |
-
- **RF-DETR Medium**: State-of-the-art object detection model
|
| 30 |
-
- **MedGemma 4B/27B**: Medical-specialized vision-language models for analysis and descriptions
|
| 31 |
-
- 4B model: Faster inference, lower memory usage
|
| 32 |
-
- 27B model: Higher accuracy, requires more resources
|
| 33 |
-
|
| 34 |
-
## Usage
|
| 35 |
-
|
| 36 |
-
1. **Upload Image**: Click on the image upload area or drag and drop a medical image
|
| 37 |
-
2. **Adjust Settings**:
|
| 38 |
-
- Use the confidence threshold slider to control detection sensitivity
|
| 39 |
-
- Select model size (4B for speed, 27B for accuracy)
|
| 40 |
-
3. **Analyze**: Click "Analyze Image" to run the AI analysis
|
| 41 |
-
4. **View Results**: See the annotated image with detected objects and AI-generated descriptions
|
| 42 |
-
|
| 43 |
-
## Installation & Setup
|
| 44 |
-
|
| 45 |
-
This application is designed to run on Hugging Face Spaces. The following files are required:
|
| 46 |
-
|
| 47 |
-
- `app.py` - Main application file (optimized for Spaces)
|
| 48 |
-
- `requirements.txt` - Python dependencies
|
| 49 |
-
- `packages.txt` - System packages
|
| 50 |
-
- `README.md` - This documentation
|
| 51 |
-
|
| 52 |
-
## Model Loading
|
| 53 |
-
|
| 54 |
-
**RF-DETR Model:**
|
| 55 |
-
- Upload your trained `rf-detr-medium.pth` file to the Space
|
| 56 |
-
- The application will automatically find and load it
|
| 57 |
-
|
| 58 |
-
**MedGemma Models:**
|
| 59 |
-
- Models download automatically from Hugging Face Hub on first use
|
| 60 |
-
- No manual installation required
|
| 61 |
-
- Choose between 4B (faster) or 27B (more accurate) models
|
| 62 |
-
|
| 63 |
-
## Space Configuration
|
| 64 |
-
|
| 65 |
-
For optimal performance, configure your Space settings:
|
| 66 |
-
- **Hardware**: GPU (T4 minimum, A100 recommended for 27B models)
|
| 67 |
-
- **Storage**: Enable persistent storage for model caching
|
| 68 |
-
- **Timeout**: 30+ minutes for large model downloads
|
| 69 |
-
|
| 70 |
-
## Technical Details
|
| 71 |
-
|
| 72 |
-
- **Framework**: PyTorch + Transformers
|
| 73 |
-
- **Interface**: Gradio
|
| 74 |
-
- **Computer Vision**: OpenCV, PIL, Supervision
|
| 75 |
-
- **Hardware**: Optimized for both CPU and GPU inference
|
| 76 |
-
|
| 77 |
-
## Performance Tips
|
| 78 |
-
|
| 79 |
-
- **Model Selection**: Use MedGemma 4B for faster processing or 27B for higher accuracy
|
| 80 |
-
- **Confidence Thresholds**: Higher values reduce false positives but may miss subtle findings
|
| 81 |
-
- **GPU Acceleration**: The application automatically uses GPU acceleration when available
|
| 82 |
-
- **Memory Optimization**: Uses 4-bit quantization to reduce memory usage
|
| 83 |
-
- **Model Caching**: Models are cached after first load for faster subsequent analyses
|
| 84 |
-
|
| 85 |
-
## Limitations
|
| 86 |
-
|
| 87 |
-
- Requires significant computational resources for optimal performance
|
| 88 |
-
- Best suited for medical imaging applications
|
| 89 |
-
- Results should be verified by qualified medical professionals
|
| 90 |
-
|
| 91 |
-
## Development
|
| 92 |
-
|
| 93 |
-
To run locally:
|
| 94 |
-
|
| 95 |
-
```bash
|
| 96 |
-
pip install -r requirements.txt
|
| 97 |
-
python app.py
|
| 98 |
-
```
|
| 99 |
-
|
| 100 |
-
**Note**: For local development, you'll need to:
|
| 101 |
-
1. Install the RF-DETR package or ensure it's available
|
| 102 |
-
2. Place your `rf-detr-medium.pth` file in the project directory
|
| 103 |
-
3. Models will download automatically on first run
|
| 104 |
-
|
| 105 |
-
## License
|
| 106 |
-
|
| 107 |
-
This project is for research and educational purposes. Medical applications should be developed and validated according to appropriate regulatory standards.
|
| 108 |
-
|
| 109 |
-
## Support
|
| 110 |
-
|
| 111 |
-
For issues or questions, please refer to the Hugging Face Space documentation or create an issue in the project repository.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Medical Image Analysis Tool
|
| 3 |
+
emoji: 🏥
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 5.49.1
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# 🏥 Medical Image Analysis Tool
|
| 14 |
+
|
| 15 |
+
An AI-powered medical image analysis application using advanced detection models and large language models for medical image interpretation.
|
| 16 |
+
|
| 17 |
+
## Features
|
| 18 |
+
|
| 19 |
+
- **Advanced Object Detection**: Uses RF-DETR (Real-time Fine-grained Detection Transformer) for precise object detection
|
| 20 |
+
- **Medical AI Analysis**: Integrates MedGemma, a specialized medical vision-language model
|
| 21 |
+
- **Interactive Interface**: Built with Gradio for easy web-based interaction
|
| 22 |
+
- **Configurable Thresholds**: Adjustable confidence thresholds for detection sensitivity
|
| 23 |
+
- **Model Size Selection**: Choose between MedGemma 4B (faster) or 27B (more accurate) models
|
| 24 |
+
- **GPU Acceleration**: Optimized for GPU usage when available with 4-bit quantization
|
| 25 |
+
- **Automatic Model Downloads**: Models download automatically from Hugging Face Hub
|
| 26 |
+
|
| 27 |
+
## Models Used
|
| 28 |
+
|
| 29 |
+
- **RF-DETR Medium**: State-of-the-art object detection model
|
| 30 |
+
- **MedGemma 4B/27B**: Medical-specialized vision-language models for analysis and descriptions
|
| 31 |
+
- 4B model: Faster inference, lower memory usage
|
| 32 |
+
- 27B model: Higher accuracy, requires more resources
|
| 33 |
+
|
| 34 |
+
## Usage
|
| 35 |
+
|
| 36 |
+
1. **Upload Image**: Click on the image upload area or drag and drop a medical image
|
| 37 |
+
2. **Adjust Settings**:
|
| 38 |
+
- Use the confidence threshold slider to control detection sensitivity
|
| 39 |
+
- Select model size (4B for speed, 27B for accuracy)
|
| 40 |
+
3. **Analyze**: Click "Analyze Image" to run the AI analysis
|
| 41 |
+
4. **View Results**: See the annotated image with detected objects and AI-generated descriptions
|
| 42 |
+
|
| 43 |
+
## Installation & Setup
|
| 44 |
+
|
| 45 |
+
This application is designed to run on Hugging Face Spaces. The following files are required:
|
| 46 |
+
|
| 47 |
+
- `app.py` - Main application file (optimized for Spaces)
|
| 48 |
+
- `requirements.txt` - Python dependencies
|
| 49 |
+
- `packages.txt` - System packages
|
| 50 |
+
- `README.md` - This documentation
|
| 51 |
+
|
| 52 |
+
## Model Loading
|
| 53 |
+
|
| 54 |
+
**RF-DETR Model:**
|
| 55 |
+
- Upload your trained `rf-detr-medium.pth` file to the Space
|
| 56 |
+
- The application will automatically find and load it
|
| 57 |
+
|
| 58 |
+
**MedGemma Models:**
|
| 59 |
+
- Models download automatically from Hugging Face Hub on first use
|
| 60 |
+
- No manual installation required
|
| 61 |
+
- Choose between 4B (faster) or 27B (more accurate) models
|
| 62 |
+
|
| 63 |
+
## Space Configuration
|
| 64 |
+
|
| 65 |
+
For optimal performance, configure your Space settings:
|
| 66 |
+
- **Hardware**: GPU (T4 minimum, A100 recommended for 27B models)
|
| 67 |
+
- **Storage**: Enable persistent storage for model caching
|
| 68 |
+
- **Timeout**: 30+ minutes for large model downloads
|
| 69 |
+
|
| 70 |
+
## Technical Details
|
| 71 |
+
|
| 72 |
+
- **Framework**: PyTorch + Transformers
|
| 73 |
+
- **Interface**: Gradio
|
| 74 |
+
- **Computer Vision**: OpenCV, PIL, Supervision
|
| 75 |
+
- **Hardware**: Optimized for both CPU and GPU inference
|
| 76 |
+
|
| 77 |
+
## Performance Tips
|
| 78 |
+
|
| 79 |
+
- **Model Selection**: Use MedGemma 4B for faster processing or 27B for higher accuracy
|
| 80 |
+
- **Confidence Thresholds**: Higher values reduce false positives but may miss subtle findings
|
| 81 |
+
- **GPU Acceleration**: The application automatically uses GPU acceleration when available
|
| 82 |
+
- **Memory Optimization**: Uses 4-bit quantization to reduce memory usage
|
| 83 |
+
- **Model Caching**: Models are cached after first load for faster subsequent analyses
|
| 84 |
+
|
| 85 |
+
## Limitations
|
| 86 |
+
|
| 87 |
+
- Requires significant computational resources for optimal performance
|
| 88 |
+
- Best suited for medical imaging applications
|
| 89 |
+
- Results should be verified by qualified medical professionals
|
| 90 |
+
|
| 91 |
+
## Development
|
| 92 |
+
|
| 93 |
+
To run locally:
|
| 94 |
+
|
| 95 |
+
```bash
|
| 96 |
+
pip install -r requirements.txt
|
| 97 |
+
python app.py
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
**Note**: For local development, you'll need to:
|
| 101 |
+
1. Install the RF-DETR package or ensure it's available
|
| 102 |
+
2. Place your `rf-detr-medium.pth` file in the project directory
|
| 103 |
+
3. Models will download automatically on first run
|
| 104 |
+
|
| 105 |
+
## License
|
| 106 |
+
|
| 107 |
+
This project is for research and educational purposes. Medical applications should be developed and validated according to appropriate regulatory standards.
|
| 108 |
+
|
| 109 |
+
## Support
|
| 110 |
+
|
| 111 |
+
For issues or questions, please refer to the Hugging Face Space documentation or create an issue in the project repository.
|