MCPcopy
hub / github.com/PaddlePaddle/PaddleOCR / __init__

Method __init__

ppocr/modeling/backbones/rec_pphgnetv2.py:1149–1194  ·  view source on GitHub ↗
(
        self,
        in_channels,
        mid_channels,
        out_channels,
        kernel_size=3,
        layer_num=6,
        identity=False,
        light_block=True,
        use_lab=False,
        lr_mult=1.0,
    )

Source from the content-addressed store, hash-verified

1147 """
1148
1149 def __init__(
1150 self,
1151 in_channels,
1152 mid_channels,
1153 out_channels,
1154 kernel_size=3,
1155 layer_num=6,
1156 identity=False,
1157 light_block=True,
1158 use_lab=False,
1159 lr_mult=1.0,
1160 ):
1161 super().__init__()
1162 self.identity = identity
1163
1164 self.layers = nn.LayerList()
1165 block_type = "LightConvBNAct" if light_block else "ConvBNAct"
1166 for i in range(layer_num):
1167 self.layers.append(
1168 eval(block_type)(
1169 in_channels=in_channels if i == 0 else mid_channels,
1170 out_channels=mid_channels,
1171 stride=1,
1172 kernel_size=kernel_size,
1173 use_lab=use_lab,
1174 lr_mult=lr_mult,
1175 )
1176 )
1177 # feature aggregation
1178 total_channels = in_channels + layer_num * mid_channels
1179 self.aggregation_squeeze_conv = ConvBNAct(
1180 in_channels=total_channels,
1181 out_channels=out_channels // 2,
1182 kernel_size=1,
1183 stride=1,
1184 use_lab=use_lab,
1185 lr_mult=lr_mult,
1186 )
1187 self.aggregation_excitation_conv = ConvBNAct(
1188 in_channels=out_channels // 2,
1189 out_channels=out_channels,
1190 kernel_size=1,
1191 stride=1,
1192 use_lab=use_lab,
1193 lr_mult=lr_mult,
1194 )
1195
1196 def forward(self, x):
1197 identity = x

Callers

nothing calls this directly

Calls 3

ConvBNActClass · 0.70
evalFunction · 0.50
__init__Method · 0.45

Tested by

no test coverage detected