Predict

class scripts.convert.Predict(queue_size: int, arguments: Namespace)

Bases: object

Obtains the output from the Faceswap model.

Parameters:
  • queue_size (int) – The maximum size of the input queue

  • arguments (Namespace) – The arguments that were passed to the convert process as generated from Faceswap’s command line arguments

Attributes Summary

centering

The centering that the model was trained on ("head", "face" or "legacy")

coverage_ratio

The coverage ratio that the model was trained at.

faces_count

The total number of faces seen by the Predictor.

has_predicted_mask

True if the model was trained to learn a mask, otherwise False.

in_queue

The input queue to the predictor.

out_queue

The output queue from the predictor.

output_size

The size in pixels of the Faceswap model output.

thread

The thread that is running the prediction function from the Faceswap model.

verify_output

True if multiple faces have been found in frames, otherwise False.

y_offset

The selected model y-offset value

Methods Summary

launch(load_queue)

Launch the prediction process in a background thread.

load_aligned(item)

Load the model's feed faces and the reference output faces.

Attributes Documentation

centering

The centering that the model was trained on (“head”, “face” or “legacy”)

coverage_ratio

The coverage ratio that the model was trained at.

Type:

float

faces_count

The total number of faces seen by the Predictor.

has_predicted_mask

True if the model was trained to learn a mask, otherwise False.

in_queue

The input queue to the predictor.

out_queue

The output queue from the predictor.

output_size

The size in pixels of the Faceswap model output.

thread

The thread that is running the prediction function from the Faceswap model.

verify_output

True if multiple faces have been found in frames, otherwise False.

y_offset

The selected model y-offset value

Methods Documentation

launch(load_queue: EventQueue) None

Launch the prediction process in a background thread.

Starts the prediction thread and returns the thread.

Parameters:

load_queue (EventQueue) – The queue that contains images and detected faces for feeding the model

Return type:

None

load_aligned(item: ConvertItem) None

Load the model’s feed faces and the reference output faces.

For each detected face in the incoming item, load the feed face and reference face images, correctly sized for input and output respectively.

Parameters:

item (ConvertItem) – The convert media object, containing the FrameFaces for the current image

Return type:

None

property centering: CenteringType

The centering that the model was trained on (“head”, “face” or “legacy”)

property coverage_ratio: float

The coverage ratio that the model was trained at.

Type:

float

property faces_count: int

The total number of faces seen by the Predictor.

property has_predicted_mask: bool

True if the model was trained to learn a mask, otherwise False.

property in_queue: EventQueue

The input queue to the predictor.

launch(load_queue: EventQueue) None

Launch the prediction process in a background thread.

Starts the prediction thread and returns the thread.

Parameters:

load_queue (EventQueue) – The queue that contains images and detected faces for feeding the model

Return type:

None

load_aligned(item: ConvertItem) None

Load the model’s feed faces and the reference output faces.

For each detected face in the incoming item, load the feed face and reference face images, correctly sized for input and output respectively.

Parameters:

item (ConvertItem) – The convert media object, containing the FrameFaces for the current image

Return type:

None

property out_queue: EventQueue

The output queue from the predictor.

property output_size: int

The size in pixels of the Faceswap model output.

property thread: MultiThread

The thread that is running the prediction function from the Faceswap model.

property verify_output: bool

True if multiple faces have been found in frames, otherwise False.

property y_offset: float

The selected model y-offset value