class_docstr: Computes one-to-one matching between predictions and ground truth.
  
  This class computes an assignment between the targets and the predictions
  based on the costs. The costs are weighted sum of some components.
  For DETR the costs are weighted sum of classification cost, regression L1
  cost and regression iou cost. The targets don't include the no_object, so
  generally there are more predictions than targets. After the one-to-one
  matching, the un-matched are treated as backgrounds. Thus each query
  prediction will be assigned with `0` or a positive integer indicating the
  ground truth index:
  
  - 0: negative sample, no assigned gt
  - positive integer: positive sample, index (1-based) of assigned gt
  
  Args:
      match_costs (:obj:`ConfigDict` or dict or             List[Union[:obj:`ConfigDict`, dict]]): Match cost configs.
class_docstr_tok: ["Computes","one-to-one","matching","between","predictions","and","ground","truth",".","This","class","computes","an","assignment","between","the","targets","and","the","predictions","based","on","the","costs",".","The","costs","are","weighted","sum","of","some","components",".","For","DETR","the","costs","are","weighted","sum","of","classification","cost",",","regression","L1","cost","and","regression","iou","cost",".","The","targets","do","n't","include","the","no_object",",","so","generally","there","are","more","predictions","than","targets",".","After","the","one-to-one","matching",",","the","un-matched","are","treated","as","backgrounds",".","Thus","each","query","prediction","will","be","assigned","with","`","0","`","or","a","positive","integer","indicating","the","ground","truth","index",":","-","0",":","negative","sample",",","no","assigned","gt","-","positive","integer",":","positive","sample",",","index","(","1-based",")","of","assigned","gt","Args",":","match_costs","(",":","obj",":","`","ConfigDict","`","or","dict","or","List","[","Union","[",":","obj",":","`","ConfigDict","`",",","dict","]","]",")",":","Match","cost","configs","."]
code: def __init__(
      self,
      match_costs: Union[
          List[Union[dict, ConfigDict]], dict, ConfigDict
      ],
  ) -> None:
      if isinstance(match_costs, dict):
          match_costs = [match_costs]
      elif isinstance(match_costs, list):
          assert (
              len(match_costs) > 0
          ), "match_costs must not be a empty list."
  
      self.match_costs = [
          TASK_UTILS.build(match_cost) for match_cost in match_costs
      ]
  
file_path: mmdetection/mmdet/models/task_modules/assigners/hungarian_assigner.py
imports: from typing import List, Optional, Union
  import torch
  from mmengine import ConfigDict
  from mmengine.structures import InstanceData
  from scipy.optimize import linear_sum_assignment
  from torch import Tensor
  from mmdet.registry import TASK_UTILS
  from .assign_result import AssignResult
  from .base_assigner import BaseAssigner
label_desc: Use image node_id 1 to create a new HungarianAssigner object from inherited base classes: BaseAssigner with example: obj = HungarianAssigner(match_costs)