Jim Flynn | 6217c3d | 2022-06-14 10:58:23 +0100 | [diff] [blame] | 1 | # |
| 2 | # Copyright © 2018-2022 Arm Ltd and Contributors. All rights reserved. |
| 3 | # SPDX-License-Identifier: MIT |
| 4 | # |
| 5 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 6 | # UnitTests |
| 7 | include(CheckIncludeFiles) |
| 8 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 9 | # Setup the inference test framework |
| 10 | set(inference_test_sources |
| 11 | ClassifierTestCaseData.hpp |
| 12 | InferenceModel.hpp |
| 13 | InferenceTest.hpp |
| 14 | InferenceTest.inl |
| 15 | InferenceTest.cpp |
| 16 | InferenceTestImage.hpp |
| 17 | InferenceTestImage.cpp) |
Sadik Armagan | 93e2e40 | 2019-05-02 09:31:38 +0100 | [diff] [blame] | 18 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 19 | add_library_ex(inferenceTest STATIC ${inference_test_sources}) |
| 20 | target_include_directories(inferenceTest PRIVATE ../src/armnnUtils) |
David Beck | 1b61be5 | 2018-11-08 09:19:14 +0000 | [diff] [blame] | 21 | target_include_directories(inferenceTest PRIVATE ../src/backends) |
Sadik Armagan | 93e2e40 | 2019-05-02 09:31:38 +0100 | [diff] [blame] | 22 | target_include_directories(inferenceTest PRIVATE ../third-party/stb) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 23 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 24 | if (BUILD_TF_LITE_PARSER) |
| 25 | macro(TfLiteParserTest testName sources) |
| 26 | add_executable_ex(${testName} ${sources}) |
| 27 | target_include_directories(${testName} PRIVATE ../src/armnnUtils) |
David Beck | 1b61be5 | 2018-11-08 09:19:14 +0000 | [diff] [blame] | 28 | target_include_directories(${testName} PRIVATE ../src/backends) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 29 | |
| 30 | target_link_libraries(${testName} inferenceTest) |
| 31 | target_link_libraries(${testName} armnnTfLiteParser) |
| 32 | target_link_libraries(${testName} armnn) |
| 33 | target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT}) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 34 | addDllCopyCommands(${testName}) |
| 35 | endmacro() |
| 36 | |
Jim Flynn | 27a9bd9 | 2020-11-12 15:48:34 +0000 | [diff] [blame] | 37 | set(TfLiteBenchmark-Armnn_sources |
| 38 | TfLiteBenchmark-Armnn/TfLiteBenchmark-Armnn.cpp) |
| 39 | TfLiteParserTest(TfLiteBenchmark-Armnn "${TfLiteBenchmark-Armnn_sources}") |
| 40 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 41 | set(TfLiteMobilenetQuantized-Armnn_sources |
| 42 | TfLiteMobilenetQuantized-Armnn/TfLiteMobilenetQuantized-Armnn.cpp |
| 43 | ImagePreprocessor.hpp |
| 44 | ImagePreprocessor.cpp) |
| 45 | TfLiteParserTest(TfLiteMobilenetQuantized-Armnn "${TfLiteMobilenetQuantized-Armnn_sources}") |
Nattapat Chaimanowong | d8eee59 | 2018-10-26 10:24:14 +0100 | [diff] [blame] | 46 | |
Aron Virginas-Tar | d089b74 | 2019-01-29 11:09:51 +0000 | [diff] [blame] | 47 | set(TfLiteMobileNetSsd-Armnn_sources |
| 48 | TfLiteMobileNetSsd-Armnn/TfLiteMobileNetSsd-Armnn.cpp |
| 49 | MobileNetSsdDatabase.hpp |
| 50 | MobileNetSsdInferenceTest.hpp |
| 51 | ObjectDetectionCommon.hpp) |
| 52 | TfLiteParserTest(TfLiteMobileNetSsd-Armnn "${TfLiteMobileNetSsd-Armnn_sources}") |
| 53 | |
Bruno Goncalves | 0630411 | 2018-12-27 16:13:58 -0200 | [diff] [blame] | 54 | set(TfLiteMobilenetV2Quantized-Armnn_sources |
| 55 | TfLiteMobilenetV2Quantized-Armnn/TfLiteMobilenetV2Quantized-Armnn.cpp |
| 56 | ImagePreprocessor.hpp |
| 57 | ImagePreprocessor.cpp) |
| 58 | TfLiteParserTest(TfLiteMobilenetV2Quantized-Armnn "${TfLiteMobilenetV2Quantized-Armnn_sources}") |
| 59 | |
Nattapat Chaimanowong | d8eee59 | 2018-10-26 10:24:14 +0100 | [diff] [blame] | 60 | set(TfLiteVGG16Quantized-Armnn_sources |
| 61 | TfLiteVGG16Quantized-Armnn/TfLiteVGG16Quantized-Armnn.cpp |
| 62 | ImagePreprocessor.hpp |
| 63 | ImagePreprocessor.cpp) |
| 64 | TfLiteParserTest(TfLiteVGG16Quantized-Armnn "${TfLiteVGG16Quantized-Armnn_sources}") |
Bruno Goncalves | c981df3 | 2018-12-27 16:15:01 -0200 | [diff] [blame] | 65 | |
David Monahan | a820e02 | 2019-04-23 11:03:38 +0100 | [diff] [blame] | 66 | set(TfLiteMobileNetQuantizedSoftmax-Armnn_sources |
| 67 | TfLiteMobileNetQuantizedSoftmax-Armnn/TfLiteMobileNetQuantizedSoftmax-Armnn.cpp |
| 68 | ImagePreprocessor.hpp |
| 69 | ImagePreprocessor.cpp) |
| 70 | TfLiteParserTest(TfLiteMobileNetQuantizedSoftmax-Armnn "${TfLiteMobileNetQuantizedSoftmax-Armnn_sources}") |
| 71 | |
Bruno Goncalves | c981df3 | 2018-12-27 16:15:01 -0200 | [diff] [blame] | 72 | set(TfLiteInceptionV3Quantized-Armnn_sources |
| 73 | TfLiteInceptionV3Quantized-Armnn/TfLiteInceptionV3Quantized-Armnn.cpp |
| 74 | ImagePreprocessor.hpp |
| 75 | ImagePreprocessor.cpp) |
| 76 | TfLiteParserTest(TfLiteInceptionV3Quantized-Armnn "${TfLiteInceptionV3Quantized-Armnn_sources}") |
Bruno Goncalves | 8f29338 | 2018-12-27 16:15:38 -0200 | [diff] [blame] | 77 | |
Bruno Goncalves | ccbde0e | 2018-12-28 10:09:53 -0200 | [diff] [blame] | 78 | set(TfLiteInceptionV4Quantized-Armnn_sources |
| 79 | TfLiteInceptionV4Quantized-Armnn/TfLiteInceptionV4Quantized-Armnn.cpp |
| 80 | ImagePreprocessor.hpp |
| 81 | ImagePreprocessor.cpp) |
| 82 | TfLiteParserTest(TfLiteInceptionV4Quantized-Armnn "${TfLiteInceptionV4Quantized-Armnn_sources}") |
| 83 | |
Bruno Goncalves | 8f29338 | 2018-12-27 16:15:38 -0200 | [diff] [blame] | 84 | set(TfLiteResNetV2-Armnn_sources |
| 85 | TfLiteResNetV2-Armnn/TfLiteResNetV2-Armnn.cpp |
| 86 | ImagePreprocessor.hpp |
| 87 | ImagePreprocessor.cpp) |
| 88 | TfLiteParserTest(TfLiteResNetV2-Armnn "${TfLiteResNetV2-Armnn_sources}") |
Bruno Goncalves | 61980d4 | 2018-12-28 10:08:26 -0200 | [diff] [blame] | 89 | |
Nina Drozd | 472d4e0 | 2019-04-15 17:18:36 +0100 | [diff] [blame] | 90 | set(TfLiteResNetV2-50-Quantized-Armnn_sources |
David Monahan | a820e02 | 2019-04-23 11:03:38 +0100 | [diff] [blame] | 91 | TfLiteResNetV2-50-Quantized-Armnn/TfLiteResNetV2-50-Quantized-Armnn.cpp |
| 92 | ImagePreprocessor.hpp |
| 93 | ImagePreprocessor.cpp) |
Nina Drozd | 472d4e0 | 2019-04-15 17:18:36 +0100 | [diff] [blame] | 94 | TfLiteParserTest(TfLiteResNetV2-50-Quantized-Armnn "${TfLiteResNetV2-50-Quantized-Armnn_sources}") |
| 95 | |
Bruno Goncalves | 61980d4 | 2018-12-28 10:08:26 -0200 | [diff] [blame] | 96 | set(TfLiteMnasNet-Armnn_sources |
| 97 | TfLiteMnasNet-Armnn/TfLiteMnasNet-Armnn.cpp |
| 98 | ImagePreprocessor.hpp |
| 99 | ImagePreprocessor.cpp) |
| 100 | TfLiteParserTest(TfLiteMnasNet-Armnn "${TfLiteMnasNet-Armnn_sources}") |
Derek Lamberti | d6cb30e | 2020-04-28 13:31:29 +0100 | [diff] [blame] | 101 | |
| 102 | |
| 103 | set(TfLiteYoloV3Big-Armnn_sources |
| 104 | TfLiteYoloV3Big-Armnn/NMS.cpp |
| 105 | TfLiteYoloV3Big-Armnn/NMS.hpp |
| 106 | TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp |
| 107 | ImagePreprocessor.hpp |
| 108 | ImagePreprocessor.cpp) |
| 109 | TfLiteParserTest(TfLiteYoloV3Big-Armnn "${TfLiteYoloV3Big-Armnn_sources}") |
Nikhil Raj | 5d955cf | 2021-04-19 16:59:48 +0100 | [diff] [blame] | 110 | |
| 111 | |
| 112 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 113 | endif() |
| 114 | |
| 115 | if (BUILD_ONNX_PARSER) |
| 116 | macro(OnnxParserTest testName sources) |
| 117 | add_executable_ex(${testName} ${sources}) |
| 118 | target_include_directories(${testName} PRIVATE ../src/armnnUtils) |
David Beck | 1b61be5 | 2018-11-08 09:19:14 +0000 | [diff] [blame] | 119 | target_include_directories(${testName} PRIVATE ../src/backends) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 120 | |
| 121 | target_link_libraries(${testName} inferenceTest) |
| 122 | target_link_libraries(${testName} armnnOnnxParser) |
| 123 | target_link_libraries(${testName} armnn) |
| 124 | target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT}) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 125 | addDllCopyCommands(${testName}) |
| 126 | endmacro() |
| 127 | |
| 128 | set(OnnxMnist-Armnn_sources |
| 129 | OnnxMnist-Armnn/OnnxMnist-Armnn.cpp |
| 130 | MnistDatabase.hpp |
| 131 | MnistDatabase.cpp) |
| 132 | OnnxParserTest(OnnxMnist-Armnn "${OnnxMnist-Armnn_sources}") |
| 133 | |
| 134 | set(OnnxMobileNet-Armnn_sources |
| 135 | OnnxMobileNet-Armnn/OnnxMobileNet-Armnn.cpp |
| 136 | ImagePreprocessor.hpp |
| 137 | ImagePreprocessor.cpp) |
| 138 | OnnxParserTest(OnnxMobileNet-Armnn "${OnnxMobileNet-Armnn_sources}") |
| 139 | endif() |
| 140 | |
Jan Eilers | 17d34da | 2021-12-08 16:15:12 +0000 | [diff] [blame] | 141 | if (BUILD_ARMNN_SERIALIZER |
| 142 | OR BUILD_TF_PARSER |
| 143 | OR BUILD_TF_LITE_PARSER |
| 144 | OR BUILD_ONNX_PARSER |
| 145 | OR BUILD_ARMNN_TFLITE_DELEGATE) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 146 | set(ExecuteNetwork_sources |
Jan Eilers | 4527490 | 2020-10-15 18:34:43 +0100 | [diff] [blame] | 147 | ExecuteNetwork/ExecuteNetwork.cpp |
| 148 | ExecuteNetwork/ExecuteNetworkProgramOptions.cpp |
| 149 | ExecuteNetwork/ExecuteNetworkProgramOptions.hpp |
| 150 | ExecuteNetwork/ExecuteNetworkParams.cpp |
| 151 | ExecuteNetwork/ExecuteNetworkParams.hpp |
| 152 | NetworkExecutionUtils/NetworkExecutionUtils.cpp |
| 153 | NetworkExecutionUtils/NetworkExecutionUtils.hpp) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 154 | |
| 155 | add_executable_ex(ExecuteNetwork ${ExecuteNetwork_sources}) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 156 | target_include_directories(ExecuteNetwork PRIVATE ../src/armnn) |
Aron Virginas-Tar | 5cc8e56 | 2018-10-23 15:14:46 +0100 | [diff] [blame] | 157 | target_include_directories(ExecuteNetwork PRIVATE ../src/armnnUtils) |
David Beck | 1b61be5 | 2018-11-08 09:19:14 +0000 | [diff] [blame] | 158 | target_include_directories(ExecuteNetwork PRIVATE ../src/backends) |
Jan Eilers | 4527490 | 2020-10-15 18:34:43 +0100 | [diff] [blame] | 159 | target_include_directories(ExecuteNetwork PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 160 | |
Aron Virginas-Tar | 64e4ccb | 2019-02-12 11:27:53 +0000 | [diff] [blame] | 161 | if (BUILD_ARMNN_SERIALIZER) |
| 162 | target_link_libraries(ExecuteNetwork armnnSerializer) |
| 163 | endif() |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 164 | |
| 165 | if (BUILD_TF_LITE_PARSER) |
| 166 | target_link_libraries(ExecuteNetwork armnnTfLiteParser) |
| 167 | endif() |
| 168 | if (BUILD_ONNX_PARSER) |
Sadik Armagan | 5d03e31 | 2020-11-17 16:43:56 +0000 | [diff] [blame] | 169 | target_link_libraries(ExecuteNetwork armnnOnnxParser) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 170 | endif() |
Sadik Armagan | 5d03e31 | 2020-11-17 16:43:56 +0000 | [diff] [blame] | 171 | if (BUILD_ARMNN_TFLITE_DELEGATE) |
| 172 | target_link_libraries(ExecuteNetwork ArmnnDelegate::ArmnnDelegate) |
| 173 | endif() |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 174 | target_link_libraries(ExecuteNetwork armnn) |
Sadik Armagan | 5d03e31 | 2020-11-17 16:43:56 +0000 | [diff] [blame] | 175 | |
| 176 | target_link_libraries(ExecuteNetwork ${CMAKE_THREAD_LIBS_INIT}) |
| 177 | addDllCopyCommands(ExecuteNetwork) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 178 | endif() |
Sadik Armagan | 8271f81 | 2019-04-19 09:55:06 +0100 | [diff] [blame] | 179 | |
Éanna Ó Catháin | a4247d5 | 2019-05-08 14:00:45 +0100 | [diff] [blame] | 180 | if(BUILD_ACCURACY_TOOL) |
| 181 | macro(AccuracyTool executorName) |
| 182 | target_link_libraries(${executorName} ${CMAKE_THREAD_LIBS_INIT}) |
Francis Murtagh | bee4bc9 | 2019-06-18 12:30:37 +0100 | [diff] [blame] | 183 | if (BUILD_ARMNN_SERIALIZER) |
| 184 | target_link_libraries(${executorName} armnnSerializer) |
| 185 | endif() |
Francis Murtagh | bee4bc9 | 2019-06-18 12:30:37 +0100 | [diff] [blame] | 186 | if (BUILD_TF_LITE_PARSER) |
| 187 | target_link_libraries(${executorName} armnnTfLiteParser) |
| 188 | endif() |
| 189 | if (BUILD_ONNX_PARSER) |
| 190 | target_link_libraries(${executorName} armnnOnnxParser) |
| 191 | endif() |
Éanna Ó Catháin | a4247d5 | 2019-05-08 14:00:45 +0100 | [diff] [blame] | 192 | addDllCopyCommands(${executorName}) |
| 193 | endmacro() |
| 194 | |
| 195 | set(ModelAccuracyTool-Armnn_sources |
| 196 | ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp) |
| 197 | |
| 198 | add_executable_ex(ModelAccuracyTool ${ModelAccuracyTool-Armnn_sources}) |
| 199 | target_include_directories(ModelAccuracyTool PRIVATE ../src/armnn) |
| 200 | target_include_directories(ModelAccuracyTool PRIVATE ../src/armnnUtils) |
| 201 | target_include_directories(ModelAccuracyTool PRIVATE ../src/backends) |
| 202 | target_link_libraries(ModelAccuracyTool inferenceTest) |
| 203 | target_link_libraries(ModelAccuracyTool armnn) |
| 204 | target_link_libraries(ModelAccuracyTool armnnSerializer) |
| 205 | AccuracyTool(ModelAccuracyTool) |
| 206 | endif() |
| 207 | |
Kevin May | 4a621c43 | 2021-04-22 16:51:18 +0100 | [diff] [blame] | 208 | if(BUILD_ACCURACY_TOOL) |
Sadik Armagan | 8271f81 | 2019-04-19 09:55:06 +0100 | [diff] [blame] | 209 | macro(ImageTensorExecutor executorName) |
| 210 | target_link_libraries(${executorName} ${CMAKE_THREAD_LIBS_INIT}) |
Sadik Armagan | 8271f81 | 2019-04-19 09:55:06 +0100 | [diff] [blame] | 211 | addDllCopyCommands(${executorName}) |
| 212 | endmacro() |
| 213 | |
| 214 | set(ImageTensorGenerator_sources |
| 215 | InferenceTestImage.hpp |
| 216 | InferenceTestImage.cpp |
| 217 | ImageTensorGenerator/ImageTensorGenerator.cpp) |
| 218 | |
| 219 | add_executable_ex(ImageTensorGenerator ${ImageTensorGenerator_sources}) |
| 220 | target_include_directories(ImageTensorGenerator PRIVATE ../src/armnn) |
| 221 | target_include_directories(ImageTensorGenerator PRIVATE ../src/armnnUtils) |
| 222 | |
| 223 | target_link_libraries(ImageTensorGenerator armnn) |
| 224 | ImageTensorExecutor(ImageTensorGenerator) |
| 225 | |
| 226 | set(ImageCSVFileGenerator_sources |
| 227 | ImageCSVFileGenerator/ImageCSVFileGenerator.cpp) |
| 228 | |
| 229 | add_executable_ex(ImageCSVFileGenerator ${ImageCSVFileGenerator_sources}) |
Francis Murtagh | 532a29d | 2020-06-29 11:50:01 +0100 | [diff] [blame] | 230 | target_include_directories(ImageCSVFileGenerator PRIVATE ../src/armnnUtils) |
Sadik Armagan | 8271f81 | 2019-04-19 09:55:06 +0100 | [diff] [blame] | 231 | ImageTensorExecutor(ImageCSVFileGenerator) |
| 232 | endif() |
Jim Flynn | e1fdd28 | 2021-10-26 21:26:10 +0100 | [diff] [blame] | 233 | |
| 234 | if(BUILD_MEMORY_STRATEGY_BENCHMARK) |
| 235 | add_subdirectory(MemoryStrategyBenchmark) |
| 236 | endif() |