ExtractHandlerFace
- class lib.infer.handler.ExtractHandlerFace(plugin: str, compile_model: bool = False, config_file: str | None = None)
Bases:
ExtractHandler,ABCHandles an extract plugin. Extended with methods common to plugins that use aligned face images as input
- Parameters:
plugin (FacePlugin) – The name of the plugin that this runner is to use
compile_model (bool) –
Trueto compile any PyTorch modelsconfig_file (str | None) – Full path to a custom config file to load.
Nonefor default config
Attributes Summary
The batch size of the plugin
The processors which should have thread's launched for this handler
The runner that runs this handler
Methods Summary
__call__([input_plugin, profile])Build and start the plugin handler's runner
Load the model, compile it, if requested, and send a warmup batch through.
Called after the final item is put to the out queue.
post_process(batch)Perform post-processing on the given batch object, ready for exit from the plugin.
pre_process(batch)Override to perform plugin type specific behavior for pre-processing on the given batch object, ready for inference.
process(batch)Perform inference to get results from the plugin for the given batch.
Attributes Documentation
- batch_size
The batch size of the plugin
- processors = ('pre_process', 'process', 'post_process')
The processors which should have thread’s launched for this handler
- runner
The runner that runs this handler
Methods Documentation
- __call__(input_plugin: ExtractHandler | ExtractRunner | None = None, profile: bool = False) ExtractRunner
Build and start the plugin handler’s runner
- Parameters:
input_plugin (ExtractHandler | ExtractRunner | None) – The input plugin handler or it’s runner that feeds this handler.
Noneif data is to be fed through the handler runner’s put method (ie, the first handler in an extraction chain). Default:Noneprofile (bool) –
Trueif the runner is to be profiled, indicating that threads will not be started. Default:False
- Return type:
The extract plugin handler’s runner for this handler
- init_model() None
Load the model, compile it, if requested, and send a warmup batch through. Called either from the main thread, if compiling, or from the inference thread if not.
- Return type:
None
- output_info() None
Called after the final item is put to the out queue. Override for plugin runner specific output
- Return type:
None
- abstractmethod post_process(batch: ExtractBatch) None
Perform post-processing on the given batch object, ready for exit from the plugin. Override for plugin type specific behavior
- Parameters:
batch (ExtractBatch) – The incoming ExtractBatch to use for post-processing
- Return type:
None
- abstractmethod pre_process(batch: ExtractBatch) None
Override to perform plugin type specific behavior for pre-processing on the given batch object, ready for inference.
- Parameters:
batch (ExtractBatch) – The incoming ExtractBatch to use for pre-processing
- Return type:
None
- process(batch: ExtractBatch) None
Perform inference to get results from the plugin for the given batch. Override for plugin type specific processing
- Parameters:
batch (ExtractBatch) – The incoming ExtractBatch to use for processing
- Return type:
None
- plugin: FacePlugin
The extraction plugin that this handler manages
- process(batch: ExtractBatch) None
Perform inference to get results from the plugin for the given batch. Override for plugin type specific processing
- Parameters:
batch (ExtractBatch) – The incoming ExtractBatch to use for processing
- Return type:
None
- storage_name
The name that the object will be stored with in the alignments file