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 only the correct box format lead to a score of 1.
  
  See issue: https://github.com/Lightning-AI/torchmetrics/issues/1908.
docstr_tok: ["Test","that","only","the","correct","box","format","lead","to","a","score","of","1",".","See","issue",":","https",":","\/\/github.com\/Lightning-AI\/torchmetrics\/issues\/1908","."]
code: def test_for_box_format(
      self, box_format, iou_val_expected, map_val_expected, backend
  ):
      """Test that only the correct box format lead to a score of 1.
  
      See issue: https://github.com/Lightning-AI/torchmetrics/issues/1908.
  
      """
      predictions = [
          {
              "boxes": torch.tensor([[0.5, 0.5, 1, 1]]),
              "scores": torch.tensor([1.0]),
              "labels": torch.tensor([0]),
          }
      ]
  
      targets = [
          {
              "boxes": torch.tensor([[0, 0, 1, 1]]),
              "labels": torch.tensor([0]),
          }
      ]
  
      metric = MeanAveragePrecision(
          box_format=box_format,
          iou_thresholds=[0.2],
          extended_summary=True,
          backend=backend,
      )
      metric.update(predictions, targets)
      result = metric.compute()
      assert result["map"].item() == map_val_expected
      assert round(float(result["ious"][(0, 0)]), 3) == iou_val_expected
  
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 17 for calling the TestMapProperties obj's underlying member method code with example usage: obj.test_for_box_format(box_format, iou_val_expected, map_val_expected, backend) without return types