anomalib.deploy.inferencers.openvino_inferencer¶
This module contains inference-related abstract class and its Torch and OpenVINO implementations.
Module Contents¶
Classes¶
OpenVINO implementation for the inference. |
- class anomalib.deploy.inferencers.openvino_inferencer.OpenVINOInferencer(config: Union[str, pathlib.Path, omegaconf.DictConfig, omegaconf.ListConfig], path: Union[str, pathlib.Path, Tuple[bytes, bytes]], meta_data_path: Union[str, pathlib.Path] = None)[source]¶
Bases:
anomalib.deploy.inferencers.base_inferencer.InferencerOpenVINO implementation for the inference.
- Parameters
config (Union[str, Path, DictConfig, ListConfig]) – Configurable parameters that are used during the training stage.
path (Union[str, Path]) – Path to the openvino onnx, xml or bin file.
meta_data_path (Union[str, Path], optional) – Path to metadata file. Defaults to None.
- load_model(path: Union[str, pathlib.Path, Tuple[bytes, bytes]])[source]¶
Load the OpenVINO model.
- Parameters
path (Union[str, Path, Tuple[bytes, bytes]]) – Path to the onnx or xml and bin files or tuple of .xml and .bin data as bytes.
- Returns
- Input and Output blob names
together with the Executable network.
- Return type
[Tuple[str, str, ExecutableNetwork]]
- pre_process(image: numpy.ndarray) numpy.ndarray[source]¶
Pre process the input image by applying transformations.
- Parameters
image (np.ndarray) – Input image.
- Returns
pre-processed image.
- Return type
np.ndarray
- forward(image: numpy.ndarray) numpy.ndarray[source]¶
Forward-Pass input tensor to the model.
- Parameters
image (np.ndarray) – Input tensor.
- Returns
Output predictions.
- Return type
np.ndarray
- post_process(predictions: numpy.ndarray, meta_data: Optional[Union[Dict, omegaconf.DictConfig]] = None) Dict[str, Any][source]¶
Post process the output predictions.
- Parameters
predictions (np.ndarray) – Raw output predicted by the model.
meta_data (Dict, optional) – Meta data. Post-processing step sometimes requires additional meta data such as image shape. This variable comprises such info. Defaults to None.
- Returns
Post processed prediction results.
- Return type
Dict[str, Any]