如何在scikit-learn中使用自己的数据集?Scikit教程通常以加载他的数据集(数字数据集、花卉数据集等)作为示例。
http://scikit-learn.org/stable/datasets/index.html 例如:从sklearn.datasets导入load_iris。
我有我的图片,但不知道如何创建新的数据集。
特别是,在开始时,我使用了我找到的这个例子(我使用opencv库):
img =cv2.imread('telamone.jpg')
# Convert them to grayscale
imgg =cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
# SURF extraction
surf = cv2.SURF()
kp, descritors = surf.detect(imgg,None,useProvidedKeypoints = False)
# Setting up samples and responses for kNN
samples = np.array(descritors)
responses = np.arange(len(kp),dtype = np.float32)
我希望能提取一组图片的特征,以便实施机器学习算法!
(n_images, n_features)
的 numpy 数组,以及形状为(n_images,)
的 numpy 数组用于目标预测,每个不同的标志都有不同的整数。提取特征的方法。您可以尝试使用 scikit-image 中的 HoG 特征,它们提供了固定大小的数组,而不是基于关键点的特征,例如 SURF 或 SIFT,这些特征具有动态结构(关键点数量因图像而异)。 - ogrisel