MCPcopy Create free account
hub / github.com/FreeformRobotics/OTS / OAM_GRAM

Class OAM_GRAM

models/ots.py:41–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39
40
41class OAM_GRAM(Module):
42 def __init__(self, in_dim, one_hot_cls_num):
43 super(OAM_GRAM, self).__init__()
44 self.attn1 = Obj_Attn_Block(in_dim, 2)
45 self.attn2 = Obj_Attn_Block(in_dim//2, 0.5)
46 self.depth_conv = nn.Conv2d(in_channels=in_dim,
47 out_channels=in_dim,
48 kernel_size=(one_hot_cls_num, 1),
49 stride=1,
50 padding=0,
51 groups=in_dim)
52 self.point_conv = Conv2d(in_channels=in_dim, out_channels=in_dim*2, kernel_size=1)
53 self.norm = nn.BatchNorm2d(in_dim*2)
54 self.relu = nn.ReLU(inplace=True)
55
56 for layer in [self.depth_conv, self.point_conv]:
57 weight_init(layer)
58
59 def forward(self, x):
60 x = self.attn1(x)
61 x = self.attn2(x)
62 x = self.depth_conv(x)
63 x = self.point_conv(x)
64 x = self.norm(x)
65 x = self.relu(x)
66 x = x.view(x.size(0), -1)
67 return x
68
69
70class Classifier(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected