def __init__(
        self,
        *,
        evaluator_factory: Callable[
            [Any, List[str]], DetectionEvaluator[TDetPredictions_co, TDetModelOutput]
        ] = coco_evaluator_factory,
        gt_api_def: Sequence[
            SupportedDatasetApiDef
        ] = DEFAULT_SUPPROTED_DETECTION_DATASETS,
        default_to_coco=False,
        save_folder=None,
        filename_prefix="model_output",
        save_stream="test",
        iou_types: Union[str, List[str]] = "bbox",
        summarize_to_stdout: bool = True,
    ):
        """
        Creates an instance of DetectionMetrics.

        :param evaluator_factory: The factory for the evaluator to use. By
            default, the COCO evaluator will be used. The factory should accept
            2 parameters: the API object containing the test annotations and
            the list of IOU types to consider. It must return an instance
            of a DetectionEvaluator.
        :param gt_api_def: The name and type of the API to search.
            The name must be the name of the field of the original dataset,
            while the Type must be the one the API object.
            For instance, for :class:`LvisDataset` is `('lvis_api', lvis.LVIS)`.
            Defaults to the datasets explicitly supported by Avalanche.
        :param default_to_coco: If True, it will try to convert the dataset
            to the COCO format.
        :param save_folder: path to the folder where to write model output
            files. Defaults to None, which means that the model output of
            test instances will not be stored.
        :param filename_prefix: prefix common to all model outputs files.
            Ignored if `save_folder` is None. Defaults to "model_output"
        :param iou_types: list of (or a single string) strings describing
            the iou types to use when computing metrics.
            Defaults to "bbox". Valid values are usually "bbox" and "segm",
            but this may vary depending on the dataset.
        :param summarize_to_stdout: if True, a summary of evaluation metrics
            will be printed to stdout (as a table) using the Lvis API.
            Defaults to True.
        """
        super().__init__()

        if save_folder is not None:
            os.makedirs(save_folder, exist_ok=True)

        if isinstance(iou_types, str):
            iou_types = [iou_types]

        self.save_folder = save_folder
        """
        The folder to use when storing the model outputs.
        """

        self.filename_prefix = filename_prefix
        """
        The file name prefix to use when storing the model outputs.
        """

        self.save_stream = save_stream
        """
        The stream for which the model outputs should be saved.
        """

        self.iou_types = iou_types
        """
        The IoU types for which metrics will be computed.
        """

        self.summarize_to_stdout = summarize_to_stdout
        """
        If True, a summary of evaluation metrics will be printed to stdout.
        """

        self.evaluator_factory = evaluator_factory
        """
        The factory of the evaluator object.
        """

        self.evaluator: Optional[
            DetectionEvaluator[TDetPredictions_co, TDetModelOutput]
        ] = None
        """
        Main evaluator object to compute metrics.
        """

        self.gt_api_def = gt_api_def
        """
        The name and type of the dataset API object containing the ground
        truth test annotations.
        """

        self.default_to_coco = default_to_coco
        """
        If True, it will try to convert the dataset to the COCO format.
        """

        self.current_filename: Optional[Union[str, Path]] = None
        """
        File containing the current model outputs.
        """

        self.current_outputs: List[TDetModelOutput] = []
        """
        List of dictionaries containing the current model outputs.
        """

        self.current_additional_metrics = None
        """
        The current additional metrics. Computed after each eval experience.
        May be None if the evaluator doesn't support additional metrics.
        """

        self.save = save_folder is not None
        """
        If True, model outputs will be written to file.
        """

        Creates an instance of DetectionMetrics.

        :param evaluator_factory: The factory for the evaluator to use. By
            default, the COCO evaluator will be used. The factory should accept
            2 parameters: the API object containing the test annotations and
            the list of IOU types to consider. It must return an instance
            of a DetectionEvaluator.
        :param gt_api_def: The name and type of the API to search.
            The name must be the name of the field of the original dataset,
            while the Type must be the one the API object.
            For instance, for :class:`LvisDataset` is `('lvis_api', lvis.LVIS)`.
            Defaults to the datasets explicitly supported by Avalanche.
        :param default_to_coco: If True, it will try to convert the dataset
            to the COCO format.
        :param save_folder: path to the folder where to write model output
            files. Defaults to None, which means that the model output of
            test instances will not be stored.
        :param filename_prefix: prefix common to all model outputs files.
            Ignored if `save_folder` is None. Defaults to "model_output"
        :param iou_types: list of (or a single string) strings describing
            the iou types to use when computing metrics.
            Defaults to "bbox". Valid values are usually "bbox" and "segm",
            but this may vary depending on the dataset.
        :param summarize_to_stdout: if True, a summary of evaluation metrics
            will be printed to stdout (as a table) using the Lvis API.
            Defaults to True.
        
avalanche/evaluation/metrics/detection.py