【发布时间】:2016-03-02 17:40:52
【问题描述】:
我是 openCV 的初学者,正在尝试分析数独求解器的现有代码。有这部分代码会引发错误。
samples = np.float32(np.loadtxt('feature_vector_pixels.data'))
responses = np.float32(np.loadtxt('samples_pixels.data'))
model = cv2.ml.KNearest_create()
model.train(samples, responses)
报错如下Type Error: Only length-1 arrays can be converted to Python Scalars。
完整的回溯如下:
C:\Study stuff\FinalProject>c:\Python27\python.exe Sudoku.py
Traceback (most recent call last):
File "Sudoku.py", line 15, in <module>
model.train(samples, responses)
TypeError: only length-1 arrays can be converted to Python scalars
知道问题是什么吗?
【问题讨论】:
-
你有完整的回溯吗?
-
@memoselyk 我添加了完整的回溯