# Revision history [back]

As @berak point out that suspect. I was looking at my code. The suspect is image in parameter. You can't used image in numpy array. You usually used index array. I have snippet code:

m1 = [270, 110, 150, 120, 370, 570, 110, 290, 350,380]
m2 = [55, 55, 51, 92, 78, 27, 14, 8, 26,54]
m3 = [38, 35, 39, 98, 57, 62, 10, 62, 43,89]

n1 = [0, 0, 1]
n2 = [0, 1, 0]
n3 = [1, 0, 0]

SAMPLES = 5000
for x in range(0, SAMPLES):
print(f'Samples {}{}'.format(x, SAMPLES)
ann.train(np.array([m1, m2, im3], np.float32),
cv2.ml.ROW_SAMPLE,
np.array([n1, n2, n3], np.float32))


As @berak point out that suspect. I was looking at my code. The suspect is image in parameter. You can't used image in numpy array. You usually used index array. I have snippet code:

m1 = [270, 110, 150, 120, 370, 570, 110, 290, 350,380]
m2 = [55, 55, 51, 92, 78, 27, 14, 8, 26,54]
m3 = [38, 35, 39, 98, 57, 62, 10, 62, 43,89]

n1 = [0, 0, 1]
n2 = [0, 1, 0]
n3 = [1, 0, 0]

SAMPLES = 5000
for x in range(0, SAMPLES):
print(f'Samples {}{}'.format(x, SAMPLES)
ann.train(np.array([m1, m2, im3], m3],  np.float32),
cv2.ml.ROW_SAMPLE,
np.array([n1, n2, n3], np.float32))


As @berak point out that suspect. I was looking at my code. The suspect is image in parameter. You can't used image in numpy array. You usually used index array. I have snippet code:

m1 = [270, 110, 150, 120, 370, 570, 110, 290, 350,380]
m2 = [55, 55, 51, 92, 78, 27, 14, 8, 26,54]
m3 = [38, 35, 39, 98, 57, 62, 10, 62, 43,89]

n1 = [0, 0, 1]
n2 = [0, 1, 0]
n3 = [1, 0, 0]

SAMPLES = 5000
for x in range(0, SAMPLES):
print(f'Samples {}{}'.format(x, SAMPLES)
ann.train(np.array([m1, m2, m3],  np.float32),
cv2.ml.ROW_SAMPLE,
np.array([n1, n2, n3], np.float32))


Edit: As @berak point out w//out looping. I was doing tensorflow and keras. You can do like this:

ann.train(np.array([m1, m2, m3],  np.float32),
cv2.ml.ROW_SAMPLE,
np.array([n1, n2, n3], np.float32))