Commit d5345ee9595c574afb6a878a984a63c32befb912
1 parent
5accab74
代码优化
Showing
9 changed files
with
49 additions
and
28 deletions
src/ai_engine_module/HumanFeature.h
1 | +#ifndef __AI_ENGINE_MODULE_HUMAN_FEATURE__ | |
2 | +#define __AI_ENGINE_MODULE_HUMAN_FEATURE__ | |
3 | + | |
1 | 4 | #include "acl/acl.h" |
2 | 5 | #include "acl/ops/acl_dvpp.h" |
3 | 6 | |
... | ... | @@ -8,7 +11,7 @@ |
8 | 11 | using namespace std; |
9 | 12 | |
10 | 13 | struct HFResult{ |
11 | - float feature[HUMANREID_FEATURESIZE]; | |
14 | + float feature[HUMANREID_FEATURE_SIZE]; | |
12 | 15 | }; |
13 | 16 | |
14 | 17 | class HumanFeature |
... | ... | @@ -27,4 +30,6 @@ private: |
27 | 30 | int m_devId; |
28 | 31 | aclrtContext m_algorthim_ctx; |
29 | 32 | void* m_handle{nullptr}; |
30 | -}; | |
31 | 33 | \ No newline at end of file |
34 | +}; | |
35 | + | |
36 | +#endif // __AI_ENGINE_MODULE_HUMAN_FEATURE__ | |
32 | 37 | \ No newline at end of file | ... | ... |
src/ai_engine_module/HumanParsing.h
1 | +#ifndef __AI_ENGINE_MODULE_HUMAN_PARSING__ | |
2 | +#define __AI_ENGINE_MODULE_HUMAN_PARSING__ | |
3 | + | |
1 | 4 | #include <vector> |
2 | 5 | #include "acl/acl.h" |
3 | 6 | #include "acl/ops/acl_dvpp.h" |
... | ... | @@ -24,4 +27,6 @@ private: |
24 | 27 | int m_devId; |
25 | 28 | aclrtContext m_algorthim_ctx; |
26 | 29 | void* m_handle{nullptr}; |
27 | -}; | |
28 | 30 | \ No newline at end of file |
31 | +}; | |
32 | + | |
33 | +#endif | |
29 | 34 | \ No newline at end of file | ... | ... |
src/ai_engine_module/VPDProcess.h
1 | +#ifndef __AI_ENGINE_MODULE_VPD__ | |
2 | +#define __AI_ENGINE_MODULE_VPD__ | |
3 | + | |
1 | 4 | #include "acl/acl.h" |
2 | 5 | #include "acl/ops/acl_dvpp.h" |
3 | 6 | |
... | ... | @@ -30,4 +33,6 @@ private: |
30 | 33 | int m_devId; |
31 | 34 | aclrtContext m_algorthim_ctx; |
32 | 35 | void* m_handle{nullptr}; |
33 | -}; | |
34 | 36 | \ No newline at end of file |
37 | +}; | |
38 | + | |
39 | +#endif // __AI_ENGINE_MODULE_VPD__ | |
35 | 40 | \ No newline at end of file | ... | ... |
src/ai_engine_module/VPTProcess.h
... | ... | @@ -4,7 +4,9 @@ |
4 | 4 | * UpdateDate: 20170705 |
5 | 5 | * Content: 人车物监测跟踪 |
6 | 6 | ********************************************************************************************/ |
7 | -#pragma once | |
7 | +#ifndef __AI_ENGINE_MODULE_VPT__ | |
8 | +#define __AI_ENGINE_MODULE_VPT__ | |
9 | + | |
8 | 10 | #include <iostream> |
9 | 11 | #include <vector> |
10 | 12 | #include <string> |
... | ... | @@ -82,3 +84,6 @@ private: |
82 | 84 | int m_max_batchsize; |
83 | 85 | map<string, TaskTracker> taskTrackers; |
84 | 86 | }; |
87 | + | |
88 | + | |
89 | +#endif // __AI_ENGINE_MODULE_VPT__ | |
85 | 90 | \ No newline at end of file | ... | ... |
src/ai_engine_module/VehicleColor.h
1 | +#ifndef __AI_ENGINE_MODULE_VEHICLE_COLOR__ | |
2 | +#define __AI_ENGINE_MODULE_VEHICLE_COLOR__ | |
3 | + | |
1 | 4 | #include "acl/acl.h" |
2 | 5 | #include "acl/ops/acl_dvpp.h" |
3 | 6 | |
... | ... | @@ -28,4 +31,6 @@ private: |
28 | 31 | int m_devId; |
29 | 32 | aclrtContext m_algorthim_ctx; |
30 | 33 | void* m_handle{nullptr}; |
31 | -}; | |
32 | 34 | \ No newline at end of file |
35 | +}; | |
36 | + | |
37 | +#endif // __AI_ENGINE_MODULE_VEHICLE_COLOR__ | |
33 | 38 | \ No newline at end of file | ... | ... |
src/ai_engine_module/VehiclePlate.h
1 | +#ifndef __AI_ENGINE_MODULE_VEHICLE_PLATE__ | |
2 | +#define __AI_ENGINE_MODULE_VEHICLE_PLATE__ | |
3 | + | |
1 | 4 | #include "acl/acl.h" |
2 | 5 | #include "acl/ops/acl_dvpp.h" |
3 | 6 | |
... | ... | @@ -25,4 +28,6 @@ private: |
25 | 28 | int m_devId; |
26 | 29 | aclrtContext m_algorthim_ctx; |
27 | 30 | void* m_handle{nullptr}; |
28 | -}; | |
29 | 31 | \ No newline at end of file |
32 | +}; | |
33 | + | |
34 | +#endif // __AI_ENGINE_MODULE_VEHICLE_PLATE__ | |
30 | 35 | \ No newline at end of file | ... | ... |
src/ai_platform/FeatureAnalysis.cpp
... | ... | @@ -88,7 +88,7 @@ void FeatureAnalysis::update_human_info(ObjectInfo& res_obj, vpc_img_info& img_i |
88 | 88 | if (vec_hf_res.size() > 0) |
89 | 89 | { |
90 | 90 | HFResult hf_res = vec_hf_res[0]; |
91 | - memcpy(res_obj.hp_feature, hf_res.feature, sizeof(float) * HUMANREID_FEATURESIZE); | |
91 | + memcpy(res_obj.hp_feature, hf_res.feature, sizeof(float) * HUMANREID_FEATURE_SIZE); | |
92 | 92 | } |
93 | 93 | } |
94 | 94 | ... | ... |
src/ai_platform/header.h
1 | -#pragma once | |
1 | +#ifndef __AI_PLATFORM_HEADER__ | |
2 | +#define __AI_PLATFORM_HEADER__ | |
2 | 3 | |
3 | 4 | #ifdef _MSC_VER |
4 | 5 | #include <windows.h> |
... | ... | @@ -13,11 +14,11 @@ |
13 | 14 | #include <vector> |
14 | 15 | #include <string> |
15 | 16 | |
16 | -#include "../ai_engine_module/humanreid.h" | |
17 | -#include "../ai_engine_module/human_parsing.h" | |
18 | 17 | |
19 | 18 | |
20 | -#define VEHICLE_FEA_SIZE 128 | |
19 | +#define HUMANREID_FEATURE_SIZE 384 | |
20 | +#define HP_ATTRI_SIZE 16 | |
21 | + | |
21 | 22 | #define PLATENUM 8 //车牌号码位数 |
22 | 23 | #define MAX_PALTE_COUNT 10 //每张图片中最多检测出10个车牌 |
23 | 24 | |
... | ... | @@ -35,8 +36,6 @@ using namespace std; |
35 | 36 | |
36 | 37 | |
37 | 38 | //返回的检测物体结果信息 |
38 | -#ifndef __VIDEO_OBJECT_INFO__ | |
39 | -#define __VIDEO_OBJECT_INFO__ | |
40 | 39 | typedef struct video_object_info { |
41 | 40 | char task_id[128]; //该物体属于的任务ID号 |
42 | 41 | int task_frame_count; //该物体当前出现的帧号 |
... | ... | @@ -48,7 +47,6 @@ typedef struct video_object_info { |
48 | 47 | int index; //该物体所属类别的编号 |
49 | 48 | double confidence; //该物体的置信度 |
50 | 49 | } video_object_info; |
51 | -#endif | |
52 | 50 | |
53 | 51 | |
54 | 52 | |
... | ... | @@ -106,8 +104,8 @@ typedef struct ObjectData { |
106 | 104 | string ori_pic_path; |
107 | 105 | string obj_pic_path; |
108 | 106 | |
109 | - hp_cls_info hp_cls[HP_ATTRI_INDEX_SIZE]; | |
110 | - float hp_feature[HUMANREID_FEATURESIZE]; | |
107 | + hp_cls_info hp_cls[HP_ATTRI_SIZE]; | |
108 | + float hp_feature[HUMANREID_FEATURE_SIZE]; | |
111 | 109 | |
112 | 110 | int vehicle_color_index; |
113 | 111 | float vehicle_color_prob; |
... | ... | @@ -118,9 +116,6 @@ typedef struct ObjectData { |
118 | 116 | |
119 | 117 | |
120 | 118 | // TASK初始化参数 |
121 | -#ifndef __TASK_PARAM__ | |
122 | -#define __TASK_PARAM__ | |
123 | - | |
124 | 119 | typedef struct task_param { |
125 | 120 | string ipc_url; //rtsp流地址 |
126 | 121 | string task_id; //外部传入任务id |
... | ... | @@ -129,10 +124,8 @@ typedef struct task_param { |
129 | 124 | string result_folder_little; //目标快照抠图保存地址 |
130 | 125 | string result_folder; //目标快照大图保存地址 |
131 | 126 | } task_param; |
132 | -#endif | |
133 | 127 | |
134 | -#ifndef __AI_LOG_LEVEL__ | |
135 | -#define __AI_LOG_LEVEL__ | |
128 | + | |
136 | 129 | enum ai_log_level { |
137 | 130 | AI_LOG_LEVEL_CLOSE = -1, // 关闭日志 |
138 | 131 | AI_LOG_LEVEL_TRACE = 0, // 跟踪变量 |
... | ... | @@ -141,12 +134,9 @@ enum ai_log_level { |
141 | 134 | AI_LOG_LEVEL_WARNING = 3, // 警告日志通知,模块一切正常(如:重要流程通知) |
142 | 135 | AI_LOG_LEVEL_ERROR = 4, // 重要日志,如结果和严重错误 |
143 | 136 | }; |
144 | -#endif | |
145 | 137 | |
146 | 138 | |
147 | 139 | //VPT初始化参数 |
148 | -#ifndef __TSL_AIPLATFORM_PARAM__ | |
149 | -#define __TSL_AIPLATFORM_PARAM__ | |
150 | 140 | typedef struct tsl_aiplatform_param { |
151 | 141 | int gpuid; //指定显卡id |
152 | 142 | string models_dir; // 模型文件目录 |
... | ... | @@ -156,4 +146,5 @@ typedef struct tsl_aiplatform_param { |
156 | 146 | int log_days; //日志保存周期 |
157 | 147 | double log_mem; //每个日志最大大小 |
158 | 148 | } tsl_aiplatform_param; |
159 | -#endif | |
160 | 149 | \ No newline at end of file |
150 | + | |
151 | +#endif // __AI_PLATFORM_HEADER__ | |
161 | 152 | \ No newline at end of file | ... | ... |