【问题标题】:Image reconstruction using eigen vector使用特征向量进行图像重建
【发布时间】:2018-01-28 05:57:20
【问题描述】:

我正在按照 PCA 进行一些图像处理。我正在处理图像识别问题。有没有办法使用特征向量/权重重建我的图像(用于训练)? 我遵循了这个程序: https://onionesquereality.wordpress.com/2009/02/11/face-recognition-using-eigenfaces-and-distance-classifiers-a-tutorial/

【问题讨论】:

    标签: image-processing pca eigenvalue eigenvector


    【解决方案1】:

    当您拥有主成分 (PC) 后,您可以通过使用 PC 和您的数据计算点积来降低维度,如下所示。

    def projectData(X, U, K):
        # Compute the projection of the data using only the top K eigenvectors 
        # in U (first K columns). 
        # X: data
        # U: Eigenvectors
        # K: your choice of dimension
    
        new_U = U[:,:K]
        return X.dot(new_U)
    

    现在,我们如何取回原始数据?通过使用 U 中的前 K 个特征向量投影回原始空间。

    def recoverData(Z, U, K):
        # Compute the approximation of the data by projecting back onto 
        # the original space using the top K eigenvectors in U. 
        # Z: projected data
    
        new_U = U[:, :K]
        return Z.dot(new_U.T) # We can use transpose instead of inverse because U is orthogonal.
    

    【讨论】:

      猜你喜欢
      • 2019-08-22
      • 2020-07-31
      • 2010-12-23
      • 2020-11-12
      • 1970-01-01
      • 2016-04-09
      • 1970-01-01
      • 2020-10-23
      • 2016-06-29
      相关资源
      最近更新 更多