class_docstr: Main evaluator class.
class_docstr_tok: ["Main","evaluator","class","."]
docstr: Extracts the label for each bbox, and sorts the results by score.
  
  More specifically, after extracting each bbox's label, the bboxes and
  scores are sorted in descending order based on score. The scores which fall
  below `threshold` are removed.
  Args:
    bboxes: a matrix of the shape (|B|, 4), where |B| is the number of
      bboxes; each row contains the `[x1, y1, x2, y2]` of the bbox
    scores: a matrix of the shape (|B|, K), where `K` is the number of
      classes in the object detection task
  Returns:
    A tuple consisting of the bboxes, a vector of length |B| containing
    the label of each of the anchors, and a vector of length |B| containing
    the label score. All elements are sorted in descending order relative
    to the score.
docstr_tok: ["Extracts","the","label","for","each","bbox",",","and","sorts","the","results","by","score",".","More","specifically",",","after","extracting","each","bbox","'s","label",",","the","bboxes","and","scores","are","sorted","in","descending","order","based","on","score",".","The","scores","which","fall","below","`","threshold","`","are","removed",".","Args",":","bboxes",":","a","matrix","of","the","shape","(","|B|",",","4",")",",","where","|B|","is","the","number","of","bboxes",";","each","row","contains","the","`","[","x1",",","y1",",","x2",",","y2","]","`","of","the","bbox","scores",":","a","matrix","of","the","shape","(","|B|",",","K",")",",","where","`","K","`","is","the","number","of","classes","in","the","object","detection","task","Returns",":","A","tuple","consisting","of","the","bboxes",",","a","vector","of","length","|B|","containing","the","label","of","each","of","the","anchors",",","and","a","vector","of","length","|B|","containing","the","label","score",".","All","elements","are","sorted","in","descending","order","relative","to","the","score","."]
code: def extract_classifications(self, bboxes, scores):
      """Extracts the label for each bbox, and sorts the results by score.
  
      More specifically, after extracting each bbox's label, the bboxes and
      scores are sorted in descending order based on score. The scores which fall
      below `threshold` are removed.
      Args:
        bboxes: a matrix of the shape (|B|, 4), where |B| is the number of
          bboxes; each row contains the `[x1, y1, x2, y2]` of the bbox
        scores: a matrix of the shape (|B|, K), where `K` is the number of
          classes in the object detection task
      Returns:
        A tuple consisting of the bboxes, a vector of length |B| containing
        the label of each of the anchors, and a vector of length |B| containing
        the label score. All elements are sorted in descending order relative
        to the score.
      """
      # Extract the labels and max score for each anchor
      labels = np.argmax(scores, axis=1)
  
      # Get the score associated to each anchor's label
      scores = scores[np.arange(labels.shape[0]), labels]
  
      # Apply the threshold
      kept_idx = np.where(scores >= self.threshold)[0]
      scores = scores[kept_idx]
      labels = labels[kept_idx]
      bboxes = bboxes[kept_idx]
  
      # Sort everything in descending order and return
      sorted_idx = np.flip(np.argsort(scores, axis=0))
      scores = scores[sorted_idx]
      labels = labels[sorted_idx]
      bboxes = bboxes[sorted_idx]
  
      return bboxes, labels, scores
  
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 4 for calling the DetectionEvaluator obj's underlying member method code with example usage: obj.extract_classifications(bboxes, scores) and returns: bboxes,  labels,  scores