Faithful implementation of the original U-Net architecture with weight maps, elastic deformation, and full training pipeline — based on the 2015 paper.
This project is a deep, from-scratch reimplementation of the original U-Net: Convolutional Networks for Biomedical Image Segmentation paper (Ronneberger et al., 2015).
The implementation is divided into beginner-friendly Kaggle notebooks, each dedicated to a core component of the original architecture and training setup — no shortcuts, no black boxes.
📌 This repository serves as a landing page to the full notebook series and highlights what makes this implementation faithful to the original work.
| Part | Description | Link |
|---|---|---|
| Part 1 | U-Net Architecture from Scratch | 🔗 Notebook |
| Part 2 | Elastic Deformation & Augmentation | 🔗 Notebook |
| Part 3 | Weight Map Generation | 🔗 Notebook |
| Part 4 | Dataset Preparation | 🔗 Notebook |
| Part 5 | Training Loop & Results | 🔗 Notebook |
| Bonus | Elastic Deformation Explained in Depth | 🔗 Notebook |
📌 Each notebook is structured, well-commented, and designed to be accessible for learners and reproducible for practitioners.
- ✅ Full U-Net architecture built from scratch, exactly as described in the original paper
- ✅ Implements elastic deformation using custom displacement fields and Gaussian smoothing
- ✅ Includes pixel-wise weight map generation to emphasize borders and handle class imbalance
- ✅ Reproducible data preparation pipeline: train/validation split, augmentation, and TFRecord generation
- ✅ Trains on 25,000+ augmented images using Kaggle TPUs for massive speedup (TPU-VM v3-8)
- ✅ Covers learning rate scheduling, callbacks, and checkpointing in training
- ✅ Clean modular split: architecture · augmentation · weight maps · data prep · training
- ✅ Uses public biomedical datasets (e.g. ISBI-style microscopy)
- ✅ Beginner-friendly walkthroughs — with motivation, visualizations, and linked components
Most public U-Net implementations deviate from the original 2015 paper in critical ways.
This project avoids those shortcuts and replicates the original design as closely as possible:
- ❌ Uses
padding='same'in conv layers
✅ Uses valid convolutions with manual input mirroring and padding to preserve spatial structure - ❌ Assumes auto-alignment of encoder–decoder paths
✅ Performs explicit cropping to align encoder feature maps during concatenation - ❌ Skips weight maps entirely
✅ Includes pixel-wise weight map generation to emphasize border regions (as per the paper) - ❌ Ignores elastic deformation
✅ Implements elastic deformation from scratch usingscipy.ndimage, matching the paper's core augmentation strategy for biomedical images
📌 This implementation is not just functional — it’s pedagogically faithful to the original U-Net design. If you're comparing U-Net repos, this one aims to teach why each detail matters.
- Python · TensorFlow · Keras · NumPy · SciPy (
scipy.ndimage) · Matplotlib - Kaggle Notebooks for training and TPU execution
- Open-source biomedical datasets (e.g., ISBI, Cell Nuclei)
Ronneberger, Olaf, Philipp Fischer, and Thomas Brox.
"U-Net: Convolutional Networks for Biomedical Image Segmentation."
arXiv preprint arXiv:1505.04597 (2015)
U-Net · Semantic Segmentation · Biomedical Imaging · Deep Learning · Paper Reimplementation · Elastic Deformation · Keras · Image Segmentation
This repo currently links to well-structured Kaggle notebooks.
A PyTorch/Keras codebase version may be added in the future. ⭐️ Watch the repo to get notified.