facenet: Error loading a frozen graph ( float incompatible with float_ref )
I froze the 20170131-234652 model using the freeze_graph.py, but I cannot load it in C++.
I first read the binaryproto successfully as:
tensorflow::GraphDef graph_def;
Status load_graph_status = ReadBinaryProto(tensorflow::Env::Default(), graph_file_name, &graph_def);
But, it gives an error while creating the graph to be used for the session:
std::unique_ptr<tensorflow::Session> session(tensorflow::NewSession(tensorflow::SessionOptions()));
tensorflow::Status sessionCreateStatus = session->Create(graphDef);
The error is:
Invalid argument: Input 0 of node InceptionResnetV1/Block8/Branch_1/Conv2d_0c_3x1/BatchNorm/cond/AssignMovingAvg_1/Switch was passed float from InceptionResnetV1/Block8/Branch_1/Conv2d_0c_3x1/BatchNorm/moving_variance:0 incompatible with expected float_ref.
Any ideas how to solve this problem?
Thanks in advance 😃
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 26 (8 by maintainers)
Commits related to this issue
- Fixed the problem with batch norm nodes The problem with batch norm nodes is fixed based on the following issues: https://github.com/tensorflow/tensorflow/issues/3628 https://github.com/davidsandbe... — committed to PythonDevMaster/faceNet by PythonDevMaster 7 years ago
- Fixed the problem with batch norm nodes The problem with batch norm nodes is fixed based on the following issues: https://github.com/tensorflow/tensorflow/issues/3628 https://github.com/davidsandbe... — committed to passiondev2024/facenet by passiondev2024 7 years ago
my code
BTW, this error also happens when I load the .pb model in Python:
ValueError: graph_def is invalid at node 'InceptionResnetV1/Conv2d_1a_3x3/BatchNorm/cond/AssignMovingAvg/Switch': Input tensor 'InceptionResnetV1/Conv2d_1a_3x3/BatchNorm/moving_mean:0' Cannot convert a tensor of type float32 to an input of type float32_ref.@tengshaofeng: I just submitted a pull request with the updated freeze_graph.py. This is how I call the function:
python freeze_graph.py ~/models/facenet/20170131-234652 ~/models/facenet/20170131-234652/facenet.pbFor loading the protobuf graph in Python, you can use:
For loading it in C++, you can use:
@tengshaofeng A great tutorial is here.