Commit be893a22dc512327a9a7683a31a27448d4b2c04f
1 parent
a74570e1
代码结构优化,未修改逻辑
Showing
23 changed files
with
443 additions
and
583 deletions
vehicle_structure_platform.git0708-3080-trt-face/linux/VPT/Makefile.qx deleted
1 | -CC = gcc | |
2 | -XX = g++ | |
3 | -AR = ar | |
4 | - | |
5 | -NVCC = /usr/local/cuda/bin/nvcc | |
6 | - | |
7 | -MNT_HOME = /home/cmhu/Project_VideoStructure | |
8 | - | |
9 | -PROJECT_ROOT= $(MNT_HOME)/vehicle_structure_platform.git0708-3080-trt-face | |
10 | -DEPEND_DIR = $(MNT_HOME)/Linux_3rdparty | |
11 | -SDK_ROOT = $(MNT_HOME)/SDK | |
12 | - | |
13 | -SRC_ROOT = $(PROJECT_ROOT)/src/VPT | |
14 | - | |
15 | -UTOOLS_SSD_ROOT = $(DEPEND_DIR)/utools_trt_v1.4.0 | |
16 | -HIDE_MODEL_CAFFE2 = $(PROJECT_ROOT)/model/hidemodel_caffe_1108 | |
17 | -HIDE_MODEL_TRT = $(PROJECT_ROOT)/model/vptModeTrt | |
18 | -AUTHORITY_DIR = $(DEPEND_DIR)/authority_linux_20200114 | |
19 | -TRT_ROOT = $(DEPEND_DIR)/TensorRT-8.6.1.6 | |
20 | -OPENCV_ROOT = $(DEPEND_DIR)/opencv-4.5.4/release | |
21 | -FFMPEG_ROOT = $(DEPEND_DIR)/ffmpeg-5.0.1/release | |
22 | - | |
23 | -TARGET = $(DEPEND_DIR)/video_structure_sdk_20220512/libmvpt.so | |
24 | - | |
25 | -DEFS=-DOS_LINUX -DLOG_INFO2 | |
26 | - | |
27 | -INCLUDE= -I $(DEPEND_DIR)/include/boost_linux_x86_64/include \ | |
28 | - -I $(DEPEND_DIR)/include \ | |
29 | - -I $(OPENCV_ROOT)/include/opencv4 \ | |
30 | - -I $(OPENCV_ROOT)/include/opencv4/opencv2 \ | |
31 | - -I $(UTOOLS_SSD_ROOT) \ | |
32 | - -I $(SRC_ROOT) \ | |
33 | - -I $(TRT_ROOT)/include \ | |
34 | - -I $(DEPEND_DIR)/include/cairo \ | |
35 | - -I $(SRC_ROOT)/sort \ | |
36 | - -I $(SRC_ROOT)/snapshot_analysis \ | |
37 | - -I $(SRC_ROOT)/../DxDecoder \ | |
38 | - -I /usr/local/cuda/include \ | |
39 | - -I $(HIDE_MODEL_CAFFE2) \ | |
40 | - -I $(HIDE_MODEL_TRT) \ | |
41 | - -I $(AUTHORITY_DIR) \ | |
42 | - -I $(FFMPEG_ROOT)/include \ | |
43 | - -I $(SDK_ROOT)/face_detect2/face_detect \ | |
44 | - | |
45 | -LIBSPATH= -L ../DxDecoder -l:libDxDecoder.a \ | |
46 | - -L/usr/local/cuda/lib64 -lcuda -lcudart -lcurand -lcublas \ | |
47 | - -L/usr/lib/x86_64-linux-gnu -lnvcuvid \ | |
48 | - -L$(DEPEND_DIR)/video_structure_sdk_20220512 -lSfxDecoder -lSfxStreamHandler -lvpd2 \ | |
49 | - -L$(DEPEND_DIR)/video_structure_sdk_20220512 -lface_detect -lvehicle_brand_cls -lvr_vehicle_type_10cls -lvr5905cls -lvehicle_recognize -lvehicle_color -lhuman_parsing -lhuman_car_parsing -lnon_vehicle_fea_trt -lvehicle_rear_recognition -lvf_int8 -lvp2_yolo\ | |
50 | - -L$(UTOOLS_SSD_ROOT) -l:libutools.so \ | |
51 | - -L$(DEPEND_DIR)/lib -l:liblibjasper.a -l:libIlmImf.a -l:liblibjpeg.a -l:liblibtiff.a -l:liblibpng.a \ | |
52 | - -L $(FFMPEG_ROOT)/lib -lavformat -lavcodec -lswscale -lavutil -lavfilter -lswresample -lavdevice \ | |
53 | - -L $(OPENCV_ROOT)/lib -lopencv_video -lopencv_highgui -lopencv_imgproc -lopencv_core -lopencv_imgcodecs\ | |
54 | - -L$(AUTHORITY_DIR) -l:libauthority.a \ | |
55 | - -L $(DEPEND_DIR)/include/boost_linux_x86_64/lib -l:libboost_system.a -l:libboost_thread.a \ | |
56 | - | |
57 | - | |
58 | -CFLAGS_LIB=-g -O0 -Wall -Wno-deprecated $(DEFS) -lz -fPIC -fvisibility=hidden -Wl,-Bsymbolic | |
59 | -CFLAGS = $(CFLAGS_LIB) $(INCLUDE) -std=c++11 -DUSE_CUDNN | |
60 | - # -DUNICODE -D_UNICODE | |
61 | -NFLAGS_LIB=-g -c $(DEFS) -shared -Xcompiler -fPIC -Xcompiler -fvisibility=hidden | |
62 | -NFLAGS = $(NFLAGS_LIB) $(INCLUDE) -std=c++11 | |
63 | - | |
64 | -LIBS= | |
65 | - | |
66 | -SRCS:=$(wildcard $(SRC_ROOT)/*.cpp) \ | |
67 | - $(wildcard ${SRC_ROOT}/sort/*.cpp) \ | |
68 | - $(wildcard $(SRC_ROOT)/MD5/mID.cpp) \ | |
69 | - $(wildcard $(HIDE_MODEL_CAFFE2)/*.cpp) \ | |
70 | - $(wildcard $(HIDE_MODEL_TRT)/*.cpp) \ | |
71 | - $(wildcard $(SRC_ROOT)/snapshot_analysis/*.cpp) \ | |
72 | - | |
73 | -OBJS = $(patsubst %.cpp, %.o, $(notdir $(SRCS))) | |
74 | - | |
75 | -CU_SOURCES = $(wildcard ${SRC_ROOT}/snapshot_analysis/*.cu) | |
76 | -CU_OBJS = $(patsubst %.cu, %.o, $(notdir $(CU_SOURCES))) | |
77 | - | |
78 | -all:$(TARGET) | |
79 | - | |
80 | -$(TARGET):$(OBJS) $(CU_OBJS) | |
81 | - rm -f $(TARGET) | |
82 | - $(XX) $(CFLAGS) -shared -o $@ $^ $(LIBSPATH) $(LIBS) -Wl,-rpath=$(DEPEND_DIR)/video_structure_sdk_20220512 | |
83 | - rm -f *.o | |
84 | - | |
85 | -%.o:$(SRC_ROOT)/%.cpp | |
86 | - $(XX) $(CFLAGS) -c $< | |
87 | -%.o:$(SRC_ROOT)/MD5/%.cpp | |
88 | - $(XX) $(CFLAGS) -c $< | |
89 | -%.o:$(SRC_ROOT)/sort/%.cpp | |
90 | - $(XX) $(CFLAGS) -c $< | |
91 | -%.o:$(HIDE_MODEL_CAFFE2)/%.cpp | |
92 | - $(XX) $(CFLAGS) -c $< | |
93 | -%.o:$(HIDE_MODEL_TRT)/%.cpp | |
94 | - $(XX) $(CFLAGS) -c $< | |
95 | -%.o:$(SRC_ROOT)/snapshot_analysis/%.cpp | |
96 | - $(XX) $(CFLAGS) -c $< | |
97 | -%.o:$(SRC_ROOT)/snapshot_analysis/%.cu | |
98 | - @echo "#######################CU_OBJS:$@###############" | |
99 | - $(NVCC) $(NFLAGS) -o $@ $< | |
100 | - | |
101 | -.PHONY:clean | |
102 | -clean: | |
103 | - rm -f *.o $(TARGET) | |
104 | - | |
105 | - |
vehicle_structure_platform.git0708-3080-trt-face/src/FFNvDecoder/FFNvDecoder.cpp
... | ... | @@ -311,10 +311,10 @@ void FFNvDecoder::decode_thread() |
311 | 311 | void FFNvDecoder::decode_finished(){ |
312 | 312 | if (avctx) |
313 | 313 | { |
314 | - if (avctx->hw_device_ctx) { | |
315 | - av_buffer_unref(&avctx->hw_device_ctx); | |
316 | - avctx->hw_device_ctx = nullptr; | |
317 | - } | |
314 | + // if (avctx->hw_device_ctx) { | |
315 | + // av_buffer_unref(&avctx->hw_device_ctx); | |
316 | + // avctx->hw_device_ctx = nullptr; | |
317 | + // } | |
318 | 318 | avcodec_free_context(&avctx); |
319 | 319 | avctx = nullptr; |
320 | 320 | } | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/HumanCarParsing.cpp
... | ... | @@ -63,11 +63,11 @@ int HumanCarParsing::init(int gpuid, char* auth_license) |
63 | 63 | param.max_batch = 20; |
64 | 64 | if (hcp_init(&handle, param) != 0) |
65 | 65 | { |
66 | - LOG_ERROR("Init HCP Failed!"); | |
66 | + LOG_ERROR("hcp_init Failed!"); | |
67 | 67 | return FAILED; |
68 | 68 | } |
69 | 69 | |
70 | - LOG_INFO("HumanCarParsing init success! gpu_id: {}", gpuid); | |
70 | + LOG_INFO("hcp_init success! gpu_id: {}", gpuid); | |
71 | 71 | return SUCCESS; |
72 | 72 | } |
73 | 73 | |
... | ... | @@ -98,6 +98,6 @@ int HumanCarParsing::release() |
98 | 98 | handle = nullptr; |
99 | 99 | } |
100 | 100 | |
101 | - LOG_INFO("HumanCarParsing Release."); | |
101 | + LOG_INFO("hcp_release"); | |
102 | 102 | return SUCCESS; |
103 | 103 | } | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/non_vehicle_fea.cpp renamed to vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/HumanFea.cpp
1 | -#include "non_vehicle_fea.h" | |
1 | +#include "HumanFea.h" | |
2 | 2 | #include "sy_common.h" |
3 | 3 | #include <iostream> |
4 | -int NonVehicleFea_Init(void *&handle, int gpuid, char* auth_license) | |
4 | + | |
5 | +#include "../../FFNvDecoder/logger.hpp" | |
6 | + | |
7 | +HumanFea::HumanFea(/* args */) | |
5 | 8 | { |
9 | +} | |
6 | 10 | |
7 | - int ret = SUCCESS; | |
11 | +HumanFea::~HumanFea() | |
12 | +{ | |
13 | + LOG_INFO("~HumanFea"); | |
14 | +} | |
8 | 15 | |
16 | +int HumanFea::init(int gpuid, char* auth_license) | |
17 | +{ | |
9 | 18 | human_fea_param fea_param; |
10 | 19 | fea_param.mode = DEVICE_GPU; |
11 | 20 | fea_param.gpuid = gpuid; |
12 | 21 | fea_param.thres = 0.6; |
13 | 22 | fea_param.engine = ENGINE_TENSORRT; |
14 | 23 | |
15 | - //δ��Ч | |
16 | 24 | fea_param.max_batch = 20; |
17 | 25 | fea_param.serialize_file = "./serialize_file/HF"; |
18 | 26 | fea_param.auth_license = auth_license; |
19 | - if (human_fea_init(&handle, fea_param) != SUCCESS) | |
27 | + | |
28 | + int ret = human_fea_init(&handle, fea_param); | |
29 | + if (ret != SUCCESS) | |
20 | 30 | { |
21 | - printf("sy_human_parsing_fea_init(error): init end. (ret = %d)\n", ret); | |
22 | - ret = HUMANPARSING_INIT_ERROR; | |
31 | + LOG_ERROR("human_fea_init failed:{}", ret); | |
32 | + return FAILED; | |
23 | 33 | } |
24 | 34 | |
35 | + LOG_INFO("human_fea_init success! gpu_id: {}", gpuid); | |
25 | 36 | return SUCCESS; |
26 | - | |
27 | 37 | } |
28 | 38 | |
29 | -int NonVehicleFea_Process(void * handle, sy_img * batch_img, int batch_size, human_fea_result*& result) | |
39 | +int HumanFea::process(sy_img * batch_img, int batch_size, human_fea_result*& result) | |
30 | 40 | { |
31 | - for (int i = 0; i < batch_size; i++) | |
32 | - { | |
33 | - if (batch_img[i].data_ == NULL) | |
34 | - std::cout << i << " NonVehicleFea data null" << std::endl; | |
41 | + for (int i = 0; i < batch_size; i++) { | |
42 | + if (batch_img[i].data_ == NULL) { | |
43 | + LOG_ERROR("data null!"); | |
44 | + return FAILED; | |
45 | + } | |
35 | 46 | } |
36 | 47 | |
37 | 48 | return human_fea_batch(handle, batch_img, batch_size, result); |
38 | - | |
39 | 49 | } |
40 | 50 | |
41 | -int NonVehicleFea_Release(void *& handle) | |
51 | +int HumanFea::release() | |
42 | 52 | { |
43 | - human_fea_release(&handle); | |
44 | - handle = NULL; | |
53 | + if(handle) { | |
54 | + human_fea_release(&handle); | |
55 | + handle = nullptr; | |
56 | + } | |
57 | + | |
58 | + LOG_INFO("human_fea_release"); | |
45 | 59 | return SUCCESS; |
46 | 60 | } |
47 | 61 | \ No newline at end of file | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/HumanFea.h
0 → 100644
1 | +#pragma once | |
2 | +#include "non_vehicle_fea_trt.h" | |
3 | +#include "utools.h" | |
4 | + | |
5 | + | |
6 | +class HumanFea { | |
7 | +public: | |
8 | + HumanFea(/* args */); | |
9 | + ~HumanFea(); | |
10 | + | |
11 | + int init(int gpuid, char* auth_license); | |
12 | + int process(sy_img * batch_img, int batch_size, human_fea_result*& result); | |
13 | + int release(); | |
14 | + | |
15 | +private: | |
16 | + void* handle{nullptr}; | |
17 | +}; | |
0 | 18 | \ No newline at end of file | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/HumanParsing.cpp
1 | 1 | #include "HumanParsing.h" |
2 | 2 | |
3 | 3 | #include <opencv2/opencv.hpp> |
4 | -//static string head[] = { "³¤·¢", "¶Ì·¢", "ÆäËû" }; | |
5 | -//static string head_color[] = { "ºÚ", "°×", "ÆäËû" }; | |
6 | -//static string eye[] = { "δ´÷ÑÛ¾µ", "´÷ÑÛ¾µ" }; | |
7 | -//static string mouth[] = { "δ´÷¿ÚÕÖ", "´÷¿ÚÕÖ" }; | |
8 | -//static string up[] ={ "TÐô/±³ÐÄ", "³ÄÉÀ", "ëÒÂ"," ÍâÌ×" , "Á¬ÒÂȹ", "ÆäËû" }; | |
9 | -//static std::string up_color[] = { "ºÚ", "°×", "»Ò", "ºì", "À¶", "»Æ", "ÂÌ", "¶àÉ«", "ÆäËû" }; | |
10 | -//static string clothing_text[] = { "´¿É«", "Ë黨", "ÌõÎÆ/¸ñ×Ó", "ÆäËû" }; | |
11 | -//static string down[6] = { "³¤¿ã", "¶Ì¿ã", "³¤È¹", "¶Ìȹ", "Á¬ÒÂȹ", "ÆäËû" }; | |
12 | -//static std::string down_color[] = { "ºÚ", "°×", "»Ò", "ºì", "À¶", "»Æ", "ÂÌ", "¶àÉ«", "ÆäËû" }; | |
13 | -//static string bao[5] = { "ÎÞ°ü", "Óаü" }; | |
14 | -//static std::string sex[] = { "ÄÐ", "Å®", "²»Ã÷" }; | |
15 | -//static std::string age[] = { "Сº¢", "³ÉÈË", "²»Ã÷" }; | |
16 | -//static std::string viewpoint[] = { "ÕýÃæ","±³Ãæ", "²àÃæ" }; | |
17 | -//static string dasan[2] = { "δ´òÉ¡", "´òÉ¡" }; | |
18 | -//static string child[2] = { "δ±§Ð¡º¢", "±§Ð¡º¢" }; | |
19 | -//static string personstate[5] = { "ÐÐ×ß/Õ¾Á¢", "±¼ÅÜ", "¶×/×ø", "ÍÆ³µ", "ÆäËû" }; | |
4 | + | |
5 | +#include "../../FFNvDecoder/logger.hpp" | |
6 | + | |
7 | + | |
8 | +//static string head[] = { "é•¿å‘", "çŸå‘", "å…¶ä»–" }; | |
9 | +//static string head_color[] = { "黑", "白", "其他" }; | |
10 | +//static string eye[] = { "未戴眼镜", "戴眼镜" }; | |
11 | +//static string mouth[] = { "未戴å£ç½©", "戴å£ç½©" }; | |
12 | +//static string up[] ={ "Tæ¤/背心", "衬衫", "毛衣"," 外套" , "连衣裙", "å…¶ä»–" }; | |
13 | +//static std::string up_color[] = { "黑", "白", "ç°", "红", "è“", "黄", "绿", "多色", "å…¶ä»–" }; | |
14 | +//static string clothing_text[] = { "纯色", "碎花", "æ¡çº¹/æ ¼å", "å…¶ä»–" }; | |
15 | +//static string down[6] = { "长裤", "çŸè£¤", "长裙", "çŸè£™", "连衣裙", "å…¶ä»–" }; | |
16 | +//static std::string down_color[] = { "黑", "白", "ç°", "红", "è“", "黄", "绿", "多色", "å…¶ä»–" }; | |
17 | +//static string bao[5] = { "æ— åŒ…", "有包" }; | |
18 | +//static std::string sex[] = { "ç”·", "女", "䏿˜Ž" }; | |
19 | +//static std::string age[] = { "å°å©", "æˆäºº", "䏿˜Ž" }; | |
20 | +//static std::string viewpoint[] = { "æ£é¢","背é¢", "ä¾§é¢" }; | |
21 | +//static string dasan[2] = { "未打伞", "打伞" }; | |
22 | +//static string child[2] = { "未抱å°å©", "抱å°å©" }; | |
23 | +//static string personstate[5] = { "行走/站立", "奔跑", "è¹²/å", "推车", "å…¶ä»–" }; | |
20 | 24 | |
21 | 25 | |
22 | 26 | const int FIR_INDEX_SIZE = 16; |
23 | 27 | const int SEC_INDEX_SIZE[FIR_INDEX_SIZE] = { 3, 3, 2, 2, 6, 9, 4, 6, 9, 2, 3, 3, 3, 2, 2, 5 }; |
24 | 28 | |
25 | 29 | |
30 | +HumanParsing::HumanParsing(/* args */) | |
31 | +{ | |
32 | +} | |
33 | + | |
34 | +HumanParsing::~HumanParsing() | |
35 | +{ | |
36 | + LOG_INFO("~HumanParsing"); | |
37 | +} | |
26 | 38 | |
27 | -int HumanParsing_Init(void *&handle, int gpuid, char* auth_license) | |
39 | +int HumanParsing::init(int gpuid, char* auth_license) | |
28 | 40 | { |
29 | 41 | hp_param param; |
30 | 42 | param.mode = DEVICE_GPU; |
... | ... | @@ -33,30 +45,25 @@ int HumanParsing_Init(void *&handle, int gpuid, char* auth_license) |
33 | 45 | param.max_batch = 20; |
34 | 46 | param.serialize_file = "./serialize_file/HP"; |
35 | 47 | param.auth_license = auth_license; |
36 | - if (hp_init(&handle, param) != 0) | |
37 | - { | |
38 | - cout << "Init HP Failed!" << endl; | |
48 | + if (hp_init(&handle, param) != 0) { | |
49 | + LOG_ERROR("hp_init failed!"); | |
39 | 50 | return FAILED; |
40 | 51 | } |
41 | 52 | |
53 | + LOG_INFO("hp_init success! gpu_id: {}", gpuid); | |
42 | 54 | return SUCCESS; |
43 | 55 | } |
44 | 56 | |
45 | - | |
46 | - | |
47 | - | |
48 | -#include <fstream> | |
49 | -int HumanParsing_Process(void * handle, sy_img * batch_img, int batch_size, hp_analysis_res*& result) | |
57 | +int HumanParsing::process(sy_img * batch_img, int batch_size, hp_analysis_res*& result) | |
50 | 58 | { |
51 | - | |
52 | - | |
53 | 59 | for (int i = 0; i < batch_size; i++) |
54 | 60 | { |
55 | - if (batch_img[i].data_ == NULL) | |
56 | - cout << i << " data null" << endl; | |
61 | + if (batch_img[i].data_ == NULL) { | |
62 | + LOG_ERROR("data null!"); | |
63 | + return FAILED; | |
64 | + } | |
57 | 65 | } |
58 | 66 | |
59 | - //cout << "begin HumanParsingProcessBatch" << endl; | |
60 | 67 | hp_batch(handle, batch_img, batch_size, result); |
61 | 68 | |
62 | 69 | for (int b = 0; b < batch_size; b++) |
... | ... | @@ -73,90 +80,16 @@ int HumanParsing_Process(void * handle, sy_img * batch_img, int batch_size, hp_ |
73 | 80 | } |
74 | 81 | } |
75 | 82 | |
76 | - //cout << "end HumanParsingProcessBatch" << endl; | |
77 | - | |
78 | - | |
79 | - //for (int b = 0; b < batch_size; b++) | |
80 | - //{ | |
81 | - // ctools_result &cur_result = result[b]; | |
82 | - // int big_class_count = cur_result.obj_count_; | |
83 | - // ctools_obj_result &index_score = cur_result.obj_results_[big_class_count]; | |
84 | - | |
85 | - // if (index_score.data_count_ != FIR_INDEX_SIZE * 2) | |
86 | - // { | |
87 | - // printf("wrong result.\n"); | |
88 | - // break; | |
89 | - // } | |
90 | - | |
91 | - // //for (int i = 0; i < FIR_INDEX_SIZE; i++) | |
92 | - // //{ | |
93 | - // // //int resIndex = result[j][i].index; | |
94 | - // // int resIndex = index_score.data_[i * 2]; | |
95 | - | |
96 | - // // switch (i) | |
97 | - // // { | |
98 | - // // case 0: | |
99 | - // // cout << head[resIndex] << " "; | |
100 | - // // break; | |
101 | - // // case 1: | |
102 | - // // cout << head_color[resIndex] << " "; | |
103 | - // // break; | |
104 | - // // case 2: | |
105 | - // // cout << eye[resIndex] << " "; | |
106 | - // // break; | |
107 | - // // case 3: | |
108 | - // // cout << mouth[resIndex] << " "; | |
109 | - // // break; | |
110 | - // // case 4: | |
111 | - // // cout << up[resIndex] << " "; | |
112 | - // // break; | |
113 | - // // case 5: | |
114 | - // // cout << up_color[resIndex] << " "; | |
115 | - // // break; | |
116 | - // // case 6: | |
117 | - // // cout << clothing_text[resIndex] << " "; | |
118 | - // // break; | |
119 | - // // case 7: | |
120 | - // // cout << down[resIndex] << " "; | |
121 | - // // break; | |
122 | - // // case 8: | |
123 | - // // cout << down_color[resIndex] << " "; | |
124 | - // // break; | |
125 | - // // case 9: | |
126 | - // // cout << bao[resIndex] << " "; | |
127 | - // // break; | |
128 | - // // case 10: | |
129 | - // // cout << sex[resIndex] << " "; | |
130 | - // // break; | |
131 | - // // case 11: | |
132 | - // // cout << age[resIndex] << " "; | |
133 | - // // break; | |
134 | - // // case 12: | |
135 | - // // cout << viewpoint[resIndex] << " "; | |
136 | - // // break; | |
137 | - // // case 13: | |
138 | - // // cout << dasan[resIndex] << " "; | |
139 | - // // break; | |
140 | - // // case 14: | |
141 | - // // cout << child[resIndex] << " "; | |
142 | - // // break; | |
143 | - // // case 15: | |
144 | - // // cout << personstate[resIndex] << " "; | |
145 | - // // break; | |
146 | - // // default: | |
147 | - // // break; | |
148 | - // // } | |
149 | - | |
150 | - // //} | |
151 | - // //cout << endl << endl; | |
152 | - //} | |
153 | - | |
154 | 83 | return SUCCESS; |
155 | 84 | } |
156 | 85 | |
157 | -int HumanParsing_Release(void *& handle) | |
86 | +int HumanParsing::release() | |
158 | 87 | { |
159 | - if(handle) | |
160 | - hp_release(&handle); | |
88 | + if(handle) { | |
89 | + hp_release(&handle); | |
90 | + handle = nullptr; | |
91 | + } | |
92 | + | |
93 | + LOG_INFO("hp_release"); | |
161 | 94 | return SUCCESS; |
162 | 95 | } | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/HumanParsing.h
... | ... | @@ -8,7 +8,16 @@ |
8 | 8 | using namespace std; |
9 | 9 | |
10 | 10 | |
11 | +class HumanParsing | |
12 | +{ | |
13 | +public: | |
14 | + HumanParsing(/* args */); | |
15 | + ~HumanParsing(); | |
11 | 16 | |
12 | -int HumanParsing_Init(void *&handle, int gpuid, char* auth_license); | |
13 | -int HumanParsing_Process(void * handle, sy_img * batch_img, int batchsize, hp_analysis_res*& result); | |
14 | -int HumanParsing_Release(void *& handle); | |
17 | + int init(int gpuid, char* auth_license); | |
18 | + int process(sy_img * batch_img, int batchsize, hp_analysis_res*& result); | |
19 | + int release(); | |
20 | + | |
21 | +private: | |
22 | + void *handle {nullptr}; | |
23 | +}; | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/SnapShotFrameCache.cpp deleted
1 | -#include <cuda_runtime.h> | |
2 | -#include "SnapShotFrameCache.h" | |
3 | - | |
4 | -void SnapShotFrameCache::init_cache(unsigned int cache_len, unsigned int cache_count) | |
5 | -{ | |
6 | - this->cache_len = cache_len; | |
7 | - this->cache_count = cache_count; | |
8 | - alloc(); | |
9 | -} | |
10 | - | |
11 | -bool SnapShotFrameCache::alloc() | |
12 | -{ | |
13 | - for (size_t i = 0; i < cache_count; i++) | |
14 | - { | |
15 | - void * frame = NULL; | |
16 | - auto cudaStatus = cudaMalloc((void**)&frame, cache_len); | |
17 | - if (cudaStatus != cudaSuccess) | |
18 | - { | |
19 | - return false; | |
20 | - } | |
21 | - cache.push(frame); | |
22 | - } | |
23 | - return true; | |
24 | -} | |
25 | - | |
26 | -void * SnapShotFrameCache::get_frame() | |
27 | -{ | |
28 | - if (cache.empty()) | |
29 | - { | |
30 | - alloc(); | |
31 | - if (!cache.empty()) | |
32 | - { | |
33 | - void * frame = cache.front(); | |
34 | - cache.pop(); | |
35 | - return frame; | |
36 | - } | |
37 | - else | |
38 | - { | |
39 | - return nullptr; | |
40 | - } | |
41 | - } | |
42 | - else | |
43 | - { | |
44 | - void * frame = cache.front(); | |
45 | - cache.pop(); | |
46 | - return frame; | |
47 | - } | |
48 | -} | |
49 | - | |
50 | -void SnapShotFrameCache::release(void * frame) | |
51 | -{ | |
52 | - cache.push(frame); | |
53 | -} | |
54 | - | |
55 | -void SnapShotFrameCache::free() | |
56 | -{ | |
57 | - while (!cache.empty()) | |
58 | - { | |
59 | - void * frame = cache.front(); | |
60 | - cudaFree(frame); | |
61 | - cache.pop(); | |
62 | - } | |
63 | -} | |
64 | 0 | \ No newline at end of file |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/SnapShotFrameCache.h deleted
1 | -#pragma once | |
2 | -#include "../FFNvDecoder/DxDecoderWrap.h" | |
3 | -#include <queue> | |
4 | -#define SHOT_CACHE_SIZE | |
5 | -#define VEHICLE_WIDTH 320 | |
6 | -class SnapShotFrameCache | |
7 | -{ | |
8 | -public: | |
9 | - void init_cache(unsigned int cache_len, unsigned int cache_count); | |
10 | - void * get_frame(); | |
11 | - void release(void * frame); | |
12 | - void free(); | |
13 | -private: | |
14 | - bool alloc(); | |
15 | - std::queue<void *> cache; | |
16 | - unsigned int cache_len; | |
17 | - unsigned int cache_count; | |
18 | -}; | |
19 | 0 | \ No newline at end of file |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/VehicleColor.cpp
1 | 1 | #include "VehicleColor.h" |
2 | 2 | |
3 | -static char colorLabel[14][8] = { "��", "��", "��", "��", "��", "��", "��", "��", "��", "��", "��", "��", "��", "��" }; | |
4 | -int VehicleColor_Init(void *&handle, int gpuid, char* auth_license) | |
3 | +#include "../../FFNvDecoder/logger.hpp" | |
4 | + | |
5 | + | |
6 | +static char colorLabel[14][8] = { "棕", "橙", "灰", "白", "粉", "紫", "红", "绿", "蓝", "金", "银", "青", "黄", "黑" }; | |
7 | + | |
8 | +VehicleColor::VehicleColor(/* args */) | |
9 | +{ | |
10 | +} | |
11 | + | |
12 | +VehicleColor::~VehicleColor() | |
13 | +{ | |
14 | + LOG_INFO("~VehicleColor"); | |
15 | +} | |
16 | + | |
17 | + | |
18 | +int VehicleColor::init(int gpuid, char* auth_license) | |
5 | 19 | { |
6 | 20 | vc_param params; |
7 | 21 | params.mode = DEVICE_GPU; |
... | ... | @@ -13,58 +27,36 @@ int VehicleColor_Init(void *&handle, int gpuid, char* auth_license) |
13 | 27 | int ret = vc_init(&handle, params); |
14 | 28 | if (ret != 0) |
15 | 29 | { |
16 | - cout << "Init Ret Failed!" << endl; | |
30 | + LOG_ERROR("vc_init failed!"); | |
17 | 31 | return FAILED; |
18 | 32 | } |
19 | 33 | |
34 | + LOG_INFO("vc_init success! gpu_id: {}", gpuid); | |
20 | 35 | return SUCCESS; |
21 | 36 | } |
22 | 37 | |
23 | -#include <fstream> | |
24 | -int VehicleColor_Process(void * handle, sy_img * batch_img, int batch_size, vc_result *&result) | |
38 | +int VehicleColor::process(sy_img * batch_img, int batch_size, vc_result *&result) | |
25 | 39 | { |
26 | 40 | for (int i = 0; i < batch_size; i++) |
27 | 41 | { |
28 | - if (batch_img[i].data_ == NULL) | |
29 | - cout << i << " data null" << endl; | |
42 | + if (batch_img[i].data_ == NULL) { | |
43 | + LOG_ERROR("data null"); | |
44 | + return FAILED; | |
45 | + } | |
30 | 46 | } |
31 | 47 | |
32 | - // ctools_result *result=NULL; | |
33 | - //cout << "begin vc ProcessBatch" << endl; | |
34 | - | |
35 | 48 | vc_batch(handle, batch_img, batch_size, result); |
36 | - //cout << "end vc ProcessBatch" << endl; | |
37 | - | |
38 | - //for (int b = 0; b < batch_size; b++) | |
39 | - //{ | |
40 | - | |
41 | - // ctools_result &cur_result = result[b]; | |
42 | - // int big_class_count = cur_result.obj_count_; | |
43 | - | |
44 | - // for (int i = 0; i < cur_result.obj_count_ + 1; i++) | |
45 | - // { | |
46 | - // ctools_obj_result &index_score_1 = cur_result.obj_results_[i]; | |
47 | - | |
48 | - // /* for (int j = 0; j < index_score_1.data_count_; j++) | |
49 | - // printf("%.2f ", index_score_1.data_[j]); | |
50 | - // printf("\n");*/ | |
51 | - // } | |
52 | - | |
53 | - | |
54 | - // ctools_obj_result &index_score = cur_result.obj_results_[big_class_count]; | |
55 | - // float *index_score_data = index_score.data_; | |
56 | - // int index_count = index_score_data[0]; | |
57 | - // float score = index_score_data[1]; | |
58 | - // printf("%d-%d, %s, index = %d, score = %.2f\n", b, batch_size, colorLabel[index_count], index_count, score); | |
59 | - // //cudaFree(images[j].data); | |
60 | - //} | |
61 | 49 | |
62 | 50 | return SUCCESS; |
63 | 51 | } |
64 | 52 | |
65 | -int VehicleColor_Release(void *& handle) | |
53 | +int VehicleColor::release() | |
66 | 54 | { |
67 | - if (handle) | |
68 | - vc_release(&handle); | |
55 | + if (handle) { | |
56 | + vc_release(&handle); | |
57 | + handle = nullptr; | |
58 | + } | |
59 | + | |
60 | + LOG_INFO("release."); | |
69 | 61 | return SUCCESS; |
70 | 62 | } | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/VehicleColor.h
... | ... | @@ -8,7 +8,16 @@ |
8 | 8 | using namespace std; |
9 | 9 | |
10 | 10 | |
11 | +class VehicleColor | |
12 | +{ | |
13 | +public: | |
14 | + VehicleColor(/* args */); | |
15 | + ~VehicleColor(); | |
11 | 16 | |
12 | -int VehicleColor_Init(void *&handle, int gpuid, char* auth_license); | |
13 | -int VehicleColor_Process(void * handle, sy_img * batch_img,int batchsize, vc_result *&result); | |
14 | -int VehicleColor_Release(void *& handle); | |
17 | + int init(int gpuid, char* auth_license); | |
18 | + int process(sy_img * batch_img,int batchsize, vc_result *&result); | |
19 | + int release(); | |
20 | + | |
21 | +private: | |
22 | + void* handle {nullptr}; | |
23 | +}; | |
15 | 24 | \ No newline at end of file | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/vehicle_features.cpp renamed to vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/VehicleFeature.cpp
1 | -#include "vehicle_features.h" | |
1 | +#include "VehicleFeature.h" | |
2 | 2 | #include <iostream> |
3 | 3 | #include "sy_errorinfo.h" |
4 | + | |
5 | +#include "../../FFNvDecoder/logger.hpp" | |
6 | + | |
4 | 7 | using namespace std; |
5 | 8 | |
6 | -void RectboundCheck(int Width, int Height, int &left, int &top, int &width, int &height); | |
7 | 9 | |
8 | -int vhd_features_init(void *&handle, char*dbpath, int gpuid, char* auth_license) | |
10 | +VehicleFeature::VehicleFeature(/* args */) | |
11 | +{ | |
12 | +} | |
13 | + | |
14 | +VehicleFeature::~VehicleFeature() | |
15 | +{ | |
16 | + LOG_INFO("~VehicleFeature"); | |
17 | +} | |
18 | + | |
19 | +int VehicleFeature::init_vpd(char*dbpath, int gpuid, char* auth_license) | |
9 | 20 | { |
10 | 21 | vehicle_pendant_det_param params; |
11 | 22 | params.gpuid = gpuid; |
... | ... | @@ -13,16 +24,16 @@ int vhd_features_init(void *&handle, char*dbpath, int gpuid, char* auth_license) |
13 | 24 | params.serialize_file = "./serialize_file/VPD"; |
14 | 25 | params.thresld = 0.6; |
15 | 26 | params.auth_license = auth_license; |
16 | - if (vpd2_init(&handle, params) !=0) { | |
17 | - cout << "Init vhd Failed!" << endl; | |
27 | + if (vpd2_init(&vpd_handle, params) !=0) { | |
28 | + LOG_ERROR("vpd2_init failed!"); | |
18 | 29 | return FAILED; |
19 | 30 | } |
20 | 31 | |
32 | + LOG_INFO("vpd2_init success! gpu_id: {}", gpuid); | |
21 | 33 | return SUCCESS; |
22 | 34 | } |
23 | 35 | |
24 | - | |
25 | -int vf_features_init(void *&handle, char*dbpath, int gpuid, char* auth_license) | |
36 | +int VehicleFeature::init_vf(char*dbpath, int gpuid, char* auth_license) | |
26 | 37 | { |
27 | 38 | vf_param params; |
28 | 39 | params.gpuid = gpuid; |
... | ... | @@ -31,26 +42,25 @@ int vf_features_init(void *&handle, char*dbpath, int gpuid, char* auth_license) |
31 | 42 | params.max_batch = 20; |
32 | 43 | params.serialize_file = "./serialize_file/VF"; |
33 | 44 | params.auth_license = auth_license; |
34 | - // params.db_path = dbpath; | |
35 | - if (vf_init(&handle, params) !=0) | |
36 | - { | |
37 | - cout << "Init VF Failed!" << endl; | |
45 | + if (vf_init(&vf_handle, params) !=0) { | |
46 | + LOG_ERROR("vf_init failed!"); | |
38 | 47 | return FAILED; |
39 | - | |
40 | 48 | } |
49 | + | |
50 | + LOG_INFO("vf_init success! gpu_id: {}", gpuid); | |
41 | 51 | return SUCCESS; |
42 | 52 | } |
43 | 53 | |
44 | - | |
45 | - | |
46 | -int vhd_features_process(void * handle, sy_img * batch_img, int batch_size, vpd2_result*& result) | |
54 | +int VehicleFeature::process_vpd(sy_img * batch_img, int batch_size, vpd2_result*& result) | |
47 | 55 | { |
48 | 56 | for (int i = 0; i < batch_size; i++) |
49 | 57 | { |
50 | - if (batch_img[i].data_ == NULL) | |
51 | - cout << i << " data null" << endl; | |
58 | + if (batch_img[i].data_ == NULL) { | |
59 | + LOG_ERROR("data null!"); | |
60 | + return FAILED; | |
61 | + } | |
52 | 62 | } |
53 | - vpd2_process(handle, batch_img, batch_size, result); | |
63 | + vpd2_process(vpd_handle, batch_img, batch_size, result); | |
54 | 64 | |
55 | 65 | for (int b = 0; b < batch_size; b++) |
56 | 66 | { |
... | ... | @@ -64,17 +74,13 @@ int vhd_features_process(void * handle, sy_img * batch_img, int batch_size, vpd |
64 | 74 | return SUCCESS; |
65 | 75 | } |
66 | 76 | |
67 | - | |
68 | -#include <cuda.h> | |
69 | -#include <cuda_runtime.h> | |
70 | -#include <opencv2/opencv.hpp> | |
71 | - | |
72 | -int vf_features_process(void * handle, sy_img * batch_img, int batch_size, int8**& result) | |
77 | +int VehicleFeature::process_vf( sy_img * batch_img, int batch_size, int8**& result) | |
73 | 78 | { |
74 | 79 | for (int i = 0; i < batch_size; i++) |
75 | 80 | { |
76 | - if (batch_img[i].data_ == NULL) | |
77 | - cout << i << " data null" << endl; | |
81 | + if (batch_img[i].data_ == NULL){ | |
82 | + LOG_ERROR("data null!"); | |
83 | + } | |
78 | 84 | } |
79 | 85 | |
80 | 86 | int **fea = new int*[batch_size]; |
... | ... | @@ -83,7 +89,7 @@ int vf_features_process(void * handle, sy_img * batch_img, int batch_size, int8 |
83 | 89 | fea[i] = new int[FEATURESIZE]; |
84 | 90 | } |
85 | 91 | |
86 | - vf_feature_batch(handle, batch_img, batch_size, fea); | |
92 | + vf_feature_batch(vf_handle, batch_img, batch_size, fea); | |
87 | 93 | |
88 | 94 | for (int i = 0; i < batch_size; i++) |
89 | 95 | { |
... | ... | @@ -111,27 +117,34 @@ int vf_features_process(void * handle, sy_img * batch_img, int batch_size, int8 |
111 | 117 | return SUCCESS; |
112 | 118 | } |
113 | 119 | |
114 | -int vhd_feature_release(void *& handle) | |
120 | +int VehicleFeature::release_vpd() | |
115 | 121 | { |
116 | - if (handle) | |
117 | - vpd2_release(&handle); | |
118 | - return SUCCESS; | |
122 | + if (vpd_handle){ | |
123 | + vpd2_release(&vpd_handle); | |
124 | + vpd_handle = nullptr; | |
125 | + } | |
126 | + | |
127 | + LOG_INFO("release_vpd"); | |
128 | + return SUCCESS; | |
119 | 129 | } |
120 | 130 | |
121 | 131 | |
122 | -int vf_feature_release(void *& handle) | |
132 | +int VehicleFeature::release_vf() | |
123 | 133 | { |
124 | - if (handle) | |
125 | - vf_release(&handle); | |
126 | - return SUCCESS; | |
134 | + if (vf_handle) { | |
135 | + vf_release(&vf_handle); | |
136 | + vf_handle = nullptr; | |
137 | + } | |
138 | + | |
139 | + LOG_INFO("release_vf"); | |
140 | + return SUCCESS; | |
127 | 141 | } |
128 | 142 | |
129 | -void RectboundCheck(int Width, int Height, int &left, int &top, int &width, int &height) | |
143 | +void VehicleFeature::RectboundCheck(int Width, int Height, int &left, int &top, int &width, int &height) | |
130 | 144 | { |
131 | 145 | #ifdef _DEBUG |
132 | - printf("img: Width = %d Height = %d\n", | |
133 | - Width, Height); | |
134 | - printf("Src: width = %d height = %d, x = %d, y =%d\n", Width, Height, left, top); | |
146 | + printf("img: Width = %d Height = %d\n", Width, Height); | |
147 | + printf("Src: width = %d height = %d, x = %d, y =%d\n", width, height, left, top); | |
135 | 148 | #endif |
136 | 149 | if (left <= 0) |
137 | 150 | left = 0; |
... | ... | @@ -153,6 +166,11 @@ void RectboundCheck(int Width, int Height, int &left, int &top, int &width, int |
153 | 166 | height = Height - 1 - top; |
154 | 167 | if (height <= 0) |
155 | 168 | height = 0; |
169 | + | |
170 | +#ifdef _DEBUG | |
171 | + printf("img: Width = %d Height = %d\n", Width, Height); | |
172 | + printf("Src: width = %d height = %d, x = %d, y =%d\n", width, height, left, top); | |
173 | +#endif | |
156 | 174 | } |
157 | 175 | |
158 | 176 | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/VehicleFeature.h
0 → 100644
1 | + | |
2 | + | |
3 | +#ifndef _VEHICLEFEATURES_H_ | |
4 | +#define _VEHICLEFEATURES_H_ | |
5 | +#include "vehicle_fea_int8.h" | |
6 | +#include "vpd.h" | |
7 | + | |
8 | +#ifndef __INT8__ | |
9 | +#define __INT8__ | |
10 | +typedef unsigned char int8; | |
11 | +#endif | |
12 | + | |
13 | +class VehicleFeature { | |
14 | +public: | |
15 | + VehicleFeature(/* args */); | |
16 | + ~VehicleFeature(); | |
17 | + | |
18 | + int init_vpd(char*dbpath, int gpuid, char* auth_license); | |
19 | + int process_vpd(sy_img * batch_img, int batch_size, vpd2_result*& result); | |
20 | + int release_vpd(); | |
21 | + | |
22 | + int init_vf(char*dbpath, int gpuid, char* auth_license); | |
23 | + int process_vf( sy_img * batch_img, int batch_size, int8**& result); | |
24 | + int release_vf(); | |
25 | + | |
26 | +private: | |
27 | + void RectboundCheck(int Width, int Height, int &left, int &top, int &width, int &height); | |
28 | + | |
29 | +private: | |
30 | + void* vpd_handle {nullptr}; | |
31 | + void* vf_handle {nullptr}; | |
32 | +}; | |
33 | + | |
34 | +#endif | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/VehiclePlate.cpp
... | ... | @@ -2,9 +2,18 @@ |
2 | 2 | #include <cuda_runtime.h> |
3 | 3 | |
4 | 4 | #include "../../FFNvDecoder/logger.hpp" |
5 | -//static string type[69] = { "��", "��", "��", "��", "��", "��", "��", "��", "��", "��", "��", "��", "��", "��", "��", "³", "ԥ", "��", "��", "��", "��", "��", "��", "��", "��", "��", "��", "��", "��", "��", "��", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "��", "ѧ", "ʹ", "��" }; | |
6 | 5 | |
7 | -int VehiclePlateDetectRecog_Init(void *&handle, int gpuid, char* auth_license) | |
6 | + | |
7 | +VehiclePlate::VehiclePlate(/* args */) | |
8 | +{ | |
9 | +} | |
10 | + | |
11 | +VehiclePlate::~VehiclePlate() | |
12 | +{ | |
13 | + LOG_INFO("~VehiclePlate"); | |
14 | +} | |
15 | + | |
16 | +int VehiclePlate::init(int gpuid, char* auth_license) | |
8 | 17 | { |
9 | 18 | vp_detect_param param; |
10 | 19 | param.gpuid = gpuid; |
... | ... | @@ -20,43 +29,39 @@ int VehiclePlateDetectRecog_Init(void *&handle, int gpuid, char* auth_license) |
20 | 29 | param.auth_license = "sy_va_sub_sdk_2023"; |
21 | 30 | |
22 | 31 | int ret = vpdr_init(&handle, param, rparam); |
23 | - | |
24 | - if (ret != 0) | |
25 | - { | |
26 | - cout << "vpdr_init Failed!" << endl; | |
32 | + if (ret != 0){ | |
33 | + LOG_ERROR("vpdr_init Failed!"); | |
27 | 34 | return FAILED; |
28 | 35 | } |
29 | 36 | |
37 | + LOG_INFO("vpdr_init success! gpu_id: {}", gpuid); | |
30 | 38 | return SUCCESS; |
31 | 39 | } |
32 | 40 | |
33 | -int VehiclePlateDetectRecog_Process(void * handle, sy_img * batch_img, int batchsize, vehicle_plate_result *&result) | |
41 | +int VehiclePlate::process(sy_img * batch_img, int batchsize, vehicle_plate_result *&result) | |
34 | 42 | { |
35 | 43 | sy_img cpu_batch_img[batchsize]; |
36 | 44 | for (int i = 0; i < batchsize; i++) |
37 | 45 | { |
38 | - if (batch_img[i].data_ == NULL) | |
39 | - { | |
46 | + if (batch_img[i].data_ == NULL) { | |
40 | 47 | LOG_ERROR("data null "); |
41 | 48 | return FAILED; |
42 | 49 | } |
43 | - cpu_batch_img[i].data_ = (unsigned char *)malloc(batch_img[i].w_ *batch_img[i].h_ * batch_img[i].c_ * sizeof(unsigned char)); | |
44 | - cudaMemcpy(cpu_batch_img[i].data_, batch_img[i].data_, batch_img[i].w_ *batch_img[i].h_ * batch_img[i].c_ * sizeof(unsigned char), cudaMemcpyDeviceToHost); | |
45 | - cpu_batch_img[i].w_ = batch_img[i].w_; | |
46 | - cpu_batch_img[i].h_ = batch_img[i].h_; | |
47 | - cpu_batch_img[i].c_ = batch_img[i].c_; | |
50 | + // cpu_batch_img[i].data_ = (unsigned char *)malloc(batch_img[i].w_ *batch_img[i].h_ * batch_img[i].c_ * sizeof(unsigned char)); | |
51 | + // cudaMemcpy(cpu_batch_img[i].data_, batch_img[i].data_, batch_img[i].w_ *batch_img[i].h_ * batch_img[i].c_ * sizeof(unsigned char), cudaMemcpyDeviceToHost); | |
52 | + // cpu_batch_img[i].w_ = batch_img[i].w_; | |
53 | + // cpu_batch_img[i].h_ = batch_img[i].h_; | |
54 | + // cpu_batch_img[i].c_ = batch_img[i].c_; | |
48 | 55 | } |
49 | 56 | |
50 | 57 | vehicle_plate_results * all_result = new vehicle_plate_results[batchsize] {}; |
51 | - for (int i = 0; i<batchsize; i++) | |
52 | - { | |
53 | - for (int j = 0; j < MAXPLATECOUNT; j++) | |
54 | - { | |
58 | + for (int i = 0; i<batchsize; i++) { | |
59 | + for (int j = 0; j < MAXPLATECOUNT; j++) { | |
55 | 60 | memset(&all_result[i].vehicle_plate_infos[j].rect, -1, sizeof(sy_rect)); |
56 | 61 | } |
57 | 62 | } |
58 | 63 | |
59 | - int index_count = vpdr_batch(handle, cpu_batch_img, batchsize, all_result); | |
64 | + int index_count = vpdr_batch(handle, batch_img, batchsize, all_result); | |
60 | 65 | cudaDeviceSynchronize(); |
61 | 66 | |
62 | 67 | for (int b = 0; b < batchsize; b++) |
... | ... | @@ -80,12 +85,12 @@ int VehiclePlateDetectRecog_Process(void * handle, sy_img * batch_img, int batc |
80 | 85 | memcpy(&result[b], &all_result[b].vehicle_plate_infos[best_index], sizeof(vehicle_plate_result)); |
81 | 86 | } |
82 | 87 | |
83 | - for (int i = 0; i < batchsize; i++) { | |
84 | - if(cpu_batch_img[i].data_ != nullptr) { | |
85 | - free(cpu_batch_img[i].data_); | |
86 | - cpu_batch_img[i].data_ = nullptr; | |
87 | - } | |
88 | - } | |
88 | + // for (int i = 0; i < batchsize; i++) { | |
89 | + // if(cpu_batch_img[i].data_ != nullptr) { | |
90 | + // free(cpu_batch_img[i].data_); | |
91 | + // cpu_batch_img[i].data_ = nullptr; | |
92 | + // } | |
93 | + // } | |
89 | 94 | |
90 | 95 | if (all_result != NULL) |
91 | 96 | delete [] all_result; |
... | ... | @@ -93,11 +98,13 @@ int VehiclePlateDetectRecog_Process(void * handle, sy_img * batch_img, int batc |
93 | 98 | return SUCCESS; |
94 | 99 | } |
95 | 100 | |
96 | -int VehiclePlateDetectRecog_Release(void *& handle) | |
101 | +int VehiclePlate::release() | |
97 | 102 | { |
98 | 103 | if (handle) { |
99 | 104 | vpdr_release(&handle); |
105 | + handle = nullptr; | |
100 | 106 | } |
101 | 107 | |
108 | + LOG_INFO("release"); | |
102 | 109 | return SUCCESS; |
103 | 110 | } | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/VehiclePlate.h
... | ... | @@ -11,6 +11,18 @@ |
11 | 11 | using namespace std; |
12 | 12 | |
13 | 13 | |
14 | -int VehiclePlateDetectRecog_Init(void *&handle, int gpuid, char* auth_license); | |
15 | -int VehiclePlateDetectRecog_Process(void * handle, sy_img * batch_img,int batchsize, vehicle_plate_result *&result); | |
16 | -int VehiclePlateDetectRecog_Release(void *& handle); | |
14 | +class VehiclePlate | |
15 | +{ | |
16 | +public: | |
17 | + VehiclePlate(/* args */); | |
18 | + ~VehiclePlate(); | |
19 | + | |
20 | + int init(int gpuid, char* auth_license); | |
21 | + int process(sy_img * batch_img,int batchsize, vehicle_plate_result *&result); | |
22 | + int release(); | |
23 | + | |
24 | +private: | |
25 | + void* handle {nullptr}; | |
26 | +}; | |
27 | + | |
28 | + | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/VehicleRearRecg.cpp
1 | 1 | #include "VehicleRearRecg.h" |
2 | + | |
3 | +#include "../../FFNvDecoder/logger.hpp" | |
4 | + | |
2 | 5 | using namespace std; |
3 | -int VehicleRearRecg_Init(void *&handle, char*dbpath, int gpuid, char* auth_license) | |
6 | + | |
7 | +VehicleRearRecg::VehicleRearRecg(/* args */) | |
8 | +{ | |
9 | +} | |
10 | + | |
11 | +VehicleRearRecg::~VehicleRearRecg() | |
12 | +{ | |
13 | + LOG_INFO("~VehicleRearRecg"); | |
14 | +} | |
15 | + | |
16 | +int VehicleRearRecg::init(char*dbpath, int gpuid, char* auth_license) | |
4 | 17 | { |
5 | 18 | vrr_param params; |
6 | 19 | params.gpuid = gpuid; |
... | ... | @@ -12,29 +25,35 @@ int VehicleRearRecg_Init(void *&handle, char*dbpath, int gpuid, char* auth_licen |
12 | 25 | params.auth_license = auth_license; |
13 | 26 | |
14 | 27 | int ret = vrr_init(&handle, params); |
15 | - if (ret != 0) | |
16 | - { | |
17 | - cout << "VRR Init Failed!" << endl; | |
28 | + if (ret != 0){ | |
29 | + LOG_ERROR("vrr_init failed!"); | |
18 | 30 | return FAILED; |
19 | 31 | } |
20 | 32 | |
33 | + LOG_INFO("vrr_init success! gpu_id: {}", gpuid); | |
21 | 34 | return SUCCESS; |
22 | 35 | } |
23 | -int VehicleRearRecg_Process(void * handle, sy_img * batch_img, int batchsize, vehicle_rear_result *&vr_result) | |
36 | +int VehicleRearRecg::process(sy_img * batch_img, int batchsize, vehicle_rear_result *&vr_result) | |
24 | 37 | { |
25 | 38 | for (int i = 0; i < batchsize; i++) |
26 | 39 | { |
27 | - if (batch_img[i].data_ == NULL) | |
28 | - cout << i << " data null" << endl; | |
40 | + if (batch_img[i].data_ == NULL) { | |
41 | + LOG_ERROR("data null "); | |
42 | + return FAILED; | |
43 | + } | |
29 | 44 | } |
30 | 45 | |
31 | 46 | vrr_batch(handle, batch_img, batchsize, vr_result); |
32 | 47 | |
33 | 48 | return SUCCESS; |
34 | 49 | } |
35 | -int VehicleRearRecg_Release(void *& handle) | |
50 | +int VehicleRearRecg::release() | |
36 | 51 | { |
37 | - if (handle) | |
38 | - vrr_release(&handle); | |
52 | + if (handle) { | |
53 | + vrr_release(&handle); | |
54 | + handle = nullptr; | |
55 | + } | |
56 | + | |
57 | + LOG_INFO("release"); | |
39 | 58 | return SUCCESS; |
40 | 59 | } | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/VehicleRearRecg.h
... | ... | @@ -4,10 +4,21 @@ |
4 | 4 | #include <iostream> |
5 | 5 | #include "utools.h" |
6 | 6 | #include <vector> |
7 | + | |
8 | + | |
7 | 9 | using namespace std; |
8 | 10 | |
9 | 11 | |
12 | +class VehicleRearRecg | |
13 | +{ | |
14 | +private: | |
15 | + void* handle{nullptr}; | |
16 | + | |
17 | +public: | |
18 | + VehicleRearRecg(/* args */); | |
19 | + ~VehicleRearRecg(); | |
10 | 20 | |
11 | -int VehicleRearRecg_Init(void *&handle, char*dbpath, int gpuid, char* auth_license); | |
12 | -int VehicleRearRecg_Process(void * handle, sy_img * batch_img, int batchsize, vehicle_rear_result *&vr_result); | |
13 | -int VehicleRearRecg_Release(void *& handle); | |
21 | + int init(char*dbpath, int gpuid, char* auth_license); | |
22 | + int process(sy_img * batch_img, int batchsize, vehicle_rear_result *&vr_result); | |
23 | + int release(); | |
24 | +}; | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/VehicleRecognition.cpp
1 | -#include "vehicle_recognition.h" | |
1 | +#include "VehicleRecognition.h" | |
2 | 2 | #include <iostream> |
3 | 3 | #include "sy_errorinfo.h" |
4 | -#include "vehicle_features.h" | |
4 | + | |
5 | +#include "../../FFNvDecoder/logger.hpp" | |
6 | + | |
7 | + | |
5 | 8 | using namespace std; |
6 | -int VehicleRecognition_Init(void *&handle, char*dbpath, int gpuid, char* auth_license) | |
9 | + | |
10 | + | |
11 | +VehicleRecognition::VehicleRecognition(/* args */) | |
12 | +{ | |
13 | +} | |
14 | + | |
15 | +VehicleRecognition::~VehicleRecognition() | |
16 | +{ | |
17 | + LOG_INFO("~VehicleRecognition"); | |
18 | +} | |
19 | + | |
20 | +int VehicleRecognition::init(char*dbpath, int gpuid, char* auth_license) | |
7 | 21 | { |
8 | 22 | vr_param params; |
9 | 23 | params.gpuid = 0; |
... | ... | @@ -16,20 +30,22 @@ int VehicleRecognition_Init(void *&handle, char*dbpath, int gpuid, char* auth_li |
16 | 30 | params.auth_license = "sy_va_sub_sdk_2023"; |
17 | 31 | |
18 | 32 | int ret = vr_init(&handle, params); |
19 | - if (ret != 0) | |
20 | - { | |
21 | - cout << "VR Init Failed!" << endl; | |
33 | + if (ret != 0) { | |
34 | + LOG_ERROR("vr_init failed!"); | |
22 | 35 | return FAILED; |
23 | 36 | } |
37 | + | |
38 | + LOG_INFO("vr_init success! gpu_id: {}", gpuid); | |
24 | 39 | return SUCCESS; |
25 | 40 | } |
26 | 41 | |
27 | -int VehicleRecognition_Process(void * handle, sy_img * batch_img, int batchsize, vehicle_recog_result *&vrresult) | |
42 | +int VehicleRecognition::process(sy_img * batch_img, int batchsize, vehicle_recog_result *&vrresult) | |
28 | 43 | { |
29 | - for (int i = 0; i < batchsize; i++) | |
30 | - { | |
31 | - if (batch_img[i].data_ == NULL) | |
32 | - cout << i << " data null" << endl; | |
44 | + for (int i = 0; i < batchsize; i++) { | |
45 | + if (batch_img[i].data_ == NULL) { | |
46 | + LOG_ERROR("data null "); | |
47 | + return FAILED; | |
48 | + } | |
33 | 49 | } |
34 | 50 | |
35 | 51 | vr_batch(handle, batch_img, batchsize, vrresult); |
... | ... | @@ -37,9 +53,13 @@ int VehicleRecognition_Process(void * handle, sy_img * batch_img, int batchsize |
37 | 53 | return SUCCESS; |
38 | 54 | } |
39 | 55 | |
40 | -int VehicleRecognition_Release(void *& handle) | |
56 | +int VehicleRecognition::release() | |
41 | 57 | { |
42 | - if (handle) | |
43 | - vr_release(&handle); | |
58 | + if (handle) { | |
59 | + vr_release(&handle); | |
60 | + handle = nullptr; | |
61 | + } | |
62 | + | |
63 | + LOG_INFO("release"); | |
44 | 64 | return SUCCESS; |
45 | -} | |
65 | +} | |
46 | 66 | \ No newline at end of file | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/VehicleRecognition.h
... | ... | @@ -9,7 +9,19 @@ |
9 | 9 | using namespace std; |
10 | 10 | |
11 | 11 | |
12 | +class VehicleRecognition | |
13 | +{ | |
14 | +public: | |
15 | + VehicleRecognition(/* args */); | |
16 | + ~VehicleRecognition(); | |
17 | + | |
18 | + int init(char*dbpath, int gpuid, char* auth_license); | |
19 | + int process(sy_img * batch_img,int batchsize, vehicle_recog_result*&vr_result); | |
20 | + int release(); | |
21 | + | |
22 | +private: | |
23 | + void* handle{nullptr}; | |
24 | +}; | |
25 | + | |
26 | + | |
12 | 27 | |
13 | -int VehicleRecognition_Init(void *&handle, char*dbpath, int gpuid, char* auth_license); | |
14 | -int VehicleRecognition_Process(void * handle, sy_img * batch_img,int batchsize, vehicle_recog_result*&vr_result); | |
15 | -int VehicleRecognition_Release(void *& handle); | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/non_vehicle_fea.h deleted
1 | -#pragma once | |
2 | -#include "non_vehicle_fea_trt.h" | |
3 | -#include "utools.h" | |
4 | - | |
5 | -int NonVehicleFea_Init(void *&handle, int gpuid, char* auth_license); | |
6 | -int NonVehicleFea_Process(void * handle, sy_img * batch_img, int batch_size, human_fea_result*& result); | |
7 | -int NonVehicleFea_Release(void *& handle); | |
8 | 0 | \ No newline at end of file |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.cpp
1 | 1 | #include "opencv2/opencv.hpp" |
2 | 2 | #include "opencv2/highgui/highgui.hpp" |
3 | 3 | #include "snapshot_helper.h" |
4 | -#include "HumanParsing.h" | |
5 | -#include "VehiclePlate.h" | |
6 | -#include "VehicleRecognition.h" | |
7 | -#include "VehicleColor.h" | |
8 | -#include "non_vehicle_fea.h" | |
9 | -//#include "HumanFeatures.h" | |
10 | -#include "vehicle_features.h" | |
11 | -#include "VehicleRearRecg.h" | |
12 | 4 | #include "CropImg.h" |
13 | 5 | |
14 | 6 | #include <chrono> |
... | ... | @@ -114,7 +106,7 @@ void snapshot_helper::snapshot_helper_init(int gpuid, double gpu_total_memory, c |
114 | 106 | |
115 | 107 | if (hp_analysis_cf == SY_CONFIG_OPEN || hf_recg_cf == SY_CONFIG_OPEN) |
116 | 108 | { |
117 | - HumanParsing_Init(hp_handle, gpuid, auth_license); | |
109 | + m_human_parsing.init(gpuid, auth_license); | |
118 | 110 | } |
119 | 111 | |
120 | 112 | if (hcp_analysis_cf == SY_CONFIG_OPEN || hcf_recg_cf == SY_CONFIG_OPEN) |
... | ... | @@ -124,25 +116,24 @@ void snapshot_helper::snapshot_helper_init(int gpuid, double gpu_total_memory, c |
124 | 116 | |
125 | 117 | if (hf_recg_cf == SY_CONFIG_OPEN || hcf_recg_cf == SY_CONFIG_OPEN) |
126 | 118 | { |
127 | - NonVehicleFea_Init(nvf_handle, gpuid, auth_license); | |
119 | + m_human_fea.init(gpuid, auth_license); | |
128 | 120 | } |
129 | 121 | |
130 | - | |
131 | 122 | if (vehicle_analysis_cf == SY_CONFIG_OPEN) |
132 | 123 | { |
133 | - VehicleColor_Init(vc_handle, gpuid, auth_license); | |
134 | - VehiclePlateDetectRecog_Init(vp_handle, gpuid, auth_license); | |
135 | - VehicleRecognition_Init(vr_handle, dbpath_utf8, gpuid, auth_license); | |
136 | - VehicleRearRecg_Init(vrr_handle, dbpath, gpuid, auth_license); | |
124 | + m_vehicle_color.init(gpuid, auth_license); | |
125 | + m_vehicle_plate.init(gpuid, auth_license); | |
126 | + m_vehicle_recognition.init(dbpath_utf8, gpuid, auth_license); | |
127 | + m_vehicle_rear_recog.init(dbpath, gpuid, auth_license); | |
137 | 128 | } |
138 | - if (vehicle_analysis_cf == SY_CONFIG_OPEN || vcf_recg_cf == SY_CONFIG_OPEN) | |
139 | - { | |
140 | - vhd_features_init(vhd_handle, dbpath_utf8, gpuid, auth_license); | |
129 | + | |
130 | + if (vehicle_analysis_cf == SY_CONFIG_OPEN || vcf_recg_cf == SY_CONFIG_OPEN) { | |
131 | + m_vehicle_feature.init_vpd(dbpath_utf8, gpuid, auth_license); | |
141 | 132 | } |
142 | 133 | |
143 | 134 | if (vcf_recg_cf == SY_CONFIG_OPEN) |
144 | 135 | { |
145 | - vf_features_init(vf_handle, dbpath_utf8, gpuid, auth_license); | |
136 | + m_vehicle_feature.init_vf(dbpath_utf8, gpuid, auth_license); | |
146 | 137 | } |
147 | 138 | |
148 | 139 | |
... | ... | @@ -174,15 +165,15 @@ void snapshot_helper::snapshot_helper_init(int gpuid, double gpu_total_memory, c |
174 | 165 | void snapshot_helper::snapshot_helper_release() |
175 | 166 | { |
176 | 167 | m_bExit = true; |
177 | - HumanParsing_Release(hp_handle); | |
168 | + m_human_parsing.release(); | |
178 | 169 | m_human_car_parsing.release(); |
179 | - VehicleColor_Release(vc_handle); | |
180 | - VehiclePlateDetectRecog_Release(vp_handle); | |
181 | - VehicleRecognition_Release(vr_handle); | |
182 | - VehicleRearRecg_Release(vrr_handle); | |
183 | - vhd_feature_release(vhd_handle); | |
184 | - vf_feature_release(vf_handle); | |
185 | - NonVehicleFea_Release(nvf_handle); | |
170 | + m_vehicle_color.release(); | |
171 | + m_vehicle_plate.release(); | |
172 | + m_vehicle_recognition.release(); | |
173 | + m_vehicle_rear_recog.release(); | |
174 | + m_vehicle_feature.release_vpd(); | |
175 | + m_vehicle_feature.release_vf(); | |
176 | + m_human_fea.release(); | |
186 | 177 | |
187 | 178 | if (batch_hp != NULL) |
188 | 179 | { |
... | ... | @@ -515,16 +506,12 @@ void snapshot_helper::finish_task_ss_analysis(int task_id) //是 |
515 | 506 | if (hp_analysis_cf == SY_CONFIG_OPEN) |
516 | 507 | { |
517 | 508 | result = new hp_analysis_res[hp_batch_count]{}; |
518 | - //TimeCounting t("HumanParsing_Process"); | |
519 | - HumanParsing_Process(hp_handle, finish_hp_img, hp_batch_count, result); | |
509 | + m_human_parsing.process(finish_hp_img, hp_batch_count, result); | |
520 | 510 | } |
521 | 511 | |
522 | - if (hf_recg_cf == SY_CONFIG_OPEN) | |
523 | - { | |
512 | + if (hf_recg_cf == SY_CONFIG_OPEN) { | |
524 | 513 | result_f = new human_fea_result[hp_batch_count]{}; |
525 | - | |
526 | - //TimeCounting t("NonVehicleFea_Process"); | |
527 | - NonVehicleFea_Process(nvf_handle, finish_hp_img, hp_batch_count, result_f); | |
514 | + m_human_fea.process(finish_hp_img, hp_batch_count, result_f); | |
528 | 515 | } |
529 | 516 | int resIndex = 0; |
530 | 517 | for (int k = 0; k < hp_batch_count; k++) |
... | ... | @@ -621,11 +608,9 @@ void snapshot_helper::finish_task_ss_analysis(int task_id) //是 |
621 | 608 | m_human_car_parsing.process(finish_hcp_img, hcp_batch_count, result); |
622 | 609 | } |
623 | 610 | |
624 | - if (hcf_recg_cf == SY_CONFIG_OPEN) | |
625 | - { | |
611 | + if (hcf_recg_cf == SY_CONFIG_OPEN) { | |
626 | 612 | result_f = new human_fea_result[hcp_batch_count]{}; |
627 | - //TimeCounting t("NonVehicleFea_Process"); | |
628 | - NonVehicleFea_Process(nvf_handle, finish_hcp_img, hcp_batch_count, result_f); | |
613 | + m_human_fea.process(finish_hcp_img, hcp_batch_count, result_f); | |
629 | 614 | } |
630 | 615 | int resIndex = 0; |
631 | 616 | |
... | ... | @@ -720,11 +705,8 @@ void snapshot_helper::finish_task_ss_analysis(int task_id) //是 |
720 | 705 | vehicle_plate_result *vp_result = new vehicle_plate_result[det_batch_size]{}; |
721 | 706 | vr_result *vrresult = new vr_result[det_batch_size]{}; |
722 | 707 | if (vehicle_analysis_cf == SY_CONFIG_OPEN) { |
723 | - if(det_batch_size == 3) { | |
724 | - printf("batchsize: %d \n", det_batch_size); | |
725 | - } | |
726 | - VehicleColor_Process(vc_handle, finish_vehicle_img, det_batch_size, vcresult); | |
727 | - VehiclePlateDetectRecog_Process(vp_handle, finish_vehicle_img, det_batch_size, vp_result); | |
708 | + m_vehicle_color.process(finish_vehicle_img, det_batch_size, vcresult); | |
709 | + m_vehicle_plate.process(finish_vehicle_img, det_batch_size, vp_result); | |
728 | 710 | VehicleRecog_Process(finish_vehicle_img, det_batch_size, vrresult, det_vehicle_keys.data()); |
729 | 711 | } |
730 | 712 | |
... | ... | @@ -735,7 +717,7 @@ void snapshot_helper::finish_task_ss_analysis(int task_id) //是 |
735 | 717 | fea[ii] = new int8[FEATURESIZE]{}; |
736 | 718 | } |
737 | 719 | |
738 | - vf_features_process(vf_handle, finish_vehicle_img, det_batch_size, fea); | |
720 | + m_vehicle_feature.process_vf(finish_vehicle_img, det_batch_size, fea); | |
739 | 721 | } |
740 | 722 | |
741 | 723 | int feaIndex = 0; |
... | ... | @@ -885,18 +867,14 @@ void snapshot_helper::hp_analysis() |
885 | 867 | } |
886 | 868 | |
887 | 869 | //算法分析 |
888 | - if (hp_analysis_cf == SY_CONFIG_OPEN) | |
889 | - { | |
870 | + if (hp_analysis_cf == SY_CONFIG_OPEN) { | |
890 | 871 | result = new hp_analysis_res[obj_batch_count]{}; |
891 | - //TimeCounting t("HumanParsing_Process"); | |
892 | - HumanParsing_Process(hp_handle, batch_hp, obj_batch_count, result); | |
872 | + m_human_parsing.process(batch_hp, obj_batch_count, result); | |
893 | 873 | } |
894 | 874 | |
895 | - if (hf_recg_cf == SY_CONFIG_OPEN) | |
896 | - { | |
875 | + if (hf_recg_cf == SY_CONFIG_OPEN) { | |
897 | 876 | result_f = new human_fea_result[obj_batch_count]{}; |
898 | - //TimeCounting t("NonVehicleFea_Process"); | |
899 | - NonVehicleFea_Process(nvf_handle, batch_hp, obj_batch_count, result_f); | |
877 | + m_human_fea.process(batch_hp, obj_batch_count, result_f); | |
900 | 878 | } |
901 | 879 | |
902 | 880 | //删除已经进行保存和二次属性分析的目标 |
... | ... | @@ -1003,11 +981,9 @@ void snapshot_helper::hcp_analysis() |
1003 | 981 | m_human_car_parsing.process(batch_hcp, obj_batch_count, result); |
1004 | 982 | } |
1005 | 983 | |
1006 | - if (hcf_recg_cf == SY_CONFIG_OPEN) | |
1007 | - { | |
984 | + if (hcf_recg_cf == SY_CONFIG_OPEN) { | |
1008 | 985 | result_f = new human_fea_result[obj_batch_count]{}; |
1009 | - //TimeCounting t("NonVehicleFea_Process"); | |
1010 | - NonVehicleFea_Process(nvf_handle, batch_hcp, obj_batch_count, result_f); | |
986 | + m_human_fea.process(batch_hcp, obj_batch_count, result_f); | |
1011 | 987 | } |
1012 | 988 | |
1013 | 989 | int resIndex = 0; |
... | ... | @@ -1113,10 +1089,7 @@ bool snapshot_helper::vehicle_color_analysis() |
1113 | 1089 | } |
1114 | 1090 | |
1115 | 1091 | vc_result *vcresult = new vc_result[cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/]{}; |
1116 | - { | |
1117 | - //TimeCounting t("VehicleColor_Process"); | |
1118 | - VehicleColor_Process(vc_handle, batch_vehicle, cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, vcresult); | |
1119 | - } | |
1092 | + m_vehicle_color.process(batch_vehicle, cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, vcresult); | |
1120 | 1093 | |
1121 | 1094 | for (int i = 0; i < cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/; i++) |
1122 | 1095 | { |
... | ... | @@ -1195,7 +1168,7 @@ bool snapshot_helper::vehicle_plate_dr_analysis() |
1195 | 1168 | batch_vehicle[i].set_data(VEHICLE_WIDTH, VEHICLE_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame); |
1196 | 1169 | } |
1197 | 1170 | vehicle_plate_result *vp_result = new vehicle_plate_result[cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/]{}; |
1198 | - VehiclePlateDetectRecog_Process(vp_handle, batch_vehicle, cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, vp_result); | |
1171 | + m_vehicle_plate.process(batch_vehicle, cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, vp_result); | |
1199 | 1172 | |
1200 | 1173 | int resIndex = 0; |
1201 | 1174 | for (int i = 0; i < cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/; i++) |
... | ... | @@ -1242,7 +1215,7 @@ void snapshot_helper::VehicleRecog_Process(sy_img * batch_img, int batchsize, vr |
1242 | 1215 | { |
1243 | 1216 | vhd_res[b].vpd_res = new vpd_info[OBJ_MAX_COUNT]; |
1244 | 1217 | } |
1245 | - vhd_features_process(vhd_handle, batch_img, batchsize, vhd_res); | |
1218 | + m_vehicle_feature.process_vpd(batch_img, batchsize, vhd_res); | |
1246 | 1219 | |
1247 | 1220 | for (int vc_idx = 0; vc_idx < batchsize; vc_idx++) |
1248 | 1221 | { |
... | ... | @@ -1323,7 +1296,7 @@ void snapshot_helper::VehicleRecog_Process(sy_img * batch_img, int batchsize, vr |
1323 | 1296 | { |
1324 | 1297 | LOG_DEBUG("index_head : {}", index_head); |
1325 | 1298 | vehicle_recog_result *vrresult = new vehicle_recog_result[index_head]{}; |
1326 | - VehicleRecognition_Process(vr_handle, batch_vehicle_head, index_head, vrresult); | |
1299 | + m_vehicle_recognition.process(batch_vehicle_head, index_head, vrresult); | |
1327 | 1300 | |
1328 | 1301 | |
1329 | 1302 | int resIndex = 0; |
... | ... | @@ -1339,7 +1312,7 @@ void snapshot_helper::VehicleRecog_Process(sy_img * batch_img, int batchsize, vr |
1339 | 1312 | if (index_rear != 0) |
1340 | 1313 | { |
1341 | 1314 | vehicle_rear_result *vrresult = new vehicle_rear_result[index_rear]{}; |
1342 | - VehicleRearRecg_Process(vrr_handle, batch_vehicle_rear, index_rear, vrresult); | |
1315 | + m_vehicle_rear_recog.process(batch_vehicle_rear, index_rear, vrresult); | |
1343 | 1316 | |
1344 | 1317 | int resIndex = 0; |
1345 | 1318 | for (auto & item : mp_rear) |
... | ... | @@ -1447,7 +1420,8 @@ bool snapshot_helper::vehicle_recg_analysis() |
1447 | 1420 | { |
1448 | 1421 | vhd_res[b].vpd_res = new vpd_info[OBJ_MAX_COUNT]; |
1449 | 1422 | } |
1450 | - vhd_features_process(vhd_handle, batch_vehicle, cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, vhd_res); | |
1423 | + | |
1424 | + m_vehicle_feature.process_vpd(batch_vehicle, cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, vhd_res); | |
1451 | 1425 | |
1452 | 1426 | for (int vc_idx = 0; vc_idx < cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/; vc_idx++) |
1453 | 1427 | { |
... | ... | @@ -1528,7 +1502,7 @@ bool snapshot_helper::vehicle_recg_analysis() |
1528 | 1502 | if (index_head != 0) |
1529 | 1503 | { |
1530 | 1504 | vehicle_recog_result *vrresult = new vehicle_recog_result[index_head]{}; |
1531 | - VehicleRecognition_Process(vr_handle, batch_vehicle_head, index_head, vrresult); | |
1505 | + m_vehicle_recognition.process(batch_vehicle_head, index_head, vrresult); | |
1532 | 1506 | |
1533 | 1507 | int resIndex = 0; |
1534 | 1508 | for (auto & item : mp_head) |
... | ... | @@ -1549,7 +1523,7 @@ bool snapshot_helper::vehicle_recg_analysis() |
1549 | 1523 | if (index_rear != 0) |
1550 | 1524 | { |
1551 | 1525 | vehicle_rear_result *vrresult = new vehicle_rear_result[index_rear]{}; |
1552 | - VehicleRearRecg_Process(vrr_handle, batch_vehicle_rear, index_rear, vrresult); | |
1526 | + m_vehicle_rear_recog.process(batch_vehicle_rear, index_rear, vrresult); | |
1553 | 1527 | |
1554 | 1528 | int resIndex = 0; |
1555 | 1529 | for (auto & item : mp_rear) |
... | ... | @@ -1609,10 +1583,7 @@ bool snapshot_helper::vehicle_recg_analysis() |
1609 | 1583 | memset(fea[i], 0, sizeof(int8) * FEATURESIZE); |
1610 | 1584 | } |
1611 | 1585 | |
1612 | - { | |
1613 | - //TimeCounting t("vf_features_process"); | |
1614 | - vf_features_process(vf_handle, batch_vehicle, cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, fea); | |
1615 | - } | |
1586 | + m_vehicle_feature.process_vf(batch_vehicle, cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, fea); | |
1616 | 1587 | |
1617 | 1588 | int resIndex = 0; |
1618 | 1589 | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.h
... | ... | @@ -11,6 +11,14 @@ |
11 | 11 | #include <condition_variable> |
12 | 12 | #include "ImageSaveCache.h" |
13 | 13 | #include "HumanCarParsing.h" |
14 | +#include "HumanParsing.h" | |
15 | +#include "HumanFea.h" | |
16 | +#include "VehicleFeature.h" | |
17 | +#include "VehiclePlate.h" | |
18 | +#include "VehicleColor.h" | |
19 | +#include "VehicleRearRecg.h" | |
20 | +#include "VehicleRecognition.h" | |
21 | + | |
14 | 22 | using namespace std; |
15 | 23 | |
16 | 24 | #define EDGESIZE 4 |
... | ... | @@ -33,9 +41,6 @@ using namespace std; |
33 | 41 | #define FALSE 0 |
34 | 42 | #endif |
35 | 43 | |
36 | - | |
37 | - | |
38 | - | |
39 | 44 | #define Sleep(a) usleep((a)*1000) |
40 | 45 | //typedef int BOOL; |
41 | 46 | #define BOOL bool |
... | ... | @@ -182,7 +187,6 @@ private: |
182 | 187 | int save_snapshot(bool is_image, bool on_image_display, OBJ_KEY obj_key, char* filename, char* mode, unsigned char* imgData, int width, int height, int taskID, int objID, int recFlag, int left, int top, int right, int bottom); |
183 | 188 | int save_snapshot(OBJ_KEY obj_key); |
184 | 189 | int save_face_snapshot(OBJ_KEY obj_key); |
185 | - | |
186 | 190 | void save_without_analysis(OBJ_KEY obj_key); |
187 | 191 | |
188 | 192 | //针对车拆开的二次属性分析 |
... | ... | @@ -190,6 +194,13 @@ private: |
190 | 194 | |
191 | 195 | private: |
192 | 196 | HumanCarParsing m_human_car_parsing; |
197 | + HumanParsing m_human_parsing; | |
198 | + HumanFea m_human_fea; | |
199 | + VehicleFeature m_vehicle_feature; | |
200 | + VehicleColor m_vehicle_color; | |
201 | + VehiclePlate m_vehicle_plate; | |
202 | + VehicleRearRecg m_vehicle_rear_recog; | |
203 | + VehicleRecognition m_vehicle_recognition; | |
193 | 204 | |
194 | 205 | queue<OBJ_KEY> count_person; |
195 | 206 | queue<OBJ_KEY> count_bike; |
... | ... | @@ -203,15 +214,7 @@ private: |
203 | 214 | sy_img * batch_hcp = nullptr; |
204 | 215 | sy_img * batch_vehicle = nullptr; |
205 | 216 | sy_img * batch_vehicle_vf = nullptr; |
206 | - | |
207 | - void * hp_handle = nullptr; | |
208 | - void * vc_handle = nullptr; | |
209 | - void * vp_handle = nullptr; | |
210 | - void * vr_handle = nullptr; | |
211 | - void * vrr_handle = nullptr; | |
212 | - void * nvf_handle = nullptr; | |
213 | - void * vhd_handle = nullptr; | |
214 | - void * vf_handle = nullptr; | |
217 | + | |
215 | 218 | sy_command hp_analysis_cf; |
216 | 219 | sy_command hcp_analysis_cf; |
217 | 220 | sy_command vehicle_analysis_cf; |
... | ... | @@ -222,9 +225,6 @@ private: |
222 | 225 | sy_command vehicle_plate_det_recg_cf; |
223 | 226 | sy_command face_detect_cf; |
224 | 227 | |
225 | - void * hf_handle = nullptr; | |
226 | - void * hcf_handle = nullptr; | |
227 | - | |
228 | 228 | int count_vehivle_finishanalysis = 0; |
229 | 229 | int OBJ_SCALE = 2; |
230 | 230 | int OBJ_BATCH_COUNT = 0; | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/vehicle_features.h deleted
1 | - | |
2 | - | |
3 | -#ifndef _VEHICLEFEATURES_H_ | |
4 | -#define _VEHICLEFEATURES_H_ | |
5 | -#include "vehicle_fea_int8.h" | |
6 | -#include "vpd.h" | |
7 | - | |
8 | -#ifndef __INT8__ | |
9 | -#define __INT8__ | |
10 | -typedef unsigned char int8; | |
11 | -#endif | |
12 | - | |
13 | -int vhd_features_init(void *&handle, char*dbpath, int gpuid, char* auth_license); | |
14 | - | |
15 | -int vf_features_init(void *&handle, char*dbpath, int gpuid, char* auth_license); | |
16 | - | |
17 | -int vhd_features_process(void * handle, sy_img * batch_img, int batch_size, vpd2_result*& result); | |
18 | - | |
19 | -int vf_features_process(void * handle, sy_img * batch_img, int batch_size, int8**& result); | |
20 | - | |
21 | -int vhd_feature_release(void *& handle); | |
22 | - | |
23 | -int vf_feature_release(void *& handle); | |
24 | - | |
25 | -#endif |