Opencv DNN module
The OpenCV DNN module only supports deep learning inference on images and videos, but it supports loading many popular deep learning frameworks such as TensorFlow, (Py)Torch, DarkNet, Caffe, ONNX. - DNN opencv module: A Definitive Guide / A Comprehensive Guide / DNN
Conversion of TensorFlow Segmentation Models and Launch with OpenCV
The key concepts involved in the transition pipeline of the TensorFlow classification and segmentation models with OpenCV API are almost equal excepting the phase of graph optimization. The initial step in conversion of TensorFlow models into cv.dnn.Net is obtaining the frozen TF model graph. Frozen graph defines the combination of the model graph structure with kept values of the required variables, for example, weights. Usually the frozen graph is saved in protobuf (.pb) files. To read the generated segmentation model .pb file with cv.dnn.readNetFromTensorflow, it is needed to modify the graph with TF graph transform tool.
.tflite
Not supported yet, but should be convertible to .pb
Conversion of PyTorch Segmentation Models and Launch with OpenCV
The key points involved in the transition pipeline of the PyTorch classification and segmentation models with OpenCV API are equal. The first step is model transferring into ONNX format with PyTorch torch.onnx.export built-in function. Further the obtained .onnx model is passed into cv.dnn.readNetFromONNX, which returns cv.dnn.Net object ready for DNN manipulations.