PATCHGAN PARADOX/ brats-2020
Dataset BraTS 2020 · 369 volumes Ablation Models A–D Runs 5 × 35 epochs Compute 12.2 GPU-h Author Dhruv Gupta · Bennett University
Notebooks

Eight Kaggle runs, rendered in full

Nothing is summarised away. Each notebook below is the complete original — every code cell, every printed epoch, every figure, exactly as it executed on Kaggle. Use these to check any number quoted elsewhere on this site.

Total 583 cells Figures 115 rendered outputs Compute logged 12.2 GPU-hours
Models A–D

One notebook per ablation stage

The five configurations compared throughout the study, in the order they were run. Each is the complete original notebook — open one to check any figure quoted on this site.

Model A · baseline

U-Net baseline on BraTS 2020

The foundation of the whole study: data exploration across all four MRI sequences, the memory-safe DataGenerator, the Dice and per-class metric suite, the U-Net definition, 35 epochs of training and the full test-set evaluation.

Result
Dice 0.6124 · accuracy 99.27 % · 25.38 dB
Runtime
88.3 min · 88 cells · 21 figures
Model D · the Goldilocks Zone

cGAN with a 4×4 kernel, stride 2

The champion architecture. 4 ÷ 2 = 2, so feature extraction is symmetric and no artefacts appear. Replaces model.fit() with a hand-written tf.GradientTape loop updating generator and discriminator in one compiled step.

Result
25.9556 dB · SSIM 0.9583
Runtime
137.2 min · 64 cells · 13 figures
Model B · checkerboard artefacts

cGAN with a 3×3 kernel, stride 2

A pix2pix-style patch critic emitting a 16×16 verdict grid, with batch normalisation from the second block. Because 3 does not divide by 2, coverage alternates 2, 1, 2, 1 and checkerboard artefacts appear in the mask. Includes the three-way comparison table against Model A and Model D.

Result
24.6395 dB · SSIM 0.9510 · 4,623 tumour slices
Runtime
148.0 min · 64 cells · 11 figures
Model C · the PatchGAN Paradox

cGAN with a 3×3 kernel, stride 1 + pooling

Removes the stride artefacts with stride-1 convolutions and max-pooling — and reaches the best local segmentation loss in the study (0.035) alongside the worst global SSIM (0.934). The discriminator loss climbs from 9.06 to 12.48 across training. The clearest demonstration of the paradox, and worth reading in full.

Result
21.6154 dB · SSIM 0.9341 · 4,524 tumour slices
Runtime
211.1 min · 63 cells · 11 figures
Model D + CLAHE

cGAN 4×4 with a CLAHE-enhanced pipeline

Takes the winning critic and upgrades the data generator with contrast-limited adaptive histogram equalisation (clip 2.0, 8×8 tiles) and a 3×3 elliptical morphological kernel. Saves final_champion_model.keras.

Result
24.7633 dB · SSIM 0.9582
Runtime
147.5 min · 62 cells · 12 figures
Model D · evaluation pass

cGAN 4×4 — PSNR / SSIM evaluation

The evaluation pass for the winning model: reloads the saved generator, filters the validation set to slices that actually contain tumour, and computes structural metrics against the expert masks.

Purpose
produces the 25.9556 dB / 0.9583 figures
Size
64 cells · 5 figures

Reading the notebooks

Each notebook page carries a sticky table of contents built from its own markdown headings, so you can jump straight to the model definition, the training loop or the evaluation. Figures open full size on click. Long console outputs — the 35-epoch training logs in particular — scroll inside their own frame rather than stretching the page.

Where each notebook came from

All eight were developed and executed on Kaggle with GPU acceleration, against the brats20-dataset-training-validation dataset. Absolute Kaggle paths such as /kaggle/input/… are left intact rather than rewritten, so the code you see is the code that ran.

Running them yourself. The notebooks expect the BraTS 2020 training set at /kaggle/input/brats20-dataset-training-validation/. To run locally, change TRAIN_DATASET_PATH to your copy and install tensorflow, nibabel, opencv-python, scikit-image and scikit-learn. A full 35-epoch run needs roughly 1.5–3.5 GPU-hours depending on the variant.

Two known quirks in the originals

  • The first cell of every notebook raises ModuleNotFoundError on tensorflow.keras.layers.experimental — a Keras 3 removal. It is harmless: that import is never used, and every later cell runs normally.
  • A few markdown cells reference images via Kaggle attachment: URIs that do not survive export. Those inline references are hidden on this site; the figures they described are reproduced on the architecture page as accurate diagrams instead.

Download the raw .ipynb files from GitHub →