Loading
0x50Lesson 6 of 6

Evaluate predictions and bounding boxes

Measure classification results and compare predicted object regions with ground truth.

14 min 4-question quiz 1 code exercise
By the end of this lesson you can
  • Calculate intersection over union and interpret a vision metric.

A vision model should be evaluated on data separate from training. For classification, a confusion matrix counts correct and incorrect labels; precision and recall describe different error tradeoffs. For object detection, intersection over union (IoU) measures overlap between a predicted bounding box and a ground-truth box: intersection area divided by union area. Metrics summarize behavior, but do not replace checking examples and data coverage.

cv_example.py
1intersection = 40
2union = 100
3iou = intersection / union
4print(round(iou, 2))
Output
0.4

IoU ranges from 0 (no overlap) to 1 (identical boxes). Detection systems often use an IoU threshold to decide whether a predicted box matches an object. Dataset imbalance, lighting, camera angle, and underrepresented groups can affect real-world performance.

Key takeaways

  • Calculate intersection over union and interpret a vision metric.

  • Small arrays make vision ideas concrete.

  • Check model performance across varied real-world examples.

Lesson quiz

4 questions · pass with 3 correct · up to 50 XP

Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.

Practice: apply computer vision with Python

Use small pixel arrays to explore vision concepts, run your code against sample images, and connect each result to the larger computer vision idea.

Exercise 1

Calculate box overlap

+25 XP

Read intersection area and union area as two numbers. Print IoU to two decimal places. The union area is positive.

  • Partial overlap
  • Perfect overlap
main.py
Loading editor…

Python runs in a sandboxed browser worker with a 60 second time limit. Its runtime loads from the Pyodide CDN; your code stays in this browser.

Questions about this lesson

Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.

Loading posts…

Did you like the lesson? 😆👍
Consider a donation to support our work: