KL630 inference error

I use KL630 board to infererence following custom nef file. (3DCNN model)

(path: /vmf_nnm/solution/app_flow/

But, when I run code I failed to inference with input following function (VMF_NNM_Inference_App_Execute)


int result = VMF_NNM_Inference_App_Execute(&inf_config);


with code 110 (int result).


How can I solve it?

----------------------------------------------------------

code

---------------------------------------------------------


static int inference_video_classification(my_kl630_sin_example_header_t *_input_header,

                     struct Video_classification_result_s *_3DCNN_result /* output */,

                     kp_app_pd_class_t *pd_class /* output */)

{


  //printf("Check_ERROR 1 \n");

  // Config image preprocessing and model settings

  VMF_NNM_INFERENCE_APP_CONFIG_T inf_config;

  memset(&inf_config, 0, sizeof(VMF_NNM_INFERENCE_APP_CONFIG_T)); // For safety let default 'bool' to 'false'


  // Image buffer address should be just after the header

  inf_config.num_image = 15; // For 15fps

  inf_config.image_list[0].image_buf = (void *)((uint32_t)_input_header + sizeof(my_kl630_sin_example_header_t));

  inf_config.image_list[0].image_width = _input_header->width;

  inf_config.image_list[0].image_height = _input_header->height;

  inf_config.image_list[0].image_channel = 3;

  //inf_config.image_list[0].image_format = KP_IMAGE_FORMAT_RGB565;   // Assume RGB565

  inf_config.image_list[0].image_format = KP_IMAGE_FORMAT_YUV420;   // Assume yuv420

  inf_config.image_list[0].image_norm = KP_NORMALIZE_KNERON;     // This depends on model

  inf_config.image_list[0].image_resize = KP_RESIZE_ENABLE;      // Default: enable resize

  inf_config.image_list[0].image_padding = KP_PADDING_DISABLE;    // Default: disable padding


  inf_config.model_id = MODELS_630_3DCNN; // This depends on model


  printf("Inference Configuration: Image Width: %d, Height: %d\n", _input_header->width, _input_header->height);


  // Set up fd result output buffer for ncpu/npu

  inf_config.ncpu_result_buf = (void *)_classifier_result;



  // Debugging: Model ID and Output Buffer

  printf("Model ID: %d, Output Buffer: %p\n", inf_config.model_id, inf_config.ncpu_result_buf);


   inf_config.post_proc_func = classifier_post_process;


   

  // Debugging: Output buffer address 확인

  printf("Output Buffer Address: %p\n", (void *)inf_config.ncpu_result_buf);

  printf("Check_ERROR 2 \n");

  if (inf_config.ncpu_result_buf == NULL) {

  printf("Error: Output buffer is NULL after allocation!\n");

  printf("Check_ERROR 2.1 \n"); 

  }

   

  // Debugging: About to execute inference with the current model ID

  printf("About to execute inference with model ID: %d\n", inf_config.model_id);

   

  // Execute the inference

  int result = VMF_NNM_Inference_App_Execute(&inf_config); //ERROR with result=110

   printf("Check_ERROR 2.2 \n");

  

   


  // Debugging print to check after inference execution

  printf("After inference execution: Result: %d\n", result);

  if (result != KP_SUCCESS) {

  printf("Inference failed with result code: %d\n", result);

  }


  // Check if inference was successful and set the classification result

  if (result == KP_SUCCESS && _3DCNN_result != NULL && _3DCNN_result->class_score != NULL) {

    // Check the score array's first element and map it to kp_app_pd_class_t

//int class_PROC = _3DCNN_result->Video_classification_result.class_ID[0]; // 첫 번째 class 만 사용한다고 가정

/*

int class_PROC = 0;

    float class_Prob = _3DCNN_result->score[0]; // 첫 번째 스코어 값만 사용한다고 가정

    */

    //YJ 240912 추가 - 향후 테스트 필요

    int max_Prob_idx = find_max_score_index(_3DCNN_result); // max_Prob_idx를 찾아줌

int class_PROC = _3DCNN_result->class_ID[max_Prob_idx]; // 해당 idx 사용한다고 가정

//int class_PROC = 0;

    float class_Prob = _3DCNN_result->class_score[max_Prob_idx]; // 해당 idx 사용한다고 가정

    

    // Debugging print to check the result and first score value

    printf("Class Result: %d, Prob Score: %f\n", class_PROC , class_Prob );



    *pd_class = class_PROC;

  } 

  else {

    printf("Inference execution failed or result is invalid.\n");

    result = KP_FW_DDR_MALLOC_FAILED_102; // 적절한 에러 코드 반환

  }


  // 디버깅: 추론 결과를 반환하기 전에 결과 값 확인

  // result: 추론 상태에 대한 상태

  // pd_class: 몇번째 class 인지


   

  printf("Final Result: %d, Mapped Class: %d\n", result, *pd_class);

   

  return result;

}

Comments

The discussion has been closed due to inactivity. To continue with the topic, please feel free to post a new discussion.