f1eb769d
Hu Chunming
1. 添加GatherDetect
|
1
2
3
4
5
6
7
8
|
/*
* @Author: yangzilong
* @Date: 2021-12-16 14:25:13
* @Last Modified by: yangzilong
* @Email: yangzilong@objecteye.com
* @Description:
*/
#include "GatherDetect.h"
|
87917184
Hu Chunming
同步代码,新添加了一些事件检测
|
9
|
#include "../helpers/img_util.h"
|
f1eb769d
Hu Chunming
1. 添加GatherDetect
|
10
11
12
13
14
15
|
GatherDetect::GatherDetect()
{
m_task_param_manager = task_param_manager::getInstance();
}
|
87917184
Hu Chunming
同步代码,新添加了一些事件检测
|
16
17
18
19
20
21
|
void GatherDetect::init(algorithm_type_t eType)
{
m_eType = eType;
}
std::vector<GatherResult> GatherDetect::process(vector<DeviceMemory*> vec_vptMem, vector<onelevel_det_result> &ol_det_result) {
|
f1eb769d
Hu Chunming
1. 添加GatherDetect
|
22
23
24
25
26
27
28
29
30
|
std::vector<GatherResult> results;
map<string, algor_open_config_param> && algor_config_param = m_task_param_manager->get_task_algor_params();
map<string, map<algo_type, task_param_manager::algo_param_type_t_*>> && algor_param = m_task_param_manager->get_task_other_params();
for (size_t idx = 0; idx < vec_vptMem.size(); idx++)
{
DeviceMemory* cur_vptMem = vec_vptMem[idx];
string task_id = cur_vptMem->getId();
|
87917184
Hu Chunming
同步代码,新添加了一些事件检测
|
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
auto it_algor = algor_param.find(task_id);
if (it_algor == algor_param.end()) {
continue;
}
task_param_manager::algo_param_type_t_* cur_task_params = algor_param[task_id][m_eType];
if (nullptr == cur_task_params) {
continue;
}
algor_basic_config_param_t* basic_param = (algor_basic_config_param_t*)cur_task_params->basic_param;
if (basic_param == nullptr || basic_param->adapt_param == nullptr) {
continue;
}
universal_algor_adapt_param *adapt_param = basic_param->adapt_param;
|
f1eb769d
Hu Chunming
1. 添加GatherDetect
|
48
|
map<string, std::vector<box_t>> taskid_to_boxes;
|
87917184
Hu Chunming
同步代码,新添加了一些事件检测
|
49
50
51
|
onelevel_det_result &cur_task_ol_detres = ol_det_result[idx];
for (int c = 0; c < cur_task_ol_detres.obj_count; c++)
|
f1eb769d
Hu Chunming
1. 添加GatherDetect
|
52
|
{
|
87917184
Hu Chunming
同步代码,新添加了一些事件检测
|
53
|
auto& obj_c = cur_task_ol_detres.obj[c];
|
f1eb769d
Hu Chunming
1. 添加GatherDetect
|
54
|
|
87917184
Hu Chunming
同步代码,新添加了一些事件检测
|
55
|
bool bHuman = m_eType == algorithm_type_t::HUMAN_GATHER || m_eType == algorithm_type_t::HUMAN_DENSITY || m_eType == algorithm_type_t::HUMAN_REGION_GATHER;
|
f1eb769d
Hu Chunming
1. 添加GatherDetect
|
56
|
|
87917184
Hu Chunming
同步代码,新添加了一些事件检测
|
57
58
59
60
61
62
|
bool bCount = false;
if(bHuman && obj_c.index == (int)det_class_label_t::HUMAN) {
bCount = true;
} else if (m_eType == algorithm_type_t::VEHICLE_GATHER && obj_c.index >= 4 && obj_c.index <= 8) {
bCount = true;
}
|
f1eb769d
Hu Chunming
1. 添加GatherDetect
|
63
|
|
87917184
Hu Chunming
同步代码,新添加了一些事件检测
|
64
65
66
67
68
69
70
71
72
73
74
75
|
sy_point center;
center.x_ = (obj_c.right + obj_c.left)/ 2 ;
center.y_ = (obj_c.bottom + obj_c.top) / 2;
// vec_pt.push_back(center);
if (bCount && common::isInPolygon(adapt_param->points, adapt_param->points_count, center)) {
box_t box;
box.top = obj_c.top;
box.left = obj_c.left;
box.right = obj_c.right;
box.bottom = obj_c.bottom;
box.score = obj_c.confidence;
taskid_to_boxes[task_id].emplace_back(std::move(box));
|
f1eb769d
Hu Chunming
1. 添加GatherDetect
|
76
|
}
|
87917184
Hu Chunming
同步代码,新添加了一些事件检测
|
77
|
}
|
f1eb769d
Hu Chunming
1. 添加GatherDetect
|
78
|
|
87917184
Hu Chunming
同步代码,新添加了一些事件检测
|
79
80
|
int count_threshold = ((algor_config_param_human_gather*)cur_task_params->algor_param)->human_count_threshold;
int frame_stride = ((algor_config_param_human_gather*)cur_task_params->algor_param)->frame_stride;
|
f1eb769d
Hu Chunming
1. 添加GatherDetect
|
81
|
|
87917184
Hu Chunming
同步代码,新添加了一些事件检测
|
82
83
84
85
86
87
88
89
|
if (taskid_to_boxes[task_id].size() > count_threshold && cur_vptMem->getFrameNb() % frame_stride == 0)
{
GatherResult data;
data.origin_img = VPCUtil::vpc_devMem2vpcImg(vec_vptMem[idx]);
data.task_id = task_id;
data.boxes = std::move(taskid_to_boxes[task_id]);
data.id = gid_++;
results.emplace_back(std::move(data));
|
f1eb769d
Hu Chunming
1. 添加GatherDetect
|
90
91
92
93
94
|
}
}
return results;
}
|