A desktop application for analyzing diabetic wounds through image processing, segmentation, and machine learning techniques. The application provides automated wound assessment, color analysis, and generates detailed medical reports.
- Diabetic Wound Analysis Application
- Features
- Requirements
- Installation
- Technical Details
- Command Line Usage
- File Structure
- Output
- Notes
- Contributing
- Interactive GUI built with Tkinter
- Image preprocessing and wound area detection
- Wound segmentation using U-Net and DeepSkin models
- Multi-color analysis with refined color ranges
- Automated wound clustering using UMAP and ResNet50
- AI-powered wound assessment report generation
- Step-by-step analysis workflow
python >= 3.8
tkinter
PIL (Pillow)
opencv-python (cv2)
torch
transformers
numpy
scikit-learn
matplotlib
tensorflow
joblib
umap-learn
The application requires pre-trained models in the following locations:
Hackathon Official Data/Results/kmeans_model.joblib: Pre-trained K-means clustering modelHackathon Official Data/Results/umap_model.joblib: Pre-trained UMAP dimensionality reduction model- U-Net model file (
.pthformat)
- Clone the repository
- Install the required dependencies:
pip install pillow opencv-python torch transformers scikit-learn matplotlib tensorflow joblib umap-learn- Ensure you have the required model files in the correct directory structure
The application analyzes wounds using the following color ranges in HSV format:
- Red:
(0-10, 50-255, 50-255) - Dark Red:
(170-180, 50-255, 50-255) - Yellow:
(20-30, 100-255, 100-255) - Black:
(0-180, 0-255, 0-50) - Pink:
(160-170, 50-255, 50-255) - White:
(0-180, 0-30, 200-255) - Brown:
(10-20, 50-255, 50-200) - Purple:
(130-160, 50-255, 50-255)
- Light/Dark Yellow
- Light/Dark Brown
- Light/Dark Pink
- Light/Dark Purple
-
Preprocessing:
- Contour detection and cropping
- Image normalization
- ResNet50 feature extraction
-
Segmentation:
- U-Net or DeepSkin model segmentation (Download checkpoints from here)
- Mask generation and wound extraction
- Contour drawing and dilation
-
Analysis:
- Color percentage calculation
- Multi-part segmentation
- Histogram visualization
-
Classification:
- Feature extraction using ResNet50
- UMAP dimensionality reduction
- K-means clustering prediction
The application can also be run from the command line:
python test.py --model MODEL.pth --input IMAGE_PATH [OPTIONS]--model, -m: Model file path or "deepskin"--input, -i: Input image path(s)--mask-threshold, -t: Mask probability threshold (default: 0.5)--scale, -s: Input image scale factor (default: 0.5)--bilinear: Use bilinear upsampling--classes, -c: Number of classes (default: 2)
The application generates:
- Segmented wound images
- Color distribution histograms
- Multi-part segmentation visualization
- Cluster prediction
- Detailed wound assessment report
- The application uses ResNet50 for feature extraction
- UMAP is used for dimensionality reduction before clustering
- Color analysis uses HSV color space for better accuracy
- Both U-Net and DeepSkin models are supported for segmentation
Feel free to submit issues, fork the repository, and create pull requests for any improvements.