Input layer not found: conv5/weights

asked 2020-03-12 12:37:55 -0600

  • opencv: 4.2
  • OS: WINDOWS10
  • Compile tools: VS2017

I trained a simple model in tensorflow, and save as a pb file. In opencv I failed in readNetFromTensorflow.

cv::dnn::Net mynet = cv::dnn::readNetFromTensorflow( "my.pb" );

I got an error: Input layer not found: conv5/weights. But there should be no input node of conv5/weight in my model. All the weights should have been frozen and the whole model have already been saved as a pb.

for i in gf.node:
    if i.name == 'conv5/weights' or i.name=='split_5' or i.name=='conv5/weights/read' or i.name=='split_5/split_dim':
        print(i);
-- I got: ----
name: "conv5/weights"
op: "Const"
attr {
  key: "dtype"
  value {
    type: DT_FLOAT
  }
}
attr {
  key: "value"
  value {....}
}


 name: "conv5/weights/read"
 op: "Identity"
 input: "conv5/weights"

 name: "split_5/split_dim"
 op: "Const"

 name: "split_5"
 op: "Split"
 input: "split_5/split_dim"
 input: "conv5/weights/read"

How to solve this problem?

edit retag flag offensive close merge delete