# revanthvundamatla/capstone_final architecture

> Architecture diagram of the GitHub repository revanthvundamatla/capstone_final, 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_final
- Repository: https://github.com/revanthvundamatla/capstone_final

## Overview

DeepSea Restore is an underwater-image restoration application built around a DDPG agent. A user uploads an image through the frontend; the API accepts it, runs sequential enhancement, and returns a restored image and quality metrics for display. A separate training workflow pairs and splits dataset images, trains and evaluates the agent, and produces checkpoints and epoch history that the API exposes. The graph includes the documented training and evaluation capabilities; unsampled API and training details limit some relationship evidence.

Main entry points: [`Backend/train.py`](https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/train.py) (Dataset training), [`Backend/app.py`](https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/app.py) (REST API), [`deepsea-restore-frontend/script.js`](https://github.com/revanthvundamatla/capstone_final/blob/main/deepsea-restore-frontend/script.js) (Upload and results UI), [`Backend/enhancement/environment.py`](https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/enhancement/environment.py) (Enhancement episode)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_frontend["Upload and results UI<br/>[script.js]"]
  node_charts["Training charts<br/>[charts.js]"]
end

subgraph group_service["Restoration service"]
  node_api["REST API<br/>[app.py]"]
  node_inference["Image inference<br/>[inference.py]"]
  node_environment["Enhancement episode<br/>[environment.py]"]
  node_operations["Image operations<br/>[ops.py]"]
  node_state["Image state<br/>[state.py]"]
  node_metrics["Quality metrics<br/>[metrics.py]"]
end

subgraph group_learning["Training and learning"]
  node_trainer["Dataset training<br/>[train.py]"]
  node_agent["DDPG agent<br/>[agent.py]"]
  node_networks["Actor and critic<br/>[networks.py]"]
  node_buffer["Experience replay<br/>[replay_buffer.py]"]
end

subgraph group_artifacts["Model and history"]
  node_checkpoint["Model checkpoints"]
  node_history["Training history"]
end

node_user(("Image user"))
node_browser["Chart.js"]

node_user -->|"uploads image"| node_frontend
node_frontend -->|"requests restoration"| node_api
node_frontend -->|"fetches history"| node_api
node_frontend -->|"checks health"| node_api
node_frontend -.->|"renders history"| node_charts
node_charts -.->|"uses library"| node_browser
node_api -->|"runs restoration"| node_inference
node_api -->|"reads history"| node_history
node_inference -->|"selects actions"| node_agent
node_inference -->|"steps episode"| node_environment
node_inference -->|"calculates metrics"| node_metrics
node_environment -->|"applies enhancement"| node_operations
node_environment -->|"encodes image"| node_state
node_environment -->|"scores image"| node_metrics
node_agent -->|"uses networks"| node_networks
node_trainer -->|"runs episodes"| node_environment
node_trainer -->|"trains and evaluates"| node_agent
node_trainer -.->|"stores experience"| node_buffer
node_trainer -->|"evaluates quality"| node_metrics
node_trainer -->|"saves models"| node_checkpoint
node_trainer -->|"writes metrics"| node_history
node_api -.->|"loads model"| node_checkpoint

click node_frontend "https://github.com/revanthvundamatla/capstone_final/blob/main/deepsea-restore-frontend/script.js"
click node_charts "https://github.com/revanthvundamatla/capstone_final/blob/main/deepsea-restore-frontend/charts.js"
click node_api "https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/app.py"
click node_inference "https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/inference.py"
click node_environment "https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/enhancement/environment.py"
click node_operations "https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/enhancement/ops.py"
click node_state "https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/enhancement/state.py"
click node_metrics "https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/metrics/metrics.py"
click node_trainer "https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/train.py"
click node_agent "https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/ddpg/agent.py"
click node_networks "https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/ddpg/networks.py"
click node_buffer "https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/ddpg/replay_buffer.py"
click node_checkpoint "https://github.com/revanthvundamatla/capstone_final/tree/main/Backend/checkpoints"
click node_history "https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/training_history.json"

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,node_environment,node_operations,node_state,node_metrics toneAmber
class node_trainer,node_agent,node_networks,node_buffer toneMint
class node_checkpoint,node_history toneRose
class node_browser toneIndigo
```

## Components

### Web client

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

### Restoration service

- [REST API](https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/app.py): `Backend/app.py`
- [Image inference](https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/inference.py): `Backend/inference.py`
- [Enhancement episode](https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/enhancement/environment.py): `Backend/enhancement/environment.py`
- [Image operations](https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/enhancement/ops.py): `Backend/enhancement/ops.py`
- [Image state](https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/enhancement/state.py): `Backend/enhancement/state.py`
- [Quality metrics](https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/metrics/metrics.py): `Backend/metrics/metrics.py`

### Training and learning

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

### Model and history

- [Model checkpoints](https://github.com/revanthvundamatla/capstone_final/tree/main/Backend/checkpoints): `Backend/checkpoints`
- [Training history](https://github.com/revanthvundamatla/capstone_final/blob/main/Backend/training_history.json): `Backend/training_history.json`

### Other components

- **Image user**
- **Chart.js**

## Connections

- Image user → Upload and results UI: uploads image (evidence: `deepsea-restore-frontend/script.js`)
- Upload and results UI → REST API: requests restoration (evidence: `deepsea-restore-frontend/script.js`)
- Upload and results UI → REST API: fetches history (evidence: `deepsea-restore-frontend/script.js`)
- Upload and results UI → REST API: checks health (evidence: `deepsea-restore-frontend/script.js`)
- Upload and results UI → Training charts: renders history
- Training charts → Chart.js: uses library
- REST API → Image inference: runs restoration (evidence: `Backend/app.py`)
- REST API → Training history: reads history (evidence: `Backend/app.py`)
- Image inference → DDPG agent: selects actions (evidence: `Backend/inference.py`)
- Image inference → Enhancement episode: steps episode (evidence: `Backend/inference.py`)
- Image inference → Quality metrics: calculates metrics (evidence: `Backend/inference.py`)
- Enhancement episode → Image operations: applies enhancement (evidence: `Backend/enhancement/environment.py`)
- Enhancement episode → Image state: encodes image (evidence: `Backend/enhancement/environment.py`)
- Enhancement episode → Quality metrics: scores image (evidence: `Backend/enhancement/environment.py`)
- DDPG agent → Actor and critic: uses networks (evidence: `Backend/ddpg/agent.py`)
- Dataset training → Enhancement episode: runs episodes (evidence: `Backend/train.py`)
- Dataset training → DDPG agent: trains and evaluates (evidence: `Backend/train.py`)
- Dataset training → Experience replay: stores experience (evidence: `Backend/train.py`)
- Dataset training → Quality metrics: evaluates quality (evidence: `Backend/train.py`)
- Dataset training → Model checkpoints: saves models (evidence: `Backend/train.py`)
- Dataset training → Training history: writes metrics (evidence: `Backend/train.py`)
- REST API → Model checkpoints: loads model
