class_docstr: Darknet backbone.
  
  Args:
      depth (int): Depth of Darknet. Currently only support 53.
      out_indices (Sequence[int]): Output from which stages.
      frozen_stages (int): Stages to be frozen (stop grad and set eval mode).
          -1 means not freezing any parameters. Default: -1.
      conv_cfg (dict): Config dict for convolution layer. Default: None.
      norm_cfg (dict): Dictionary to construct and config norm layer.
          Default: dict(type='BN', requires_grad=True)
      act_cfg (dict): Config dict for activation layer.
          Default: dict(type='LeakyReLU', negative_slope=0.1).
      norm_eval (bool): Whether to set norm layers to eval mode, namely,
          freeze running stats (mean and var). Note: Effect on Batch Norm
          and its variants only.
      pretrained (str, optional): model pretrained path. Default: None
      init_cfg (dict or list[dict], optional): Initialization config dict.
          Default: None
  
  Example:
      >>> from mmdet.models import Darknet
      >>> import torch
      >>> self = Darknet(depth=53)
      >>> self.eval()
      >>> inputs = torch.rand(1, 3, 416, 416)
      >>> level_outputs = self.forward(inputs)
      >>> for level_out in level_outputs:
      ...     print(tuple(level_out.shape))
      ...
      (1, 256, 52, 52)
      (1, 512, 26, 26)
      (1, 1024, 13, 13)
class_docstr_tok: ["Darknet","backbone",".","Args",":","depth","(","int",")",":","Depth","of","Darknet",".","Currently","only","support","53.","out_indices","(","Sequence","[","int","]",")",":","Output","from","which","stages",".","frozen_stages","(","int",")",":","Stages","to","be","frozen","(","stop","grad","and","set","eval","mode",")",".","-1","means","not","freezing","any","parameters",".","Default",":","-1.","conv_cfg","(","dict",")",":","Config","dict","for","convolution","layer",".","Default",":","None",".","norm_cfg","(","dict",")",":","Dictionary","to","construct","and","config","norm","layer",".","Default",":","dict","(","type='BN","'",",","requires_grad=True",")","act_cfg","(","dict",")",":","Config","dict","for","activation","layer",".","Default",":","dict","(","type='LeakyReLU","'",",","negative_slope=0.1",")",".","norm_eval","(","bool",")",":","Whether","to","set","norm","layers","to","eval","mode",",","namely",",","freeze","running","stats","(","mean","and","var",")",".","Note",":","Effect","on","Batch","Norm","and","its","variants","only",".","pretrained","(","str",",","optional",")",":","model","pretrained","path",".","Default",":","None","init_cfg","(","dict","or","list","[","dict","]",",","optional",")",":","Initialization","config","dict",".","Default",":","None","Example",":",">",">",">","from","mmdet.models","import","Darknet",">",">",">","import","torch",">",">",">","self","=","Darknet","(","depth=53",")",">",">",">","self.eval","(",")",">",">",">","inputs","=","torch.rand","(","1",",","3",",","416",",","416",")",">",">",">","level_outputs","=","self.forward","(","inputs",")",">",">",">","for","level_out","in","level_outputs",":","...","print","(","tuple","(","level_out.shape",")",")","...","(","1",",","256",",","52",",","52",")","(","1",",","512",",","26",",","26",")","(","1",",","1024",",","13",",","13",")"]
code: def train(self, mode=True):
      super(Darknet, self).train(mode)
      self._freeze_stages()
      if mode and self.norm_eval:
          for m in self.modules():
              if isinstance(m, _BatchNorm):
                  m.eval()
  
file_path: mmdetection/mmdet/models/backbones/darknet.py
imports: import warnings
  import torch.nn
  from mmcv.cnn import ConvModule
  from mmengine.model import BaseModule
  from torch.nn.modules.batchnorm import _BatchNorm
  from mmdet.registry import MODELS
label_desc: Use image node_id 4 for calling the Darknet obj's underlying member method code with example usage: obj.train(mode) without return types