class_docstr: Stores assignments between predicted and truth boxes.
  
  Attributes:
      num_gts (int): the number of truth boxes considered when computing this
          assignment
      gt_inds (Tensor): for each predicted box indicates the 1-based
          index of the assigned truth box. 0 means unassigned and -1 means
          ignore.
      max_overlaps (Tensor): the iou between the predicted box and its
          assigned truth box.
      labels (Tensor): If specified, for each predicted box
          indicates the category label of the assigned truth box.
  
  Example:
      >>> # An assign result between 4 predicted boxes and 9 true boxes
      >>> # where only two boxes were assigned.
      >>> num_gts = 9
      >>> max_overlaps = torch.LongTensor([0, .5, .9, 0])
      >>> gt_inds = torch.LongTensor([-1, 1, 2, 0])
      >>> labels = torch.LongTensor([0, 3, 4, 0])
      >>> self = AssignResult(num_gts, gt_inds, max_overlaps, labels)
      >>> print(str(self))  # xdoctest: +IGNORE_WANT
      <AssignResult(num_gts=9, gt_inds.shape=(4,), max_overlaps.shape=(4,),
                    labels.shape=(4,))>
      >>> # Force addition of gt labels (when adding gt as proposals)
      >>> new_labels = torch.LongTensor([3, 4, 5])
      >>> self.add_gt_(new_labels)
      >>> print(str(self))  # xdoctest: +IGNORE_WANT
      <AssignResult(num_gts=9, gt_inds.shape=(7,), max_overlaps.shape=(7,),
                    labels.shape=(7,))>
class_docstr_tok: ["Stores","assignments","between","predicted","and","truth","boxes",".","Attributes",":","num_gts","(","int",")",":","the","number","of","truth","boxes","considered","when","computing","this","assignment","gt_inds","(","Tensor",")",":","for","each","predicted","box","indicates","the","1-based","index","of","the","assigned","truth","box",".","0","means","unassigned","and","-1","means","ignore",".","max_overlaps","(","Tensor",")",":","the","iou","between","the","predicted","box","and","its","assigned","truth","box",".","labels","(","Tensor",")",":","If","specified",",","for","each","predicted","box","indicates","the","category","label","of","the","assigned","truth","box",".","Example",":",">",">",">","#","An","assign","result","between","4","predicted","boxes","and","9","true","boxes",">",">",">","#","where","only","two","boxes","were","assigned",".",">",">",">","num_gts","=","9",">",">",">","max_overlaps","=","torch.LongTensor","(","[","0",",",".5",",",".9",",","0","]",")",">",">",">","gt_inds","=","torch.LongTensor","(","[","-1",",","1",",","2",",","0","]",")",">",">",">","labels","=","torch.LongTensor","(","[","0",",","3",",","4",",","0","]",")",">",">",">","self","=","AssignResult","(","num_gts",",","gt_inds",",","max_overlaps",",","labels",")",">",">",">","print","(","str","(","self",")",")","#","xdoctest",":","+IGNORE_WANT","<","AssignResult","(","num_gts=9",",","gt_inds.shape=","(","4",",",")",",","max_overlaps.shape=","(","4",",",")",",","labels.shape=","(","4",",",")",")",">",">",">",">","#","Force","addition","of","gt","labels","(","when","adding","gt","as","proposals",")",">",">",">","new_labels","=","torch.LongTensor","(","[","3",",","4",",","5","]",")",">",">",">","self.add_gt_","(","new_labels",")",">",">",">","print","(","str","(","self",")",")","#","xdoctest",":","+IGNORE_WANT","<","AssignResult","(","num_gts=9",",","gt_inds.shape=","(","7",",",")",",","max_overlaps.shape=","(","7",",",")",",","labels.shape=","(","7",",",")",")",">"]
docstr: Add ground truth as assigned results.
  
  Args:
      gt_labels (torch.Tensor): Labels of gt boxes
docstr_tok: ["Add","ground","truth","as","assigned","results",".","Args",":","gt_labels","(","torch.Tensor",")",":","Labels","of","gt","boxes"]
code: def add_gt_(self, gt_labels):
      """Add ground truth as assigned results.
  
      Args:
          gt_labels (torch.Tensor): Labels of gt boxes
      """
      self_inds = torch.arange(
          1,
          len(gt_labels) + 1,
          dtype=torch.long,
          device=gt_labels.device,
      )
      self.gt_inds = torch.cat([self_inds, self.gt_inds])
  
      self.max_overlaps = torch.cat(
          [
              self.max_overlaps.new_ones(len(gt_labels)),
              self.max_overlaps,
          ]
      )
  
      self.labels = torch.cat([gt_labels, self.labels])
  
file_path: mmdetection/mmdet/models/task_modules/assigners/assign_result.py
imports: import torch
  from torch import Tensor
  from mmdet.utils import util_mixins
label_desc: Use image node_id 8 for calling the AssignResult obj's underlying member method code with example usage: obj.add_gt_(gt_labels) without return types