Commit e6b08c4f52fdfb62d0ed3f89ec961c5c32f817ee
1 parent
5e69f8fc
优化demo
Showing
4 changed files
with
18 additions
and
62 deletions
build/demo/Makefile
... | ... | @@ -2,7 +2,6 @@ CC = gcc |
2 | 2 | XX = c++ |
3 | 3 | |
4 | 4 | |
5 | - | |
6 | 5 | PROJ_ALL_PATH = $(PWD)/../.. |
7 | 6 | CUR_PROJ_PATH = $(PROJ_ALL_PATH)/src |
8 | 7 | BIN_PATH = $(PROJ_ALL_PATH)/bin |
... | ... | @@ -17,22 +16,11 @@ SPDLOG_ROOT = $(PROJ_ALL_PATH)/3rdparty/spdlog-1.9.2/release |
17 | 16 | ALGORITHM_PATH = $(PROJ_ALL_PATH)/algorithm |
18 | 17 | |
19 | 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 | 19 | -I$(OPENCV_PATH)/include \ |
28 | 20 | -I$(OPENCV_PATH)/include/opencv2 \ |
29 | 21 | -I$(ACL_PATH)/include \ |
30 | 22 | -I$(SPDLOG_ROOT)/include \ |
31 | - -I$(CUR_PROJ_PATH)/ai_engine_module \ | |
32 | 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 | 26 | # CXXFLAGS = -O0 -std=c++11 $(INCLUDES) -DENABLE_DVPP_INTERFACE -D_GLIBCXX_USE_CXX11_ABI=0 |
... | ... | @@ -49,10 +37,7 @@ local_shared_libs := \ |
49 | 37 | ascendcl \ |
50 | 38 | acl_dvpp \ |
51 | 39 | spdlog \ |
52 | - vehicle_analysis \ | |
53 | - vid_clothes \ | |
54 | - hp \ | |
55 | - hcp \ | |
40 | + village_ascend_arm \ | |
56 | 41 | |
57 | 42 | |
58 | 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 | 46 | |
62 | 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 | 51 | DIRS := $(notdir $(SRCS)) |
77 | 52 | OBJS := $(patsubst %cpp, %o, $(DIRS)) |
... | ... | @@ -80,40 +55,10 @@ all: $(TARGET) |
80 | 55 | |
81 | 56 | $(TARGET):$(OBJS) |
82 | 57 | $(XX) -o $@ $^ $(CXXFLAGS) $(SHARED_LIBRARIES_DIRS) $(SHARED_LIBRARIES) |
83 | - | |
84 | -%.o:$(CUR_PROJ_PATH)/%.cpp | |
85 | - $(XX) $(CXXFLAGS) -c $< | |
86 | 58 | |
87 | 59 | %.o:$(CUR_PROJ_PATH)/demo/%.cpp |
88 | 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 | 62 | clean: |
118 | 63 | @rm -f $(TARGET) |
119 | 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 | 7 | int main() { |
4 | 8 | |
5 | - PicAnalysis pic_analysis; | |
9 | + void *vaHandle = NULL; | |
6 | 10 | |
7 | 11 | VillageParam param; |
8 | 12 | param.dev_id = 0; |
9 | 13 | param.db_path = ""; |
10 | 14 | param.model_path = ""; |
11 | - pic_analysis.init(param); | |
15 | + int ret = village_pic_init(&vaHandle, param); | |
12 | 16 | |
13 | 17 | vector<string> vec_path; |
14 | 18 | size_t i = 1; |
... | ... | @@ -19,9 +23,9 @@ int main() { |
19 | 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 | 30 | return 0; |
27 | 31 | } |
28 | 32 | \ No newline at end of file | ... | ... |
src/village_pic_interface.cpp
... | ... | @@ -21,6 +21,10 @@ std::vector<AnalysisResult> village_pic_analysis(void *handle, sy_img* img_array |
21 | 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 | 29 | int village_pic_release(void **handle) |
26 | 30 | { | ... | ... |
src/village_pic_interface.h
... | ... | @@ -12,6 +12,7 @@ |
12 | 12 | |
13 | 13 | #include "village_inc.h" |
14 | 14 | #include <vector> |
15 | +#include <string> | |
15 | 16 | |
16 | 17 | extern "C" |
17 | 18 | { |
... | ... | @@ -19,6 +20,8 @@ extern "C" |
19 | 20 | |
20 | 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 | 25 | VILLAGE_PIC_API int village_pic_release(void **handle); |
23 | 26 | |
24 | 27 | VILLAGE_PIC_API const char* get_village_pic_version(); | ... | ... |