Commit fa8183035cd924444e5c5fcfba9f11f3e6b4cb7e
1 parent
b5aaf53a
增加闯红灯功能(特定场景);优化货车载人效果(检测框行人及非机动车过滤)
Showing
17 changed files
with
995 additions
and
36 deletions
bin/libSYTSLSystemInfoNativeJNI.so
No preview for this file type
bin/libtraffic_light_vdec.so
0 → 100755
No preview for this file type
bin/models/village/trlight_det_310p.om
0 → 100644
No preview for this file type
src/Makefile
... | ... | @@ -38,7 +38,7 @@ lib=-lacl_dvpp -lascendcl -lacl_dvpp_mpi -lruntime -lascendalog -lc_sec -lmsprof |
38 | 38 | -lplatform -lgraph_base -lqos_manager |
39 | 39 | |
40 | 40 | LIBS= -L $(SPDLOG_ROOT)/lib -l:libspdlog.a \ |
41 | - -L $(DEPEND_DIR) -lvpt_det_vdec -lsycheck -lface_det_vdec -lhs_tri_process -lhs_truck_process -lphone_motor_det -lhcp_vdec -lmotor_rainshed_vdec -lhs_motor_process\ | |
41 | + -L $(DEPEND_DIR) -lvpt_det_vdec -lsycheck -lface_det_vdec -lhs_tri_process -lhs_truck_process -lphone_motor_det -lhcp_vdec -lmotor_rainshed_vdec -ltraffic_light_vdec -lhs_motor_process\ | |
42 | 42 | -L $(OPENCV_ROOT)/lib -lopencv_world\ |
43 | 43 | -L $(JSON_ROOT)/lib -ljsoncpp \ |
44 | 44 | -L $(FFMPEG_ROOT)/lib -lavformat -lavcodec -lswscale -lavutil -lavfilter -lswresample -lavdevice \ | ... | ... |
src/ai_engine_module/ai_engine_module.h
0 → 100644
1 | +#pragma once | |
2 | + | |
3 | +#include "./VPTProcess.h" | |
4 | +#include "./face_det_ai_engine.h" | |
5 | +#include "./pedestrian_vehicle_retrograde.h" | |
6 | +#include "./pedestrian_vehicle_trespass.h" | |
7 | +#include "./tricycle_manned_process.h" | |
8 | +#include "./truck_manned_process.h" | |
9 | +#include "./motocycle_hs_process.h" | |
10 | +#include "./motocycle_refit_phone_process.h" | |
11 | +#include "./motocycle_phone_process.h" | |
12 | +#include "./motocycle_refit_process.h" | |
13 | +#include "./traffic_light_process.h" | |
0 | 14 | \ No newline at end of file | ... | ... |
src/ai_engine_module/traffic_light_det.h
0 → 100644
1 | +/******************************************************************************************* | |
2 | +* Version: triffic_light_det_x64_v0.0.1 | |
3 | +* CopyRight: 中科视语(北京)科技有限公司 | |
4 | +* UpdateDate: 20230922 | |
5 | +* Content:头肩检测_货车 | |
6 | +********************************************************************************************/ | |
7 | +#ifndef TRAFFIC_LIGHT_H_ | |
8 | +#define TRAFFIC_LIGHT_H_ | |
9 | + | |
10 | +#ifdef _MSC_VER | |
11 | +#ifdef TRAFFIC_LIGHT_EXPORTS | |
12 | +#define TRAFFIC_LIGHT_API __declspec(dllexport) | |
13 | +#else | |
14 | +#define TRAFFIC_LIGHT_API __declspec(dllimport) | |
15 | +#endif | |
16 | +#else | |
17 | +#define TRAFFIC_LIGHT_API __attribute__ ((visibility ("default"))) | |
18 | +#endif | |
19 | + | |
20 | +#include "sy_common.h" | |
21 | + | |
22 | +#define MAX_OBJ_COUNT 1000 | |
23 | + | |
24 | +#ifdef __cplusplus | |
25 | +extern "C" | |
26 | +{ | |
27 | +#endif | |
28 | + | |
29 | + typedef struct traffic_light_info //结果结构体 | |
30 | + { | |
31 | + int left; | |
32 | + int top; | |
33 | + int right; | |
34 | + int bottom; | |
35 | + double confidence; // 置信度 | |
36 | + int index; // 类别索引 | |
37 | + }traffic_light_info; | |
38 | + | |
39 | + typedef struct traffic_light_result | |
40 | + { | |
41 | + traffic_light_info objinfo[MAX_OBJ_COUNT]; | |
42 | + int objcount; | |
43 | + }; | |
44 | + | |
45 | + typedef struct traffic_light_param | |
46 | + { | |
47 | + //int mode; //运行模式 GPU_MODE 或者 CPU_MODE | |
48 | + int devId; //运行卡号 GPU模式下有效 | |
49 | + char* modelNames; | |
50 | + float thresld; //检测阈值 默认为0.3 | |
51 | + | |
52 | + //int engine; //指定运行引擎(ENGINE_MCAFFE2 / ENGINE_TENSORRT) | |
53 | + //int max_batch; //ָ指定trt最大batch数 | |
54 | + //char* trt_serialize_file; | |
55 | + //traffic_light_param() :mode(DEVICE_GPU), gpuid(0), thresld(0.4), engine(ENGINE_MCAFFE2), max_batch(10){}; | |
56 | + }traffic_light_param; | |
57 | + | |
58 | + /************************************************************************* | |
59 | + * FUNCTION: hst_init | |
60 | + * PURPOSE: 初始化 | |
61 | + * PARAM: | |
62 | + [in] handle -处理句柄 | |
63 | + [in] param -初始化参数 | |
64 | + * RETURN: handle | |
65 | + * NOTES:成功(0)或者错误代码(<0) | |
66 | + *************************************************************************/ | |
67 | + TRAFFIC_LIGHT_API int traffic_light_init(void **handle, traffic_light_param param); | |
68 | + TRAFFIC_LIGHT_API int traffic_light_process_batch(void * handle, sy_img *image_data_array, int batchsize, traffic_light_result *result); | |
69 | + | |
70 | + /************************************************************************* | |
71 | + * FUNCTION: hst_release | |
72 | + * PURPOSE: 资源释放 | |
73 | + * PARAM: | |
74 | + [in] handle - 处理句柄 | |
75 | + * RETURN: NULL | |
76 | + * NOTES: | |
77 | + *************************************************************************/ | |
78 | + TRAFFIC_LIGHT_API void traffic_light_release(void **handle); | |
79 | + | |
80 | + | |
81 | + /************************************************************************* | |
82 | + * FUNCTION: hst_process_gpu | |
83 | + * PURPOSE: | |
84 | + * PARAM: | |
85 | + [in] handle - 处理句柄 | |
86 | + [in] rgb - 图片数据(3通道BGR数据 cv::Mat格式) | |
87 | + [in] width - 图片宽度 | |
88 | + [in] height - 图片高度 | |
89 | + [in] result - 搜索结果,在外部申请足够内存 | |
90 | + * RETURN: -1:图像错误; 其他:检测到的个数 | |
91 | + * NOTES: | |
92 | + *************************************************************************/ | |
93 | + TRAFFIC_LIGHT_API int traffic_light_process(void * handle, sy_img image, traffic_light_result *result); | |
94 | + | |
95 | + /************************************************************************* | |
96 | + * FUNCTION: hst_getversion | |
97 | + * PURPOSE: 释放 | |
98 | + * PARAM: NULL | |
99 | + * RETURN: 版本号 | |
100 | + * NOTES: | |
101 | + *************************************************************************/ | |
102 | + TRAFFIC_LIGHT_API const char * traffic_light_getversion(); | |
103 | + | |
104 | +#ifdef __cplusplus | |
105 | +}; | |
106 | +#endif | |
107 | + | |
108 | +#endif | ... | ... |
src/ai_engine_module/traffic_light_process.cpp
0 → 100644
1 | +#include <algorithm> | |
2 | +#include "./traffic_light_process.h" | |
3 | +#include <cmath> | |
4 | +#include "../decoder/interface/DeviceMemory.hpp" | |
5 | +#include "../common/logger.hpp" | |
6 | +#include "../ai_platform/mvpt_process_assist.h" | |
7 | + | |
8 | +#if 0 | |
9 | +#include "opencv2/opencv.hpp" | |
10 | +#include "opencv2/imgcodecs/legacy/constants_c.h" | |
11 | +#endif | |
12 | + | |
13 | +namespace ai_engine_module | |
14 | +{ | |
15 | + namespace traffic_light_process | |
16 | + { | |
17 | + static std::set<algorithm_type_t> algor_type_list_ = { | |
18 | + algorithm_type_t::PERSON_RUNNING_REDLIGHTS, | |
19 | + algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS, | |
20 | + }; | |
21 | + | |
22 | + inline bool is_valid_label(const label_t &label) { | |
23 | + return ((label == label_t::red)); | |
24 | + } | |
25 | + | |
26 | + std::set<algorithm_type_t> task_id_to_algorithm_type_seq(const task_id_t &task_id, | |
27 | + task_param_manager *const task_param) { | |
28 | + std::set<algorithm_type_t> seq; | |
29 | + auto &&algor_map = task_param->get_task_other_param(task_id); | |
30 | + if (algor_map) { | |
31 | + // LOG_TRACE("task id is {} size algor type {}", task_id, algor_map->size()); | |
32 | + for (auto iter = algor_map->begin(); iter != algor_map->end(); ++iter) { | |
33 | + if (algor_type_list_.count(iter->first) > 0) | |
34 | + seq.emplace(iter->first); | |
35 | + } | |
36 | + } | |
37 | + return seq; // N(RVO) | |
38 | + } | |
39 | + | |
40 | + bool is_valid_box(const int top, const int left, const int right, const int bottom, const float score, | |
41 | + const algorithm_type_t &algor_type, | |
42 | + const task_param_manager::algo_param_type_t_ *params_ptr = nullptr) { | |
43 | + if (!params_ptr) | |
44 | + return false; | |
45 | + | |
46 | + if (!snapshot_legal_inarea(params_ptr->basic_param->algor_valid_rect, left, top, right, bottom)) | |
47 | + return false; | |
48 | + | |
49 | + if (params_ptr->algor_param == nullptr) | |
50 | + return false; | |
51 | + | |
52 | + | |
53 | + const unsigned width = right - left; | |
54 | + const unsigned height = bottom - top; | |
55 | + | |
56 | + if (width == 0 || height == 0) | |
57 | + return false; | |
58 | + | |
59 | + //! TODO: use switch to replace. | |
60 | + using data_t = algor_config_param_manned_incident; | |
61 | + data_t *algor_params_ptr = (data_t *) (params_ptr->algor_param); | |
62 | + | |
63 | + if ((width < algor_params_ptr->obj_min_width || height < algor_params_ptr->obj_min_height || score < algor_params_ptr->obj_confidence_threshold)) | |
64 | + return false; | |
65 | + | |
66 | + return true; | |
67 | + } | |
68 | + | |
69 | + vector<tr_point> Mbuild_area(vector<int> args) | |
70 | + { | |
71 | + vector<tr_point> result; | |
72 | + int points_check = args.size(); | |
73 | + //需x y作为一组,是偶数 | |
74 | + if (points_check % 2 == 1) { | |
75 | + LOG_ERROR("points need x and y, but only get one"); | |
76 | + exit(0); | |
77 | + } | |
78 | + | |
79 | + for (int i = 0; i < points_check; i++) { | |
80 | + if (i % 2 == 0) { | |
81 | + tr_point tmp_point; | |
82 | + tmp_point.x = args[i]; | |
83 | + result.push_back(tmp_point); | |
84 | + } | |
85 | + else { | |
86 | + result[result.size() - 1].y = args[i]; | |
87 | + } | |
88 | + } | |
89 | + | |
90 | + return result; | |
91 | + } | |
92 | + | |
93 | + bool McheckPointPolygon(vector<tr_point> tr_boxes, tr_point pCur) { | |
94 | + //任意四边形有4个顶点 | |
95 | + int nCount = tr_boxes.size(); | |
96 | + tr_point RectPoints[MAX_LANE_NUM]; | |
97 | + | |
98 | + // std::cout << "ponits: "; | |
99 | + for (int i = 0; i < nCount; i++) { | |
100 | + RectPoints[i] = tr_boxes[i]; | |
101 | + // std::cout << tr_boxes[i].x << " " << tr_boxes[i].y << " "; | |
102 | + } | |
103 | + // std::cout << std::endl; | |
104 | + | |
105 | + int nCross = 0; | |
106 | + pCur.y += 0.1; | |
107 | + for (int i = 0; i < nCount; i++) { | |
108 | + //依次取相邻的两个点 | |
109 | + tr_point pStart = RectPoints[i]; | |
110 | + tr_point pEnd = RectPoints[(i + 1) % nCount]; | |
111 | + | |
112 | + //相邻的两个点是平行于x轴的,肯定不相交,忽略 | |
113 | + if (pStart.y == pEnd.y) continue; | |
114 | + | |
115 | + //交点在pStart,pEnd的延长线上,pCur肯定不会与pStart.pEnd相交,忽略 | |
116 | + if (pCur.y < min(pStart.y, pEnd.y) || pCur.y > max(pStart.y, pEnd.y)) continue; | |
117 | + | |
118 | + //求当前点和x轴的平行线与pStart,pEnd直线的交点的x坐标 | |
119 | + double x = (double)(pCur.y - pStart.y) * (double)(pEnd.x - pStart.x) / (double)(pEnd.y - pStart.y) + pStart.x; | |
120 | + | |
121 | + //若x坐标大于当前点的坐标,则有交点 | |
122 | + if (x > pCur.x) nCross++; | |
123 | + } | |
124 | + | |
125 | + // 单边交点为偶数,点在多边形之外 | |
126 | + return (nCross % 2 == 1); | |
127 | + } | |
128 | + | |
129 | +#if 0 | |
130 | + void CvtYuvToBgr(sy_img src, sy_img dst) { | |
131 | + const int uvStart = src.w_ * src.h_; | |
132 | + for (int h = 0; h < dst.h_; h++) { | |
133 | + for (int w = 0; w < dst.w_; w++) { | |
134 | + int uvIndex = h / 2 * src.w_ + w - w % 2; | |
135 | + unsigned char y = *(src.data_ + w + h * src.w_); | |
136 | + unsigned char u = *(src.data_ + uvStart + uvIndex); | |
137 | + unsigned char v = *(src.data_ + uvStart + uvIndex + 1); | |
138 | + | |
139 | + int r = (int)(y + 1.402 * (v - 128)); | |
140 | + int g = (int)(y - 0.34414 * (u - 128) - 0.71414 * (v - 128)); | |
141 | + int b = (int)(y + 1.772 * (u -128)); | |
142 | + | |
143 | + if (r > 255) r = 255; | |
144 | + if (g > 255) g = 255; | |
145 | + if (b > 255) b = 255; | |
146 | + if (r < 0) r = 0; | |
147 | + if (g < 0) g = 0; | |
148 | + if (b < 0) b = 0; | |
149 | + *(dst.data_ + h * dst.w_ * 3 + w * 3) = b; | |
150 | + *(dst.data_ + h * dst.w_ * 3 + w * 3 + 1) = g; | |
151 | + *(dst.data_ + h * dst.w_ * 3 + w * 3 + 2) = r; | |
152 | + } | |
153 | + } | |
154 | + } | |
155 | +#endif | |
156 | + | |
157 | + TrafficLightProcess::TrafficLightProcess() | |
158 | + : task_param_manager_(nullptr) | |
159 | + { | |
160 | + | |
161 | + } | |
162 | + | |
163 | + TrafficLightProcess::~TrafficLightProcess() | |
164 | + { | |
165 | + if (tools_) { | |
166 | + traffic_light_release(&tools_); | |
167 | + tools_ = nullptr; | |
168 | + } | |
169 | + if (m_algorthim_ctx) { | |
170 | + aclrtDestroyContext(m_algorthim_ctx); | |
171 | + } | |
172 | + } | |
173 | + | |
174 | + bool TrafficLightProcess::init(int gpu_id, string models_dir) | |
175 | + { | |
176 | + init_ = false; | |
177 | + | |
178 | + string model_path = models_dir + "/models/village/trlight_det_310p.om" ; | |
179 | + LOG_INFO("traffic_light 版本:{} 模型路径:{}", traffic_light_getversion(), model_path); | |
180 | + | |
181 | + traffic_light_param param; | |
182 | + char modelNames[100]; | |
183 | + strcpy(modelNames, model_path.c_str()); | |
184 | + param.modelNames = modelNames; | |
185 | + param.thresld = 0.25; | |
186 | + param.devId = gpu_id; | |
187 | + | |
188 | + m_devId = param.devId; | |
189 | + ACL_CALL(aclrtSetDevice(m_devId), ACL_SUCCESS, -1); | |
190 | + ACL_CALL(aclrtCreateContext(&m_algorthim_ctx, m_devId), ACL_SUCCESS, -1); | |
191 | + | |
192 | + int status; | |
193 | + if (!(init_ = (0 == (status = traffic_light_init(&tools_, param))))) | |
194 | + LOG_ERROR("Init TrafficLightProcessSdk failed error code is {}", status); | |
195 | + else | |
196 | + if (!task_param_manager_) | |
197 | + task_param_manager_ = task_param_manager::getInstance(); | |
198 | + return init_; | |
199 | + } | |
200 | + | |
201 | + | |
202 | + bool TrafficLightProcess::check_initied() | |
203 | + { | |
204 | + if (!init_) | |
205 | + LOG_ERROR("[%s:%d] call init function please.", __FILE__, __LINE__); | |
206 | + return init_; | |
207 | + } | |
208 | + | |
209 | + | |
210 | + void TrafficLightProcess::force_release_result(const task_id_t& task_id) { | |
211 | + for (auto iter = id_to_result_.begin(); iter != id_to_result_.end();) { | |
212 | + const auto& key = iter->first; | |
213 | + if (key.task_id == task_id) { | |
214 | + auto& value = iter->second; | |
215 | + if (value.origin_img_desc != nullptr) { | |
216 | + VPCUtil::vpc_pic_desc_release(value.origin_img_desc); | |
217 | + } | |
218 | + | |
219 | + if (value.roi_img_desc != nullptr) { | |
220 | + VPCUtil::vpc_pic_desc_release(value.roi_img_desc); | |
221 | + } | |
222 | + iter = id_to_result_.erase(iter); | |
223 | + } | |
224 | + else { | |
225 | + ++iter; | |
226 | + } | |
227 | + | |
228 | + } | |
229 | + } | |
230 | + | |
231 | + std::shared_ptr<results_data_t> TrafficLightProcess::get_result_by_objectid(const id_t& id, bool do_erase) | |
232 | + { | |
233 | + auto it = id_to_result_.find(id); | |
234 | + if (it == id_to_result_.end()) | |
235 | + return std::shared_ptr<results_data_t>(nullptr); | |
236 | + std::shared_ptr<results_data_t> res = std::make_shared<results_data_t>(it->second); | |
237 | + if (do_erase) | |
238 | + id_to_result_.erase(id); | |
239 | + return res; | |
240 | + } | |
241 | + | |
242 | + bool TrafficLightProcess::update_mstreams(const std::vector<task_id_t>& taskIds, vector<sy_img> src_interest_imgs, vector<DeviceMemory*> vec_det_input_images, const std::vector<onelevel_det_result> &det_results) | |
243 | + { | |
244 | + if (!check_initied()) | |
245 | + return false; | |
246 | + | |
247 | + if (det_results.empty()) | |
248 | + { | |
249 | + LOG_DEBUG("detection result is empty."); | |
250 | + return false; | |
251 | + } | |
252 | + | |
253 | + struct stream_idx_and_algor_seq_t { | |
254 | + unsigned stream_idx; | |
255 | + std::set<algorithm_type_t> algors; | |
256 | + }; | |
257 | + | |
258 | + int n_images = det_results.size(); // or n_stream | |
259 | + | |
260 | + unsigned flattened_idx = 0; | |
261 | + std::map<int, int> flattened_idx_to_batch_idx; | |
262 | + //! 记录每个box对应的算法以及流id. | |
263 | + std::map<unsigned, stream_idx_and_algor_seq_t> flattened_idx_to_algor_seq; | |
264 | + | |
265 | + /* 1. Crop & keep some interest class. */ | |
266 | + auto taskId_iter = taskIds.begin(); | |
267 | + std::vector<sy_img> flattened_imgs(0); | |
268 | + std::vector<vpc_img_info> flattened_vpc_imgs(0); | |
269 | + std::vector<input_data_wrap_t> flattened_interest_data(0); // | |
270 | + VPCUtil* pVpcUtil = VPCUtil::getInstance(); | |
271 | + for (int n = 0; n < n_images; ++n) | |
272 | + { | |
273 | + int n_interest_obj = 0; | |
274 | + auto& src_img = vec_det_input_images[n]; | |
275 | + int src_img_w = src_img->getWidth(); | |
276 | + int src_img_h = src_img->getHeight(); | |
277 | + | |
278 | + auto& boxes_of_one_image = det_results[n].obj; | |
279 | + for (int i = 0; i < det_results[n].obj_count; ++i) | |
280 | + { | |
281 | + auto& box = boxes_of_one_image[i]; | |
282 | + if (static_cast<det_class_label_t>(box.index) == det_class_label_t::MOTOCYCLE || static_cast<det_class_label_t>(box.index) == det_class_label_t::BICYCLE || static_cast<det_class_label_t>(box.index) == det_class_label_t::HUMAN) | |
283 | + { | |
284 | + auto& taskId = *taskId_iter; | |
285 | + input_data_wrap_t data; | |
286 | + int top = std::max(int(box.top - (IMAGE_CROP_EXPAND_RATIO * box.top)), 0); | |
287 | + int left = std::max(int(box.left - (IMAGE_CROP_EXPAND_RATIO * box.left)), 0); | |
288 | + int right = std::min(int(box.right + (IMAGE_CROP_EXPAND_RATIO * box.right)), src_img_w); | |
289 | + int bottom = std::min(int(box.bottom + (IMAGE_CROP_EXPAND_RATIO * box.bottom)), src_img_h); | |
290 | + | |
291 | + //! loop per algor from set. | |
292 | + stream_idx_and_algor_seq_t stream_idx_and_algor_seq{n, {}}; | |
293 | + std::set<algorithm_type_t> algorithm_type_seq = task_id_to_algorithm_type_seq(taskId, | |
294 | + task_param_manager_); // N(RVO). | |
295 | + | |
296 | + for (auto algor_iter = algorithm_type_seq.begin();algor_iter != algorithm_type_seq.end(); ++algor_iter) { | |
297 | + const algorithm_type_t algor_type = *algor_iter; | |
298 | + auto &&algor_param_wrap = task_param_manager_->get_task_other_param(taskId, algor_type); | |
299 | + if (!algor_param_wrap) { | |
300 | + LOG_ERROR("{} is nullptr when get algor param from task_param", taskId.c_str()); | |
301 | + continue; | |
302 | + } | |
303 | + | |
304 | + if (!is_valid_box(top, left, right, bottom, box.confidence, algor_type, algor_param_wrap)) | |
305 | + continue; | |
306 | + | |
307 | + //DEBUG增加多边形区域选择及判断================================================================ | |
308 | + tr_point curpos; | |
309 | + curpos.x = (left + right) * 0.5; curpos.y = bottom; | |
310 | + vector<int> args = {1552,435,1756,537,1915,537,1915,499,1725,435}; //区域(泰兴黄桥锦润福府路口) | |
311 | + // vector<int> args = {0,0,0,1080,1920,1080,1920,0}; //区域 | |
312 | + vector<tr_point> tr_boxes = Mbuild_area(args); | |
313 | + int cur_flag = McheckPointPolygon(tr_boxes, curpos); //cur_flag==true表示在区域内 | |
314 | + if (!cur_flag) continue; | |
315 | + //DEBUG END================================================================================== | |
316 | + stream_idx_and_algor_seq.algors.emplace(algor_type); | |
317 | + } | |
318 | + | |
319 | + if (stream_idx_and_algor_seq.algors.empty()) | |
320 | + continue; | |
321 | + | |
322 | + int width = right - left; | |
323 | + int height = bottom - top; | |
324 | + | |
325 | + data.box.top = top; data.box.left = left; | |
326 | + data.box.right = right; data.box.bottom = bottom; | |
327 | + data.box.score = box.confidence; data.box.cls = box.index; | |
328 | + data.taskId = taskId; data.objId = box.id; | |
329 | + | |
330 | + // 抠图 | |
331 | + video_object_info obj; | |
332 | + strcpy(obj.task_id, taskId.c_str()); | |
333 | + obj.object_id = box.id; | |
334 | + obj.left = left; obj.top = top; | |
335 | + obj.right = right; obj.bottom = bottom; | |
336 | + | |
337 | + vpc_img_info img_info = pVpcUtil->crop(src_img, obj); | |
338 | + | |
339 | + sy_img img; | |
340 | + img.w_ = width; | |
341 | + img.h_ = height; | |
342 | + img.c_ = src_img->getChannel(); | |
343 | + | |
344 | + if (img_info.pic_desc != nullptr) { | |
345 | + void *outputDataDev = acldvppGetPicDescData(img_info.pic_desc); | |
346 | + img.data_ = reinterpret_cast<unsigned char*>(outputDataDev); | |
347 | + } | |
348 | + else { | |
349 | + LOG_ERROR("Crop image NPU failed wh is [{}, {}] ltrb is [{} {} {} {}]", | |
350 | + src_img_w, src_img_h, data.box.left, data.box.top, data.box.right, data.box.bottom); | |
351 | + continue; | |
352 | + } | |
353 | + | |
354 | + flattened_imgs.emplace_back(std::move(img)); | |
355 | + flattened_vpc_imgs.emplace_back(std::move(img_info)); | |
356 | + flattened_interest_data.emplace_back(std::move(data)); | |
357 | + flattened_idx_to_algor_seq[flattened_idx] = std::move(stream_idx_and_algor_seq); | |
358 | + flattened_idx_to_batch_idx[flattened_idx++] = n; | |
359 | + } | |
360 | + } | |
361 | + ++taskId_iter; | |
362 | + } | |
363 | + | |
364 | + int ret = aclrtSetCurrentContext(m_algorthim_ctx); | |
365 | + if (ACL_SUCCESS != ret) { | |
366 | + return false; | |
367 | + } | |
368 | + /* 2. collection result. */ | |
369 | + int n_input_image = flattened_imgs.size(); | |
370 | + int n_input_src_image = src_interest_imgs.size(); | |
371 | + traffic_light_result model_results[n_input_src_image]; | |
372 | + { | |
373 | + int steps = (n_input_src_image + MAX_BATCH - 1) / MAX_BATCH; | |
374 | + for (int step = 0; step < steps; ++step) | |
375 | + { | |
376 | + int offset = step * MAX_BATCH; | |
377 | + int batch_size = (step == steps - 1) ? n_input_src_image - offset : MAX_BATCH; | |
378 | + traffic_light_process_batch(tools_, src_interest_imgs.data() + offset, batch_size, model_results + offset); | |
379 | + } | |
380 | + } | |
381 | + | |
382 | + /* 3. postprocess. */ | |
383 | + { | |
384 | + for (int n = 0; n < n_input_image; ++n) | |
385 | + { | |
386 | + auto& det_result = flattened_interest_data[n]; | |
387 | + auto& objId = det_result.objId; | |
388 | + auto& task_id = det_result.taskId; | |
389 | + | |
390 | + auto &stream_idx_and_algor_seq = flattened_idx_to_algor_seq[n]; | |
391 | + auto &algors = stream_idx_and_algor_seq.algors; | |
392 | + // auto &steram_idx = stream_idx_and_algor_seq.stream_idx; | |
393 | + | |
394 | + const auto& src_img = vec_det_input_images[flattened_idx_to_batch_idx[n]]; | |
395 | + auto &model_result = model_results[flattened_idx_to_batch_idx[n]]; | |
396 | + int red_cnt = 0; //统计直行红灯个数 | |
397 | + for (unsigned i = 0; i < model_result.objcount; ++i) { | |
398 | + auto &box = model_result.objinfo[i]; | |
399 | + const label_t label = static_cast<label_t>(box.index); | |
400 | + if (!is_valid_label(label)) | |
401 | + continue; | |
402 | + if (box.left < 1200 || box.top < 159 || box.right > 1307 || box.bottom > 212) continue; // 限制红绿灯的出现位置(泰兴黄桥锦润福府路口) | |
403 | + LOG_TRACE("task id is {} obj_id {} label {} index {} score {}", task_id, objId, label, box.index, box.confidence); | |
404 | + red_cnt ++; | |
405 | + } | |
406 | +#if 0 | |
407 | + if (red_cnt > 0) { | |
408 | + sy_img img = src_interest_imgs[flattened_idx_to_batch_idx[n]]; | |
409 | + int dataSize = img.w_ * img.h_ * 3 / 2; | |
410 | + uint8_t* buffer = new uint8_t[dataSize]; | |
411 | + uint8_t* imgBgr = new uint8_t[dataSize]; | |
412 | + aclError aclRet = aclrtMemcpy(buffer, dataSize, img.data_, dataSize, ACL_MEMCPY_DEVICE_TO_HOST); | |
413 | + | |
414 | + sy_img imgyuv_local, tmpbgr; | |
415 | + imgyuv_local.data_ = (unsigned char*)buffer; imgyuv_local.w_ = img.w_; imgyuv_local.h_ = img.h_; | |
416 | + tmpbgr.w_ = img.w_; tmpbgr.h_ = img.h_; tmpbgr.data_ = imgBgr; | |
417 | + CvtYuvToBgr(imgyuv_local, tmpbgr); | |
418 | + | |
419 | + cv::Mat cvImg = cv::Mat(tmpbgr.h_, tmpbgr.w_, CV_8UC3, tmpbgr.data_); | |
420 | + string jpgSaveName1 = "result/oral/" + task_id + "_" + to_string(objId) + ".jpg"; | |
421 | + cv::imwrite(jpgSaveName1, cvImg); | |
422 | + for (unsigned i = 0; i < model_result.objcount; ++i) { | |
423 | + cv::Point lt(model_result.objinfo[i].left, model_result.objinfo[i].top); | |
424 | + cv::Point rb(model_result.objinfo[i].right, model_result.objinfo[i].bottom); | |
425 | + cv::rectangle(cvImg, lt, rb, cv::Scalar(0, 0, 255), 3); | |
426 | + | |
427 | + char buffer[50]; int fontface = cv::FONT_HERSHEY_SIMPLEX; double scale = 0.8; int thickness = 2; int baseline = 0; | |
428 | + snprintf(buffer, sizeof(buffer), "%d:%.2f", model_result.objinfo[i].index, model_result.objinfo[i].confidence); | |
429 | + cv::Size text = cv::getTextSize(buffer, fontface, scale, thickness, &baseline); | |
430 | + cv::putText(cvImg, buffer, lt - cv::Point(0, baseline), fontface, scale, cv::Scalar(0, 0, 255), thickness, 8); | |
431 | + } | |
432 | + string jpgSaveName2 = "result/draw/" + task_id + "_" + to_string(objId) + ".jpg"; | |
433 | + cv::imwrite(jpgSaveName2, cvImg); | |
434 | + | |
435 | + delete[] buffer; buffer = NULL; | |
436 | + delete[] imgBgr; imgBgr = NULL; | |
437 | + } | |
438 | +#endif | |
439 | + | |
440 | + for (auto algor_type_iter = algors.begin();algor_type_iter != algors.end(); ++algor_type_iter) { | |
441 | + const algorithm_type_t algor_type = *algor_type_iter; | |
442 | + | |
443 | + auto &&algor_param_wrap = task_param_manager_->get_task_other_param(task_id, algor_type); | |
444 | + if (!algor_param_wrap) { | |
445 | + LOG_ERROR("{} is nullptr when get algor param from task_param", task_id); | |
446 | + continue; | |
447 | + } | |
448 | + auto algor_param = ((algor_param_type)algor_param_wrap->algor_param); | |
449 | + | |
450 | + id_t obj_key = obj_key_t{ objId, task_id, algor_type}; | |
451 | + if (id_to_result_.find(obj_key) != id_to_result_.end()) | |
452 | + continue; | |
453 | + | |
454 | + // LOG_TRACE("task id is {} algor type is {} obj_id {}", task_id, int(algor_type), objId); | |
455 | + if (algor_type == algorithm_type_t::PERSON_RUNNING_REDLIGHTS && static_cast<det_class_label_t>(det_result.box.cls) != det_class_label_t::HUMAN) | |
456 | + continue; | |
457 | + if (algor_type == algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS && (static_cast<det_class_label_t>(det_result.box.cls) != det_class_label_t::MOTOCYCLE || | |
458 | + static_cast<det_class_label_t>(det_result.box.cls) != det_class_label_t::BICYCLE)) | |
459 | + continue; | |
460 | + | |
461 | + auto& e = id_to_mn_[obj_key]; | |
462 | + ++e.m_frame; | |
463 | + | |
464 | + // 数量小于设定阈值不报警 | |
465 | + if (red_cnt < 1) | |
466 | + continue; | |
467 | + | |
468 | + { | |
469 | + if (++e.n_frame == algor_param->n) | |
470 | + { | |
471 | + results_data_t result; | |
472 | + { LOG_TRACE("task id is {} obj_id {} red_cnt {}", task_id, det_result.objId, red_cnt); | |
473 | + result.box = det_result.box; | |
474 | + result.taskId = det_result.taskId; | |
475 | + result.objId = det_result.objId; | |
476 | + result.algor_type = algor_type; | |
477 | + // 原图 | |
478 | + vpc_img_info src_img_info = VPCUtil::vpc_devMem2vpcImg(src_img); | |
479 | + result.origin_img_desc = src_img_info.pic_desc; | |
480 | + // 抠图--拷贝后赋值 | |
481 | + void *outputDataDev = acldvppGetPicDescData(flattened_vpc_imgs[n].pic_desc); | |
482 | + int nBufferSize = acldvppGetPicDescSize(flattened_vpc_imgs[n].pic_desc); | |
483 | + | |
484 | + void *devBuffer = nullptr; | |
485 | + auto ret = acldvppMalloc(&devBuffer, nBufferSize); | |
486 | + if (ret != ACL_SUCCESS) { | |
487 | + LOG_ERROR("acldvppMalloc failed, size = %u, errorCode = %d.", nBufferSize, static_cast<int32_t>(ret)); | |
488 | + return false; | |
489 | + } | |
490 | + aclrtMemcpy(devBuffer, nBufferSize, outputDataDev, nBufferSize, ACL_MEMCPY_DEVICE_TO_DEVICE); | |
491 | + | |
492 | + acldvppPicDesc *vpcInputDesc_= acldvppCreatePicDesc(); | |
493 | + acldvppSetPicDescData(vpcInputDesc_, devBuffer); | |
494 | + acldvppSetPicDescFormat(vpcInputDesc_, PIXEL_FORMAT_YUV_SEMIPLANAR_420); | |
495 | + acldvppSetPicDescWidth(vpcInputDesc_, acldvppGetPicDescWidth(flattened_vpc_imgs[n].pic_desc)); | |
496 | + acldvppSetPicDescHeight(vpcInputDesc_, acldvppGetPicDescHeight(flattened_vpc_imgs[n].pic_desc)); | |
497 | + acldvppSetPicDescWidthStride(vpcInputDesc_, acldvppGetPicDescWidthStride(flattened_vpc_imgs[n].pic_desc)); | |
498 | + acldvppSetPicDescHeightStride(vpcInputDesc_, acldvppGetPicDescHeightStride(flattened_vpc_imgs[n].pic_desc)); | |
499 | + acldvppSetPicDescSize(vpcInputDesc_, nBufferSize); | |
500 | + | |
501 | + result.roi_img_desc = vpcInputDesc_; //需复制 | |
502 | + } | |
503 | + id_to_result_.emplace(obj_key, std::move(result)); | |
504 | + } | |
505 | + } | |
506 | + | |
507 | + if (e.m_frame == algor_param->m) | |
508 | + e.reset(); | |
509 | + | |
510 | + } | |
511 | + | |
512 | + VPCUtil::vpc_img_release(flattened_vpc_imgs[n]); //flattened_imgs[n].data_ | |
513 | + | |
514 | + } | |
515 | + } | |
516 | + | |
517 | + return true; | |
518 | + } | |
519 | + | |
520 | + } // namespace traffic_light_process | |
521 | + | |
522 | +} // namespace ai_engine_module | |
523 | + | ... | ... |
src/ai_engine_module/traffic_light_process.h
0 → 100644
1 | +#pragma once | |
2 | +#include <deque> | |
3 | +#include <map> | |
4 | +#include <vector> | |
5 | +#include <memory> | |
6 | +#include "../util/vpc_util.h" | |
7 | +#include "../ai_platform/task_param_manager.h" | |
8 | +#include "../ai_platform/macro_definition.h" | |
9 | +#include "ai_engine_header.h" | |
10 | +#include "traffic_light_det.h" | |
11 | +#include "acl/acl.h" | |
12 | +#include "acl/ops/acl_dvpp.h" | |
13 | + | |
14 | +#define MAX_BATCH 20 | |
15 | +#define IMAGE_CROP_EXPAND_RATIO 0 | |
16 | +#define MAX_OBJ_BOX_COUNT 100 | |
17 | +#define MAX_LANE_NUM 100 | |
18 | + | |
19 | +namespace ai_engine_module | |
20 | +{ | |
21 | + namespace traffic_light_process | |
22 | + { | |
23 | + // typedef long id_t; | |
24 | + using id_t = obj_key_t; | |
25 | + using task_id_t = std::string; | |
26 | + using algor_param_type = algor_config_param_manned_incident*; | |
27 | + | |
28 | + enum class label_t { | |
29 | + PLACEHOLDER = -1, | |
30 | + red = 0, //直行红灯 | |
31 | + green = 1, //直行绿灯 | |
32 | + yellow = 2, //直行黄灯 | |
33 | + wred = 3, //转向红灯 | |
34 | + wgreen = 4, //转向绿灯 | |
35 | + wyellow = 5, //转向黄灯 | |
36 | + pred = 6, //行人红灯 | |
37 | + pyellow = 7, //行人黄灯 | |
38 | + pgreen = 8, //行人绿灯 | |
39 | + bred = 9, //自行车红灯 | |
40 | + byellow = 10, //自行车黄灯 | |
41 | + bgreen = 11, //自行车绿灯 | |
42 | + no = 12, //灭灯 | |
43 | + }; | |
44 | + | |
45 | + typedef struct input_data_wrap_t | |
46 | + { | |
47 | + id_t id; | |
48 | + long objId; | |
49 | + std::string taskId; | |
50 | + box_t box; | |
51 | + } input_data_wrap_t; | |
52 | + | |
53 | + typedef struct tr_point { | |
54 | + float x, y; | |
55 | + }tr_point; | |
56 | + | |
57 | + | |
58 | + typedef struct mn_frame_t | |
59 | + { | |
60 | + uint m_frame; | |
61 | + uint n_frame; | |
62 | + | |
63 | + // explicit | |
64 | + mn_frame_t(uint m = 0, uint n = 0) | |
65 | + : m_frame(m) | |
66 | + , n_frame(n) | |
67 | + {} | |
68 | + | |
69 | + void reset() | |
70 | + { | |
71 | + m_frame = 0; | |
72 | + n_frame = 0; | |
73 | + } | |
74 | + | |
75 | + } mn_frame_t; | |
76 | + | |
77 | + | |
78 | + typedef struct results_data_t | |
79 | + { | |
80 | + box_t box; | |
81 | + acldvppPicDesc* origin_img_desc{nullptr}; | |
82 | + acldvppPicDesc* roi_img_desc{nullptr}; | |
83 | + id_t id; | |
84 | + long objId; | |
85 | + std::string taskId; | |
86 | + algorithm_type_t algor_type; | |
87 | + } results_data_t; | |
88 | + | |
89 | + class TrafficLightProcess | |
90 | + { | |
91 | + /** | |
92 | + * @brief | |
93 | + * 1. move able | |
94 | + */ | |
95 | + public: | |
96 | + TrafficLightProcess(); | |
97 | + | |
98 | + ~TrafficLightProcess(); | |
99 | + | |
100 | + bool check_initied(); | |
101 | + bool init(int gpu_id, string models_dir); | |
102 | + bool update_mstreams(const std::vector<task_id_t>& taskIds, vector<sy_img> src_interest_imgs, vector<DeviceMemory*> vec_det_input_images, const std::vector<onelevel_det_result> &det_results); | |
103 | + std::shared_ptr<results_data_t> get_result_by_objectid(const id_t& id, bool do_erase = true); | |
104 | + | |
105 | + void force_release_result(const task_id_t& task_id); | |
106 | + | |
107 | + TrafficLightProcess(const TrafficLightProcess&) = delete; | |
108 | + TrafficLightProcess& operator=(const TrafficLightProcess&) = delete; | |
109 | + | |
110 | + private: | |
111 | + static algorithm_type_t algor_type_; | |
112 | + int m_devId; | |
113 | + aclrtContext m_algorthim_ctx; | |
114 | + | |
115 | + bool init_; | |
116 | + void* tools_; | |
117 | + task_param_manager* task_param_manager_; | |
118 | + std::map<id_t, mn_frame_t> id_to_mn_; | |
119 | + std::map<id_t, results_data_t> id_to_result_; | |
120 | + }; | |
121 | + } // namespace traffic_light_process | |
122 | +} // namespace ai_engine_module | |
123 | + | ... | ... |
src/ai_engine_module/truck_manned_process.cpp
... | ... | @@ -12,6 +12,28 @@ namespace ai_engine_module |
12 | 12 | { |
13 | 13 | algorithm_type_t TruckMannedProcess::algor_type_ = algorithm_type_t::TRUCK_MANNED; |
14 | 14 | |
15 | + int legal_person_motocycle_inarea(const std::vector<input_data_wrap_t>& person_motocycle_data, int left, int top, int right, int bottom) { | |
16 | + int legal_person_motocycle_count = 0; | |
17 | + for (const auto& det_result : person_motocycle_data) { | |
18 | + int x1_intersection = std::max(det_result.box.left, left); | |
19 | + int y1_intersection = std::max(det_result.box.top, top); | |
20 | + int x2_intersection = std::min(det_result.box.right, right); | |
21 | + int y2_intersection = std::min(det_result.box.bottom, bottom); | |
22 | + | |
23 | + if (x2_intersection <= x1_intersection || y2_intersection <= y1_intersection) continue; // 没有交集 | |
24 | + float area_a = float(det_result.box.right - det_result.box.left) * float(det_result.box.bottom - det_result.box.top); | |
25 | + float area_b = float(right - left) * float(bottom - top); | |
26 | + float area_intersection = float(x2_intersection - x1_intersection) * float(y2_intersection - y1_intersection); | |
27 | + | |
28 | + if (area_a > area_b || area_a <= 0) continue; //暂不考虑非机动车目标比货车大的情况 | |
29 | + // float iou = area_intersection / (area_a + area_b - area_intersection); | |
30 | + float small_overlap_ratio = area_intersection / area_a; //计算非机动车目标相对于自身的重叠程度 | |
31 | + if (small_overlap_ratio > 0.2) legal_person_motocycle_count ++; | |
32 | + } | |
33 | + return legal_person_motocycle_count; | |
34 | + | |
35 | + } | |
36 | + | |
15 | 37 | TruckMannedProcess::TruckMannedProcess() |
16 | 38 | : task_param_manager_(nullptr) |
17 | 39 | { |
... | ... | @@ -127,6 +149,34 @@ namespace ai_engine_module |
127 | 149 | int src_img_h = src_img->getHeight(); |
128 | 150 | |
129 | 151 | auto& boxes_of_one_image = det_results[n].obj; |
152 | + | |
153 | + //汇总当前帧的行人/非机动车目标 | |
154 | + std::vector<input_data_wrap_t> person_motocycle_data(0); | |
155 | + for (int i = 0; i < det_results[n].obj_count; ++i) | |
156 | + { | |
157 | + auto& box = boxes_of_one_image[i]; | |
158 | + if (static_cast<det_class_label_t>(box.index) == det_class_label_t::MOTOCYCLE || static_cast<det_class_label_t>(box.index) == det_class_label_t::BICYCLE || | |
159 | + static_cast<det_class_label_t>(box.index) == det_class_label_t::HUMAN || static_cast<det_class_label_t>(box.index) == det_class_label_t::TRICYCLE) | |
160 | + { | |
161 | + auto& taskId = *taskId_iter; | |
162 | + input_data_wrap_t data; | |
163 | + int top = std::max(int(box.top), 0); int left = std::max(int(box.left), 0); | |
164 | + int right = std::min(int(box.right), src_img_w); int bottom = std::min(int(box.bottom), src_img_h); | |
165 | + int width = right - left; int height = bottom - top; | |
166 | + | |
167 | + if (static_cast<det_class_label_t>(box.index) == det_class_label_t::HUMAN && width >= 0.9*height) //基于载人只能看到半身的假设 | |
168 | + continue; | |
169 | + | |
170 | + data.box.top = top; data.box.left = left; | |
171 | + data.box.right = right; data.box.bottom = bottom; | |
172 | + data.box.score = box.confidence; data.box.cls = box.index; | |
173 | + data.taskId = taskId; data.objId = box.id; | |
174 | + | |
175 | + person_motocycle_data.emplace_back(std::move(data)); | |
176 | + } | |
177 | + } | |
178 | + | |
179 | + | |
130 | 180 | for (int i = 0; i < det_results[n].obj_count; ++i) |
131 | 181 | { |
132 | 182 | auto& box = boxes_of_one_image[i]; |
... | ... | @@ -154,14 +204,15 @@ namespace ai_engine_module |
154 | 204 | !snapshot_legal_inarea(algor_param_wrap->basic_param->algor_valid_rect, left, top, right, bottom)) |
155 | 205 | continue; |
156 | 206 | |
157 | - data.box.top = top; | |
158 | - data.box.left = left; | |
159 | - data.box.right = right; | |
160 | - data.box.bottom = bottom; | |
207 | + //统计货车检测框内行人及非机动车的数量 | |
208 | + int person_motocycle_inarea = legal_person_motocycle_inarea(person_motocycle_data, left, top, right, bottom); | |
209 | + | |
210 | + data.box.top = top; data.box.left = left; | |
211 | + data.box.right = right; data.box.bottom = bottom; | |
161 | 212 | data.box.score = box.confidence; |
162 | - data.taskId = taskId; | |
163 | - data.objId = box.id; | |
213 | + data.taskId = taskId; data.objId = box.id; | |
164 | 214 | data.id = obj_key_t{ box.id, taskId, algorithm_type_t::TRUCK_MANNED }; |
215 | + data.person_motocycle_cnt = person_motocycle_inarea; | |
165 | 216 | |
166 | 217 | // 抠图 |
167 | 218 | video_object_info obj; |
... | ... | @@ -193,6 +244,7 @@ namespace ai_engine_module |
193 | 244 | flattened_idx_to_batch_idx[flattened_idx++] = n; |
194 | 245 | } |
195 | 246 | } |
247 | + std::vector<input_data_wrap_t>().swap(person_motocycle_data); | |
196 | 248 | ++taskId_iter; |
197 | 249 | } |
198 | 250 | |
... | ... | @@ -246,7 +298,8 @@ namespace ai_engine_module |
246 | 298 | auto& e = id_to_mn_[obj_key]; |
247 | 299 | ++e.m_frame; |
248 | 300 | |
249 | - if (hs_count >= algor_param->hs_count_threshold) | |
301 | + // if (hs_count >= algor_param->hs_count_threshold) | |
302 | + if (hs_count - det_result.person_motocycle_cnt >= algor_param->hs_count_threshold) //头肩数量去除包含的行人和非机动车数量 | |
250 | 303 | { |
251 | 304 | if (++e.n_frame == algor_param->n) |
252 | 305 | { | ... | ... |
src/ai_engine_module/truck_manned_process.h
src/ai_platform/MultiSourceProcess.cpp
... | ... | @@ -195,6 +195,11 @@ int CMultiSourceProcess::InitAlgorthim(tsl_aiplatform_param vptParam){ |
195 | 195 | LOG_FATAL("Init motor_refit failed"); |
196 | 196 | return -1; |
197 | 197 | } |
198 | + // 行人/二轮车闯红灯 | |
199 | + if (!traffic_lightprocess_.init(vptParam.gpuid, models_dir)) { | |
200 | + LOG_FATAL("Init traffic_light failed"); | |
201 | + return -1; | |
202 | + } | |
198 | 203 | #endif |
199 | 204 | |
200 | 205 | #ifdef WITH_FACE_DET_SS |
... | ... | @@ -711,6 +716,7 @@ bool CMultiSourceProcess::finish_task(const string taskID, const bool delete_sna |
711 | 716 | motor_refit_phoneprocess_.force_release_result(taskID); |
712 | 717 | // motor_phoneprocess_.force_release_result(taskID); |
713 | 718 | motor_refitprocess_.force_release_result(taskID); |
719 | + traffic_lightprocess_.force_release_result(taskID); | |
714 | 720 | |
715 | 721 | m_task_param_manager->delete_task_param(taskID); |
716 | 722 | #endif |
... | ... | @@ -905,6 +911,8 @@ int CMultiSourceProcess::algorthim_vpt(vector<DeviceMemory*> vec_gpuMem){ |
905 | 911 | algorithm_motor_phone_process(vpt_interest_task_id, vec_vptMem, vptResult);*/ |
906 | 912 | // 电动车改装(加雨棚) |
907 | 913 | algorithm_motor_refit_process(vpt_interest_task_id, vec_vptMem, vptResult); |
914 | + // 行人/二轮车闯红灯 | |
915 | + algorithm_traffic_light_process(vpt_interest_task_id, vec_vptMem, vptResult); | |
908 | 916 | village_snapshot(vpt_interest_task_id, vec_vptMem, deleteObjectID); |
909 | 917 | #endif |
910 | 918 | |
... | ... | @@ -1439,6 +1447,42 @@ void CMultiSourceProcess::algorithm_motor_refit_process(vector<string>& vpt_inte |
1439 | 1447 | } |
1440 | 1448 | } |
1441 | 1449 | |
1450 | + | |
1451 | +// 行人/二轮车闯红灯 | |
1452 | +void CMultiSourceProcess::algorithm_traffic_light_process(vector<string>& vpt_interest_task_id, vector<DeviceMemory*> vpt_interest_imgs, | |
1453 | + vector<onelevel_det_result>& vptResult) { | |
1454 | + | |
1455 | + vector<string> interest_task_id; | |
1456 | + vector<onelevel_det_result> interest_vpt_result; | |
1457 | + vector<DeviceMemory*> interest_imgs; | |
1458 | + vector<sy_img> sy_interest_imgs; | |
1459 | + | |
1460 | + int _idx = 0; | |
1461 | + for (auto _task_id_iter = vpt_interest_task_id.begin(); _task_id_iter != vpt_interest_task_id.end(); | |
1462 | + ++_task_id_iter, ++_idx) // loop task_id; | |
1463 | + { | |
1464 | + auto task_id = *_task_id_iter; | |
1465 | + auto algor_map = m_task_param_manager->get_task_other_param(task_id); | |
1466 | + | |
1467 | + if (algor_map->find(algorithm_type_t::PERSON_RUNNING_REDLIGHTS) != algor_map->end() || | |
1468 | + algor_map->find(algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS) != algor_map->end()) { | |
1469 | + DeviceMemory* mem = vpt_interest_imgs[_idx]; | |
1470 | + sy_img img; | |
1471 | + img.w_ = mem->getWidth(); img.h_ = mem->getHeight(); | |
1472 | + img.c_ = mem->getChannel(); img.data_ = mem->getMem(); | |
1473 | + sy_interest_imgs.push_back(img); | |
1474 | + | |
1475 | + interest_task_id.emplace_back(task_id); | |
1476 | + interest_imgs.emplace_back(vpt_interest_imgs[_idx]); | |
1477 | + interest_vpt_result.emplace_back(vptResult[_idx]); | |
1478 | + } | |
1479 | + } | |
1480 | + | |
1481 | + if (!interest_imgs.empty()){ | |
1482 | + traffic_lightprocess_.update_mstreams(interest_task_id, sy_interest_imgs, interest_imgs, interest_vpt_result); | |
1483 | + } | |
1484 | +} | |
1485 | + | |
1442 | 1486 | // for snapshot algorithm. 轨迹结束目标 做最后的结果返回(当前返回算法结果+快照保存路径) |
1443 | 1487 | void CMultiSourceProcess::village_snapshot(vector<string>& vpt_interest_task_id, vector<DeviceMemory*> vec_vptMem, vector<vector<int>> deleteObjectID) { |
1444 | 1488 | auto task_iter = vpt_interest_task_id.begin(); |
... | ... | @@ -1472,8 +1516,7 @@ void CMultiSourceProcess::village_snapshot(vector<string>& vpt_interest_task_id, |
1472 | 1516 | auto json_str = helpers::gen_json::gen_manned_json(obj_key.video_id, obj_key.obj_id, result->box, algorithm_type_t::TRICYCLE_MANNED); |
1473 | 1517 | save_snapshot_process(obj_key, algorithm_type_t::TRICYCLE_MANNED, src_img, roi_img, 0, json_str); |
1474 | 1518 | } else { |
1475 | - VPCUtil::vpc_img_release(src_img); | |
1476 | - VPCUtil::vpc_img_release(roi_img); | |
1519 | + VPCUtil::vpc_img_release(src_img); VPCUtil::vpc_img_release(roi_img); | |
1477 | 1520 | } |
1478 | 1521 | |
1479 | 1522 | } |
... | ... | @@ -1496,8 +1539,7 @@ void CMultiSourceProcess::village_snapshot(vector<string>& vpt_interest_task_id, |
1496 | 1539 | auto json_str = helpers::gen_json::gen_manned_json(obj_key.video_id, obj_key.obj_id, result->box, algorithm_type_t::TRUCK_MANNED); |
1497 | 1540 | save_snapshot_process(obj_key, algorithm_type_t::TRUCK_MANNED, src_img, roi_img, 0, json_str); |
1498 | 1541 | } else { |
1499 | - VPCUtil::vpc_img_release(src_img); | |
1500 | - VPCUtil::vpc_img_release(roi_img); | |
1542 | + VPCUtil::vpc_img_release(src_img); VPCUtil::vpc_img_release(roi_img); | |
1501 | 1543 | } |
1502 | 1544 | |
1503 | 1545 | } |
... | ... | @@ -1520,8 +1562,7 @@ void CMultiSourceProcess::village_snapshot(vector<string>& vpt_interest_task_id, |
1520 | 1562 | auto json_str = helpers::gen_json::gen_manned_json(obj_key.video_id, obj_key.obj_id, result->box, algorithm_type_t::NONMOTOR_VEHICLE_NOHELMET); |
1521 | 1563 | save_snapshot_process(obj_key, algorithm_type_t::NONMOTOR_VEHICLE_NOHELMET, src_img, roi_img, 0, json_str); |
1522 | 1564 | } else { |
1523 | - VPCUtil::vpc_img_release(src_img); | |
1524 | - VPCUtil::vpc_img_release(roi_img); | |
1565 | + VPCUtil::vpc_img_release(src_img); VPCUtil::vpc_img_release(roi_img); | |
1525 | 1566 | } |
1526 | 1567 | |
1527 | 1568 | } |
... | ... | @@ -1544,8 +1585,7 @@ void CMultiSourceProcess::village_snapshot(vector<string>& vpt_interest_task_id, |
1544 | 1585 | auto json_str = helpers::gen_json::gen_manned_json(obj_key.video_id, obj_key.obj_id, result->box, algorithm_type_t::NONMOTOR_VEHICLE_OVERMAN); |
1545 | 1586 | save_snapshot_process(obj_key, algorithm_type_t::NONMOTOR_VEHICLE_OVERMAN, src_img, roi_img, 0, json_str); |
1546 | 1587 | } else { |
1547 | - VPCUtil::vpc_img_release(src_img); | |
1548 | - VPCUtil::vpc_img_release(roi_img); | |
1588 | + VPCUtil::vpc_img_release(src_img); VPCUtil::vpc_img_release(roi_img); | |
1549 | 1589 | } |
1550 | 1590 | |
1551 | 1591 | } |
... | ... | @@ -1569,8 +1609,7 @@ void CMultiSourceProcess::village_snapshot(vector<string>& vpt_interest_task_id, |
1569 | 1609 | auto json_str = helpers::gen_json::gen_manned_json(obj_key.video_id, obj_key.obj_id, result->box, algorithm_type_t::NONMOTOR_VEHICLE_USEPHONE); |
1570 | 1610 | save_snapshot_process(obj_key, algorithm_type_t::NONMOTOR_VEHICLE_USEPHONE, src_img, roi_img, 0, json_str); |
1571 | 1611 | } else { |
1572 | - VPCUtil::vpc_img_release(src_img); | |
1573 | - VPCUtil::vpc_img_release(roi_img); | |
1612 | + VPCUtil::vpc_img_release(src_img); VPCUtil::vpc_img_release(roi_img); | |
1574 | 1613 | } |
1575 | 1614 | |
1576 | 1615 | } |
... | ... | @@ -1594,8 +1633,53 @@ void CMultiSourceProcess::village_snapshot(vector<string>& vpt_interest_task_id, |
1594 | 1633 | auto json_str = helpers::gen_json::gen_manned_json(obj_key.video_id, obj_key.obj_id, result->box, algorithm_type_t::NONMOTOR_VEHICLE_REFIT); |
1595 | 1634 | save_snapshot_process(obj_key, algorithm_type_t::NONMOTOR_VEHICLE_REFIT, src_img, roi_img, 0, json_str); |
1596 | 1635 | } else { |
1597 | - VPCUtil::vpc_img_release(src_img); | |
1598 | - VPCUtil::vpc_img_release(roi_img); | |
1636 | + VPCUtil::vpc_img_release(src_img); VPCUtil::vpc_img_release(roi_img); | |
1637 | + } | |
1638 | + | |
1639 | + } | |
1640 | + } | |
1641 | + | |
1642 | + if (task_param_ptr->nonmotor_vehicle_algors.find(algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS) != task_param_ptr->nonmotor_vehicle_algors.end()) { | |
1643 | + const auto &algor_other_params = task_other_params->find(algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS); | |
1644 | + const algor_basic_config_param_t *basic_param = algor_other_params->second->basic_param; | |
1645 | + | |
1646 | + auto result = traffic_lightprocess_.get_result_by_objectid(ai_engine_module::obj_key_t{obj_key.obj_id, obj_key.video_id, algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS}); | |
1647 | + if (result.get()) { | |
1648 | + village_alarm = true; | |
1649 | + algorithm_types.push_back((int)algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS); | |
1650 | + video_folder = basic_param->video_folder; result_folder = basic_param->result_folder; result_folder_little = basic_param->result_folder_little; | |
1651 | + // 原图及抠图 | |
1652 | + vpc_img_info src_img; src_img.pic_desc = result->origin_img_desc; src_img.task_id = obj_key.video_id; | |
1653 | + vpc_img_info roi_img; roi_img.pic_desc = result->roi_img_desc; roi_img.task_id = obj_key.video_id; roi_img.object_id = obj_key.obj_id; | |
1654 | + | |
1655 | + if (save_single_algor_pic) { | |
1656 | + auto json_str = helpers::gen_json::gen_manned_json(obj_key.video_id, obj_key.obj_id, result->box, algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS); | |
1657 | + save_snapshot_process(obj_key, algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS, src_img, roi_img, 0, json_str); | |
1658 | + } else { | |
1659 | + VPCUtil::vpc_img_release(src_img); VPCUtil::vpc_img_release(roi_img); | |
1660 | + } | |
1661 | + | |
1662 | + } | |
1663 | + } | |
1664 | + | |
1665 | + if (task_param_ptr->human_algors.find(algorithm_type_t::PERSON_RUNNING_REDLIGHTS) != task_param_ptr->human_algors.end()) { | |
1666 | + const auto &algor_other_params = task_other_params->find(algorithm_type_t::PERSON_RUNNING_REDLIGHTS); | |
1667 | + const algor_basic_config_param_t *basic_param = algor_other_params->second->basic_param; | |
1668 | + | |
1669 | + auto result = traffic_lightprocess_.get_result_by_objectid(ai_engine_module::obj_key_t{obj_key.obj_id, obj_key.video_id, algorithm_type_t::PERSON_RUNNING_REDLIGHTS}); | |
1670 | + if (result.get()) { | |
1671 | + village_alarm = true; | |
1672 | + algorithm_types.push_back((int)algorithm_type_t::PERSON_RUNNING_REDLIGHTS); | |
1673 | + video_folder = basic_param->video_folder; result_folder = basic_param->result_folder; result_folder_little = basic_param->result_folder_little; | |
1674 | + // 原图及抠图 | |
1675 | + vpc_img_info src_img; src_img.pic_desc = result->origin_img_desc; src_img.task_id = obj_key.video_id; | |
1676 | + vpc_img_info roi_img; roi_img.pic_desc = result->roi_img_desc; roi_img.task_id = obj_key.video_id; roi_img.object_id = obj_key.obj_id; | |
1677 | + | |
1678 | + if (save_single_algor_pic) { | |
1679 | + auto json_str = helpers::gen_json::gen_manned_json(obj_key.video_id, obj_key.obj_id, result->box, algorithm_type_t::PERSON_RUNNING_REDLIGHTS); | |
1680 | + save_snapshot_process(obj_key, algorithm_type_t::PERSON_RUNNING_REDLIGHTS, src_img, roi_img, 0, json_str); | |
1681 | + } else { | |
1682 | + VPCUtil::vpc_img_release(src_img); VPCUtil::vpc_img_release(roi_img); | |
1599 | 1683 | } |
1600 | 1684 | |
1601 | 1685 | } |
... | ... | @@ -1966,7 +2050,7 @@ bool CMultiSourceProcess::CheckTime() { |
1966 | 2050 | nYear = info->tm_year + 1900; |
1967 | 2051 | nMonth = info->tm_mon + 1; |
1968 | 2052 | nDay = info->tm_mday; |
1969 | - if ((nYear == 2023 && nMonth <= 9) || (nYear == 2023 && nMonth <= 10 && nDay <= 31)) | |
2053 | + if ((nYear == 2023 && nMonth <= 10) || (nYear == 2023 && nMonth <= 11 && nDay <= 30)) | |
1970 | 2054 | { |
1971 | 2055 | return true; |
1972 | 2056 | } | ... | ... |
src/ai_platform/MultiSourceProcess.h
... | ... | @@ -12,16 +12,7 @@ |
12 | 12 | #include "task_param_manager.h" |
13 | 13 | #include "../reprocessing_module/snapshot_reprocessing.h" |
14 | 14 | #include "../reprocessing_module/save_snapshot_reprocessing.h" |
15 | -#include "../ai_engine_module/VPTProcess.h" | |
16 | -#include "../ai_engine_module/face_det_ai_engine.h" | |
17 | -#include "../ai_engine_module/pedestrian_vehicle_retrograde.h" | |
18 | -#include "../ai_engine_module/pedestrian_vehicle_trespass.h" | |
19 | -#include "../ai_engine_module/tricycle_manned_process.h" | |
20 | -#include "../ai_engine_module/truck_manned_process.h" | |
21 | -#include "../ai_engine_module/motocycle_hs_process.h" | |
22 | -#include "../ai_engine_module/motocycle_refit_phone_process.h" | |
23 | -#include "../ai_engine_module/motocycle_phone_process.h" | |
24 | -#include "../ai_engine_module/motocycle_refit_process.h" | |
15 | +#include "../ai_engine_module/ai_engine_module.h" | |
25 | 16 | #include "../util/JpegUtil.h" |
26 | 17 | #include "atlas_licence.h"//授权文件 |
27 | 18 | |
... | ... | @@ -84,6 +75,8 @@ private: |
84 | 75 | void algorithm_motor_phone_process(vector<string>& vpt_interest_task_id, vector<DeviceMemory*> vpt_interest_imgs, vector<onelevel_det_result>& vptResult); |
85 | 76 | // 电动车改装(加雨棚) |
86 | 77 | void algorithm_motor_refit_process(vector<string>& vpt_interest_task_id, vector<DeviceMemory*> vpt_interest_imgs, vector<onelevel_det_result>& vptResult); |
78 | + // 行人/二轮车闯红灯 | |
79 | + void algorithm_traffic_light_process(vector<string>& vpt_interest_task_id, vector<DeviceMemory*> vpt_interest_imgs, vector<onelevel_det_result>& vptResult); | |
87 | 80 | |
88 | 81 | |
89 | 82 | private: |
... | ... | @@ -152,6 +145,7 @@ private: |
152 | 145 | ai_engine_module::motocycle_refit_phone_process::MotorRefitPhoneProcess motor_refit_phoneprocess_; |
153 | 146 | // ai_engine_module::motocycle_phone_process::MotorPhoneProcess motor_phoneprocess_; |
154 | 147 | ai_engine_module::motocycle_refit_process::MotorRefitProcess motor_refitprocess_; |
148 | + ai_engine_module::traffic_light_process::TrafficLightProcess traffic_lightprocess_; | |
155 | 149 | |
156 | 150 | face_det_ai_engine m_face_det_ai_engine; // 人脸检测 |
157 | 151 | ... | ... |
src/ai_platform/header.h
... | ... | @@ -46,7 +46,9 @@ enum class algorithm_type_t { |
46 | 46 | TRICYCLE_MANNED = 503, // 三轮车载人 |
47 | 47 | TRUCK_MANNED = 504, // 货车货箱载人 |
48 | 48 | NONMOTOR_VEHICLE_USEPHONE = 505,// 电动/摩托车驾乘人员使用手机 |
49 | - NONMOTOR_VEHICLE_REFIT = 506, // 电动车改装(加雨棚) | |
49 | + NONMOTOR_VEHICLE_REFIT = 506, // 电动车改装(加雨棚) | |
50 | + PERSON_RUNNING_REDLIGHTS = 507, // 行人闯红灯 | |
51 | + NONMOTOR_RUNNING_REDLIGHTS = 508, // 非机动车闯红灯 | |
50 | 52 | }; |
51 | 53 | |
52 | 54 | ... | ... |
src/ai_platform/task_param_manager.cpp
... | ... | @@ -58,9 +58,15 @@ bool copy_algor_param_aux(const algorithm_type_t &algor_type, const std::string |
58 | 58 | case algorithm_type_t::NONMOTOR_VEHICLE_REFIT: |
59 | 59 | m_algor_config_params[task_id].nonmotor_vehicle_algors.insert(algor_type); |
60 | 60 | goto _manned_param_copy; |
61 | + case algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS: | |
62 | + m_algor_config_params[task_id].nonmotor_vehicle_algors.insert(algor_type); | |
63 | + goto _manned_param_copy; | |
61 | 64 | case algorithm_type_t::TRICYCLE_MANNED: |
62 | 65 | m_algor_config_params[task_id].nonmotor_vehicle_algors.insert(algor_type); |
63 | 66 | goto _manned_param_copy; |
67 | + case algorithm_type_t::PERSON_RUNNING_REDLIGHTS: | |
68 | + m_algor_config_params[task_id].human_algors.insert(algor_type); | |
69 | + goto _manned_param_copy; | |
64 | 70 | case algorithm_type_t::TRUCK_MANNED: { |
65 | 71 | m_algor_config_params[task_id].vehicle_algors.insert(algor_type); |
66 | 72 | _manned_param_copy : { | ... | ... |
src/demo/Makefile
... | ... | @@ -33,7 +33,7 @@ lib_dir=-L/usr/local/Ascend/ascend-toolkit/6.3.RC1/runtime/lib64 \ |
33 | 33 | lib=-lacl_dvpp -lascendcl -lacl_dvpp_mpi -lruntime -lascendalog -lc_sec -lmsprofiler -lgert -lmmpa -lascend_hal -lexe_graph -lge_executor -lgraph -lprofapi -lascend_protobuf -lerror_manager -lhybrid_executor -lregister -ldavinci_executor -lge_common -lge_common_base \ |
34 | 34 | -lplatform -lgraph_base -lqos_manager |
35 | 35 | |
36 | -LIBS= -L $(DEPEND_DIR) -lvpt_det_vdec -lsycheck -lface_det_vdec -lhs_tri_process -lhs_truck_process -lhs_motor_process -lphone_motor_det -lhcp_vdec -lmotor_rainshed_vdec -latlaslic -lvpt_ascend\ | |
36 | +LIBS= -L $(DEPEND_DIR) -lvpt_det_vdec -lsycheck -lface_det_vdec -lhs_tri_process -lhs_truck_process -lhs_motor_process -lphone_motor_det -lhcp_vdec -lmotor_rainshed_vdec -ltraffic_light_vdec -latlaslic -lvpt_ascend\ | |
37 | 37 | -L $(OPENCV_ROOT)/lib -lopencv_world\ |
38 | 38 | -L $(JSON_ROOT)/lib -ljsoncpp \ |
39 | 39 | -L $(FFMPEG_ROOT)/lib -lavformat -lavcodec -lswscale -lavutil -lavfilter -lswresample -lavdevice \ | ... | ... |
src/demo/demo.cpp
... | ... | @@ -223,6 +223,56 @@ void set_task_params(task_param &tparam, const unsigned &idx, const algorithm_ty |
223 | 223 | algor_init_params->basic_param = basic_params; |
224 | 224 | } break; |
225 | 225 | |
226 | + case algorithm_type_t::PERSON_RUNNING_REDLIGHTS: { | |
227 | + auto algor_params = new algor_config_param_manned_incident; | |
228 | + { | |
229 | + algor_params->m = 10; | |
230 | + algor_params->n = 8; | |
231 | + algor_params->obj_confidence_threshold = 0.5f; | |
232 | + algor_params->obj_min_height = 6; | |
233 | + algor_params->obj_min_width = 32; | |
234 | + } | |
235 | + | |
236 | + auto basic_params = new algor_basic_config_param_t; | |
237 | + { | |
238 | + // basic_params->algor_valid_rect.top_ = 0; | |
239 | + // basic_params->algor_valid_rect.left_ = 0; | |
240 | + // basic_params->algor_valid_rect.width_ = 1920; | |
241 | + // basic_params->algor_valid_rect.height_ = 1080; | |
242 | + basic_params->video_folder = "res/video_recode"; | |
243 | + basic_params->result_folder = "res/person_runred"; | |
244 | + basic_params->result_folder_little = "res/person_runred_little"; | |
245 | + } | |
246 | + | |
247 | + algor_init_params->algor_param = algor_params; | |
248 | + algor_init_params->basic_param = basic_params; | |
249 | + } break; | |
250 | + | |
251 | + case algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS: { | |
252 | + auto algor_params = new algor_config_param_manned_incident; | |
253 | + { | |
254 | + algor_params->m = 10; | |
255 | + algor_params->n = 8; | |
256 | + algor_params->obj_confidence_threshold = 0.5f; | |
257 | + algor_params->obj_min_height = 6; | |
258 | + algor_params->obj_min_width = 32; | |
259 | + } | |
260 | + | |
261 | + auto basic_params = new algor_basic_config_param_t; | |
262 | + { | |
263 | + // basic_params->algor_valid_rect.top_ = 0; | |
264 | + // basic_params->algor_valid_rect.left_ = 0; | |
265 | + // basic_params->algor_valid_rect.width_ = 1920; | |
266 | + // basic_params->algor_valid_rect.height_ = 1080; | |
267 | + basic_params->video_folder = "res/video_recode"; | |
268 | + basic_params->result_folder = "res/motor_runred"; | |
269 | + basic_params->result_folder_little = "res/motor_runred_little"; | |
270 | + } | |
271 | + | |
272 | + algor_init_params->algor_param = algor_params; | |
273 | + algor_init_params->basic_param = basic_params; | |
274 | + } break; | |
275 | + | |
226 | 276 | case algorithm_type_t::FACE_SNAPSHOT: { |
227 | 277 | auto basic_params = new algor_basic_config_param_t; |
228 | 278 | { |
... | ... | @@ -721,7 +771,7 @@ string createTask(void *handle, std::vector<algorithm_type_t> algor_vec, int gi, |
721 | 771 | tparam.ipc_url = "/data/share/data/hczr1.mp4"; |
722 | 772 | break; |
723 | 773 | case 8: |
724 | - tparam.ipc_url = "/opt/share/data/1-00000001d9.mp4"; | |
774 | + tparam.ipc_url = "/data/share/data/燕高路口高点_CVR_2015-12-30_09-00-00_2015-12-30.mp4"; | |
725 | 775 | break; |
726 | 776 | case 9: |
727 | 777 | tparam.ipc_url = "/opt/share/data/1-00000002d55_h265.mp4"; |
... | ... | @@ -843,7 +893,7 @@ void test_gpu(int gpuID){ |
843 | 893 | |
844 | 894 | |
845 | 895 | std::vector<algorithm_type_t> 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, |
846 | - algorithm_type_t::NONMOTOR_VEHICLE_REFIT}; | |
896 | + algorithm_type_t::NONMOTOR_VEHICLE_REFIT, algorithm_type_t::PERSON_RUNNING_REDLIGHTS, algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS}; | |
847 | 897 | std::vector<algorithm_type_t> algor_vec3 = {algorithm_type_t::FACE_SNAPSHOT}; |
848 | 898 | |
849 | 899 | /* |
... | ... | @@ -870,7 +920,7 @@ void test_gpu(int gpuID){ |
870 | 920 | createTask(handle, algor_vec2, 5); |
871 | 921 | createTask(handle, algor_vec2, 6); |
872 | 922 | createTask(handle, algor_vec2, 7); |
873 | - // createTask(handle, algor_vec, 8); | |
923 | + createTask(handle, algor_vec2, 8); | |
874 | 924 | // createTask(handle, algor_vec, 9); |
875 | 925 | // createTask(handle, algor_vec, 10); |
876 | 926 | // createTask(handle, algor_vec, 11); | ... | ... |
src/tsl_aiplatform_jni/AiEngineNativeInterface.cpp
... | ... | @@ -382,6 +382,8 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter |
382 | 382 | case algorithm_type_t::NONMOTOR_VEHICLE_OVERMAN: |
383 | 383 | case algorithm_type_t::NONMOTOR_VEHICLE_USEPHONE: |
384 | 384 | case algorithm_type_t::NONMOTOR_VEHICLE_REFIT: |
385 | + case algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS: | |
386 | + case algorithm_type_t::PERSON_RUNNING_REDLIGHTS: | |
385 | 387 | case algorithm_type_t::TRICYCLE_MANNED: |
386 | 388 | case algorithm_type_t::TRUCK_MANNED: { |
387 | 389 | jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "hs_threshold", "I"); | ... | ... |