Commit 1bd542b20ff7c839000b4d8b302c6a0775510ef9
1 parent
52516fb9
补交
Showing
2 changed files
with
48 additions
and
120 deletions
src/ai_engine_module/VehicleAnalysisDevice.cpp
... | ... | @@ -89,8 +89,6 @@ typedef struct va_handle |
89 | 89 | va_param param; //�Ѳ�������handle���� |
90 | 90 | |
91 | 91 | aclrtContext ctx; |
92 | - | |
93 | - void *skt_handle = NULL;//��Ȩ | |
94 | 92 | }va_handle; |
95 | 93 | |
96 | 94 | |
... | ... | @@ -496,47 +494,7 @@ double msecond() { |
496 | 494 | return (tv.tv_sec * 1000.0 + tv.tv_usec / 1000.0); |
497 | 495 | } |
498 | 496 | |
499 | -//----------����ϵ��----// | |
500 | -//wh20210713����img_data_array��device����,batch_size�̶�Ϊ10 | |
501 | -int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *result) | |
502 | -{ | |
503 | - if (handle == NULL) | |
504 | - { | |
505 | - LOG_ERROR("sy_va_va_batch(error): handle == null."); | |
506 | - return -1; | |
507 | - } | |
508 | - if ((*img_data_array).data_ == NULL || (*img_data_array).w_ == 0 || (*img_data_array).h_ == 0) | |
509 | - { | |
510 | - LOG_ERROR("sy_va_va_batch(error): imgdata == null or w == 0 or h == 0."); | |
511 | - return -1; | |
512 | - } | |
513 | - if (batch_size == 0) | |
514 | - { | |
515 | - LOG_ERROR("sy_va_va_batch(error): batch size == 0."); | |
516 | - return -1; | |
517 | - } | |
518 | - | |
519 | - va_handle *tools=(va_handle *)handle; | |
520 | - | |
521 | - //�������뿪�� | |
522 | - if(tools->param.vehicle_detect_config==SY_CONFIG_CLOSE) | |
523 | - { | |
524 | - LOG_ERROR("sy_va_va_batch(error): vehicle_detect_config error."); | |
525 | - return -1; | |
526 | - } | |
527 | - | |
528 | - | |
529 | - //wh:init��process����һ���̵߳û�����Ҫ�趨Context����Ӧ������ | |
530 | - //ACL_CALL(aclrtSetDevice(0), ACL_ERROR_NONE, SY_FAILED); | |
531 | - ACL_CALL(aclrtSetCurrentContext(tools->ctx), ACL_ERROR_NONE, SY_FAILED); | |
532 | - | |
533 | - | |
534 | - | |
535 | - LOG_DEBUG("prepare data"); | |
536 | - //wh20220301 | |
537 | - //step2----����batch_img��ͼ�����1000��ָ�� img_data_array ��ͼ��С��1000����pad��ָ�� | |
538 | - sy_img batch_img[batch_size]; // | |
539 | - ImageData img_data_dvpp[batch_size];//������ͼ����dvpp,���ں���Ŀ�ͼ | |
497 | +int prepare_data(sy_img * img_data_array, int batch_size, sy_img batch_img[], ImageData img_data_dvpp[]) { | |
540 | 498 | for(int b=0;b<batch_size;b++) |
541 | 499 | { |
542 | 500 | int w= img_data_array[b].w_; |
... | ... | @@ -606,53 +564,59 @@ int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result * |
606 | 564 | } |
607 | 565 | } |
608 | 566 | } |
609 | - //end step2----���� batch_img | |
610 | 567 | |
568 | + return 0; | |
569 | +} | |
570 | + | |
571 | +//----------����ϵ��----// | |
572 | +//wh20210713����img_data_array��device����,batch_size�̶�Ϊ10 | |
573 | +int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *result) | |
574 | +{ | |
575 | + if (handle == NULL) | |
576 | + { | |
577 | + LOG_ERROR("sy_va_va_batch(error): handle == null."); | |
578 | + return -1; | |
579 | + } | |
580 | + if ((*img_data_array).data_ == NULL || (*img_data_array).w_ == 0 || (*img_data_array).h_ == 0) | |
581 | + { | |
582 | + LOG_ERROR("sy_va_va_batch(error): imgdata == null or w == 0 or h == 0."); | |
583 | + return -1; | |
584 | + } | |
585 | + if (batch_size == 0) | |
586 | + { | |
587 | + LOG_ERROR("sy_va_va_batch(error): batch size == 0."); | |
588 | + return -1; | |
589 | + } | |
590 | + | |
591 | + va_handle *tools=(va_handle *)handle; | |
611 | 592 | |
593 | + //�������뿪�� | |
594 | + if(tools->param.vehicle_detect_config==SY_CONFIG_CLOSE) | |
595 | + { | |
596 | + LOG_ERROR("sy_va_va_batch(error): vehicle_detect_config error."); | |
597 | + return -1; | |
598 | + } | |
612 | 599 | |
613 | 600 | |
601 | + //wh:init��process����һ���̵߳û�����Ҫ�趨Context����Ӧ������ | |
602 | + //ACL_CALL(aclrtSetDevice(0), ACL_ERROR_NONE, SY_FAILED); | |
603 | + ACL_CALL(aclrtSetCurrentContext(tools->ctx), ACL_ERROR_NONE, SY_FAILED); | |
604 | + | |
605 | + | |
606 | + | |
607 | + LOG_DEBUG("prepare data"); | |
608 | + //wh20220301 | |
609 | + //step2----����batch_img��ͼ�����1000��ָ�� img_data_array ��ͼ��С��1000����pad��ָ�� | |
610 | + sy_img batch_img[batch_size]; // | |
611 | + ImageData img_data_dvpp[batch_size];//������ͼ����dvpp,���ں���Ŀ�ͼ | |
612 | + | |
613 | + prepare_data(img_data_array, batch_size, batch_img, img_data_dvpp); | |
614 | + | |
614 | 615 | //��ʼ��dvpp |
615 | 616 | aclrtStream stream = nullptr; |
616 | 617 | ACL_CALL(aclrtCreateStream(&stream), ACL_ERROR_NONE, SY_FAILED); |
617 | 618 | DvppProcess* dvpp = new DvppProcess(); |
618 | 619 | dvpp->InitResource(stream); |
619 | - | |
620 | - | |
621 | - | |
622 | - //��ʼ�������� | |
623 | - sy_rect rect_init; | |
624 | - rect_init.left_= 0; | |
625 | - rect_init.top_ =0; | |
626 | - rect_init.width_ = 0; | |
627 | - rect_init.height_=0; | |
628 | - for (int b = 0; b < batch_size; b++) | |
629 | - { | |
630 | - result[b].count=0; | |
631 | - for(int c=0;c<VD_MAXDETECTCOUNT;c++) | |
632 | - { | |
633 | - //4.vr���� | |
634 | - memset(result[b].info[c].vehicle_recg_res.vehicle_brand, '\0', sizeof(result[b].info[c].vehicle_recg_res.vehicle_brand)); | |
635 | - memset(result[b].info[c].vehicle_recg_res.vehicle_subbrand, '\0', sizeof(result[b].info[c].vehicle_recg_res.vehicle_subbrand)); | |
636 | - memset(result[b].info[c].vehicle_recg_res.vehicle_issue_year, '\0', sizeof(result[b].info[c].vehicle_recg_res.vehicle_issue_year)); | |
637 | - memset(result[b].info[c].vehicle_recg_res.vehicle_type, '\0', sizeof(result[b].info[c].vehicle_recg_res.vehicle_type)); | |
638 | - memset(result[b].info[c].vehicle_recg_res.freight_ton, '\0', sizeof(result[b].info[c].vehicle_recg_res.freight_ton)); | |
639 | - | |
640 | - for(int p=0;p<PLATENUM;p++) | |
641 | - { | |
642 | - result[b].info[c].vehicle_plate_det_recg_res.recg[p].index = -1; | |
643 | - result[b].info[c].vehicle_plate_det_recg_res.recg[p].maxprob = 0; | |
644 | - memset(result[b].info[c].vehicle_plate_det_recg_res.recg[p].character, '\0', sizeof(result[b].info[c].vehicle_plate_det_recg_res.recg[p].character)); | |
645 | - } | |
646 | - for(int p=0;p<PLATENUM;p++)//20201201wh��������vp��Ϣ | |
647 | - { | |
648 | - result[b].info[c].vehicle_fea_res.feature[FEATURESIZE*2+p] = 0; | |
649 | - } | |
650 | - | |
651 | - //8.vf������ | |
652 | - memset(result[b].info[c].vehicle_fea_res.feature,0,sizeof(float)*VA_FEATURESIZE); | |
653 | - | |
654 | - } | |
655 | - }//end result��ֵ | |
656 | 620 | |
657 | 621 | |
658 | 622 | //��ͷ��β�����ı�ǩ |
... | ... | @@ -721,8 +685,6 @@ int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result * |
721 | 685 | |
722 | 686 | if(index== 2 )motor_num++; |
723 | 687 | if(index== 3 )tricycle_num++; |
724 | - | |
725 | - | |
726 | 688 | } |
727 | 689 | //if((index>= 4 && index<= 8 ) )//�˳���4-8 |
728 | 690 | 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 * |
730 | 692 | result[b].info[idx].type=4;//���� |
731 | 693 | result[b].info[idx].vehicle_body_detect_res.rect = vpt_result_[b].obj_results_[c].obj_rect; |
732 | 694 | result[b].info[idx].vehicle_body_detect_res.score = score; |
733 | - | |
734 | - | |
695 | + | |
735 | 696 | manned_label =1; |
736 | 697 | //idx++; |
737 | - body_idx++; | |
738 | - | |
698 | + body_idx++; | |
739 | 699 | } |
740 | 700 | |
741 | 701 | //���˷��� |
... | ... | @@ -2411,36 +2371,6 @@ void va_release(void ** handle) |
2411 | 2371 | } |
2412 | 2372 | } |
2413 | 2373 | |
2414 | - | |
2415 | -//1.��绰 | |
2416 | -//������� | |
2417 | -//-��Ӧ�����ˣ� | |
2418 | -//-��Ӧ�Υ��ʶ��Ϊ��绰�������Լ��ֻ���λ�ÿ��ϡ����������Ŷ�>0.85 or | |
2419 | -//��Ӧ����Լ��ֻ���λ�ÿ��ϡ����������Ŷ�>0.9�� | |
2420 | - | |
2421 | -//2.���ֻ� | |
2422 | -//������� | |
2423 | -//-��Ӧ�����ˣ� | |
2424 | -//-��Ӧ�Υ��ʶ��Ϊ���ֻ�(0308ģ�ͽ�����绰�ж�)�������Լ��ֻ���λ�ÿ��¡����������Ŷ�>0.75(�ɵ���Ϊ0���ʹ�����긨��) or | |
2425 | -// ��Ӧ����Լ��ֻ���λ�ÿ��¡����������Ŷ�>0.9�� | |
2426 | - | |
2427 | -//3.δϵ��ȫ�� | |
2428 | -//������� | |
2429 | -//-��Ӧ�����ˣ� | |
2430 | -//-��Ӧ�Υ���ж�Ϊδϵ��ȫ����������δ����ȫ��(��������ȫ��ȡ��)�� | |
2431 | -// ����ȫ�����ж��������Լ��а�ȫ��(���Ŷ�>0.2����)����ͨ�������ж����ڶ�Ӧ��(����/����)�� | |
2432 | - | |
2433 | -//4.���� | |
2434 | -//������� | |
2435 | -//-��Ӧ�����ˣ� | |
2436 | -//-��Ӧ�Υ��ʶ��ΪΥ���ҳ����Լ����� or | |
2437 | -// ��Ӧ����Լ����̡����������Ŷ�>0.8�� | |
2438 | - | |
2439 | -//5.���� | |
2440 | -//-����/���ݵ��ж���driver/copilot����ʶ���ˡ������Զ�Ӧ���ĵ�����λ�ڳ�����/��ࣻ | |
2441 | -//-��Ӧ�����˵��ж�����Ӧ�Υ��ʶ���ˡ������Լ����Ҽ�����Ŷ�>0.8�� | |
2442 | -//-��Ӧ����ֻ�/����/��ȫ�����ж������ֻ�/����/��ȫ�����ڣ���ͨ�������ж����ڶ�Ӧ��(����/����)�� | |
2443 | - | |
2444 | 2374 | int process_vidresult_atlas(void * handle, int batch_size, va_result *result) |
2445 | 2375 | { |
2446 | 2376 | for (int b = 0; b < batch_size; b++) | ... | ... |
src/ai_engine_module/VehicleAnalysisDevice.h
... | ... | @@ -45,9 +45,7 @@ const char * va_get_version(); |
45 | 45 | * return: success(0) or error code(<0) |
46 | 46 | * notes: null |
47 | 47 | *************************************************************************/ |
48 | -int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *result); | |
49 | -//img_data_array是device数据,batch_size==16时调用固定16模型,小于16时调用固定1模型。 | |
50 | -int va_batch16_device(void * handle, sy_img * img_data_array, int batch_size, va_result *result); | |
48 | +int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *result); | |
51 | 49 | |
52 | 50 | |
53 | 51 | ... | ... |