# aiff22/dped architecture

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

- Interactive diagram: https://gitdiagram.com/aiff22/dped
- Repository: https://github.com/aiff22/dped

## Overview

This repository implements a TensorFlow photo-enhancement workflow: train camera-specific models on paired mobile/DSLR images, then apply trained or provided checkpoints to test photos. The training and data/model internals are supported by sampled source; inference capabilities and outputs are described in the README, but test_model.py was not sampled, so its internal wiring is represented only where documented.

Main entry points: [`train_model.py`](https://github.com/aiff22/dped/blob/master/train_model.py) (Train models), [`test_model.py`](https://github.com/aiff22/dped/blob/master/test_model.py) (Enhance test photos), [`vgg.py`](https://github.com/aiff22/dped/blob/master/vgg.py) (VGG-19 features), [`load_dataset.py`](https://github.com/aiff22/dped/blob/master/load_dataset.py) (Paired data loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflows["Workflows"]
  node_train["Train models<br/>[train_model.py]"]
  node_test["Enhance test photos<br/>[test_model.py]"]
end

subgraph group_learning["Training Components"]
  node_generator["Enhancement ResNet<br/>[models.py]"]
  node_discriminator["Texture discriminator<br/>[models.py]"]
  node_vgg["VGG-19 features<br/>[vgg.py]"]
  node_metrics["Quality metrics<br/>[ssim.py]"]
  node_utils["Training and image utilities<br/>[utils.py]"]
end

subgraph group_assets["Data and Models"]
  node_loader["Paired data loader<br/>[load_dataset.py]"]
  node_dped[("DPED image pairs")]
  node_vggweights[("Pretrained VGG weights")]
  node_checkpoints[("Saved checkpoints")]
  node_provided[("Provided checkpoints")]
  node_results["Training previews"]
  node_visual["Enhanced test images"]
end

node_user(("Engineer / user"))

node_user -->|"starts training"| node_train
node_user -->|"requests enhancement"| node_test
node_train -->|"parses options"| node_utils
node_train -->|"loads batches"| node_loader
node_loader -->|"reads image pairs"| node_dped
node_train -->|"builds enhancement graph"| node_generator
node_train -->|"builds adversarial graph"| node_discriminator
node_train -->|"builds content features"| node_vgg
node_vgg -->|"loads weights"| node_vggweights
node_train -->|"evaluates SSIM"| node_metrics
node_train -->|"saves checkpoints"| node_checkpoints
node_train -->|"writes previews"| node_results
node_test -->|"uses test options"| node_utils
node_test -->|"applies enhancement model"| node_generator
node_test -->|"loads pretrained models"| node_provided
node_test -->|"loads trained models"| node_checkpoints
node_test -->|"writes enhanced photos"| node_visual

click node_train "https://github.com/aiff22/dped/blob/master/train_model.py"
click node_test "https://github.com/aiff22/dped/blob/master/test_model.py"
click node_loader "https://github.com/aiff22/dped/blob/master/load_dataset.py"
click node_dped "https://github.com/aiff22/dped/tree/master/dped"
click node_generator "https://github.com/aiff22/dped/blob/master/models.py"
click node_discriminator "https://github.com/aiff22/dped/blob/master/models.py"
click node_vgg "https://github.com/aiff22/dped/blob/master/vgg.py"
click node_vggweights "https://github.com/aiff22/dped/tree/master/vgg_pretrained"
click node_metrics "https://github.com/aiff22/dped/blob/master/ssim.py"
click node_utils "https://github.com/aiff22/dped/blob/master/utils.py"
click node_checkpoints "https://github.com/aiff22/dped/tree/master/models"
click node_provided "https://github.com/aiff22/dped/tree/master/models_orig"
click node_results "https://github.com/aiff22/dped/tree/master/results"
click node_visual "https://github.com/aiff22/dped/tree/master/visual_results"

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_train,node_test,node_user toneBlue
class node_generator,node_discriminator,node_vgg,node_metrics,node_utils toneAmber
class node_loader,node_dped,node_vggweights,node_checkpoints,node_provided,node_results,node_visual toneMint
```

## Components

### Workflows

- [Train models](https://github.com/aiff22/dped/blob/master/train_model.py): `train_model.py`
- [Enhance test photos](https://github.com/aiff22/dped/blob/master/test_model.py): `test_model.py`

### Training Components

- [Enhancement ResNet](https://github.com/aiff22/dped/blob/master/models.py): `models.py`
- [Texture discriminator](https://github.com/aiff22/dped/blob/master/models.py): `models.py`
- [VGG-19 features](https://github.com/aiff22/dped/blob/master/vgg.py): `vgg.py`
- [Quality metrics](https://github.com/aiff22/dped/blob/master/ssim.py): `ssim.py`
- [Training and image utilities](https://github.com/aiff22/dped/blob/master/utils.py): `utils.py`

### Data and Models

- [Paired data loader](https://github.com/aiff22/dped/blob/master/load_dataset.py): `load_dataset.py`
- [DPED image pairs](https://github.com/aiff22/dped/tree/master/dped): `dped`
- [Pretrained VGG weights](https://github.com/aiff22/dped/tree/master/vgg_pretrained): `vgg_pretrained`
- [Saved checkpoints](https://github.com/aiff22/dped/tree/master/models): `models`
- [Provided checkpoints](https://github.com/aiff22/dped/tree/master/models_orig): `models_orig`
- [Training previews](https://github.com/aiff22/dped/tree/master/results): `results`
- [Enhanced test images](https://github.com/aiff22/dped/tree/master/visual_results): `visual_results`

### Other components

- **Engineer / user**

## Connections

- Engineer / user → Train models: starts training
- Engineer / user → Enhance test photos: requests enhancement
- Train models → Training and image utilities: parses options
- Train models → Paired data loader: loads batches
- Paired data loader → DPED image pairs: reads image pairs
- Train models → Enhancement ResNet: builds enhancement graph
- Train models → Texture discriminator: builds adversarial graph
- Train models → VGG-19 features: builds content features
- VGG-19 features → Pretrained VGG weights: loads weights
- Train models → Quality metrics: evaluates SSIM
- Train models → Saved checkpoints: saves checkpoints
- Train models → Training previews: writes previews
- Enhance test photos → Training and image utilities: uses test options
- Enhance test photos → Enhancement ResNet: applies enhancement model
- Enhance test photos → Provided checkpoints: loads pretrained models
- Enhance test photos → Saved checkpoints: loads trained models
- Enhance test photos → Enhanced test images: writes enhanced photos
