vis4d.eval.coco.detect¶
COCO evaluator.
Functions
|
Convert Vis4D format predictions to COCO format. |
|
Convert Tensor [N, 4] in xyxy format into xywh. |
Classes
|
COCO detection evaluation class. |
|
Subclass COCO eval for logging / printing. |
- class COCODetectEvaluator(data_root, split='val2017', per_class_eval=False)[source]¶
COCO detection evaluation class.
Creates an instance of the class.
- Parameters:
data_root (str) – Root directory of data.
split (str, optional) – COCO data split. Defaults to “val2017”.
per_class_eval (bool, optional) – Per-class evaluation. Defaults to False.
- evaluate(metric)[source]¶
Evaluate COCO predictions.
- Parameters:
metric (str) – Metric to evaluate. Should be “COCO_AP”.
- Raises:
NotImplementedError – Raised if metric is not “COCO_AP”.
RuntimeError – Raised if no predictions are available.
- Returns:
- Dictionary of scores to log and a pretty
printed string.
- Return type:
tuple[MetricLogs, str]
- process_batch(coco_image_id, pred_boxes, pred_scores, pred_classes, pred_masks=None)[source]¶
Process sample and convert detections to coco format.
coco_image_id (list[int]): COCO image ID. pred_boxes (list[NDArrayNumber]): Predicted bounding boxes. pred_scores (list[NDArrayNumber]): Predicted scores for each box. pred_classes (list[NDArrayNumber]): Predicted classes for each box. pred_masks (None | list[NDArrayNumber], optional): Predicted masks.
- Return type:
None
- property metrics: list[str]¶
Supported metrics.
- Returns:
Metrics to evaluate.
- Return type:
list[str]
- class COCOevalV2(cocoGt=None, cocoDt=None, iouType='segm')[source]¶
Subclass COCO eval for logging / printing.
Initialize CocoEval using coco APIs for gt and dt :type cocoGt: :param cocoGt: coco object with ground truth annotations :type cocoDt: :param cocoDt: coco object with detection results :return: None
- predictions_to_coco(cat_map, coco_id2name, image_id, boxes, scores, classes, masks=None)[source]¶
Convert Vis4D format predictions to COCO format.
- Parameters:
cat_map (dict[str, int]) – COCO class name to class ID mapping.
coco_id2name (dict[int, str]) – COCO class ID to class name mapping.
image_id (int) – ID of image.
boxes (NDArrayNumber) – Predicted bounding boxes.
scores (NDArrayNumber) – Predicted scores for each box.
classes (NDArrayNumber) – Predicted classes for each box.
masks (None | NDArrayNumber, optional) – Predicted masks. Defaults to None.
- Returns:
Predictions in COCO format.
- Return type:
list[DictStrAny]