InfoLoader

class tools.sort.info_loader.InfoLoader(input_dir: str, info_type: Literal['face', 'meta', 'all'])

Bases: object

Loads aligned faces and/or face metadata

Parameters:
  • input_dir (str) – Full path to containing folder of faces to be supported

  • loader_type – Dictates the type of iterator that will be used. “face” just loads the image with the filename, “meta” just loads the image alignment data with the filename. “all” loads the image and the alignment data with the filename

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

Attributes Summary

filelist_count

The number of files to be processed

Methods Summary

__call__()

Return the selected iterator

update_png_header(filename, alignments)

Update the PNG header of the given file with the given alignments.

Attributes Documentation

filelist_count

The number of files to be processed

Methods Documentation

__call__() ImgMetaType

Return the selected iterator

The resulting generator:

Yields:
  • filename – The filename that has been read

  • image – The aligned face image loaded from disk for ‘face’ and ‘all’ info_types otherwise None

  • alignments – The alignments dict for ‘all’ and ‘meta’ info_types otherwise None

Return type:

ImgMetaType

update_png_header(filename: str, alignments: PNGAlignments) None

Update the PNG header of the given file with the given alignments.

NB: Header information can only be updated if the face is already on at least alignment version 2.2. If below this version, then the header is not updated

Parameters:
  • filename (str) – Full path to the PNG file to update

  • alignments (dict) – The alignments to update into the PNG header

Return type:

None

__call__() ImgMetaType

Return the selected iterator

The resulting generator:

Yields:
  • filename – The filename that has been read

  • image – The aligned face image loaded from disk for ‘face’ and ‘all’ info_types otherwise None

  • alignments – The alignments dict for ‘all’ and ‘meta’ info_types otherwise None

Return type:

ImgMetaType

cached_source_data: dict[str, PNGSource]

The source data read from the PNG header for each processed face

property filelist_count: int

The number of files to be processed

update_png_header(filename: str, alignments: PNGAlignments) None

Update the PNG header of the given file with the given alignments.

NB: Header information can only be updated if the face is already on at least alignment version 2.2. If below this version, then the header is not updated

Parameters:
  • filename (str) – Full path to the PNG file to update

  • alignments (dict) – The alignments to update into the PNG header

Return type:

None