class_docstr: Focal and Global Knowledge Distillation for Detectors
  The code is reference from https://github.com/yzd-v/FGD/blob/master/mmdet/distillation/losses/fgd.py
  
  Args:
      student_channels (int): The number of channels in the student's FPN feature map. Default to 256.
      teacher_channels (int): The number of channels in the teacher's FPN feature map. Default to 256.
      normalize (bool): Whether to normalize the feature maps.
      temp (float, optional): The temperature coefficient. Defaults to 0.5.
      alpha_fgd (float, optional): The weight of fg_loss. Defaults to 0.001
      beta_fgd (float, optional): The weight of bg_loss. Defaults to 0.0005
      gamma_fgd (float, optional): The weight of mask_loss. Defaults to 0.001
      lambda_fgd (float, optional): The weight of relation_loss. Defaults to 0.000005
class_docstr_tok: ["Focal","and","Global","Knowledge","Distillation","for","Detectors","The","code","is","reference","from","https",":","\/\/github.com\/yzd-v\/FGD\/blob\/master\/mmdet\/distillation\/losses\/fgd.py","Args",":","student_channels","(","int",")",":","The","number","of","channels","in","the","student","'s","FPN","feature","map",".","Default","to","256.","teacher_channels","(","int",")",":","The","number","of","channels","in","the","teacher","'s","FPN","feature","map",".","Default","to","256.","normalize","(","bool",")",":","Whether","to","normalize","the","feature","maps",".","temp","(","float",",","optional",")",":","The","temperature","coefficient",".","Defaults","to","0.5.","alpha_fgd","(","float",",","optional",")",":","The","weight","of","fg_loss",".","Defaults","to","0.001","beta_fgd","(","float",",","optional",")",":","The","weight","of","bg_loss",".","Defaults","to","0.0005","gamma_fgd","(","float",",","optional",")",":","The","weight","of","mask_loss",".","Defaults","to","0.001","lambda_fgd","(","float",",","optional",")",":","The","weight","of","relation_loss",".","Defaults","to","0.000005"]
code: def __init__(
      self,
      student_channels,
      teacher_channels,
      normalize=False,
      loss_weight=1.0,
      temp=0.5,
      alpha_fgd=0.001,
      beta_fgd=0.0005,
      gamma_fgd=0.001,
      lambda_fgd=0.000005,
  ):
      super(FGDFeatureLoss, self).__init__()
      self.normalize = normalize
      self.loss_weight = loss_weight
      self.temp = temp
      self.alpha_fgd = alpha_fgd
      self.beta_fgd = beta_fgd
      self.gamma_fgd = gamma_fgd
      self.lambda_fgd = lambda_fgd
      kaiming_init = parameter_init("kaiming")
      zeros_init = parameter_init("constant", 0.0)
  
      if student_channels != teacher_channels:
          self.align = nn.Conv2D(
              student_channels,
              teacher_channels,
              kernel_size=1,
              stride=1,
              padding=0,
              weight_attr=kaiming_init,
          )
          student_channels = teacher_channels
      else:
          self.align = None
  
      self.conv_mask_s = nn.Conv2D(
          student_channels, 1, kernel_size=1, weight_attr=kaiming_init
      )
      self.conv_mask_t = nn.Conv2D(
          teacher_channels, 1, kernel_size=1, weight_attr=kaiming_init
      )
  
      self.stu_conv_block = nn.Sequential(
          nn.Conv2D(
              student_channels,
              student_channels // 2,
              kernel_size=1,
              weight_attr=zeros_init,
          ),
          nn.LayerNorm([student_channels // 2, 1, 1]),
          nn.ReLU(),
          nn.Conv2D(
              student_channels // 2,
              student_channels,
              kernel_size=1,
              weight_attr=zeros_init,
          ),
      )
      self.tea_conv_block = nn.Sequential(
          nn.Conv2D(
              teacher_channels,
              teacher_channels // 2,
              kernel_size=1,
              weight_attr=zeros_init,
          ),
          nn.LayerNorm([teacher_channels // 2, 1, 1]),
          nn.ReLU(),
          nn.Conv2D(
              teacher_channels // 2,
              teacher_channels,
              kernel_size=1,
              weight_attr=zeros_init,
          ),
      )
  
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 FGDFeatureLoss object from inherited base classes: nn with example: obj = FGDFeatureLoss(student_channels, teacher_channels, normalize, loss_weight, temp, alpha_fgd, beta_fgd, gamma_fgd, lambda_fgd)