0

当我在 scikit learn 中预测属于 SVM 中图像的类别时

...
print "Predicting on 1 sample"
print "Input features:"
fv = [0.16666666666628771, 5.169878828456423e-26, 2.584939414228212e-22, 1.0, 1.0000000000027285]
print fv
print "Predicted class index:"
print clf.predict([fv])

输出:

Predicted class index:
[5]

我怎样才能在同类中获得最多 5 个相似的图像?

4

1 回答 1

1

我不认为您可以获得来自 SVM 的样本之间的相似性度量,只有从样本到用于分类的超平面的距离。

您可以使用scipy.spatial.distance.pdist方法计算图像特征向量之间的欧几里得距离。与您的目标图像距离最短的 5 个图像可以被认为是最相似的。我希望这会有所帮助。

于 2013-02-21T07:48:32.957 回答