Cluster

class lib.infer.identity.Cluster(predictions: ndarray, method: Literal['single', 'centroid', 'median', 'ward'], threshold: float | None = None)

Bases: object

Cluster the outputs from a VGG-Face 2 Model

Parameters:
  • predictions (np.ndarray) – A stacked matrix of identity predictions of the shape (N, D) where N is the number of observations and D are the number of dimensions. NB: The given predictions will be overwritten to save memory. If you still require the original values you should take a copy prior to running this method

  • method (T.Literal['single', 'centroid', 'median', 'ward']) – The clustering method to use.

  • threshold (float | None) – The threshold to start creating bins for. Set to None to disable binning

Methods Summary

__call__()

Process the linkages.

Methods Documentation

__call__() list[tuple[int, int]]

Process the linkages.

Transforms a distance matrix into a sorted distance matrix according to the order implied by the hierarchical tree (dendrogram).

Returns:

  • List of indices with the order implied by the hierarchical tree or list of tuples of

  • (index, bin) if a binning threshold was provided

Return type:

list[tuple[int, int]]

__call__() list[tuple[int, int]]

Process the linkages.

Transforms a distance matrix into a sorted distance matrix according to the order implied by the hierarchical tree (dendrogram).

Returns:

  • List of indices with the order implied by the hierarchical tree or list of tuples of

  • (index, bin) if a binning threshold was provided

Return type:

list[tuple[int, int]]