leaf.inference

Module Contents

class leaf.inference.Predictor(config_path: str = 'config', config_name: str = 'canopy_portrait', symptoms_det_params: dict | None = None, symptoms_seg_params: dict | None = None, organs_params: dict | None = None, focus_params: dict | None = None, module_params: dict | None = None)

This class is used to unify the complete pipeline into a single object with a simple predict method. It provides capability to use a yaml file configuration for repeatability. Furthermore, it allows for passing all the arguments for cofigring the individual building blocks of the pipeline. If a new block

Constructor of the predictor object. For possible parameters to configure see either the individual models directly or see the configuration yaml files in the config folder.

Parameters:
  • config_path (str, optional) – relative path from the location of this file to a config directory. Defaults to “config”.

  • config_name (str, optional) – name of a config within the config_path directory. New configurations can be added. Defaults to “canopy_portrait”.

  • symptoms_det_params (Union[dict, None], optional) – An optional dictionary which directly passes the contents as **kwargs to symptoms detection model. It overrides the parameters from the configuration file. Defaults to None.

  • symptoms_seg_params (Union[dict, None], optional) – An optional dictionary which directly passes the contents as **kwargs to symptoms segmentation model. It overrides the parameters from the configuration file. Defaults to None.

  • organs_params (Union[dict, None], optional) – An optional dictionary which directly passes the contents as **kwargs to organs segmentation model. It overrides the parameters from the configuration file. Defaults to None.

  • focus_params (Union[dict, None], optional) – An optional dictionary which directly passes the contents as **kwargs to focus estimation model. It overrides the parameters from the configuration file. Defaults to None.

  • module_params (Union[dict, None], optional) – An optional dictionary which controls which parts of the pipeline are executed. It overrides the parameters from the configuration file. Defaults to None.

module_params
symptoms_det_params
symptoms_seg_params
organs_params
focus_params
predict(images_src: str, export_dst: str) None

This method provides a simple interface to predict on images from a specified folder and save the results to a specified location.

Parameters:
  • images_src (str) – Path to location of images.

  • export_dst (str) – Path where the results should be saved.