loading tensorflow model without .pbtxt file

asked 2018-08-09 13:52:21 -0500

Miguel Lorenzo gravatar image

Hi, complete DNN newbie here. I'm loading opencv_face_detector_uint8.pb with its associated opencv_face_detector.pbtxt file. When I omit the second argument to the readNet function, the unconnected output layer vector is different. Why?

Net net = dnn::experimental_dnn_v5::readNetFromTensorflow("opencv_face_detector_uint8.pb", "opencv_face_detector.pbtxt");

vector<int> vi = net.getUnconnectedOutLayers();
vector<string> node_names;
for(int i : vi)
  node_names.push_back(net.getLayer(i)->name);
for(auto& s : node_names)
  cout << s << " ";
/* outputs  "detection_out"*/

Net net = dnn::experimental_dnn_v5::readNetFromTensorflow("opencv_face_detector_uint8.pb");
...
/*outputs: mbox_loc mbox_conf_flatten, i.e. two nodes*/

A side question is: why can't I call

net.forward(node_name); /*node_name is a string containing an output node name*/

on the two nodes I get in the second example?

I hope someone can clarify, thanks.

edit retag flag offensive close merge delete