Skip to content

KitPi/UNet

Repository files navigation

UNet

Creating a UNet Convolutional Neural Network for interactively colourising black and white photos.

Create Python virtual environment

python3 - m venv .venv

source .venv/bin/activate

pip install -r requirements.txt

Paper

Paper

Uni-Freiberg: Olaf Ronneberger: 18 May 2015

Debugger Cafe: Sovit Ranjan Rath: 3 April 2023

Modified to take greyscale photos as input, then output LUV colorised photos


Version 1

  • No BatchNorm
  • Image input and targets Normalized: $\mu$: 0.5, $\sigma$ 0.25
  • Epochs: 5
  • Mean Squared Error Loss
  • No dropout
  • Learning Rate: 5e-5

Training

Training loss (smoothed) / Time Training loss

Results

Results

Input Epoch 1 Epoch 2 Epoch 3 Epoch 4 Epoch 5 Ground Truth

Evaluation|300px


TODO


Version 2

Highly experimental trails of different error functions, normalisation methods, droput / no dropout

Proposal

  • Removed Image input and targets Normalized: $\mu$: 0.5, $\sigma$ 0.25
  • No normalisation
  • Improved Loss function: MSE + SSIM
  • BatchNorm on down conv, hints down conv, up conv, and hints up conv
  • Skip Connection Self Convolution on level 2, 3, 4, 5
  • Hintegration: Convolve hints, then integrate then convolve colour hints alongside down convolutions.
  • Dropout (not from school, from network)
  • Variable learning rate
  • Variable hints per epoch
  • 51,086,771 total trainable parameters.

Epoch 1

Num points = 150


Version 3

Proposal

61,508,906 total parameters.

Training

Loss / training

This image shows the first five training epochs in Green, where the Huber loss function was used. The next three training epochs are in Orange, where the MSError loss function was used. Each epoch was ~20k image batches. The lowest loss values do not necessarily reflect better visual results. Epochs 3-5 achieeved the better loss results recorded, but the visual accuracy of the images was degraded. Training with Huber loss allowed the model to train on higly variable data without incurring huge losses, but allowed later epochs to overtrain and lose accuracy. Switching to MSError after epoch 5 allowed the model to produce more accurate results.

Notes

This model improved upon the last version by fully implementing a hint convolutional feed-forward network. This model passes colour hints up the U-Net structure to higher complexity convolutional layers, allowing hint information to permeate the network at the highest levels. This version also removed the max-pooling layers, instead making down-convolutions that reduce channel size. The LAB colour-space was implemented in this version which is easier to train on than HSV colour-space. The first 5 epochs were trained with a Huber loss function, the last 3 epochs were trained on MSError loss functions. This allowed the network to train easily on high-variance data, later MSError was used to train the network back to expected results after epoch 5.

Results

Results

Evaluation

Evaluation

About

A Convolutional Neural Network U-NET for colourising Black and White images.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages