tracking

TrackingData

class stardust.metric.tracking.TrackingData(track_id, box_type, obj_info)[source]

Bases: object

Define a tracking object

Args:
track_id: int

tracking id of object

box_type: str

type of object, which should be chosen from ‘2D’ and ‘3D’

obj_info: List

info of box, [x, y, z, l, w, h, ry] for box 3d and [x, y, w, h] for box 2d

Returns:

TrackingData object

Examples:
from stardust.metric.tracking import TrackingData
t_data = TrackingData(0, '3D', [1, 2, 3, 4.5, 1.8, 1.5, 0.1])
t_data = TrackingData(0, '2D', [1, 2, 4.5, 1.8])

TrackingMetric

class stardust.metric.tracking.TrackingMetric(trajectory_gt, trajectory_pd, IoU_thr, metric_tyoe)[source]

Bases: object

Define a TrackMetric object and prepare metric data

Args:
trajectory_gt: List

trajectory of annotation

trajectory_pd: List

trajectory of prediction

IoU_thr: float

The iou threshold of tp boxes

metric_tyoe: str

type of input object, which should be chosen from ‘2D’ and ‘3D’

Returns:

TrackingMetric obj

compute()[source]

compute tracking metric

Args:

Returns:

Dict

compute_metric

stardust.metric.tracking.compute_metric(data=None, IoU_thr=None, metric_types=None, save_path=None)[source]

Computing IoU of all objects in all frames

Args:
data: Generator

A generator object to get all information from all frames

IoU_thr: float

The iou threshold of tp boxes

metric_types: List

which type of box to compute metric, which can be chosen from [‘2D’], [‘3D’] and [‘2D’, ‘3D’]

save_path: str

Local path to save metric results

Returns:
metric: List

The metric of dataset which include two dict, the first represents metric of every single frame and the second represents metric of all frames

Examples:
from stardust.metric.tracking import compute_metric
project_id = 856
Export(project_id, 'top', input_path, True).export()
json_datas = read_rosetta(project_id=project_id,
                        input_path=input_path,
                        )
metric = compute_metric(json_datas, 0.5, ['2D', '3D'], 'local/')