Computer vision · comparative study

Four ways to colour
a black-and-white photo.

Upload a grayscale image, pick a colorizer, and see the result with its PSNR, SSIM and MSE. Two of the four methods are deliberately weak baselines — because a comparison with only strong entrants tells you nothing about the metric.

Gradio · PyTorch · TensorFlow · DeOldify · OpenCV · scikit-image

What the network actually predicts

Grayscale in, two channels out, recombined.

  1. LLuminancetaken straight from the grayscale input, never predicted
  2. AGreen ↔ redpredicted, tanh output scaled by 128
  3. BBlue ↔ yellowpredicted, tanh output scaled by 128

Recombined through lab2rgb. The model only ever learns colour — the detail in the photograph is the input's, untouched.

  • 4

    colorization methods explored

  • 22

    paired training images

  • 1.33M

    autoencoder parameters

  • 100

    training epochs

  • 3

    metrics per result

  • 128²

    input resolution

The problem

Plenty of colorizers exist. Comparing them is the hard part.

Old and scientific images are often grayscale, and colouring them by hand is slow and subjective. Automated methods behave very differently from one another, and each paper reports its own numbers on its own images — which makes it hard to tell what will work on yours.

This puts four approaches behind one interface, running on the same image, scored with the same metrics. Including the weak ones is the point: seeing a false-colour colormap land at 7–15 dB while a pretrained model reaches 16–30 dB tells you as much about the metric as it does about the models.

What it does

One dashboard, four backends, three numbers.

  • Model switcher

    Pick a colorizer from one radio group and run the same image through any of them without touching code.

  • Pretrained DeOldify

    The artistic generator at render factor 35 — the method that actually produces photorealistic colour.

  • Autoencoder built from scratch

    A 1.33M-parameter encoder–decoder trained in LAB space to predict the two colour channels from luminance.

  • Metrics on every result

    PSNR, SSIM and MSE are computed and shown alongside the image, so quality is a number and not a vibe.

  • LAB colour pipeline

    The network predicts AB only and recombines with the input's own luminance, rather than regressing all three RGB channels.

  • Drop an image, get a result

    A Gradio interface with an upload target, a model choice and a metrics readout. No install to try it.

Under the hood

Four methods, and what each one is actually for.

Choose a colorization model

The local dashboard runs the first two offline. DeOldify and the trained autoencoder need artifacts that aren't committed to the repository.

DeOldify

ColorizeArtistic_gen · render_factor=35

strong result

The pretrained artistic generator, used as-is at render factor 35. It is by a wide margin the best output here, and the only method that produces photorealistic colour. It is also the heaviest call — a ResNet34-backed U-Net that writes and re-reads a temporary JPEG per request.

Observed across 22 images

OpenCV colormap7.0–15.1
PyTorch CNNnot recorded
DeOldify16.0–30.0
LAB autoencodernot recorded

These two evaluations were not run identically — DeOldify was scored against the full-colour reference, the colormap against grayscale versions of both images. Read the gap as directional, not as a like-for-like benchmark. Single-run values, not a controlled experiment.

Three decisions worth defending

Problem framing

Predict the colour channels, not the whole image.

The obvious approach is to regress RGB from grayscale. This does something better posed: convert to LAB, feed the network the L channel, and have it predict only A and B — then recombine with the original L untouched. The grayscale input already is the luminance, so asking the model to reproduce it wastes capacity and risks degrading detail it was handed for free. The output layer is tanh with AB targets normalised by 128, which matches the channel range exactly.

PDF p.67–71, p.98

Baselines

Two of the four methods are meant to be bad.

The JET colormap and the untrained CNN are not competitors — they are controls. The colormap shows what a metric records when the output is false colour rather than inferred colour, and the untrained network shows the serving path working with no learned weights behind it. Reporting them next to DeOldify is what makes the 7–15 dB versus 16–30 dB gap mean something. A comparison with only strong entrants tells you nothing about the metric.

PDF p.48–49

Known flaw

The dashboard's metrics don't really measure colour.

calculate_metrics converts both the result and the reference to grayscale before computing PSNR and SSIM. Since colorization preserves luminance by construction, that comparison is close to measuring nothing — two wildly different colorizations of the same photo would score almost identically. DeOldify's separate evaluation does use the full-colour reference, which is why those two sets of numbers are not comparable. The fix is to score in RGB or use a colour-aware metric; lpips is already installed and unused.

PDF p.98 vs p.19

Stack

Serving
Gradio 5.7.1Google Colabtemporary share link
Models
DeOldify (fastai 1.0.61)PyTorch 2.5.1 + cu121TensorFlow / Keras 2.17.1
Vision
OpenCV 4.10scikit-image 0.24 (LAB, PSNR, SSIM)NumPy 1.26Pillow 11
Data
22 grayscale/colour pairs17 / 5 train-validation split128 × 128 inputs

Honest limitations: the autoencoder trained on 17 images, which is one batch per epoch — it is a learning exercise, not a production model. The dashboard's metric methodology measures structure more than colour. Per-image latency and aggregate autoencoder scores were never measured.