Images, language and games

Machine learning for image processing

Machine learning for image processing learns to denoise photos, sharpen low-resolution images and segment regions for later measurement. It also prepares scans for OCR and inspection, where success is judged by the downstream result as well as by appearance.

Where to start

Learn classical filters in OpenCV and scikit-image first, so you have a baseline a learned model must beat. Then learn PSNR and SSIM, and when a downstream measurement is the better test.

How machine learning is used in image processing

Removing noise from images

A network learns to map noisy images to clean ones from pairs of examples, often by predicting the noise and subtracting it. Learned denoisers can handle noise levels and patterns that fixed filters smooth away with the detail.

Real example: DnCNN. DnCNN is a deep residual CNN that learns to remove Gaussian noise and was also applied to super-resolution and JPEG deblocking.

Super-resolution

Models learn to rebuild a sharper, higher-resolution image from a low-resolution one by training on pairs created by downscaling. This is used to enlarge photos, restore archives and improve video frames.

Real example: SRCNN. SRCNN was an early deep CNN that learned an end-to-end mapping from low-resolution to high-resolution images.

Low-light and phone photography

Phone cameras combine several short exposures and use learned models for steps such as white balance in difficult light. Research models also learn the whole pipeline from raw sensor data to a finished image.

Real example: Google Pixel Night Sight. Google describes a learning-based auto white balance algorithm in Night Sight, trained to tell well-balanced images from poorly balanced ones in dim or strongly coloured light.

Segmentation for measurement

Segmentation networks mark which pixels belong to a cell, a crack or a region, so their size and shape can be measured. U-Net style models work well even with modest numbers of annotated images.

Real example: U-Net. U-Net is a convolutional network for biomedical image segmentation, designed to train from few annotated images with heavy data augmentation.

Can you learn machine learning for image processing?

Yes. Image processing with machine learning builds on Python, array maths and CNNs, and many projects can start from published pretrained models. Learn classical filtering and image arrays first, then CNNs, then task metrics such as PSNR and SSIM.

  1. Python and image arrays. Load, crop, convert colour spaces and apply simple filters with NumPy, OpenCV or scikit-image. Taught in the Python track of Foundations of AI
  2. Maths for filtering. Convolution, gradients and linear algebra explain both classical filters and the layers of a CNN. Taught in the Maths track of Foundations of AI
  3. Neural networks and CNNs. Train encoder-decoder networks that take an image in and produce an image out, using pixel losses. Covered by the Deep Learning course (coming next)
  4. Image quality metrics. Measure results with PSNR and SSIM, and check the downstream task, such as OCR accuracy, as well as how the image looks.

Moving into machine learning for image processing

If you already work in the field

If you work in imaging, photography, microscopy or signal processing, you already understand noise, blur and optics. Add PyTorch and a pretrained restoration or segmentation model, then compare it with the classical method you use today on your own images.

If you come from data science or ML

If you come from machine learning, learn how sensors, compression and optics create the artefacts you are trying to fix. Classical filters are strong baselines, so always compare against them.

Roles that do this work: Image processing engineerComputer vision engineerImaging scientistCamera software engineer

Tools you will use

ToolWhat you use it for
OpenCVRun classical filters, denoising, thresholding and geometric transforms as baselines and preprocessing.
scikit-imageApply filters, segmentation and quality metrics such as PSNR and SSIM in Python.
PillowOpen, convert and save image files when building datasets and pipelines.
KorniaRun differentiable filters, colour conversions and augmentations on the GPU inside PyTorch models.
TorchMetricsCompute image-quality metrics such as PSNR and SSIM consistently during training and evaluation.

Public data to practise on

  • DIV2K: High-resolution images with downscaled versions, built for super-resolution and handy for denoising experiments.
  • SIDD (Smartphone Image Denoising Dataset): Noisy smartphone photos paired with ground-truth images, for training and testing denoisers on real camera noise.
  • BSDS500: Natural images with human-drawn boundaries and segmentations, for edge detection and segmentation experiments.

Your first project

Download DIV2K, train a small denoising CNN on the training images with added Gaussian noise, and compare it with OpenCV's non-local means filter on the validation images using PSNR and SSIM.

Keep the result, your code and a short note on what didn't work. That record is worth more than the score.

Common questions

What is the difference between image processing and computer vision?
Image processing usually produces a better or transformed image, such as a denoised photo. Computer vision extracts information, such as labels, boxes or measurements, though the two overlap heavily.
Is classical image processing still worth learning?
Yes. Filters, thresholds and morphology are fast, need no training data, and are the baselines that learned models must beat.
Can deep learning invent detail that was not in the image?
Yes. Super-resolution and restoration models can produce plausible detail that was not captured, so their output should not be treated as measurement in scientific or legal settings.

First Principles, the SchoolWhool newsletter

One machine learning idea, explained properly, every week.

The intuition, the common mistake, and a five-minute way to try it yourself. Written by Gaurav.

Learn the machine learning behind it, from first principles.

Start with Python from zero, free. Every stage after that builds on the last, and a person answers your doubts.