- void create(int inputSize, int channel, int numResult, int numClasses, char *mParamPath) {
- img_width = inputSize;
- img_height = inputSize;
- img_channels = channel;
- int ret = 0;
- int model_len = 0;
- unsigned char *model = nullptr;
- // Load RKNN Model
- LOGE("Loading model: %s", mParamPath);
- model = load_model(mParamPath, &model_len);
- LOGE("rknn_init ...");
- ret = rknn_init(&ctx, model, model_len, 0, NULL);
- if (ret < 0) {
- LOGE("rknn_init fail! ret=%d\n", ret);
- return;
- }
- // Get Model Input Output Info
- ret = rknn_query(ctx, RKNN_QUERY_IN_OUT_NUM, &io_num, sizeof(io_num));
- if (ret != RKNN_SUCC) {
- LOGE("rknn_query fail! ret=%d\n", ret);
- return;
- }
- LOGE("model input num: %d, output num: %d\n", io_num.n_input, io_num.n_output);
- LOGE("input tensors:\n");
- rknn_tensor_attr input_attrs[io_num.n_input];
- memset(input_attrs, 0, sizeof(input_attrs));
- for (int i = 0; i < io_num.n_input; i++) {
- input_attrs[i].index = i;
- ret = rknn_query(ctx, RKNN_QUERY_INPUT_ATTR, &(input_attrs[i]),
- sizeof(rknn_tensor_attr));
- if (ret != RKNN_SUCC) {
- LOGE("rknn_query fail! ret=%d\n", ret);
- return;
- }
- printRKNNTensor(&(input_attrs[i]));
- }
- LOGE("output tensors:\n");
- rknn_tensor_attr output_attrs[io_num.n_output];
- memset(output_attrs, 0, sizeof(output_attrs));
- for (int i = 0; i < io_num.n_output; i++) {
- output_attrs[i].index = i;
- ret = rknn_query(ctx, RKNN_QUERY_OUTPUT_ATTR, &(output_attrs[i]),
- sizeof(rknn_tensor_attr));
- if (ret != RKNN_SUCC) {
- LOGE("rknn_query fail! ret=%d\n", ret);
- return;
- }
- printRKNNTensor(&(output_attrs[i]));
- }
- created = true;
- }
复制代码
- 2021-09-16 22:44:12.122 2506-2560/com.rockchip.gpadc.ssddemo E/rkssd4j: Loading model: /data/user/0/com.rockchip.gpadc.ssddemo/cache/ssd_inception_v2.rknn
- 2021-09-16 22:44:12.183 2506-2560/com.rockchip.gpadc.ssddemo E/rkssd4j: rknn_init ...
- 2021-09-16 22:44:12.188 2506-2560/com.rockchip.gpadc.ssddemo E/RKNN_API: nnapi error: unable to open function ARKNN_destory_mem
- 2021-09-16 22:44:12.189 2506-2560/com.rockchip.gpadc.ssddemo E/RKNN_API: nnapi error: unable to open function ARKNN_create_mem
- 2021-09-16 22:44:12.189 2506-2560/com.rockchip.gpadc.ssddemo E/RKNN_API: nnapi error: unable to open function ARKNN_set_io_mem
- 2021-09-16 22:44:12.190 2506-2560/com.rockchip.gpadc.ssddemo E/neuralnetworks@ndk_bridge: ARKNN_client_create 0
- 2021-09-16 22:44:12.254 2506-2560/com.rockchip.gpadc.ssddemo E/neuralnetworks@ndk_bridge: Client init failed!
- 2021-09-16 22:44:12.254 2506-2560/com.rockchip.gpadc.ssddemo E/neuralnetworks@ndk_bridge: Ret Successfully!
- 2021-09-16 22:44:12.257 2506-2560/com.rockchip.gpadc.ssddemo E/rkssd4j: rknn_query fail! ret=-7
- 2021-09-16 22:44:12.257 2506-2560/com.rockchip.gpadc.ssddemo E/rkssd4j: run_ssd: create hasn't successful!
- 2021-09-16 22:44:12.259 2506-2560/com.rockchip.gpadc.ssddemo I/chatty: uid=10131(com.rockchip.gpadc.ssddemo) Thread-3 identical 1 line
- 2021-09-16 22:44:12.280 2506-2560/com.rockchip.gpadc.ssddemo E/rkssd4j: run_ssd: create hasn't successful!
复制代码
时间没有校准,请忽略时间。- E/rkssd4j: rknn_init ctx: 479969337520, model len: 32003278
复制代码
欢迎光临 Toybrick (https://t.rock-chips.com/) | Powered by Discuz! X3.3 |