Browse Source

fix(knowing app/yolov2): AI address error while sensor output and net input height mismatch

pull/119/head
yangtuo250 8 months ago
parent
commit
4640055ab6
  1. 15
      APP_Framework/Framework/knowing/kpu/k210_detect_procedure/k210_detect.c
  2. 5
      APP_Framework/Framework/knowing/kpu/yolov2_json/json_parser.c

15
APP_Framework/Framework/knowing/kpu/k210_detect_procedure/k210_detect.c

@ -97,9 +97,18 @@ void k210_detect(char *json_file_path)
}
}
unsigned char *model_data_align = (unsigned char *)(((unsigned int)model_data + 255) & (~255));
dvp_set_ai_addr((uint32_t)kpurgbbuffer,
(uint32_t)(kpurgbbuffer + detect_params.net_input_size[0] * detect_params.net_input_size[1]),
(uint32_t)(kpurgbbuffer + detect_params.net_input_size[0] * detect_params.net_input_size[1] * 2));
// dvp_set_ai_addr((uint32_t)kpurgbbuffer,
// (uint32_t)(kpurgbbuffer + detect_params.net_input_size[0] * detect_params.net_input_size[1]),
// (uint32_t)(kpurgbbuffer + detect_params.net_input_size[0] * detect_params.net_input_size[1] * 2));
dvp_set_ai_addr(
(uint32_t)(kpurgbbuffer +
detect_params.net_input_size[1] * (detect_params.net_input_size[0] - detect_params.sensor_output_size[0])),
(uint32_t)(kpurgbbuffer +
detect_params.net_input_size[1] * (detect_params.net_input_size[0] - detect_params.sensor_output_size[0]) +
detect_params.net_input_size[0] * detect_params.net_input_size[1]),
(uint32_t)(kpurgbbuffer +
detect_params.net_input_size[1] * (detect_params.net_input_size[0] - detect_params.sensor_output_size[0]) +
detect_params.net_input_size[0] * detect_params.net_input_size[1] * 2));
if (kpu_load_kmodel(&detect_task, model_data_align) != 0) {
printf("\nmodel init error\n");
close(g_fd);

5
APP_Framework/Framework/knowing/kpu/yolov2_json/json_parser.c

@ -91,6 +91,11 @@ yolov2_params_t param_parse(char *json_file_path)
params_return.sensor_output_size[i] = json_array_item->valueint;
printf("%d: %d\n", i, params_return.sensor_output_size[i]);
}
// check sensor output width and net input width
if (params_return.sensor_output_size[1] != params_return.net_input_size[1]) {
printf("Net input width must match sensor output width!\n");
exit(-1);
}
// kmodel_path
json_item = cJSON_GetObjectItem(json_obj, "kmodel_path");
memset(params_return.kmodel_path, 0, 127);

Loading…
Cancel
Save