Expand description
§yscv-eval
Evaluation metrics for classification, detection, and tracking. Dataset adapters for COCO, Pascal VOC, and CSV.
ⓘ
use yscv_eval::*;
let ap = average_precision(&predictions, &ground_truths, 0.5);
let report = classification_report(&predicted_labels, &true_labels);
println!("{}", report);§Metrics
37 public metric/eval functions across the crate:
| Task | Metrics |
|---|---|
| Classification | accuracy, precision, recall, F1, confusion matrix, Cohen’s kappa, ROC curve + AUC, average_precision, top_k_accuracy, classification_report |
| Detection | mAP, COCO mAP, AP@IoU, precision-recall, evaluate_detections{,_coco,_from_dataset} |
| Tracking | MOTA, MOTP, HOTA, IDF1, evaluate_tracking{,_from_dataset} |
| Regression | MAE, RMSE, MAPE, R² |
| Image quality / segmentation | PSNR, SSIM, dice_score, mean_iou, per_class_iou |
| Counting / pipeline / camera | counting metrics, pipeline benchmark thresholds, camera diagnostics validation |
§Dataset Adapters (8)
Under src/dataset/:
- COCO —
parse_detection_dataset_coco,load_detection_dataset_coco_files - JSONL — detection + tracking
- MOT —
parse_tracking_dataset_mot,load_tracking_dataset_mot_txt_files - OpenImages — CSV pair (
parse_detection_dataset_openimages_csv) - VOC — XML directories
- YOLO — label directories
- KITTI — label directories
- WIDERFACE — TXT pair
§Tests
95 tests covering metric correctness, edge cases, dataset parsing.
Structs§
- Benchmark
Violation - Camera
Diagnostics Capture - Camera
Diagnostics Device - Camera
Diagnostics First Frame - Camera
Diagnostics Report - Camera
Diagnostics Requested - Camera
Diagnostics Thresholds - Camera
Diagnostics Timing - Camera
Diagnostics Violation - Coco
Metrics - Counting
Metrics - Detection
Dataset Frame - Detection
Eval Config - Detection
Frame - Detection
Metrics - Ground
Truth Track - Labeled
Box - Pipeline
Benchmark Report - Pipeline
Benchmark Thresholds - Pipeline
Durations - Stage
Thresholds - Timing
Stats - Tracking
Dataset Frame - Tracking
Eval Config - Tracking
Frame - Tracking
Metrics
Enums§
Constants§
Functions§
- accuracy
- Compute classification accuracy as the fraction of correct predictions.
- auc
- Area under the curve using the trapezoidal rule.
- average_
precision - Compute average precision (area under the precision-recall curve) using the trapezoidal rule.
- classification_
report - Generate a human-readable classification report (similar to scikit-learn’s
classification_report). - cohens_
kappa - Cohen’s kappa coefficient measuring inter-annotator agreement.
- confusion_
matrix - Compute a confusion matrix for
num_classesclasses. - detection_
frames_ as_ view - dice_
score - Per-class Dice coefficient: 2 * |pred ∩ target| / (|pred| + |target|).
- evaluate_
counts - evaluate_
detections - evaluate_
detections_ coco - Evaluate detections using COCO-style multi-threshold metrics.
- evaluate_
detections_ from_ dataset - evaluate_
tracking - evaluate_
tracking_ from_ dataset - f1_
score - Compute F1 score with the specified averaging strategy.
- hota
- Higher Order Tracking Accuracy.
- idf1
- Identity F1 score: measures how well predicted IDs match GT IDs across frames.
- load_
camera_ diagnostics_ report_ json_ file - load_
detection_ dataset_ coco_ files - load_
detection_ dataset_ jsonl_ file - load_
detection_ dataset_ kitti_ label_ dirs - load_
detection_ dataset_ openimages_ csv_ files - load_
detection_ dataset_ voc_ xml_ dirs - load_
detection_ dataset_ widerface_ files - load_
detection_ dataset_ yolo_ label_ dirs - load_
tracking_ dataset_ jsonl_ file - load_
tracking_ dataset_ mot_ txt_ files - mae
- Mean absolute error.
- mape
- Mean absolute percentage error, skipping pairs where the target is zero.
- mean_
iou - Mean Intersection over Union for semantic segmentation.
- parse_
camera_ diagnostics_ report_ json - parse_
detection_ dataset_ coco - parse_
detection_ dataset_ jsonl - parse_
detection_ dataset_ openimages_ csv - parse_
detection_ dataset_ widerface - parse_
pipeline_ benchmark_ thresholds - parse_
tracking_ dataset_ jsonl - parse_
tracking_ dataset_ mot - per_
class_ iou - Per-class Intersection over Union: |pred ∩ target| / |pred ∪ target|.
- per_
class_ precision_ recall - Compute per-class precision and recall from a confusion matrix.
- precision_
recall_ curve - Compute precision-recall curve from binary classification scores and labels.
- psnr
- Peak Signal-to-Noise Ratio between two images.
- r2_
score - Coefficient of determination: 1 - SS_res / SS_tot.
- rmse
- Root mean squared error.
- roc_
curve - Compute ROC curve from binary classification scores and labels.
- ssim
- Structural Similarity Index (SSIM) between two grayscale images.
- summarize_
durations - summarize_
pipeline_ durations - top_
k_ accuracy - Top-k accuracy: fraction of samples where the correct label is in the top-k predictions.
- tracking_
frames_ as_ view - validate_
camera_ diagnostics_ report - validate_
pipeline_ benchmark_ thresholds