From 1bd542b20ff7c839000b4d8b302c6a0775510ef9 Mon Sep 17 00:00:00 2001 From: cmhu <2657262686@qq.com> Date: Mon, 10 Mar 2025 10:20:11 +0800 Subject: [PATCH] 补交 --- src/ai_engine_module/VehicleAnalysisDevice.cpp | 164 +++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------- src/ai_engine_module/VehicleAnalysisDevice.h | 4 +--- 2 files changed, 48 insertions(+), 120 deletions(-) diff --git a/src/ai_engine_module/VehicleAnalysisDevice.cpp b/src/ai_engine_module/VehicleAnalysisDevice.cpp index d6e8ecf..26b5a66 100644 --- a/src/ai_engine_module/VehicleAnalysisDevice.cpp +++ b/src/ai_engine_module/VehicleAnalysisDevice.cpp @@ -89,8 +89,6 @@ typedef struct va_handle va_param param; //�Ѳ�������handle���� aclrtContext ctx; - - void *skt_handle = NULL;//��Ȩ }va_handle; @@ -496,47 +494,7 @@ double msecond() { return (tv.tv_sec * 1000.0 + tv.tv_usec / 1000.0); } -//----------����ϵ��----// -//wh20210713����img_data_array��device����,batch_size�̶�Ϊ10 -int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *result) -{ - if (handle == NULL) - { - LOG_ERROR("sy_va_va_batch(error): handle == null."); - return -1; - } - if ((*img_data_array).data_ == NULL || (*img_data_array).w_ == 0 || (*img_data_array).h_ == 0) - { - LOG_ERROR("sy_va_va_batch(error): imgdata == null or w == 0 or h == 0."); - return -1; - } - if (batch_size == 0) - { - LOG_ERROR("sy_va_va_batch(error): batch size == 0."); - return -1; - } - - va_handle *tools=(va_handle *)handle; - - //�������뿪�� - if(tools->param.vehicle_detect_config==SY_CONFIG_CLOSE) - { - LOG_ERROR("sy_va_va_batch(error): vehicle_detect_config error."); - return -1; - } - - - //wh:init��process����һ���̵߳û�����Ҫ�趨Context����Ӧ������ - //ACL_CALL(aclrtSetDevice(0), ACL_ERROR_NONE, SY_FAILED); - ACL_CALL(aclrtSetCurrentContext(tools->ctx), ACL_ERROR_NONE, SY_FAILED); - - - - LOG_DEBUG("prepare data"); - //wh20220301 - //step2----����batch_img��ͼ�����1000��ָ�� img_data_array ��ͼ��С��1000����pad��ָ�� - sy_img batch_img[batch_size]; // - ImageData img_data_dvpp[batch_size];//������ͼ�񿽱���dvpp,���ں���Ŀ�ͼ +int prepare_data(sy_img * img_data_array, int batch_size, sy_img batch_img[], ImageData img_data_dvpp[]) { for(int b=0;bparam.vehicle_detect_config==SY_CONFIG_CLOSE) + { + LOG_ERROR("sy_va_va_batch(error): vehicle_detect_config error."); + return -1; + } + //wh:init��process����һ���̵߳û�����Ҫ�趨Context����Ӧ������ + //ACL_CALL(aclrtSetDevice(0), ACL_ERROR_NONE, SY_FAILED); + ACL_CALL(aclrtSetCurrentContext(tools->ctx), ACL_ERROR_NONE, SY_FAILED); + + + + LOG_DEBUG("prepare data"); + //wh20220301 + //step2----����batch_img��ͼ�����1000��ָ�� img_data_array ��ͼ��С��1000����pad��ָ�� + sy_img batch_img[batch_size]; // + ImageData img_data_dvpp[batch_size];//������ͼ�񿽱���dvpp,���ں���Ŀ�ͼ + + prepare_data(img_data_array, batch_size, batch_img, img_data_dvpp); + //��ʼ��dvpp aclrtStream stream = nullptr; ACL_CALL(aclrtCreateStream(&stream), ACL_ERROR_NONE, SY_FAILED); DvppProcess* dvpp = new DvppProcess(); dvpp->InitResource(stream); - - - - //��ʼ�������� - sy_rect rect_init; - rect_init.left_= 0; - rect_init.top_ =0; - rect_init.width_ = 0; - rect_init.height_=0; - for (int b = 0; b < batch_size; b++) - { - result[b].count=0; - for(int c=0;c= 4 && index<= 8 ) )//�˳���4-8 if((index>= 4 && index<= 8 ) && (vpt_result_[b].obj_results_[c].obj_rect.width_ >= tools->param.min_obj_size && vpt_result_[b].obj_results_[c].obj_rect.height_ >= tools->param.min_obj_size))//�˳���4-8 @@ -730,12 +692,10 @@ int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result * result[b].info[idx].type=4;//���� result[b].info[idx].vehicle_body_detect_res.rect = vpt_result_[b].obj_results_[c].obj_rect; result[b].info[idx].vehicle_body_detect_res.score = score; - - + manned_label =1; //idx++; - body_idx++; - + body_idx++; } //���˷��� @@ -2411,36 +2371,6 @@ void va_release(void ** handle) } } - -//1.��绰 -//�ж������� -//-��Ӧ�����ˣ� -//-��Ӧ�೵Υ��ʶ��Ϊ��绰�������Լ�⵽�ֻ���λ�ÿ��ϡ����������Ŷ�>0.85 or -//��Ӧ�೵���Լ�⵽�ֻ���λ�ÿ��ϡ����������Ŷ�>0.9�� - -//2.���ֻ� -//�ж������� -//-��Ӧ�����ˣ� -//-��Ӧ�೵Υ��ʶ��Ϊ���ֻ�(0308ģ�ͽ�����绰�ж�)�������Լ�⵽�ֻ���λ�ÿ��¡����������Ŷ�>0.75(�ɵ���Ϊ0���ʹ�����긨��) or -// ��Ӧ�೵���Լ�⵽�ֻ���λ�ÿ��¡����������Ŷ�>0.9�� - -//3.δϵ��ȫ�� -//�ж������� -//-��Ӧ�����ˣ� -//-��Ӧ�೵Υ���ж�Ϊδϵ��ȫ����������δ��⵽��ȫ��(������⵽��ȫ��ȡ��)�� -// ��⵽��ȫ�����ж��������Լ�⵽�а�ȫ��(���Ŷ�>0.2����)����ͨ�������ж����ڶ�Ӧ��(����/����)�� - -//4.���� -//�ж������� -//-��Ӧ�����ˣ� -//-��Ӧ�೵Υ��ʶ��ΪΥ���ҳ����Լ�⵽���� or -// ��Ӧ�೵���Լ�⵽���̡����������Ŷ�>0.8�� - -//5.���� -//-����/���ݵ��ж���driver/copilot����ʶ���ˡ������Զ�Ӧ���ĵ�����λ�ڳ�����/��ࣻ -//-��Ӧ�����˵��ж�����Ӧ�೵Υ��ʶ���ˡ������Լ�⵽���Ҽ�����Ŷ�>0.8�� -//-��Ӧ���⵽�ֻ�/����/��ȫ�����ж�����⵽�ֻ�/����/��ȫ�����ڣ���ͨ�������ж����ڶ�Ӧ��(����/����)�� - int process_vidresult_atlas(void * handle, int batch_size, va_result *result) { for (int b = 0; b < batch_size; b++) diff --git a/src/ai_engine_module/VehicleAnalysisDevice.h b/src/ai_engine_module/VehicleAnalysisDevice.h index 78fd338..f15e38f 100644 --- a/src/ai_engine_module/VehicleAnalysisDevice.h +++ b/src/ai_engine_module/VehicleAnalysisDevice.h @@ -45,9 +45,7 @@ const char * va_get_version(); * return: success(0) or error code(<0) * notes: null *************************************************************************/ -int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *result); -//img_data_array是device数据,batch_size==16时调用固定16模型,小于16时调用固定1模型。 -int va_batch16_device(void * handle, sy_img * img_data_array, int batch_size, va_result *result); +int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *result); -- libgit2 0.21.4