openCV上的setSVMDetector

时间:2018-07-06 12:07:13

标签: python python-3.x opencv svm

error: (-215) checkDetectorSize() in function cv::HOGDescriptor::setSVMDetector

这是我在代码上遇到的错误,我在一个函数中,并且试图返回一个值。

with open(file_save_model, 'rb') as file:
    model = pickle.load(file)
    XX, YY = create_test_data_set()
    print("done")// print done
    print('default shape = ')// print default shape =
    print(cv.HOGDescriptor_getDefaultPeopleDetector().shape)// print (3781, 1)
    supportvectors = []
    print('dot shape = ')// print dot shape =
    print(np.dot(model.dual_coef_, model.support_vectors_).shape)// print (1, 50274)
    supportvectors.append(np.transpose(np.dot(model.dual_coef_, model.support_vectors_)))
    supportvectors.append([model.intercept_])
    supportvectors = list(itertools.chain(*supportvectors))
    hog_load = cv.HOGDescriptor(projectDirectory + '\\toxicity.xml')
    print('support vector = ')// print support vector
    print(np.array(supportvectors).shape)//print (50275, 1)
    hog_load.setSVMDetector(np.array(supportvectors, dtype=np.float64))//error that I mentioned
    return hog_load

我是SVM的新手,正在使用INRIA人检测器,并在scikit svc上对其进行了培训,并获得71%的分数。我将模型保存到该文件中,在这里也得到71%的信息。请告诉我是否需要更多数据来回答我。

0 个答案:

没有答案