Skip to content
← University

Image restoration for cervical cytology

Removing blur and noise from cervical cytology images, comparing a variational method (Total Variation), a UNet and a diffusion based method (DiffPIR) on the same benchmark.

Role
Co-author, with Paolo Fusco
When
June 2026
Course
Computational Imaging, MSc Computer Science
Stack
Python, PyTorch, scikit-image, NumPy, Jupyter
Side by side comparison of a cytology image: ground truth, degraded input, and the Total Variation, UNet and DiffPIR reconstructions at noise level 0.05

Context

Liquid based cytology (LBC) slides are used to screen for cervical cancer. Digitised slides can be blurred by focus problems and corrupted by sensor noise, and both make the cells harder to read. Recovering a clean image from a degraded one is a classic inverse problem: the degradation is known, but undoing it is unstable, because many clean images could have produced the same blurred and noisy observation.

This was a two person project with Paolo Fusco.

Setup

We used the Mendeley LBC Cervical Cancer dataset (962 images, resized to 256 by 256). Each image was degraded with a 9 by 9 Gaussian blur (σ = 2) followed by additive white Gaussian noise at four levels, from σ = 0.005 to σ = 0.1. All methods received exactly the same degraded inputs, with a fixed seed, and were scored with PSNR and SSIM from scikit-image.

The three methods

Total Variation (variational). Finds the image that best explains the observation while penalising the total variation, which favours piecewise smooth images with sharp edges. No training is needed, but the regularisation weight has to be chosen; we used a single value for all noise levels.

UNet (end to end). A compact UNet (about 1.9 million parameters, GroupNorm, conditioned on the noise level) trained with an L1 loss to map degraded images straight to clean ones. Training took 50 epochs on a CPU.

DiffPIR (generative). A diffusion model used as a learned prior, combined at each sampling step with a data fidelity term computed with the FFT. We trained our own lightweight denoising network (about 1.26 million parameters) on the LBC images.

Results

Noise σ TV (PSNR / SSIM) UNet (PSNR / SSIM) DiffPIR (PSNR / SSIM)
0.005 32.09 dB / 0.911 29.58 dB / 0.896 15.80 dB / 0.356
0.01 32.04 dB / 0.909 29.57 dB / 0.895 16.48 dB / 0.407
0.05 30.42 dB / 0.837 29.37 dB / 0.874 22.77 dB / 0.722
0.1 26.54 dB / 0.586 28.72 dB / 0.821 25.60 dB / 0.797

Total Variation is the best at low noise, but it degrades quickly as noise grows, partly because its regularisation weight was fixed. The UNet is the most stable across noise levels and takes about 13 ms per image at inference, against about 0.65 s for DiffPIR. Our DiffPIR setup, with the small prior we could train, scored lowest overall and behaved unusually: its results improved as noise increased instead of getting worse.

Engineering

The code is organised as a small library (degradation, methods, metrics, plotting) with scripts to run each method, notebooks for exploration and 34 unit tests. The original brief mentioned a dataset of 4,000 images; the public dataset has 962, and we used all of them.

← All projects