medusa.tracking#

Module with functionality to ‘track’ faces, i.e., to associate the same face across detections/reconstructions from multiple consecutive (video) frames.

Module Contents#

medusa.tracking.sort_faces(lms, img_idx, dist_threshold=250)[source]#

‘Sorts’ faces across multiple frames.

Parameters:
  • lms (torch.tensor) – A float tensor of shape B (batch size) x V (vertices/landmarks) x C (coordinates), which will be used to sort the faces

  • img_idx (torch.tensor) – An integer tensor with the image index associated with each detection (e.g., [0, 0, 1, 1, 1, …] means that there are two faces in the first image, three faces in the second image, etc.)

  • dist_threshold (torch.tensor) – Euclidean distance between two sets of landmarks/vertices that we consider comes from two different faces (e.g., if d(lms1, lms2) >= dist_treshold, then we conclude that face 1 (lms1) is a different from face 2 (lms2)

Returns:

face_idx – An integer tensor of length n detections, in which each unique value represents a unique face

Return type:

torch.tensor

medusa.tracking.filter_faces(face_idx, n_img, present_threshold=0.1)[source]#

Function to filter faces based on various criteria.

For now, only filters based on how frequent a face is detected across frames.