OpenEdv-开源电子网

 找回密码
 立即注册
查看: 435|回复: 1

rv1126 tflite模型转为rknn,加载模型报错

[复制链接]

1

主题

2

帖子

0

精华

新手入门

积分
4
金钱
4
注册时间
2024-4-23
在线时间
0 小时
发表于 2024-4-23 19:58:37 | 显示全部楼层 |阅读模式
1金钱
日志:
W rknn-toolkit version: 1.7.5
D Using CPPUTILS: True
I Start importing tflite...
I Model: hand_landmark_lite
I Version: 3
I Description: MLIR Converted.
I Subgraphs: 1
D import clients finished
D Convert layer conv_2d
D Convert layer depthwise_conv_2d
D Convert layer conv_2d
D Convert layer conv_2d
D Convert layer max_pool_2d
D Convert layer depthwise_conv_2d
D Convert layer conv_2d
D Convert layer add
D Convert layer conv_2d
D Convert layer depthwise_conv_2d
D Convert layer conv_2d
D Convert layer add
D Convert layer conv_2d
D Convert layer depthwise_conv_2d
D Convert layer conv_2d
D Convert layer conv_2d
D Convert layer depthwise_conv_2d
D Convert layer conv_2d
D Convert layer add
D Convert layer conv_2d
D Convert layer depthwise_conv_2d
D Convert layer conv_2d
D Convert layer conv_2d
D Convert layer depthwise_conv_2d
D Convert layer conv_2d
D Convert layer add
D Convert layer conv_2d
D Convert layer depthwise_conv_2d
D Convert layer conv_2d
D Convert layer add
D Convert layer conv_2d
D Convert layer depthwise_conv_2d
D Convert layer conv_2d
D Convert layer conv_2d
D Convert layer depthwise_conv_2d
D Convert layer conv_2d
D Convert layer add
D Convert layer conv_2d
D Convert layer depthwise_conv_2d
D Convert layer conv_2d
D Convert layer add
D Convert layer conv_2d
D Convert layer depthwise_conv_2d
D Convert layer conv_2d
D Convert layer conv_2d
D Convert layer depthwise_conv_2d
D Convert layer conv_2d
D Convert layer add
D Convert layer conv_2d
D Convert layer depthwise_conv_2d
D Convert layer conv_2d
D Convert layer add
D Convert layer conv_2d
D Convert layer depthwise_conv_2d
D Convert layer conv_2d
D Convert layer add
D Convert layer conv_2d
D Convert layer depthwise_conv_2d
D Convert layer mean
D Convert layer dequantize
D Convert layer dequantize
D Convert layer fully_connected
W Tensor b'model_1/model/conv_handedness/BiasAdd/ReadVariableOp/resource_dequantize' has no buffer, init to zeros.
D Convert layer logistic
D Convert layer dequantize
D Convert layer dequantize
D Convert layer fully_connected
W Tensor b'model_1/model/conv_handflag/BiasAdd/ReadVariableOp/resource_dequantize' has no buffer, init to zeros.
D Convert layer logistic
D Convert layer dequantize
D Convert layer dequantize
D Convert layer fully_connected
W Tensor b'model_1/model/conv_landmarks/BiasAdd/ReadVariableOp/resource_dequantize' has no buffer, init to zeros.
D Convert layer dequantize
D Convert layer dequantize
D Convert layer fully_connected
W Tensor b'model_1/model/conv_world_landmarks/BiasAdd/ReadVariableOp/resource_dequantize' has no buffer, init to zeros.
E Invalid tensor id(2), tensor(@model_1/model/conv_handedness/BiasAdd/ReadVariableOp/resource_dequantize_93ut0)
E Catch exception when loading tflite model: ./hand_landmark_lite.tflite!
E Traceback (most recent call last):
E   File "rknn/base/RKNNlib/converter/tflite_loader.py", line 575, in rknn.base.RKNNlib.converter.tflite_loader.ModelParser.parse
E   File "rknn/base/RKNNlib/converter/tflite_loader.py", line 546, in rknn.base.RKNNlib.converter.tflite_loader.ModelParser._build_connections
E   File "rknn/base/RKNNlib/layer/RKNNlayer.py", line 144, in rknn.base.RKNNlib.layer.RKNNlayer.RKNNLayer.add_input
E   File "rknn/base/RKNNlib/layer/RKNNlayer.py", line 26, in rknn.base.RKNNlib.layer.RKNNlayer.IoStruct.add
E   File "rknn/api/rknn_log.py", line 323, in rknn.api.rknn_log.RKNNLog.e
E ValueError: Invalid tensor id(2), tensor(@model_1/model/conv_handedness/BiasAdd/ReadVariableOp/resource_dequantize_93ut0)
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

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
代码:
     target = 'rv1126'

    # 创建RKNN对象
    rknn = RKNN()

    # 配置RKNN模型
    print('--> config model')
    rknn.config(quantized_dtype='asymmetric_affine-u8',
                mean_values=[[128, 128, 128 ]],
                std_values=[[ 128, 128, 128 ]],
                reorder_channel='0 1 2',
                target_platform=[target])
    print('done')

    # 加载TFLite模型
    print('--> loading model')
    ret = rknn.load_tflite(model='./hand_landmark_lite.tflite')
    if ret != 0:
        print('load model failed!')
        rknn.release()
        exit(ret)
    print('done')

    # 构建 RKNN 模型
    print('--> building model')
    ret = rknn.build(do_quantization=True, dataset='./hand_landmark_full.tflite')
    if ret != 0:
        print('build model failed!')
        rknn.release()
        exit(ret)
    print('done')

    # 导出 RKNN 模型
    print('--> export RKNN model')
    ret = rknn.export_rknn('./hand_landmark.rknn')
    if ret != 0:
        print('export model failed!')
        rknn.release()
        exit(ret)
    print('done')

    # 释放RKNN对象
    rknn.release()

-----------------------------------------------------------------------------------------
在加载模型时报错,改过tensorflow版本到rk转换工具支持的最高版本也不行,环境编译示例代码都可以。
模型使用的时MediaPipe的hand_landmark_lite.tflite和hand_landmark_full.tflite。都会报错: ValueError: Invalid tensor id(2), tensor(@model_1/model/conv_handedness/BiasAdd/ReadVariableOp/resource_dequantize_93ut0)
请大神解答,感谢!

正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

1

主题

4

帖子

0

精华

新手入门

积分
11
金钱
11
注册时间
2024-6-17
在线时间
1 小时
发表于 2024-6-19 08:41:10 来自手机 | 显示全部楼层
你好请问解决了吗
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2024-11-22 06:13

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表