telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1 | # UnitTests |
| 2 | include(CheckIncludeFiles) |
| 3 | |
| 4 | include_directories(SYSTEM "${THIRD_PARTY_INCLUDE_DIRS}") |
| 5 | |
| 6 | # Setup the inference test framework |
| 7 | set(inference_test_sources |
| 8 | ClassifierTestCaseData.hpp |
| 9 | InferenceModel.hpp |
| 10 | InferenceTest.hpp |
| 11 | InferenceTest.inl |
| 12 | InferenceTest.cpp |
| 13 | InferenceTestImage.hpp |
| 14 | InferenceTestImage.cpp) |
| 15 | add_library_ex(inferenceTest STATIC ${inference_test_sources}) |
| 16 | target_include_directories(inferenceTest PRIVATE ../src/armnnUtils) |
David Beck | 1b61be5 | 2018-11-08 09:19:14 +0000 | [diff] [blame] | 17 | target_include_directories(inferenceTest PRIVATE ../src/backends) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 18 | |
| 19 | if(BUILD_CAFFE_PARSER) |
| 20 | macro(CaffeParserTest 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 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 24 | set_target_properties(${testName} PROPERTIES COMPILE_FLAGS "${CAFFE_PARSER_TEST_ADDITIONAL_COMPILE_FLAGS}") |
| 25 | |
| 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 | if(OPENCL_LIBRARIES) |
| 31 | target_link_libraries(${testName} ${OPENCL_LIBRARIES}) |
| 32 | endif() |
| 33 | target_link_libraries(${testName} |
| 34 | ${Boost_SYSTEM_LIBRARY} |
| 35 | ${Boost_FILESYSTEM_LIBRARY} |
| 36 | ${Boost_PROGRAM_OPTIONS_LIBRARY}) |
| 37 | addDllCopyCommands(${testName}) |
| 38 | endmacro() |
| 39 | |
| 40 | set(CaffeCifar10AcrossChannels-Armnn_sources |
| 41 | CaffeCifar10AcrossChannels-Armnn/CaffeCifar10AcrossChannels-Armnn.cpp |
| 42 | Cifar10Database.hpp |
| 43 | Cifar10Database.cpp) |
| 44 | CaffeParserTest(CaffeCifar10AcrossChannels-Armnn "${CaffeCifar10AcrossChannels-Armnn_sources}") |
| 45 | |
| 46 | set(CaffeMnist-Armnn_sources |
| 47 | CaffeMnist-Armnn/CaffeMnist-Armnn.cpp |
| 48 | MnistDatabase.hpp |
| 49 | MnistDatabase.cpp) |
| 50 | CaffeParserTest(CaffeMnist-Armnn "${CaffeMnist-Armnn_sources}") |
| 51 | |
| 52 | set(CaffeAlexNet-Armnn_sources |
| 53 | CaffeAlexNet-Armnn/CaffeAlexNet-Armnn.cpp |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 54 | CaffePreprocessor.hpp |
| 55 | CaffePreprocessor.cpp) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 56 | CaffeParserTest(CaffeAlexNet-Armnn "${CaffeAlexNet-Armnn_sources}") |
| 57 | |
| 58 | set(MultipleNetworksCifar10_SRC |
| 59 | MultipleNetworksCifar10/MultipleNetworksCifar10.cpp |
| 60 | Cifar10Database.hpp |
| 61 | Cifar10Database.cpp) |
| 62 | CaffeParserTest(MultipleNetworksCifar10 "${MultipleNetworksCifar10_SRC}") |
| 63 | |
| 64 | set(CaffeResNet-Armnn_sources |
| 65 | CaffeResNet-Armnn/CaffeResNet-Armnn.cpp |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 66 | CaffePreprocessor.hpp |
| 67 | CaffePreprocessor.cpp) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 68 | CaffeParserTest(CaffeResNet-Armnn "${CaffeResNet-Armnn_sources}") |
| 69 | |
| 70 | set(CaffeVGG-Armnn_sources |
| 71 | CaffeVGG-Armnn/CaffeVGG-Armnn.cpp |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 72 | CaffePreprocessor.hpp |
| 73 | CaffePreprocessor.cpp) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 74 | CaffeParserTest(CaffeVGG-Armnn "${CaffeVGG-Armnn_sources}") |
| 75 | |
| 76 | set(CaffeInception_BN-Armnn_sources |
| 77 | CaffeInception_BN-Armnn/CaffeInception_BN-Armnn.cpp |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 78 | CaffePreprocessor.hpp |
| 79 | CaffePreprocessor.cpp) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 80 | CaffeParserTest(CaffeInception_BN-Armnn "${CaffeInception_BN-Armnn_sources}") |
| 81 | |
| 82 | set(CaffeYolo-Armnn_sources |
| 83 | CaffeYolo-Armnn/CaffeYolo-Armnn.cpp |
| 84 | YoloDatabase.hpp |
| 85 | YoloDatabase.cpp |
| 86 | YoloInferenceTest.hpp) |
| 87 | CaffeParserTest(CaffeYolo-Armnn "${CaffeYolo-Armnn_sources}") |
| 88 | endif() |
| 89 | |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 90 | if(BUILD_TF_PARSER) |
| 91 | macro(TfParserTest testName sources) |
| 92 | add_executable_ex(${testName} ${sources}) |
| 93 | target_include_directories(${testName} PRIVATE ../src/armnnUtils) |
David Beck | 1b61be5 | 2018-11-08 09:19:14 +0000 | [diff] [blame] | 94 | target_include_directories(${testName} PRIVATE ../src/backends) |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 95 | |
| 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}) |
| 100 | if(OPENCL_LIBRARIES) |
| 101 | target_link_libraries(${testName} ${OPENCL_LIBRARIES}) |
| 102 | endif() |
| 103 | target_link_libraries(${testName} |
| 104 | ${Boost_SYSTEM_LIBRARY} |
| 105 | ${Boost_FILESYSTEM_LIBRARY} |
| 106 | ${Boost_PROGRAM_OPTIONS_LIBRARY}) |
| 107 | addDllCopyCommands(${testName}) |
| 108 | endmacro() |
| 109 | |
| 110 | set(TfMnist-Armnn_sources |
| 111 | TfMnist-Armnn/TfMnist-Armnn.cpp |
| 112 | MnistDatabase.hpp |
| 113 | MnistDatabase.cpp) |
| 114 | TfParserTest(TfMnist-Armnn "${TfMnist-Armnn_sources}") |
| 115 | |
| 116 | set(TfCifar10-Armnn_sources |
| 117 | TfCifar10-Armnn/TfCifar10-Armnn.cpp |
| 118 | Cifar10Database.hpp |
| 119 | Cifar10Database.cpp) |
| 120 | TfParserTest(TfCifar10-Armnn "${TfCifar10-Armnn_sources}") |
| 121 | |
| 122 | set(TfMobileNet-Armnn_sources |
| 123 | TfMobileNet-Armnn/TfMobileNet-Armnn.cpp |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 124 | ImagePreprocessor.hpp |
| 125 | ImagePreprocessor.cpp) |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 126 | TfParserTest(TfMobileNet-Armnn "${TfMobileNet-Armnn_sources}") |
| 127 | |
| 128 | set(TfInceptionV3-Armnn_sources |
| 129 | TfInceptionV3-Armnn/TfInceptionV3-Armnn.cpp |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 130 | ImagePreprocessor.hpp |
| 131 | ImagePreprocessor.cpp) |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 132 | TfParserTest(TfInceptionV3-Armnn "${TfInceptionV3-Armnn_sources}") |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 133 | |
| 134 | set(TfResNext-Armnn_sources |
| 135 | TfResNext_Quantized-Armnn/TfResNext_Quantized-Armnn.cpp |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 136 | CaffePreprocessor.hpp |
| 137 | CaffePreprocessor.cpp) |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 138 | TfParserTest(TfResNext-Armnn "${TfResNext-Armnn_sources}") |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 139 | endif() |
| 140 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 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) |
David Beck | 1b61be5 | 2018-11-08 09:19:14 +0000 | [diff] [blame] | 145 | target_include_directories(${testName} PRIVATE ../src/backends) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 146 | |
| 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}) |
| 151 | if(OPENCL_LIBRARIES) |
| 152 | target_link_libraries(${testName} ${OPENCL_LIBRARIES}) |
| 153 | endif() |
| 154 | target_link_libraries(${testName} |
| 155 | ${Boost_SYSTEM_LIBRARY} |
| 156 | ${Boost_FILESYSTEM_LIBRARY} |
| 157 | ${Boost_PROGRAM_OPTIONS_LIBRARY}) |
| 158 | addDllCopyCommands(${testName}) |
| 159 | endmacro() |
| 160 | |
| 161 | set(TfLiteMobilenetQuantized-Armnn_sources |
| 162 | TfLiteMobilenetQuantized-Armnn/TfLiteMobilenetQuantized-Armnn.cpp |
| 163 | ImagePreprocessor.hpp |
| 164 | ImagePreprocessor.cpp) |
| 165 | TfLiteParserTest(TfLiteMobilenetQuantized-Armnn "${TfLiteMobilenetQuantized-Armnn_sources}") |
Nattapat Chaimanowong | d8eee59 | 2018-10-26 10:24:14 +0100 | [diff] [blame] | 166 | |
Aron Virginas-Tar | d089b74 | 2019-01-29 11:09:51 +0000 | [diff] [blame] | 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}") |
| 173 | |
Bruno Goncalves | 0630411 | 2018-12-27 16:13:58 -0200 | [diff] [blame] | 174 | set(TfLiteMobilenetV2Quantized-Armnn_sources |
| 175 | TfLiteMobilenetV2Quantized-Armnn/TfLiteMobilenetV2Quantized-Armnn.cpp |
| 176 | ImagePreprocessor.hpp |
| 177 | ImagePreprocessor.cpp) |
| 178 | TfLiteParserTest(TfLiteMobilenetV2Quantized-Armnn "${TfLiteMobilenetV2Quantized-Armnn_sources}") |
| 179 | |
Nattapat Chaimanowong | d8eee59 | 2018-10-26 10:24:14 +0100 | [diff] [blame] | 180 | set(TfLiteVGG16Quantized-Armnn_sources |
| 181 | TfLiteVGG16Quantized-Armnn/TfLiteVGG16Quantized-Armnn.cpp |
| 182 | ImagePreprocessor.hpp |
| 183 | ImagePreprocessor.cpp) |
| 184 | TfLiteParserTest(TfLiteVGG16Quantized-Armnn "${TfLiteVGG16Quantized-Armnn_sources}") |
Bruno Goncalves | c981df3 | 2018-12-27 16:15:01 -0200 | [diff] [blame] | 185 | |
| 186 | set(TfLiteInceptionV3Quantized-Armnn_sources |
| 187 | TfLiteInceptionV3Quantized-Armnn/TfLiteInceptionV3Quantized-Armnn.cpp |
| 188 | ImagePreprocessor.hpp |
| 189 | ImagePreprocessor.cpp) |
| 190 | TfLiteParserTest(TfLiteInceptionV3Quantized-Armnn "${TfLiteInceptionV3Quantized-Armnn_sources}") |
Bruno Goncalves | 8f29338 | 2018-12-27 16:15:38 -0200 | [diff] [blame] | 191 | |
Bruno Goncalves | ccbde0e | 2018-12-28 10:09:53 -0200 | [diff] [blame] | 192 | set(TfLiteInceptionV4Quantized-Armnn_sources |
| 193 | TfLiteInceptionV4Quantized-Armnn/TfLiteInceptionV4Quantized-Armnn.cpp |
| 194 | ImagePreprocessor.hpp |
| 195 | ImagePreprocessor.cpp) |
| 196 | TfLiteParserTest(TfLiteInceptionV4Quantized-Armnn "${TfLiteInceptionV4Quantized-Armnn_sources}") |
| 197 | |
Bruno Goncalves | 8f29338 | 2018-12-27 16:15:38 -0200 | [diff] [blame] | 198 | set(TfLiteResNetV2-Armnn_sources |
| 199 | TfLiteResNetV2-Armnn/TfLiteResNetV2-Armnn.cpp |
| 200 | ImagePreprocessor.hpp |
| 201 | ImagePreprocessor.cpp) |
| 202 | TfLiteParserTest(TfLiteResNetV2-Armnn "${TfLiteResNetV2-Armnn_sources}") |
Bruno Goncalves | 61980d4 | 2018-12-28 10:08:26 -0200 | [diff] [blame] | 203 | |
| 204 | set(TfLiteMnasNet-Armnn_sources |
| 205 | TfLiteMnasNet-Armnn/TfLiteMnasNet-Armnn.cpp |
| 206 | ImagePreprocessor.hpp |
| 207 | ImagePreprocessor.cpp) |
| 208 | TfLiteParserTest(TfLiteMnasNet-Armnn "${TfLiteMnasNet-Armnn_sources}") |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 209 | endif() |
| 210 | |
| 211 | if (BUILD_ONNX_PARSER) |
| 212 | macro(OnnxParserTest testName sources) |
| 213 | add_executable_ex(${testName} ${sources}) |
| 214 | target_include_directories(${testName} PRIVATE ../src/armnnUtils) |
David Beck | 1b61be5 | 2018-11-08 09:19:14 +0000 | [diff] [blame] | 215 | target_include_directories(${testName} PRIVATE ../src/backends) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 216 | |
| 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 | if(OPENCL_LIBRARIES) |
| 222 | target_link_libraries(${testName} ${OPENCL_LIBRARIES}) |
| 223 | endif() |
| 224 | target_link_libraries(${testName} |
| 225 | ${Boost_SYSTEM_LIBRARY} |
| 226 | ${Boost_FILESYSTEM_LIBRARY} |
| 227 | ${Boost_PROGRAM_OPTIONS_LIBRARY}) |
| 228 | addDllCopyCommands(${testName}) |
| 229 | endmacro() |
| 230 | |
| 231 | set(OnnxMnist-Armnn_sources |
| 232 | OnnxMnist-Armnn/OnnxMnist-Armnn.cpp |
| 233 | MnistDatabase.hpp |
| 234 | MnistDatabase.cpp) |
| 235 | OnnxParserTest(OnnxMnist-Armnn "${OnnxMnist-Armnn_sources}") |
| 236 | |
| 237 | set(OnnxMobileNet-Armnn_sources |
| 238 | OnnxMobileNet-Armnn/OnnxMobileNet-Armnn.cpp |
| 239 | ImagePreprocessor.hpp |
| 240 | ImagePreprocessor.cpp) |
| 241 | OnnxParserTest(OnnxMobileNet-Armnn "${OnnxMobileNet-Armnn_sources}") |
| 242 | endif() |
| 243 | |
Aron Virginas-Tar | 64e4ccb | 2019-02-12 11:27:53 +0000 | [diff] [blame] | 244 | if (BUILD_ARMNN_SERIALIZER OR BUILD_CAFFE_PARSER OR BUILD_TF_PARSER OR BUILD_TF_LITE_PARSER OR BUILD_ONNX_PARSER) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 245 | set(ExecuteNetwork_sources |
| 246 | ExecuteNetwork/ExecuteNetwork.cpp) |
| 247 | |
| 248 | add_executable_ex(ExecuteNetwork ${ExecuteNetwork_sources}) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 249 | target_include_directories(ExecuteNetwork PRIVATE ../src/armnn) |
Aron Virginas-Tar | 5cc8e56 | 2018-10-23 15:14:46 +0100 | [diff] [blame] | 250 | target_include_directories(ExecuteNetwork PRIVATE ../src/armnnUtils) |
David Beck | 1b61be5 | 2018-11-08 09:19:14 +0000 | [diff] [blame] | 251 | target_include_directories(ExecuteNetwork PRIVATE ../src/backends) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 252 | |
Aron Virginas-Tar | 64e4ccb | 2019-02-12 11:27:53 +0000 | [diff] [blame] | 253 | if (BUILD_ARMNN_SERIALIZER) |
| 254 | target_link_libraries(ExecuteNetwork armnnSerializer) |
| 255 | endif() |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 256 | if (BUILD_CAFFE_PARSER) |
| 257 | target_link_libraries(ExecuteNetwork armnnCaffeParser) |
| 258 | endif() |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 259 | if (BUILD_TF_PARSER) |
| 260 | target_link_libraries(ExecuteNetwork armnnTfParser) |
| 261 | endif() |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 262 | |
| 263 | if (BUILD_TF_LITE_PARSER) |
| 264 | target_link_libraries(ExecuteNetwork armnnTfLiteParser) |
| 265 | endif() |
| 266 | if (BUILD_ONNX_PARSER) |
| 267 | target_link_libraries(ExecuteNetwork armnnOnnxParser) |
| 268 | endif() |
| 269 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 270 | target_link_libraries(ExecuteNetwork armnn) |
| 271 | target_link_libraries(ExecuteNetwork ${CMAKE_THREAD_LIBS_INIT}) |
| 272 | if(OPENCL_LIBRARIES) |
| 273 | target_link_libraries(ExecuteNetwork ${OPENCL_LIBRARIES}) |
| 274 | endif() |
| 275 | target_link_libraries(ExecuteNetwork |
| 276 | ${Boost_SYSTEM_LIBRARY} |
| 277 | ${Boost_FILESYSTEM_LIBRARY} |
| 278 | ${Boost_PROGRAM_OPTIONS_LIBRARY}) |
| 279 | addDllCopyCommands(ExecuteNetwork) |
| 280 | endif() |