(self, in_dim, one_hot_cls_num)
| 40 | |
| 41 | class 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) |
no test coverage detected