Sometimes it's necessary to get information about what's going on with the data shape during a forward pass in deep neural networks. For example, some models allow the usage of various input spatial size and, in that case, you may want to know the output tensors' shapes. OpenCV has an option to get all shapes for all tensors (including intermediate tensors) without inference. This recipe reviews ways of using such functionality along with other useful routines relevant to neural nets.
Getting input and output tensors' shapes for all layers
Getting ready
Before you proceed with this recipe, you need to install the OpenCV 3.3.1 (or higher) Python API package.