# viroshan2307/epoch_58 architecture

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

- Interactive diagram: https://gitdiagram.com/viroshan2307/epoch_58
- Repository: https://github.com/viroshan2307/epoch_58

## Overview

This repository restores noisy, low-resolution semiconductor inspection images into clean images at 2× resolution. The primary workflow is a user invoking the batch entry point, which loads the trained weights and runs the restoration model with flip-and-average test-time augmentation. A separate training workflow learns from paired arrays and saves a checkpoint; validation scripts measure PSNR/SSIM and LPIPS. Training and evaluation details are based on the README and sampled scripts; dataset storage is external to this repository.

Main entry points: [`compute_lpips.py`](https://github.com/viroshan2307/epoch_58/blob/main/compute_lpips.py) (LPIPS evaluation), [`run.py`](https://github.com/viroshan2307/epoch_58/blob/main/run.py) (Batch runner), [`train.py`](https://github.com/viroshan2307/epoch_58/blob/main/train.py) (Training workflow), [`evaluate_metrics.py`](https://github.com/viroshan2307/epoch_58/blob/main/evaluate_metrics.py) (PSNR / SSIM evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inference["Image restoration"]
  node_runner["Batch runner<br/>[run.py]"]
  node_restore["TTA restoration<br/>[run.py]"]
  node_model["Restoration network"]
  node_weights[("Trained weights<br/>[best_model_v3.pth]")]
end

subgraph group_training["Model training"]
  node_trainer["Training workflow<br/>[train.py]"]
  node_train_model["Training network"]
  node_checkpoint[("Saved checkpoint<br/>[train.py]")]
end

subgraph group_evaluation["Model evaluation"]
  node_metric_eval["PSNR / SSIM evaluation"]
  node_lpips_eval["LPIPS evaluation<br/>[compute_lpips.py]"]
end

node_user(("Operator"))
node_input[("Noisy image files")]
node_output[("Restored image files")]
node_paired_data[("Paired image arrays")]
node_lpips["LPIPS package"]

node_user -->|"invokes"| node_runner
node_input -->|"reads files"| node_runner
node_runner -->|"loads"| node_weights
node_runner -->|"dispatches"| node_restore
node_restore -->|"runs inference"| node_model
node_restore -->|"writes files"| node_output
node_trainer -->|"loads pairs"| node_paired_data
node_trainer -->|"trains"| node_train_model
node_trainer -->|"saves best"| node_checkpoint
node_metric_eval -->|"runs inference"| node_model
node_metric_eval -->|"reads validation"| node_paired_data
node_metric_eval -->|"loads"| node_weights
node_lpips_eval -->|"runs inference"| node_model
node_lpips_eval -->|"reads validation"| node_paired_data
node_lpips_eval -->|"loads"| node_weights
node_lpips_eval -->|"computes distance"| node_lpips

click node_runner "https://github.com/viroshan2307/epoch_58/blob/main/run.py"
click node_restore "https://github.com/viroshan2307/epoch_58/blob/main/run.py"
click node_model "https://github.com/viroshan2307/epoch_58/blob/main/model_architecture.py"
click node_weights "https://github.com/viroshan2307/epoch_58/blob/main/models/best_model_v3.pth"
click node_trainer "https://github.com/viroshan2307/epoch_58/blob/main/train.py"
click node_train_model "https://github.com/viroshan2307/epoch_58/blob/main/model_architecture.py"
click node_checkpoint "https://github.com/viroshan2307/epoch_58/blob/main/train.py"
click node_metric_eval "https://github.com/viroshan2307/epoch_58/blob/main/evaluate_metrics.py"
click node_lpips_eval "https://github.com/viroshan2307/epoch_58/blob/main/compute_lpips.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_runner,node_restore,node_model,node_weights toneBlue
class node_trainer,node_train_model,node_checkpoint,node_input,node_output,node_paired_data toneAmber
class node_metric_eval,node_lpips_eval toneMint
class node_user,node_lpips toneIndigo
```

## Components

### Image restoration

- [Batch runner](https://github.com/viroshan2307/epoch_58/blob/main/run.py): `run.py`
- [TTA restoration](https://github.com/viroshan2307/epoch_58/blob/main/run.py): `run.py`
- [Restoration network](https://github.com/viroshan2307/epoch_58/blob/main/model_architecture.py): `model_architecture.py`
- [Trained weights](https://github.com/viroshan2307/epoch_58/blob/main/models/best_model_v3.pth): `models/best_model_v3.pth`

### Model training

- [Training workflow](https://github.com/viroshan2307/epoch_58/blob/main/train.py): `train.py`
- [Training network](https://github.com/viroshan2307/epoch_58/blob/main/model_architecture.py): `model_architecture.py`
- [Saved checkpoint](https://github.com/viroshan2307/epoch_58/blob/main/train.py): `train.py`

### Model evaluation

- [PSNR / SSIM evaluation](https://github.com/viroshan2307/epoch_58/blob/main/evaluate_metrics.py): `evaluate_metrics.py`
- [LPIPS evaluation](https://github.com/viroshan2307/epoch_58/blob/main/compute_lpips.py): `compute_lpips.py`

### Other components

- **Operator**
- **Noisy image files**
- **Restored image files**
- **Paired image arrays**
- **LPIPS package**

## Connections

- Operator → Batch runner: invokes (evidence: `run.py`)
- Noisy image files → Batch runner: reads files (evidence: `run.py`)
- Batch runner → Trained weights: loads (evidence: `run.py`)
- Batch runner → TTA restoration: dispatches (evidence: `run.py`)
- TTA restoration → Restoration network: runs inference (evidence: `run.py`)
- TTA restoration → Restored image files: writes files (evidence: `run.py`)
- Training workflow → Paired image arrays: loads pairs (evidence: `train.py`)
- Training workflow → Training network: trains (evidence: `train.py`)
- Training workflow → Saved checkpoint: saves best (evidence: `train.py`)
- PSNR / SSIM evaluation → Restoration network: runs inference (evidence: `evaluate_metrics.py`)
- PSNR / SSIM evaluation → Paired image arrays: reads validation (evidence: `evaluate_metrics.py`)
- PSNR / SSIM evaluation → Trained weights: loads (evidence: `evaluate_metrics.py`)
- LPIPS evaluation → Restoration network: runs inference (evidence: `compute_lpips.py`)
- LPIPS evaluation → Paired image arrays: reads validation (evidence: `compute_lpips.py`)
- LPIPS evaluation → Trained weights: loads (evidence: `compute_lpips.py`)
- LPIPS evaluation → LPIPS package: computes distance (evidence: `compute_lpips.py`)
