LandmarkMatcher
- class lib.training.data.collate.LandmarkMatcher(folders: list[str], size: int, centering: CenteringType, coverage: float, y_offset: float, num_choices: int = 10)
Bases:
objectPrepares landmarks when Warp-to-Landmarks is enabled.
2 sides (A/B) only.
For each side, stores the aligned landmarks for each side and collates the 10 nearest matches on the other side for random warping
- Parameters:
folders (list[str]) – Two training folders for sides A and B
size (int) – The aligned face size to transform the landmarks to
centering (CenteringType) – The aligned centering to transform the landmarks to
coverage (float) – Additional coverage ratio to be applied
y_offset (float) – Additional vertical offset to be applied
num_choices (int) – Number of choices from the opposite side to cache for each landmark. Default: 10
Methods Summary
get_close_landmarks(indices)For the given image indices, obtain a randomly selected close match landmarks from the other side
Methods Documentation
- get_close_landmarks(indices: npt.NDArray[np.int64]) npt.NDArray[np.float32]
For the given image indices, obtain a randomly selected close match landmarks from the other side
- Parameters:
indices (npt.NDArray[np.int64]) – The (num_inputs, landmark_indices) image file indices to obtain the matches for
- Returns:
2 sets of landmarks in shape (num_sides * batch_size, num_sides, 68, 2) stacked to a batch
of landmark points for augmentation
- Return type:
npt.NDArray[np.float32]
- get_close_landmarks(indices: npt.NDArray[np.int64]) npt.NDArray[np.float32]
For the given image indices, obtain a randomly selected close match landmarks from the other side
- Parameters:
indices (npt.NDArray[np.int64]) – The (num_inputs, landmark_indices) image file indices to obtain the matches for
- Returns:
2 sets of landmarks in shape (num_sides * batch_size, num_sides, 68, 2) stacked to a batch
of landmark points for augmentation
- Return type:
npt.NDArray[np.float32]