Segmentation fault on readNetFromTensorflow [closed]

asked 2017-10-11 10:48:36 -0500

Maups gravatar image

I'm currently trying to create a .pb file for the InceptionV3 that runs on OpenCV 3.3. The problem is that, even after using the script I'm not able to load it using readNetFromTensorflow and I have no idea why.

I managed to create a .pbtxt file for this checkpointavailable on the internet, and I packaged all files (ckpt, pbtxt and my pb) in here:

To create the pb using the ckpt and pbtxt, I ran the following command:

export TENSORFLOW=/path/to/tensorflow
python -frz $TENSORFLOW/tensorflow/python/tools/ -opt $TENSORFLOW/tensorflow/python/tools/ -tr $TENSORFLOW/bazel-bin/tensorflow/tools/graph_transforms/transform_graph -net inception.pbtxt -ckpt inception_v3.ckpt -in_node Placeholder -out_node InceptionV3/Logits/AvgPool_1a_8x8/AvgPool -o inception-v3.pb

Then, I tried to load the model with this code:

#include <iostream>
#include <opencv2/dnn.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>

using namespace cv;
using namespace cv::dnn;
using namespace std;

int main(int argc, char **argv) {
    dnn::Net net = readNetFromTensorflow("inception-v3.pb");

but I'm getting segmentation fault. From gdb I get the following message:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff766baf0 in cv::dnn::experimental_dnn_v1::(anonymous namespace)::TFImporter::populateNet(cv::dnn::experimental_dnn_v1::Net) ()
   from /usr/local/lib/

Anyone faced a similar problem? Thanks in advance for any help!

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Maups
close date 2017-10-11 15:45:41.253106



Can you pull master branch to be sure ?

LBerger gravatar imageLBerger ( 2017-10-11 10:56:56 -0500 )edit

@LBerger is right, there is no problem for me with the master branch.

dkurt gravatar imagedkurt ( 2017-10-11 13:33:35 -0500 )edit

Yes, it works with the master branch. Sorry for the trouble guys, and thank you for the help!

Maups gravatar imageMaups ( 2017-10-11 15:45:08 -0500 )edit