diff --git a/src/ai_engine_module/road_seg_correlation_algor.cpp b/src/ai_engine_module/road_seg_correlation_algor.cpp index a8a2f59..cd4ca5d 100644 --- a/src/ai_engine_module/road_seg_correlation_algor.cpp +++ b/src/ai_engine_module/road_seg_correlation_algor.cpp @@ -20,6 +20,7 @@ namespace ai_engine_module algorithm_type_t::PERSON_CROSS, algorithm_type_t::NONMOTOR_WRONGDIRECTION, algorithm_type_t::VEHICLE_WRONGDIRECTION, + algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND, algorithm_type_t::VEHICLE_NOTGIVEWAY, }; @@ -237,6 +238,91 @@ namespace ai_engine_module return true; } } /*----------------------分割线---------------分割线--------------------*/ + // 获取轨迹起点/终点:去除离群点后取平均 + bool find_traceStartEnd(const vector& tracker_list, int check_frames, jxline& trace_line) { + int stcnt = 0, edcnt = 0; + float center_sum_x = 0, center_sum_y = 0, center_nsum_x = 0, center_nsum_y = 0; + for (int tmp = tracker_list.size()-check_frames; tmp < tracker_list.size()-check_frames+3; tmp++) { + center_sum_x += tracker_list[tmp].x_; + center_sum_y += tracker_list[tmp].y_; + } + float center_ave_x = center_sum_x / 3; float center_ave_y = center_sum_y / 3; + for (int tmp = tracker_list.size()-check_frames; tmp < tracker_list.size()-11; tmp++) { + if (abs(tracker_list[tmp].x_ - center_ave_x) > 300 || abs(tracker_list[tmp].y_ - center_ave_y) > 300) + continue; + center_nsum_x += tracker_list[tmp].x_; + center_nsum_y += tracker_list[tmp].y_; + stcnt += 1; + } + + float center_edsum_x = 0, center_edsum_y = 0, center_ednsum_x = 0, center_ednsum_y = 0; + for (int tmp = tracker_list.size()-3; tmp < tracker_list.size(); tmp++) { + center_edsum_x += tracker_list[tmp].x_; + center_edsum_y += tracker_list[tmp].y_; + } + float center_edave_x = center_edsum_x / 3; float center_edave_y = center_edsum_y / 3; + for (int tmp = tracker_list.size()-3; tmp < tracker_list.size(); tmp++) { + if (abs(tracker_list[tmp].x_ - center_edave_x) > 300 || abs(tracker_list[tmp].y_ - center_edave_y) > 300) + continue; + center_ednsum_x += tracker_list[tmp].x_; + center_ednsum_y += tracker_list[tmp].y_; + edcnt += 1; + } + + if (stcnt > 0 && edcnt > 0) { + trace_line.xa = center_nsum_x / stcnt; trace_line.ya = center_nsum_y / stcnt; + trace_line.xb = center_ednsum_x / edcnt; trace_line.yb = center_ednsum_y / edcnt; + float t_diff_x = trace_line.xb - trace_line.xa, t_diff_y = trace_line.yb - trace_line.ya; + float temp_dist = sqrt(t_diff_x * t_diff_x + t_diff_y * t_diff_y); + if (temp_dist > 50) return true; // 位移限制 + } + + return false; + } + + // 判断是否相交 + bool is_intersect(jxline myline1, jxline myline2) + { + // 快速排斥实验 + if (myline1.get_max_x() < myline2.get_min_x() || + myline2.get_max_x() < myline1.get_min_x() || + myline1.get_max_y() < myline2.get_min_y() || + myline2.get_max_y() < myline1.get_min_y()) + return false; + + // 跨立实验(叉积异号) + if (((((float)myline1.xa - (float)myline2.xa)*((float)myline2.yb - (float)myline2.ya) - ((float)myline1.ya - (float)myline2.ya)*((float)myline2.xb - (float)myline2.xa))* + (((float)myline1.xb - (float)myline2.xa)*((float)myline2.yb - (float)myline2.ya) - ((float)myline1.yb - (float)myline2.ya)*((float)myline2.xb - (float)myline2.xa))) > 0 || + ((((float)myline2.xa - (float)myline1.xa)*((float)myline1.yb - (float)myline1.ya) - ((float)myline2.ya - (float)myline1.ya)*((float)myline1.xb - (float)myline1.xa))* + (((float)myline2.xb - (float)myline1.xa)*((float)myline1.yb - (float)myline1.ya) - ((float)myline2.yb - (float)myline1.ya)*((float)myline1.xb - (float)myline1.xa))) > 0) + return false; + + return true; + } + + // 判断掉头:以轨迹中间为界,判断前后方向是否一致 + bool vTurnAround(const vector& tracker_list, int check_frames) { + int trackcnt = tracker_list.size(); + int half_check_frames = check_frames / 2; + tr_point p_start, p_end, p_half; + p_start.x = tracker_list[trackcnt-check_frames-1].x_; p_start.y = tracker_list[trackcnt-check_frames-1].y_; + p_end.x = tracker_list[trackcnt-1].x_; p_end.y = tracker_list[trackcnt-1].y_; + p_half.x = tracker_list[trackcnt-half_check_frames-1].x_; p_half.y = tracker_list[trackcnt-half_check_frames-1].y_; + // 车辆方向 + tr_point car_toward1, car_toward2; + car_toward1.x = p_half.x - p_start.x; car_toward1.y = p_half.y - p_start.y; + car_toward2.x = p_end.x - p_half.x; car_toward2.y = p_end.y - p_half.y; + + float temp_dist1 = sqrt(car_toward1.x * car_toward1.x + car_toward1.y * car_toward1.y); + float temp_dist2 = sqrt(car_toward2.x * car_toward2.x + car_toward2.y * car_toward2.y); + if (temp_dist1 < 40 || temp_dist2 < 40) return false; // 位移限制 + + int deg1 = atan2(car_toward1.y, car_toward1.x) * 180 / Pi; // 返回与x轴的夹角 + int deg2 = atan2(car_toward2.y, car_toward2.x) * 180 / Pi; + int deg_diff = abs(deg1 - deg2); + if (deg_diff < 135) { return false; } + else { return true; } + } vector Mbuild_area(vector args) { @@ -494,7 +580,8 @@ namespace ai_engine_module continue; stream_idx_and_algor_seq.algors.emplace(algor_type); - if (algor_type == algorithm_type_t::VEHICLE_WRONGDIRECTION || algor_type == algorithm_type_t::VEHICLE_NOTGIVEWAY) has_vehicle_algor = true; + if (algor_type == algorithm_type_t::VEHICLE_WRONGDIRECTION || algor_type == algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND || + algor_type == algorithm_type_t::VEHICLE_NOTGIVEWAY) has_vehicle_algor = true; } if (stream_idx_and_algor_seq.algors.empty()) @@ -591,7 +678,8 @@ namespace ai_engine_module auto fence_labels_ = fence_labels[flattened_idx_to_batch_idx[n]]; vector> vehiclelanes_regions; //机动车区域 - vector> crosswalk_regions; //人行道区域+十字路口区域 + vector> crosswalk_regions; //人行道+十字路口区域 + vector> solidlines; //黄实线+白实线 // printf("seg_labels.size:%d\n",seg_labels.size()); for (unsigned i = 0; i < seg_labels.size(); ++i) { const label_t label = static_cast(seg_labels[i]); @@ -603,6 +691,10 @@ namespace ai_engine_module vector cur_region(seg_regions[i].begin(),seg_regions[i].end()); crosswalk_regions.push_back(cur_region); } + if ((label == label_t::yellow_solidline || label == label_t::white_solidline)) { + vector cur_region(seg_regions[i].begin(),seg_regions[i].end()); + solidlines.push_back(cur_region); + } } vector> roadseg_fence_regions;//车道分割护栏区域 @@ -637,7 +729,7 @@ namespace ai_engine_module if ((algor_type == algorithm_type_t::NONMOTOR_IN_VEHICLELANE || algor_type == algorithm_type_t::NONMOTOR_CEOSSPARKLINE || algor_type == algorithm_type_t::NONMOTOR_WRONGDIRECTION) && !is_valid_nomotor(static_cast(det_result.box.cls))) continue; - if ((algor_type == algorithm_type_t::VEHICLE_WRONGDIRECTION || algor_type == algorithm_type_t::VEHICLE_NOTGIVEWAY) && !is_valid_car(static_cast(det_result.box.cls))) + if ((algor_type == algorithm_type_t::VEHICLE_WRONGDIRECTION || algor_type == algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND || algor_type == algorithm_type_t::VEHICLE_NOTGIVEWAY) && !is_valid_car(static_cast(det_result.box.cls))) continue; auto& e = id_to_mn_[obj_key]; @@ -716,6 +808,32 @@ namespace ai_engine_module if (!isalarm) continue; } + // 机动车实线掉头 + if (algor_type == algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND) { + bool isalarm = false; + int check_frames = 20; //4s 监控4s内的轨迹情况 + if (m_total_obj_info[trace_obj_key].center_points.size() > check_frames) { + jxline trace_line; + bool ret = find_traceStartEnd(m_total_obj_info[trace_obj_key].center_points, check_frames, trace_line); + if (ret) { + for (auto region : solidlines) { + vector tr_boxes = Mbuild_area(region); if (tr_boxes.size() < 2) continue; + for (int tmp_p = 0; tmp_p < tr_boxes.size() - 1; tmp_p++) { + jxline cur_line; + cur_line.xa = tr_boxes[tmp_p].x; cur_line.ya = tr_boxes[tmp_p].y; + cur_line.xb = tr_boxes[tmp_p + 1].x; cur_line.yb = tr_boxes[tmp_p + 1].y; + if (is_intersect(trace_line, cur_line)) { //压线 + bool cur_flag = vTurnAround(m_total_obj_info[trace_obj_key].center_points, check_frames);// 掉头 todo: 根据关键点判车头车尾朝向是否发生改变 + if (cur_flag) { isalarm = true; break; } + } + } + if (isalarm) break; + } + } + } + if (!isalarm) continue; + } + // 机动车不让行:针对人行道区域有行人,车辆不停车的情形 if (algor_type == algorithm_type_t::VEHICLE_NOTGIVEWAY) { bool isalarm = false; @@ -748,7 +866,8 @@ namespace ai_engine_module { if (++e.n_frame == algor_param->n || - algor_type == algorithm_type_t::NONMOTOR_CEOSSPARKLINE || algor_type == algorithm_type_t::PERSON_CROSS ) //部分功能当前版本暂不投票 + algor_type == algorithm_type_t::NONMOTOR_CEOSSPARKLINE || algor_type == algorithm_type_t::PERSON_CROSS || + algor_type == algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND ) //部分功能当前版本暂不投票 { results_data_t result; { diff --git a/src/ai_engine_module/road_seg_correlation_algor.h b/src/ai_engine_module/road_seg_correlation_algor.h index 29e6a15..bc48ca1 100644 --- a/src/ai_engine_module/road_seg_correlation_algor.h +++ b/src/ai_engine_module/road_seg_correlation_algor.h @@ -36,7 +36,10 @@ namespace ai_engine_module crosswalk = 5, //人行横道 no_parking_area = 6, //禁停区域 interestion_area = 7, //十字路口区域 - // green_belt_area = 8, //绿化带区域 + yellow_solidline = 8, //黄实线 + white_solidline = 9, //白实线 + white_dottedline = 10, //虚线 + yellow_dottedline = 11, //黄虚线 }; enum class fence_label_t { @@ -124,6 +127,39 @@ namespace ai_engine_module std::map id_to_mn_; std::map id_to_result_; }; + + class jxline + { + public: + int xa; + int ya; + int xb; + int yb; + jxline() {} + jxline(int xa, int ya, int xb, int yb) + { + this->xa = xa; + this->ya = ya; + this->xb = xb; + this->yb = yb; + } + int get_max_x() + { + return xa > xb ? xa : xb; + } + int get_min_x() + { + return xa > xb ? xb : xa; + } + int get_max_y() + { + return ya > yb ? ya : yb; + } + int get_min_y() + { + return ya > yb ? yb : ya; + } + }; } // namespace road_seg_correlation_process } // namespace ai_engine_module diff --git a/src/ai_engine_module/road_seg_statistics.cpp b/src/ai_engine_module/road_seg_statistics.cpp index 7bd7ea0..36caf1c 100644 --- a/src/ai_engine_module/road_seg_statistics.cpp +++ b/src/ai_engine_module/road_seg_statistics.cpp @@ -215,7 +215,7 @@ cv::Mat RoadSegProcess::seg_post_process(bool large_resolution, unsigned char *s for (int i = 0; i < lanes.size(); ++i) { int thickness = 4; for (int j = 0; j < lanes[i].size()-1; ++j) { - cv::line(mask_rmlane, lanes[i][j], lanes[i][j+1], cats[i], thickness); + cv::line(mask_rmlane, lanes[i][j], lanes[i][j+1], {seg_colors[cats[i]][0],seg_colors[cats[i]][1],seg_colors[cats[i]][2]}, thickness); // std::cout << lanes[i][j] << " " << lanes[i][j+1] << " " << cats[i] << std::endl; } } diff --git a/src/ai_engine_module/road_seg_statistics.h b/src/ai_engine_module/road_seg_statistics.h index e4c1dfe..08f23d2 100644 --- a/src/ai_engine_module/road_seg_statistics.h +++ b/src/ai_engine_module/road_seg_statistics.h @@ -77,7 +77,8 @@ private: int seg_num_seg = 7; //道路分割种类(不包含背景) int seg_min_region_area = 512; //1024 float seg_min_lane_score = 0.35; //230625 - uint8_t seg_colors[9][3] = { {0, 0, 0}, {255, 0, 0}, {0, 255, 0}, {0, 0, 255}, {0, 255, 128}, {128, 255, 255}, {255, 128, 255}, {255, 255, 128}, {60, 180, 0}}; + uint8_t seg_colors[13][3] = { {0, 0, 0}, {255, 0, 0}, {0, 255, 0}, {0, 0, 255}, {0, 255, 128}, {128, 255, 255}, {255, 128, 255}, {255, 255, 128}, {60, 180, 0}, {0, 60, 180}, + {0, 180, 60}, {60, 0, 180}, {180, 0, 60} }; uint8_t lane_colors[9][3] = { {0, 0, 0}, {255, 255, 0}, {255, 0, 255}, {0, 255, 255}, {128, 255, 0}, {255, 128, 0}, {128, 0, 255}, {255, 0, 128}, {0, 128, 255}}; }; diff --git a/src/ai_platform/MultiSourceProcess.cpp b/src/ai_platform/MultiSourceProcess.cpp index 7b81e89..3ae92f0 100755 --- a/src/ai_platform/MultiSourceProcess.cpp +++ b/src/ai_platform/MultiSourceProcess.cpp @@ -1647,7 +1647,8 @@ void CMultiSourceProcess::algorithm_roadseg_correlation_process(vector& algor_map->find(algorithm_type_t::PERSON_CROSS) != algor_map->end() || algor_map->find(algorithm_type_t::NONMOTOR_WRONGDIRECTION) != algor_map->end() || algor_map->find(algorithm_type_t::VEHICLE_WRONGDIRECTION) != algor_map->end() || - algor_map->find(algorithm_type_t::VEHICLE_NOTGIVEWAY) != algor_map->end() + algor_map->find(algorithm_type_t::VEHICLE_NOTGIVEWAY) != algor_map->end() || + algor_map->find(algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND) != algor_map->end() ) { m_RoadSegTaskMtx.lock(); @@ -1845,7 +1846,7 @@ void CMultiSourceProcess::village_snapshot(vector& vpt_interest_task_id, } vector roadseg_algor = {algorithm_type_t::PERSON_IN_VEHICLELANE, algorithm_type_t::PERSON_CROSS, algorithm_type_t::NONMOTOR_IN_VEHICLELANE, algorithm_type_t::NONMOTOR_CEOSSPARKLINE, - algorithm_type_t::NONMOTOR_WRONGDIRECTION, algorithm_type_t::VEHICLE_WRONGDIRECTION, algorithm_type_t::VEHICLE_NOTGIVEWAY }; + algorithm_type_t::NONMOTOR_WRONGDIRECTION, algorithm_type_t::VEHICLE_WRONGDIRECTION, algorithm_type_t::VEHICLE_NOTGIVEWAY, algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND }; for (size_t idx = 0; idx < roadseg_algor.size(); ++idx) { if (algor_param[task_id].count(roadseg_algor.at(idx))) { const auto &algor_other_params = task_other_params->find(roadseg_algor.at(idx)); diff --git a/src/ai_platform/task_param_manager.cpp b/src/ai_platform/task_param_manager.cpp index e2badde..ef2c88e 100755 --- a/src/ai_platform/task_param_manager.cpp +++ b/src/ai_platform/task_param_manager.cpp @@ -88,6 +88,9 @@ bool copy_algor_param_aux(const algorithm_type_t &algor_type, const std::string case algorithm_type_t::VEHICLE_NOTGIVEWAY: m_algor_config_params[task_id].vehicle_algors.insert(algor_type); goto _manned_param_copy; + case algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND: + m_algor_config_params[task_id].vehicle_algors.insert(algor_type); + goto _manned_param_copy; case algorithm_type_t::TRUCK_MANNED: { m_algor_config_params[task_id].vehicle_algors.insert(algor_type); _manned_param_copy : { diff --git a/src/decoder/test_face.cpp b/src/decoder/test_face.cpp1 index 1ef3eb2..1ef3eb2 100644 --- a/src/decoder/test_face.cpp +++ b/src/decoder/test_face.cpp1 diff --git a/src/decoder/test_recoder.cpp b/src/decoder/test_recoder.cpp new file mode 100644 index 0000000..d373aa8 --- /dev/null +++ b/src/decoder/test_recoder.cpp @@ -0,0 +1,248 @@ +#include "./interface/DecoderManager.h" +#include +#include +#include + +using namespace std; + +struct decode_cbk_userdata{ + string task_id; + void* opaque; + void* opaque1; +}; + +deque m_RgbDataList; +mutex m_DataListMtx; + +thread* m_pAlgorthimThread{nullptr}; +thread* m_recodeThread{nullptr}; +bool m_bfinish{false}; +int m_devId = 0; +const char* task_id = "test0"; +int skip_frame_ = 5; +int m_batch_size = 20; + +deque m_recoderinfo_queue; +mutex m_recoderinfo_queue_mtx; + +void algorthim_process_thread(); +void recode_thread(); +void algorthim_face_detect(vector vec_gpuMem); + +void test_recode_thread(); + +void post_decod_cbk(const void * userPtr, DeviceMemory* devFrame){ + do{ + if(m_bfinish){ + break; + } + m_DataListMtx.lock(); + if(m_RgbDataList.size() >= 30){ + m_DataListMtx.unlock(); + std::this_thread::sleep_for(std::chrono::milliseconds(3)); + continue; + } + m_RgbDataList.push_back(devFrame); + m_DataListMtx.unlock(); + break; + }while (true); +} + +void decode_finished_cbk(const void * userPtr){ + decode_cbk_userdata* ptr = (decode_cbk_userdata*)userPtr; + if (ptr!= nullptr){ + printf("task finished: %s \n", ptr->task_id.c_str()); + } + delete ptr; + ptr = nullptr; +} + +int main(){ + + // 创建解码任务 + DecoderManager* pDecManager = DecoderManager::getInstance(); + + MgrDecConfig config; + config.name = task_id; + config.cfg.uri = "/opt/cmhu/data/公安局老桥头_CVR15F89410_1465819864_1B.mp4"; + config.cfg.post_decoded_cbk = post_decod_cbk; + config.cfg.decode_finished_cbk = decode_finished_cbk; + config.cfg.force_tcp = true; // rtsp用tcp + config.cfg.gpuid = to_string(m_devId); + config.cfg.skip_frame = skip_frame_; + + config.dec_type = DECODER_TYPE_DVPP; + + AbstractDecoder* dec = pDecManager->createDecoder(config); + if (!dec){ + printf("创建解码器失败 \n"); + return false; + } + + decode_cbk_userdata* userPtr = new decode_cbk_userdata; + userPtr->task_id = string(task_id); + pDecManager->setPostDecArg(config.name, userPtr); + pDecManager->setFinishedDecArg(config.name, userPtr); + + + int input_image_width = 0; + int input_image_height = 0; + pDecManager->getResolution(config.name, input_image_width, input_image_height); + + + // 创建算法线程 + m_pAlgorthimThread = new thread([](void* arg) { + algorthim_process_thread(); + return (void*)0; + } + , nullptr); + + // m_recodeThread = new thread([](void* arg) { + // recode_thread(); + // return (void*)0; + // } + // , nullptr); + + m_recodeThread = new thread([](void* arg) { + test_recode_thread(); + return (void*)0; + } + , nullptr); + + pDecManager->startDecodeByName(config.name); + + while (getchar() != 'q'); +} + +void algorthim_process_thread(){ + + while (true){ + if(m_bfinish){ + break; + } + + vector vec_gpuMem; + m_DataListMtx.lock(); + while (!m_RgbDataList.empty()){ + DeviceMemory* gpuMem = m_RgbDataList.front(); + if(gpuMem->getMem() == nullptr){ + // 错误数据,直接删除 + delete gpuMem; + gpuMem = nullptr; + printf("mem is null \n"); + } else { + vec_gpuMem.push_back(gpuMem); + } + m_RgbDataList.pop_front(); + if(vec_gpuMem.size() >= m_batch_size){ + break; + } + } + m_DataListMtx.unlock(); + + if(vec_gpuMem.size() <= 0){ + std::this_thread::sleep_for(std::chrono::milliseconds(3)); + continue; + } + + algorthim_face_detect(vec_gpuMem); + + for(int i=0;i < vec_gpuMem.size(); i++){ + DeviceMemory* mem = vec_gpuMem[i]; + if(mem->getSize() <= 0){ + continue; + } + delete mem; + mem = nullptr; + } + vec_gpuMem.clear(); + + } + + printf("algorthim_process_thread exit. \n"); +} + +static int interval = 0; +static int obj_id = 0; + +void algorthim_face_detect(vector vec_gpuMem) { + interval ++ ; + + if(interval % 50 != 0) { + return; + } + + for(int i= 0; i < vec_gpuMem.size(); i++) { + DeviceMemory* mem = vec_gpuMem[i]; + string task_id = mem->getId(); + + RecoderInfo recoderInfo; + recoderInfo.task_id = task_id; + recoderInfo.object_id = std::to_string(obj_id); + recoderInfo.recoderPath = "./res/recode"; + recoderInfo.frame_nb = mem->getFrameNb(); + + m_recoderinfo_queue_mtx.lock(); + m_recoderinfo_queue.push_back(recoderInfo); + m_recoderinfo_queue_mtx.unlock(); + + obj_id++; + + } +} + +void test_recode_thread() { + unsigned long long frame_index = 0; + while(true) { + std::this_thread::sleep_for(std::chrono::milliseconds(10)); + + DeviceMemory* mem = nullptr; + m_DataListMtx.lock(); + while (!m_RgbDataList.empty()){ + DeviceMemory* gpuMem = m_RgbDataList.front(); + if(gpuMem->getMem() == nullptr){ + // 错误数据,直接删除 + delete gpuMem; + gpuMem = nullptr; + printf("mem is null \n"); + } else { + frame_index ++ ; + if (frame_index % 50 == 0) { + RecoderInfo recoderInfo; + recoderInfo.task_id = gpuMem->getId(); + recoderInfo.object_id = std::to_string(obj_id); + recoderInfo.recoderPath = "./res/recode"; + recoderInfo.frame_nb = gpuMem->getFrameNb(); + + DecoderManager* pDecManager = DecoderManager::getInstance(); + pDecManager->doRecode(recoderInfo); + + obj_id++; + } + delete gpuMem; + gpuMem = nullptr; + } + m_RgbDataList.pop_front(); + } + m_DataListMtx.unlock(); + } +} + +void recode_thread() { + while(true) { + + m_recoderinfo_queue_mtx.lock(); + if(m_recoderinfo_queue.size() <= 0) { + m_recoderinfo_queue_mtx.unlock(); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); + continue; + } + + RecoderInfo info = m_recoderinfo_queue.front(); + m_recoderinfo_queue.pop_front(); + m_recoderinfo_queue_mtx.unlock(); + + DecoderManager* pDecManager = DecoderManager::getInstance(); + pDecManager->doRecode(info); + } +} \ No newline at end of file diff --git a/src/demo/demo.cpp b/src/demo/demo.cpp index 8ee9f53..d92f286 100755 --- a/src/demo/demo.cpp +++ b/src/demo/demo.cpp @@ -396,6 +396,27 @@ void set_task_params(task_param &tparam, const unsigned &idx, const algorithm_ty algor_init_params->basic_param = basic_params; } break; + case algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND: { + auto algor_params = new algor_config_param_manned_incident; + { + algor_params->m = 10; + algor_params->n = 8; + algor_params->obj_confidence_threshold = 0.5f; + algor_params->obj_min_height = 40; + algor_params->obj_min_width = 40; + } + + auto basic_params = new algor_basic_config_param_t; + { + basic_params->video_folder = "res/video_recode"; + basic_params->result_folder = "res/vehicle_solid_turnaround"; + basic_params->result_folder_little = "res/vehicle_solid_turnaround_little"; + } + + algor_init_params->algor_param = algor_params; + algor_init_params->basic_param = basic_params; + } break; + case algorithm_type_t::FACE_SNAPSHOT: { auto basic_params = new algor_basic_config_param_t; @@ -1037,11 +1058,10 @@ void test_gpu(int gpuID){ std::vector algor_vec2 = {algorithm_type_t::NONMOTOR_VEHICLE_NOHELMET, algorithm_type_t::NONMOTOR_VEHICLE_OVERMAN, algorithm_type_t::TRICYCLE_MANNED, algorithm_type_t::TRUCK_MANNED, algorithm_type_t::NONMOTOR_VEHICLE_USEPHONE, algorithm_type_t::NONMOTOR_VEHICLE_REFIT, algorithm_type_t::PERSON_RUNNING_REDLIGHTS, algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS, algorithm_type_t::PERSON_IN_VEHICLELANE, algorithm_type_t::NONMOTOR_IN_VEHICLELANE, - algorithm_type_t::NONMOTOR_CEOSSPARKLINE, algorithm_type_t::PERSON_CROSS, algorithm_type_t::NONMOTOR_WRONGDIRECTION, algorithm_type_t::VEHICLE_WRONGDIRECTION, algorithm_type_t::VEHICLE_NOTGIVEWAY}; - std::vector algor_vec3 = {algorithm_type_t::NONMOTOR_VEHICLE_NOHELMET, algorithm_type_t::NONMOTOR_VEHICLE_OVERMAN, algorithm_type_t::TRICYCLE_MANNED, algorithm_type_t::TRUCK_MANNED, algorithm_type_t::NONMOTOR_VEHICLE_USEPHONE, - algorithm_type_t::NONMOTOR_VEHICLE_REFIT, algorithm_type_t::PERSON_RUNNING_REDLIGHTS, algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS}; - // std::vector algor_vec3 = {algorithm_type_t::NONMOTOR_VEHICLE_NOHELMET, algorithm_type_t::NONMOTOR_VEHICLE_OVERMAN, algorithm_type_t::TRICYCLE_MANNED, algorithm_type_t::NONMOTOR_VEHICLE_USEPHONE, - // algorithm_type_t::NONMOTOR_VEHICLE_REFIT}; + algorithm_type_t::NONMOTOR_CEOSSPARKLINE, algorithm_type_t::PERSON_CROSS, algorithm_type_t::NONMOTOR_WRONGDIRECTION, algorithm_type_t::VEHICLE_WRONGDIRECTION, algorithm_type_t::VEHICLE_NOTGIVEWAY, algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND}; + // std::vector algor_vec3 = {algorithm_type_t::NONMOTOR_VEHICLE_NOHELMET, algorithm_type_t::NONMOTOR_VEHICLE_OVERMAN, algorithm_type_t::TRICYCLE_MANNED, algorithm_type_t::TRUCK_MANNED, algorithm_type_t::NONMOTOR_VEHICLE_USEPHONE, + // algorithm_type_t::NONMOTOR_VEHICLE_REFIT, algorithm_type_t::PERSON_RUNNING_REDLIGHTS, algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS}; + std::vector algor_vec3 = {algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND}; /* int repeat_num = 1000; @@ -1063,18 +1083,18 @@ void test_gpu(int gpuID){ // createTask(handle, algor_vec, 1); // createTask(handle, algor_vec, 2); // createTask(handle, algor_vec, 3); - // createTask(handle, algor_vec3, 4); - createTask(handle, algor_vec2, 5); - createTask(handle, algor_vec2, 6); - createTask(handle, algor_vec2, 7); - createTask(handle, algor_vec2, 8); - createTask(handle, algor_vec2, 9); - createTask(handle, algor_vec2, 10); - createTask(handle, algor_vec2, 11); - createTask(handle, algor_vec2, 12); - createTask(handle, algor_vec2, 13); - createTask(handle, algor_vec2, 14); - createTask(handle, algor_vec2, 15); + createTask(handle, algor_vec3, 4); + createTask(handle, algor_vec3, 5); + createTask(handle, algor_vec3, 6); + createTask(handle, algor_vec3, 7); + createTask(handle, algor_vec3, 8); + createTask(handle, algor_vec3, 9); + createTask(handle, algor_vec3, 10); + // createTask(handle, algor_vec3, 11); + // createTask(handle, algor_vec3, 12); + // createTask(handle, algor_vec3, 13); + // createTask(handle, algor_vec3, 14); + // createTask(handle, algor_vec3, 15); // createTask(handle, algor_vec2, 16); // createTask(handle, algor_vec2, 17); // createTask(handle, algor_vec2, 18);