def _track_by_iou(res, results_last, thr):
    """Get track id using IoU tracking greedily."""

    bbox = list(np.squeeze(res.pred_instances.bboxes, axis=0))

    max_iou_score = -1
    max_index = -1
    match_result = {}
    for index, res_last in enumerate(results_last):
        bbox_last = list(np.squeeze(res_last.pred_instances.bboxes, axis=0))

        iou_score = _compute_iou(bbox, bbox_last)
        if iou_score > max_iou_score:
            max_iou_score = iou_score
            max_index = index

    if max_iou_score > thr:
        track_id = results_last[max_index].track_id
        match_result = results_last[max_index]
        del results_last[max_index]
    else:
        track_id = -1

    return track_id, results_last, match_result
Get track id using IoU tracking greedily.
mmpose/mmpose/apis/inference_tracking.py