InboundIterator

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

Bases: ExtractIterator[ExtractBatch, ExtractBatch]

An iterator that processes ExtractBatch data from a previous plugin and configures it as an input for the current plugin.

An Inbound iterator assumes that the plugin’s batch size are the number of faces (not frames) that it can process at one time. Detect plugins are the only plugins that work with frames rather than faces, but these will always be the input to the pipeline, so will use an InputIterator not an InboundIterator

Parameters:
  • queue (Queue[QueueItemInT | ExtractSignal]) – The outbound queue from the previous plugin

  • name (str) – The plugin name and process calling this iterator

  • plugin_type (T.Literal['detect', 'align', 'mask', 'identity', 'file']) – The type of extractor plugin that this iterator is serving

  • batch_size (int) – The batch size that data should be returned from the iterator

  • error_state (ErrorState)

__next__() ExtractBatch | ExtractSignal

Get the next batch of data from the iterator. Depending on the plugin type calling this iterator, a batch object will be returned for the given batch size of frames (for detect plugins) or faces (for all other plugins)

Returns:

A new ExtractBatch object containing the batch to process through the plugin or an ExtractSignal

Return type:

ExtractBatch or ExtractSignal

Raises:

StopIteration – When the input is exhausted