Tools

face_engine.tools.imread(uri, mode=None)

Reads an image from the specified file.

References:
  1. https://pillow.readthedocs.io/en/stable/reference/Image.html
  2. https://stackoverflow.com/questions/7160737
Parameters:
  • uri (Union[str, bytes, file, os.PathLike]) – image file, file path or url
  • mode (str) – format mode to convert the image to. More info on accepted mode types see on [1].
Returns:

image content as unsigned 8-bit numpy array

Return type:

uint8

face_engine.tools.import_module(filepath)

Convenient function to import module by given filepath.

Note that this function is using file path unlike importlib’s import_module.

Parameters:filepath (Union[str, bytes, os.PathLike, Path]) – absolute or relative filepath
face_engine.tools.import_package(package)

Convenient function to import all modules of given package except __init__.py

Parameters:package (Union[str, bytes, os.PathLike, Path]) – absolute or relative filepath to the package

Fetching tools

Fetching tools. Used to download and unpack project models and testing data.

face_engine.fetching.fetch_file(url, extract_dir=None)

Fetch file by URL to extract_dir folder

face_engine.fetching.unpack_archive(filename, extract_dir=None)

shutil.unpack_archive wrapper to unpack [‘.dat.bz2’] archive.

Parameters:
  • filename – name of the archive.
  • extract_dir – name of the target directory, where the archive is unpacked. If not provided, the current working directory is used.