code: def test_ocr_metric(
      gt_boxes,
      gt_words,
      pred_boxes,
      pred_words,
      iou_thresh,
      recall,
      precision,
      mean_iou,
  ):
      metric = metrics.OCRMetric(iou_thresh)
      for _gboxes, _gwords, _pboxes, _pwords in zip(
          gt_boxes, gt_words, pred_boxes, pred_words
      ):
          metric.update(
              np.asarray(_gboxes),
              np.zeros((0, 4))
              if _pboxes is None
              else np.asarray(_pboxes),
              _gwords,
              _pwords,
          )
      _recall, _precision, _mean_iou = metric.summary()
      assert _recall == recall
      assert _precision == precision
      assert _mean_iou == mean_iou
      metric.reset()
      assert metric.num_gts == metric.num_preds == metric.tot_iou == 0
      assert (
          metric.raw_matches
          == metric.caseless_matches
          == metric.unidecode_matches
          == metric.unicase_matches
          == 0
      )
      # Shape check
      with pytest.raises(AssertionError):
          metric.update(
              np.asarray(_gboxes),
              np.zeros((0, 4)),
              _gwords,
              ["I", "have", "a", "bad", "feeling", "about", "this"],
          )
  
file_path: doctr/tests/common/test_utils_metrics.py
imports: import numpy
  import pytest
  from doctr.utils import metrics
label_desc: Use image node_id 8 for calling a global function with example usage: test_ocr_metric(gt_boxes, gt_words, pred_boxes, pred_words, iou_thresh, recall, precision, mean_iou) without return types