airockchip / rknn-toolkit2

Other
967 stars 101 forks source link

load_tensorflow加载pb模型时报错 #208

Open hzr12 opened 1 week ago

hzr12 commented 1 week ago

log I rknn-toolkit2 version: 2.2.0 I rknn-toolkit2 version: 2.2.0 2024-11-10 13:44:26.696928: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT W load_tensorflow: The inputs name should be a tensor name instead of node name 2024-11-10 13:44:45.437895: E tensorflow/core/framework/node_def_util.cc:676] NodeDef mentions attribute grad_b which is not in the op definition: Op<name=MatMul; signature=a:T, b:T -> product:T; attr=transpose_a:bool,default=false; attr=transpose_b:bool,default=false; attr=T:type,allowed=[DT_BFLOAT16, DT_HALF, DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64, DT_UINT8, DT_UINT16, DT_UINT32, DT_UINT64, DT_COMPLEX64, DT_COMPLEX128]> This may be expected if your graph generating binary is newer than this binary. Unknown attributes will be ignored. NodeDef: {{node sequential_1/dense_1/MatMul}} WARNING:tensorflow:From /home/huangzr/anaconda3/envs/rknn/lib/python3.8/site-packages/tf2onnx/tf_loader.py:301: convert_variables_to_constants (from tensorflow.python.framework.convert_to_constants) is deprecated and will be removed in a future version. Instructions for updating: This API was designed for TensorFlow v1. See https://www.tensorflow.org/guide/migrate for instructions on how to migrate your code to TensorFlow v2. WARNING:tensorflow:From /home/huangzr/anaconda3/envs/rknn/lib/python3.8/site-packages/tensorflow/python/framework/convert_to_constants.py:946: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version. Instructions for updating: This API was designed for TensorFlow v1. See https://www.tensorflow.org/guide/migrate for instructions on how to migrate your code to TensorFlow v2. 2024-11-10 13:44:45.725709: E tensorflow/core/grappler/grappler_item_builder.cc:664] Fetch node Input:0 doesn't exist in graph W load_tensorflow: Catch exception when loading tensorflow model: /home/huangzr/Fairy.pb! W load_tensorflow: Make sure that the tensorflow version of '/home/huangzr/Fairy.pb' is consistent with the installed tensorflow version '2.13.1'! E load_tensorflow: Traceback (most recent call last): E load_tensorflow: File "rknn/api/rknn_base.py", line 1256, in rknn.api.rknn_base.RKNNBase.load_tensorflow E load_tensorflow: File "/home/huangzr/anaconda3/envs/rknn/lib/python3.8/site-packages/tf2onnx/convert.py", line 634, in from_graph_def E load_tensorflow: frozen_graph = tf_loader.tf_optimize(input_names, output_names, graph_def) E load_tensorflow: File "/home/huangzr/anaconda3/envs/rknn/lib/python3.8/site-packages/tf2onnx/tf_loader.py", line 735, in tf_optimize E load_tensorflow: graph_def = tf_optimize_grappler(input_names, output_names, graph_def) E load_tensorflow: File "/home/huangzr/anaconda3/envs/rknn/lib/python3.8/site-packages/tf2onnx/tf_loader.py", line 724, in tf_optimize_grappler E load_tensorflow: graph_def = tf_opt.OptimizeGraph(config, meta_graph) E load_tensorflow: File "/home/huangzr/anaconda3/envs/rknn/lib/python3.8/site-packages/tensorflow/python/grappler/tf_optimizer.py", line 65, in OptimizeGraph E load_tensorflow: out_graph = tf_opt.TF_OptimizeGraph(cluster.tf_cluster, E load_tensorflow: ValueError: Failed to import metagraph, check error log for more info. W If you can't handle this error, please try updating to the latest version of the toolkit2 and runtime from: https://console.zbox.filez.com/l/I00fc3 (Pwd: rknn) Path: RKNPU2_SDK / 2.X.X / develop / If the error still exists in the latest version, please collect the corresponding error logs and the model, convert script, and input data that can reproduce the problem, and then submit an issue on: https://redmine.rock-chips.com (Please consult our sales or FAE for the redmine account)

` from rknn.api import RKNN

rknn = RKNN(verbose=True) rknn.release()

rknn_instance = RKNN()

ret = rknn_instance.load_tensorflow(tf_pb='/home/huangzr/Fairy.pb', inputs=['Input:0'], outputs=['Identity:0'], input_size_list=[[None, 280, 210, 3]])`

hzr12 commented 2 days ago

请麻烦看看到底为何报错