如何知道或創建 模型推論後的輸出結構 C語言
您好:
我觀察到一個在96board運行的範例程式,利用VMF_NNM函數庫(C1),取得推論後的結果存放到buf_addr,而透過後面的結構連接(C2),最後在解析yolo_data獲得推論的結果(C3)。
C1
int ret = VMF_NNM_Fifoq_Manager_Result_Dequeue(&buf_addr, &phy_buf_addr, &buf_size, -1);
C2
kp_inference_header_stamp_t *header_stamp = (kp_inference_header_stamp_t *)buf_addr; kdp2_ipc_app_yolo_result_t *app_yolo_result = (kdp2_ipc_app_yolo_result_t *)header_stamp; kp_app_yolo_result_t *yolo_data = &app_yolo_result->yolo_data;
C3
dwResultCounts = yolo_data->box_count; if(dwResultCounts > MAX_RESULT_BOX) { dwResultCounts = MAX_RESULT_BOX; } for (i = 0; i < yolo_data->box_count; i++) { if(g_dwOnlyPerson){ if(yolo_data->boxes[i].class_num == 0){ printf("[%s][%d] Count=%d x1= %.2f y1= %.2f x2= %.2f y2= %.2f score= %.3f class= %d\n", __func__, i, yolo_data->box_count, yolo_data->boxes[i].x1, yolo_data->boxes[i].y1, yolo_data->boxes[i].x2, yolo_data->boxes[i].y2, yolo_data->boxes[i].score, yolo_data->boxes[i].class_num); calculate_bbox_postion(atDrawInfo, i, yolo_data->boxes[i].x1, yolo_data->boxes[i].y1, yolo_data->boxes[i].x2, yolo_data->boxes[i].y2, yolo_data->boxes[i].score, g_fWidthRatio, g_fHeightRatio, yolo_data->boxes[i].class_num, pHostStreamInit); setup_isp_privacy_mask(1, atDrawInfo[i].dwStartX, atDrawInfo[i].dwStartY, atDrawInfo[i].dwWidth, atDrawInfo[i].dwHeight); } } }
typedef struct { uint32_t magic_type; /**< must be 'KDP2_MAGIC_TYPE_XXXXXX' */ uint32_t total_size; /**< total size of user-defined header data struct and data (image) */ uint32_t job_id; /**< user-defined ID to synchronize with firmware side, must >= 1000 */ uint32_t status_code; /**< this field is valid only for result data, refer to KP_API_RETURN_CODE */ uint32_t total_image; /**< total number of images for this inference */ uint32_t image_index; /**< the index of the image in this transmission */ } __attribute__((aligned(4))) kp_inference_header_stamp_t; typedef struct { /* header stamp is necessary for data transfer between host and device */ kp_inference_header_stamp_t header_stamp; uint32_t inf_number; kp_app_yolo_result_t yolo_data; } __attribute__((aligned(4))) kdp2_ipc_app_yolo_result_t; typedef struct { uint32_t class_count; /**< total class count */ uint32_t box_count; /**< boxes of all classes */ kp_bounding_box_t boxes[YOLO_GOOD_BOX_MAX_SCPU]; /**< box information */ } __attribute__((aligned(4))) kp_app_yolo_result_t;
我想請問如何知道或創建,模型的輸出結構?
透過上面程式我只了解到yolo範例所設計的C語言結構,如果我自行訓練與組合多個模型為一個.nef檔案,我要如何像上面範例一樣,知道輸出地址接下來的每個N (4N byte) 代表什麼資訊,進而寫出上面這些結構。
上述範例程式運行於KL630 96board,使用模型為models_630_211.nef。
我對於來討論區提問我是抱持著緊張與希望,擔心我的問題是愚蠢的,也期待困擾我的問題能有所進展,還請不吝指教,謝謝。
The discussion has been closed due to inactivity. To continue with the topic, please feel free to post a new discussion.
Comments
您好,
我們有請相關人員跟您聯絡,他會提供您協助,謝謝。