Mask
- class lib.infer.mask.Mask(plugin: str, compile_model: bool = False, config_file: str | None = None)
Bases:
ExtractHandlerFaceResponsible for running Masking plugins within the extract pipeline
- Parameters:
plugin (str) – 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 mask post processing.
pre_process(batch)Obtain the aligned face images at the requested size, centering and image format.
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
- post_process(batch: ExtractBatch) None
Perform mask post processing.
Obtains the final output from the mask plugins and masks any part of the face patch that goes out of bounds
- Parameters:
batch (ExtractBatch) – The incoming ExtractBatch to use for post-processing
- Return type:
None
- pre_process(batch: ExtractBatch) None
Obtain the aligned face images at the requested size, centering and image format. Perform any plugin specific pre-processing
- 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
- post_process(batch: ExtractBatch) None
Perform mask post processing.
Obtains the final output from the mask plugins and masks any part of the face patch that goes out of bounds
- Parameters:
batch (ExtractBatch) – The incoming ExtractBatch to use for post-processing
- Return type:
None
- pre_process(batch: ExtractBatch) None
Obtain the aligned face images at the requested size, centering and image format. Perform any plugin specific pre-processing
- Parameters:
batch (ExtractBatch) – The incoming ExtractBatch to use for pre-processing
- Return type:
None