在脚注8中的这篇提炼文章(https://distill.pub/2017/feature-visualization/)中,作者写道:
The Fourier transforms decorrelates spatially, but a correlation will still exist
between colors. To address this, we explicitly measure the correlation between colors
in the training set and use a Cholesky decomposition to decorrelate them.我很难理解该怎么做。我理解,对于任意图像,我可以通过将图像的形状解释为通道、宽度*高度而不是通道、高度、宽度来计算相关矩阵。但是如何考虑整个数据集呢?它可以被平均值,但这与Cholesky分解没有任何关系。
检查代码使我更加困惑(https://github.com/tensorflow/lucid/blob/master/lucid/optvis/param/color.py#L24)。没有计算相关性的代码,但有一个硬编码版本的矩阵(去相关发生在矩阵乘法与此矩阵)。矩阵名为color_correlation_svd_sqrt,其中包含svd,其他任何地方都没有提到SVD。还有矩阵是非三角形的,这意味着它不是来自Cholesky分解。
如能对我提到的任何问题作出澄清,将不胜感激。
发布于 2021-02-15 17:57:47
我想出了你问题的答案:How to calculate the 3x3 covariance matrix for RGB values across an image dataset?
简而言之,计算图像数据集的RGB协方差矩阵,然后进行以下计算
U,S,V = torch.svd(dataset_rgb_cov_matrix)
epsilon = 1e-10
svd_sqrt = U @ torch.diag(torch.sqrt(S + epsilon))https://stackoverflow.com/questions/62289967
复制相似问题