code: def __init__(
      self,
      loss_weight={"logits": 4.0, "feat": 1.0},
      logits_distill=True,
      logits_loss_weight={"class": 1.0, "iou": 2.5, "dfl": 0.5},
      logits_ld_distill=False,
      logits_ld_params={"weight": 20000, "T": 10},
      feat_distill=True,
      feat_distiller="fgd",
      feat_distill_place="neck_feats",
      teacher_width_mult=1.0,  # L
      student_width_mult=0.75,  # M
      feat_out_channels=[768, 384, 192],
  ):
      super(DistillPPYOLOELoss, self).__init__()
      self.loss_weight_logits = loss_weight["logits"]
      self.loss_weight_feat = loss_weight["feat"]
      self.logits_distill = logits_distill
      self.logits_ld_distill = logits_ld_distill
      self.feat_distill = feat_distill
  
      if logits_distill and self.loss_weight_logits > 0:
          self.bbox_loss_weight = logits_loss_weight["iou"]
          self.dfl_loss_weight = logits_loss_weight["dfl"]
          self.qfl_loss_weight = logits_loss_weight["class"]
          self.loss_bbox = GIoULoss()
  
      if logits_ld_distill:
          self.loss_kd = KnowledgeDistillationKLDivLoss(
              loss_weight=logits_ld_params["weight"],
              T=logits_ld_params["T"],
          )
  
      if feat_distill and self.loss_weight_feat > 0:
          assert feat_distiller in ["cwd", "fgd", "pkd", "mgd", "mimic"]
          assert feat_distill_place in ["backbone_feats", "neck_feats"]
          self.feat_distill_place = feat_distill_place
          self.t_channel_list = [
              int(c * teacher_width_mult) for c in feat_out_channels
          ]
          self.s_channel_list = [
              int(c * student_width_mult) for c in feat_out_channels
          ]
          self.distill_feat_loss_modules = []
          for i in range(len(feat_out_channels)):
              if feat_distiller == "cwd":
                  feat_loss_module = CWDFeatureLoss(
                      student_channels=self.s_channel_list[i],
                      teacher_channels=self.t_channel_list[i],
                      normalize=True,
                  )
              elif feat_distiller == "fgd":
                  feat_loss_module = FGDFeatureLoss(
                      student_channels=self.s_channel_list[i],
                      teacher_channels=self.t_channel_list[i],
                      normalize=True,
                      alpha_fgd=0.00001,
                      beta_fgd=0.000005,
                      gamma_fgd=0.00001,
                      lambda_fgd=0.00000005,
                  )
              elif feat_distiller == "pkd":
                  feat_loss_module = PKDFeatureLoss(
                      student_channels=self.s_channel_list[i],
                      teacher_channels=self.t_channel_list[i],
                      normalize=True,
                      resize_stu=True,
                  )
              elif feat_distiller == "mgd":
                  feat_loss_module = MGDFeatureLoss(
                      student_channels=self.s_channel_list[i],
                      teacher_channels=self.t_channel_list[i],
                      normalize=True,
                      loss_func="ssim",
                  )
              elif feat_distiller == "mimic":
                  feat_loss_module = MimicFeatureLoss(
                      student_channels=self.s_channel_list[i],
                      teacher_channels=self.t_channel_list[i],
                      normalize=True,
                  )
              else:
                  raise ValueError
              self.distill_feat_loss_modules.append(feat_loss_module)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddle import ParamAttr
  from ppdet.core.workspace import register
  from ppdet.modeling import ops
  from ppdet.modeling.losses.iou_loss import GIoULoss
  from ppdet.utils.logger import setup_logger
label_desc: Use image node_id 1 to create a new DistillPPYOLOELoss object from inherited base classes: nn with example: obj = DistillPPYOLOELoss(loss_weight, logits_distill, logits_loss_weight, logits_ld_distill, logits_ld_params, feat_distill, feat_distiller, feat_distill_place, teacher_width_mult, student_width_mult, feat_out_channels)