0
0
Computer Visionml~8 mins

Drawing on images (lines, rectangles, circles, text) in Computer Vision - Model Metrics & Evaluation

Choose your learning style9 modes available
Metrics & Evaluation - Drawing on images (lines, rectangles, circles, text)
Which metric matters for Drawing on images and WHY

When drawing on images, the main goal is to accurately place shapes and text where intended. Metrics focus on pixel accuracy and alignment correctness. For example, if you draw a rectangle around an object, the drawn shape should closely match the object's true position and size.

Common metrics include Intersection over Union (IoU) for shapes, which measures how well the drawn shape overlaps the target area, and pixel error for text placement, which measures how far the text is from the intended spot.

These metrics matter because they tell us if the drawing is precise and useful for tasks like highlighting objects or adding readable labels.

Confusion matrix or equivalent visualization

For drawing tasks, a confusion matrix is not typical. Instead, we use overlap measures like IoU.

    Example: Drawing a rectangle around a cat in an image

    Ground truth box: (x1=30, y1=40, x2=130, y2=140)
    Drawn box:       (x1=35, y1=45, x2=125, y2=135)

    IoU = Area of Overlap / Area of Union

    Overlap area = (125-35) * (135-45) = 90 * 90 = 8100
    Ground truth area = 100 * 100 = 10000
    Drawn box area = 90 * 90 = 8100

    Union area = 10000 + 8100 - 8100 = 10000

    IoU = 8100 / 10000 = 0.81
    

An IoU of 0.81 means the drawn rectangle matches the target well.

Precision vs Recall tradeoff with examples

In drawing on images, precision means how much of the drawn shape is correct (not outside the target), and recall means how much of the target is covered by the drawing.

Example 1: High precision, low recall
Drawing a small circle inside a large object. The circle is fully inside the object (high precision), but it misses much of the object (low recall).

Example 2: Low precision, high recall
Drawing a large rectangle that covers the whole object and some background. It covers all the object (high recall) but also includes extra area (low precision).

Good drawing balances both: covering the object well without extra parts.

What "good" vs "bad" metric values look like

Good drawing: IoU above 0.75, text placed within 5 pixels of target location, shapes aligned with object edges.

Bad drawing: IoU below 0.4, text overlapping wrong areas or unreadable, shapes misplaced or distorted.

Good metrics mean the drawing clearly marks the intended parts of the image, making it useful for visualization or further analysis.

Common pitfalls in metrics for drawing on images
  • Ignoring scale: Drawing a shape too small or too large can give misleading IoU scores.
  • Misalignment: Slight shifts can reduce IoU even if the shape looks close.
  • Text readability: Metrics may not capture if text is readable or overlaps other elements.
  • Overfitting to training images: Drawing perfectly on training images but failing on new ones.
  • Data leakage: Using ground truth info directly to draw shapes inflates metrics unfairly.
Self-check question

Your model draws rectangles around objects with 98% pixel accuracy but only 12% recall of the object area. Is this good?

Answer: No. High pixel accuracy means the drawn parts are correct, but very low recall means most of the object is missed. The drawing is incomplete and not useful for highlighting the full object.

Key Result
IoU above 0.75 indicates good shape drawing accuracy; balance precision and recall for best results.