python - 将输入的 JPG 图像转换为 scikit 学习 SVM 分类器

标签 python machine-learning svm scikit-learn

我有一堆训练图像(.jpg 格式),我想将它们作为训练输入提供给 scikit learn 的 SVM 分类器。知道这样做的首选方法是什么吗?

例如,在 the example here 中图像数据从预定义的集合中加载,并在以下步骤中转换为 SVM 分类器可以理解的格式。

# The digits dataset
digits = datasets.load_digits()

# To apply an classifier on this data, we need to flatten the image, to
# turn the data in a (samples, feature) matrix:
n_samples = len(digits.images)
data = digits.images.reshape((n_samples, -1))

我的问题是,如果我有自己的图像集,想将其作为训练集加载到 SVM 分类器,我应该如何将这些图像转换为分类器能够理解的格式。

我在 OS-X (Mavericks) 上开发,但我将在 Linux (Ubuntu) 上运行实际代码

谢谢

最佳答案

您可以使用 DeCAF/nolearn/convnet 来完成这项任务。参见 this page举个例子。

关于python - 将输入的 JPG 图像转换为 scikit 学习 SVM 分类器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21226736/

相关文章:

java - org.deeplearning4j.exception.DL4JInvalidInputException : Problem with creating array with data to predict

python - 如何对 pandas 列中的列表执行一次热编码?

python - Keras CNN 仅预测单个类别

python - 在 Gridsearchcv 中评分

opencv - opencv 中 HOG 描述符的 SVM

python - 为什么 pytest + xdist 不捕获输出?

machine-learning - 是否可以使用具有余弦相似度的 KDTree?

R:使用支持向量机预测月度销售数据的两种方法

python - 使用 SVM 作为图像分类器时,精度/F 分数预计为 10% 吗?

python - 如何连接两个对象的路径?