class_docstr: Implementation of `Distilling the Knowledge in a Neural Network.
  <https://arxiv.org/abs/1503.02531>`_.
  
  Args:
      backbone (:obj:`ConfigDict` or dict): The backbone module.
      neck (:obj:`ConfigDict` or dict): The neck module.
      bbox_head (:obj:`ConfigDict` or dict): The bbox head module.
      teacher_config (:obj:`ConfigDict` | dict | str | Path): Config file
          path or the config object of teacher model.
      teacher_ckpt (str, optional): Checkpoint path of teacher model.
          If left as None, the model will not load any weights.
          Defaults to True.
      eval_teacher (bool): Set the train mode for teacher.
          Defaults to True.
      train_cfg (:obj:`ConfigDict` or dict, optional): The training config
          of ATSS. Defaults to None.
      test_cfg (:obj:`ConfigDict` or dict, optional): The testing config
          of ATSS. Defaults to None.
      data_preprocessor (:obj:`ConfigDict` or dict, optional): Config of
          :class:`DetDataPreprocessor` to process the input data.
          Defaults to None.
class_docstr_tok: ["Implementation","of","`","Distilling","the","Knowledge","in","a","Neural","Network",".","<","https",":","\/\/arxiv.org\/abs\/1503.02531",">","`","_",".","Args",":","backbone","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","The","backbone","module",".","neck","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","The","neck","module",".","bbox_head","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","The","bbox","head","module",".","teacher_config","(",":","obj",":","`","ConfigDict","`","|","dict","|","str","|","Path",")",":","Config","file","path","or","the","config","object","of","teacher","model",".","teacher_ckpt","(","str",",","optional",")",":","Checkpoint","path","of","teacher","model",".","If","left","as","None",",","the","model","will","not","load","any","weights",".","Defaults","to","True",".","eval_teacher","(","bool",")",":","Set","the","train","mode","for","teacher",".","Defaults","to","True",".","train_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","The","training","config","of","ATSS",".","Defaults","to","None",".","test_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","The","testing","config","of","ATSS",".","Defaults","to","None",".","data_preprocessor","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Config","of",":","class",":","`","DetDataPreprocessor","`","to","process","the","input","data",".","Defaults","to","None","."]
code: def __init__(
      self,
      backbone: ConfigType,
      neck: ConfigType,
      bbox_head: ConfigType,
      teacher_config: Union[ConfigType, str, Path],
      teacher_ckpt: Optional[str] = None,
      eval_teacher: bool = True,
      train_cfg: OptConfigType = None,
      test_cfg: OptConfigType = None,
      data_preprocessor: OptConfigType = None,
  ) -> None:
      super().__init__(
          backbone=backbone,
          neck=neck,
          bbox_head=bbox_head,
          train_cfg=train_cfg,
          test_cfg=test_cfg,
          data_preprocessor=data_preprocessor,
      )
      self.eval_teacher = eval_teacher
      # Build teacher model
      if isinstance(teacher_config, (str, Path)):
          teacher_config = Config.fromfile(teacher_config)
      self.teacher_model = MODELS.build(teacher_config["model"])
      if teacher_ckpt is not None:
          load_checkpoint(
              self.teacher_model, teacher_ckpt, map_location="cpu"
          )
  
file_path: mmdetection/mmdet/models/detectors/kd_one_stage.py
imports: from pathlib import Path
  from typing import Any, Optional, Union
  import torch
  import torch.nn
  from mmengine.config import Config
  from mmengine.runner import load_checkpoint
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.utils import ConfigType, OptConfigType
  from .single_stage import SingleStageDetector
label_desc: Use image node_id 1 to create a new KnowledgeDistillationSingleStageDetector object from inherited base classes: SingleStageDetector with example: obj = KnowledgeDistillationSingleStageDetector(backbone, neck, bbox_head, teacher_config, teacher_ckpt, eval_teacher, train_cfg, test_cfg, data_preprocessor)