Converter
- class lib.convert.Converter(output_size: int, coverage_ratio: float, centering: CenteringType, draw_transparent: bool, pre_encode: Callable | None, arguments: Namespace, config_file: str | None = None)
Bases:
objectThe converter is responsible for swapping the original face(s) in a frame with the output of a trained Faceswap model.
- Parameters:
output_size (int) – The size of the face, in pixels, that is output from the Faceswap model
coverage_ratio (float) – The ratio of the training image that was used for training the Faceswap model
centering (CenteringType) – The extracted face centering that the model was trained on (“face” or “legacy”)
draw_transparent (bool) – Whether the final output should be drawn onto a transparent layer rather than the original frame. Only available with certain writer plugins.
pre_encode (Callable | None) – Some writer plugins support the pre-encoding of images prior to saving out. As patching is done in multiple threads, but writing is done in a single thread, it can speed up the process to do any pre-encoding as part of the converter process.
arguments (Namespace) – The arguments that were passed to the convert process as generated from Faceswap’s command line arguments
config_file (str | None) – Optional location of custom configuration
inifile. IfNonethen use the default config location. Default:None
Attributes Summary
The command line arguments passed to the convert process
Methods Summary
process(in_queue, out_queue)Main convert process.
Reinitialize this
Converter.Attributes Documentation
- cli_arguments
The command line arguments passed to the convert process
Methods Documentation
- process(in_queue: EventQueue, out_queue: EventQueue)
Main convert process.
Takes items from the in queue, runs the relevant adjustments, patches faces to final frame and outputs patched frame to the out queue.
- Parameters:
in_queue (EventQueue) – The output from
scripts.convert.Predictor. Contains detected faces from the Faceswap model as well as the frame to be patched.out_queue (EventQueue) – The queue to place patched frames into for writing by one of Faceswap’s
plugins.convert.writerplugins.
- reinitialize() None
Reinitialize this
Converter.Called as part of the
previewtool. Resets all adjustments then loads the plugins as specified in the current config.- Return type:
None
- property cli_arguments: Namespace
The command line arguments passed to the convert process
- process(in_queue: EventQueue, out_queue: EventQueue)
Main convert process.
Takes items from the in queue, runs the relevant adjustments, patches faces to final frame and outputs patched frame to the out queue.
- Parameters:
in_queue (EventQueue) – The output from
scripts.convert.Predictor. Contains detected faces from the Faceswap model as well as the frame to be patched.out_queue (EventQueue) – The queue to place patched frames into for writing by one of Faceswap’s
plugins.convert.writerplugins.