使用opencv加载MobileNet模型时出错

时间:2019-12-17 03:57:04

标签: opencv tensorflow connect

#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'

0 个答案:

没有答案