Commit 1067e0668f9189cde8a072d19597286eb59cf956

Authored by Hu Chunming
1 parent 7e57d38f

修复定时抓拍

src/ai_platform/MultiSourceProcess.cpp
... ... @@ -364,7 +364,18 @@ bool CMultiSourceProcess::task_has_vpt_algor(const std::string &task_id){
364 364 if (algor_map == nullptr)
365 365 return false;
366 366  
367   - return (algor_map->find(algorithm_type_t::HUMAN_GATHER) != algor_map->end() ||
  367 + return (algor_map->find(algorithm_type_t::HUMAN_GATHER) != algor_map->end() ||
  368 + algor_map->find(algorithm_type_t::VEHICLE_GATHER) != algor_map->end() ||
  369 + algor_map->find(algorithm_type_t::HUMAN_CROSSING_LINE) != algor_map->end() ||
  370 + algor_map->find(algorithm_type_t::HUMAN_DENSITY) != algor_map->end() ||
  371 + algor_map->find(algorithm_type_t::HUMAN_CLIMB) != algor_map->end() ||
  372 + algor_map->find(algorithm_type_t::VEHICLE_ILLEGAL_CROSSING_LINE) != algor_map->end() ||
  373 + algor_map->find(algorithm_type_t::HUMAN_LINGER) != algor_map->end() ||
  374 + algor_map->find(algorithm_type_t::VEHICLE_ILLEGAL_PARKING) != algor_map->end() ||
  375 + algor_map->find(algorithm_type_t::HUMAN_REGION_GATHER) != algor_map->end() ||
  376 + algor_map->find(algorithm_type_t::HUMAN_LEAVE_REGION) != algor_map->end() ||
  377 + algor_map->find(algorithm_type_t::HUMAN_REGION_DISMISS) != algor_map->end() ||
  378 + algor_map->find(algorithm_type_t::HUMAN_REGION_FAST_MOVING) != algor_map->end() ||
368 379 algor_map->find(algorithm_type_t::HUMAN_SNAPSHOT) != algor_map->end() ||
369 380 algor_map->find(algorithm_type_t::NONMOTOR_VEHICLE_SNAPSHOT) != algor_map->end() ||
370 381 algor_map->find(algorithm_type_t::SMOKING_DET) != algor_map->end() ||
... ... @@ -378,7 +389,11 @@ bool CMultiSourceProcess::task_has_vpt_algor(const std::string &task_id){
378 389 algor_map->find(algorithm_type_t::PEDESTRIAN_RETROGRADE) != algor_map->end() ||
379 390 algor_map->find(algorithm_type_t::VEHICLE_RETROGRADE) != algor_map->end() ||
380 391 algor_map->find(algorithm_type_t::PEDESTRIAN_TRESPASS) != algor_map->end() ||
381   - algor_map->find(algorithm_type_t::VEHICLE_TRESPASS) != algor_map->end());
  392 + algor_map->find(algorithm_type_t::VEHICLE_TRESPASS) != algor_map->end() ||
  393 + algor_map->find(algorithm_type_t::VEHICLE_TIMING_SNAPSHOT) != algor_map->end() ||
  394 + algor_map->find(algorithm_type_t::HUMAN_TIMING_SNAPSHOT) != algor_map->end() ||
  395 + algor_map->find(algorithm_type_t::NONMOTOR_VEHICLE_TIMING_SNAPSHOT) != algor_map->end()
  396 + );
382 397 }
383 398  
384 399 void CMultiSourceProcess::decoded_cbk(DeviceMemory* devFrame){
... ... @@ -625,18 +640,18 @@ int CMultiSourceProcess::algorthim_vpt(vector<DeviceMemory*> vec_gpuMem){
625 640  
626 641 m_snapshot_reprocessing->screen_effective_snapshot(vptResult);
627 642  
628   -#ifndef VEHICLE_MULTI_BOXES
  643 +// #ifndef VEHICLE_MULTI_BOXES
629 644 /* 快照优选(内部可实现不同的快照优选策略) */
630 645 m_snapshot_reprocessing->update_bestsnapshot(vec_vptMem, vptResult, deleteObjectID);
631 646 /* for snapshot algorithm. 轨迹结束目标 做最后的结果返回(当前返回算法结果+快照保存路径)*/
632 647 vehicle_snapshot(vpt_interest_task_id, deleteObjectID);
633   -#else
  648 +// #else
634 649 algorithm_timing_snapshot(vec_vptMem, vptResult, algorithm_type_t::HUMAN_TIMING_SNAPSHOT);
635   - algorithm_timing_snapshot(vec_vptMem, vptResult, algorithm_type_t::VEHICLE_TIMING_SNAPSHOT);
636   - algorithm_timing_snapshot(vec_vptMem, vptResult, algorithm_type_t::NONMOTOR_VEHICLE_TIMING_SNAPSHOT);
  650 + // algorithm_timing_snapshot(vec_vptMem, vptResult, algorithm_type_t::VEHICLE_TIMING_SNAPSHOT);
  651 + // algorithm_timing_snapshot(vec_vptMem, vptResult, algorithm_type_t::NONMOTOR_VEHICLE_TIMING_SNAPSHOT);
637 652  
638 653 send_locus_finished_msg(vpt_interest_task_id, deleteObjectID);
639   -#endif
  654 +// #endif
640 655  
641 656 // #ifdef WITH_SECOND_PROCESS
642 657 /* for pedestrian safety det. 行人安全分析算法模块 */
... ...
src/ai_platform/task_param_manager.cpp
... ... @@ -35,6 +35,16 @@ bool copy_algor_param_aux(const algorithm_type_t &algor_type, const std::string
35 35 case algorithm_type_t::VEHICLE_SNAPSHOT:
36 36 m_algor_config_params[task_id].vehicle_algors.insert(algor_type);
37 37 goto _snapshot_param_copy;
  38 + case algorithm_type_t::VEHICLE_TIMING_SNAPSHOT: // 车辆轨迹定时抓拍
  39 + m_algor_config_params[task_id].vehicle_algors.insert(algor_type);
  40 + goto _snapshot_param_copy;
  41 + case algorithm_type_t::HUMAN_TIMING_SNAPSHOT: // 行人轨迹定时抓拍
  42 + m_algor_config_params[task_id].human_algors.insert(algor_type);
  43 + goto _snapshot_param_copy;
  44 + case algorithm_type_t::NONMOTOR_VEHICLE_TIMING_SNAPSHOT: // 非机动车轨迹定时抓拍
  45 + m_algor_config_params[task_id].nonmotor_vehicle_algors.insert(algor_type);
  46 + goto _snapshot_param_copy;
  47 +
38 48 case algorithm_type_t::NONMOTOR_VEHICLE_SNAPSHOT: {
39 49 m_algor_config_params[task_id].nonmotor_vehicle_algors.insert(algor_type);
40 50 _snapshot_param_copy : {
... ...
src/demo/demo.cpp
... ... @@ -879,6 +879,88 @@ void set_task_params(task_param &tparam, const unsigned &idx, const algorithm_ty
879 879 algor_init_params->basic_param = basic_params;
880 880 } break;
881 881  
  882 + case algorithm_type_t::VEHICLE_TIMING_SNAPSHOT: {
  883 +
  884 + auto basic_params = new algor_basic_config_param_t;
  885 + {
  886 + basic_params->result_folder = "res/vehicle_timing_snapshot";
  887 + basic_params->result_folder_little = "res/vehicle_timing_little";
  888 +
  889 + auto adapt_params = new universal_algor_adapt_param;
  890 + {
  891 + adapt_params->points_count = 4; // 0表示不生效
  892 + adapt_params->points[0].x_ = 0; adapt_params->points[0].y_ = 0;
  893 + adapt_params->points[1].x_ = 1920; adapt_params->points[1].y_ = 0;
  894 + adapt_params->points[2].x_ = 1920; adapt_params->points[2].y_ = 1080;
  895 + adapt_params->points[3].x_ = 0; adapt_params->points[3].y_ = 1080;
  896 + }
  897 + basic_params->adapt_param = adapt_params;
  898 + }
  899 +
  900 + auto algor_params = new algor_config_param_snapshot;
  901 + {
  902 + algor_params->threshold = 0.6f;
  903 + algor_params->snap_frame_interval = 25;
  904 + }
  905 + algor_init_params->algor_param = algor_params;
  906 + algor_init_params->basic_param = basic_params;
  907 + } break;
  908 +
  909 + case algorithm_type_t::HUMAN_TIMING_SNAPSHOT: {
  910 +
  911 + auto basic_params = new algor_basic_config_param_t;
  912 + {
  913 + basic_params->result_folder = "res/human_timing_snapshot";
  914 + basic_params->result_folder_little = "res/human_timing_little";
  915 +
  916 + //共性算法适配测试用
  917 + auto adapt_params = new universal_algor_adapt_param;
  918 + {
  919 + adapt_params->points_count = 4; // 0表示不生效
  920 + adapt_params->points[0].x_ = 0; adapt_params->points[0].y_ = 0;
  921 + adapt_params->points[1].x_ = 1920; adapt_params->points[1].y_ = 0;
  922 + adapt_params->points[2].x_ = 1920; adapt_params->points[2].y_ = 1080;
  923 + adapt_params->points[3].x_ = 0; adapt_params->points[3].y_ = 1080;
  924 + }
  925 + basic_params->adapt_param = adapt_params;
  926 + }
  927 +
  928 + auto algor_params = new algor_config_param_snapshot;
  929 + {
  930 + algor_params->threshold = 0.6f;
  931 + algor_params->snap_frame_interval = 25;
  932 + }
  933 + algor_init_params->algor_param = algor_params;
  934 + algor_init_params->basic_param = basic_params;
  935 + } break;
  936 +
  937 + case algorithm_type_t::NONMOTOR_VEHICLE_TIMING_SNAPSHOT: {
  938 +
  939 + auto basic_params = new algor_basic_config_param_t;
  940 + {
  941 + basic_params->result_folder = "res/nonvehicle_timing_snapshot";
  942 + basic_params->result_folder_little = "res/nonvehicle_timing_little";
  943 +
  944 + auto adapt_params = new universal_algor_adapt_param;
  945 + {
  946 + adapt_params->points_count = 4; // 0表示不生效
  947 + adapt_params->points[0].x_ = 0; adapt_params->points[0].y_ = 0;
  948 + adapt_params->points[1].x_ = 1920; adapt_params->points[1].y_ = 0;
  949 + adapt_params->points[2].x_ = 1920; adapt_params->points[2].y_ = 1080;
  950 + adapt_params->points[3].x_ = 0; adapt_params->points[3].y_ = 1080;
  951 + }
  952 + basic_params->adapt_param = adapt_params;
  953 + }
  954 +
  955 + auto algor_params = new algor_config_param_snapshot;
  956 + {
  957 + algor_params->threshold = 0.6f;
  958 + algor_params->snap_frame_interval = 25;
  959 + }
  960 + algor_init_params->algor_param = algor_params;
  961 + algor_init_params->basic_param = basic_params;
  962 + } break;
  963 +
882 964 default: {
883 965 if (algor_init_params != nullptr) {
884 966 delete algor_init_params;
... ... @@ -1231,7 +1313,8 @@ void test_gpu(int gpuID){
1231 1313 ,algorithm_type_t::VEHICLE_ILLEGAL_CROSSING_LINE};
1232 1314  
1233 1315 std::vector<algorithm_type_t> algor_wenhuagong = {algorithm_type_t::NONMOTOR_VEHICLE_SNAPSHOT, algorithm_type_t::VEHICLE_TRESPASS,algorithm_type_t::VEHICLE_SNAPSHOT,algorithm_type_t::VEHICLE_GATHER,algorithm_type_t::VEHICLE_ILLEGAL_PARKING,algorithm_type_t::VEHICLE_ILLEGAL_CROSSING_LINE
1234   - ,algorithm_type_t::HUMAN_GATHER, algorithm_type_t::FACE_SNAPSHOT, algorithm_type_t::HUMAN_LEAVE_REGION, algorithm_type_t::HUMAN_REGION_DISMISS, algorithm_type_t::HUMAN_REGION_FAST_MOVING, algorithm_type_t::HUMAN_SNAPSHOT, algorithm_type_t::HUMAN_REGION_GATHER, algorithm_type_t::HUMAN_DENSITY, algorithm_type_t::HUMAN_CROSSING_LINE, algorithm_type_t::HUMAN_CLIMB, algorithm_type_t::HUMAN_LINGER
  1316 + ,algorithm_type_t::HUMAN_GATHER, algorithm_type_t::FACE_SNAPSHOT, algorithm_type_t::HUMAN_LEAVE_REGION, algorithm_type_t::HUMAN_REGION_DISMISS, algorithm_type_t::HUMAN_REGION_FAST_MOVING, algorithm_type_t::HUMAN_SNAPSHOT, algorithm_type_t::HUMAN_REGION_GATHER, algorithm_type_t::HUMAN_DENSITY
  1317 + , algorithm_type_t::HUMAN_CROSSING_LINE, algorithm_type_t::HUMAN_CLIMB, algorithm_type_t::HUMAN_LINGER, algorithm_type_t::VEHICLE_TIMING_SNAPSHOT, algorithm_type_t::HUMAN_TIMING_SNAPSHOT, algorithm_type_t::NONMOTOR_VEHICLE_TIMING_SNAPSHOT
1235 1318 };
1236 1319  
1237 1320 // int repeat_num = 1000;
... ...
src/reprocessing_module/snapshot_reprocessing.cpp
... ... @@ -736,8 +736,6 @@ vector&lt;multi_obj_data_t&gt; snapshot_reprocessing::get_timing_snapshot(vector&lt;Devic
736 736 continue;
737 737 } else if (algor_type == algorithm_type_t::VEHICLE_TIMING_SNAPSHOT && algor_index_table["vehicle"].find(type_index) == algor_index_table["vehicle"].end()) {
738 738 continue;
739   - } else {
740   - continue;
741 739 }
742 740  
743 741 sy_point center;
... ...