Bilinear CNN与 Randomly Wired Neural Network

最近主要学习了两篇论文以及相关的代码。

1、Bilinear CNN

这篇论文主要是在细粒度分类上应用的,在全连接层之前,在所有的卷积计算完成之后,进行的Bilinear计算,关键的代码如下:

    def forward(self, X):
        """Forward pass of the network.

        Args:
            X, torch.autograd.Variable of shape N*3*448*448.

        Returns:
            Score, torch.autograd.Variable of shape N*200.
        """
        N = X.size()[0]
        assert X.size() == (N, 3, 448, 448)
        X = self.features(X)
        assert X.size() == (N, 512, 28, 28)
        X = X.view(N, 512, 28**2)
        X = torch.bmm(X, torch.transpose(X, 1, 2)) / (28**2)  # Bilinear
        assert X.size() == (N, 512, 512)
        X = X.view(N, 512**2)
        X = torch.sqrt(X + 1e-5)
        X = torch.nn.functional.normalize(X)
        X = self.fc(X)
        assert X.size() == (N, 200)
        return X

这个地方和判断卷积核提取的特征的相似度判别,求取的相似矩阵有很大的相似之处。

2、 Randomly Wired Neural Network

将随机图应用到神经网络的构建之中,讲道理,构建的网络其实和DenseNet这种有很大的相似性。具体的过程,寄到笔记本上了。

猜你喜欢

转载自www.cnblogs.com/yanxingang/p/10689547.html