loadGraph(): ERRORNot found: Failed to load compute graph at

loadGraph(): ERRORNot found: Failed to load compute graph at



I am trying to run a c++ project using tesorflow ! But getting this error when loading the frozen_inference_graph.pb.



loadGraph(): ERRORNot found: Failed to load compute graph at '~/Desktop/Tensor/obdet/tensorflow-object-detection-cpp/demo/ssd_mobilenet_v1_egohands/frozen_inference_graph.pb'



How to solve it !



Source Code::


string ROOTDIR = "~/Desktop/Tensor/obdet/tensorflow-object-detection-cpp/";
string LABELS = "demo/ssd_mobilenet_v1_egohands/labels_map.pbtxt";
string GRAPH = "demo/ssd_mobilenet_v1_egohands/frozen_inference_graph.pb";
// Set input & output nodes names`
string inputLayer = "image_tensor:0";
vector<string> outputLayer = "detection_boxes:0", "detection_scores:0", "detection_classes:0", "num_detections:0";
// Load and initialize the model from .pb file
std::unique_ptr<tensorflow::Session> session;
string graphPath = tensorflow::io::JoinPath(ROOTDIR, GRAPH);
LOG(INFO) << "graphPath:" << graphPath;
Status loadGraphStatus = loadGraph(graphPath, &session);
//LOG(INFO) << "graphPath:" << graphPath;
if (!loadGraphStatus.ok())
LOG(ERROR) << "loadGraph(): ERROR" << loadGraphStatus;
//return -1;
else
LOG(INFO) << "loadGraph(): frozen graph loaded" << endl;


// Load labels map from .pbtxt file
std::map<int, std::string> labelsMap = std::map<int,std::string>();
Status readLabelsMapStatus = readLabelsMapFile(tensorflow::io::JoinPath(ROOTDIR, LABELS), labelsMap);
if (!readLabelsMapStatus.ok())
LOG(ERROR) << "readLabelsMapFile(): ERROR" << loadGraphStatus;
// return -1;
else
LOG(INFO) << "readLabelsMapFile(): labels map loaded with " << labelsMap.size() << " label(s)" << endl;



Load Function :


Status loadGraph(const string &graph_file_name,unique_ptr<tensorflow::Session> *session)
tensorflow::GraphDef graph_def;
Status load_graph_status =
ReadBinaryProto(tensorflow::Env::Default(), graph_file_name, &graph_def);
if (!load_graph_status.ok())
return tensorflow::errors::NotFound("Failed to load compute graph at '",
graph_file_name, "'");

session->reset(tensorflow::NewSession(tensorflow::SessionOptions()));
Status session_create_status = (*session)->Create(graph_def);
if (!session_create_status.ok())
return session_create_status;

return Status::OK();





Most likely reason is that your graphPath is wrong. Assuming the file is where you say it is then I would try replacing the ~ in ROOTDIR with an explicit path.
– john
Aug 30 at 13:36



graphPath


~


ROOTDIR





Yes ! graphpath was from! Thanks a lot :)
– mahbubcseju
Aug 31 at 10:51






Required, but never shown



Required, but never shown






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)