plugin_loader module
Plugin loader for Faceswap extract, training and convert tasks
- class plugins.plugin_loader.PluginLoader
Bases:
objectRetrieve, 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_aligner(name: str, disable_logging: bool = False) type[Aligner]
Return requested aligner plugin
- Parameters:
name (str) – The name of the requested aligner plugin
disable_logging (bool, optional) – Whether to disable the INFO log message that the plugin is being imported. Default: False
- Returns:
An extraction aligner plugin
- Return type:
plugins.extract.alignobject
- 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 ({'color', 'mask', 'scaling', 'writer'}) – The category of converter plugin to return the plugins for
add_none (bool, optional) – Append “none” to the list of returned plugins. Default: True
- Returns:
A list of the available converter plugin names in the given category
- Return type:
list
- static get_available_extractors(extractor_type: Literal['align', 'detect', 'mask'], add_none: bool = False, extend_plugin: bool = False) list[str]
Return a list of available extractors of the given type
- Parameters:
extractor_type ({'align', 'detect', 'mask'}) – The type of extractor to return the plugins for
add_none (bool, optional) – Append “none” to the list of returned plugins. Default: False
extend_plugin (bool, optional) – 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
- Returns:
A list of the available extractor plugin names for the given type
- Return type:
list
- static get_available_models() list[str]
Return a list of available training models
- Returns:
A list of the available training model plugin names
- Return type:
list
- 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, optional) – Whether to disable the INFO log message that the plugin is being imported. Default: False
- Returns:
A converter sub plugin
- Return type:
plugins.convertobject
- static get_default_model() str
Return the default training model plugin name
- Returns:
The default faceswap training model
- Return type:
str
- static get_detector(name: str, disable_logging: bool = False) type[Detector]
Return requested detector plugin
- Parameters:
name (str) – The name of the requested detector plugin
disable_logging (bool, optional) – Whether to disable the INFO log message that the plugin is being imported. Default: False
- Returns:
An extraction detector plugin
- Return type:
plugins.extract.detectobject
- static get_masker(name: str, disable_logging: bool = False) type[Masker]
Return requested masker plugin
- Parameters:
name (str) – The name of the requested masker plugin
disable_logging (bool, optional) – Whether to disable the INFO log message that the plugin is being imported. Default: False
- Returns:
An extraction masker plugin
- Return type:
plugins.extract.maskobject
- 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, optional) – Whether to disable the INFO log message that the plugin is being imported. Default: False
- Returns:
A training model plugin
- Return type:
plugins.train.modelobject
- static get_recognition(name: str, disable_logging: bool = False) type[Identity]
Return requested recognition plugin
- Parameters:
name (str) – The name of the requested reccognition plugin
disable_logging (bool, optional) – Whether to disable the INFO log message that the plugin is being imported. Default: False
- Returns:
An extraction recognition plugin
- Return type:
plugins.extract.recognitionobject
- 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, optional) – Whether to disable the INFO log message that the plugin is being imported. Default: False
- Returns:
A training trainer plugin
- Return type:
plugins.train.trainerobject