- from rknn.api import RKNN
- rknn = RKNN()
- rknn.config(channel_mean_value='127.5 127.5 127.5 128', reorder_channel='2 1 0')
- print('--> Loading model')
- rknn.load_onnx(model='./resnet.onnx')
- print('done')
- print('--> Building model')
- rknn.build(do_quantization=False)
- print('done')
- rknn.export_rknn('./resnet.rknn')
- rknn.release()
复制代码
- img = cv2.imread('test.png')
- img = cv2.resize(img, (128,128))
- net = RKNN()
- net.load_rknn('./resnet.rknn')
- print('--> Init runtime environment of arcface')
- ret = net.init_runtime()
- if ret != 0:
- print('Init runtime environment failed')
- exit(ret)
- print('done')
复制代码
output = net.inference(inputs=[img])欢迎光临 Toybrick (https://t.rock-chips.com/) | Powered by Discuz! X3.3 |