#include <opencv2/dnn.hpp>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
using namespace dnn;
Mat img = imread(image_path);
String file = "graph_for_dnn.pb";
Net net = readNetFromTensorflow(file);
型号:http://download.tensorflow.org/models/deeplabv3_mnv2_dm05_pascal_trainval_2018_10_01.tar.gz
bazel-bin/tensorflow/tools/graph_transforms/transform_graph --in_graph=deeplabv3_mnv2_dm05_pascal_trainval/frozen_inference_graph.pb --out_graph=graph_for_dnn.pb --inputs='input' --outputs='embeding' --transforms="remove_nodes(op=phase_train, op=Identity, op=CheckNumerics)"
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.2.0-pre) /home/wcy/learnopencv-master/InstallScripts/opencv/modules/dnn/src/tensorflow/tf_importer.cpp:544: error: (-2:Unspecified error) Input layer not found: Shape_4 in function 'connect'