:py:mod:`wsinfer.modellib.run_inference` ======================================== .. py:module:: wsinfer.modellib.run_inference .. autoapi-nested-parse:: Run inference. From the original paper (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7369575/): > In the prediction (test) phase, no data augmentation was applied except for the > normalization of the color channels. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: wsinfer.modellib.run_inference.run_inference .. py:function:: run_inference(wsi_dir: str | pathlib.Path, results_dir: str | pathlib.Path, model_info: wsinfer_zoo.client.HFModelTorchScript | wsinfer.modellib.models.LocalModelTorchScript, batch_size: int = 32, num_workers: int = 0, speedup: bool = False) -> tuple[list[str], list[str]] Run model inference on a directory of whole slide images and save results to CSV. This assumes the patching has already been done and the results are stored in `results_dir`. An error will be raised otherwise. Output CSV files are written to `{results_dir}/model-outputs/`. :param wsi_dir: Directory containing whole slide images. This directory can *only* contain whole slide images. Otherwise, an error will be raised during model inference. :type wsi_dir: str or Path :param results_dir: Directory containing results of patching. :type results_dir: str or Path :param model_info: Instance of Weights including the model object and information about how to apply the model to new data. :param batch_size: The batch size during the forward pass (default is 32). :type batch_size: int :param num_workers: Number of workers for data loading (default is 0, meaning use a single thread). :type num_workers: int :param speedup: If True, JIT-compile the model. This has a startup cost but model inference should be faster (default False). :type speedup: bool :returns: * *A tuple of two lists of strings. The first list contains the slide IDs for which* * *patching failed, and the second list contains the slide IDs for which model* * *inference failed.*