Teaching Machines to Understand Images
An introduction to computer vision systems and real-world applications — from classification to segmentation, and the edge-deployment patterns that make them reliable.
Computer vision is the part of AI that touches the physical world. A language model reads text; a vision model reads pixels — light, geometry, motion. It is how a factory line spots a defect, a drone finds a landing pad, and a medical scan flags a region for review.
The task ladder
- Classification — "what is in this image?" A single label per image.
- Detection — "what is here, and where?" Bounding boxes around each object.
- Segmentation — "which pixels belong to which object?" Pixel-precise masks.
- Tracking — "and how do those objects move across frames?" Identity over time.
A detection pipeline
A modern detector takes an image, scales it, and predicts boxes plus confidence scores. The non-maximum suppression step collapses overlapping boxes into a single detection per object.
import cv2
model = cv2.dnn.readNetFromONNX("yolo11n.onnx")
img = cv2.imread("line_sample.jpg")
blob = cv2.dnn.blobFromImage(img, 1 / 255.0, (640, 640), swapRB=True)
model.setInput(blob)
boxes, scores = model.forward() # raw predictions
# keep only confident, non-overlapping detections
keep = cv2.dnn.NMSBoxes(boxes, scores, 0.5, 0.45)
for i in keep:
x, y, w, h = boxes[i]
cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 200), 2)
cv2.imwrite("detected.jpg", img)
Running on the edge
Vision models live where the camera is — on the factory floor, in the vehicle, at the gate. That means constrained compute, intermittent connectivity, and no room for a 200ms round trip. Quantization and ONNX export shrink a model until it runs at 30 fps on an industrial edge box.
A vision system that needs the cloud to see is blind the moment the network blinks.— LAB-19 Bench
The reliable pattern: detect on the edge, aggregate in the cloud. The edge makes the millisecond decision; the cloud learns from thousands of edge decisions and pushes an improved model back down. The loop is the system.