我正在尝试将scikit-learn的特征脸人脸识别脚本调整为适用于我的图像数据集(请注意,此脚本在我的Python 3、sklearn 0.17上运行完美)。
下面对
我希望脚本从我的数据集中获取图像,而不是从下载的文件夹中提取数据,该数据集位于
下面对
fetch_lfw_people()
的调用可能需要修改,我一直在努力让脚本跳过这一步,而是指向我的自己的图像文件夹。我希望脚本从我的数据集中获取图像,而不是从下载的文件夹中提取数据,该数据集位于
'/User/pepe/images/'
。# Download the data, if not already on disk and load it as numpy arrays
lfw_people = fetch_lfw_people(min_faces_per_person=70, resize=0.4)
# introspect the images arrays to find the shapes (for plotting)
n_samples, h, w = lfw_people.images.shape
# for machine learning we use the 2 data directly (as relative pixel
# positions info is ignored by this model)
X = lfw_people.data
n_features = X.shape[1]
# the label to predict is the id of the person
y = lfw_people.target
target_names = lfw_people.target_names
n_classes = target_names.shape[0]
etc...
你有没有关于如何解决这个问题的建议?
从GitHub代码中可以看出,中心部分实际上不是fetch_lfw_people()
本身,而是具有附加功能的lfw.py文件。