SortAlignedMetric
- class tools.sort.sort_methods_aligned.SortAlignedMetric(arguments: Namespace, loader_type: T.Literal['face', 'meta', 'all'] = 'meta', is_group: bool = False)
Bases:
SortMethodSort by comparison of metrics stored in an Aligned Face objects. This is a parent class for sort by aligned metrics methods. Individual methods should inherit from this class
- Parameters:
arguments (
argparse.Namespace) – The command line arguments passed to the sort processsort_reverse (bool, optional) –
Trueif the sorted results should be in reverse order. Default:Trueis_group (bool, optional) – Set to
Trueif this class is going to be called exclusively for binning. Default:Falseloader_type (T.Literal['face', 'meta', 'all'])
Attributes Summary
The name of each created bin, if they exist, otherwise an empty list
List of bins (list) containing the filenames belonging to the bin.
The loader that this sorter uses
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: "distance", "yaw", "pitch" or "size" and add the result to
_resultsort()Sort by metric score.
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. Override for method specific binning techniques.
Binning takes the results from
_resultcompiled during_sort_filelist()and organizes into bins for output.- 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.ndarrayorNone) – A face image loaded from disk orNonealignments (dict or
None) – The alignments dictionary for the aligned face orNone
- Return type:
None
- sort() None
Sort by metric score. Order in reverse for distance sort.
- Return type:
None
- 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.ndarrayorNone) – A face image loaded from disk orNonealignments (dict or
None) – The alignments dictionary for the aligned face orNone
- Return type:
None
- sort() None
Sort by metric score. Order in reverse for distance sort.
- Return type:
None