def __init__(self,
                 depth=53,
                 freeze_at=-1,
                 return_idx=[2, 3, 4],
                 num_stages=5,
                 norm_type='bn',
                 norm_decay=0.,
                 freeze_norm=False,
                 data_format='NCHW'):
        """
        Darknet, see https://pjreddie.com/darknet/yolo/
        Args:
            depth (int): depth of network
            freeze_at (int): freeze the backbone at which stage
            filter_size (int): filter size, default 3
            return_idx (list): index of stages whose feature maps are returned
            norm_type (str): batch norm type, default bn
            norm_decay (str): decay for weight and bias of batch norm layer, default 0.
            data_format (str): data format, NCHW or NHWC
        """
        super(DarkNet, self).__init__()
        self.depth = depth
        self.freeze_at = freeze_at
        self.return_idx = return_idx
        self.num_stages = num_stages
        self.stages = DarkNet_cfg[self.depth][0:num_stages]

        self.conv0 = ConvBNLayer(
            ch_in=3,
            ch_out=32,
            filter_size=3,
            stride=1,
            padding=1,
            norm_type=norm_type,
            norm_decay=norm_decay,
            freeze_norm=freeze_norm,
            data_format=data_format)

        self.downsample0 = DownSample(
            ch_in=32,
            ch_out=32 * 2,
            norm_type=norm_type,
            norm_decay=norm_decay,
            freeze_norm=freeze_norm,
            data_format=data_format)

        self._out_channels = []
        # self.darknet_conv_block_list = []
        self.darknet_conv_block_list = nn.ModuleList()
        self.downsample_list = nn.ModuleDict()
        self.downsample_list_names = []
        ch_in = [64, 128, 256, 512, 1024]
        for i, stage in enumerate(self.stages):
            name = 'stage_{}'.format(i)
            # conv_block = self.add_sublayer(
            #     name,
            #     Blocks(
            #         int(ch_in[i]),
            #         32 * (2**i),
            #         stage,
            #         norm_type=norm_type,
            #         norm_decay=norm_decay,
            #         freeze_norm=freeze_norm,
            #         data_format=data_format,
            #         name=name))
            # self.darknet_conv_block_list.append(conv_block)

            conv_block = Blocks(
                    int(ch_in[i]),
                    32 * (2**i),
                    stage,
                    norm_type=norm_type,
                    norm_decay=norm_decay,
                    freeze_norm=freeze_norm,
                    data_format=data_format,
                    name=name)
            self.darknet_conv_block_list.add_module(name,
                                                    conv_block)

            if i in return_idx:
                self._out_channels.append(64 * (2**i))
        for i in range(num_stages - 1):
            down_name = 'stage_{}_downsample'.format(i)
            # downsample = self.add_sublayer(
            #     down_name,
            #     DownSample(
            #         ch_in=32 * (2**(i + 1)),
            #         ch_out=32 * (2**(i + 2)),
            #         norm_type=norm_type,
            #         norm_decay=norm_decay,
            #         freeze_norm=freeze_norm,
            #         data_format=data_format))
            # self.downsample_list.append(downsample)

            downsample = DownSample(
                    ch_in=32 * (2**(i + 1)),
                    ch_out=32 * (2**(i + 2)),
                    norm_type=norm_type,
                    norm_decay=norm_decay,
                    freeze_norm=freeze_norm,
                    data_format=data_format)
            self.downsample_list.add_module(down_name, downsample)
            self.downsample_list_names.append(down_name)

        Darknet, see https://pjreddie.com/darknet/yolo/
        Args:
            depth (int): depth of network
            freeze_at (int): freeze the backbone at which stage
            filter_size (int): filter size, default 3
            return_idx (list): index of stages whose feature maps are returned
            norm_type (str): batch norm type, default bn
            norm_decay (str): decay for weight and bias of batch norm layer, default 0.
            data_format (str): data format, NCHW or NHWC
        
ptstructure/layout/ptppyolov2/ppyolov2_darknet.py