Regression & Computer Vision Metrics: MAE, MSE, RMSE, R², IoU, Dice & mAP
Evaluating continuous numeric targets and spatial bounding box predictions in detection and segmentation tasks.
⚡ Executive Summary
A practical guide to continuous error metrics (MAE, MSE, RMSE, R²) and computer vision spatial metrics (Intersection over Union, Dice Coefficient, mAP).
Key Takeaways
- ✓Regression Metrics — covered in depth with practical examples, formulas, and code.
- ✓Computer Vision Metrics — covered in depth with practical examples, formulas, and code.
Regression & Computer Vision Metrics — Foundations Guide
#1. Regression Metrics
Used when the target is a continuous number (price, temperature, demand, etc.).
1.1 MAE — Mean Absolute Error
Interpretation: Average magnitude of error, in the same units as the target. Treats all errors linearly — a 10 error counts as exactly 10x a1 error.
When to use: You want an easily interpretable "average miss," and don't want a few big outliers to dominate the score.
from sklearn.metrics import mean_absolute_error
mean_absolute_error(y_true, y_pred)1.2 MSE — Mean Squared Error
Interpretation: Average of squared errors. Squaring penalizes large errors much more than small ones.
When to use: Large errors are disproportionately bad in your application or as a training loss function.
1.3 RMSE — Root Mean Squared Error
Interpretation: Same "penalize big errors more" behavior as MSE, but back in the original units, making it directly comparable to MAE.
1.4 R² — Coefficient of Determination
Adjusted R² penalizes for feature count when comparing models:
1.5 Quick Comparison Table
| Metric | Penalizes outliers? | Units | Best for |
|---|---|---|---|
| MAE | No (linear) | Same as target | Robust, interpretable average error |
| MSE | Yes (quadratic) | Target² | Training loss, punishing big misses |
| RMSE | Yes (quadratic) | Same as target | Interpretable version of MSE |
| R² | Depends on residuals | Unitless (0–1 typically) | "% of variance explained," model comparison |
#2. Computer Vision Metrics
2.1 IoU — Intersection over Union
2.2 Dice Coefficient (F1 for pixels)
2.3 mAP — mean Average Precision
Used in object detection benchmarks (mAP@0.5, mAP@0.5:0.95). Mean of AP across all classes.
Govindarajan Selvaraj
ML Engineer
Govindarajan Selvaraj is part of the Junglans Solutions engineering team, specializing in machine learning foundations. Junglans builds a 20-product ecosystem of local-first enterprise software — AI developer tools, encrypted communication, and data infrastructure with zero cloud telemetry.
Meet the full Junglans engineering team ↗This article is part of the Junglans Research knowledge base, produced alongside the engineering teams that build our production AI tools. Explore related product documentation and research:
- Junglans ML Visualizer ↗
Interactive 22-algorithm machine learning sandbox — see the concepts in action.
- JunglasNCode ↗
Line-by-line code execution and call stack visualizer for algorithm practice.
- All Junglans Research Articles ↗
More engineering and AI deep-dives from the Junglans team.
Related Research & Articles
Traditional ML Classification Metrics: Confusion Matrix, Accuracy, Precision, Recall & F1-Score
Classification metrics almost all derive from the confusion matrix. Learn how Accuracy, Precision, Recall, and F1-Score behave under real-world data distributions.
ROC-AUC Curves, PR-AUC, and Multi-Class Evaluation Metrics
Explore threshold-agnostic ROC curves, probability ranking, Precision-Recall AUC for rare classes, and multi-class macro, micro, and weighted averaging techniques.
Linear Models, Regularization (Ridge/Lasso/ElasticNet), KNN Distance & Naive Bayes
Explore linear hyperplanes, sigmoid logistic log-loss, L1 Lasso feature selection, L2 Ridge shrinkage, KNN distance metrics, and Naive Bayes independence assumptions.