Commit 3318f8fcc2e1a9405798cd332bd97132e8717696
1 parent
e57d1d04
代码优化
Showing
3 changed files
with
14 additions
and
40 deletions
vehicle_structure_platform.git0708-3080-trt-face/src/FFNvDecoder/logger.hpp
@@ -6,7 +6,8 @@ | @@ -6,7 +6,8 @@ | ||
6 | * @Description: | 6 | * @Description: |
7 | */ | 7 | */ |
8 | 8 | ||
9 | -#pragma once | 9 | +#ifndef __LOGGER_HPP__ |
10 | +#define __LOGGER_HPP__ | ||
10 | 11 | ||
11 | 12 | ||
12 | #include <spdlog/spdlog.h> | 13 | #include <spdlog/spdlog.h> |
@@ -344,3 +345,6 @@ static std::shared_ptr<spdlog::logger> get_simple_logger(const LogLevel &level, | @@ -344,3 +345,6 @@ static std::shared_ptr<spdlog::logger> get_simple_logger(const LogLevel &level, | ||
344 | static LoggerGenerator loggerGenerator; | 345 | static LoggerGenerator loggerGenerator; |
345 | return loggerGenerator.gen_logger(level, logger_name, file_path, max_file_size, max_keep_days); | 346 | return loggerGenerator.gen_logger(level, logger_name, file_path, max_file_size, max_keep_days); |
346 | } | 347 | } |
348 | + | ||
349 | + | ||
350 | +#endif // __LOGGER_HPP__ | ||
347 | \ No newline at end of file | 351 | \ No newline at end of file |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.cpp
@@ -155,10 +155,6 @@ void snapshot_helper::snapshot_helper_init(int gpuid, double gpu_total_memory, c | @@ -155,10 +155,6 @@ void snapshot_helper::snapshot_helper_init(int gpuid, double gpu_total_memory, c | ||
155 | #endif | 155 | #endif |
156 | v_analysis = V_ANALYSIS_TYPE::VC_ANALYSIS; | 156 | v_analysis = V_ANALYSIS_TYPE::VC_ANALYSIS; |
157 | 157 | ||
158 | - batch_hp = new sy_img[OBJ_BATCH_COUNT]{}; | ||
159 | - batch_vehicle = new sy_img[OBJ_BATCH_COUNT_VEHICLE]{}; | ||
160 | - batch_vehicle_vf = new sy_img[OBJ_BATCH_COUNT_VEHICLE]{}; | ||
161 | - | ||
162 | m_bExit = false; | 158 | m_bExit = false; |
163 | ProcessSnapshotThread = new std::thread(SnapshotThreadProcess, this); | 159 | ProcessSnapshotThread = new std::thread(SnapshotThreadProcess, this); |
164 | for (size_t i = 0; i < 12; i++) | 160 | for (size_t i = 0; i < 12; i++) |
@@ -182,37 +178,10 @@ void snapshot_helper::snapshot_helper_release() | @@ -182,37 +178,10 @@ void snapshot_helper::snapshot_helper_release() | ||
182 | m_human_fea.release(); | 178 | m_human_fea.release(); |
183 | m_face_det_module.face_det_module_release(); | 179 | m_face_det_module.face_det_module_release(); |
184 | 180 | ||
185 | - if (batch_hp != NULL) | ||
186 | - { | ||
187 | - delete[] batch_hp; | ||
188 | - batch_hp = NULL; | ||
189 | - } | ||
190 | - | ||
191 | - if (batch_vehicle != NULL) | ||
192 | - { | ||
193 | - delete[] batch_vehicle; | ||
194 | - batch_vehicle = NULL; | ||
195 | - } | ||
196 | - if (batch_vehicle_vf != NULL) | ||
197 | - { | ||
198 | - for (int i = 0; i < OBJ_BATCH_COUNT_VEHICLE; ++i) | ||
199 | - { | ||
200 | - if (batch_vehicle_vf[i].data_ != 0) | ||
201 | - { | ||
202 | - cudaFree(batch_vehicle_vf[i].data_); | ||
203 | - batch_vehicle_vf[i].data_ = NULL; | ||
204 | - } | ||
205 | - } | ||
206 | - delete[] batch_vehicle_vf; | ||
207 | - batch_vehicle_vf = NULL; | ||
208 | - } | ||
209 | - | ||
210 | - while (1) | ||
211 | - { | ||
212 | - { | ||
213 | - std::lock_guard<std::mutex> lock(threadMutex); | ||
214 | - if (snapshotImageQueue.empty()) | ||
215 | - break; | 181 | + while (1) { |
182 | + std::lock_guard<std::mutex> lock(threadMutex); | ||
183 | + if (snapshotImageQueue.empty()) { | ||
184 | + snapshotImageQueue.pop(); | ||
216 | } | 185 | } |
217 | } | 186 | } |
218 | 187 | ||
@@ -826,6 +795,8 @@ void snapshot_helper::hp_analysis() | @@ -826,6 +795,8 @@ void snapshot_helper::hp_analysis() | ||
826 | int obj_batch_count = 0; | 795 | int obj_batch_count = 0; |
827 | 796 | ||
828 | int cur_batchsize = index == 0 ? per_batchsize : OBJ_BATCH_COUNT - per_batchsize; | 797 | int cur_batchsize = index == 0 ? per_batchsize : OBJ_BATCH_COUNT - per_batchsize; |
798 | + | ||
799 | + sy_img batch_hp[cur_batchsize]; | ||
829 | for (int i = 0; i < cur_batchsize/*OBJ_BATCH_COUNT / OBJ_SCALE*/; i++) | 800 | for (int i = 0; i < cur_batchsize/*OBJ_BATCH_COUNT / OBJ_SCALE*/; i++) |
830 | { | 801 | { |
831 | OBJ_KEY cur_obj_key = count_person.front(); | 802 | OBJ_KEY cur_obj_key = count_person.front(); |
@@ -1046,6 +1017,7 @@ bool snapshot_helper::vehicle_color_analysis() | @@ -1046,6 +1017,7 @@ bool snapshot_helper::vehicle_color_analysis() | ||
1046 | 1017 | ||
1047 | int cur_batchsize = index == 0 ? cur_iter_count : OBJ_BATCH_COUNT_VEHICLE - cur_iter_count; | 1018 | int cur_batchsize = index == 0 ? cur_iter_count : OBJ_BATCH_COUNT_VEHICLE - cur_iter_count; |
1048 | 1019 | ||
1020 | + sy_img batch_vehicle[cur_batchsize]; | ||
1049 | for (int i = 0; i < /*OBJ_BATCH_COUNT_VEHICLE/ OBJ_SCALE*/cur_batchsize; i++) | 1021 | for (int i = 0; i < /*OBJ_BATCH_COUNT_VEHICLE/ OBJ_SCALE*/cur_batchsize; i++) |
1050 | { | 1022 | { |
1051 | 1023 | ||
@@ -1127,6 +1099,7 @@ bool snapshot_helper::vehicle_plate_dr_analysis() | @@ -1127,6 +1099,7 @@ bool snapshot_helper::vehicle_plate_dr_analysis() | ||
1127 | int start_idx = cur_iter_count * index; | 1099 | int start_idx = cur_iter_count * index; |
1128 | int cur_batchsize = index == 0 ? cur_iter_count : OBJ_BATCH_COUNT_VEHICLE - cur_iter_count; | 1100 | int cur_batchsize = index == 0 ? cur_iter_count : OBJ_BATCH_COUNT_VEHICLE - cur_iter_count; |
1129 | 1101 | ||
1102 | + sy_img batch_vehicle[cur_batchsize]; | ||
1130 | for (int i = 0; i < cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/; i++) | 1103 | for (int i = 0; i < cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/; i++) |
1131 | { | 1104 | { |
1132 | OBJ_KEY cur_obj_key = count_vehicle_v[i+ start_idx]; | 1105 | OBJ_KEY cur_obj_key = count_vehicle_v[i+ start_idx]; |
@@ -1363,6 +1336,7 @@ bool snapshot_helper::vehicle_recg_analysis() | @@ -1363,6 +1336,7 @@ bool snapshot_helper::vehicle_recg_analysis() | ||
1363 | { | 1336 | { |
1364 | int cur_batchsize = index == 0 ? cur_iter_count : OBJ_BATCH_COUNT_VEHICLE - cur_iter_count; | 1337 | int cur_batchsize = index == 0 ? cur_iter_count : OBJ_BATCH_COUNT_VEHICLE - cur_iter_count; |
1365 | 1338 | ||
1339 | + sy_img batch_vehicle[cur_batchsize]; | ||
1366 | for (int i = 0; i < cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/; i++) | 1340 | for (int i = 0; i < cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/; i++) |
1367 | { | 1341 | { |
1368 | OBJ_KEY cur_obj_key = count_vehicle_v[i]; | 1342 | OBJ_KEY cur_obj_key = count_vehicle_v[i]; |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.h
@@ -234,10 +234,6 @@ private: | @@ -234,10 +234,6 @@ private: | ||
234 | vector<OBJ_KEY> count_vehicle_v; //车的二次属性分析拆为三部分时,不再使用队列,只能使用数组 | 234 | vector<OBJ_KEY> count_vehicle_v; //车的二次属性分析拆为三部分时,不再使用队列,只能使用数组 |
235 | 235 | ||
236 | vector<vehicle_result> vehicle_result_v; | 236 | vector<vehicle_result> vehicle_result_v; |
237 | - | ||
238 | - sy_img * batch_hp = nullptr; | ||
239 | - sy_img * batch_vehicle = nullptr; | ||
240 | - sy_img * batch_vehicle_vf = nullptr; | ||
241 | 237 | ||
242 | sy_command hp_analysis_cf; | 238 | sy_command hp_analysis_cf; |
243 | sy_command hcp_analysis_cf; | 239 | sy_command hcp_analysis_cf; |