blob: e8f72eb4eefa942df798ec6cb3df0b683ba9990a [file] [log] [blame]
telsoa014fcda012018-03-09 14:13:49 +00001# UnitTests
2include(CheckIncludeFiles)
3
4include_directories(SYSTEM "${THIRD_PARTY_INCLUDE_DIRS}")
5
6# Setup the inference test framework
7set(inference_test_sources
8 ClassifierTestCaseData.hpp
9 InferenceModel.hpp
10 InferenceTest.hpp
11 InferenceTest.inl
12 InferenceTest.cpp
13 InferenceTestImage.hpp
14 InferenceTestImage.cpp)
15add_library_ex(inferenceTest STATIC ${inference_test_sources})
16target_include_directories(inferenceTest PRIVATE ../src/armnnUtils)
David Beck1b61be52018-11-08 09:19:14 +000017target_include_directories(inferenceTest PRIVATE ../src/backends)
telsoa014fcda012018-03-09 14:13:49 +000018
19if(BUILD_CAFFE_PARSER)
20 macro(CaffeParserTest testName sources)
21 add_executable_ex(${testName} ${sources})
22 target_include_directories(${testName} PRIVATE ../src/armnnUtils)
David Beck1b61be52018-11-08 09:19:14 +000023 target_include_directories(${testName} PRIVATE ../src/backends)
telsoa014fcda012018-03-09 14:13:49 +000024 set_target_properties(${testName} PROPERTIES COMPILE_FLAGS "${CAFFE_PARSER_TEST_ADDITIONAL_COMPILE_FLAGS}")
25
26 target_link_libraries(${testName} inferenceTest)
27 target_link_libraries(${testName} armnnCaffeParser)
28 target_link_libraries(${testName} armnn)
29 target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
30 if(OPENCL_LIBRARIES)
31 target_link_libraries(${testName} ${OPENCL_LIBRARIES})
32 endif()
33 target_link_libraries(${testName}
34 ${Boost_SYSTEM_LIBRARY}
35 ${Boost_FILESYSTEM_LIBRARY}
36 ${Boost_PROGRAM_OPTIONS_LIBRARY})
37 addDllCopyCommands(${testName})
38 endmacro()
39
40 set(CaffeCifar10AcrossChannels-Armnn_sources
41 CaffeCifar10AcrossChannels-Armnn/CaffeCifar10AcrossChannels-Armnn.cpp
42 Cifar10Database.hpp
43 Cifar10Database.cpp)
44 CaffeParserTest(CaffeCifar10AcrossChannels-Armnn "${CaffeCifar10AcrossChannels-Armnn_sources}")
45
46 set(CaffeMnist-Armnn_sources
47 CaffeMnist-Armnn/CaffeMnist-Armnn.cpp
48 MnistDatabase.hpp
49 MnistDatabase.cpp)
50 CaffeParserTest(CaffeMnist-Armnn "${CaffeMnist-Armnn_sources}")
51
52 set(CaffeAlexNet-Armnn_sources
53 CaffeAlexNet-Armnn/CaffeAlexNet-Armnn.cpp
telsoa01c577f2c2018-08-31 09:22:23 +010054 CaffePreprocessor.hpp
55 CaffePreprocessor.cpp)
telsoa014fcda012018-03-09 14:13:49 +000056 CaffeParserTest(CaffeAlexNet-Armnn "${CaffeAlexNet-Armnn_sources}")
57
58 set(MultipleNetworksCifar10_SRC
59 MultipleNetworksCifar10/MultipleNetworksCifar10.cpp
60 Cifar10Database.hpp
61 Cifar10Database.cpp)
62 CaffeParserTest(MultipleNetworksCifar10 "${MultipleNetworksCifar10_SRC}")
63
64 set(CaffeResNet-Armnn_sources
65 CaffeResNet-Armnn/CaffeResNet-Armnn.cpp
telsoa01c577f2c2018-08-31 09:22:23 +010066 CaffePreprocessor.hpp
67 CaffePreprocessor.cpp)
telsoa014fcda012018-03-09 14:13:49 +000068 CaffeParserTest(CaffeResNet-Armnn "${CaffeResNet-Armnn_sources}")
69
70 set(CaffeVGG-Armnn_sources
71 CaffeVGG-Armnn/CaffeVGG-Armnn.cpp
telsoa01c577f2c2018-08-31 09:22:23 +010072 CaffePreprocessor.hpp
73 CaffePreprocessor.cpp)
telsoa014fcda012018-03-09 14:13:49 +000074 CaffeParserTest(CaffeVGG-Armnn "${CaffeVGG-Armnn_sources}")
75
76 set(CaffeInception_BN-Armnn_sources
77 CaffeInception_BN-Armnn/CaffeInception_BN-Armnn.cpp
telsoa01c577f2c2018-08-31 09:22:23 +010078 CaffePreprocessor.hpp
79 CaffePreprocessor.cpp)
telsoa014fcda012018-03-09 14:13:49 +000080 CaffeParserTest(CaffeInception_BN-Armnn "${CaffeInception_BN-Armnn_sources}")
81
82 set(CaffeYolo-Armnn_sources
83 CaffeYolo-Armnn/CaffeYolo-Armnn.cpp
84 YoloDatabase.hpp
85 YoloDatabase.cpp
86 YoloInferenceTest.hpp)
87 CaffeParserTest(CaffeYolo-Armnn "${CaffeYolo-Armnn_sources}")
88endif()
89
surmeh01bceff2f2018-03-29 16:29:27 +010090if(BUILD_TF_PARSER)
91 macro(TfParserTest testName sources)
92 add_executable_ex(${testName} ${sources})
93 target_include_directories(${testName} PRIVATE ../src/armnnUtils)
David Beck1b61be52018-11-08 09:19:14 +000094 target_include_directories(${testName} PRIVATE ../src/backends)
surmeh01bceff2f2018-03-29 16:29:27 +010095
96 target_link_libraries(${testName} inferenceTest)
97 target_link_libraries(${testName} armnnTfParser)
98 target_link_libraries(${testName} armnn)
99 target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
100 if(OPENCL_LIBRARIES)
101 target_link_libraries(${testName} ${OPENCL_LIBRARIES})
102 endif()
103 target_link_libraries(${testName}
104 ${Boost_SYSTEM_LIBRARY}
105 ${Boost_FILESYSTEM_LIBRARY}
106 ${Boost_PROGRAM_OPTIONS_LIBRARY})
107 addDllCopyCommands(${testName})
108 endmacro()
109
110 set(TfMnist-Armnn_sources
111 TfMnist-Armnn/TfMnist-Armnn.cpp
112 MnistDatabase.hpp
113 MnistDatabase.cpp)
114 TfParserTest(TfMnist-Armnn "${TfMnist-Armnn_sources}")
115
116 set(TfCifar10-Armnn_sources
117 TfCifar10-Armnn/TfCifar10-Armnn.cpp
118 Cifar10Database.hpp
119 Cifar10Database.cpp)
120 TfParserTest(TfCifar10-Armnn "${TfCifar10-Armnn_sources}")
121
122 set(TfMobileNet-Armnn_sources
123 TfMobileNet-Armnn/TfMobileNet-Armnn.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100124 ImagePreprocessor.hpp
125 ImagePreprocessor.cpp)
surmeh01bceff2f2018-03-29 16:29:27 +0100126 TfParserTest(TfMobileNet-Armnn "${TfMobileNet-Armnn_sources}")
127
128 set(TfInceptionV3-Armnn_sources
129 TfInceptionV3-Armnn/TfInceptionV3-Armnn.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100130 ImagePreprocessor.hpp
131 ImagePreprocessor.cpp)
surmeh01bceff2f2018-03-29 16:29:27 +0100132 TfParserTest(TfInceptionV3-Armnn "${TfInceptionV3-Armnn_sources}")
surmeh013537c2c2018-05-18 16:31:43 +0100133
134 set(TfResNext-Armnn_sources
135 TfResNext_Quantized-Armnn/TfResNext_Quantized-Armnn.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100136 CaffePreprocessor.hpp
137 CaffePreprocessor.cpp)
surmeh013537c2c2018-05-18 16:31:43 +0100138 TfParserTest(TfResNext-Armnn "${TfResNext-Armnn_sources}")
surmeh01bceff2f2018-03-29 16:29:27 +0100139endif()
140
telsoa01c577f2c2018-08-31 09:22:23 +0100141if (BUILD_TF_LITE_PARSER)
142 macro(TfLiteParserTest testName sources)
143 add_executable_ex(${testName} ${sources})
144 target_include_directories(${testName} PRIVATE ../src/armnnUtils)
David Beck1b61be52018-11-08 09:19:14 +0000145 target_include_directories(${testName} PRIVATE ../src/backends)
telsoa01c577f2c2018-08-31 09:22:23 +0100146
147 target_link_libraries(${testName} inferenceTest)
148 target_link_libraries(${testName} armnnTfLiteParser)
149 target_link_libraries(${testName} armnn)
150 target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
151 if(OPENCL_LIBRARIES)
152 target_link_libraries(${testName} ${OPENCL_LIBRARIES})
153 endif()
154 target_link_libraries(${testName}
155 ${Boost_SYSTEM_LIBRARY}
156 ${Boost_FILESYSTEM_LIBRARY}
157 ${Boost_PROGRAM_OPTIONS_LIBRARY})
158 addDllCopyCommands(${testName})
159 endmacro()
160
161 set(TfLiteMobilenetQuantized-Armnn_sources
162 TfLiteMobilenetQuantized-Armnn/TfLiteMobilenetQuantized-Armnn.cpp
163 ImagePreprocessor.hpp
164 ImagePreprocessor.cpp)
165 TfLiteParserTest(TfLiteMobilenetQuantized-Armnn "${TfLiteMobilenetQuantized-Armnn_sources}")
Nattapat Chaimanowongd8eee592018-10-26 10:24:14 +0100166
Aron Virginas-Tard089b742019-01-29 11:09:51 +0000167 set(TfLiteMobileNetSsd-Armnn_sources
168 TfLiteMobileNetSsd-Armnn/TfLiteMobileNetSsd-Armnn.cpp
169 MobileNetSsdDatabase.hpp
170 MobileNetSsdInferenceTest.hpp
171 ObjectDetectionCommon.hpp)
172 TfLiteParserTest(TfLiteMobileNetSsd-Armnn "${TfLiteMobileNetSsd-Armnn_sources}")
173
Nattapat Chaimanowongd8eee592018-10-26 10:24:14 +0100174 set(TfLiteVGG16Quantized-Armnn_sources
175 TfLiteVGG16Quantized-Armnn/TfLiteVGG16Quantized-Armnn.cpp
176 ImagePreprocessor.hpp
177 ImagePreprocessor.cpp)
178 TfLiteParserTest(TfLiteVGG16Quantized-Armnn "${TfLiteVGG16Quantized-Armnn_sources}")
telsoa01c577f2c2018-08-31 09:22:23 +0100179endif()
180
181if (BUILD_ONNX_PARSER)
182 macro(OnnxParserTest testName sources)
183 add_executable_ex(${testName} ${sources})
184 target_include_directories(${testName} PRIVATE ../src/armnnUtils)
David Beck1b61be52018-11-08 09:19:14 +0000185 target_include_directories(${testName} PRIVATE ../src/backends)
telsoa01c577f2c2018-08-31 09:22:23 +0100186
187 target_link_libraries(${testName} inferenceTest)
188 target_link_libraries(${testName} armnnOnnxParser)
189 target_link_libraries(${testName} armnn)
190 target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
191 if(OPENCL_LIBRARIES)
192 target_link_libraries(${testName} ${OPENCL_LIBRARIES})
193 endif()
194 target_link_libraries(${testName}
195 ${Boost_SYSTEM_LIBRARY}
196 ${Boost_FILESYSTEM_LIBRARY}
197 ${Boost_PROGRAM_OPTIONS_LIBRARY})
198 addDllCopyCommands(${testName})
199 endmacro()
200
201 set(OnnxMnist-Armnn_sources
202 OnnxMnist-Armnn/OnnxMnist-Armnn.cpp
203 MnistDatabase.hpp
204 MnistDatabase.cpp)
205 OnnxParserTest(OnnxMnist-Armnn "${OnnxMnist-Armnn_sources}")
206
207 set(OnnxMobileNet-Armnn_sources
208 OnnxMobileNet-Armnn/OnnxMobileNet-Armnn.cpp
209 ImagePreprocessor.hpp
210 ImagePreprocessor.cpp)
211 OnnxParserTest(OnnxMobileNet-Armnn "${OnnxMobileNet-Armnn_sources}")
212endif()
213
214if (BUILD_CAFFE_PARSER OR BUILD_TF_PARSER OR BUILD_TF_LITE_PARSER OR BUILD_ONNX_PARSER)
telsoa014fcda012018-03-09 14:13:49 +0000215 set(ExecuteNetwork_sources
216 ExecuteNetwork/ExecuteNetwork.cpp)
217
218 add_executable_ex(ExecuteNetwork ${ExecuteNetwork_sources})
telsoa01c577f2c2018-08-31 09:22:23 +0100219 target_include_directories(ExecuteNetwork PRIVATE ../src/armnn)
Aron Virginas-Tar5cc8e562018-10-23 15:14:46 +0100220 target_include_directories(ExecuteNetwork PRIVATE ../src/armnnUtils)
David Beck1b61be52018-11-08 09:19:14 +0000221 target_include_directories(ExecuteNetwork PRIVATE ../src/backends)
telsoa014fcda012018-03-09 14:13:49 +0000222
223 if (BUILD_CAFFE_PARSER)
224 target_link_libraries(ExecuteNetwork armnnCaffeParser)
225 endif()
surmeh01bceff2f2018-03-29 16:29:27 +0100226 if (BUILD_TF_PARSER)
227 target_link_libraries(ExecuteNetwork armnnTfParser)
228 endif()
telsoa01c577f2c2018-08-31 09:22:23 +0100229
230 if (BUILD_TF_LITE_PARSER)
231 target_link_libraries(ExecuteNetwork armnnTfLiteParser)
232 endif()
233 if (BUILD_ONNX_PARSER)
234 target_link_libraries(ExecuteNetwork armnnOnnxParser)
235 endif()
236
telsoa014fcda012018-03-09 14:13:49 +0000237 target_link_libraries(ExecuteNetwork armnn)
238 target_link_libraries(ExecuteNetwork ${CMAKE_THREAD_LIBS_INIT})
239 if(OPENCL_LIBRARIES)
240 target_link_libraries(ExecuteNetwork ${OPENCL_LIBRARIES})
241 endif()
242 target_link_libraries(ExecuteNetwork
243 ${Boost_SYSTEM_LIBRARY}
244 ${Boost_FILESYSTEM_LIBRARY}
245 ${Boost_PROGRAM_OPTIONS_LIBRARY})
246 addDllCopyCommands(ExecuteNetwork)
247endif()