FrameFaces
- class lib.infer.objects.FrameFaces(filename: str, image: npt.NDArray[np.uint8], bboxes: npt.NDArray[np.int32] | None = None, landmarks: npt.NDArray[np.float32] | None = None, identities: dict[str, npt.NDArray[np.float32]] | None = None, masks: dict[str, ExtractBatchMask] | None = None, source: str | None = None, is_aligned: bool = False, frame_metadata: PNGSource | None = None, passthrough: bool = False)
Bases:
objectAn object for holding information about faces in a single frame
- Parameters:
filename (str) – The original file name of the frame
image (npt.NDArray[np.uint8]) – The original frame or a faceswap aligned face image
bboxes (npt.NDArray[np.int32] | None) – The (N, Left, Top, Right, Bottom) bounding boxes of the faces in the frame. Default:
None(Not provided)landmarks (npt.NDArray[np.float32] | None) – The (N, M, 2) landmarks for each face in the frame, in frame space. Default:
None(Not provided)identities (dict[str, npt.NDArray[np.float32]] | None) – The identity matrices for each face in the frame. Default:
None(Not provided)masks (dict[str, ExtractBatchMask] | None) – The mask objects for each face in the frame. Default:
None(Not provided)source (str | None) – The full path to the source folder or video file. Default:
None(Not provided)is_aligned (bool) –
Trueif theimageis an aligned faceswap image otherwiseFalse. Used for face filtering with vggface2. Aligned faceswap images will automatically skip detection, alignment and masking. Default:Falseframe_metadata (PNGSource | None) – The frame metadata for aligned images.
Noneif the image is not an aligned imagepassthrough (bool) –
Trueif this item is meant to be passed straight through the extraction pipeline with no batching or caching. for immediate return. Default:False
Attributes Summary
A list of DetectedFace objects within the
imageThe (height, width) of the stored
imageThe (N, M, 2) landmarks for each face in the frame, in frame space
Methods Summary
append(batch)Append the data from the given batch object to this batch object
Delete the image and reset
imagetoNone.Attributes Documentation
- landmarks
The (N, M, 2) landmarks for each face in the frame, in frame space
Methods Documentation
- append(batch: FrameFaces) None
Append the data from the given batch object to this batch object
- Parameters:
batch (FrameFaces) – The object containing data to be appended to this object
- Return type:
None
- aligned
Holds the face landmarks found for this batch any any aligned data
- append(batch: FrameFaces) None
Append the data from the given batch object to this batch object
- Parameters:
batch (FrameFaces) – The object containing data to be appended to this object
- Return type:
None
- bboxes
The (N, Left, Top, Right, Bottom) bounding boxes of the faces in the frame
- property detected_faces: list[DetectedFace]
A list of DetectedFace objects within the
image
- filename
The original file name of the original frame
- frame_metadata: PNGSource | None
The frame metadata that has been added from an aligned image.
Noneif metadata has not been added
- identities
The identity matrices for each face in the frame
- image
The original frame or a faceswap aligned face image
- image_shape
The shape of the original frame
- property landmarks: ndarray[tuple[Any, ...], dtype[float32]] | None
The (N, M, 2) landmarks for each face in the frame, in frame space
- masks
The mask objects for each face in the frame
- passthrough
Trueif the contents of this item are meant to pass straight through the extraction pipeline for immediate return
- source
The full path to the source folder or video file or
Noneif not provided