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})
30 addDllCopyCommands(${testName})
33 set(CaffeCifar10AcrossChannels-Armnn_sources
34 CaffeCifar10AcrossChannels-Armnn/CaffeCifar10AcrossChannels-Armnn.cpp
37 CaffeParserTest(CaffeCifar10AcrossChannels-Armnn "${CaffeCifar10AcrossChannels-Armnn_sources}")
39 set(CaffeMnist-Armnn_sources
40 CaffeMnist-Armnn/CaffeMnist-Armnn.cpp
43 CaffeParserTest(CaffeMnist-Armnn "${CaffeMnist-Armnn_sources}")
45 set(CaffeAlexNet-Armnn_sources
46 CaffeAlexNet-Armnn/CaffeAlexNet-Armnn.cpp
48 CaffePreprocessor.cpp)
49 CaffeParserTest(CaffeAlexNet-Armnn "${CaffeAlexNet-Armnn_sources}")
51 set(MultipleNetworksCifar10_SRC
52 MultipleNetworksCifar10/MultipleNetworksCifar10.cpp
55 CaffeParserTest(MultipleNetworksCifar10 "${MultipleNetworksCifar10_SRC}")
57 set(CaffeResNet-Armnn_sources
58 CaffeResNet-Armnn/CaffeResNet-Armnn.cpp
60 CaffePreprocessor.cpp)
61 CaffeParserTest(CaffeResNet-Armnn "${CaffeResNet-Armnn_sources}")
63 set(CaffeVGG-Armnn_sources
64 CaffeVGG-Armnn/CaffeVGG-Armnn.cpp
66 CaffePreprocessor.cpp)
67 CaffeParserTest(CaffeVGG-Armnn "${CaffeVGG-Armnn_sources}")
69 set(CaffeInception_BN-Armnn_sources
70 CaffeInception_BN-Armnn/CaffeInception_BN-Armnn.cpp
72 CaffePreprocessor.cpp)
73 CaffeParserTest(CaffeInception_BN-Armnn "${CaffeInception_BN-Armnn_sources}")
75 set(CaffeYolo-Armnn_sources
76 CaffeYolo-Armnn/CaffeYolo-Armnn.cpp
79 YoloInferenceTest.hpp)
80 CaffeParserTest(CaffeYolo-Armnn "${CaffeYolo-Armnn_sources}")
84 macro(TfParserTest testName sources)
85 add_executable_ex(${testName} ${sources})
86 target_include_directories(${testName} PRIVATE ../src/armnnUtils)
87 target_include_directories(${testName} PRIVATE ../src/backends)
89 target_link_libraries(${testName} inferenceTest)
90 target_link_libraries(${testName} armnnTfParser)
91 target_link_libraries(${testName} armnn)
92 target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
93 addDllCopyCommands(${testName})
96 set(TfMnist-Armnn_sources
97 TfMnist-Armnn/TfMnist-Armnn.cpp
100 TfParserTest(TfMnist-Armnn "${TfMnist-Armnn_sources}")
102 set(TfCifar10-Armnn_sources
103 TfCifar10-Armnn/TfCifar10-Armnn.cpp
106 TfParserTest(TfCifar10-Armnn "${TfCifar10-Armnn_sources}")
108 set(TfMobileNet-Armnn_sources
109 TfMobileNet-Armnn/TfMobileNet-Armnn.cpp
110 ImagePreprocessor.hpp
111 ImagePreprocessor.cpp)
112 TfParserTest(TfMobileNet-Armnn "${TfMobileNet-Armnn_sources}")
114 set(TfInceptionV3-Armnn_sources
115 TfInceptionV3-Armnn/TfInceptionV3-Armnn.cpp
116 ImagePreprocessor.hpp
117 ImagePreprocessor.cpp)
118 TfParserTest(TfInceptionV3-Armnn "${TfInceptionV3-Armnn_sources}")
120 set(TfResNext-Armnn_sources
121 TfResNext_Quantized-Armnn/TfResNext_Quantized-Armnn.cpp
122 CaffePreprocessor.hpp
123 CaffePreprocessor.cpp)
124 TfParserTest(TfResNext-Armnn "${TfResNext-Armnn_sources}")
127 if (BUILD_TF_LITE_PARSER)
128 macro(TfLiteParserTest testName sources)
129 add_executable_ex(${testName} ${sources})
130 target_include_directories(${testName} PRIVATE ../src/armnnUtils)
131 target_include_directories(${testName} PRIVATE ../src/backends)
133 target_link_libraries(${testName} inferenceTest)
134 target_link_libraries(${testName} armnnTfLiteParser)
135 target_link_libraries(${testName} armnn)
136 target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
137 addDllCopyCommands(${testName})
140 set(TfLiteMobilenetQuantized-Armnn_sources
141 TfLiteMobilenetQuantized-Armnn/TfLiteMobilenetQuantized-Armnn.cpp
142 ImagePreprocessor.hpp
143 ImagePreprocessor.cpp)
144 TfLiteParserTest(TfLiteMobilenetQuantized-Armnn "${TfLiteMobilenetQuantized-Armnn_sources}")
146 set(TfLiteMobileNetSsd-Armnn_sources
147 TfLiteMobileNetSsd-Armnn/TfLiteMobileNetSsd-Armnn.cpp
148 MobileNetSsdDatabase.hpp
149 MobileNetSsdInferenceTest.hpp
150 ObjectDetectionCommon.hpp)
151 TfLiteParserTest(TfLiteMobileNetSsd-Armnn "${TfLiteMobileNetSsd-Armnn_sources}")
153 set(TfLiteMobilenetV2Quantized-Armnn_sources
154 TfLiteMobilenetV2Quantized-Armnn/TfLiteMobilenetV2Quantized-Armnn.cpp
155 ImagePreprocessor.hpp
156 ImagePreprocessor.cpp)
157 TfLiteParserTest(TfLiteMobilenetV2Quantized-Armnn "${TfLiteMobilenetV2Quantized-Armnn_sources}")
159 set(TfLiteVGG16Quantized-Armnn_sources
160 TfLiteVGG16Quantized-Armnn/TfLiteVGG16Quantized-Armnn.cpp
161 ImagePreprocessor.hpp
162 ImagePreprocessor.cpp)
163 TfLiteParserTest(TfLiteVGG16Quantized-Armnn "${TfLiteVGG16Quantized-Armnn_sources}")
165 set(TfLiteMobileNetQuantizedSoftmax-Armnn_sources
166 TfLiteMobileNetQuantizedSoftmax-Armnn/TfLiteMobileNetQuantizedSoftmax-Armnn.cpp
167 ImagePreprocessor.hpp
168 ImagePreprocessor.cpp)
169 TfLiteParserTest(TfLiteMobileNetQuantizedSoftmax-Armnn "${TfLiteMobileNetQuantizedSoftmax-Armnn_sources}")
171 set(TfLiteInceptionV3Quantized-Armnn_sources
172 TfLiteInceptionV3Quantized-Armnn/TfLiteInceptionV3Quantized-Armnn.cpp
173 ImagePreprocessor.hpp
174 ImagePreprocessor.cpp)
175 TfLiteParserTest(TfLiteInceptionV3Quantized-Armnn "${TfLiteInceptionV3Quantized-Armnn_sources}")
177 set(TfLiteInceptionV4Quantized-Armnn_sources
178 TfLiteInceptionV4Quantized-Armnn/TfLiteInceptionV4Quantized-Armnn.cpp
179 ImagePreprocessor.hpp
180 ImagePreprocessor.cpp)
181 TfLiteParserTest(TfLiteInceptionV4Quantized-Armnn "${TfLiteInceptionV4Quantized-Armnn_sources}")
183 set(TfLiteResNetV2-Armnn_sources
184 TfLiteResNetV2-Armnn/TfLiteResNetV2-Armnn.cpp
185 ImagePreprocessor.hpp
186 ImagePreprocessor.cpp)
187 TfLiteParserTest(TfLiteResNetV2-Armnn "${TfLiteResNetV2-Armnn_sources}")
189 set(TfLiteResNetV2-50-Quantized-Armnn_sources
190 TfLiteResNetV2-50-Quantized-Armnn/TfLiteResNetV2-50-Quantized-Armnn.cpp
191 ImagePreprocessor.hpp
192 ImagePreprocessor.cpp)
193 TfLiteParserTest(TfLiteResNetV2-50-Quantized-Armnn "${TfLiteResNetV2-50-Quantized-Armnn_sources}")
195 set(TfLiteMnasNet-Armnn_sources
196 TfLiteMnasNet-Armnn/TfLiteMnasNet-Armnn.cpp
197 ImagePreprocessor.hpp
198 ImagePreprocessor.cpp)
199 TfLiteParserTest(TfLiteMnasNet-Armnn "${TfLiteMnasNet-Armnn_sources}")
202 set(TfLiteYoloV3Big-Armnn_sources
203 TfLiteYoloV3Big-Armnn/NMS.cpp
204 TfLiteYoloV3Big-Armnn/NMS.hpp
205 TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp
206 ImagePreprocessor.hpp
207 ImagePreprocessor.cpp)
208 TfLiteParserTest(TfLiteYoloV3Big-Armnn "${TfLiteYoloV3Big-Armnn_sources}")
211 if (BUILD_ONNX_PARSER)
212 macro(OnnxParserTest testName sources)
213 add_executable_ex(${testName} ${sources})
214 target_include_directories(${testName} PRIVATE ../src/armnnUtils)
215 target_include_directories(${testName} PRIVATE ../src/backends)
217 target_link_libraries(${testName} inferenceTest)
218 target_link_libraries(${testName} armnnOnnxParser)
219 target_link_libraries(${testName} armnn)
220 target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
221 addDllCopyCommands(${testName})
224 set(OnnxMnist-Armnn_sources
225 OnnxMnist-Armnn/OnnxMnist-Armnn.cpp
228 OnnxParserTest(OnnxMnist-Armnn "${OnnxMnist-Armnn_sources}")
230 set(OnnxMobileNet-Armnn_sources
231 OnnxMobileNet-Armnn/OnnxMobileNet-Armnn.cpp
232 ImagePreprocessor.hpp
233 ImagePreprocessor.cpp)
234 OnnxParserTest(OnnxMobileNet-Armnn "${OnnxMobileNet-Armnn_sources}")
237 if (BUILD_ARMNN_SERIALIZER OR BUILD_CAFFE_PARSER OR BUILD_TF_PARSER OR BUILD_TF_LITE_PARSER OR BUILD_ONNX_PARSER)
238 set(ExecuteNetwork_sources
239 ExecuteNetwork/ExecuteNetwork.cpp
240 ExecuteNetwork/ExecuteNetworkProgramOptions.cpp
241 ExecuteNetwork/ExecuteNetworkProgramOptions.hpp
242 ExecuteNetwork/ExecuteNetworkParams.cpp
243 ExecuteNetwork/ExecuteNetworkParams.hpp
244 NetworkExecutionUtils/NetworkExecutionUtils.cpp
245 NetworkExecutionUtils/NetworkExecutionUtils.hpp)
247 add_executable_ex(ExecuteNetwork ${ExecuteNetwork_sources})
248 target_include_directories(ExecuteNetwork PRIVATE ../src/armnn)
249 target_include_directories(ExecuteNetwork PRIVATE ../src/armnnUtils)
250 target_include_directories(ExecuteNetwork PRIVATE ../src/backends)
251 target_include_directories(ExecuteNetwork PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
253 if (BUILD_ARMNN_SERIALIZER)
254 target_link_libraries(ExecuteNetwork armnnSerializer)
256 if (BUILD_CAFFE_PARSER)
257 target_link_libraries(ExecuteNetwork armnnCaffeParser)
260 target_link_libraries(ExecuteNetwork armnnTfParser)
263 if (BUILD_TF_LITE_PARSER)
264 target_link_libraries(ExecuteNetwork armnnTfLiteParser)
266 if (BUILD_ONNX_PARSER)
267 target_link_libraries(ExecuteNetwork armnnOnnxParser)
269 if (BUILD_ARMNN_TFLITE_DELEGATE)
270 target_link_libraries(ExecuteNetwork ArmnnDelegate::ArmnnDelegate)
272 target_link_libraries(ExecuteNetwork armnn)
274 target_link_libraries(ExecuteNetwork ${CMAKE_THREAD_LIBS_INIT})
275 addDllCopyCommands(ExecuteNetwork)
278 if(BUILD_ACCURACY_TOOL)
279 macro(AccuracyTool executorName)
280 target_link_libraries(${executorName} ${CMAKE_THREAD_LIBS_INIT})
281 if (BUILD_ARMNN_SERIALIZER)
282 target_link_libraries(${executorName} armnnSerializer)
284 if (BUILD_CAFFE_PARSER)
285 target_link_libraries(${executorName} armnnCaffeParser)
288 target_link_libraries(${executorName} armnnTfParser)
290 if (BUILD_TF_LITE_PARSER)
291 target_link_libraries(${executorName} armnnTfLiteParser)
293 if (BUILD_ONNX_PARSER)
294 target_link_libraries(${executorName} armnnOnnxParser)
296 addDllCopyCommands(${executorName})
299 set(ModelAccuracyTool-Armnn_sources
300 ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp)
302 add_executable_ex(ModelAccuracyTool ${ModelAccuracyTool-Armnn_sources})
303 target_include_directories(ModelAccuracyTool PRIVATE ../src/armnn)
304 target_include_directories(ModelAccuracyTool PRIVATE ../src/armnnUtils)
305 target_include_directories(ModelAccuracyTool PRIVATE ../src/backends)
306 target_link_libraries(ModelAccuracyTool inferenceTest)
307 target_link_libraries(ModelAccuracyTool armnn)
308 target_link_libraries(ModelAccuracyTool armnnSerializer)
309 AccuracyTool(ModelAccuracyTool)
312 if(BUILD_ARMNN_QUANTIZER)
313 macro(ImageTensorExecutor executorName)
314 target_link_libraries(${executorName} ${CMAKE_THREAD_LIBS_INIT})
315 addDllCopyCommands(${executorName})
318 set(ImageTensorGenerator_sources
319 InferenceTestImage.hpp
320 InferenceTestImage.cpp
321 ImageTensorGenerator/ImageTensorGenerator.cpp)
323 add_executable_ex(ImageTensorGenerator ${ImageTensorGenerator_sources})
324 target_include_directories(ImageTensorGenerator PRIVATE ../src/armnn)
325 target_include_directories(ImageTensorGenerator PRIVATE ../src/armnnUtils)
327 target_link_libraries(ImageTensorGenerator armnn)
328 ImageTensorExecutor(ImageTensorGenerator)
330 set(ImageCSVFileGenerator_sources
331 ImageCSVFileGenerator/ImageCSVFileGenerator.cpp)
333 add_executable_ex(ImageCSVFileGenerator ${ImageCSVFileGenerator_sources})
334 target_include_directories(ImageCSVFileGenerator PRIVATE ../src/armnnUtils)
335 ImageTensorExecutor(ImageCSVFileGenerator)