import cv2 import numpy as np 214750 nn_config np array 1250 trainX np

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import cv2
import numpy as np
c = 214750
nn_config = np.array([1250, 2, 1])
trainX = np.zeros((c, nn_config[0]))
trainY = np.zeros((c, nn_config[2]))
sampleWeights = np.ones_like(trainY) / trainY.shape[0]
ann = cv2.ANN_MLP()
ann.create(nn_config, cv2.ANN_MLP_SIGMOID_SYM)
ann.train(inputs=trainX, outputs=trainY, sampleWeights=sampleWeights)