← Image Processing for EveryoneToolsInVisionLearning Center
Restoration and Reliable Workflows · Lesson 15

Compression and Image Quality Metrics

Sending a smaller image is convenient until compression removes a detail your model needs.

Watch the lesson

Compression and Image Quality Metrics explained visually

1:26

Sending a smaller image is convenient until compression removes a detail your model needs. English captions are optional and start off. The complete transcript follows the written lesson.

Lesson overview

What you will learn

Sending a smaller image is convenient until compression removes a detail your model needs.

  1. Choose a storage tradeoff
  2. Use metrics with context
  3. Inspect what matters
  4. A worked example
01

Choose a storage tradeoff

We need to send inspection images to another team without losing tiny scratches. Smaller files are convenient, but the storage choice affects what can be recovered. Lossless compression reproduces the stored pixel values exactly after decoding. Lossy compression allows changes to save more space.

02

Use metrics with context

For photographs, a jay-peg copy can show blocks or ringing at stronger compression. For a label mask where zero, one, and two name three classes, altered pixel values can change the meaning entirely. Choose a format and loading path that preserve the mask's labels and data type. If transparency matters, check that it survives too.

03

Inspect what matters

Compare decoded copies against the same source. Mean squared pixel error measures differences after alignment; a structural score examines local patterns. Neither replaces an inspection of small scratches. A high overall score can hide one lost mark, and a slight shift can make pixel error large without destroying the scene.

04

A worked example

Keep a lossless master and test any viewing copies on the actual recognition task. Next, we'll combine our processing steps into one documented inspection pipeline.

Worked example

A mask uses values zero, one, and two for three classes. A lossy save could introduce other values or alter boundaries. A lossless save preserves the stored labels, provided the software also preserves the image mode and data type during loading and writing.

Knowledge check

Quick check: test your understanding

Try it yourself: Choose a format for an editable class-ID mask and one for a compact preview photograph. Explain the different goals.

Check the reasoning

Use a suitable lossless format for the mask. A JPEG preview may be acceptable when small size matters and the original remains available.

Does the highest whole-image quality score guarantee the best small-object visibility?

No. An average metric can underrepresent a small but important region.

How would you solve the practice case?

Use a suitable lossless format for the mask. A JPEG preview may be acceptable when small size matters and the original remains available.

What does the worked example show?

A mask uses values zero, one, and two for three classes. A lossy save could introduce other values or alter boundaries. A lossless save preserves the stored labels, provided the software also preserves the image mode and data type during loading and writing.

Further reading

Digital Image Processing, 4th edition — Rafael C. Gonzalez and Richard E. Woods.

Original ToolsInVision teaching examples. Editorial approach · Suggest a correction

Accessible referenceLesson 15 transcript174 words · Video transcript · Matches the published narration and captionsOpen transcript

We need to send inspection images to another team without losing tiny scratches. Smaller files are convenient, but the storage choice affects what can be recovered. Lossless compression reproduces the stored pixel values exactly after decoding. Lossy compression allows changes to save more space.

For photographs, a jay-peg copy can show blocks or ringing at stronger compression. For a label mask where zero, one, and two name three classes, altered pixel values can change the meaning entirely. Choose a format and loading path that preserve the mask's labels and data type. If transparency matters, check that it survives too.

Compare decoded copies against the same source. Mean squared pixel error measures differences after alignment; a structural score examines local patterns. Neither replaces an inspection of small scratches. A high overall score can hide one lost mark, and a slight shift can make pixel error large without destroying the scene.

Keep a lossless master and test any viewing copies on the actual recognition task. Next, we'll combine our processing steps into one documented inspection pipeline.