Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

c++ - opencv dnn module load tensorflow .pb file error

I trained a mnist_fashion model with tensorflow2.4, and then used opencv to call the generated .pb file and the following error occurred.

Net net = readNetFromTensorflow(weightFile);

String field 'tensorflow.FunctionDef.Node.ret' contains invalid UTF-8 data when parsing a protocol buffer. Use the 'bytes' type if you intend to send raw bytes. Failed to parse GraphDef file: models/saved_model.pb) in cv::dnn::ReadTFNetParamsFromBinaryFileOrDie


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I found a solution, just convert saved_model.pb to frozen_graph.pb. [https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/freeze_graph.py][1]


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...