Skip to content
AI Engineering
Applied AI

Computer vision in practice

Computer vision means models that work with images and video. In practice, the hard parts are the data, the cost of mistakes and the camera.

Chapter 14: Applied AILesson 4 of 8Level: CoreAbout 14 min
Words on this page (11)
computer vision
: Getting models to work with images and video: classifying, locating objects and reading text.
segmentation
: A vision task that labels every pixel by which object it belongs to.
OCR
: Optical character recognition: turning an image of text into real text.
fine-tuning
: Further training on a smaller, targeted set of examples to change behavior or style.
recall
: Of the truly positive cases, the share the system found.
precision
: Of the cases a system flagged, the share that were truly positive.
tool
: A function the model can ask your program to run, described by a name, description and argument schema.
training
: Adjusting a model's parameters on data so its predictions improve.
IoU
: A score for a predicted box: the overlap area divided by the combined area of the predicted and true boxes. 1 is a perfect match, 0 is no overlap.
calibration
: Whether a model's confidence matches how often it is right. A well calibrated model is right about 90 percent of the time when it says 0.9.
weights
: The learned numbers that define a trained model. A model whose weights are published is called open-weight.

What it is

The main jobs are classification (what is in this image), detection (where are the objects, drawn as boxes), (which pixels belong to which object) and reading text (). Modern systems start from a model pretrained on millions of images and it on a few hundred of your own, which makes small projects possible. Vision-language models can also answer questions about an image in plain words, which is often enough for simple cases.

Where it is used

Factories check parts for defects on a conveyor belt. Farms spot diseased plants from drone photos. Hospitals use models that flag suspicious areas on scans for a doctor to review. Banks read cheques and invoices. Phones unlock with a face. In each case a human usually reviews the uncertain cases.

A worked example: a screening test

A hospital screens 1,000 scans. Ten show disease. The model finds 9 of the 10 ( 90 percent) and raises 50 false alarms. It flagged 59 scans, of which 9 are real, so is 9 / 59, about 15 percent. That can still be a good screening , because a doctor reviews 59 scans instead of 1,000 and only 1 case was missed. The numbers decide whether it helps, not the headline accuracy.

What goes wrong

Models learn shortcuts. A classifier trained on photos from one hospital may be reading the scanner's label, not the disease. A model trained in good light fails at night. Always test on images from a different place and time than the set, and keep checking after launch because cameras and conditions change.

How a detection gets scored

A detector draws a box. To grade it, compare with the true box using , or IoU: the overlap area divided by the combined area. Say the true box covers x from 0 to 10 and y from 0 to 10, and the prediction covers x from 5 to 15 and y from 0 to 10. The overlap is 5 × 10 = 50. The union is 100 + 100 - 50 = 150. IoU is 50 / 150 = 0.33. Teams choose a cutoff, often 0.5, and count a box as correct only above it. This is why a box that "looks about right" can still count as a miss.

Routing by confidence

A model gives each image a score between 0 and 1. Invented example with 1,000 images: 800 score above 0.9 and pass automatically, of which 4 are wrong (0.5 percent). The other 200 go to a person, and 30 of them are wrong, which the person fixes. People handle 20 percent of the load, and, if the reviewer catches every error, the final error rate is 0.4 percent. The catch is : whether a score of 0.9 really means 90 percent right. To check, group past predictions by score and compare each group's true accuracy with its score. Models are often too sure of themselves.

When a simple sensor wins

A packing line needs to know whether a box has a bottle in it. A sensor or a light beam answers in a fraction of a millisecond, costs little and does not care about lighting. Use vision when the question depends on appearance, such as a scratch or a label. If a cheaper signal answers the question, use that.

Common mistake

Training and testing on images from the same camera session. The score looks great and falls apart in the real world.

Check yourself

What does object detection return?

Why can a model with low precision still help in screening?

A model works in the lab but fails on the factory floor. A likely cause?

Go deeper

Spotted a mistake or something unclear? Report it on GitHub.

On this page