You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***Data**: band order, normalization stats, crop sizes, augmentations
@@ -52,8 +52,8 @@ The schedule and ramp make training **easier, safer, and more reproducible**.
52
52
53
53
| Component | Options | Config keys |
54
54
|-----------|---------|-------------|
55
-
|**Generators**|`SRResNet`, `res`, `rcab`, `rrdb`, `lka`|`Generator.model_type`, depth via `Generator.n_blocks`, width via `Generator.n_channels`, kernels and scale. |
56
-
|**Discriminators**|`standard` SRGAN CNN, `patchgan`|`Discriminator.model_type`, granularity with `Discriminator.n_blocks`. |
55
+
|**Generators**|`SRResNet`, `res`, `rcab`, `rrdb`, `lka`, `esrgan`, `stochastic_gan`|`Generator.model_type`, depth via `Generator.n_blocks`, width via `Generator.n_channels`, kernels/scale plus ESRGAN-specific `growth_channels`, `res_scale`, `out_channels`. |
|**Adversarial loss**| BCE‑with‑logits on real/fake logits | Warmup via `Training.pretrain_g_only`, ramped by `adv_loss_ramp_steps`, capped at `adv_loss_beta`, optional label smoothing. |
total-variation terms. Adversarial supervision uses `torch.nn.BCEWithLogitsLoss` with optional label smoothing.
15
16
***Optimiser scheduling.**`configure_optimizers()` returns paired Adam optimisers (generator + discriminator) with
@@ -40,21 +41,25 @@ The generator zoo lives under `opensr_srgan/model/generators/` and can be select
40
41
***Flexible residual families (`flexible_generator.py`).** Parameterised factory that instantiates residual, RCAB, RRDB, or
41
42
large-kernel attention blocks while reusing the same interface. Channel counts, block depth, kernel sizes, and scaling factor
42
43
are all read from the YAML file.
43
-
***Conditional GAN generator (`cgan_generator.py`).** Extends the flexible generator with conditioning inputs and latent noise,
44
+
***Stochastic GAN generator (`cgan_generator.py`).** Extends the flexible generator with conditioning inputs and latent noise,
44
45
enabling experiments where auxiliary metadata influences the super-resolution output.
46
+
***ESRGAN generator (`esrgan.py`).** Implements the RRDBNet trunk introduced with ESRGAN, exposing `n_blocks`, `growth_channels`,
47
+
and `res_scale` so you can dial in deeper receptive fields and sharper textures.
45
48
***Advanced variants (`SRGAN_advanced.py`).** Provides additional block implementations and compatibility aliases exposed in
46
49
`__init__.py` for backwards compatibility.
47
50
48
51
Common traits across generators include configurable input channel counts (`Model.in_bands`), support for upscaling factors from 2× to 8×, and residual scaling to stabilise deeper networks.
49
52
50
53
## Discriminator options
51
54
52
-
`opensr_srgan/model/discriminators/` exposes two complementary discriminators:
55
+
`opensr_srgan/model/discriminators/` exposes three complementary discriminators:
53
56
54
57
***Standard SRGAN discriminator (`srgan_discriminator.py`).** Deep convolutional stack tailored for multispectral imagery. The
55
58
number of convolutional blocks is configurable through `Discriminator.n_blocks`.
56
59
***PatchGAN discriminator (`patchgan.py`).** Operates on local patches, which can improve high-frequency fidelity when training
57
60
with large images. The depth is controlled by `n_blocks` and defaults to three layers.
61
+
***ESRGAN discriminator (`esrgan.py`).** Deep VGG-style stack with configurable `base_channels` and `linear_size`; pairs well
62
+
with RRDB generators when perceptual sharpness is the priority.
58
63
59
64
Both discriminators use LeakyReLU activations and strided convolutions to progressively downsample the input until a real/fake logit map is produced.
Tune discriminator depth to match the generator capacity—too shallow and adversarial loss underfits, too deep and the training loop destabilises. These starting points mirror the architectures bundled with the repo:
|`standard`|`n_blocks = 8`| Mirrors the original SRGAN CNN with alternating stride-1/stride-2 blocks before the dense head.】|
132
+
|`standard`|`n_blocks = 8`| Mirrors the original SRGAN CNN with alternating stride-1/stride-2 blocks before the dense head. |
126
133
|`patchgan`|`n_blocks = 3`| Maps to the 3-layer PatchGAN (a.k.a. `n_layers`); increase to 4–5 for larger crops or when the generator is particularly sharp. |
134
+
|`esrgan`|`base_channels = 64`, `linear_size = 1024`| Deep VGG-style discriminator from ESRGAN; keep base width aligned with the generator feature count. |
127
135
128
136
When adjusting these presets, scale generator and discriminator together and monitor adversarial loss ramps defined in `Training.Losses` to keep training stable.
129
137
138
+
!!! note
139
+
When you pick `model_type: esrgan` or `stochastic_gan`, SRResNet-only keys such as `block_type`, `large_kernel_size`, or `small_kernel_size` are automatically ignored. The model factory prints a console notice so you know which settings were overridden.
140
+
130
141
## Optimisers
131
142
132
143
The trainer instantiates independent Adam optimisers for the generator and discriminator and enables a Two-Time-Scale Update Rule (TTUR) setup by default. The discriminator learning rate automatically defaults to a slower schedule than the generator, which keeps adversarial updates balanced without extra configuration.
0 commit comments