2 include(CheckIncludeFiles)
4 # Setup the inference test framework
5 set(inference_test_sources
6 ClassifierTestCaseData.hpp
11 InferenceTestImage.hpp
12 InferenceTestImage.cpp)
14 add_library_ex(inferenceTest STATIC ${inference_test_sources})
15 target_include_directories(inferenceTest PRIVATE ../src/armnnUtils)
16 target_include_directories(inferenceTest PRIVATE ../src/backends)
17 target_include_directories(inferenceTest PRIVATE ../third-party/stb)
19 if(BUILD_CAFFE_PARSER)
20 macro(CaffeParserTest testName sources)
21 add_executable_ex(${testName} ${sources})
22 target_include_directories(${testName} PRIVATE ../src/armnnUtils)
23 target_include_directories(${testName} PRIVATE ../src/backends)
24 set_target_properties(${testName} PROPERTIES COMPILE_FLAGS "${CAFFE_PARSER_TEST_ADDITIONAL_COMPILE_FLAGS}")
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})
31 target_link_libraries(${testName} ${OPENCL_LIBRARIES})
33 target_link_libraries(${testName}
34 ${Boost_SYSTEM_LIBRARY}
35 ${Boost_FILESYSTEM_LIBRARY}
36 ${Boost_PROGRAM_OPTIONS_LIBRARY})
37 addDllCopyCommands(${testName})
40 set(CaffeCifar10AcrossChannels-Armnn_sources
41 CaffeCifar10AcrossChannels-Armnn/CaffeCifar10AcrossChannels-Armnn.cpp
44 CaffeParserTest(CaffeCifar10AcrossChannels-Armnn "${CaffeCifar10AcrossChannels-Armnn_sources}")
46 set(CaffeMnist-Armnn_sources
47 CaffeMnist-Armnn/CaffeMnist-Armnn.cpp
50 CaffeParserTest(CaffeMnist-Armnn "${CaffeMnist-Armnn_sources}")
52 set(CaffeAlexNet-Armnn_sources
53 CaffeAlexNet-Armnn/CaffeAlexNet-Armnn.cpp
55 CaffePreprocessor.cpp)
56 CaffeParserTest(CaffeAlexNet-Armnn "${CaffeAlexNet-Armnn_sources}")
58 set(MultipleNetworksCifar10_SRC
59 MultipleNetworksCifar10/MultipleNetworksCifar10.cpp
62 CaffeParserTest(MultipleNetworksCifar10 "${MultipleNetworksCifar10_SRC}")
64 set(CaffeResNet-Armnn_sources
65 CaffeResNet-Armnn/CaffeResNet-Armnn.cpp
67 CaffePreprocessor.cpp)
68 CaffeParserTest(CaffeResNet-Armnn "${CaffeResNet-Armnn_sources}")
70 set(CaffeVGG-Armnn_sources
71 CaffeVGG-Armnn/CaffeVGG-Armnn.cpp
73 CaffePreprocessor.cpp)
74 CaffeParserTest(CaffeVGG-Armnn "${CaffeVGG-Armnn_sources}")
76 set(CaffeInception_BN-Armnn_sources
77 CaffeInception_BN-Armnn/CaffeInception_BN-Armnn.cpp
79 CaffePreprocessor.cpp)
80 CaffeParserTest(CaffeInception_BN-Armnn "${CaffeInception_BN-Armnn_sources}")
82 set(CaffeYolo-Armnn_sources
83 CaffeYolo-Armnn/CaffeYolo-Armnn.cpp
86 YoloInferenceTest.hpp)
87 CaffeParserTest(CaffeYolo-Armnn "${CaffeYolo-Armnn_sources}")
91 macro(TfParserTest testName sources)
92 add_executable_ex(${testName} ${sources})
93 target_include_directories(${testName} PRIVATE ../src/armnnUtils)
94 target_include_directories(${testName} PRIVATE ../src/backends)
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})
101 target_link_libraries(${testName} ${OPENCL_LIBRARIES})
103 target_link_libraries(${testName}
104 ${Boost_SYSTEM_LIBRARY}
105 ${Boost_FILESYSTEM_LIBRARY}
106 ${Boost_PROGRAM_OPTIONS_LIBRARY})
107 addDllCopyCommands(${testName})
110 set(TfMnist-Armnn_sources
111 TfMnist-Armnn/TfMnist-Armnn.cpp
114 TfParserTest(TfMnist-Armnn "${TfMnist-Armnn_sources}")
116 set(TfCifar10-Armnn_sources
117 TfCifar10-Armnn/TfCifar10-Armnn.cpp
120 TfParserTest(TfCifar10-Armnn "${TfCifar10-Armnn_sources}")
122 set(TfMobileNet-Armnn_sources
123 TfMobileNet-Armnn/TfMobileNet-Armnn.cpp
124 ImagePreprocessor.hpp
125 ImagePreprocessor.cpp)
126 TfParserTest(TfMobileNet-Armnn "${TfMobileNet-Armnn_sources}")
128 set(TfInceptionV3-Armnn_sources
129 TfInceptionV3-Armnn/TfInceptionV3-Armnn.cpp
130 ImagePreprocessor.hpp
131 ImagePreprocessor.cpp)
132 TfParserTest(TfInceptionV3-Armnn "${TfInceptionV3-Armnn_sources}")
134 set(TfResNext-Armnn_sources
135 TfResNext_Quantized-Armnn/TfResNext_Quantized-Armnn.cpp
136 CaffePreprocessor.hpp
137 CaffePreprocessor.cpp)
138 TfParserTest(TfResNext-Armnn "${TfResNext-Armnn_sources}")
141 if (BUILD_TF_LITE_PARSER)
142 macro(TfLiteParserTest testName sources)
143 add_executable_ex(${testName} ${sources})
144 target_include_directories(${testName} PRIVATE ../src/armnnUtils)
145 target_include_directories(${testName} PRIVATE ../src/backends)
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})
152 target_link_libraries(${testName} ${OPENCL_LIBRARIES})
154 target_link_libraries(${testName}
155 ${Boost_SYSTEM_LIBRARY}
156 ${Boost_FILESYSTEM_LIBRARY}
157 ${Boost_PROGRAM_OPTIONS_LIBRARY})
158 addDllCopyCommands(${testName})
161 set(TfLiteMobilenetQuantized-Armnn_sources
162 TfLiteMobilenetQuantized-Armnn/TfLiteMobilenetQuantized-Armnn.cpp
163 ImagePreprocessor.hpp
164 ImagePreprocessor.cpp)
165 TfLiteParserTest(TfLiteMobilenetQuantized-Armnn "${TfLiteMobilenetQuantized-Armnn_sources}")
167 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}")
174 set(TfLiteMobilenetV2Quantized-Armnn_sources
175 TfLiteMobilenetV2Quantized-Armnn/TfLiteMobilenetV2Quantized-Armnn.cpp
176 ImagePreprocessor.hpp
177 ImagePreprocessor.cpp)
178 TfLiteParserTest(TfLiteMobilenetV2Quantized-Armnn "${TfLiteMobilenetV2Quantized-Armnn_sources}")
180 set(TfLiteVGG16Quantized-Armnn_sources
181 TfLiteVGG16Quantized-Armnn/TfLiteVGG16Quantized-Armnn.cpp
182 ImagePreprocessor.hpp
183 ImagePreprocessor.cpp)
184 TfLiteParserTest(TfLiteVGG16Quantized-Armnn "${TfLiteVGG16Quantized-Armnn_sources}")
186 set(TfLiteMobileNetQuantizedSoftmax-Armnn_sources
187 TfLiteMobileNetQuantizedSoftmax-Armnn/TfLiteMobileNetQuantizedSoftmax-Armnn.cpp
188 ImagePreprocessor.hpp
189 ImagePreprocessor.cpp)
190 TfLiteParserTest(TfLiteMobileNetQuantizedSoftmax-Armnn "${TfLiteMobileNetQuantizedSoftmax-Armnn_sources}")
192 set(TfLiteInceptionV3Quantized-Armnn_sources
193 TfLiteInceptionV3Quantized-Armnn/TfLiteInceptionV3Quantized-Armnn.cpp
194 ImagePreprocessor.hpp
195 ImagePreprocessor.cpp)
196 TfLiteParserTest(TfLiteInceptionV3Quantized-Armnn "${TfLiteInceptionV3Quantized-Armnn_sources}")
198 set(TfLiteInceptionV4Quantized-Armnn_sources
199 TfLiteInceptionV4Quantized-Armnn/TfLiteInceptionV4Quantized-Armnn.cpp
200 ImagePreprocessor.hpp
201 ImagePreprocessor.cpp)
202 TfLiteParserTest(TfLiteInceptionV4Quantized-Armnn "${TfLiteInceptionV4Quantized-Armnn_sources}")
204 set(TfLiteResNetV2-Armnn_sources
205 TfLiteResNetV2-Armnn/TfLiteResNetV2-Armnn.cpp
206 ImagePreprocessor.hpp
207 ImagePreprocessor.cpp)
208 TfLiteParserTest(TfLiteResNetV2-Armnn "${TfLiteResNetV2-Armnn_sources}")
210 set(TfLiteResNetV2-50-Quantized-Armnn_sources
211 TfLiteResNetV2-50-Quantized-Armnn/TfLiteResNetV2-50-Quantized-Armnn.cpp
212 ImagePreprocessor.hpp
213 ImagePreprocessor.cpp)
214 TfLiteParserTest(TfLiteResNetV2-50-Quantized-Armnn "${TfLiteResNetV2-50-Quantized-Armnn_sources}")
216 set(TfLiteMnasNet-Armnn_sources
217 TfLiteMnasNet-Armnn/TfLiteMnasNet-Armnn.cpp
218 ImagePreprocessor.hpp
219 ImagePreprocessor.cpp)
220 TfLiteParserTest(TfLiteMnasNet-Armnn "${TfLiteMnasNet-Armnn_sources}")
223 if (BUILD_ONNX_PARSER)
224 macro(OnnxParserTest testName sources)
225 add_executable_ex(${testName} ${sources})
226 target_include_directories(${testName} PRIVATE ../src/armnnUtils)
227 target_include_directories(${testName} PRIVATE ../src/backends)
229 target_link_libraries(${testName} inferenceTest)
230 target_link_libraries(${testName} armnnOnnxParser)
231 target_link_libraries(${testName} armnn)
232 target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
234 target_link_libraries(${testName} ${OPENCL_LIBRARIES})
236 target_link_libraries(${testName}
237 ${Boost_SYSTEM_LIBRARY}
238 ${Boost_FILESYSTEM_LIBRARY}
239 ${Boost_PROGRAM_OPTIONS_LIBRARY})
240 addDllCopyCommands(${testName})
243 set(OnnxMnist-Armnn_sources
244 OnnxMnist-Armnn/OnnxMnist-Armnn.cpp
247 OnnxParserTest(OnnxMnist-Armnn "${OnnxMnist-Armnn_sources}")
249 set(OnnxMobileNet-Armnn_sources
250 OnnxMobileNet-Armnn/OnnxMobileNet-Armnn.cpp
251 ImagePreprocessor.hpp
252 ImagePreprocessor.cpp)
253 OnnxParserTest(OnnxMobileNet-Armnn "${OnnxMobileNet-Armnn_sources}")
256 if (BUILD_ARMNN_SERIALIZER OR BUILD_CAFFE_PARSER OR BUILD_TF_PARSER OR BUILD_TF_LITE_PARSER OR BUILD_ONNX_PARSER)
257 set(ExecuteNetwork_sources
258 ExecuteNetwork/ExecuteNetwork.cpp)
260 add_executable_ex(ExecuteNetwork ${ExecuteNetwork_sources})
261 target_include_directories(ExecuteNetwork PRIVATE ../src/armnn)
262 target_include_directories(ExecuteNetwork PRIVATE ../src/armnnUtils)
263 target_include_directories(ExecuteNetwork PRIVATE ../src/backends)
265 if (BUILD_ARMNN_SERIALIZER)
266 target_link_libraries(ExecuteNetwork armnnSerializer)
268 if (BUILD_CAFFE_PARSER)
269 target_link_libraries(ExecuteNetwork armnnCaffeParser)
272 target_link_libraries(ExecuteNetwork armnnTfParser)
275 if (BUILD_TF_LITE_PARSER)
276 target_link_libraries(ExecuteNetwork armnnTfLiteParser)
278 if (BUILD_ONNX_PARSER)
279 target_link_libraries(ExecuteNetwork armnnOnnxParser)
282 target_link_libraries(ExecuteNetwork armnn)
283 target_link_libraries(ExecuteNetwork ${CMAKE_THREAD_LIBS_INIT})
285 target_link_libraries(ExecuteNetwork ${OPENCL_LIBRARIES})
287 target_link_libraries(ExecuteNetwork
288 ${Boost_SYSTEM_LIBRARY}
289 ${Boost_FILESYSTEM_LIBRARY}
290 ${Boost_PROGRAM_OPTIONS_LIBRARY})
291 addDllCopyCommands(ExecuteNetwork)
294 if(BUILD_ACCURACY_TOOL)
295 macro(AccuracyTool executorName)
296 target_link_libraries(${executorName} ${CMAKE_THREAD_LIBS_INIT})
297 if (BUILD_ARMNN_SERIALIZER)
298 target_link_libraries(${executorName} armnnSerializer)
300 if (BUILD_CAFFE_PARSER)
301 target_link_libraries(${executorName} armnnCaffeParser)
304 target_link_libraries(${executorName} armnnTfParser)
306 if (BUILD_TF_LITE_PARSER)
307 target_link_libraries(${executorName} armnnTfLiteParser)
309 if (BUILD_ONNX_PARSER)
310 target_link_libraries(${executorName} armnnOnnxParser)
313 target_link_libraries(${executorName} ${OPENCL_LIBRARIES})
315 target_link_libraries(${executorName}
316 ${Boost_SYSTEM_LIBRARY}
317 ${Boost_FILESYSTEM_LIBRARY}
318 ${Boost_PROGRAM_OPTIONS_LIBRARY})
319 addDllCopyCommands(${executorName})
322 set(ModelAccuracyTool-Armnn_sources
323 ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp)
325 add_executable_ex(ModelAccuracyTool ${ModelAccuracyTool-Armnn_sources})
326 target_include_directories(ModelAccuracyTool PRIVATE ../src/armnn)
327 target_include_directories(ModelAccuracyTool PRIVATE ../src/armnnUtils)
328 target_include_directories(ModelAccuracyTool PRIVATE ../src/backends)
329 target_link_libraries(ModelAccuracyTool inferenceTest)
330 target_link_libraries(ModelAccuracyTool armnn)
331 target_link_libraries(ModelAccuracyTool armnnSerializer)
332 AccuracyTool(ModelAccuracyTool)
335 if(BUILD_ARMNN_QUANTIZER)
336 macro(ImageTensorExecutor executorName)
337 target_link_libraries(${executorName} ${CMAKE_THREAD_LIBS_INIT})
339 target_link_libraries(${executorName} ${OPENCL_LIBRARIES})
341 target_link_libraries(${executorName}
342 ${Boost_SYSTEM_LIBRARY}
343 ${Boost_FILESYSTEM_LIBRARY}
344 ${Boost_PROGRAM_OPTIONS_LIBRARY})
345 addDllCopyCommands(${executorName})
348 set(ImageTensorGenerator_sources
349 InferenceTestImage.hpp
350 InferenceTestImage.cpp
351 ImageTensorGenerator/ImageTensorGenerator.cpp)
353 add_executable_ex(ImageTensorGenerator ${ImageTensorGenerator_sources})
354 target_include_directories(ImageTensorGenerator PRIVATE ../src/armnn)
355 target_include_directories(ImageTensorGenerator PRIVATE ../src/armnnUtils)
357 target_link_libraries(ImageTensorGenerator armnn)
358 ImageTensorExecutor(ImageTensorGenerator)
360 set(ImageCSVFileGenerator_sources
361 ImageCSVFileGenerator/ImageCSVFileGenerator.cpp)
363 add_executable_ex(ImageCSVFileGenerator ${ImageCSVFileGenerator_sources})
364 ImageTensorExecutor(ImageCSVFileGenerator)