Python 基于PCA和SVM的人脸识别

Python 基于PCA和SVM的人脸识别,python,scikit-learn,pca,Python,Scikit Learn,Pca,我使用的代码来自sklearn文档网站上的一个示例 因此,这将与错误消息中断: Traceback (most recent call last): File "eigenfaces.py", line 87, in <module> eigenfaces = pca.components_.reshape((n_components, h, w)) ValueError: total size of new array must be unchanged n_samples,

我使用的代码来自sklearn文档网站上的一个示例

因此,这将与错误消息中断:

Traceback (most recent call last):
File "eigenfaces.py", line 87, in <module>
eigenfaces = pca.components_.reshape((n_components, h, w))
ValueError: total size of new array must be unchanged

n_samples, h, w = lfw_people.images.shape
lfw_people.images.shape = (109, 50, 37)

有人能帮忙吗?谢谢

您应该发布完整的堆栈跟踪。还有一些发生此错误的人脸数据文件,上面关于示例的链接也不起作用
Traceback (most recent call last):
File "eigenfaces.py", line 87, in <module>
eigenfaces = pca.components_.reshape((n_components, h, w))
ValueError: total size of new array must be unchanged

n_samples, h, w = lfw_people.images.shape
lfw_people.images.shape = (109, 50, 37)
pca.components_.shape = (81, 1850)
n_component = 150