Guide · Introductory · 15 min read

Classification, detection or segmentation: how to choose

One decision flow from "do I need labels at all?" to panoptic segmentation, with what each label stores, what it costs to annotate and how it is scored, shown on the same image.

anastig editorial teamPublished

Choose the least detailed label from which you can still compute your decision. If a person can make the decision from the whole image at a glance, without counting, locating or measuring anything ("is this a product photo or a packaging photo?"), use classification. If you need to know where objects are or how many there are, use object detection with boxes. If you need outlines, areas or exact pixels, use segmentation; choose instance segmentation when touching objects of the same class must be told apart. Before any of that, check whether a fixed rule, a text or barcode reader, or an existing model already answers the question. If one does, you may not need new labels at all.

The same synthetic tray image of three bolts and one nut, two bolts touching, in six panels, each with the question it answers. Single-label classification: kit type B, which kind of image is this. Multi-label: bolt yes, nut yes, washer no, which classes are present. Detection: four boxes, where and how many; the bolt boxes are 26, 26 and 42 percent bolt pixels and boxes 1 and 2 overlap with IoU 0.10. Semantic segmentation: bolt and nut pixels, area per class, with only 2 connected bolt regions for 3 bolts. Instance segmentation: four separately numbered masks, count, outline and area per object. Keypoints: the face under each bolt head and its tip, giving shaft lengths of 106, 92 and 86 pixels.
Synthetic dataOne synthetic image labelled six ways, with the question each label can answer. The label types do not form a single ladder: semantic masks cannot count the touching bolts, and keypoints answer a question (length) that boxes and masks answer only indirectly. The numbers are computed from the drawn shapes.

Start from the question, not the model

Write down two things in one sentence each: the question the system must answer, and what someone does with the answer. "Reject the tray if any part is missing" needs counts per class. "Report the corroded share of each plate" needs pixels. "Sort incoming photos into twelve product groups" needs one class per image. The action tells you how much detail the label must carry. Any detail beyond that costs labelling time and adds new ways for annotators to disagree.

Then use the flow below. The questions are about the output the model must produce so that you can compute the decision, not about the decision itself. "Is the kit complete?" sounds like one yes/no for the whole image, but answering it means counting parts, so it is a counting question. Ask the questions separately for each class your decision depends on, then combine the answers.

Decision flow in four steps. Step 0: if thresholds, template matching, OCR, a barcode reader, a pre-trained model or similarity search already gives the output on your own hard images, no new labels. Step 1, asked for each class in order, first yes decides: A, decide from the whole image at a glance without counting, locating or measuring, gives image classification (single-label or multi-label; accuracy, macro-F1, AP or F1 per tag). B, named points for a length, angle or pose, gives keypoint detection (AP over OKS, error in mm or degrees). C, count or locate separate objects without outline or area, gives object detection (AP, count error). D, area of a region with no meaningful count, gives semantic segmentation (IoU per class). E, otherwise outline or area per object, gives instance segmentation (mask AP). Step 2 combines classes: D with E in the same images gives panoptic segmentation; D with C gives detection plus semantic segmentation; classes on B use keypoints. Step 3: if bad examples are too rare or varied to collect by type, use anomaly detection at image level (A) or pixel level (D or E), trained on good images, scored with ROC AUC and per-region overlap.
DiagramThe decision flow. Step 0 can end the project before any annotation starts. Step 1 is asked once per class, step 2 combines the classes, and step 3 switches to anomaly detection when bad examples are too scarce to label by type. Every worked decision and worksheet item on this page was run through an encoded copy of this flow.

The tasks are not one ladder in which each step contains the previous one. Only some of them nest:

  • An instance mask gives its box exactly, and a box shows that its class is present in the image.
  • A panoptic label contains both a semantic and an instance label.
  • A semantic mask does not give separate objects: touching objects of one class merge.
  • Keypoints are a separate branch; boxes and masks do not contain named points.
  • A holistic class such as "kit type B" does not follow from the parts that are visible.

Deriving a coarser label also requires that the finer one was exhaustive. Boxes prove that a class is absent from an image only if every object of that class was boxed. Where tasks do nest and you are torn between them, label a small pilot set at the finer level. You can collapse it later, and the pilot shows you what the extra detail costs.

When you may not need new labels

Several common problems are better solved without training a model on your own labels. Test the option below on 50 to 100 of your own images before you commit to an annotation project, and include the hardest cases on purpose. A clean result is limited evidence: with no failures in 100 random images, the failure rate can still be up to about 3 % (one-sided 95 % bound).

SituationTry firstSigns it is not enough
Fixed camera and lighting, one known part, presence or position checkClassic image processing: thresholding, blob counting, template matchingLighting or part appearance varies; parts overlap; background changes
Reading printed text, serial numbers, datesAn existing OCR engine, such as the open-source Tesseract [1]; score it with character error rateHandwriting, embossed or curved text, very low contrast
Barcodes or QR codesA barcode decoding libraryCodes are damaged or partly hidden
Everyday objects (people, vehicles, animals)A detector pre-trained on a large public dataset such as COCO [2]Your classes, viewpoints or image type differ from that data
"Find images like this one" or match images to a text descriptionSimilarity search on features from a pre-trained model. CLIP, for example, matches images to text descriptions without task-specific training [3]. Score it with recall@k: the share of queries whose correct match is in the top kk resultsThe differences that matter to you are too fine for generic features
Defects are rare, varied or unknown in advanceAnomaly detection: train on good images only. The MVTec AD benchmark is built this way, with defect-free training images and test images with defects [4]You must name the defect type, or measure it to a tolerance an anomaly map cannot guarantee
A few images a day, and a person already looks at each oneManual review with a written checklistVolume grows, or reviewers disagree too often

The tasks compared

TaskWhat one label isTypical metricGood fitPoor fit
Single-label classificationOne class per imageAccuracy, macro-averaged F1, confusion matrix [5]Sorting whole images: product group, scene type, pass or fail for a centred partSeveral objects per image; location matters
Multi-label classificationYes or no for every class in the listAverage precision (AP) or F1 per class. PASCAL VOC scored classification as 20 independent yes/no tasks with AP [6]Tags that can be true together: "contains a nut", "contains a washer"Counting; location
Object detectionClass and axis-aligned box per objectAP, where a detection counts as correct if its intersection over union (IoU) with the reference box exceeds 0.5, as in PASCAL VOC [6]; or AP averaged over IoU thresholds 0.50 to 0.95 in steps of 0.05, as in COCO [7]Counting and locating compact objectsThin, long or diagonal objects (rotated boxes are an in-between option); measuring areas
Semantic segmentationClass per pixel, usually with an "ignore" valueMean IoU over classes, with IoU = TP / (TP + FP + FN) counted in pixels [8]Surfaces and regions without a count: road, rust, sky, vegetationCounting or separating touching objects
Instance segmentationMask and class per objectMask AP: the detection metric with IoU computed on masks instead of boxes [7]Separating, counting and measuring touching or irregular objectsLarge background regions; tight budgets
Panoptic segmentationClass for every pixel, plus an instance id for countable objects [9]Panoptic quality (PQ) [9]Complete scene descriptions, both objects and backgroundSmall projects; you rarely need every pixel
Keypoint detectionNamed points per object, each with a visibility flag (not labelled, labelled but hidden, labelled and visible) [10]AP over object keypoint similarity (OKS), which plays the role IoU plays for boxes. OKS needs a tolerance constant per point and an object scale; COCO uses the square root of the segment area [10]. For your own points, set both, or score the error in millimetres or degrees directlyPose, orientation, end points for length measurementObjects without points that are the same on every instance

Two terms appear in most rows. Intersection over union is the overlap between a prediction and the reference, divided by the area they cover together. Average precision summarises precision across all recall levels for one class. Metrics for detection are explained in object detection metrics: precision, recall and mAP.

Multi-label is not single-label with more classes. A single-label model picks one class out of the list. A multi-label model answers an independent yes/no question for each class, so an image can be "yes" for several classes or for none [11]. If a tray image is tagged only "bolt", the label claims that no nut is present. Annotators must check every class, not just tick the ones they happen to notice.

What each label costs

Published annotation times come from different datasets, interfaces, annotator groups and statistics (median, mean or budget). Use them for orders of magnitude, not for a budget.

LabelPublished time, as reportedContextSource
Image-level yes/no for one class1 s per classAssumption used by Bearman et al. for PASCAL VOC (20 classes, so 20 s per image), taken from an earlier eye-tracking study[12]
One point per objectMedian 2.4 s for the first object of a class, median 0.9 s for each further object of that class (plus 1 s for each absent class)Crowd workers on Amazon Mechanical Turk, PASCAL VOC 2012[12]
One box, drawn and verifiedMedians 25.5 s drawing + 9.0 s verification = 34.5 s, for one object per class per image. Checking for further objects of the class adds a median 7.8 s; the median is 55 s when rejected boxes are redrawn; means instead of medians give 117 sSu et al.'s crowdsourcing protocol for ImageNet (ILSVRC) boxes, as reported by Papadopoulos et al.[13]
One box by extreme clicking (top, bottom, left-most and right-most points)7.0 s per boxCrowd workers who passed a training stage and a qualification test; PASCAL VOC 2007 and 2012; one object per class per image[13]
One instance polygonOver 22 worker hours per 1,000 segmentations, so at least 79 s eachCOCO crowd workers, one worker per instance; the 3 to 5 verification judgements per mask are extra[2]
One street-scene image, every pixel, fine polygonsMore than 1.5 h on average, including quality controlCityscapes, annotated in-house[8]
The same kind of image, coarse polygonsA budget of less than 7 min per imageCityscapes; a time limit set by the authors, not a measured time[8]

Worked estimate. Take 1,000 images and a list of 5 classes. Each image contains 3 of the classes, with one object of each, so the box timings for one object per class apply as published:

  • Image-level labels: 5 × 1 s = 5 s per image, or 1.4 hours in total.
  • One point per present class: 3 × 2.4 s + 2 × 1 s = 9.2 s per image, or 2.6 hours. Points are the cheapest way to get counts when each object is clearly separate.
  • Boxes, drawn and verified: 3 × 34.5 s = 103.5 s per image, or 28.8 hours from medians. From means, 3 × 117 s gives 97.5 hours.
  • Boxes, extreme clicking: 3 × 7.0 s = 21 s per image, or 5.8 hours.
  • Instance polygons at the COCO rate: at least 3 × 79.2 s = 237.6 s per image, or 66.0 hours, before verification.

Polygons therefore cost at least about 48 times as much as image-level labels here, and boxes drawn the conventional way 21 to 70 times as much, depending on whether medians or means describe your annotators. With several objects of the same class per image, add the search for further objects to every box and polygon. None of these figures includes training annotators, reviewing their work or settling disagreements. A written protocol and quality checks add to all of them; see build a reproducible annotation protocol. Before you budget, time yourself labelling 20 of your own images in the tool you will actually use.

What goes wrong with each choice

Each label type fails in its own way, and the failures are easier to prevent than to repair.

  • Classification cannot show where or how many. The label does not say which part of the image justified it, so a reviewer cannot reliably check whether the model looked at the right thing.
  • Multi-label needs explicit negatives. An unticked class is ambiguous: is the object absent, or did nobody look? Open Images records human-verified positive and negative image labels and treats every other class as unknown [14].
  • Boxes include background. In the figure, the three bolt boxes contain only 26 %, 26 % and 42 % bolt pixels, and the boxes of the two touching bolts overlap (IoU 0.10). Rotated boxes fit long diagonal objects better, but they need an angle as a fifth number, and not every tool or format supports them. Dense groups are hard to box one by one. COCO segmented 10 to 15 instances of a class per image and then marked the rest as one "crowd" region, which evaluation ignores [2].
  • Semantic masks merge touching objects. The figure's semantic mask has 2 connected bolt regions for 3 bolts, so counting from it gives the wrong answer. Unclear pixels need a rule. Cityscapes told annotators to choose a "void" label when unsure, and void pixels count in neither training nor evaluation [8].
  • Instance masks are slow and invite boundary disputes. Annotators must agree on the details. Is an occluded part included? Does a thin protrusion count? Without written rules, two careful annotators draw different masks.
  • Keypoints need points that are the same on every object. Each point needs a definition and a visibility rule [10]. Symmetric objects raise extra questions, such as which end of a symmetric part is "left".
  • Panoptic labels leave nothing out. Every pixel needs a class or an explicit void. This makes panoptic the most complete output and also the most expensive one.

Worked decisions

Each decision below walks the flow step by step.

1. Kit check. Each tray must hold 3 bolts and 1 nut; anything else is rejected. Step 0: if every part sits in its own pocket of a fixed tray, a classic check of each pocket may be enough, and no labels are needed. If the parts lie loose: step 1, A: no. "Complete" cannot be judged without counting. A classifier trained on "complete" and "incomplete" would also have to learn every way a kit can be incomplete. B: no points needed. C: yes, for both bolt and nut. Result: object detection, and the kit is complete when the model counts 3 bolts and 1 nut. Label: boxes for bolt and nut, or points if the parts never touch. Metric: AP at IoU 0.5, plus the share of trays with the correct count.

2. Rust coverage. A report needs the percentage of each steel plate covered by rust. Step 0: no fixed rule separates rust from shadows and stains reliably. Step 1 for rust and for clean steel: A no, B no, C no (rust patches have no meaningful count), D yes. Result: semantic segmentation. Label: a per-pixel mask with classes rust, clean steel and ignore (for plate edges and glare). Metric: IoU for the rust class, plus the error in the reported percentage, which is what the reader of the report cares about.

3. Bolt length. A calibrated top-down camera must report each bolt's length. Step 1: A no; B yes, because a length needs two end points. Define the points the way the length is measured, here the centre of the bearing face under the head and the tip. In the figure, these points give the shaft lengths directly. A point in the middle of the head would make every length too long by half the head height. Result: keypoint detection. The length is the pixel distance times the scale in millimetres per pixel. Label: two keypoints per bolt plus a box. Metric: the length error in millimetres on a test set. OKS-based AP is useful during development once you have set its tolerances.

Common misconceptions

  • "Segmentation is always better because it is more detailed." It costs more, it is harder to label consistently, and the extra detail helps only if your decision uses it.
  • "We can start with classification and add locations later." Image-level labels do not contain locations. Weakly supervised methods can train segmentation models from image labels or single clicks [12], but plan on labelling again if you need reliable boxes or masks to test against.
  • "A 0.9 score on one task is better than 0.8 on another." Accuracy, AP, mean IoU and PQ measure different things and are not comparable across tasks.
  • "More classes make the model more useful." Each class needs enough examples and a definition annotators can apply consistently. Designing that list is its own step; see how to design a useful label taxonomy.

Worksheet

For each case, choose the task (or "no new labels"), the label and the metric. Use the decision flow.

  1. A wildlife camera takes 2,000 photos a night. The team wants to discard photos with no animal in them.
  2. A recycling line must report how many bottles, cans and cartons pass per minute. Items often touch on the belt.
  3. A quality engineer wants the percentage of each fabric roll image covered by stains. Stains are common, and thousands of stained images are on file.
  4. An archive wants to read the printed catalogue number in the corner of every scanned index card.
  5. A robotics team wants the opening angle of a two-finger gripper from side-view photos.
  6. A factory sees a new kind of surface fault almost every month, and only 12 faulty parts have been photographed so far.
  7. An urban-planning study needs, from the same aerial images, the area of lawn and of paved ground, and the number and crown area of individual trees.
Show the answers
  1. Step 0: try a pre-trained animal detector first; it may already work. If it does not: A yes, one answer per image, so single-label classification (animal, empty). Metric: a confusion matrix, watching the animal photos wrongly discarded.
  2. A no, B no, C yes for all three classes: object detection. Instance segmentation is an option if touching items make boxes ambiguous. A single frame counts each item many times on a moving belt, so count with a tracker or a virtual line across the belt. Metric: AP, plus the error in counts per minute against a manual count of recorded video.
  3. A, B and C no; D yes, because stains have no meaningful count: semantic segmentation with stain, clean fabric and ignore. Step 3 does not apply because stained examples are plentiful. Metric: stain IoU, plus the error in the reported percentage.
  4. Step 0: no new labels at first. Crop the corner and run an existing OCR engine. Measure character error rate on 100 cards before deciding whether you need anything else.
  5. A no, B yes: keypoint detection with three named points (finger base, left fingertip, right fingertip) and visibility flags. The angle is computed from the three points. Metric: angle error in degrees on a held-out set; OKS-based AP once its tolerances are set.
  6. A yes: "faulty or not" can be judged from the whole part. Step 3 then applies, because 12 examples spread over changing fault types are too few to label by type: anomaly detection at image level, trained on good parts. Keep the 12 faulty parts, with their faults outlined, as a test set.
  7. Lawn and paving: D. Trees: E, because crown area is needed per tree. Step 2: D and E in the same images gives panoptic segmentation. Metric: PQ, also reported for the tree class. If only the tree count were needed (C), detection for trees plus semantic segmentation for the ground would be the cheaper pair.

Next steps: once the task is chosen, write down the classes and their boundaries, then the annotation rules. For a first detection project from start to finish, see create your first object detection dataset.

References

  1. [1] Tesseract OCR project. Tesseract User Manual (Tesseract 5.x documentation). Accessed 2026-11-28. tesseract-ocr.github.io/tessdoc/
  2. [2] T.-Y. Lin, M. Maire, S. Belongie, L. Bourdev, R. Girshick, J. Hays, P. Perona, D. Ramanan, C. L. Zitnick and P. Dollár. Microsoft COCO: Common Objects in Context. ECCV 2014; arXiv:1405.0312. arxiv.org/abs/1405.0312
  3. [3] A. Radford, J. W. Kim, C. Hallacy, A. Ramesh, G. Goh, S. Agarwal, G. Sastry, A. Askell, P. Mishkin, J. Clark, G. Krueger and I. Sutskever. Learning Transferable Visual Models From Natural Language Supervision. ICML 2021; arXiv:2103.00020. arxiv.org/abs/2103.00020
  4. [4] P. Bergmann, M. Fauser, D. Sattlegger and C. Steger. MVTec AD: A Comprehensive Real-World Dataset for Unsupervised Anomaly Detection. CVPR 2019, 9584–9592. openaccess.thecvf.com/content_CVPR_2019/papers/Bergmann_MVTec_AD_--_A_Comprehensive_Real-World_Dataset_for_Unsupervised_Anomaly_CVPR_2019_paper.pdf doi:10.1109/CVPR.2019.00982
  5. [5] scikit-learn user guide: Metrics and scoring, classification metrics (version 1.9 documentation). Accessed 2026-11-28. scikit-learn.org/stable/modules/model_evaluation.html
  6. [6] M. Everingham, L. Van Gool, C. K. I. Williams, J. Winn and A. Zisserman. The PASCAL Visual Object Classes (VOC) Challenge. International Journal of Computer Vision 88(2), 303–338, 2010. doi.org/10.1007/s11263-009-0275-4 doi:10.1007/s11263-009-0275-4
  7. [7] COCO Consortium. Detection evaluation (metrics for bounding boxes and segmentation masks). Accessed 2026-11-28. cocodataset.org/#detection-eval
  8. [8] M. Cordts, M. Omran, S. Ramos, T. Rehfeld, M. Enzweiler, R. Benenson, U. Franke, S. Roth and B. Schiele. The Cityscapes Dataset for Semantic Urban Scene Understanding. CVPR 2016, 3213–3223; arXiv:1604.01685. arxiv.org/abs/1604.01685 doi:10.1109/CVPR.2016.350
  9. [9] A. Kirillov, K. He, R. Girshick, C. Rother and P. Dollár. Panoptic Segmentation. CVPR 2019, 9396–9405; arXiv:1801.00868. arxiv.org/abs/1801.00868 doi:10.1109/CVPR.2019.00963
  10. [10] COCO Consortium. Keypoint evaluation (object keypoint similarity). Accessed 2026-11-28. cocodataset.org/#keypoints-eval
  11. [11] scikit-learn user guide: Multiclass and multioutput algorithms (multiclass vs multilabel classification), version 1.9 documentation. Accessed 2026-11-28. scikit-learn.org/stable/modules/multiclass.html
  12. [12] A. Bearman, O. Russakovsky, V. Ferrari and L. Fei-Fei. What's the Point: Semantic Segmentation with Point Supervision. ECCV 2016; arXiv:1506.02106. arxiv.org/abs/1506.02106 doi:10.1007/978-3-319-46478-7_34
  13. [13] D. P. Papadopoulos, J. R. R. Uijlings, F. Keller and V. Ferrari. Extreme Clicking for Efficient Object Annotation. ICCV 2017; arXiv:1708.02750. arxiv.org/abs/1708.02750 doi:10.1109/ICCV.2017.528
  14. [14] A. Kuznetsova, H. Rom, N. Alldrin, J. Uijlings, I. Krasin, J. Pont-Tuset, S. Kamali, S. Popov, M. Malloci, A. Kolesnikov, T. Duerig and V. Ferrari. The Open Images Dataset V4. International Journal of Computer Vision 128, 1956–1981, 2020; arXiv:1811.00982. arxiv.org/abs/1811.00982 doi:10.1007/s11263-020-01316-z

Where to go next

How to cite: anastig (2026). Classification, Detection or Segmentation: How to Choose. Retrieved from https://anastig.ai/learn/choosing-classification-detection-or-segmentation

How this resource was prepared and checked: editorial standards. Found an error? Tell us.

Classification, Detection or Segmentation: How to Choose | anastig