【发布时间】:2014-02-09 04:39:21
【问题描述】:
我有一堆训练图像(.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) 上运行实际代码
谢谢
【问题讨论】:
-
你想要shell脚本吗? Python 脚本?你的操作系统是什么?
-
我不想要 shell 脚本。我在 OS-X (Mavericks) 上用 python 编码。
标签: python machine-learning svm scikit-learn