rockchip-linux / rknn-toolkit

BSD 3-Clause "New" or "Revised" License
831 stars 175 forks source link

toolkit-1.7.1 layer: Mean(OP: functional_1/avg_pool/Mean)不支持 #220

Open sanfordhuang opened 2 years ago

sanfordhuang commented 2 years ago

tensorflow模型转rknn时报错,提示不支持,请问有解决方案吗,谢谢!

版本: rknn-toolkit: toolkit-1.7.1 tensorflow: 2.0.0 python:3.6.13

错误信息:

I Match reduce_mean_nokeepshape [['functional_1/avg_pool/Mean', 'functional_1/avg_pool/Mean/reduction_indices']] [['Mean', 'C']] to [['pooling', 'reshape']]
E Try match layer: Mean(OP: functional_1/avg_pool/Mean) failed, catch exception!The OP of this layer may not yet support, please check document <RKNN_OP_Support.md>!
E Catch exception when loading tensorflow model: ./xxx.pb!
E Traceback (most recent call last):
E   File "/home/xxx/anaconda3/envs/py/lib/python3.6/site-packages/tensorflow_core/python/framework/importer.py", line 501, in _import_graph_def_internal
E     graph._c_graph, serialized, options)  # pylint: disable=protected-access
E tensorflow.python.framework.errors_impl.InvalidArgumentError: NodeDef mentions attr 'exponential_avg_factor' not in Op<name=FusedBatchNormV3; signature=x:T, scale:U, offset:U, mean:U, variance:U -> y:T, batch_mean:U, batch_variance:U, reserve_space_1:U, reserve_space_2:U, reserve_space_3:U; attr=T:type,allowed=[DT_HALF, DT_BFLOAT16, DT_FLOAT]; attr=U:type,allowed=[DT_FLOAT]; attr=epsilon:float,default=0.0001; attr=data_format:string,default="NHWC",allowed=["NHWC", "NCHW"]; attr=is_training:bool,default=true>; NodeDef: {{node functional_1/batch_normalization/FusedBatchNormV3}}. (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).
E During handling of the above exception, another exception occurred:
E Traceback (most recent call last):
E   File "rknn/base/RKNNlib/converter/tf_util.py", line 371, in rknn.base.RKNNlib.converter.tf_util.TFProto_Util.query_tensor
E   File "rknn/base/RKNNlib/converter/tf_util.py", line 372, in rknn.base.RKNNlib.converter.tf_util.TFProto_Util.query_tensor
E   File "/home/xxx/anaconda3/envs/py/lib/python3.6/site-packages/tensorflow_core/python/util/deprecation.py", line 507, in new_func
E     return func(*args, **kwargs)
E   File "/home/xxx/anaconda3/envs/py/lib/python3.6/site-packages/tensorflow_core/python/framework/importer.py", line 405, in import_graph_def
E     producer_op_list=producer_op_list)
E   File "/home/xxx/anaconda3/envs/py/lib/python3.6/site-packages/tensorflow_core/python/framework/importer.py", line 505, in _import_graph_def_internal
E     raise ValueError(str(e))
E ValueError: NodeDef mentions attr 'exponential_avg_factor' not in Op<name=FusedBatchNormV3; signature=x:T, scale:U, offset:U, mean:U, variance:U -> y:T, batch_mean:U, batch_variance:U, reserve_space_1:U, reserve_space_2:U, reserve_space_3:U; attr=T:type,allowed=[DT_HALF, DT_BFLOAT16, DT_FLOAT]; attr=U:type,allowed=[DT_FLOAT]; attr=epsilon:float,default=0.0001; attr=data_format:string,default="NHWC",allowed=["NHWC", "NCHW"]; attr=is_training:bool,default=true>; NodeDef: {{node functional_1/batch_normalization/FusedBatchNormV3}}. (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).
E During handling of the above exception, another exception occurred:
E Traceback (most recent call last):
E   File "rknn/api/rknn_base.py", line 231, in rknn.api.rknn_base.RKNNBase.load_tensorflow
E   File "rknn/base/RKNNlib/RK_nn.py", line 51, in rknn.base.RKNNlib.RK_nn.RKnn.load_tensorflow
E   File "rknn/base/RKNNlib/app/importer/import_tensorflow.py", line 205, in rknn.base.RKNNlib.app.importer.import_tensorflow.Importensorflow.run
E   File "rknn/base/RKNNlib/converter/convert_tf.py", line 1289, in rknn.base.RKNNlib.converter.convert_tf.convert_tf.match_paragraph_and_param
E   File "rknn/api/rknn_log.py", line 323, in rknn.api.rknn_log.RKNNLog.e
E ValueError: Try match layer: Mean(OP: functional_1/avg_pool/Mean) failed, catch exception!The OP of this layer may not yet support, please check document <RKNN_OP_Support.md>!
E Please feedback the detailed log file <log_feedback_to_the_rknn_toolkit_dev_team.log> to the RKNN Toolkit development team.
E You can also check github issues: https://github.com/rockchip-linux/rknn-toolkit/issues
LiuJuan3120181383 commented 2 years ago

我也遇见了很多不支持的,然后我看了一下RKNN_OP_Support.md,貌似支持tensorflow1.14之前版本的OP,我不知道我理解是否正确,附上文件的原地址,您可以看一下https://github.com/rockchip-linux/rknn-toolkit/blob/master/doc/RKNN_OP_Support_V1.7.1.md

sanfordhuang commented 2 years ago

我也遇见了很多不支持的,然后我看了一下RKNN_OP_Support.md,貌似支持tensorflow1.14之前版本的OP,我不知道我理解是否正确,附上文件的原地址,您可以看一下https://github.com/rockchip-linux/rknn-toolkit/blob/master/doc/RKNN_OP_Support_V1.7.1.md

谢谢您的提醒!