Samples

class lib.training.preview.Samples(coverage_ratio: float, has_mask: bool, mask_opacity: int, mask_color: str)

Bases: object

Compile samples for display for preview and time-lapse

Parameters:
  • coverage_ratio (float) – Ratio of face to be cropped out of the training image.

  • has_mask (bool) – True if the model was trained with a mask

  • mask_opacity (int) – The opacity (as a percentage) to use for the mask overlay

  • mask_color (str) – The hex RGB value to use the mask overlay

Methods Summary

get_preview(predictions, targets)

Compile a preview image.

toggle_mask_display()

Toggle the mask overlay on or off depending on user input.

Methods Documentation

get_preview(predictions: npt.NDArray[np.float32], targets: npt.NDArray[np.float32]) npt.NDArray[np.uint8]

Compile a preview image.

Predictions

The (BGR) predictions shape: (src_side, dst_side, batch_size, height, width, channels)

targets

Full size BGR face patches at 100% coverage for patching predictions into in (A, B, …) order

Return type:

A compiled preview image ready for display or saving

Parameters:
  • predictions (npt.NDArray[np.float32])

  • targets (npt.NDArray[np.float32])

toggle_mask_display() None

Toggle the mask overlay on or off depending on user input.

Return type:

None

get_preview(predictions: npt.NDArray[np.float32], targets: npt.NDArray[np.float32]) npt.NDArray[np.uint8]

Compile a preview image.

Predictions

The (BGR) predictions shape: (src_side, dst_side, batch_size, height, width, channels)

targets

Full size BGR face patches at 100% coverage for patching predictions into in (A, B, …) order

Return type:

A compiled preview image ready for display or saving

Parameters:
  • predictions (npt.NDArray[np.float32])

  • targets (npt.NDArray[np.float32])

toggle_mask_display() None

Toggle the mask overlay on or off depending on user input.

Return type:

None