Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

loading tensorflow model without .pbtxt file

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.