Samples

class tools.preview.preview.Samples(app: Preview, arguments: Namespace, sample_size: int)

Bases: object

The display samples.

Obtains and holds sample_size semi random test faces for displaying in the preview GUI.

The file list is split into evenly sized groups of sample_size. When a display set is generated, a random image from each of the groups is selected to provide an array of images across the length of the video.

Parameters:
  • app (Preview) – The main tkinter Preview app

  • arguments (Namespace) – The argparse arguments as passed in from tools.py

  • sample_size (int) – The number of samples to take from the input video/images

Attributes Summary

alignments

The alignments for the preview faces

available_masks

The mask names that are available for every face in the alignments file

predicted_images

The predicted faces output from the Faceswap model

predictor

The Predictor for the Faceswap model

sample_size

The number of samples to take from the input video/images

Methods Summary

generate()

Generate a sample set.

Attributes Documentation

alignments

The alignments for the preview faces

available_masks

The mask names that are available for every face in the alignments file

predicted_images

The predicted faces output from the Faceswap model

predictor

The Predictor for the Faceswap model

sample_size

The number of samples to take from the input video/images

Methods Documentation

generate() None

Generate a sample set.

Selects sample_size random faces. Runs them through prediction to obtain the swap, then trigger the patch event to run the faces through patching.

Return type:

None

property alignments: Alignments

The alignments for the preview faces

property available_masks: list[str]

The mask names that are available for every face in the alignments file

generate() None

Generate a sample set.

Selects sample_size random faces. Runs them through prediction to obtain the swap, then trigger the patch event to run the faces through patching.

Return type:

None

property predicted_images: list[tuple[ConvertItem, ndarray]]

The predicted faces output from the Faceswap model

property predictor: Predict

The Predictor for the Faceswap model

property sample_size: int

The number of samples to take from the input video/images