class_docstr: Localization distillation Head. (Short description)
  
  It utilizes the learned bbox distributions to transfer the localization
  dark knowledge from teacher to student. Original paper: `Localization
  Distillation for Object Detection. <https://arxiv.org/abs/2102.12252>`_
  
  Args:
      num_classes (int): Number of categories excluding the background
          category.
      in_channels (int): Number of channels in the input feature map.
      loss_ld (:obj:`ConfigDict` or dict): Config of Localization
          Distillation Loss (LD), T is the temperature for distillation.
class_docstr_tok: ["Localization","distillation","Head",".","(","Short","description",")","It","utilizes","the","learned","bbox","distributions","to","transfer","the","localization","dark","knowledge","from","teacher","to","student",".","Original","paper",":","`","Localization","Distillation","for","Object","Detection",".","<","https",":","\/\/arxiv.org\/abs\/2102.12252",">","`","_","Args",":","num_classes","(","int",")",":","Number","of","categories","excluding","the","background","category",".","in_channels","(","int",")",":","Number","of","channels","in","the","input","feature","map",".","loss_ld","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","Localization","Distillation","Loss","(","LD",")",",","T","is","the","temperature","for","distillation","."]
docstr: Args:
      x (list[Tensor]): Features from FPN.
      out_teacher (tuple[Tensor]): The output of teacher.
      batch_data_samples (list[:obj:`DetDataSample`]): The batch
          data samples. It usually includes information such
          as `gt_instance` or `gt_panoptic_seg` or `gt_sem_seg`.
  
  Returns:
      tuple[dict, list]: The loss components and proposals of each image.
  
      - losses (dict[str, Tensor]): A dictionary of loss components.
      - proposal_list (list[Tensor]): Proposals of each image.
docstr_tok: ["Args",":","x","(","list","[","Tensor","]",")",":","Features","from","FPN",".","out_teacher","(","tuple","[","Tensor","]",")",":","The","output","of","teacher",".","batch_data_samples","(","list","[",":","obj",":","`","DetDataSample","`","]",")",":","The","batch","data","samples",".","It","usually","includes","information","such","as","`","gt_instance","`","or","`","gt_panoptic_seg","`","or","`","gt_sem_seg","`",".","Returns",":","tuple","[","dict",",","list","]",":","The","loss","components","and","proposals","of","each","image",".","-","losses","(","dict","[","str",",","Tensor","]",")",":","A","dictionary","of","loss","components",".","-","proposal_list","(","list","[","Tensor","]",")",":","Proposals","of","each","image","."]
code: def loss(
      self,
      x: List[Tensor],
      out_teacher: Tuple[Tensor],
      batch_data_samples: SampleList,
  ) -> dict:
      """
      Args:
          x (list[Tensor]): Features from FPN.
          out_teacher (tuple[Tensor]): The output of teacher.
          batch_data_samples (list[:obj:`DetDataSample`]): The batch
              data samples. It usually includes information such
              as `gt_instance` or `gt_panoptic_seg` or `gt_sem_seg`.
  
      Returns:
          tuple[dict, list]: The loss components and proposals of each image.
  
          - losses (dict[str, Tensor]): A dictionary of loss components.
          - proposal_list (list[Tensor]): Proposals of each image.
      """
      outputs = unpack_gt_instances(batch_data_samples)
      (
          batch_gt_instances,
          batch_gt_instances_ignore,
          batch_img_metas,
      ) = outputs
  
      outs = self(x)
      soft_targets = out_teacher[1]
      loss_inputs = outs + (
          batch_gt_instances,
          batch_img_metas,
          soft_targets,
      )
      losses = self.loss_by_feat(
          *loss_inputs,
          batch_gt_instances_ignore=batch_gt_instances_ignore,
      )
  
      return losses
  
file_path: mmdetection/mmdet/models/dense_heads/ld_head.py
imports: from typing import List, Tuple
  import torch
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.structures.bbox import bbox_overlaps
  from mmdet.utils import ConfigType, InstanceList, OptInstanceList, reduce_mean
  from ..utils import multi_apply, unpack_gt_instances
  from .gfl_head import GFLHead
label_desc: Use image node_id 3 for calling the LDHead obj's underlying member method code with example usage: obj.loss(x, out_teacher, batch_data_samples) and returns: losses