We train artificial neural networks for application in our tasks. Here, some conditions arise. Firstly, we need to prepare input data in the format and range that our network can handle. Secondly, we need to pass our data to the network properly. OpenCV helps us to perform both steps, and in this recipe we examine how to use OpenCV's dnn module to easily convert an image to a tensor and perform an inference.
Preprocessing images and inference in convolutional networks
Getting ready
Before you proceed with this recipe, you need to install the OpenCV 3.3.1 (or higher) Python API package.