net.setInput(cv.dnn.blobFromImage(frame, 1.0, (inWidth, inHeight), (127.5, 127.5, 127.5), swapRB=True, crop=False))
out = net.forward()
out = out[:, :19, :, :] # MobileNet output [1, 57, -1, -1], we only need the first 19 elements
#在docker 环境 rknn 1.0.0 版本源码
rknn = RKNN()
print('--> config model')
rknn.config(channel_mean_value='127.5 127.5 127.5 128', reorder_channel='0 1 2', quantized_dtype='asymmetric_quantized-u8')
print('done')
# Load tensorflow model
print('--> Loading model')
ret = rknn.load_tensorflow(tf_pb='./graph_opt.pb',
inputs=['FeatureExtractor/human-pose-estimation/human-pose-estimation/input'],
outputs=['concat_1', 'concat'],
input_size_list=[[368,368,3]],
predef_file=None)
if ret != 0:
print('Load model failed!')
exit(ret)
print('done')
执行报错:
--> Loading model
E Catch exception when loading tensorflow model: ./graph_opt.pb!
T Traceback (most recent call last):
T File "rknn/api/rknn_base.py", line 136, in rknn.api.rknn_base.RKNNBase.load_tensorflow
T File "rknn/base/RKNNlib/converter/convert_tf.py", line 102, in rknn.base.RKNNlib.converter.convert_tf.convert_tf.__init__
T File "rknn/base/RKNNlib/converter/tensorflowloader.py", line 50, in rknn.base.RKNNlib.converter.tensorflowloader.TF_Graph_Preprocess.__init__
T File "rknn/base/RKNNlib/converter/tensorflowloader.py", line 65, in rknn.base.RKNNlib.converter.tensorflowloader.TF_Graph_Preprocess.scan_and_optim_graph
T File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/graph_util_impl.py", line 174, in extract_sub_graph
T _assert_nodes_are_present(name_to_node, dest_nodes)
T File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/graph_util_impl.py", line 133, in _assert_nodes_are_present
T assert d in name_to_node, "%s is not in graph" % d
T AssertionError: concat is not in graph
Load model failed!