You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In inference/post_processing.py, function filter_max_center_dist attempts to modify the association matrix during the track assignment step. Its current intent is to disallow track linking if an instance is max_center_dist pixels away from all other instances in the window. However, similar to TrackMate's LAP tracker, a definition that makes more sense is to disallow track linking if an instance is max_center_dist away from the instances in just the previous frame. There are other bugs i.e. with normalizing the distance, and with units; currently distances are in units of fractions of height/width of image; we want the max_center_dist to be in pixels so scale by image height and width
Current:
def filter_max_center_dist(
asso_output: torch.Tensor,
max_center_dist: float = 0,
k_boxes: torch.Tensor | None = None,
nonk_boxes: torch.Tensor | None = None,
id_inds: torch.Tensor | None = None,
) -> torch.Tensor:
"""Filter trajectory score by distances between objects across frames.
Args:
asso_output: An N_t x N association matrix
max_center_dist: The euclidean distance threshold between bboxes
k_boxes: The bounding boxes in the current frame
nonk_boxes: the boxes not in the current frame
id_inds: track ids
Returns:
An N_t x N association matrix
"""
if max_center_dist is not None and max_center_dist > 0:
assert (
k_boxes is not None and nonk_boxes is not None and id_inds is not None
), "Need `k_boxes`, `nonk_boxes`, and `id_ind` to filter by `max_center_dist`"
k_ct = (k_boxes[:, :, :2] + k_boxes[:, :, 2:]) / 2
k_s = ((k_boxes[:, :, 2:] - k_boxes[:, :, :2]) ** 2).sum(dim=2) # n_k
nonk_ct = (nonk_boxes[:, :, :2] + nonk_boxes[:, :, 2:]) / 2
dist = ((k_ct[:, None, :, :] - nonk_ct[None, :, :, :]) ** 2).sum(
dim=-1
) # n_k x Np
norm_dist = dist / (k_s[:, None, :] + 1e-8)
norm_dist = dist.mean(axis=-1) # n_k x Np
valid = norm_dist < max_center_dist # n_k x Np
valid_assn = (
torch.mm(valid.float(), id_inds.to(valid.device))
.clamp_(max=1.0)
.long()
.bool()
) # n_k x M
asso_output_filtered = asso_output.clone()
asso_output_filtered[~valid_assn] = 0 # n_k x M
return asso_output_filtered
else:
return asso_output```
The text was updated successfully, but these errors were encountered:
In inference/post_processing.py, function filter_max_center_dist attempts to modify the association matrix during the track assignment step. Its current intent is to disallow track linking if an instance is max_center_dist pixels away from all other instances in the window. However, similar to TrackMate's LAP tracker, a definition that makes more sense is to disallow track linking if an instance is max_center_dist away from the instances in just the previous frame. There are other bugs i.e. with normalizing the distance, and with units; currently distances are in units of fractions of height/width of image; we want the max_center_dist to be in pixels so scale by image height and width
Current:
The text was updated successfully, but these errors were encountered: