# theonlysg/super-resolution-model architecture

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

- Interactive diagram: https://gitdiagram.com/theonlysg/super-resolution-model
- Repository: https://github.com/theonlysg/super-resolution-model

## Overview

Beyond Resolutions is a web workstation for 4× multispectral satellite-image super-resolution, land-cover analysis, and reference-based quality validation. The main workflow uploads an image, runs RCAN inference, presents a preview and downloadable output, then optionally segments the SR image or compares it with an uploaded high-resolution reference. The backend also preserves a scientific SR tensor for validation. Frontend-to-API wiring is not visible in the excerpts, so those links are marked unverified; unsampled route details are not expanded.

Main entry points: [`backend/main.py`](https://github.com/theonlysg/super-resolution-model/blob/geotiff/backend/main.py) (HTTP API), [`backend/inference.py`](https://github.com/theonlysg/super-resolution-model/blob/geotiff/backend/inference.py) (SR inference), [`backend/validation.py`](https://github.com/theonlysg/super-resolution-model/blob/geotiff/backend/validation.py) (Validation engine), [`frontend/app.js`](https://github.com/theonlysg/super-resolution-model/blob/geotiff/frontend/app.js) (SR workstation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Web interface"]
  node_sr_ui["SR workstation<br/>[app.js]"]
  node_validation_ui["Validation viewer<br/>[validation.js]"]
end

subgraph group_backend["Inference service"]
  node_api["HTTP API<br/>[main.py]"]
  node_image_io["Image loading<br/>[image_utils.py]"]
  node_sr_pipeline["SR inference<br/>[inference.py]"]
end

subgraph group_analysis["Scientific analysis"]
  node_seg_loader["SegFormer loader<br/>[seg_model.py]"]
  node_seg_config["Segmentation config<br/>[config.py]"]
  node_seg_pipeline["Land-cover analysis<br/>[inference.py]"]
  node_validation["Validation engine<br/>[validation.py]"]
end

subgraph group_storage["Models and artifacts"]
  node_rcan["RCAN networks<br/>[model.py]"]
  node_sr_artifacts[("SR outputs<br/>[inference.py]")]
end

node_user(("User"))
node_hr_reference["HR reference"]

node_user -->|"uploads image"| node_sr_ui
node_sr_ui -.->|"requests inference"| node_api
node_api -->|"runs inference"| node_sr_pipeline
node_sr_pipeline -->|"runs network"| node_rcan
node_sr_pipeline -->|"loads images"| node_image_io
node_sr_pipeline -->|"saves SR data"| node_sr_artifacts
node_api -->|"loads model"| node_seg_loader
node_seg_loader -->|"uses model path"| node_seg_config
node_api -->|"runs segmentation"| node_seg_pipeline
node_api -->|"runs validation"| node_validation
node_validation -->|"reads SR tensor"| node_sr_artifacts
node_validation -->|"stretches preview"| node_image_io
node_user -->|"opens validation"| node_validation_ui
node_validation_ui -.->|"submits reference"| node_api
node_user -->|"provides reference"| node_hr_reference
node_hr_reference -.->|"uploads reference"| node_api

click node_sr_ui "https://github.com/theonlysg/super-resolution-model/blob/geotiff/frontend/app.js"
click node_validation_ui "https://github.com/theonlysg/super-resolution-model/blob/geotiff/frontend/validation.js"
click node_api "https://github.com/theonlysg/super-resolution-model/blob/geotiff/backend/main.py"
click node_image_io "https://github.com/theonlysg/super-resolution-model/blob/geotiff/backend/image_utils.py"
click node_sr_pipeline "https://github.com/theonlysg/super-resolution-model/blob/geotiff/backend/inference.py"
click node_rcan "https://github.com/theonlysg/super-resolution-model/blob/geotiff/backend/model.py"
click node_sr_artifacts "https://github.com/theonlysg/super-resolution-model/blob/geotiff/backend/inference.py"
click node_seg_loader "https://github.com/theonlysg/super-resolution-model/blob/geotiff/model/segmentation/seg_model.py"
click node_seg_config "https://github.com/theonlysg/super-resolution-model/blob/geotiff/model/segmentation/config.py"
click node_seg_pipeline "https://github.com/theonlysg/super-resolution-model/blob/geotiff/model/segmentation/inference.py"
click node_validation "https://github.com/theonlysg/super-resolution-model/blob/geotiff/backend/validation.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_sr_ui,node_validation_ui,node_user toneBlue
class node_api,node_image_io,node_sr_pipeline toneAmber
class node_seg_loader,node_seg_config,node_seg_pipeline,node_validation toneMint
class node_rcan,node_sr_artifacts toneRose
class node_hr_reference toneIndigo
```

## Components

### Web interface

- [SR workstation](https://github.com/theonlysg/super-resolution-model/blob/geotiff/frontend/app.js): `frontend/app.js`
- [Validation viewer](https://github.com/theonlysg/super-resolution-model/blob/geotiff/frontend/validation.js): `frontend/validation.js`

### Inference service

- [HTTP API](https://github.com/theonlysg/super-resolution-model/blob/geotiff/backend/main.py): `backend/main.py`
- [Image loading](https://github.com/theonlysg/super-resolution-model/blob/geotiff/backend/image_utils.py): `backend/image_utils.py`
- [SR inference](https://github.com/theonlysg/super-resolution-model/blob/geotiff/backend/inference.py): `backend/inference.py`

### Scientific analysis

- [SegFormer loader](https://github.com/theonlysg/super-resolution-model/blob/geotiff/model/segmentation/seg_model.py): `model/segmentation/seg_model.py`
- [Segmentation config](https://github.com/theonlysg/super-resolution-model/blob/geotiff/model/segmentation/config.py): `model/segmentation/config.py`
- [Land-cover analysis](https://github.com/theonlysg/super-resolution-model/blob/geotiff/model/segmentation/inference.py): `model/segmentation/inference.py`
- [Validation engine](https://github.com/theonlysg/super-resolution-model/blob/geotiff/backend/validation.py): `backend/validation.py`

### Models and artifacts

- [RCAN networks](https://github.com/theonlysg/super-resolution-model/blob/geotiff/backend/model.py): `backend/model.py`
- [SR outputs](https://github.com/theonlysg/super-resolution-model/blob/geotiff/backend/inference.py): `backend/inference.py`

### Other components

- **User**
- **HR reference**

## Connections

- User → SR workstation: uploads image (evidence: `README.md`)
- SR workstation → HTTP API: requests inference
- HTTP API → SR inference: runs inference (evidence: `backend/main.py`)
- SR inference → RCAN networks: runs network (evidence: `backend/inference.py`)
- SR inference → Image loading: loads images (evidence: `backend/inference.py`)
- SR inference → SR outputs: saves SR data (evidence: `backend/inference.py`)
- HTTP API → SegFormer loader: loads model (evidence: `backend/main.py`)
- SegFormer loader → Segmentation config: uses model path (evidence: `model/segmentation/seg_model.py`)
- HTTP API → Land-cover analysis: runs segmentation (evidence: `backend/main.py`)
- HTTP API → Validation engine: runs validation (evidence: `backend/main.py`)
- Validation engine → SR outputs: reads SR tensor (evidence: `backend/validation.py`)
- Validation engine → Image loading: stretches preview (evidence: `backend/validation.py`)
- User → Validation viewer: opens validation (evidence: `README.md`)
- Validation viewer → HTTP API: submits reference
- User → HR reference: provides reference (evidence: `README.md`)
- HR reference → HTTP API: uploads reference
