# xenbaloch/remdinet architecture

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

- Interactive diagram: https://gitdiagram.com/xenbaloch/remdinet
- Repository: https://github.com/xenbaloch/remdinet

## Overview

RemDiNet is a PyTorch low-light image enhancement framework. Its main workflow pairs low-light images with optional ground truth, trains a saliency/SNR-guided enhancement model through three loss stages, then applies the model to test images and evaluates enhancement quality. The map also shows color correction and metric calculation as internal capabilities. The README documents testing and stage behavior; unsampled source limits confirmation of some wiring, so only directly supported relationships are drawn.

Main entry points: [`lowlight_train.py`](https://github.com/xenbaloch/remdinet/blob/main/lowlight_train.py) (Staged trainer), [`lowlight_test.py`](https://github.com/xenbaloch/remdinet/blob/main/lowlight_test.py) (Test and inference), [`model.py`](https://github.com/xenbaloch/remdinet/blob/main/model.py) (SNR-saliency enhancer), [`dataloader.py`](https://github.com/xenbaloch/remdinet/blob/main/dataloader.py) (Pairing and augmentation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_dataset["Pairing and augmentation<br/>[dataloader.py]"]
end

subgraph group_enhancement["Enhancement model"]
  node_model["SNR-saliency enhancer<br/>[model.py]"]
  node_color["Color correction"]
end

subgraph group_training["Training"]
  node_trainer["Staged trainer<br/>[lowlight_train.py]"]
  node_loss["Enhancement losses<br/>[Myloss.py]"]
  node_weights["Stage weights<br/>[loss_weights.py]"]
  node_checkpoint["Model checkpoint"]
end

subgraph group_evaluation["Inference and evaluation"]
  node_tester["Test and inference<br/>[lowlight_test.py]"]
  node_enhanced["Enhanced images"]
  node_metrics["Image metrics<br/>[metrics.py]"]
  node_metriccore["PSNR and MS-SSIM<br/>[metrics_core.py]"]
end

node_user(("Researcher"))
node_images["Image datasets"]

node_user -->|"starts training"| node_trainer
node_images -->|"provides images"| node_dataset
node_trainer -->|"loads batches"| node_dataset
node_dataset -->|"returns batches"| node_trainer
node_trainer -->|"trains model"| node_model
node_trainer -->|"computes loss"| node_loss
node_loss -->|"reads defaults"| node_weights
node_trainer -->|"saves weights"| node_checkpoint
node_user -->|"starts inference"| node_tester
node_tester -->|"enhances images"| node_model
node_tester -->|"loads weights"| node_checkpoint
node_model -->|"uses correction"| node_color
node_model -->|"produces images"| node_enhanced
node_tester -->|"evaluates output"| node_metrics
node_metrics -->|"delegates metrics"| node_metriccore

click node_dataset "https://github.com/xenbaloch/remdinet/blob/main/dataloader.py"
click node_trainer "https://github.com/xenbaloch/remdinet/blob/main/lowlight_train.py"
click node_loss "https://github.com/xenbaloch/remdinet/blob/main/Myloss.py"
click node_weights "https://github.com/xenbaloch/remdinet/blob/main/loss_weights.py"
click node_model "https://github.com/xenbaloch/remdinet/blob/main/model.py"
click node_color "https://github.com/xenbaloch/remdinet/blob/main/color_enhancement.py"
click node_tester "https://github.com/xenbaloch/remdinet/blob/main/lowlight_test.py"
click node_metrics "https://github.com/xenbaloch/remdinet/blob/main/metrics.py"
click node_metriccore "https://github.com/xenbaloch/remdinet/blob/main/metrics_core.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 toneBlue
class node_model,node_color toneAmber
class node_trainer,node_loss,node_weights,node_checkpoint toneMint
class node_tester,node_enhanced,node_metrics,node_metriccore toneRose
class node_user,node_images toneIndigo
```

## Components

### Data preparation

- [Pairing and augmentation](https://github.com/xenbaloch/remdinet/blob/main/dataloader.py): `dataloader.py`

### Enhancement model

- [SNR-saliency enhancer](https://github.com/xenbaloch/remdinet/blob/main/model.py): `model.py`
- [Color correction](https://github.com/xenbaloch/remdinet/blob/main/color_enhancement.py): `color_enhancement.py`

### Training

- [Staged trainer](https://github.com/xenbaloch/remdinet/blob/main/lowlight_train.py): `lowlight_train.py`
- [Enhancement losses](https://github.com/xenbaloch/remdinet/blob/main/Myloss.py): `Myloss.py`
- [Stage weights](https://github.com/xenbaloch/remdinet/blob/main/loss_weights.py): `loss_weights.py`
- **Model checkpoint**

### Inference and evaluation

- [Test and inference](https://github.com/xenbaloch/remdinet/blob/main/lowlight_test.py): `lowlight_test.py`
- **Enhanced images**
- [Image metrics](https://github.com/xenbaloch/remdinet/blob/main/metrics.py): `metrics.py`
- [PSNR and MS-SSIM](https://github.com/xenbaloch/remdinet/blob/main/metrics_core.py): `metrics_core.py`

### Other components

- **Researcher**
- **Image datasets**

## Connections

- Researcher → Staged trainer: starts training
- Image datasets → Pairing and augmentation: provides images
- Staged trainer → Pairing and augmentation: loads batches
- Pairing and augmentation → Staged trainer: returns batches
- Staged trainer → SNR-saliency enhancer: trains model
- Staged trainer → Enhancement losses: computes loss
- Enhancement losses → Stage weights: reads defaults
- Staged trainer → Model checkpoint: saves weights
- Researcher → Test and inference: starts inference
- Test and inference → SNR-saliency enhancer: enhances images
- Test and inference → Model checkpoint: loads weights
- SNR-saliency enhancer → Color correction: uses correction
- SNR-saliency enhancer → Enhanced images: produces images
- Test and inference → Image metrics: evaluates output
- Image metrics → PSNR and MS-SSIM: delegates metrics
