Atlas Robotics
Computer Vision / AIBasic

Object detection basics: bounding boxes, classes and confidence

Atlasbot · 18/8/2026 · 11 min read

Object detection basics: bounding boxes, classes and confidence
Object Detection returns location, label, and reliability for each object

Object Detection (object detection) is a computer vision problem that simultaneously answers two questions: what is in the image, and where is that object — which differs from the simpler problem Image Classification (just answering "what kind of image is this" without knowing the location). What is YOLO? introduced a specific model to solve this problem — this article goes into three foundational concepts that all object detection models share.

Key concepts

Three core concepts: Bounding box — the smallest rectangular frame that surrounds the object, usually represented by upper-left angular coordinates and dimensions (x, y, width, height), or 2-angle diagonal coordinates (x1, y1, x2, y2). Class (label/class) — names the type of object detected, limited to the set of classes that the model is trained to recognize (e.g., the model trained on the COCO dataset identifies 80 common classes such as people, cars, chairs, etc.). Confidence score — a number from 0 to 1 represents how "confident" the model is with that prediction.

How it works

Real-world applications always set a threshold (threshold), e.g. retaining only the ≥0.5 confidence outcome only, to eliminate uncertain predictions. The detection model typically generates multiple bounding box proposals for the same object before filtering — the technique Non-Maximum Suppression (NMS) is used to remove duplicate boxes, retaining only the highest confidence box in the group of multiple overlapping boxes. Most frameworks (such as YOLO) have NMS built-in, without the need to write themselves.

Technical details

Formulas

The NMS uses the IoU (Intersection over Union) index to measure the degree of overlap between 2 bounding boxes, deciding which box to discard:

IoU = Intersection_area / Union_area

Example: Box A (100,100,200,200), Box B (120,110,220,210)
Intersection_area = (200-120) × (200-110) = 80 × 90 = 7200
Area_A = 100×100 = 10000, Area_B = 100×100 = 10000
Union_area = 10000 + 10000 - 7200 = 12800
IoU = 7200/12800 = 0.5625

If the IoU between 2 boxes exceeds the threshold (usually 0.45-0.5), treat them as the same object
→ keep only the box with higher confidence and remove the other

Parameters

ThresholdImplications
Low confidence threshold (VD: 0.25)Keeps more results, increases false positive
Confidence threshold cao (VD: 0.7)Filtering is tighter, and you may miss the true negative.
Low IoU threshold (NMS )Remove overlapping boxes more forcefully
IoU threshold (NMS) caoKeep more boxes closer together (possibly 2 objects close together)

Practical applications

With AMR, object detection is often used for dynamic human/obstacle detection (in addition to LiDAR — the camera identifies * types * of objects that LiDAR does not know about, in accordance with the sensor matching principle learned in the Camera problem in AMR), or for identification of package codes/arrest positions in storage. Choosing the correct confidence threshold and IoU needs to be considered according to the specific application — safety (human visibility), so a lower confidence threshold should be preferred (mistake detection rather than omission), while package classification may accept a higher threshold to reduce confusion.

Practical example

def tinh_iou(box_a, box_b):
    x1 = max(box_a[0], box_b[0])
    y1 = max(box_a[1], box_b[1])
    x2 = min(box_a[2], box_b[2])
    y2 = min(box_a[3], box_b[3])

    giao_nhau = max(0, x2-x1) * max(0, y2-y1)
    dien_tich_a = (box_a[2]-box_a[0]) * (box_a[3]-box_a[1])
    dien_tich_b = (box_b[2]-box_b[0]) * (box_b[3]-box_b[1])
    hop_nhat = dien_tich_a + dien_tich_b - giao_nhau

    return giao_nhau / hop_nhat if hop_nhat > 0 else 0

detections = [
    {"class": "person", "confidence": 0.91, "box": [140, 130, 250, 280]},
    {"class": "person", "confidence": 0.65, "box": [150, 135, 255, 285]},  # duplicate
    {"class": "box",    "confidence": 0.87, "box": [320, 180, 480, 270]},
]

iou = tinh_iou(detections[0]["box"], detections[1]["box"])
print(f"IoU giữa 2 box 'person': {iou:.3f}")
if iou > 0.45:
    print("-> Đây là cùng 1 vật thể, NMS sẽ loại box confidence thấp hơn (0.65)")
Output:
IoU giữa 2 box 'person': 0.712
-> Đây là cùng 1 vật thể, NMS sẽ loại box confidence thấp hơn (0.65)

Common mistakes

  • Set confidence threshold too low for high-fidelity— applications such as the Parameter table, increasing false positive (misidentification of non-existent object), causing unnecessary false response.
  • Setting the confidence threshold too high for the safety application — may miss the real object, which is much more dangerous than the false positive in the safety context.
  • Uninterpreted IoU when debugging the phenomenon of "1 object received multiple boxes" — as the above example, this is normal behavior before NMS, it is necessary to check the NMS IoU threshold instead of suspecting the wrong detection pattern.
  • Using the same 1 confidence threshold for all types of objects— some classes of objects (e.g., people, need high safety) should have different thresholds than others (e.g., stationary shelves, less important in terms of reaction speed).

Conclusion

Mastering the three concepts of bounding box, class, and confidence — and the IoU-based NMS mechanism for duplicate box type — is sufficient to read and use any object detection model (YOLO or other family of models). Choosing the correct confidence/IoU threshold by application specification (safety or classification) is more important than choosing the "most accurate" model. The next article expanded to Object Tracking, where the same object is tracked through multiple consecutive frames.

Get new articles and lessons by email

When a new technical article or course module is published, Atlas Robotics sends you a short email. No spam.

Unsubscribe any time with the link in each email. See our Privacy policy.

Object detection basics: bounding boxes, classes and confidence — Atlas Robotics