All Projects
Computer Vision
Generative AI

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

1

Synthesized a large paired training dataset by programmatically overlaying diverse watermark patterns (varying opacity, scale, position) — solving the zero-label problem without manual annotation.

2

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.

3

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

01Install dependencies: pip install -r requirements.txt
02Generate synthetic dataset: python generate_dataset.py --input <clean_images/>
03Train model: python train.py --epochs 200 --batch-size 16
04Run inference: python infer.py --input <watermarked.jpg> --output <clean.jpg>

Tech Stack

PythonPyTorchPix2PixGANImage TilingOpenCV