Spaces:
Running
Running
Update README.md
Browse files
README.md
CHANGED
|
@@ -8,5 +8,113 @@ sdk_version: 5.42.0
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
+
# Wound Analysis LE
|
| 12 |
+
|
| 13 |
+
## π©Ή Project Overview
|
| 14 |
+
Wound Analysis LE is an advanced medical imaging tool for automated wound assessment using deep learning. It provides:
|
| 15 |
+
- **Wound classification** (type identification)
|
| 16 |
+
- **Depth estimation** (3D wound structure)
|
| 17 |
+
- **Segmentation** (precise wound area extraction)
|
| 18 |
+
- **Severity analysis** (quantitative and AI-powered clinical assessment)
|
| 19 |
+
|
| 20 |
+
The system is built for research and educational purposes, integrating state-of-the-art computer vision models and a user-friendly Gradio interface.
|
| 21 |
+
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
## π Features & Workflow
|
| 25 |
+
1. **Wound Classification**: Identifies wound type using a vision transformer model.
|
| 26 |
+
2. **Depth Estimation**: Generates depth maps and 3D visualizations from 2D images using DepthAnythingV2 (DINOv2 + DPT).
|
| 27 |
+
3. **Segmentation**: Extracts wound regions using deep learning models (Deeplabv3+, FCN, SegNet, Unet).
|
| 28 |
+
4. **Severity Analysis**: Computes wound area, depth, volume, and provides AI-powered medical assessment (Gemini AI integration).
|
| 29 |
+
5. **Interactive Gradio App**: Step-by-step workflow with visualization, overlays, and downloadable results.
|
| 30 |
+
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
## ποΈ Model Architecture
|
| 34 |
+
### Segmentation Models
|
| 35 |
+
- **Deeplabv3+**: Encoder-decoder with atrous convolutions for semantic segmentation.
|
| 36 |
+
- **FCN (VGG16-16s)**: Fully convolutional network for pixel-wise segmentation.
|
| 37 |
+
- **SegNet**: Encoder-decoder architecture for efficient segmentation.
|
| 38 |
+
- **Unet (multiple variants)**: U-shaped architecture for biomedical image segmentation.
|
| 39 |
+
|
| 40 |
+
### Depth Estimation
|
| 41 |
+
- **DepthAnythingV2**: Combines DINOv2 vision transformer backbone with DPT head for monocular depth prediction.
|
| 42 |
+
- **DINOv2**: Self-supervised vision transformer for feature extraction.
|
| 43 |
+
- **DPT**: Dense Prediction Transformer for pixel-wise depth estimation.
|
| 44 |
+
|
| 45 |
+
### Classification
|
| 46 |
+
- **Vision Transformer (ViT)**: Used for wound type classification (via HuggingFace Transformers).
|
| 47 |
+
|
| 48 |
+
---
|
| 49 |
+
|
| 50 |
+
## π οΈ Installation & Requirements
|
| 51 |
+
1. **Clone the repository**
|
| 52 |
+
```bash
|
| 53 |
+
git clone <repo-url>
|
| 54 |
+
cd Wound-Analysis-LE
|
| 55 |
+
```
|
| 56 |
+
2. **Install dependencies**
|
| 57 |
+
```bash
|
| 58 |
+
pip install -r requirements.txt
|
| 59 |
+
```
|
| 60 |
+
- Key dependencies: `gradio`, `torch`, `tensorflow`, `opencv-python`, `transformers`, `open3d`, `plotly`, `google-generativeai`, etc.
|
| 61 |
+
3. **Download model weights**
|
| 62 |
+
- The app will auto-download required weights (e.g., DINOv2, segmentation models) on first run if not present.
|
| 63 |
+
|
| 64 |
+
---
|
| 65 |
+
|
| 66 |
+
## π» Usage Instructions
|
| 67 |
+
### Run the Gradio App
|
| 68 |
+
```bash
|
| 69 |
+
python app.py
|
| 70 |
+
```
|
| 71 |
+
- Access the app at: [http://localhost:7860](http://localhost:7860)
|
| 72 |
+
|
| 73 |
+
### Segmentation Tool (Standalone)
|
| 74 |
+
```bash
|
| 75 |
+
python temp_files/segmentation_app.py
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
### Workflow
|
| 79 |
+
1. **Upload a wound image**
|
| 80 |
+
2. **Classify**: Get wound type and initial AI analysis
|
| 81 |
+
3. **Depth Estimation**: Generate depth map and 3D visualization
|
| 82 |
+
4. **Segmentation**: Auto-segment wound area
|
| 83 |
+
5. **Severity Analysis**: Quantitative and AI-powered report
|
| 84 |
+
6. **Download**: Export masks, overlays, and 3D data
|
| 85 |
+
|
| 86 |
+
---
|
| 87 |
+
|
| 88 |
+
## π Training & Evaluation
|
| 89 |
+
- **Training scripts**: See `temp_files/train.py`
|
| 90 |
+
- **Metrics**: Dice coefficient, precision, recall, loss (see `utils/learning/metrics.py`)
|
| 91 |
+
- **Results**: Training history and model checkpoints in `training_history/`
|
| 92 |
+
- Example: Dice coefficient > 0.98 on training set (see `2025-08-07_16-25-27.json`)
|
| 93 |
+
|
| 94 |
+
---
|
| 95 |
+
|
| 96 |
+
## π Code Structure
|
| 97 |
+
- `app.py` β Main Gradio app (classification, depth, segmentation, severity)
|
| 98 |
+
- `models/` β Segmentation model definitions (Deeplab, FCN, SegNet, Unet)
|
| 99 |
+
- `depth_anything_v2/` β Depth estimation (DINOv2, DPT, utility layers)
|
| 100 |
+
- `utils/` β Data loading, augmentation, metrics, postprocessing
|
| 101 |
+
- `temp_files/` β Standalone scripts, experiments, and legacy tools
|
| 102 |
+
- `training_history/` β Model checkpoints and training logs
|
| 103 |
+
|
| 104 |
+
---
|
| 105 |
+
|
| 106 |
+
## π References
|
| 107 |
+
- [Deeplabv3+ Paper](https://arxiv.org/pdf/1802.02611.pdf)
|
| 108 |
+
- [DINOv2 (Meta AI)](https://github.com/facebookresearch/dinov2)
|
| 109 |
+
- [DPT: Vision Transformers for Dense Prediction](https://arxiv.org/abs/2103.13413)
|
| 110 |
+
- [HuggingFace Transformers](https://huggingface.co/docs/transformers/index)
|
| 111 |
+
- [Gradio](https://gradio.app/)
|
| 112 |
+
- [Open3D](http://www.open3d.org/)
|
| 113 |
+
- [Augmentor](https://github.com/mdbloice/Augmentor)
|
| 114 |
+
- Datasets: Custom wound datasets (not included)
|
| 115 |
+
|
| 116 |
+
---
|
| 117 |
+
|
| 118 |
+
## β οΈ Disclaimer
|
| 119 |
+
This tool is for research and educational purposes only. It does **not** provide medical advice or diagnosis. Always consult a medical professional for clinical decisions.
|
| 120 |
|
|
|