SortMultiMethod

class tools.sort.sort_methods.SortMultiMethod(arguments: Namespace, sort_method: SortMethod, group_method: SortMethod)

Bases: SortMethod

A Parent sort method that runs 2 different underlying methods (one for sorting one for binning) in instances where grouping has been requested, but the sort method is different from the group method

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

  • sort_method (SortMethod) – A sort method object for sorting the images

  • group_method (SortMethod) – A sort method object used for sorting and binning the images

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

Override standard binning, to bin by the group-by method and sort by the sorting method.

score_image(filename, image, alignments)

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

sort()

Sort the sorter and grouper methods

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

Override standard binning, to bin by the group-by method and sort by the sorting method.

Go through the grouped binned results, and reorder each bin contents based on the sorted list

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

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 the sorter and grouper methods

Return type:

None

binning() list[list[str]]

Override standard binning, to bin by the group-by method and sort by the sorting method.

Go through the grouped binned results, and reorder each bin contents based on the sorted list

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

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 the sorter and grouper methods

Return type:

None