class_docstr: Hourglass Module for HourglassNet backbone.
  
  Generate module recursively and use BasicBlock as the base unit.
  
  Args:
      depth (int): Depth of current HourglassModule.
      stage_channels (list[int]): Feature channels of sub-modules in current
          and follow-up HourglassModule.
      stage_blocks (list[int]): Number of sub-modules stacked in current and
          follow-up HourglassModule.
      norm_cfg (ConfigType): Dictionary to construct and config norm layer.
          Defaults to `dict(type='BN', requires_grad=True)`
      upsample_cfg (ConfigType): Config dict for interpolate layer.
          Defaults to `dict(mode='nearest')`
     init_cfg (dict or ConfigDict, optional): the config to control the
         initialization.
class_docstr_tok: ["Hourglass","Module","for","HourglassNet","backbone",".","Generate","module","recursively","and","use","BasicBlock","as","the","base","unit",".","Args",":","depth","(","int",")",":","Depth","of","current","HourglassModule",".","stage_channels","(","list","[","int","]",")",":","Feature","channels","of","sub-modules","in","current","and","follow-up","HourglassModule",".","stage_blocks","(","list","[","int","]",")",":","Number","of","sub-modules","stacked","in","current","and","follow-up","HourglassModule",".","norm_cfg","(","ConfigType",")",":","Dictionary","to","construct","and","config","norm","layer",".","Defaults","to","`","dict","(","type='BN","'",",","requires_grad=True",")","`","upsample_cfg","(","ConfigType",")",":","Config","dict","for","interpolate","layer",".","Defaults","to","`","dict","(","mode='nearest","'",")","`","init_cfg","(","dict","or","ConfigDict",",","optional",")",":","the","config","to","control","the","initialization","."]
code: def __init__(
      self,
      depth: int,
      stage_channels: List[int],
      stage_blocks: List[int],
      norm_cfg: ConfigType = dict(type="BN", requires_grad=True),
      upsample_cfg: ConfigType = dict(mode="nearest"),
      init_cfg: OptMultiConfig = None,
  ) -> None:
      super().__init__(init_cfg)
  
      self.depth = depth
  
      cur_block = stage_blocks[0]
      next_block = stage_blocks[1]
  
      cur_channel = stage_channels[0]
      next_channel = stage_channels[1]
  
      self.up1 = ResLayer(
          BasicBlock,
          cur_channel,
          cur_channel,
          cur_block,
          norm_cfg=norm_cfg,
      )
  
      self.low1 = ResLayer(
          BasicBlock,
          cur_channel,
          next_channel,
          cur_block,
          stride=2,
          norm_cfg=norm_cfg,
      )
  
      if self.depth > 1:
          self.low2 = HourglassModule(
              depth - 1, stage_channels[1:], stage_blocks[1:]
          )
      else:
          self.low2 = ResLayer(
              BasicBlock,
              next_channel,
              next_channel,
              next_block,
              norm_cfg=norm_cfg,
          )
  
      self.low3 = ResLayer(
          BasicBlock,
          next_channel,
          cur_channel,
          cur_block,
          norm_cfg=norm_cfg,
          downsample_first=False,
      )
  
      self.up2 = F.interpolate
      self.upsample_cfg = upsample_cfg
  
file_path: mmdetection/mmdet/models/backbones/hourglass.py
imports: from typing import List, Sequence
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import ConvModule
  from mmengine.model import BaseModule
  from mmdet.registry import MODELS
  from mmdet.utils import ConfigType, OptMultiConfig
  from ..layers import ResLayer
  from .resnet import BasicBlock
label_desc: Use image node_id 1 to create a new HourglassModule object from inherited base classes: BaseModule with example: obj = HourglassModule(depth, stage_channels, stage_blocks, norm_cfg, upsample_cfg, init_cfg)