0
0
Computer Visionml~8 mins

Text detection in images in Computer Vision - Model Metrics & Evaluation

Choose your learning style9 modes available
Metrics & Evaluation - Text detection in images
Which metric matters for text detection in images and WHY

For text detection in images, the main goal is to find all text areas correctly without too many false alarms. So, Recall is very important because it tells us how many real text parts the model found out of all the text parts that exist. Missing text means bad results.

Precision is also important because it shows how many detected text parts are actually text. Too many false detections confuse users.

The F1 score balances precision and recall, giving a single number to check overall quality.

Sometimes, Intersection over Union (IoU) is used to measure how well the detected boxes match the real text boxes.

Confusion matrix for text detection
Detected Text   | Actual Text   | Count
-------------------------------------
True Positive (TP)  | Text detected correctly       | 80
False Positive (FP) | Non-text detected as text     | 15
False Negative (FN) | Text missed by detector       | 20
True Negative (TN)  | Non-text correctly ignored    | Not usually counted in detection tasks

Total text regions = TP + FN = 100
Total detected text regions = TP + FP = 95

Precision = TP / (TP + FP) = 80 / (80 + 15) = 0.842

Recall = TP / (TP + FN) = 80 / (80 + 20) = 0.8

F1 score = 2 * (Precision * Recall) / (Precision + Recall) ≈ 0.82

Precision vs Recall tradeoff with examples

If the model tries to find every text area, it may detect many false text parts, increasing recall but lowering precision.

If the model is very strict, it finds fewer false texts but may miss some real text, increasing precision but lowering recall.

Example: In reading signs for a navigation app, missing text (low recall) is worse because the app may not give directions. So recall is more important.

In a document scanner, false text detections (low precision) may cause extra work cleaning results, so precision matters more.

What good vs bad metric values look like for text detection

Good: Precision and recall both above 0.85 means the model finds most text and makes few mistakes.

Bad: Precision below 0.5 means many false detections, confusing users.

Recall below 0.5 means the model misses too much text, making it unreliable.

F1 score below 0.6 usually means the model needs improvement.

Common pitfalls in metrics for text detection
  • Ignoring IoU: Counting a detected box as correct without checking overlap can inflate metrics.
  • Accuracy paradox: Since most image areas are non-text, accuracy can be high even if detection is poor.
  • Data leakage: Testing on images very similar to training can give unrealistically high scores.
  • Overfitting: Model performs well on training images but poorly on new images, misleading metrics.
Self-check question

Your text detection model has 98% accuracy but only 12% recall on text regions. Is it good for production? Why or why not?

Answer: No, it is not good. The high accuracy is misleading because most image pixels are non-text, so the model guesses non-text well. But 12% recall means it misses 88% of text, which is unacceptable for text detection.

Key Result
Recall and precision are key metrics; high recall ensures most text is found, high precision avoids false detections.