Course contentsShow
← AI Engineering
Lesson 1657 of 1,88640. Computer Vision DeploymentFree lesson

Response Formatting and Postprocessing

Transform model outputs into application-friendly formats: bounding boxes, segmentation masks, and class probabilities.

Response Formatting and Postprocessing

You'll learn how to transform raw model outputs into clean, application-ready structures like bounding boxes, segmentation masks, and class probabilities.

When your deployed vision model completes inference, it doesn't return nice, neat results automatically. You get raw tensors—arrays of numbers that represent predictions but aren't directly usable by your application. A classification model might output logits, an object detector returns coordinates in normalized space, and a segmentation model produces pixel-wise class indices. Your job is to convert these into formats your application (or users) can actually consume.

The Core Transformation

Classification outputs need conversion from logits or raw scores to human-readable class names with confidence percentages. You apply softmax if needed, sort by confidence, and map indices to labels.

Object detection outputs require translating normalized coordinates (often 0–1 range) back to pixel coordinates matching the original image dimensions. You also filter predictions by confidence threshold and apply Non-Maximum Suppression (NMS) to remove duplicate boxes.

Segmentation masks need conversion from class indices to visual masks or polygons. You might colorize the mask for visualization or extract contours for downstream processing.

Why This Matters

Your frontend developer doesn't want a numpy array of shape (1, 1000) with raw logits. They want {"class": "golden_retriever", "confidence": 0.94}. Your mobile app can't use normalized coordinates—it needs pixel-perfect bounding boxes to draw on screen.

Think of it like a translator: the model speaks in mathematical tensors, but your application speaks in JSON, coordinates, and human labels. Postprocessing is the bridge.

Key Takeaway:
Postprocessing transforms raw model tensors into application-friendly formats—applying thresholds, coordinate conversions, label mappings, and filtering to deliver actionable results.