# srikanth903/skin-disease-detection architecture

> Architecture diagram of the GitHub repository srikanth903/skin-disease-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/srikanth903/skin-disease-detection
- Repository: https://github.com/srikanth903/skin-disease-detection

## Overview

This repository trains and evaluates a MobileNetV2 skin-lesion classifier, and also provides image-inference interfaces with confidence, explainability, and guidance. The main user workflow is image upload or selection → preprocessing and classification → prediction details and optional Grad-CAM or decision support. Training and evaluation form a separate model-development branch: dataset loaders feed training, while evaluation reports classification metrics. A demo adds optional lesion segmentation. Connections are limited to calls visible in excerpts, SOURCE INDEX references, or README statements; unsampled implementation details are not inferred.

Main entry points: [`pipeline.py`](https://github.com/srikanth903/skin-disease-detection/blob/main/pipeline.py) (Decision pipeline), [`models.py`](https://github.com/srikanth903/skin-disease-detection/blob/main/models.py) (MobileNetV2 factory), [`train.py`](https://github.com/srikanth903/skin-disease-detection/blob/main/train.py) (Model training), [`inference.py`](https://github.com/srikanth903/skin-disease-detection/blob/main/inference.py) (Image inference)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_app["Gradio app<br/>[app.py]"]
  node_simple_app["Simple Gradio app<br/>[app_simple.py]"]
  node_demo["Workflow demos<br/>[demo.py]"]
end

subgraph group_inference["Inference and guidance"]
  node_inference_script["Image inference<br/>[inference.py]"]
  node_pipeline["Decision pipeline<br/>[pipeline.py]"]
  node_suggestions["Risk guidance<br/>[suggestions.py]"]
end

subgraph group_development["Model development"]
  node_model["MobileNetV2 factory<br/>[models.py]"]
  node_datasets["Dataset loaders<br/>[datasets.py]"]
  node_training["Model training<br/>[train.py]"]
  node_training_utils["Training utilities<br/>[utils.py]"]
  node_evaluation["Model evaluation<br/>[evaluate.py]"]
end

subgraph group_analysis["Explainability and segmentation"]
  node_gradcam["Grad-CAM<br/>[xai.py]"]
  node_segmentation["Lesion segmentation<br/>[segmentation.py]"]
end

node_user(("Image user"))

node_user -->|"uploads image"| node_app
node_user -->|"uploads image"| node_simple_app
node_app -->|"requests inference"| node_inference_script
node_simple_app -->|"requests inference"| node_inference_script
node_inference_script -->|"creates model"| node_model
node_pipeline -->|"loads model"| node_model
node_pipeline -->|"generates heatmap"| node_gradcam
node_pipeline -->|"gets guidance"| node_suggestions
node_training -->|"loads data"| node_datasets
node_training -->|"builds model"| node_model
node_training -->|"uses utilities"| node_training_utils
node_evaluation -->|"loads data"| node_datasets
node_evaluation -->|"loads model"| node_model
node_demo -->|"runs inference"| node_pipeline
node_demo -->|"generates mask"| node_segmentation

click node_app "https://github.com/srikanth903/skin-disease-detection/blob/main/app.py"
click node_simple_app "https://github.com/srikanth903/skin-disease-detection/blob/main/app_simple.py"
click node_inference_script "https://github.com/srikanth903/skin-disease-detection/blob/main/inference.py"
click node_pipeline "https://github.com/srikanth903/skin-disease-detection/blob/main/pipeline.py"
click node_suggestions "https://github.com/srikanth903/skin-disease-detection/blob/main/suggestions.py"
click node_model "https://github.com/srikanth903/skin-disease-detection/blob/main/models.py"
click node_datasets "https://github.com/srikanth903/skin-disease-detection/blob/main/datasets.py"
click node_training "https://github.com/srikanth903/skin-disease-detection/blob/main/train.py"
click node_training_utils "https://github.com/srikanth903/skin-disease-detection/blob/main/utils.py"
click node_evaluation "https://github.com/srikanth903/skin-disease-detection/blob/main/evaluate.py"
click node_gradcam "https://github.com/srikanth903/skin-disease-detection/blob/main/xai.py"
click node_segmentation "https://github.com/srikanth903/skin-disease-detection/blob/main/segmentation.py"
click node_demo "https://github.com/srikanth903/skin-disease-detection/blob/main/demo.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_simple_app,node_demo,node_user toneBlue
class node_inference_script,node_pipeline,node_suggestions toneAmber
class node_model,node_datasets,node_training,node_training_utils,node_evaluation toneMint
class node_gradcam,node_segmentation toneRose
```

## Components

### User interfaces

- [Gradio app](https://github.com/srikanth903/skin-disease-detection/blob/main/app.py): `app.py`
- [Simple Gradio app](https://github.com/srikanth903/skin-disease-detection/blob/main/app_simple.py): `app_simple.py`
- [Workflow demos](https://github.com/srikanth903/skin-disease-detection/blob/main/demo.py): `demo.py`

### Inference and guidance

- [Image inference](https://github.com/srikanth903/skin-disease-detection/blob/main/inference.py): `inference.py`
- [Decision pipeline](https://github.com/srikanth903/skin-disease-detection/blob/main/pipeline.py): `pipeline.py`
- [Risk guidance](https://github.com/srikanth903/skin-disease-detection/blob/main/suggestions.py): `suggestions.py`

### Model development

- [MobileNetV2 factory](https://github.com/srikanth903/skin-disease-detection/blob/main/models.py): `models.py`
- [Dataset loaders](https://github.com/srikanth903/skin-disease-detection/blob/main/datasets.py): `datasets.py`
- [Model training](https://github.com/srikanth903/skin-disease-detection/blob/main/train.py): `train.py`
- [Training utilities](https://github.com/srikanth903/skin-disease-detection/blob/main/utils.py): `utils.py`
- [Model evaluation](https://github.com/srikanth903/skin-disease-detection/blob/main/evaluate.py): `evaluate.py`

### Explainability and segmentation

- [Grad-CAM](https://github.com/srikanth903/skin-disease-detection/blob/main/xai.py): `xai.py`
- [Lesion segmentation](https://github.com/srikanth903/skin-disease-detection/blob/main/segmentation.py): `segmentation.py`

### Other components

- **Image user**

## Connections

- Image user → Gradio app: uploads image (evidence: `app.py`)
- Image user → Simple Gradio app: uploads image (evidence: `app_simple.py`)
- Gradio app → Image inference: requests inference (evidence: `app.py`)
- Simple Gradio app → Image inference: requests inference (evidence: `app_simple.py`)
- Image inference → MobileNetV2 factory: creates model (evidence: `inference.py`)
- Decision pipeline → MobileNetV2 factory: loads model (evidence: `pipeline.py`)
- Decision pipeline → Grad-CAM: generates heatmap (evidence: `pipeline.py`)
- Decision pipeline → Risk guidance: gets guidance (evidence: `pipeline.py`)
- Model training → Dataset loaders: loads data (evidence: `train.py`)
- Model training → MobileNetV2 factory: builds model (evidence: `train.py`)
- Model training → Training utilities: uses utilities (evidence: `train.py`)
- Model evaluation → Dataset loaders: loads data (evidence: `evaluate.py`)
- Model evaluation → MobileNetV2 factory: loads model (evidence: `evaluate.py`)
- Workflow demos → Decision pipeline: runs inference (evidence: `demo.py`)
- Workflow demos → Lesion segmentation: generates mask (evidence: `demo.py`)
