Skip to content

Commit f69c636

Browse files
xizilishengxi
andauthored
mmocr FPNC neck support asf module (open-mmlab#1828)
* mmocr FPNC neck support asf module * mmocr FPNC neck support asf module --------- Co-authored-by: lishengxi <[email protected]>
1 parent cb964f6 commit f69c636

File tree

1 file changed

+8
-0
lines changed
  • mmdeploy/codebase/mmocr/models/text_detection

1 file changed

+8
-0
lines changed

mmdeploy/codebase/mmocr/models/text_detection/fpn_cat.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ def fpnc__forward__tensorrt(ctx, self, inputs, **kwargs):
5252
outs[i] = F.interpolate(outs[i], size=outs[0].shape[2:], mode=mode)
5353
out = torch.cat(outs, dim=1)
5454

55+
if self.asf_cfg is not None:
56+
asf_feature = self.asf_conv(out)
57+
attention = self.asf_attn(asf_feature)
58+
enhanced_feature = []
59+
for i, out in enumerate(outs):
60+
enhanced_feature.append(attention[:, i:i + 1] * outs[i])
61+
out = torch.cat(enhanced_feature, dim=1)
62+
5563
if self.conv_after_concat:
5664
out = self.out_conv(out)
5765

0 commit comments

Comments
 (0)