# 2kdietga/computer-vision architecture

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

- Interactive diagram: https://gitdiagram.com/2kdietga/computer-vision
- Repository: https://github.com/2kdietga/computer-vision

## Overview

This is a Django image-segmentation web app. A visitor submits a supported image; the view validates and normalizes it, invokes CPU inference, then renders the original, binary mask, blended overlay, and predicted area percentage. Inference loads a configured checkpoint and runs the U-Net model. The excerpts show the request path and prediction flow, but not the template contents or unsampled deployment wiring; the checkpoint is represented as an external artifact.

Main entry points: [`segmentation/inference.py`](https://github.com/2kdietga/computer-vision/blob/main/segmentation/inference.py) (Image inference), [`segmentation/views.py`](https://github.com/2kdietga/computer-vision/blob/main/segmentation/views.py) (Upload view), [`config/urls.py`](https://github.com/2kdietga/computer-vision/blob/main/config/urls.py) (URL routing), [`segmentation/templates/segmentation/index.html`](https://github.com/2kdietga/computer-vision/blob/main/segmentation/templates/segmentation/index.html) (Result page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web request"]
  node_urls["URL routing<br/>[urls.py]"]
  node_view["Upload view<br/>[views.py]"]
  node_template["Result page<br/>[index.html]"]
end

subgraph group_prediction["Prediction"]
  node_inference["Image inference<br/>[inference.py]"]
  node_unet["U-Net model<br/>[network.py]"]
  node_checkpoint["Model checkpoint"]
end

subgraph group_configuration["Configuration"]
  node_settings["App settings<br/>[settings.py]"]
end

node_visitor(("Visitor"))

node_visitor -->|"requests page"| node_urls
node_urls -->|"routes to"| node_view
node_view -->|"calls prediction"| node_inference
node_inference -->|"runs model"| node_unet
node_inference -->|"reads model path"| node_settings
node_inference -->|"loads weights"| node_checkpoint
node_view -->|"renders results"| node_template

click node_urls "https://github.com/2kdietga/computer-vision/blob/main/config/urls.py"
click node_view "https://github.com/2kdietga/computer-vision/blob/main/segmentation/views.py"
click node_template "https://github.com/2kdietga/computer-vision/blob/main/segmentation/templates/segmentation/index.html"
click node_inference "https://github.com/2kdietga/computer-vision/blob/main/segmentation/inference.py"
click node_unet "https://github.com/2kdietga/computer-vision/blob/main/segmentation/network.py"
click node_settings "https://github.com/2kdietga/computer-vision/blob/main/config/settings.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_urls,node_view,node_template toneBlue
class node_inference,node_unet,node_checkpoint toneAmber
class node_settings toneMint
class node_visitor toneIndigo
```

## Components

### Web request

- [URL routing](https://github.com/2kdietga/computer-vision/blob/main/config/urls.py): `config/urls.py`
- [Upload view](https://github.com/2kdietga/computer-vision/blob/main/segmentation/views.py): `segmentation/views.py`
- [Result page](https://github.com/2kdietga/computer-vision/blob/main/segmentation/templates/segmentation/index.html): `segmentation/templates/segmentation/index.html`

### Prediction

- [Image inference](https://github.com/2kdietga/computer-vision/blob/main/segmentation/inference.py): `segmentation/inference.py`
- [U-Net model](https://github.com/2kdietga/computer-vision/blob/main/segmentation/network.py): `segmentation/network.py`
- **Model checkpoint**

### Configuration

- [App settings](https://github.com/2kdietga/computer-vision/blob/main/config/settings.py): `config/settings.py`

### Other components

- **Visitor**

## Connections

- Visitor → URL routing: requests page (evidence: `config/urls.py`)
- URL routing → Upload view: routes to (evidence: `config/urls.py`)
- Upload view → Image inference: calls prediction (evidence: `segmentation/views.py`)
- Image inference → U-Net model: runs model (evidence: `segmentation/inference.py`)
- Image inference → App settings: reads model path (evidence: `segmentation/inference.py`)
- Image inference → Model checkpoint: loads weights (evidence: `segmentation/inference.py`)
- Upload view → Result page: renders results (evidence: `segmentation/views.py`)
