MCPcopy
hub / github.com/JaidedAI/EasyOCR / __init__

Method __init__

easyocr/DBNet/backbones/resnet.py:34–74  ·  view source on GitHub ↗
(self, inplanes, planes, stride=1, downsample=None, dcn=None)

Source from the content-addressed store, hash-verified

32 expansion = 1
33
34 def __init__(self, inplanes, planes, stride=1, downsample=None, dcn=None):
35 super(BasicBlock, self).__init__()
36 self.with_dcn = dcn is not None
37 self.conv1 = conv3x3(inplanes, planes, stride)
38 self.bn1 = BatchNorm2d(planes)
39 self.relu = nn.ReLU(inplace=True)
40 self.with_modulated_dcn = False
41 if self.with_dcn:
42 fallback_on_stride = dcn.get('fallback_on_stride', False)
43 self.with_modulated_dcn = dcn.get('modulated', False)
44 # self.conv2 = conv3x3(planes, planes)
45 if not self.with_dcn or fallback_on_stride:
46 self.conv2 = nn.Conv2d(planes, planes, kernel_size=3,
47 padding=1, bias=False)
48 else:
49 deformable_groups = dcn.get('deformable_groups', 1)
50 if not self.with_modulated_dcn:
51 #from assets.ops.dcn import DeformConv
52 from ..assets.ops.dcn import DeformConv
53 conv_op = DeformConv
54 offset_channels = 18
55 else:
56 #from assets.ops.dcn import ModulatedDeformConv
57 from ..assets.ops.dcn import ModulatedDeformConv
58 conv_op = ModulatedDeformConv
59 offset_channels = 27
60 self.conv2_offset = nn.Conv2d(
61 planes,
62 deformable_groups * offset_channels,
63 kernel_size=3,
64 padding=1)
65 self.conv2 = conv_op(
66 planes,
67 planes,
68 kernel_size=3,
69 padding=1,
70 deformable_groups=deformable_groups,
71 bias=False)
72 self.bn2 = BatchNorm2d(planes)
73 self.downsample = downsample
74 self.stride = stride
75
76 def forward(self, x):
77 residual = x

Callers

nothing calls this directly

Calls 3

conv3x3Function · 0.85
getMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected