Example #1
0
    def forward(self, x):
        '''

        :param x:  b,n,f,ssn,srn
        :return:
        '''
        b, n, f, ssn, srn = x.shape
        assert (ssn == 5 and srn == 5)
        x = x.reshape(b * n, f, ssn, srn)

        x1 = self.network1_embed1_relu(
            self.network1_embed1(x) + self.network1_embed1_short(x))
        x1 = self.network1_embed2_relu(
            self.network1_embed2(x1) + self.network1_embed2_short(x1))
        x1 = self.network1_embed3(x1)

        x2 = self.network2_embed1_relu(
            self.network2_embed1(x) + self.network2_embed1_short(x))
        x2 = self.network2_embed2_relu(
            self.network2_embed2(x2) + self.network2_embed2_short(x2))
        x2 = self.network2_embed3(x2)

        x1 = x1.reshape(b * n, 8, 25)
        x2 = x2.reshape(b * n, 16, 25).permute(0, 2, 1)  # b*n,25,16
        x = torch.bmm(x1, x2).reshape(b * n, 128)  # b*n,8,25
        assert (x.shape[1] == 128)
        x = x.reshape(b, n, 128)
        x = l2_normalize(x, axis=2)
        return x
Example #2
0
    def forward(self, x):
        '''

        :param x:  b,n,f,ssn,srn
        :return:
        '''
        x = l2_normalize(x, axis=2)
        return x[:, :, :, 0, 0]
Example #3
0
 def forward(self, x):
     x = self.conv1(self.conv0(x))
     x = l2_normalize(x, axis=1)
     return x