class_docstr: Main evaluator class.
class_docstr_tok: ["Main","evaluator","class","."]
docstr: Compute the COCO metrics for the collected annotations.
  
  Args:
    clear_annotations: if True, clears the `self.annotations`
      parameter after obtaining the COCO metrics
  
  Returns:
    The COCO metrics as a dictionary, defining the following entries:
    ```
    Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ]
    Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ]
    Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ]
    Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ]
    Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ]
    Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ]
    Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ]
    Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ]
    Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ]
    Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ]
    Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ]
    Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ]
    ```
docstr_tok: ["Compute","the","COCO","metrics","for","the","collected","annotations",".","Args",":","clear_annotations",":","if","True",",","clears","the","`","self.annotations","`","parameter","after","obtaining","the","COCO","metrics","Returns",":","The","COCO","metrics","as","a","dictionary",",","defining","the","following","entries",":","``","`","Average","Precision","(","AP",")","@","[","IoU=0.50:0.95","|","area=","all","|","maxDets=100","]","Average","Precision","(","AP",")","@","[","IoU=0.50","|","area=","all","|","maxDets=100","]","Average","Precision","(","AP",")","@","[","IoU=0.75","|","area=","all","|","maxDets=100","]","Average","Precision","(","AP",")","@","[","IoU=0.50:0.95","|","area=","small","|","maxDets=100","]","Average","Precision","(","AP",")","@","[","IoU=0.50:0.95","|","area=medium","|","maxDets=100","]","Average","Precision","(","AP",")","@","[","IoU=0.50:0.95","|","area=","large","|","maxDets=100","]","Average","Recall","(","AR",")","@","[","IoU=0.50:0.95","|","area=","all","|","maxDets=","1","]","Average","Recall","(","AR",")","@","[","IoU=0.50:0.95","|","area=","all","|","maxDets=","10","]","Average","Recall","(","AR",")","@","[","IoU=0.50:0.95","|","area=","all","|","maxDets=100","]","Average","Recall","(","AR",")","@","[","IoU=0.50:0.95","|","area=","small","|","maxDets=100","]","Average","Recall","(","AR",")","@","[","IoU=0.50:0.95","|","area=medium","|","maxDets=100","]","Average","Recall","(","AR",")","@","[","IoU=0.50:0.95","|","area=","large","|","maxDets=100","]","``","`"]
code: def compute_coco_metrics(self, clear_annotations=False):
      """Compute the COCO metrics for the collected annotations.
  
      Args:
        clear_annotations: if True, clears the `self.annotations`
          parameter after obtaining the COCO metrics
  
      Returns:
        The COCO metrics as a dictionary, defining the following entries:
        ```
        Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ]
        Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ]
        Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ]
        Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ]
        Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ]
        Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ]
        Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ]
        Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ]
        Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ]
        Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ]
        Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ]
        Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ]
        ```
      """
  
      def _run_eval():
          # Create prediction object for producing mAP metric values
          pred_object = self.coco.loadRes(self.annotations)
  
          # Compute mAP
          coco_eval = COCOeval(self.coco, pred_object, "bbox")
          coco_eval.params.imgIds = self.annotated_img_ids
          coco_eval.evaluate()
          coco_eval.accumulate()
          coco_eval.summarize()
          return coco_eval
  
      if self.disable_output:
          with open(os.devnull, "w") as devnull:
              with contextlib.redirect_stdout(devnull):
                  coco_eval = _run_eval()
      else:
          coco_eval = _run_eval()
  
      # Clear annotations if requested
      if clear_annotations:
          self.clear_annotations()
  
      # Pack the results
      return self.construct_result_dict(coco_eval.stats)
  
imports: import collections
  import contextlib
  import functools
  import io
  import json
  import os
  import tempfile
  from typing import Any, Dict, List, Optional, Set
  import zipfile
  from absl import logging
  import jax
  import numpy
  import PIL
  from pycocotools.coco import COCO
  from pycocotools.cocoeval import COCOeval
  from tensorflow.io import gfile
label_desc: Use image node_id 8 for calling the DetectionEvaluator obj's underlying member method code with example usage: obj.compute_coco_metrics(clear_annotations) and returns: self, coco_eval