Who this is for
Computer Vision Engineers and ML practitioners who need models that stay reliable when images are blurry, noisy, or compressed.
Prerequisites
- Basic Python and image concepts (pixels, channels, 8-bit ranges)
- Familiarity with convolutions, kernels, and augmentation basics
- Knowing when your task is classification, detection, or segmentation
Why this matters
Real-world images are messy. Cameras shake, sensors are noisy, and JPEG compression introduces artifacts. If your model only sees pristine images, it can fail in production. You will:
- Diagnose blur, noise, and compression artifacts in datasets
- Apply the right fixes when cleaning data
- Design augmentations so models generalize to harsh conditions
Real tasks you will face
- Retail cameras: motion blur at night; you must train a detector that still finds people
- Mobile app: user uploads are heavy-compressed; your classifier should remain stable
- Robotics: sensor noise varies; you must tune denoising without erasing edges
Concept explained simply
Think of images as signals. Three common degradations:
- Blur: details are smeared (defocus or motion). High-frequency edges weaken.
- Noise: random pixel fluctuations (Gaussian, Poisson, speckle, salt-and-pepper).
- Compression artifacts: patterns from lossy coding (JPEG blockiness and ringing).
Mental model
Use the Detect–Decide–Do loop:
- Detect: measure signals that reveal issues (edge energy, local variance, block patterns).
- Decide: is it too degraded to train or infer on? Fix or filter out.
- Do: apply the most appropriate filter or add realistic augmentation.
Quick reference: best tools by problem
- Blur detection: variance of Laplacian (low value suggests blur)
- Blur handling (light): unsharp mask or mild deconvolution
- Noise (Gaussian): Gaussian/bilateral/non-local means
- Noise (salt-pepper): median filter
- Poisson noise: variance-stabilizing transform (e.g., Anscombe) then Gaussian denoise
- JPEG artifacts: deblocking filters, mild total variation denoise
Detection toolbox
- Blur score: variance of Laplacian. Low value = weak edges = possible blur.
- FFT or wavelet energy: less high-frequency energy indicates blur or compression smoothing.
- Noise estimate: local variance in flat regions; impulsive outliers suggest salt-pepper.
- JPEG artifacts: visible 8Ă—8 grid blockiness and ringing near strong edges.
Thresholding tips
- Calibrate per dataset: compute metric distributions on a clean subset.
- Use relative thresholds (e.g., bottom 10% Laplacian variance = too blurry).
- Combine signals: do not rely on one metric alone.
Fixing and augmenting
Denoising choices
- Median filter: great for salt-and-pepper; preserves edges reasonably.
- Gaussian blur (small sigma): reduces Gaussian noise but can soften edges.
- Bilateral filter: denoise while keeping edges (tune spatial and range sigmas).
- Non-local means: strong denoising with detail preservation; slower.
- Total variation: removes noise and ringing, may flatten textures.
Deblurring and sharpening
- Unsharp mask: boost edges without large artifacts if done mildly.
- Wiener/Richardson–Lucy: deconvolution; helps when blur kernel is known/estimated.
- Motion deblur: estimate direction/length; avoid over-iteration to prevent halos.
Compression artifact reduction
- Deblocking: smooth block boundaries with mild spatial filtering.
- Edge-preserving denoise: bilateral or TV to reduce ringing.
- If possible, re-encode originals at higher quality.
Robust augmentation recipes
- Gaussian blur: kernel size 3–15, sigma 0.3–3.0
- Motion blur: length 3–25 px, random angle
- Gaussian noise: sigma 5–25 (on 0–255 scale)
- Salt-and-pepper: amount 0.01–0.1
- Poisson noise: sample from Poisson, or apply variance-stabilizing transform
- JPEG compression: quality randomly in [10, 90]
Safe augmentation tips
- Randomize only a subset per batch to avoid overfitting to heavy degradation.
- Keep a small clean fraction so the model still learns fine detail.
- Monitor validation under multiple corruption levels.
Worked examples
Example 1: Nighttime motion blur on surveillance
- Detect: variance of Laplacian is very low on many frames; edges are smeared horizontally.
- Decide: training needs robustness to motion blur.
- Do: add motion blur augmentation with random length 5–20 px and random angles; limit probability to 0.3 per image. Optionally unsharp mask for mild enhancement on training inputs, but avoid at inference unless validated.
Example 2: User-uploaded photos with JPEG artifacts
- Detect: 8Ă—8 block boundaries and ringing near high-contrast edges; high-frequency energy drop.
- Decide: do not over-smooth; preserve edges for face landmarks.
- Do: apply mild deblocking (bilateral with small spatial sigma). Train with random JPEG quality 15–85 so the model is robust to artifacts.
Example 3: Medical sensor noise (Poisson-like)
- Detect: noise scales with intensity; darker regions have less variance than bright ones.
- Decide: use variance-stabilizing transform to Gaussianize the noise.
- Do: apply Anscombe transform, denoise with small-sigma Gaussian or non-local means, invert transform. For robustness, simulate Poisson noise in augmentation on a fraction of training images.
Common mistakes
- Over-smoothing: denoising that erases edges harms detectors and segmenters.
- One-size-fits-all thresholds: metrics vary by dataset; calibrate.
- Always trying to fix: sometimes it is better to filter out unusable samples.
- Augmenting everything heavily: keep a balance; too much corruption slows learning.
- Sharpening aggressively: creates halos and amplifies noise.
How to self-check
- Before/after PSNR/SSIM on a validation set with synthetic corruption.
- Edge map sanity check: edges should be crisper, not haloed.
- Downstream metric: does mAP/IoU/F1 improve under corrupted validation?
Exercises
These mirror the exercises below. You can do them here and compare with the solutions.
Exercise 1: Design a robustness augmentation policy
Goal: Make a road-sign detector resilient to blur, noise, and compression without destroying fine detail.
- Choose 3–4 degradations and parameter ranges
- Set application probabilities
- Explain how you will validate the effect
Checklist
- Includes blur, noise, and JPEG compression
- Parameters are realistic (not extreme only)
- Validation covers multiple corruption levels
Exercise 2: Diagnose and fix a mixed-quality batch
You receive images with: (a) low variance of Laplacian; (b) impulse-like outliers; (c) visible 8×8 grid. Describe a Detect–Decide–Do pipeline.
Checklist
- Detect signals mapped to issues
- Decide which samples to filter vs. fix
- Do: concrete methods with safe parameters
Practical projects
- Build a corruption-robust validation suite: generate sets for blur, noise, and compression at 3 severity levels and track model metrics.
- Auto-quality gate: compute blur/noise/compression scores and flag images for review or filtering in your data pipeline.
- Adaptive preprocessing: per-image choose mild denoise, deblock, or no-op based on metrics; compare to a fixed pipeline.
Learning path
- Understand signals: edges, frequency, and common artifact patterns
- Master detection metrics: Laplacian variance, local variance, blockiness cues
- Apply targeted fixes: median, bilateral, NLM, unsharp, TV, deconvolution
- Design augmentations: set ranges and probabilities; keep clean fraction
- Evaluate properly: corrupted validation, edge maps, downstream metrics
Next steps
- Integrate your chosen policy into training and log metrics by corruption type.
- A/B test preprocessing vs. train-time augmentation only.
- Document thresholds and parameter ranges for teammates.
Mini challenge
Without changing your model, improve performance on a JPEG-corrupted validation set by 3–5% relative by adjusting only augmentations and preprocessing. Keep a record of each change and its effect.
Quick Test note: The quick test is available to everyone. If you sign in, your progress will be saved automatically.