ExtractIterator

class lib.infer.iterator.ExtractIterator(queue: Queue[QueueItemInT | ExtractSignal], name: str, plugin_type: T.Literal['detect', 'align', 'mask', 'identity', 'file'], batch_size: int, error_state: ErrorState)

Bases: Generic[QueueItemInT, QueueItemOutT], ABC

Base class for iterators within Faceswap’s extract pipeline

Type Parameters

QueueItemInT

Type of item received from the input queue.

QueueItemOutT

Type yielded by the iterator.

param queue:

The inbound queue to the plugin

param name:

The plugin name and process calling this iterator

param plugin_type:

The type of extractor plugin that this iterator is serving

param batch_size:

The batch size that data should be returned from the iterator

param error_state:

The pipeline threads’ global Error State object

abstractmethod __next__() QueueItemOutT | ExtractSignal

Override to return the next batch item from the iterator

Returns:

Batch object for pipeline processing, or a final media object when exiting the pipeline.

Return type:

ExtractBatch or FrameFaces or ExtractSignal

Parameters: