plugins.plugin_loader Module
Plugin loader for Faceswap extract, training and convert tasks
- class plugins.plugin_loader.PluginLoader
Retrieve, or get information on, Faceswap plugins
Return a specific plugin, list available plugins, or get the default plugin for a task.
Example
>>> from plugins.plugin_loader import PluginLoader >>> align_plugins = PluginLoader.get_available_extractors('align') >>> aligner = PluginLoader.get_aligner('cv2-dnn')
- static get_available_convert_plugins(convert_category: str, add_none: bool = True) list[str]
Return a list of available converter plugins in the given category
- Parameters:
convert_category (str) – The category of converter plugin to return the plugins for
add_none (bool) – Append “none” to the list of returned plugins. Default: True
- Return type:
A list of the available converter plugin names in the given category
- classmethod get_available_extractors(extractor_type: Literal['align', 'detect', 'identity', 'mask'], add_none: bool = False, extend_plugin: bool = False) list[str]
Return a list of available extractors of the given type
- Parameters:
extractor_type (Literal['align', 'detect', 'identity', 'mask']) – The type of extractor to return the plugins for
add_none (bool) – Append “none” to the list of returned plugins. Default: False
extend_plugin (bool) – Some plugins have configuration options that mean that multiple ‘pseudo-plugins’ can be generated based on their settings. An example of this is the bisenet-fp mask which, whilst selected as ‘bisenet-fp’ can be stored as ‘bisenet-fp-face’ and ‘bisenet-fp-head’ depending on whether hair has been included in the mask or not.
Truewill generate each pseudo-plugin,Falsewill generate the original plugin name. Default:False
- Return type:
A list of the available extractor plugin names for the given type
- static get_available_models() list[str]
Return a list of available training models
- Return type:
A list of the available training model plugin names
- static get_converter(category: str, name: str, disable_logging: bool = False) Callable
Return requested converter plugin
Converters work slightly differently to other faceswap plugins. They are created to do a specific task (e.g. color adjustment, mask blending etc.), so multiple plugins will be loaded in the convert phase, rather than just one plugin for the other phases.
- Parameters:
name (str) – The name of the requested converter plugin
disable_logging (bool) – Whether to disable the INFO log message that the plugin is being imported. Default: False
category (str)
- Return type:
A converter sub plugin
- static get_default_model() str
Return the default training model plugin name
- Return type:
The default faceswap training model
- classmethod get_extractor(plugin_type: T.Literal['align', 'detect', 'identity', 'mask'], name: str) ExtractPlugin
Return requested extractor plugin
- Parameters:
type – The type of extractor plugin to obtain
name (str) – The name of the requested extractor plugin
plugin_type (T.Literal['align', 'detect', 'identity', 'mask'])
- Return type:
An extraction plugin
- Raises:
ValueError – If an invalid plugin type or plugin name is selected
- static get_model(name: str, disable_logging: bool = False) type[ModelBase]
Return requested training model plugin
- Parameters:
name (str) – The name of the requested training model plugin
disable_logging (bool) – Whether to disable the INFO log message that the plugin is being imported. Default: False
- Return type:
A training model plugin
- static get_trainer(name: str, disable_logging: bool = False) type[TrainerBase]
Return requested training trainer plugin
- Parameters:
name (str) – The name of the requested training trainer plugin
disable_logging (bool) – Whether to disable the INFO log message that the plugin is being imported. Default: False
- Return type:
A training trainer plugin
- plugins.plugin_loader.get_extractors() dict[str, list[str]]
Obtain a dictionary of all available extraction plugins by plugin type
- Return type:
A list of all available plugins for each extraction plugin type
Functions
Obtain a dictionary of all available extraction plugins by plugin type |
Classes
Retrieve, or get information on, Faceswap plugins |
Class Inheritance Diagram
