class_docstr: Base model for object detection with matching.
class_docstr_tok: ["Base","model","for","object","detection","with","matching","."]
docstr: Implements a matching function.
  
  Matching functions match predicted detections against ground truth
  detections and return match indices.
  
  Args:
    cost: Matching cost matrix [B, N, M].
    n_cols: Number of non-padded columns in each cost matrix.
  
  Returns:
    Matched indices in the form of a list of tuples (src, dst), where
    `src` and `dst` are indices of corresponding predicted and ground truth
    detections. [B, 2, min(N, M)].
docstr_tok: ["Implements","a","matching","function",".","Matching","functions","match","predicted","detections","against","ground","truth","detections","and","return","match","indices",".","Args",":","cost",":","Matching","cost","matrix","[","B",",","N",",","M","]",".","n_cols",":","Number","of","non-padded","columns","in","each","cost","matrix",".","Returns",":","Matched","indices","in","the","form","of","a","list","of","tuples","(","src",",","dst",")",",","where","`","src","`","and","`","dst","`","are","indices","of","corresponding","predicted","and","ground","truth","detections",".","[","B",",","2",",","min","(","N",",","M",")","]","."]
code: def matcher(
      self, cost: jnp.ndarray, n_cols: Optional[jnp.ndarray] = None
  ) -> jnp.ndarray:
      """Implements a matching function.
  
      Matching functions match predicted detections against ground truth
      detections and return match indices.
  
      Args:
        cost: Matching cost matrix [B, N, M].
        n_cols: Number of non-padded columns in each cost matrix.
  
      Returns:
        Matched indices in the form of a list of tuples (src, dst), where
        `src` and `dst` are indices of corresponding predicted and ground truth
        detections. [B, 2, min(N, M)].
      """
      if self.config.matcher == "hungarian":
          matcher_fn = functools.partial(
              matchers.hungarian_matcher, n_cols=n_cols
          )
      elif self.config.matcher == "hungarian_cover_tpu":
          matcher_fn = matchers.hungarian_cover_tpu_matcher
      else:
          raise ValueError(
              "Unknown matcher (%s)." % self.config.matcher
          )
  
      return jax.lax.stop_gradient(matcher_fn(cost))
  
imports: import abc
  import functools
  from typing import Any, Callable, Dict, Optional, Tuple
  import jax
  import jax.numpy
  import ml_collections
  from scenic.model_lib import matchers
  from scenic.model_lib.base_models import base_model
  from scenic.model_lib.base_models import box_utils
  from scenic.model_lib.base_models import model_utils
  from scenic.projects.owl_vit import losses
label_desc: Use image node_id 4 for calling the BaseModelWithMatching obj's underlying member method code with example usage: obj.matcher(cost, n_cols) and returns: jax