论文标题

快速区分矩阵平方根和反平方根

Fast Differentiable Matrix Square Root and Inverse Square Root

论文作者

Song, Yue, Sebe, Nicu, Wang, Wei

论文摘要

在各种计算机视觉任务中,计算矩阵平方根及其倒数很重要。先前的方法要么采用奇异值分解(SVD)来显式分解矩阵,要么使用牛顿 - 舒尔茨迭代(NS迭代)来得出近似解决方案。但是,两种方法在向前或向后通过的计算上都不够有效。在本文中,我们提出了两个更有效的变体,以计算可区分的矩阵平方根和反平方根。对于正向传播,一种方法是使用矩阵Taylor多项式(MTP),另一种方法是使用矩阵Padé近似值(MPA)。向后梯度是通过使用矩阵符号函数迭代求解连续时间Lyapunov方程来计算的。一系列数值测试表明,两种方法与SVD或NS迭代相比产生相当大的加速。此外,我们验证了在几种现实世界应用中的方法的有效性,包括DE相关的批发归一化,二阶视觉变压器,用于大规模且细粒度识别的全球协方差池,用于视频识别和神经风格转移的专注协方差池。实验结果表明,我们的方法还可以实现竞争性甚至更好的性能。 pytorch实施可在https://github.com/kingjamessong/fastdifferentiablemablesqrt上获得

Computing the matrix square root and its inverse in a differentiable manner is important in a variety of computer vision tasks. Previous methods either adopt the Singular Value Decomposition (SVD) to explicitly factorize the matrix or use the Newton-Schulz iteration (NS iteration) to derive the approximate solution. However, both methods are not computationally efficient enough in either the forward pass or the backward pass. In this paper, we propose two more efficient variants to compute the differentiable matrix square root and the inverse square root. For the forward propagation, one method is to use Matrix Taylor Polynomial (MTP), and the other method is to use Matrix Padé Approximants (MPA). The backward gradient is computed by iteratively solving the continuous-time Lyapunov equation using the matrix sign function. A series of numerical tests show that both methods yield considerable speed-up compared with the SVD or the NS iteration. Moreover, we validate the effectiveness of our methods in several real-world applications, including de-correlated batch normalization, second-order vision transformer, global covariance pooling for large-scale and fine-grained recognition, attentive covariance pooling for video recognition, and neural style transfer. The experimental results demonstrate that our methods can also achieve competitive and even slightly better performances. The Pytorch implementation is available at https://github.com/KingJamesSong/FastDifferentiableMatSqrt

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源