# shyad1/fast-sea-thru architecture

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

- Interactive diagram: https://gitdiagram.com/shyad1/fast-sea-thru
- Repository: https://github.com/shyad1/fast-sea-thru

## Overview

The repository provides two command-line workflows: downloading images described by a COCO-format dataset, and restoring underwater images with a Sea-Thru implementation. The downloader’s worker, retry, and file-writing behavior is visible in its excerpt. The restoration excerpt shows image handling, illuminant support, fitting, recovery, and postprocessing, while the README documents the broader stages and output options; unsampled internal call relationships are therefore not asserted.

Main entry points: [`proyect/proyect.py`](https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py) (Restoration CLI), [`download.py`](https://github.com/shyad1/fast-sea-thru/blob/main/download.py) (Adaptive Downloader), [`proyect/illuminant.cu`](https://github.com/shyad1/fast-sea-thru/blob/main/proyect/illuminant.cu) (CUDA Backend)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_download["Image Download"]
  node_dataset_loader["Dataset Loader<br/>[download.py]"]
  node_task_builder["Task Builder<br/>[download.py]"]
  node_downloader["Adaptive Downloader<br/>[download.py]"]
  node_downloaded_images[("Downloaded Images<br/>[download.py]")]
end

subgraph group_restore["Image Restoration"]
  node_restore_cli["Restoration CLI<br/>[proyect.py]"]
  node_image_reader["Image Reader<br/>[proyect.py]"]
end

subgraph group_depth["Depth Estimation"]
  node_depth_inputs["Depth Inputs<br/>[proyect.py]"]
  node_midas["MiDaS Estimation<br/>[proyect.py]"]
  node_depth_modes["Depth Modes<br/>[proyect.py]"]
end

subgraph group_sea_thru["Sea-Thru Modeling"]
  node_illuminant["Illuminant Map<br/>[proyect.py]"]
  node_cuda_backend["CUDA Backend<br/>[illuminant.cu]"]
  node_backscatter["Backscatter Removal<br/>[proyect.py]"]
  node_attenuation["Attenuation Fitting<br/>[proyect.py]"]
  node_recovery["Radiance Recovery<br/>[proyect.py]"]
  node_tone_post["Tone and Postprocess<br/>[proyect.py]"]
end

subgraph group_outputs["Outputs"]
  node_restored_output[("Restored Images<br/>[proyect.py]")]
  node_diagnostics["Depth Diagnostics<br/>[proyect.py]"]
end

node_user(("User"))
node_dataset["COCO Dataset"]
node_image_service["Image Servers"]

node_user -->|"selects dataset"| node_dataset_loader
node_dataset -->|"loads"| node_dataset_loader
node_dataset_loader -->|"provides images"| node_task_builder
node_task_builder -->|"creates tasks"| node_downloader
node_downloader -->|"requests images"| node_image_service
node_downloader -->|"writes files"| node_downloaded_images
node_user -->|"supplies inputs"| node_restore_cli
node_restore_cli -.->|"reads images"| node_image_reader
node_restore_cli -->|"selects depth mode"| node_depth_modes
node_depth_inputs -->|"provides maps"| node_depth_modes
node_midas -->|"provides predicted depth"| node_depth_modes
node_depth_modes -.->|"supplies depth"| node_illuminant
node_illuminant -.->|"dispatches optionally"| node_cuda_backend
node_restore_cli -->|"removes backscatter"| node_backscatter
node_restore_cli -->|"fits attenuation"| node_attenuation
node_restore_cli -->|"recovers radiance"| node_recovery
node_restore_cli -->|"applies options"| node_tone_post
node_restore_cli -.->|"writes results"| node_restored_output
node_restore_cli -->|"saves diagnostics"| node_diagnostics

click node_dataset_loader "https://github.com/shyad1/fast-sea-thru/blob/main/download.py"
click node_task_builder "https://github.com/shyad1/fast-sea-thru/blob/main/download.py"
click node_downloader "https://github.com/shyad1/fast-sea-thru/blob/main/download.py"
click node_downloaded_images "https://github.com/shyad1/fast-sea-thru/blob/main/download.py"
click node_restore_cli "https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py"
click node_image_reader "https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py"
click node_depth_inputs "https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py"
click node_midas "https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py"
click node_depth_modes "https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py"
click node_illuminant "https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py"
click node_cuda_backend "https://github.com/shyad1/fast-sea-thru/blob/main/proyect/illuminant.cu"
click node_backscatter "https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py"
click node_attenuation "https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py"
click node_recovery "https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py"
click node_tone_post "https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py"
click node_restored_output "https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py"
click node_diagnostics "https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.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_dataset_loader,node_task_builder,node_downloader,node_downloaded_images,node_user toneBlue
class node_restore_cli,node_image_reader toneAmber
class node_depth_inputs,node_midas,node_depth_modes,node_image_service toneMint
class node_illuminant,node_cuda_backend,node_backscatter,node_attenuation,node_recovery,node_tone_post toneRose
class node_restored_output,node_diagnostics,node_dataset toneIndigo
```

## Components

### Image Download

- [Dataset Loader](https://github.com/shyad1/fast-sea-thru/blob/main/download.py): `download.py`
- [Task Builder](https://github.com/shyad1/fast-sea-thru/blob/main/download.py): `download.py`
- [Adaptive Downloader](https://github.com/shyad1/fast-sea-thru/blob/main/download.py): `download.py`
- [Downloaded Images](https://github.com/shyad1/fast-sea-thru/blob/main/download.py): `download.py`

### Image Restoration

- [Restoration CLI](https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py): `proyect/proyect.py`
- [Image Reader](https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py): `proyect/proyect.py`

### Depth Estimation

- [Depth Inputs](https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py): `proyect/proyect.py`
- [MiDaS Estimation](https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py): `proyect/proyect.py`
- [Depth Modes](https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py): `proyect/proyect.py`

### Sea-Thru Modeling

- [Illuminant Map](https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py): `proyect/proyect.py`
- [CUDA Backend](https://github.com/shyad1/fast-sea-thru/blob/main/proyect/illuminant.cu): `proyect/illuminant.cu`
- [Backscatter Removal](https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py): `proyect/proyect.py`
- [Attenuation Fitting](https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py): `proyect/proyect.py`
- [Radiance Recovery](https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py): `proyect/proyect.py`
- [Tone and Postprocess](https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py): `proyect/proyect.py`

### Outputs

- [Restored Images](https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py): `proyect/proyect.py`
- [Depth Diagnostics](https://github.com/shyad1/fast-sea-thru/blob/main/proyect/proyect.py): `proyect/proyect.py`

### Other components

- **User**
- **COCO Dataset**
- **Image Servers**

## Connections

- User → Dataset Loader: selects dataset (evidence: `download.py`)
- COCO Dataset → Dataset Loader: loads (evidence: `download.py`)
- Dataset Loader → Task Builder: provides images (evidence: `download.py`)
- Task Builder → Adaptive Downloader: creates tasks (evidence: `download.py`)
- Adaptive Downloader → Image Servers: requests images (evidence: `download.py`)
- Adaptive Downloader → Downloaded Images: writes files (evidence: `download.py`)
- User → Restoration CLI: supplies inputs (evidence: `README.md`)
- Restoration CLI → Image Reader: reads images (evidence: `proyect/proyect.py`)
- Restoration CLI → Depth Modes: selects depth mode (evidence: `README.md`)
- Depth Inputs → Depth Modes: provides maps (evidence: `README.md`)
- MiDaS Estimation → Depth Modes: provides predicted depth (evidence: `README.md`)
- Depth Modes → Illuminant Map: supplies depth (evidence: `proyect/proyect.py`)
- Illuminant Map → CUDA Backend: dispatches optionally
- Restoration CLI → Backscatter Removal: removes backscatter (evidence: `README.md`)
- Restoration CLI → Attenuation Fitting: fits attenuation (evidence: `README.md`)
- Restoration CLI → Radiance Recovery: recovers radiance (evidence: `README.md`)
- Restoration CLI → Tone and Postprocess: applies options (evidence: `README.md`)
- Restoration CLI → Restored Images: writes results (evidence: `proyect/proyect.py`)
- Restoration CLI → Depth Diagnostics: saves diagnostics (evidence: `README.md`)
