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