Commit e6b08c4f52fdfb62d0ed3f89ec961c5c32f817ee

Authored by Hu Chunming
1 parent 5e69f8fc

优化demo

build/demo/Makefile
@@ -2,7 +2,6 @@ CC = gcc @@ -2,7 +2,6 @@ CC = gcc
2 XX = c++ 2 XX = c++
3 3
4 4
5 -  
6 PROJ_ALL_PATH = $(PWD)/../.. 5 PROJ_ALL_PATH = $(PWD)/../..
7 CUR_PROJ_PATH = $(PROJ_ALL_PATH)/src 6 CUR_PROJ_PATH = $(PROJ_ALL_PATH)/src
8 BIN_PATH = $(PROJ_ALL_PATH)/bin 7 BIN_PATH = $(PROJ_ALL_PATH)/bin
@@ -17,22 +16,11 @@ SPDLOG_ROOT = $(PROJ_ALL_PATH)/3rdparty/spdlog-1.9.2/release @@ -17,22 +16,11 @@ SPDLOG_ROOT = $(PROJ_ALL_PATH)/3rdparty/spdlog-1.9.2/release
17 ALGORITHM_PATH = $(PROJ_ALL_PATH)/algorithm 16 ALGORITHM_PATH = $(PROJ_ALL_PATH)/algorithm
18 17
19 INCLUDES = -I$(PROJ_ALL_PATH)/src/common \ 18 INCLUDES = -I$(PROJ_ALL_PATH)/src/common \
20 - -I$(PROJ_ALL_PATH)/src/common/dvpp \  
21 - -I$(PROJ_ALL_PATH)/src/common/cnn \  
22 - -I$(PROJ_ALL_PATH)/src/common/cnn_cls \  
23 - -I$(PROJ_ALL_PATH)/src/common/road_cnn \  
24 - -I$(PROJ_ALL_PATH)/src/common/dvppx \  
25 - -I$(PROJ_ALL_PATH)/src/common/model_process \  
26 - -I$(CUR_PROJ_PATH)/../va \  
27 -I$(OPENCV_PATH)/include \ 19 -I$(OPENCV_PATH)/include \
28 -I$(OPENCV_PATH)/include/opencv2 \ 20 -I$(OPENCV_PATH)/include/opencv2 \
29 -I$(ACL_PATH)/include \ 21 -I$(ACL_PATH)/include \
30 -I$(SPDLOG_ROOT)/include \ 22 -I$(SPDLOG_ROOT)/include \
31 - -I$(CUR_PROJ_PATH)/ai_engine_module \  
32 -I$(ALGORITHM_PATH)/vehicle_analysis \ 23 -I$(ALGORITHM_PATH)/vehicle_analysis \
33 - -I$(ALGORITHM_PATH)/vid_clothes2/vid_clothes \  
34 - -I$(ALGORITHM_PATH)/hp2/hp \  
35 - -I$(ALGORITHM_PATH)/hcp2/hcp \  
36 24
37 25
38 # CXXFLAGS = -O0 -std=c++11 $(INCLUDES) -DENABLE_DVPP_INTERFACE -D_GLIBCXX_USE_CXX11_ABI=0 26 # CXXFLAGS = -O0 -std=c++11 $(INCLUDES) -DENABLE_DVPP_INTERFACE -D_GLIBCXX_USE_CXX11_ABI=0
@@ -49,10 +37,7 @@ local_shared_libs := \ @@ -49,10 +37,7 @@ local_shared_libs := \
49 ascendcl \ 37 ascendcl \
50 acl_dvpp \ 38 acl_dvpp \
51 spdlog \ 39 spdlog \
52 - vehicle_analysis \  
53 - vid_clothes \  
54 - hp \  
55 - hcp \ 40 + village_ascend_arm \
56 41
57 42
58 SHARED_LIBRARIES := $(foreach shared_lib, $(local_shared_libs), -l$(shared_lib)) 43 SHARED_LIBRARIES := $(foreach shared_lib, $(local_shared_libs), -l$(shared_lib))
@@ -61,17 +46,7 @@ SHARED_LIBRARIES_DIRS := $(foreach shared_lib_dir, $(local_shared_libs_dirs), -L @@ -61,17 +46,7 @@ SHARED_LIBRARIES_DIRS := $(foreach shared_lib_dir, $(local_shared_libs_dirs), -L
61 46
62 CXXFLAGS= -g -O0 -fPIC $(INCLUDES) $(DEFS) -lpthread -lrt -lz -fexceptions -std=c++11 -DENABLE_DVPP_INTERFACE -D_GLIBCXX_USE_CXX11_ABI=0 -fvisibility=hidden -Wall -Wno-deprecated -Wdeprecated-declarations -Wl,-Bsymbolic -ldl 47 CXXFLAGS= -g -O0 -fPIC $(INCLUDES) $(DEFS) -lpthread -lrt -lz -fexceptions -std=c++11 -DENABLE_DVPP_INTERFACE -D_GLIBCXX_USE_CXX11_ABI=0 -fvisibility=hidden -Wall -Wno-deprecated -Wdeprecated-declarations -Wl,-Bsymbolic -ldl
63 48
64 -SRCS := $(wildcard $(CUR_PROJ_PATH)/*.cpp) \  
65 - $(wildcard $(CUR_PROJ_PATH)/demo/*.cpp) \  
66 - $(wildcard $(CUR_PROJ_PATH)/ai_engine_module/*.cpp) \  
67 - $(wildcard $(CUR_PROJ_PATH)/common/*.cpp) \  
68 - $(wildcard $(CUR_PROJ_PATH)/common/dvpp/*.cpp) \  
69 - $(wildcard $(CUR_PROJ_PATH)/common/cnn_cls/*.cpp) \  
70 - $(wildcard $(CUR_PROJ_PATH)/common/road_cnn/*.cpp) \  
71 - $(wildcard $(CUR_PROJ_PATH)/common/cnn/*.cpp) \  
72 - $(wildcard $(CUR_PROJ_PATH)/common/dvppx/*.cpp) \  
73 - $(wildcard $(CUR_PROJ_PATH)/common/model_process/*.cpp) \  
74 - $(wildcard $(CUR_PROJ_PATH)/utils/*.cpp) \ 49 +SRCS := $(wildcard $(CUR_PROJ_PATH)/demo/*.cpp) \
75 50
76 DIRS := $(notdir $(SRCS)) 51 DIRS := $(notdir $(SRCS))
77 OBJS := $(patsubst %cpp, %o, $(DIRS)) 52 OBJS := $(patsubst %cpp, %o, $(DIRS))
@@ -80,40 +55,10 @@ all: $(TARGET) @@ -80,40 +55,10 @@ all: $(TARGET)
80 55
81 $(TARGET):$(OBJS) 56 $(TARGET):$(OBJS)
82 $(XX) -o $@ $^ $(CXXFLAGS) $(SHARED_LIBRARIES_DIRS) $(SHARED_LIBRARIES) 57 $(XX) -o $@ $^ $(CXXFLAGS) $(SHARED_LIBRARIES_DIRS) $(SHARED_LIBRARIES)
83 -  
84 -%.o:$(CUR_PROJ_PATH)/%.cpp  
85 - $(XX) $(CXXFLAGS) -c $<  
86 58
87 %.o:$(CUR_PROJ_PATH)/demo/%.cpp 59 %.o:$(CUR_PROJ_PATH)/demo/%.cpp
88 $(XX) $(CXXFLAGS) -c $< 60 $(XX) $(CXXFLAGS) -c $<
89 61
90 -%.o:$(CUR_PROJ_PATH)/ai_engine_module/%.cpp  
91 - $(XX) $(CXXFLAGS) -c $<  
92 -  
93 -%.o:$(CUR_PROJ_PATH)/common/%.cpp  
94 - $(XX) $(CXXFLAGS) -c $<  
95 -  
96 -%.o:$(CUR_PROJ_PATH)/common/dvpp/%.cpp  
97 - $(XX) $(CXXFLAGS) -c $<  
98 -  
99 -%.o:$(CUR_PROJ_PATH)/common/cnn/%.cpp  
100 - $(XX) $(CXXFLAGS) -c $<  
101 -  
102 -%.o:$(CUR_PROJ_PATH)/common/cnn_cls/%.cpp  
103 - $(XX) $(CXXFLAGS) -c $<  
104 -  
105 -%.o:$(CUR_PROJ_PATH)/common/road_cnn/%.cpp  
106 - $(XX) $(CXXFLAGS) -c $<  
107 -  
108 -%.o:$(CUR_PROJ_PATH)/common/dvppx/%.cpp  
109 - $(XX) $(CXXFLAGS) -c $<  
110 -  
111 -%.o:$(CUR_PROJ_PATH)/common/model_process/%.cpp  
112 - $(XX) $(CXXFLAGS) -c $<  
113 -  
114 -%.o:$(CUR_PROJ_PATH)/utils/%.cpp  
115 - $(XX) $(CXXFLAGS) -c $<  
116 -  
117 clean: 62 clean:
118 @rm -f $(TARGET) 63 @rm -f $(TARGET)
119 @rm -f $(OBJS) 64 @rm -f $(OBJS)
src/demo/main.cpp
1 -#include "../PicAnalysis.h" 1 +#include "../village_pic_interface.h"
  2 +#include <vector>
  3 +#include <string>
  4 +
  5 +using namespace std;
2 6
3 int main() { 7 int main() {
4 8
5 - PicAnalysis pic_analysis; 9 + void *vaHandle = NULL;
6 10
7 VillageParam param; 11 VillageParam param;
8 param.dev_id = 0; 12 param.dev_id = 0;
9 param.db_path = ""; 13 param.db_path = "";
10 param.model_path = ""; 14 param.model_path = "";
11 - pic_analysis.init(param); 15 + int ret = village_pic_init(&vaHandle, param);
12 16
13 vector<string> vec_path; 17 vector<string> vec_path;
14 size_t i = 1; 18 size_t i = 1;
@@ -19,9 +23,9 @@ int main() { @@ -19,9 +23,9 @@ int main() {
19 vec_path.push_back(path); 23 vec_path.push_back(path);
20 } 24 }
21 25
22 - pic_analysis.analysis_file(vec_path); 26 + village_pic_analysis_file(vaHandle, vec_path);
23 27
24 - // while (getchar() != 'q'); 28 + village_pic_release(&vaHandle);
25 29
26 return 0; 30 return 0;
27 } 31 }
28 \ No newline at end of file 32 \ No newline at end of file
src/village_pic_interface.cpp
@@ -21,6 +21,10 @@ std::vector&lt;AnalysisResult&gt; village_pic_analysis(void *handle, sy_img* img_array @@ -21,6 +21,10 @@ std::vector&lt;AnalysisResult&gt; village_pic_analysis(void *handle, sy_img* img_array
21 return tools->analysis_img(vec_img); 21 return tools->analysis_img(vec_img);
22 } 22 }
23 23
  24 +std::vector<AnalysisResult> village_pic_analysis_file(void *handle, std::vector<std::string> vec_file) {
  25 + PicAnalysis* tools = (PicAnalysis*)handle;
  26 + return tools->analysis_file(vec_file);
  27 +}
24 28
25 int village_pic_release(void **handle) 29 int village_pic_release(void **handle)
26 { 30 {
src/village_pic_interface.h
@@ -12,6 +12,7 @@ @@ -12,6 +12,7 @@
12 12
13 #include "village_inc.h" 13 #include "village_inc.h"
14 #include <vector> 14 #include <vector>
  15 +#include <string>
15 16
16 extern "C" 17 extern "C"
17 { 18 {
@@ -19,6 +20,8 @@ extern &quot;C&quot; @@ -19,6 +20,8 @@ extern &quot;C&quot;
19 20
20 VILLAGE_PIC_API std::vector<AnalysisResult> village_pic_analysis(void *handle, sy_img* imgs, int batch_size); 21 VILLAGE_PIC_API std::vector<AnalysisResult> village_pic_analysis(void *handle, sy_img* imgs, int batch_size);
21 22
  23 + VILLAGE_PIC_API std::vector<AnalysisResult> village_pic_analysis_file(void *handle, std::vector<std::string> vec_file);
  24 +
22 VILLAGE_PIC_API int village_pic_release(void **handle); 25 VILLAGE_PIC_API int village_pic_release(void **handle);
23 26
24 VILLAGE_PIC_API const char* get_village_pic_version(); 27 VILLAGE_PIC_API const char* get_village_pic_version();