Ansh SinghalAI/ML & backend engineer
Remote sensing · Generative AI

Flood-GAN

A physics-aware conditional GAN that turns all-weather Sentinel-1 radar into optical-style imagery and a water mask, so floods can be mapped through cloud.

Code on GitHub
31.25PSNR (dB)
0.94SSIM
~0.05L1 loss

Overview

Floods come with clouds, and clouds blind optical satellites exactly when maps are needed most. Radar sees through them but is hard to read.

Flood-GAN translates Sentinel-1 radar into Sentinel-2-style optical images and predicts where the water is, with losses that encode how radar and water actually behave.

The problem in one picture

Sentinel-1 radar image of flooded farmland in SpainSentinel-1 radar
Sentinel-2 optical image of the same flooded farmland in SpainSentinel-2 optical
Real radar and optical images of the same flooded farmland in Spain, from the Sen1Floods11 dataset. Flood-GAN learns to go from the left to the right. Contains modified Copernicus Sentinel data.

Model

Radar input is two polarizations, VV and VH, each cleaned with a 5×5 Lee speckle filter. The generator is a U-Net, an encoder-decoder with skip connections and a self-attention block at the bottleneck, and it outputs four channels: three for the optical image and one for the water mask.

A PatchGAN discriminator judges realism patch by patch, trained with a least-squares GAN loss and label smoothing for steadier gradients.

Physics-aware losses

The generator is trained on a weighted sum of five terms:

LossWhat it enforcesWeight
Adversarial (LSGAN)Outputs that look real to the discriminator1
Masked L1Pixel accuracy, but only on cloud-free pixels, so partly cloudy scenes still teach100
Masked perceptual (VGG)Natural texture and structure on clear regions10
Speckle preservationNo invented texture where the radar is smooth, such as calm water (Sobel gradients)1
Water consistencyThe water mask matches the labels, and the image’s water index agrees with it5

Weights from the training config in the repository.

Training

Trained with PyTorch Lightning on 512×512 chips in 16-bit mixed precision, using Adam at a 2e-4 learning rate (β1 = 0.5) and batch size 8 for up to 200 epochs, with a Prometheus and Grafana stack for monitoring.

More projects

Let's build something secure.

I'm an AI/ML and backend engineer in Greater Noida, Delhi NCR, open to AI/ML, backend, AI security and GenAI roles in Noida, Gurugram, Bengaluru or remote.

Hire meDownload resumeBack to the portfolio