Sub topic 1
What You Are Labelling: Detection and Segmentation Task Types
Prerequisites
This chapter assumes you know basic Python, can read JSON, and understand that an image is a grid of pixels with a width and height. You should also know that supervised models learn from labelled examples.
Task Types
Each task type asks for a different kind of label.
- Classification: one label per image, such as "cat".
- Object detection: a class and a bounding box for each object. A bounding box is a rectangle that encloses the object.
- Semantic segmentation: a class for every pixel. Two cars share one "car" class and are not separated.
- Instance segmentation: a class and a separate mask for each object, so two cars get two masks.
- Panoptic segmentation: combines both. Every pixel gets a class, and countable objects also get instance IDs.
Pick the cheapest task that answers the product question. Boxes are faster to draw than masks.
Defining Classes and a Label Taxonomy
A label taxonomy is the list of classes and how they relate. Give each class a name, a short definition, and one positive and one negative example. Decide whether "van" is its own class or part of "car". Keep the list flat unless a hierarchy helps the people who use the model. Record every decision in one file that the whole team reads.
Writing Labelling Guidelines
Guidelines tell annotators what to do in hard cases. Cover three cases explicitly.
- Occlusion: the object is partly hidden. Rule example: label only the visible part.
- Truncation: the object runs past the image edge. Rule example: clip the box to the image border.
- Ambiguity: the object is unclear, such as a reflection or a tiny blur. Rule example: skip objects under 16 pixels on the short side, or use an "uncertain" flag.
Test the rules on about 50 images before labelling the full dataset. Revise any rule that two annotators read differently.
Pixel Coordinates, Origins and Normalisation
Image coordinates start at the top-left corner, (0, 0). x grows to the right and y grows downward. Formats differ in layout and units:
| Format | Box layout | Units |
|---|---|---|
| COCO | [x_min, y_min, width, height] | pixels |
| YOLO | [x_center, y_center, width, height] | fractions of image size |
| Pascal VOC | [x_min, y_min, x_max, y_max] | pixels |
To normalise, divide x values by the image width and y values by the image height. For a COCO box [50, 40, 100, 50] in a 640 x 480 image, the YOLO x_center is (50 + 100 / 2) / 640 = 0.15625.
Exercise
A COCO box is [50, 40, 100, 50] in a 640 x 480 image. What is its YOLO y_center?
Show answer
(40 + 50 / 2) / 480 = 65 / 480 ≈ 0.1354