Watermark Removal with Pix2Pix GAN
Trained on synthetic paired data · Pix2Pix GAN removes diverse watermarks and restores full-resolution images via overlapping-tile inference
Oct 2024
L1 + Adversarial
Loss
Tiled (overlap)
Inference
Problem
Removing diverse watermarks from high-resolution images while preserving fine texture detail — with zero paired real-world training data available. Standard inference breaks on large images due to memory constraints, requiring a solution that handles both data scarcity and full-resolution output without artifacts.
Approach
Synthesized a large paired training dataset by programmatically overlaying diverse watermark patterns (varying opacity, scale, position) — solving the zero-label problem without manual annotation.
Trained a Pix2Pix conditional GAN with combined L1 + adversarial loss to reconstruct clean images while preserving fine textures that a plain L1 objective would blur.
Engineered overlapping-tile inference for high-resolution inputs: split images into overlapping patches, processed independently, then stitched with blending — eliminating seam artifacts across the full-resolution output.
Results
Removed diverse watermark types (text, logos, semi-transparent patterns) with no real-world labelled data required.
Preserved fine texture details via combined L1 + adversarial objective — outperforming a pure L1 baseline in perceptual quality.
Produced seamless full-resolution output via overlapping-tile inference, eliminating memory constraints that break naive high-res inference.
Architecture Overview
Synthetic dataset generation
Pix2Pix Generator (U-Net) + PatchGAN Discriminator
L1 + GAN loss
Overlapping tile inference
Patch blending
Full-resolution output
How to Run
Install dependencies: pip install -r requirements.txtGenerate synthetic dataset: python generate_dataset.py --input <clean_images/>Train model: python train.py --epochs 200 --batch-size 16Run inference: python infer.py --input <watermarked.jpg> --output <clean.jpg>