SortDistance

class tools.sort.sort_methods_aligned.SortDistance(arguments: Namespace, loader_type: T.Literal['face', 'meta', 'all'] = 'meta', is_group: bool = False)

Bases: SortAlignedMetric

Sorting mechanism for sorting faces from small to large

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()

Create bins to split linearly from the lowest to the highest sample value

score_image(filename, image, alignments)

Score a single image for sort method: "distance", "yaw", "pitch" or "size" and add the result to _result

sort()

Override default sort to sort in ascending order.

Attributes Documentation

Parameters:
  • arguments (Namespace)

  • loader_type (T.Literal['face', 'meta', 'all'])

  • is_group (bool)

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]]

Create bins to split linearly from the lowest to the highest sample value

Returns:

List of bins of filenames

Return type:

list

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

Score a single image for sort method: “distance”, “yaw”, “pitch” or “size” and add the result to _result

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

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

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

Return type:

None

sort() None

Override default sort to sort in ascending order.

Return type:

None

binning() list[list[str]]

Create bins to split linearly from the lowest to the highest sample value

Returns:

List of bins of filenames

Return type:

list

sort() None

Override default sort to sort in ascending order.

Return type:

None