0
0
Computer Visionml~8 mins

Edge detection (Canny) in Computer Vision - Model Metrics & Evaluation

Choose your learning style9 modes available
Metrics & Evaluation - Edge detection (Canny)
Which metric matters for Edge detection (Canny) and WHY

For edge detection, the key metrics are Precision and Recall. Precision tells us how many detected edges are actually true edges, avoiding false edges. Recall tells us how many true edges were found, avoiding missed edges. Since edge detection is about finding boundaries accurately, both matter to balance sharpness and completeness.

Confusion matrix for Edge detection (Canny)
      | Predicted Edge      | Predicted No Edge   |
      |---------------------|---------------------|
      | True Positive  (TP)  | False Negative (FN)  |
      | False Positive (FP)  | True Negative  (TN)  |

      TP: Pixels correctly detected as edges
      FP: Pixels wrongly detected as edges
      FN: Pixels missed as edges
      TN: Pixels correctly detected as no edge
    
Precision vs Recall tradeoff with examples

If you set Canny thresholds too high, you get high precision but low recall. This means edges found are mostly correct but many edges are missed. Good for clean images where false edges confuse.

If thresholds are too low, you get high recall but low precision. Many edges are found but many are false. Good if missing edges is worse than extra noise.

Example: For medical images, missing edges (low recall) can hide important details, so recall is more important. For artistic filters, precision may matter more to avoid noisy edges.

What good vs bad metric values look like for Edge detection

Good: Precision and recall both above 0.8 means edges are mostly correct and most true edges are found.

Bad: Precision below 0.5 means many false edges. Recall below 0.5 means many edges missed. Either hurts the usefulness of edge detection.

Common pitfalls in edge detection metrics
  • Accuracy paradox: Most pixels are non-edge, so accuracy can be high even if edges are poorly detected.
  • Data leakage: Using test images similar to training or tuning thresholds on test data inflates metrics.
  • Overfitting: Tuning Canny thresholds too tightly on one image type may fail on others.
  • Ignoring context: Edges in noisy areas may be false positives; metrics alone don't capture visual quality.
Self-check question

Your edge detection model has 98% accuracy but 12% recall on true edges. Is it good for production? Why or why not?

Answer: No, it is not good. The high accuracy is misleading because most pixels are non-edge. The very low recall means most true edges are missed, so the model fails to find important edges.

Key Result
Precision and recall are key to evaluate Canny edge detection, balancing correct edge detection and missed edges.