Greetings! I’ve been wanting to start running models on my Rock5B’s NPU for a while now and haven’t been successful in getting that to happen. I know https://github.com/rockchip-linux/rknn-toolkit2 is needed to convert models to the .rknn
format which can be run on the Rock5B’s NPU. I also know https://github.com/rockchip-linux/rknpu2 is needed to be installed on the Rock5B to run the models on the Rock5B. But I don’t really know how to use/install them because a lot of the documentation is written in Chinese which I don’t know how to read. Am I the only one not sure how to start? Would anyone like to help?
Utilising the Rock5B's NPU
2 Likes
It seems there are comprehensive examples available in the rknpu2 repo https://github.com/rockchip-linux/rknpu2/tree/master/examples/rknn_common_test. They are written in the universal language of C, so they should be accessible for non chinese readers (;
To me it looks like you need to wrap your .rknn model in some rknn api functions:
rknn_context ctx = 0;
int ret = rknn_init(&ctx, model_path, 0, 0, NULL);
ret = rknn_query(ctx, RKNN_QUERY_IN_OUT_NUM, &io_num, sizeof(io_num));
[...]
output_mems[i] = rknn_create_mem(ctx, output_size);
ret = rknn_set_io_mem(ctx, input_mems[0], &input_attrs[0]);
ret = rknn_run(ctx, NULL);
[... etc.la. ...]
best
any rtsp streaming tuts?