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 target_link_libraries(${testName}
31 ${Boost_SYSTEM_LIBRARY}
32 ${Boost_FILESYSTEM_LIBRARY}
33 ${Boost_PROGRAM_OPTIONS_LIBRARY})
34 addDllCopyCommands(${testName})
37 set(CaffeCifar10AcrossChannels-Armnn_sources
38 CaffeCifar10AcrossChannels-Armnn/CaffeCifar10AcrossChannels-Armnn.cpp
41 CaffeParserTest(CaffeCifar10AcrossChannels-Armnn "${CaffeCifar10AcrossChannels-Armnn_sources}")
43 set(CaffeMnist-Armnn_sources
44 CaffeMnist-Armnn/CaffeMnist-Armnn.cpp
47 CaffeParserTest(CaffeMnist-Armnn "${CaffeMnist-Armnn_sources}")
49 set(CaffeAlexNet-Armnn_sources
50 CaffeAlexNet-Armnn/CaffeAlexNet-Armnn.cpp
52 CaffePreprocessor.cpp)
53 CaffeParserTest(CaffeAlexNet-Armnn "${CaffeAlexNet-Armnn_sources}")
55 set(MultipleNetworksCifar10_SRC
56 MultipleNetworksCifar10/MultipleNetworksCifar10.cpp
59 CaffeParserTest(MultipleNetworksCifar10 "${MultipleNetworksCifar10_SRC}")
61 set(CaffeResNet-Armnn_sources
62 CaffeResNet-Armnn/CaffeResNet-Armnn.cpp
64 CaffePreprocessor.cpp)
65 CaffeParserTest(CaffeResNet-Armnn "${CaffeResNet-Armnn_sources}")
67 set(CaffeVGG-Armnn_sources
68 CaffeVGG-Armnn/CaffeVGG-Armnn.cpp
70 CaffePreprocessor.cpp)
71 CaffeParserTest(CaffeVGG-Armnn "${CaffeVGG-Armnn_sources}")
73 set(CaffeInception_BN-Armnn_sources
74 CaffeInception_BN-Armnn/CaffeInception_BN-Armnn.cpp
76 CaffePreprocessor.cpp)
77 CaffeParserTest(CaffeInception_BN-Armnn "${CaffeInception_BN-Armnn_sources}")
79 set(CaffeYolo-Armnn_sources
80 CaffeYolo-Armnn/CaffeYolo-Armnn.cpp
83 YoloInferenceTest.hpp)
84 CaffeParserTest(CaffeYolo-Armnn "${CaffeYolo-Armnn_sources}")
88 macro(TfParserTest testName sources)
89 add_executable_ex(${testName} ${sources})
90 target_include_directories(${testName} PRIVATE ../src/armnnUtils)
91 target_include_directories(${testName} PRIVATE ../src/backends)
93 target_link_libraries(${testName} inferenceTest)
94 target_link_libraries(${testName} armnnTfParser)
95 target_link_libraries(${testName} armnn)
96 target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
97 target_link_libraries(${testName}
98 ${Boost_SYSTEM_LIBRARY}
99 ${Boost_FILESYSTEM_LIBRARY}
100 ${Boost_PROGRAM_OPTIONS_LIBRARY})
101 addDllCopyCommands(${testName})
104 set(TfMnist-Armnn_sources
105 TfMnist-Armnn/TfMnist-Armnn.cpp
108 TfParserTest(TfMnist-Armnn "${TfMnist-Armnn_sources}")
110 set(TfCifar10-Armnn_sources
111 TfCifar10-Armnn/TfCifar10-Armnn.cpp
114 TfParserTest(TfCifar10-Armnn "${TfCifar10-Armnn_sources}")
116 set(TfMobileNet-Armnn_sources
117 TfMobileNet-Armnn/TfMobileNet-Armnn.cpp
118 ImagePreprocessor.hpp
119 ImagePreprocessor.cpp)
120 TfParserTest(TfMobileNet-Armnn "${TfMobileNet-Armnn_sources}")
122 set(TfInceptionV3-Armnn_sources
123 TfInceptionV3-Armnn/TfInceptionV3-Armnn.cpp
124 ImagePreprocessor.hpp
125 ImagePreprocessor.cpp)
126 TfParserTest(TfInceptionV3-Armnn "${TfInceptionV3-Armnn_sources}")
128 set(TfResNext-Armnn_sources
129 TfResNext_Quantized-Armnn/TfResNext_Quantized-Armnn.cpp
130 CaffePreprocessor.hpp
131 CaffePreprocessor.cpp)
132 TfParserTest(TfResNext-Armnn "${TfResNext-Armnn_sources}")
135 if (BUILD_TF_LITE_PARSER)
136 macro(TfLiteParserTest testName sources)
137 add_executable_ex(${testName} ${sources})
138 target_include_directories(${testName} PRIVATE ../src/armnnUtils)
139 target_include_directories(${testName} PRIVATE ../src/backends)
141 target_link_libraries(${testName} inferenceTest)
142 target_link_libraries(${testName} armnnTfLiteParser)
143 target_link_libraries(${testName} armnn)
144 target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
145 target_link_libraries(${testName}
146 ${Boost_SYSTEM_LIBRARY}
147 ${Boost_FILESYSTEM_LIBRARY}
148 ${Boost_PROGRAM_OPTIONS_LIBRARY})
149 addDllCopyCommands(${testName})
152 set(TfLiteMobilenetQuantized-Armnn_sources
153 TfLiteMobilenetQuantized-Armnn/TfLiteMobilenetQuantized-Armnn.cpp
154 ImagePreprocessor.hpp
155 ImagePreprocessor.cpp)
156 TfLiteParserTest(TfLiteMobilenetQuantized-Armnn "${TfLiteMobilenetQuantized-Armnn_sources}")
158 set(TfLiteMobileNetSsd-Armnn_sources
159 TfLiteMobileNetSsd-Armnn/TfLiteMobileNetSsd-Armnn.cpp
160 MobileNetSsdDatabase.hpp
161 MobileNetSsdInferenceTest.hpp
162 ObjectDetectionCommon.hpp)
163 TfLiteParserTest(TfLiteMobileNetSsd-Armnn "${TfLiteMobileNetSsd-Armnn_sources}")
165 set(TfLiteMobilenetV2Quantized-Armnn_sources
166 TfLiteMobilenetV2Quantized-Armnn/TfLiteMobilenetV2Quantized-Armnn.cpp
167 ImagePreprocessor.hpp
168 ImagePreprocessor.cpp)
169 TfLiteParserTest(TfLiteMobilenetV2Quantized-Armnn "${TfLiteMobilenetV2Quantized-Armnn_sources}")
171 set(TfLiteVGG16Quantized-Armnn_sources
172 TfLiteVGG16Quantized-Armnn/TfLiteVGG16Quantized-Armnn.cpp
173 ImagePreprocessor.hpp
174 ImagePreprocessor.cpp)
175 TfLiteParserTest(TfLiteVGG16Quantized-Armnn "${TfLiteVGG16Quantized-Armnn_sources}")
177 set(TfLiteMobileNetQuantizedSoftmax-Armnn_sources
178 TfLiteMobileNetQuantizedSoftmax-Armnn/TfLiteMobileNetQuantizedSoftmax-Armnn.cpp
179 ImagePreprocessor.hpp
180 ImagePreprocessor.cpp)
181 TfLiteParserTest(TfLiteMobileNetQuantizedSoftmax-Armnn "${TfLiteMobileNetQuantizedSoftmax-Armnn_sources}")
183 set(TfLiteInceptionV3Quantized-Armnn_sources
184 TfLiteInceptionV3Quantized-Armnn/TfLiteInceptionV3Quantized-Armnn.cpp
185 ImagePreprocessor.hpp
186 ImagePreprocessor.cpp)
187 TfLiteParserTest(TfLiteInceptionV3Quantized-Armnn "${TfLiteInceptionV3Quantized-Armnn_sources}")
189 set(TfLiteInceptionV4Quantized-Armnn_sources
190 TfLiteInceptionV4Quantized-Armnn/TfLiteInceptionV4Quantized-Armnn.cpp
191 ImagePreprocessor.hpp
192 ImagePreprocessor.cpp)
193 TfLiteParserTest(TfLiteInceptionV4Quantized-Armnn "${TfLiteInceptionV4Quantized-Armnn_sources}")
195 set(TfLiteResNetV2-Armnn_sources
196 TfLiteResNetV2-Armnn/TfLiteResNetV2-Armnn.cpp
197 ImagePreprocessor.hpp
198 ImagePreprocessor.cpp)
199 TfLiteParserTest(TfLiteResNetV2-Armnn "${TfLiteResNetV2-Armnn_sources}")
201 set(TfLiteResNetV2-50-Quantized-Armnn_sources
202 TfLiteResNetV2-50-Quantized-Armnn/TfLiteResNetV2-50-Quantized-Armnn.cpp
203 ImagePreprocessor.hpp
204 ImagePreprocessor.cpp)
205 TfLiteParserTest(TfLiteResNetV2-50-Quantized-Armnn "${TfLiteResNetV2-50-Quantized-Armnn_sources}")
207 set(TfLiteMnasNet-Armnn_sources
208 TfLiteMnasNet-Armnn/TfLiteMnasNet-Armnn.cpp
209 ImagePreprocessor.hpp
210 ImagePreprocessor.cpp)
211 TfLiteParserTest(TfLiteMnasNet-Armnn "${TfLiteMnasNet-Armnn_sources}")
214 if (BUILD_ONNX_PARSER)
215 macro(OnnxParserTest testName sources)
216 add_executable_ex(${testName} ${sources})
217 target_include_directories(${testName} PRIVATE ../src/armnnUtils)
218 target_include_directories(${testName} PRIVATE ../src/backends)
220 target_link_libraries(${testName} inferenceTest)
221 target_link_libraries(${testName} armnnOnnxParser)
222 target_link_libraries(${testName} armnn)
223 target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
224 target_link_libraries(${testName}
225 ${Boost_SYSTEM_LIBRARY}
226 ${Boost_FILESYSTEM_LIBRARY}
227 ${Boost_PROGRAM_OPTIONS_LIBRARY})
228 addDllCopyCommands(${testName})
231 set(OnnxMnist-Armnn_sources
232 OnnxMnist-Armnn/OnnxMnist-Armnn.cpp
235 OnnxParserTest(OnnxMnist-Armnn "${OnnxMnist-Armnn_sources}")
237 set(OnnxMobileNet-Armnn_sources
238 OnnxMobileNet-Armnn/OnnxMobileNet-Armnn.cpp
239 ImagePreprocessor.hpp
240 ImagePreprocessor.cpp)
241 OnnxParserTest(OnnxMobileNet-Armnn "${OnnxMobileNet-Armnn_sources}")
244 if (BUILD_ARMNN_SERIALIZER OR BUILD_CAFFE_PARSER OR BUILD_TF_PARSER OR BUILD_TF_LITE_PARSER OR BUILD_ONNX_PARSER)
245 set(ExecuteNetwork_sources
246 ExecuteNetwork/ExecuteNetwork.cpp)
248 add_executable_ex(ExecuteNetwork ${ExecuteNetwork_sources})
249 target_include_directories(ExecuteNetwork PRIVATE ../src/armnn)
250 target_include_directories(ExecuteNetwork PRIVATE ../src/armnnUtils)
251 target_include_directories(ExecuteNetwork PRIVATE ../src/backends)
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)
270 target_link_libraries(ExecuteNetwork armnn)
271 target_link_libraries(ExecuteNetwork ${CMAKE_THREAD_LIBS_INIT})
272 target_link_libraries(ExecuteNetwork
273 ${Boost_SYSTEM_LIBRARY}
274 ${Boost_FILESYSTEM_LIBRARY}
275 ${Boost_PROGRAM_OPTIONS_LIBRARY})
276 addDllCopyCommands(ExecuteNetwork)
279 if(BUILD_ACCURACY_TOOL)
280 macro(AccuracyTool executorName)
281 target_link_libraries(${executorName} ${CMAKE_THREAD_LIBS_INIT})
282 if (BUILD_ARMNN_SERIALIZER)
283 target_link_libraries(${executorName} armnnSerializer)
285 if (BUILD_CAFFE_PARSER)
286 target_link_libraries(${executorName} armnnCaffeParser)
289 target_link_libraries(${executorName} armnnTfParser)
291 if (BUILD_TF_LITE_PARSER)
292 target_link_libraries(${executorName} armnnTfLiteParser)
294 if (BUILD_ONNX_PARSER)
295 target_link_libraries(${executorName} armnnOnnxParser)
297 target_link_libraries(${executorName}
298 ${Boost_SYSTEM_LIBRARY}
299 ${Boost_FILESYSTEM_LIBRARY}
300 ${Boost_PROGRAM_OPTIONS_LIBRARY})
301 addDllCopyCommands(${executorName})
304 set(ModelAccuracyTool-Armnn_sources
305 ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp)
307 add_executable_ex(ModelAccuracyTool ${ModelAccuracyTool-Armnn_sources})
308 target_include_directories(ModelAccuracyTool PRIVATE ../src/armnn)
309 target_include_directories(ModelAccuracyTool PRIVATE ../src/armnnUtils)
310 target_include_directories(ModelAccuracyTool PRIVATE ../src/backends)
311 target_link_libraries(ModelAccuracyTool inferenceTest)
312 target_link_libraries(ModelAccuracyTool armnn)
313 target_link_libraries(ModelAccuracyTool armnnSerializer)
314 AccuracyTool(ModelAccuracyTool)
317 if(BUILD_ARMNN_QUANTIZER)
318 macro(ImageTensorExecutor executorName)
319 target_link_libraries(${executorName} ${CMAKE_THREAD_LIBS_INIT})
320 target_link_libraries(${executorName}
321 ${Boost_SYSTEM_LIBRARY}
322 ${Boost_FILESYSTEM_LIBRARY}
323 ${Boost_PROGRAM_OPTIONS_LIBRARY})
324 addDllCopyCommands(${executorName})
327 set(ImageTensorGenerator_sources
328 InferenceTestImage.hpp
329 InferenceTestImage.cpp
330 ImageTensorGenerator/ImageTensorGenerator.cpp)
332 add_executable_ex(ImageTensorGenerator ${ImageTensorGenerator_sources})
333 target_include_directories(ImageTensorGenerator PRIVATE ../src/armnn)
334 target_include_directories(ImageTensorGenerator PRIVATE ../src/armnnUtils)
336 target_link_libraries(ImageTensorGenerator armnn)
337 ImageTensorExecutor(ImageTensorGenerator)
339 set(ImageCSVFileGenerator_sources
340 ImageCSVFileGenerator/ImageCSVFileGenerator.cpp)
342 add_executable_ex(ImageCSVFileGenerator ${ImageCSVFileGenerator_sources})
343 ImageTensorExecutor(ImageCSVFileGenerator)