class_docstr: Test class collection different tests for different properties parametrized by backend argument.
class_docstr_tok: ["Test","class","collection","different","tests","for","different","properties","parametrized","by","backend","argument","."]
docstr: Test that a warning is raised when there are many detections.
docstr_tok: ["Test","that","a","warning","is","raised","when","there","are","many","detections","."]
code: def test_warning_on_many_detections(self, iou_type, backend):
      """Test that a warning is raised when there are many detections."""
      if iou_type == "bbox":
          preds = [
              {
                  "boxes": torch.tensor([[0.5, 0.5, 1, 1]]).repeat(
                      101, 1
                  ),
                  "scores": torch.tensor([1.0]).repeat(101),
                  "labels": torch.tensor([0]).repeat(101),
              }
          ]
          targets = [
              {
                  "boxes": torch.tensor([[0, 0, 1, 1]]),
                  "labels": torch.tensor([0]),
              }
          ]
      else:
          preds, targets = _generate_random_segm_input(
              "cpu", 1, 101, 10, False
          )
  
      metric = MeanAveragePrecision(iou_type=iou_type, backend=backend)
      with pytest.warns(
          UserWarning,
          match="Encountered more than 100 detections in a single image.*",
      ):
          metric.update(preds, targets)
  
imports: import contextlib
  import io
  import json
  from copy import deepcopy
  from functools import partial
  from itertools import product
  import numpy
  import pytest
  import torch
  from lightning_utilities import apply_to_collection
  from pycocotools.coco import COCO
  from pycocotools.cocoeval import COCOeval
  from torch import IntTensor, Tensor
  from torchmetrics.detection.mean_ap import MeanAveragePrecision
  from torchmetrics.utilities.imports import _FASTER_COCO_EVAL_AVAILABLE, _PYCOCOTOOLS_AVAILABLE, _TORCHVISION_GREATER_EQUAL_0_8
  from unittests.detection import _DETECTION_BBOX, _DETECTION_SEGM, _DETECTION_VAL
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 18 for calling the TestMapProperties obj's underlying member method code with example usage: obj.test_warning_on_many_detections(iou_type, backend) without return types