SortFace

class tools.sort.sort_methods.SortFace(arguments: Namespace, is_group: bool = False)

Bases: SortMethod

Sort by identity similarity using an Identity plugin

Parameters:
  • arguments (Namespace) – The command line arguments passed to the sort process

  • is_group (bool) – Set to True if this class is going to be called exclusively for binning. Default: False

Attributes Summary

bin_names

The name of each created bin, if they exist, otherwise an empty list

binned

List of bins (list) containing the filenames belonging to the bin.

loader_type

The loader that this sorter uses

sorted_filelist

List of sorted filenames for given sorter in a single list.

Methods Summary

binning()

Group into bins by their sorted score

score_image(filename, image, alignments)

Score a single image for sort method and add the result to _result.

sort()

Sort by dendrogram.

Attributes Documentation

bin_names

The name of each created bin, if they exist, otherwise an empty list

binned

List of bins (list) containing the filenames belonging to the bin. The binning process is called when this property is first accessed

loader_type

The loader that this sorter uses

Type:

[“face”, “meta”, “all”]

sorted_filelist

List of sorted filenames for given sorter in a single list. The sort process is called when this property is first accessed

Methods Documentation

binning() list[list[str]]

Group into bins by their sorted score

The bin ID has been output in the 2nd column of _result so use that for binning

Return type:

List of bins of filenames

score_image(filename: str, image: np.ndarray | None, alignments: PNGAlignments | None) None

Score a single image for sort method and add the result to _result. Attempts to pull identity information from the PNG metadata. If not available, pulls the information from the Identity plugin and stores in the PNG header for future use

Parameters:
  • filename (str) – The filename of the currently processing image

  • image (np.ndarray | None) – A face image loaded from disk or None

  • alignments (PNGAlignments | None) – The alignments dictionary for the aligned face or None

Return type:

None

sort() None

Sort by dendrogram.

Parameters:

matched_list – The list of tuples with filename in first position and face encoding in the 2nd

Return type:

The original list, sorted for this metric

binning() list[list[str]]

Group into bins by their sorted score

The bin ID has been output in the 2nd column of _result so use that for binning

Return type:

List of bins of filenames

score_image(filename: str, image: np.ndarray | None, alignments: PNGAlignments | None) None

Score a single image for sort method and add the result to _result. Attempts to pull identity information from the PNG metadata. If not available, pulls the information from the Identity plugin and stores in the PNG header for future use

Parameters:
  • filename (str) – The filename of the currently processing image

  • image (np.ndarray | None) – A face image loaded from disk or None

  • alignments (PNGAlignments | None) – The alignments dictionary for the aligned face or None

Return type:

None

sort() None

Sort by dendrogram.

Parameters:

matched_list – The list of tuples with filename in first position and face encoding in the 2nd

Return type:

The original list, sorted for this metric