Toybrick

标题: onnx转rknn模型报错 [打印本页]

作者: weidao    时间: 2019-5-20 19:42
标题: onnx转rknn模型报错
如题,用的onnx的ssd模型 :https://github.com/onnx/models/tree/master/ssd,用的1.0的api,报错如下,
[attach]288[/attach]
ssd模型参数如图:
[attach]289[/attach]
代码如下:
import numpy as np
import cv2
from rknn.api import RKNN

if __name__ == '__main__':
    # Create RKNN object
    rknn = RKNN(verbose=True)

    # pre-process config
    print('--> config model')
    rknn.config(channel_mean_value='103.94 116.78 123.68 58.82', reorder_channel='2 1 0')
    print('done')

    # Load onnx model
    print('--> Loading model')
    ret = rknn.load_onnx(model='./ssd.onnx')
    if ret != 0:
        print('Load mobilenet_v2 failed! Ret = {}'.format(ret))
        exit(ret)
    print('done')

    # Build model
    print('--> Building model')
    ret = rknn.build(do_quantization=True, dataset='./dataset.txt')
    if ret != 0:
        print('Build ssd failed!')
        exit(ret)
    print('done')

    # Export rknn model
    print('--> Export RKNN model')
    ret = rknn.export_rknn('./ssd.rknn')
    if ret != 0:
        print('Export ssd.rknn failed!')
        exit(ret)
    print('done')

    rknn.release()


另外,之前我还发了转换出错的帖子,大佬们帮忙一起解决下,帖子地址:
http://t.rock-chips.com/forum.php?mod=viewthread&tid=420&highlight=onnx






欢迎光临 Toybrick (https://t.rock-chips.com/) Powered by Discuz! X3.3