1 | initial version |
The answer is to set up the network using these functions:
ann = cv2.ml.ANN_MLP_create()
ann.setLayerSizes(np.array([num_input_neurons, num_hidden_neurons, num_output_neurons], dtype=np.int64))
ann.setActivationFunction(cv2.ml.ANN_MLP_SIGMOID_SYM)
ann.setTermCriteria((cv2.TERM_CRITERIA_COUNT | cv2.TERM_CRITERIA_EPS, 1, 0.000001 ))
ann.setTrainMethod(cv2.ml.ANN_MLP_BACKPROP, 0.001)
#ann.setBackpropMomentumScale(0.00001)
ann.setBackpropWeightScale(0.00001)
I swear I tried this approach before, but I guess not. Thanks to @berak for the help again.