Spaces:
Sleeping
Sleeping
| title: Wound Analysis V2 | |
| emoji: π’ | |
| colorFrom: yellow | |
| colorTo: pink | |
| sdk: gradio | |
| sdk_version: 5.42.0 | |
| app_file: app.py | |
| pinned: false | |
| # Wound Analysis LE | |
| ## π©Ή Project Overview | |
| Wound Analysis LE is an advanced medical imaging tool for automated wound assessment using deep learning. It provides: | |
| - **Wound classification** (type identification) | |
| - **Depth estimation** (3D wound structure) | |
| - **Segmentation** (precise wound area extraction) | |
| - **Severity analysis** (quantitative and AI-powered clinical assessment) | |
| The system is built for research and educational purposes, integrating state-of-the-art computer vision models and a user-friendly Gradio interface. | |
| --- | |
| ## π Features & Workflow | |
| 1. **Wound Classification**: Identifies wound type using a vision transformer model. | |
| 2. **Depth Estimation**: Generates depth maps and 3D visualizations from 2D images using DepthAnythingV2 (DINOv2 + DPT). | |
| 3. **Segmentation**: Extracts wound regions using deep learning models (Deeplabv3+, FCN, SegNet, Unet). | |
| 4. **Severity Analysis**: Computes wound area, depth, volume, and provides AI-powered medical assessment (Gemini AI integration). | |
| 5. **Interactive Gradio App**: Step-by-step workflow with visualization, overlays, and downloadable results. | |
| --- | |
| ## ποΈ Model Architecture | |
| ### Segmentation Models | |
| - **Deeplabv3+**: Encoder-decoder with atrous convolutions for semantic segmentation. | |
| - **FCN (VGG16-16s)**: Fully convolutional network for pixel-wise segmentation. | |
| - **SegNet**: Encoder-decoder architecture for efficient segmentation. | |
| - **Unet (multiple variants)**: U-shaped architecture for biomedical image segmentation. | |
| ### Depth Estimation | |
| - **DepthAnythingV2**: Combines DINOv2 vision transformer backbone with DPT head for monocular depth prediction. | |
| - **DINOv2**: Self-supervised vision transformer for feature extraction. | |
| - **DPT**: Dense Prediction Transformer for pixel-wise depth estimation. | |
| ### Classification | |
| - **Vision Transformer (ViT)**: Used for wound type classification (via HuggingFace Transformers). | |
| --- | |
| ## π οΈ Installation & Requirements | |
| 1. **Clone the repository** | |
| ```bash | |
| git clone <repo-url> | |
| cd Wound-Analysis-LE | |
| ``` | |
| 2. **Install dependencies** | |
| ```bash | |
| pip install -r requirements.txt | |
| ``` | |
| - Key dependencies: `gradio`, `torch`, `tensorflow`, `opencv-python`, `transformers`, `open3d`, `plotly`, `google-generativeai`, etc. | |
| 3. **Download model weights** | |
| - The app will auto-download required weights (e.g., DINOv2, segmentation models) on first run if not present. | |
| --- | |
| ## π» Usage Instructions | |
| ### Run the Gradio App | |
| ```bash | |
| python app.py | |
| ``` | |
| - Access the app at: [http://localhost:7860](http://localhost:7860) | |
| ### Segmentation Tool (Standalone) | |
| ```bash | |
| python temp_files/segmentation_app.py | |
| ``` | |
| ### Workflow | |
| 1. **Upload a wound image** | |
| 2. **Classify**: Get wound type and initial AI analysis | |
| 3. **Depth Estimation**: Generate depth map and 3D visualization | |
| 4. **Segmentation**: Auto-segment wound area | |
| 5. **Severity Analysis**: Quantitative and AI-powered report | |
| 6. **Download**: Export masks, overlays, and 3D data | |
| --- | |
| ## π Training & Evaluation | |
| - **Training scripts**: See `temp_files/train.py` | |
| - **Metrics**: Dice coefficient, precision, recall, loss (see `utils/learning/metrics.py`) | |
| - **Results**: Training history and model checkpoints in `training_history/` | |
| - Example: Dice coefficient > 0.98 on training set (see `2025-08-07_16-25-27.json`) | |
| --- | |
| ## π Code Structure | |
| - `app.py` β Main Gradio app (classification, depth, segmentation, severity) | |
| - `models/` β Segmentation model definitions (Deeplab, FCN, SegNet, Unet) | |
| - `depth_anything_v2/` β Depth estimation (DINOv2, DPT, utility layers) | |
| - `utils/` β Data loading, augmentation, metrics, postprocessing | |
| - `temp_files/` β Standalone scripts, experiments, and legacy tools | |
| - `training_history/` β Model checkpoints and training logs | |
| --- | |
| ## π References | |
| - [Deeplabv3+ Paper](https://arxiv.org/pdf/1802.02611.pdf) | |
| - [DINOv2 (Meta AI)](https://github.com/facebookresearch/dinov2) | |
| - [DPT: Vision Transformers for Dense Prediction](https://arxiv.org/abs/2103.13413) | |
| - [HuggingFace Transformers](https://huggingface.co/docs/transformers/index) | |
| - [Gradio](https://gradio.app/) | |
| - [Open3D](http://www.open3d.org/) | |
| - [Augmentor](https://github.com/mdbloice/Augmentor) | |
| - Datasets: Custom wound datasets (not included) | |
| --- | |
| ## β οΈ Disclaimer | |
| 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. | |