Ejemplo n.º 1
0
    def forward(self, x, feat):
        out = self.conv_offset(feat)
        o1, o2, mask = torch.chunk(out, 3, dim=1)
        offset = torch.cat((o1, o2), dim=1)
        mask = torch.sigmoid(mask)

        offset_absmean = torch.mean(torch.abs(offset))
        if offset_absmean > 50:
            # logger = get_root_logger()
            print(f'Offset abs mean is {offset_absmean}, larger than 50.')

        return modulated_deform_conv(x, offset, mask, self.weight, self.bias,
                                     self.stride, self.padding, self.dilation,
                                     self.groups, self.deformable_groups)
Ejemplo n.º 2
0
    def forward(self, x, feat):
        out = self.conv_offset(feat)
        o1, o2, mask = torch.chunk(out, 3, dim=1)
        offset = torch.cat((o1, o2), dim=1)
        mask = torch.sigmoid(mask)
        #    print('o1 shape: {p1}'.format(p1=o1.shape))
        #     print('offset shape: {p2}'.format(p2=offset.shape))
        #    print('mask shape: {p3}'.format(p3=mask.shape))
        offset_absmean = torch.mean(torch.abs(offset))
        if offset_absmean > 50:
            logger = get_root_logger()
            logger.warning(
                f'Offset abs mean is {offset_absmean}, larger than 50.')

        return modulated_deform_conv(x, offset, mask, self.weight, self.bias,
                                     self.stride, self.padding, self.dilation,
                                     self.groups, self.deformable_groups)
Ejemplo n.º 3
0
def my_modulated_deform_conv(ctx, input_data, offset, mask, weight,
                bias=None, stride=1, padding=0, dilation=1, groups=1, deformable_groups=1):
    return modulated_deform_conv(ctx, input_data, offset, mask, weight, bias, stride, padding, dilation, groups, deformable_groups)