From the course: Computer Vision on the Raspberry Pi 4

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Creating neural networks in OpenCV

Creating neural networks in OpenCV

- [Instructor] In OpenCV, neural networks are represented by instances of the ANN_MLP class, where ANN stands for Artificial Neural Network, and MLP stands for Multi-Layer Perceptron. Using this class is easy. You create an instance by calling ANN_MLP_create and then set its structure by calling setLayerSizes with a list that identifies the number of nodes in each layer. After creating the network, you can train it by calling train with two arrays, one containing feature data, and one containing labels. A label is an integer that identifies the category of the corresponding feature. When training is complete, the predict method accepts data of an unknown feature and returns a prediction or classification. The ANN_MLP class provides three methods that control the training process. The first is setTrainingMethod, which can be set to simulate at annealing, backpropagation, or resilient backpropagation. The second is…

Contents