:py:mod:`anomalib.utils.sweep.helpers` ====================================== .. py:module:: anomalib.utils.sweep.helpers .. autoapi-nested-parse:: Helpers for benchmarking and hyperparameter optimization. Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 callbacks/index.rst inference/index.rst Package Contents ---------------- Functions ~~~~~~~~~ .. autoapisummary:: anomalib.utils.sweep.helpers.get_sweep_callbacks anomalib.utils.sweep.helpers.get_openvino_throughput anomalib.utils.sweep.helpers.get_torch_throughput .. py:function:: get_sweep_callbacks(config: Union[omegaconf.ListConfig, omegaconf.DictConfig]) -> List[pytorch_lightning.Callback] Gets callbacks relevant to sweep. :param config: Model config loaded from anomalib :type config: Union[DictConfig, ListConfig] :returns: List of callbacks :rtype: List[Callback] .. py:function:: get_openvino_throughput(config: Union[omegaconf.DictConfig, omegaconf.ListConfig], model_path: pathlib.Path, test_dataset: torch.utils.data.DataLoader) -> float Runs the generated OpenVINO model on a dummy dataset to get throughput. :param config: Model config. :type config: Union[DictConfig, ListConfig] :param model_path: Path to folder containing the OpenVINO models. It then searches `model.xml` in the folder. :type model_path: Path :param test_dataset: The test dataset used as a reference for the mock dataset. :type test_dataset: DataLoader :returns: Inference throughput :rtype: float .. py:function:: get_torch_throughput(config: Union[omegaconf.DictConfig, omegaconf.ListConfig], model: anomalib.models.components.AnomalyModule, test_dataset: torch.utils.data.DataLoader) -> float Tests the model on dummy data. Images are passed sequentially to make the comparision with OpenVINO model fair. :param config: Model config. :type config: Union[DictConfig, ListConfig] :param model: Model on which inference is called. :type model: Path :param test_dataset: The test dataset used as a reference for the mock dataset. :type test_dataset: DataLoader :returns: Inference throughput :rtype: float