# revanthvundamatla/capstone architecture

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

- Interactive diagram: https://gitdiagram.com/revanthvundamatla/capstone
- Repository: https://github.com/revanthvundamatla/capstone

## Overview

DeepSea Restore is an underwater-image restoration application backed by a DDPG agent, with a browser interface, an API, and a separate dataset-training workflow. The user workflow is upload → API inference → sequential enhancement → returned image and quality metrics. Training pairs raw/reference images, evaluates the learned policy, and records validation history. Relationships for unsampled API and training details are omitted unless supported by the excerpts or source index.

Main entry points: [`Backend/enhancement/environment.py`](https://github.com/revanthvundamatla/capstone/blob/main/Backend/enhancement/environment.py) (Enhancement environment), [`Backend/inference.py`](https://github.com/revanthvundamatla/capstone/blob/main/Backend/inference.py) (Inference runner), [`Backend/ddpg/agent.py`](https://github.com/revanthvundamatla/capstone/blob/main/Backend/ddpg/agent.py) (DDPG agent), [`Backend/train.py`](https://github.com/revanthvundamatla/capstone/blob/main/Backend/train.py) (Dataset training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Browser interface"]
  node_frontend["Upload and results UI<br/>[script.js]"]
  node_charts["Training charts<br/>[charts.js]"]
end

subgraph group_service["API and inference"]
  node_api["REST API<br/>[app.py]"]
  node_inference["Inference runner<br/>[inference.py]"]
end

subgraph group_restoration["Restoration engine"]
  node_environment["Enhancement environment<br/>[environment.py]"]
  node_state["Image state encoding<br/>[state.py]"]
  node_operations["Image enhancement ops<br/>[ops.py]"]
  node_metrics["Quality metrics<br/>[metrics.py]"]
end

subgraph group_learning["DDPG learning"]
  node_agent["DDPG agent<br/>[agent.py]"]
  node_networks["Actor and critic<br/>[networks.py]"]
  node_training["Dataset training<br/>[train.py]"]
  node_replay["Replay buffer<br/>[replay_buffer.py]"]
end

node_user(("Image user"))

node_user -->|"uploads image"| node_frontend
node_frontend -.->|"posts image"| node_api
node_api -->|"runs restoration"| node_inference
node_inference -->|"selects actions"| node_agent
node_inference -->|"steps environment"| node_environment
node_inference -->|"computes metrics"| node_metrics
node_environment -->|"applies actions"| node_operations
node_environment -->|"encodes image"| node_state
node_environment -->|"scores restoration"| node_metrics
node_agent -->|"uses networks"| node_networks
node_training -->|"trains policy"| node_agent
node_training -->|"runs episodes"| node_environment
node_training -->|"stores experience"| node_replay
node_agent -->|"samples batches"| node_replay
node_api -.->|"returns image and metrics"| node_frontend

click node_frontend "https://github.com/revanthvundamatla/capstone/blob/main/deepsea-restore-frontend/script.js"
click node_charts "https://github.com/revanthvundamatla/capstone/blob/main/deepsea-restore-frontend/charts.js"
click node_api "https://github.com/revanthvundamatla/capstone/blob/main/Backend/app.py"
click node_inference "https://github.com/revanthvundamatla/capstone/blob/main/Backend/inference.py"
click node_agent "https://github.com/revanthvundamatla/capstone/blob/main/Backend/ddpg/agent.py"
click node_networks "https://github.com/revanthvundamatla/capstone/blob/main/Backend/ddpg/networks.py"
click node_training "https://github.com/revanthvundamatla/capstone/blob/main/Backend/train.py"
click node_replay "https://github.com/revanthvundamatla/capstone/blob/main/Backend/ddpg/replay_buffer.py"
click node_environment "https://github.com/revanthvundamatla/capstone/blob/main/Backend/enhancement/environment.py"
click node_state "https://github.com/revanthvundamatla/capstone/blob/main/Backend/enhancement/state.py"
click node_operations "https://github.com/revanthvundamatla/capstone/blob/main/Backend/enhancement/ops.py"
click node_metrics "https://github.com/revanthvundamatla/capstone/blob/main/Backend/metrics/metrics.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_frontend,node_charts,node_user toneBlue
class node_api,node_inference toneAmber
class node_environment,node_state,node_operations,node_metrics toneMint
class node_agent,node_networks,node_training,node_replay toneRose
```

## Components

### Browser interface

- [Upload and results UI](https://github.com/revanthvundamatla/capstone/blob/main/deepsea-restore-frontend/script.js): `deepsea-restore-frontend/script.js`
- [Training charts](https://github.com/revanthvundamatla/capstone/blob/main/deepsea-restore-frontend/charts.js): `deepsea-restore-frontend/charts.js`

### API and inference

- [REST API](https://github.com/revanthvundamatla/capstone/blob/main/Backend/app.py): `Backend/app.py`
- [Inference runner](https://github.com/revanthvundamatla/capstone/blob/main/Backend/inference.py): `Backend/inference.py`

### Restoration engine

- [Enhancement environment](https://github.com/revanthvundamatla/capstone/blob/main/Backend/enhancement/environment.py): `Backend/enhancement/environment.py`
- [Image state encoding](https://github.com/revanthvundamatla/capstone/blob/main/Backend/enhancement/state.py): `Backend/enhancement/state.py`
- [Image enhancement ops](https://github.com/revanthvundamatla/capstone/blob/main/Backend/enhancement/ops.py): `Backend/enhancement/ops.py`
- [Quality metrics](https://github.com/revanthvundamatla/capstone/blob/main/Backend/metrics/metrics.py): `Backend/metrics/metrics.py`

### DDPG learning

- [DDPG agent](https://github.com/revanthvundamatla/capstone/blob/main/Backend/ddpg/agent.py): `Backend/ddpg/agent.py`
- [Actor and critic](https://github.com/revanthvundamatla/capstone/blob/main/Backend/ddpg/networks.py): `Backend/ddpg/networks.py`
- [Dataset training](https://github.com/revanthvundamatla/capstone/blob/main/Backend/train.py): `Backend/train.py`
- [Replay buffer](https://github.com/revanthvundamatla/capstone/blob/main/Backend/ddpg/replay_buffer.py): `Backend/ddpg/replay_buffer.py`

### Other components

- **Image user**

## Connections

- Image user → Upload and results UI: uploads image (evidence: `deepsea-restore-frontend/script.js`)
- Upload and results UI → REST API: posts image
- REST API → Inference runner: runs restoration (evidence: `Backend/app.py`)
- Inference runner → DDPG agent: selects actions (evidence: `Backend/inference.py`)
- Inference runner → Enhancement environment: steps environment (evidence: `Backend/inference.py`)
- Inference runner → Quality metrics: computes metrics (evidence: `Backend/inference.py`)
- Enhancement environment → Image enhancement ops: applies actions (evidence: `Backend/enhancement/environment.py`)
- Enhancement environment → Image state encoding: encodes image (evidence: `Backend/enhancement/environment.py`)
- Enhancement environment → Quality metrics: scores restoration (evidence: `Backend/enhancement/environment.py`)
- DDPG agent → Actor and critic: uses networks (evidence: `Backend/ddpg/agent.py`)
- Dataset training → DDPG agent: trains policy (evidence: `Backend/train.py`)
- Dataset training → Enhancement environment: runs episodes (evidence: `Backend/train.py`)
- Dataset training → Replay buffer: stores experience (evidence: `Backend/train.py`)
- DDPG agent → Replay buffer: samples batches (evidence: `Backend/ddpg/agent.py`)
- REST API → Upload and results UI: returns image and metrics
