class_docstr: Metric used to compute the detection and segmentation metrics using the
  dataset-specific API.
  
  Metrics are returned after each evaluation experience.
  
  This metric can also be used to serialize model outputs to JSON files,
  by producing one file for each evaluation experience. This can be useful
  if outputs have to been processed later (like in a competition).
  
  If no dataset-specific API is used, the COCO API (pycocotools) will be used.
class_docstr_tok: ["Metric","used","to","compute","the","detection","and","segmentation","metrics","using","the","dataset-specific","API",".","Metrics","are","returned","after","each","evaluation","experience",".","This","metric","can","also","be","used","to","serialize","model","outputs","to","JSON","files",",","by","producing","one","file","for","each","evaluation","experience",".","This","can","be","useful","if","outputs","have","to","been","processed","later","(","like","in","a","competition",")",".","If","no","dataset-specific","API","is","used",",","the","COCO","API","(","pycocotools",")","will","be","used","."]
code: def __str__(self):
      return "DetectionMetrics"
  
imports: import os
  from pathlib import Path
  import torch
  import json
  from typing import Any, Generic, List, Union, TypeVar, Tuple, Dict, TYPE_CHECKING, Type, Callable, Sequence, Optional
  from avalanche.benchmarks.utils.data import AvalancheDataset
  from torch import Tensor
  from json import JSONEncoder
  from torch.utils.data import Subset, ConcatDataset
  from typing_extensions import Protocol
  from avalanche.evaluation import PluginMetric
  from avalanche.evaluation.metric_results import MetricValue
  from avalanche.evaluation.metric_utils import get_metric_name
label_desc: Use image node_id 12 for calling the DetectionMetrics obj's underlying member method code with example usage: obj.__str__() and returns: str