# cameronfabbri/underwater-color-correction architecture

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

- Interactive diagram: https://gitdiagram.com/cameronfabbri/underwater-color-correction
- Repository: https://github.com/cameronfabbri/underwater-color-correction

## Overview

UGAN trains an image-to-image model to correct underwater color: paired distorted/clean images feed a selected generator and discriminator, and inference produces corrected images. A separate CycleGAN workflow generates underwater-style training imagery from clean photos; the repository also provides image, folder, underwater-specific, video, and latent-embedding workflows. Edges follow the excerpts, SOURCE INDEX references, or README; unsampled wiring is omitted where it cannot be verified.

Main entry points: [`ops/tf_ops.py`](https://github.com/cameronfabbri/underwater-color-correction/blob/master/ops/tf_ops.py) (TensorFlow operations), [`train.py`](https://github.com/cameronfabbri/underwater-color-correction/blob/master/train.py) (Correction trainer), [`ops/data_ops.py`](https://github.com/cameronfabbri/underwater-color-correction/blob/master/ops/data_ops.py) (Dataset and color ops), [`eval_one.py`](https://github.com/cameronfabbri/underwater-color-correction/blob/master/eval_one.py) (Single-image evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_cycle_utils["CycleGAN image utilities<br/>[utils.py]"]
  node_dataset_ops["Dataset and color ops<br/>[data_ops.py]"]
end

subgraph group_models["Model training"]
  node_cycle_entry["CycleGAN runner<br/>[main.py]"]
  node_cycle_model["CycleGAN model<br/>[model.py]"]
  node_cycle_networks["CycleGAN networks<br/>[module.py]"]
  node_cycle_ops["CycleGAN operations<br/>[ops.py]"]
  node_ugan_train["Correction trainer<br/>[train.py]"]
  node_tf_ops["TensorFlow operations<br/>[tf_ops.py]"]
  node_pix2pix["Pix2pix generator<br/>[pix2pix.py]"]
  node_pix2pix_new["Alternate Pix2pix<br/>[pix2pix_new.py]"]
  node_resnet["ResNet generator<br/>[resnet.py]"]
end

subgraph group_inference["Image inference"]
  node_eval_single["Single-image evaluation<br/>[eval_one.py]"]
  node_eval_images["Image evaluation<br/>[eval.py]"]
  node_eval_folder["Folder evaluation<br/>[eval_folder.py]"]
  node_underwater_eval["Underwater evaluation<br/>[underwater_eval.py]"]
end

subgraph group_tools["Media and analysis"]
  node_video["Video correction<br/>[convert_video.py]"]
  node_embedding["Embedding interpolation<br/>[embedding.py]"]
end

node_user(("Researcher"))
node_clean_images["Clean images"]
node_underwater_images["Underwater images"]
node_corrected["Corrected imagery"]

node_user -->|"starts training"| node_cycle_entry
node_cycle_entry -->|"creates model"| node_cycle_model
node_cycle_model -->|"uses networks"| node_cycle_networks
node_cycle_networks -->|"uses operations"| node_cycle_ops
node_cycle_model -->|"loads and saves"| node_cycle_utils
node_clean_images -.->|"provides clean domain"| node_cycle_entry
node_cycle_entry -.->|"generates style data"| node_underwater_images
node_user -->|"starts training"| node_ugan_train
node_underwater_images -.->|"provides distorted samples"| node_ugan_train
node_clean_images -.->|"provides clean samples"| node_ugan_train
node_ugan_train -->|"uses data operations"| node_dataset_ops
node_ugan_train -->|"uses tensor operations"| node_tf_ops
node_ugan_train -->|"selects generator"| node_pix2pix
node_ugan_train -->|"selects generator"| node_resnet
node_pix2pix_new -->|"uses operations"| node_tf_ops
node_pix2pix -->|"uses operations"| node_tf_ops
node_user -->|"submits image"| node_eval_single
node_user -->|"runs evaluation"| node_eval_images
node_user -->|"submits folder"| node_eval_folder
node_user -->|"runs evaluation"| node_underwater_eval
node_eval_single -->|"uses image operations"| node_dataset_ops
node_eval_images -->|"uses image operations"| node_dataset_ops
node_eval_folder -->|"uses image operations"| node_dataset_ops
node_underwater_eval -->|"uses image operations"| node_dataset_ops
node_eval_single -->|"uses tensor operations"| node_tf_ops
node_eval_images -->|"uses tensor operations"| node_tf_ops
node_eval_folder -->|"uses tensor operations"| node_tf_ops
node_underwater_eval -->|"uses tensor operations"| node_tf_ops
node_eval_single -.->|"writes corrections"| node_corrected
node_eval_images -.->|"writes corrections"| node_corrected
node_eval_folder -.->|"writes corrections"| node_corrected
node_underwater_eval -.->|"writes corrections"| node_corrected
node_user -->|"provides video"| node_video
node_video -->|"uses tensor operations"| node_tf_ops
node_video -->|"uses image operations"| node_dataset_ops
node_video -->|"produces corrected video"| node_corrected
node_user -->|"runs interpolation"| node_embedding
node_embedding -->|"uses tensor operations"| node_tf_ops
node_embedding -->|"uses image operations"| node_dataset_ops
node_embedding -->|"writes interpolated images"| node_corrected

click node_cycle_entry "https://github.com/cameronfabbri/underwater-color-correction/blob/master/cyclegan/main.py"
click node_cycle_model "https://github.com/cameronfabbri/underwater-color-correction/blob/master/cyclegan/model.py"
click node_cycle_networks "https://github.com/cameronfabbri/underwater-color-correction/blob/master/cyclegan/module.py"
click node_cycle_ops "https://github.com/cameronfabbri/underwater-color-correction/blob/master/cyclegan/ops.py"
click node_cycle_utils "https://github.com/cameronfabbri/underwater-color-correction/blob/master/cyclegan/utils.py"
click node_ugan_train "https://github.com/cameronfabbri/underwater-color-correction/blob/master/train.py"
click node_dataset_ops "https://github.com/cameronfabbri/underwater-color-correction/blob/master/ops/data_ops.py"
click node_tf_ops "https://github.com/cameronfabbri/underwater-color-correction/blob/master/ops/tf_ops.py"
click node_pix2pix "https://github.com/cameronfabbri/underwater-color-correction/blob/master/nets/pix2pix.py"
click node_pix2pix_new "https://github.com/cameronfabbri/underwater-color-correction/blob/master/nets/pix2pix_new.py"
click node_resnet "https://github.com/cameronfabbri/underwater-color-correction/blob/master/nets/resnet.py"
click node_eval_single "https://github.com/cameronfabbri/underwater-color-correction/blob/master/eval_one.py"
click node_eval_images "https://github.com/cameronfabbri/underwater-color-correction/blob/master/eval.py"
click node_eval_folder "https://github.com/cameronfabbri/underwater-color-correction/blob/master/eval_folder.py"
click node_underwater_eval "https://github.com/cameronfabbri/underwater-color-correction/blob/master/underwater_eval.py"
click node_video "https://github.com/cameronfabbri/underwater-color-correction/blob/master/convert_video.py"
click node_embedding "https://github.com/cameronfabbri/underwater-color-correction/blob/master/embedding/embedding.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_cycle_utils,node_dataset_ops toneBlue
class node_cycle_entry,node_cycle_model,node_cycle_networks,node_cycle_ops,node_ugan_train,node_tf_ops,node_pix2pix,node_pix2pix_new,node_resnet toneAmber
class node_eval_single,node_eval_images,node_eval_folder,node_underwater_eval toneMint
class node_video,node_embedding toneRose
class node_user,node_clean_images,node_underwater_images,node_corrected toneIndigo
```

## Components

### Data preparation

- [CycleGAN image utilities](https://github.com/cameronfabbri/underwater-color-correction/blob/master/cyclegan/utils.py): `cyclegan/utils.py`
- [Dataset and color ops](https://github.com/cameronfabbri/underwater-color-correction/blob/master/ops/data_ops.py): `ops/data_ops.py`

### Model training

- [CycleGAN runner](https://github.com/cameronfabbri/underwater-color-correction/blob/master/cyclegan/main.py): `cyclegan/main.py`
- [CycleGAN model](https://github.com/cameronfabbri/underwater-color-correction/blob/master/cyclegan/model.py): `cyclegan/model.py`
- [CycleGAN networks](https://github.com/cameronfabbri/underwater-color-correction/blob/master/cyclegan/module.py): `cyclegan/module.py`
- [CycleGAN operations](https://github.com/cameronfabbri/underwater-color-correction/blob/master/cyclegan/ops.py): `cyclegan/ops.py`
- [Correction trainer](https://github.com/cameronfabbri/underwater-color-correction/blob/master/train.py): `train.py`
- [TensorFlow operations](https://github.com/cameronfabbri/underwater-color-correction/blob/master/ops/tf_ops.py): `ops/tf_ops.py`
- [Pix2pix generator](https://github.com/cameronfabbri/underwater-color-correction/blob/master/nets/pix2pix.py): `nets/pix2pix.py`
- [Alternate Pix2pix](https://github.com/cameronfabbri/underwater-color-correction/blob/master/nets/pix2pix_new.py): `nets/pix2pix_new.py`
- [ResNet generator](https://github.com/cameronfabbri/underwater-color-correction/blob/master/nets/resnet.py): `nets/resnet.py`

### Image inference

- [Single-image evaluation](https://github.com/cameronfabbri/underwater-color-correction/blob/master/eval_one.py): `eval_one.py`
- [Image evaluation](https://github.com/cameronfabbri/underwater-color-correction/blob/master/eval.py): `eval.py`
- [Folder evaluation](https://github.com/cameronfabbri/underwater-color-correction/blob/master/eval_folder.py): `eval_folder.py`
- [Underwater evaluation](https://github.com/cameronfabbri/underwater-color-correction/blob/master/underwater_eval.py): `underwater_eval.py`

### Media and analysis

- [Video correction](https://github.com/cameronfabbri/underwater-color-correction/blob/master/convert_video.py): `convert_video.py`
- [Embedding interpolation](https://github.com/cameronfabbri/underwater-color-correction/blob/master/embedding/embedding.py): `embedding/embedding.py`

### Other components

- **Researcher**
- **Clean images**
- **Underwater images**
- **Corrected imagery**

## Connections

- Researcher → CycleGAN runner: starts training (evidence: `cyclegan/main.py`)
- CycleGAN runner → CycleGAN model: creates model (evidence: `cyclegan/main.py`)
- CycleGAN model → CycleGAN networks: uses networks (evidence: `cyclegan/model.py`)
- CycleGAN networks → CycleGAN operations: uses operations (evidence: `cyclegan/module.py`)
- CycleGAN model → CycleGAN image utilities: loads and saves (evidence: `cyclegan/model.py`)
- Clean images → CycleGAN runner: provides clean domain (evidence: `README.md`)
- CycleGAN runner → Underwater images: generates style data (evidence: `README.md`)
- Researcher → Correction trainer: starts training (evidence: `train.py`)
- Underwater images → Correction trainer: provides distorted samples (evidence: `README.md`)
- Clean images → Correction trainer: provides clean samples (evidence: `README.md`)
- Correction trainer → Dataset and color ops: uses data operations (evidence: `train.py`)
- Correction trainer → TensorFlow operations: uses tensor operations (evidence: `train.py`)
- Correction trainer → Pix2pix generator: selects generator (evidence: `train.py`)
- Correction trainer → ResNet generator: selects generator (evidence: `train.py`)
- Alternate Pix2pix → TensorFlow operations: uses operations (evidence: `nets/pix2pix_new.py`)
- Pix2pix generator → TensorFlow operations: uses operations (evidence: `nets/pix2pix.py`)
- Researcher → Single-image evaluation: submits image (evidence: `eval_one.py`)
- Researcher → Image evaluation: runs evaluation (evidence: `eval.py`)
- Researcher → Folder evaluation: submits folder (evidence: `eval_folder.py`)
- Researcher → Underwater evaluation: runs evaluation (evidence: `underwater_eval.py`)
- Single-image evaluation → Dataset and color ops: uses image operations (evidence: `eval_one.py`)
- Image evaluation → Dataset and color ops: uses image operations (evidence: `eval.py`)
- Folder evaluation → Dataset and color ops: uses image operations (evidence: `eval_folder.py`)
- Underwater evaluation → Dataset and color ops: uses image operations (evidence: `underwater_eval.py`)
- Single-image evaluation → TensorFlow operations: uses tensor operations (evidence: `eval_one.py`)
- Image evaluation → TensorFlow operations: uses tensor operations (evidence: `eval.py`)
- Folder evaluation → TensorFlow operations: uses tensor operations (evidence: `eval_folder.py`)
- Underwater evaluation → TensorFlow operations: uses tensor operations (evidence: `underwater_eval.py`)
- Single-image evaluation → Corrected imagery: writes corrections (evidence: `eval_one.py`)
- Image evaluation → Corrected imagery: writes corrections (evidence: `eval.py`)
- Folder evaluation → Corrected imagery: writes corrections (evidence: `eval_folder.py`)
- Underwater evaluation → Corrected imagery: writes corrections (evidence: `underwater_eval.py`)
- Researcher → Video correction: provides video (evidence: `convert_video.py`)
- Video correction → TensorFlow operations: uses tensor operations (evidence: `convert_video.py`)
- Video correction → Dataset and color ops: uses image operations (evidence: `convert_video.py`)
- Video correction → Corrected imagery: produces corrected video (evidence: `convert_video.py`)
- Researcher → Embedding interpolation: runs interpolation (evidence: `embedding/embedding.py`)
- Embedding interpolation → TensorFlow operations: uses tensor operations (evidence: `embedding/embedding.py`)
- Embedding interpolation → Dataset and color ops: uses image operations (evidence: `embedding/embedding.py`)
- Embedding interpolation → Corrected imagery: writes interpolated images (evidence: `embedding/embedding.py`)
