aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt344
-rw-r--r--tests/CaffeAlexNet-Armnn/CaffeAlexNet-Armnn.cpp35
-rw-r--r--tests/CaffeAlexNet-Armnn/Validation.txt1000
-rw-r--r--tests/CaffeCifar10AcrossChannels-Armnn/CaffeCifar10AcrossChannels-Armnn.cpp36
-rw-r--r--tests/CaffeCifar10AcrossChannels-Armnn/Validation.txt1000
-rw-r--r--tests/CaffeInception_BN-Armnn/CaffeInception_BN-Armnn.cpp42
-rw-r--r--tests/CaffeInception_BN-Armnn/Validation.txt1000
-rw-r--r--tests/CaffeMnist-Armnn/CaffeMnist-Armnn.cpp36
-rw-r--r--tests/CaffeMnist-Armnn/Validation.txt1000
-rw-r--r--tests/CaffePreprocessor.cpp46
-rw-r--r--tests/CaffePreprocessor.hpp40
-rw-r--r--tests/CaffeResNet-Armnn/CaffeResNet-Armnn.cpp45
-rw-r--r--tests/CaffeResNet-Armnn/Validation.txt2000
-rw-r--r--tests/CaffeSqueezeNet1_0-Armnn/CaffeSqueezeNet1_0-Armnn.cpp20
-rw-r--r--tests/CaffeVGG-Armnn/CaffeVGG-Armnn.cpp37
-rw-r--r--tests/CaffeVGG-Armnn/Validation.txt1000
-rw-r--r--tests/CaffeYolo-Armnn/CaffeYolo-Armnn.cpp58
-rw-r--r--tests/Cifar10Database.cpp85
-rw-r--r--tests/Cifar10Database.hpp24
-rw-r--r--tests/ClassifierTestCaseData.hpp21
-rw-r--r--tests/DeepSpeechV1Database.hpp202
-rw-r--r--tests/DeepSpeechV1InferenceTest.hpp204
-rw-r--r--tests/ExecuteNetwork/ExecuteNetwork.cpp276
-rw-r--r--tests/ImageCSVFileGenerator/ImageCSVFileGenerator.cpp225
-rw-r--r--tests/ImageCSVFileGenerator/README.md13
-rw-r--r--tests/ImagePreprocessor.cpp82
-rw-r--r--tests/ImagePreprocessor.hpp73
-rw-r--r--tests/ImageTensorGenerator/ImageTensorGenerator.cpp313
-rw-r--r--tests/ImageTensorGenerator/ImageTensorGenerator.hpp183
-rw-r--r--tests/ImageTensorGenerator/README.md21
-rw-r--r--tests/InferenceModel.hpp593
-rw-r--r--tests/InferenceTest.cpp260
-rw-r--r--tests/InferenceTest.hpp236
-rw-r--r--tests/InferenceTest.inl407
-rw-r--r--tests/InferenceTestImage.cpp363
-rw-r--r--tests/InferenceTestImage.hpp145
-rw-r--r--tests/LstmCommon.hpp30
-rw-r--r--tests/MnistDatabase.cpp106
-rw-r--r--tests/MnistDatabase.hpp24
-rw-r--r--tests/MobileNetSsdDatabase.hpp135
-rw-r--r--tests/MobileNetSsdInferenceTest.hpp203
-rw-r--r--tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp480
-rw-r--r--tests/ModelAccuracyTool-Armnn/README.md30
-rw-r--r--tests/MultipleNetworksCifar10/MultipleNetworksCifar10.cpp234
-rw-r--r--tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp849
-rw-r--r--tests/ObjectDetectionCommon.hpp55
-rw-r--r--tests/OnnxMnist-Armnn/OnnxMnist-Armnn.cpp39
-rw-r--r--tests/OnnxMnist-Armnn/Validation.txt1000
-rw-r--r--tests/OnnxMobileNet-Armnn/OnnxMobileNet-Armnn.cpp59
-rw-r--r--tests/OnnxMobileNet-Armnn/Validation.txt201
-rw-r--r--tests/OnnxMobileNet-Armnn/labels.txt1001
-rw-r--r--tests/TfCifar10-Armnn/TfCifar10-Armnn.cpp38
-rw-r--r--tests/TfCifar10-Armnn/Validation.txt1000
-rw-r--r--tests/TfInceptionV3-Armnn/TfInceptionV3-Armnn.cpp70
-rw-r--r--tests/TfInceptionV3-Armnn/Validation.txt201
-rw-r--r--tests/TfLiteInceptionV3Quantized-Armnn/TfLiteInceptionV3Quantized-Armnn.cpp61
-rw-r--r--tests/TfLiteInceptionV3Quantized-Armnn/Validation.txt201
-rw-r--r--tests/TfLiteInceptionV4Quantized-Armnn/TfLiteInceptionV4Quantized-Armnn.cpp61
-rw-r--r--tests/TfLiteInceptionV4Quantized-Armnn/Validation.txt201
-rw-r--r--tests/TfLiteMnasNet-Armnn/TfLiteMnasNet-Armnn.cpp60
-rw-r--r--tests/TfLiteMobileNetQuantizedSoftmax-Armnn/TfLiteMobileNetQuantizedSoftmax-Armnn.cpp67
-rw-r--r--tests/TfLiteMobileNetQuantizedSoftmax-Armnn/Validation.txt201
-rw-r--r--tests/TfLiteMobileNetSsd-Armnn/TfLiteMobileNetSsd-Armnn.cpp79
-rw-r--r--tests/TfLiteMobilenetQuantized-Armnn/TfLiteMobilenetQuantized-Armnn.cpp129
-rw-r--r--tests/TfLiteMobilenetQuantized-Armnn/Validation.txt201
-rw-r--r--tests/TfLiteMobilenetQuantized-Armnn/labels.txt1001
-rw-r--r--tests/TfLiteMobilenetV2Quantized-Armnn/TfLiteMobilenetV2Quantized-Armnn.cpp61
-rw-r--r--tests/TfLiteResNetV2-50-Quantized-Armnn/TfLiteResNetV2-50-Quantized-Armnn.cpp61
-rw-r--r--tests/TfLiteResNetV2-Armnn/TfLiteResNetV2-Armnn.cpp60
-rw-r--r--tests/TfLiteVGG16Quantized-Armnn/TfLiteVGG16Quantized-Armnn.cpp67
-rw-r--r--tests/TfLiteVGG16Quantized-Armnn/Validation.txt201
-rw-r--r--tests/TfMnist-Armnn/TfMnist-Armnn.cpp39
-rw-r--r--tests/TfMnist-Armnn/Validation.txt1000
-rw-r--r--tests/TfMobileNet-Armnn/TfMobileNet-Armnn.cpp78
-rw-r--r--tests/TfMobileNet-Armnn/Validation.txt201
-rw-r--r--tests/TfMobileNet-Armnn/labels.txt1001
-rw-r--r--tests/TfResNext_Quantized-Armnn/TfResNext_Quantized-Armnn.cpp46
-rw-r--r--tests/YoloDatabase.cpp104
-rw-r--r--tests/YoloDatabase.hpp63
-rw-r--r--tests/YoloInferenceTest.hpp240
-rw-r--r--tests/profiling/gatordmock/CommandFileParser.cpp85
-rw-r--r--tests/profiling/gatordmock/CommandFileParser.hpp29
-rw-r--r--tests/profiling/gatordmock/CommandLineProcessor.cpp72
-rw-r--r--tests/profiling/gatordmock/CommandLineProcessor.hpp47
-rw-r--r--tests/profiling/gatordmock/CounterDirectory.hpp263
-rw-r--r--tests/profiling/gatordmock/GatordMockMain.cpp79
-rw-r--r--tests/profiling/gatordmock/GatordMockService.cpp485
-rw-r--r--tests/profiling/gatordmock/GatordMockService.hpp158
-rw-r--r--tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.cpp128
-rw-r--r--tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp61
-rw-r--r--tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.cpp37
-rw-r--r--tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp45
-rw-r--r--tests/profiling/gatordmock/StreamMetadataCommandHandler.cpp127
-rw-r--r--tests/profiling/gatordmock/StreamMetadataCommandHandler.hpp71
-rw-r--r--tests/profiling/gatordmock/tests/GatordMockTests.cpp295
-rw-r--r--tests/profiling/timelineDecoder/ITimelineDecoder.h41
-rw-r--r--tests/profiling/timelineDecoder/TimelineCaptureCommandHandler.cpp300
-rw-r--r--tests/profiling/timelineDecoder/TimelineCaptureCommandHandler.hpp66
-rw-r--r--tests/profiling/timelineDecoder/TimelineDecoder.cpp166
-rw-r--r--tests/profiling/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp117
-rw-r--r--tests/profiling/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp49
-rw-r--r--tests/profiling/timelineDecoder/TimelineModel.h96
-rw-r--r--tests/profiling/timelineDecoder/tests/TimelineTestFunctions.hpp143
-rw-r--r--tests/profiling/timelineDecoder/tests/TimelineTests.cpp220
104 files changed, 0 insertions, 25884 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
deleted file mode 100644
index 014221b9c4..0000000000
--- a/tests/CMakeLists.txt
+++ /dev/null
@@ -1,344 +0,0 @@
-# UnitTests
-include(CheckIncludeFiles)
-
-# Setup the inference test framework
-set(inference_test_sources
- ClassifierTestCaseData.hpp
- InferenceModel.hpp
- InferenceTest.hpp
- InferenceTest.inl
- InferenceTest.cpp
- InferenceTestImage.hpp
- InferenceTestImage.cpp)
-
-add_library_ex(inferenceTest STATIC ${inference_test_sources})
-target_include_directories(inferenceTest PRIVATE ../src/armnnUtils)
-target_include_directories(inferenceTest PRIVATE ../src/backends)
-target_include_directories(inferenceTest PRIVATE ../third-party/stb)
-
-if(BUILD_CAFFE_PARSER)
- macro(CaffeParserTest testName sources)
- add_executable_ex(${testName} ${sources})
- target_include_directories(${testName} PRIVATE ../src/armnnUtils)
- target_include_directories(${testName} PRIVATE ../src/backends)
- set_target_properties(${testName} PROPERTIES COMPILE_FLAGS "${CAFFE_PARSER_TEST_ADDITIONAL_COMPILE_FLAGS}")
-
- target_link_libraries(${testName} inferenceTest)
- target_link_libraries(${testName} armnnCaffeParser)
- target_link_libraries(${testName} armnn)
- target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
- target_link_libraries(${testName}
- ${Boost_SYSTEM_LIBRARY}
- ${Boost_FILESYSTEM_LIBRARY}
- ${Boost_PROGRAM_OPTIONS_LIBRARY})
- addDllCopyCommands(${testName})
- endmacro()
-
- set(CaffeCifar10AcrossChannels-Armnn_sources
- CaffeCifar10AcrossChannels-Armnn/CaffeCifar10AcrossChannels-Armnn.cpp
- Cifar10Database.hpp
- Cifar10Database.cpp)
- CaffeParserTest(CaffeCifar10AcrossChannels-Armnn "${CaffeCifar10AcrossChannels-Armnn_sources}")
-
- set(CaffeMnist-Armnn_sources
- CaffeMnist-Armnn/CaffeMnist-Armnn.cpp
- MnistDatabase.hpp
- MnistDatabase.cpp)
- CaffeParserTest(CaffeMnist-Armnn "${CaffeMnist-Armnn_sources}")
-
- set(CaffeAlexNet-Armnn_sources
- CaffeAlexNet-Armnn/CaffeAlexNet-Armnn.cpp
- CaffePreprocessor.hpp
- CaffePreprocessor.cpp)
- CaffeParserTest(CaffeAlexNet-Armnn "${CaffeAlexNet-Armnn_sources}")
-
- set(MultipleNetworksCifar10_SRC
- MultipleNetworksCifar10/MultipleNetworksCifar10.cpp
- Cifar10Database.hpp
- Cifar10Database.cpp)
- CaffeParserTest(MultipleNetworksCifar10 "${MultipleNetworksCifar10_SRC}")
-
- set(CaffeResNet-Armnn_sources
- CaffeResNet-Armnn/CaffeResNet-Armnn.cpp
- CaffePreprocessor.hpp
- CaffePreprocessor.cpp)
- CaffeParserTest(CaffeResNet-Armnn "${CaffeResNet-Armnn_sources}")
-
- set(CaffeVGG-Armnn_sources
- CaffeVGG-Armnn/CaffeVGG-Armnn.cpp
- CaffePreprocessor.hpp
- CaffePreprocessor.cpp)
- CaffeParserTest(CaffeVGG-Armnn "${CaffeVGG-Armnn_sources}")
-
- set(CaffeInception_BN-Armnn_sources
- CaffeInception_BN-Armnn/CaffeInception_BN-Armnn.cpp
- CaffePreprocessor.hpp
- CaffePreprocessor.cpp)
- CaffeParserTest(CaffeInception_BN-Armnn "${CaffeInception_BN-Armnn_sources}")
-
- set(CaffeYolo-Armnn_sources
- CaffeYolo-Armnn/CaffeYolo-Armnn.cpp
- YoloDatabase.hpp
- YoloDatabase.cpp
- YoloInferenceTest.hpp)
- CaffeParserTest(CaffeYolo-Armnn "${CaffeYolo-Armnn_sources}")
-endif()
-
-if(BUILD_TF_PARSER)
- macro(TfParserTest testName sources)
- add_executable_ex(${testName} ${sources})
- target_include_directories(${testName} PRIVATE ../src/armnnUtils)
- target_include_directories(${testName} PRIVATE ../src/backends)
-
- target_link_libraries(${testName} inferenceTest)
- target_link_libraries(${testName} armnnTfParser)
- target_link_libraries(${testName} armnn)
- target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
- target_link_libraries(${testName}
- ${Boost_SYSTEM_LIBRARY}
- ${Boost_FILESYSTEM_LIBRARY}
- ${Boost_PROGRAM_OPTIONS_LIBRARY})
- addDllCopyCommands(${testName})
- endmacro()
-
- set(TfMnist-Armnn_sources
- TfMnist-Armnn/TfMnist-Armnn.cpp
- MnistDatabase.hpp
- MnistDatabase.cpp)
- TfParserTest(TfMnist-Armnn "${TfMnist-Armnn_sources}")
-
- set(TfCifar10-Armnn_sources
- TfCifar10-Armnn/TfCifar10-Armnn.cpp
- Cifar10Database.hpp
- Cifar10Database.cpp)
- TfParserTest(TfCifar10-Armnn "${TfCifar10-Armnn_sources}")
-
- set(TfMobileNet-Armnn_sources
- TfMobileNet-Armnn/TfMobileNet-Armnn.cpp
- ImagePreprocessor.hpp
- ImagePreprocessor.cpp)
- TfParserTest(TfMobileNet-Armnn "${TfMobileNet-Armnn_sources}")
-
- set(TfInceptionV3-Armnn_sources
- TfInceptionV3-Armnn/TfInceptionV3-Armnn.cpp
- ImagePreprocessor.hpp
- ImagePreprocessor.cpp)
- TfParserTest(TfInceptionV3-Armnn "${TfInceptionV3-Armnn_sources}")
-
- set(TfResNext-Armnn_sources
- TfResNext_Quantized-Armnn/TfResNext_Quantized-Armnn.cpp
- CaffePreprocessor.hpp
- CaffePreprocessor.cpp)
- TfParserTest(TfResNext-Armnn "${TfResNext-Armnn_sources}")
-endif()
-
-if (BUILD_TF_LITE_PARSER)
- macro(TfLiteParserTest testName sources)
- add_executable_ex(${testName} ${sources})
- target_include_directories(${testName} PRIVATE ../src/armnnUtils)
- target_include_directories(${testName} PRIVATE ../src/backends)
-
- target_link_libraries(${testName} inferenceTest)
- target_link_libraries(${testName} armnnTfLiteParser)
- target_link_libraries(${testName} armnn)
- target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
- target_link_libraries(${testName}
- ${Boost_SYSTEM_LIBRARY}
- ${Boost_FILESYSTEM_LIBRARY}
- ${Boost_PROGRAM_OPTIONS_LIBRARY})
- addDllCopyCommands(${testName})
- endmacro()
-
- set(TfLiteMobilenetQuantized-Armnn_sources
- TfLiteMobilenetQuantized-Armnn/TfLiteMobilenetQuantized-Armnn.cpp
- ImagePreprocessor.hpp
- ImagePreprocessor.cpp)
- TfLiteParserTest(TfLiteMobilenetQuantized-Armnn "${TfLiteMobilenetQuantized-Armnn_sources}")
-
- set(TfLiteMobileNetSsd-Armnn_sources
- TfLiteMobileNetSsd-Armnn/TfLiteMobileNetSsd-Armnn.cpp
- MobileNetSsdDatabase.hpp
- MobileNetSsdInferenceTest.hpp
- ObjectDetectionCommon.hpp)
- TfLiteParserTest(TfLiteMobileNetSsd-Armnn "${TfLiteMobileNetSsd-Armnn_sources}")
-
- set(TfLiteMobilenetV2Quantized-Armnn_sources
- TfLiteMobilenetV2Quantized-Armnn/TfLiteMobilenetV2Quantized-Armnn.cpp
- ImagePreprocessor.hpp
- ImagePreprocessor.cpp)
- TfLiteParserTest(TfLiteMobilenetV2Quantized-Armnn "${TfLiteMobilenetV2Quantized-Armnn_sources}")
-
- set(TfLiteVGG16Quantized-Armnn_sources
- TfLiteVGG16Quantized-Armnn/TfLiteVGG16Quantized-Armnn.cpp
- ImagePreprocessor.hpp
- ImagePreprocessor.cpp)
- TfLiteParserTest(TfLiteVGG16Quantized-Armnn "${TfLiteVGG16Quantized-Armnn_sources}")
-
- set(TfLiteMobileNetQuantizedSoftmax-Armnn_sources
- TfLiteMobileNetQuantizedSoftmax-Armnn/TfLiteMobileNetQuantizedSoftmax-Armnn.cpp
- ImagePreprocessor.hpp
- ImagePreprocessor.cpp)
- TfLiteParserTest(TfLiteMobileNetQuantizedSoftmax-Armnn "${TfLiteMobileNetQuantizedSoftmax-Armnn_sources}")
-
- set(TfLiteInceptionV3Quantized-Armnn_sources
- TfLiteInceptionV3Quantized-Armnn/TfLiteInceptionV3Quantized-Armnn.cpp
- ImagePreprocessor.hpp
- ImagePreprocessor.cpp)
- TfLiteParserTest(TfLiteInceptionV3Quantized-Armnn "${TfLiteInceptionV3Quantized-Armnn_sources}")
-
- set(TfLiteInceptionV4Quantized-Armnn_sources
- TfLiteInceptionV4Quantized-Armnn/TfLiteInceptionV4Quantized-Armnn.cpp
- ImagePreprocessor.hpp
- ImagePreprocessor.cpp)
- TfLiteParserTest(TfLiteInceptionV4Quantized-Armnn "${TfLiteInceptionV4Quantized-Armnn_sources}")
-
- set(TfLiteResNetV2-Armnn_sources
- TfLiteResNetV2-Armnn/TfLiteResNetV2-Armnn.cpp
- ImagePreprocessor.hpp
- ImagePreprocessor.cpp)
- TfLiteParserTest(TfLiteResNetV2-Armnn "${TfLiteResNetV2-Armnn_sources}")
-
- set(TfLiteResNetV2-50-Quantized-Armnn_sources
- TfLiteResNetV2-50-Quantized-Armnn/TfLiteResNetV2-50-Quantized-Armnn.cpp
- ImagePreprocessor.hpp
- ImagePreprocessor.cpp)
- TfLiteParserTest(TfLiteResNetV2-50-Quantized-Armnn "${TfLiteResNetV2-50-Quantized-Armnn_sources}")
-
- set(TfLiteMnasNet-Armnn_sources
- TfLiteMnasNet-Armnn/TfLiteMnasNet-Armnn.cpp
- ImagePreprocessor.hpp
- ImagePreprocessor.cpp)
- TfLiteParserTest(TfLiteMnasNet-Armnn "${TfLiteMnasNet-Armnn_sources}")
-endif()
-
-if (BUILD_ONNX_PARSER)
- macro(OnnxParserTest testName sources)
- add_executable_ex(${testName} ${sources})
- target_include_directories(${testName} PRIVATE ../src/armnnUtils)
- target_include_directories(${testName} PRIVATE ../src/backends)
-
- target_link_libraries(${testName} inferenceTest)
- target_link_libraries(${testName} armnnOnnxParser)
- target_link_libraries(${testName} armnn)
- target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
- target_link_libraries(${testName}
- ${Boost_SYSTEM_LIBRARY}
- ${Boost_FILESYSTEM_LIBRARY}
- ${Boost_PROGRAM_OPTIONS_LIBRARY})
- addDllCopyCommands(${testName})
- endmacro()
-
- set(OnnxMnist-Armnn_sources
- OnnxMnist-Armnn/OnnxMnist-Armnn.cpp
- MnistDatabase.hpp
- MnistDatabase.cpp)
- OnnxParserTest(OnnxMnist-Armnn "${OnnxMnist-Armnn_sources}")
-
- set(OnnxMobileNet-Armnn_sources
- OnnxMobileNet-Armnn/OnnxMobileNet-Armnn.cpp
- ImagePreprocessor.hpp
- ImagePreprocessor.cpp)
- OnnxParserTest(OnnxMobileNet-Armnn "${OnnxMobileNet-Armnn_sources}")
-endif()
-
-if (BUILD_ARMNN_SERIALIZER OR BUILD_CAFFE_PARSER OR BUILD_TF_PARSER OR BUILD_TF_LITE_PARSER OR BUILD_ONNX_PARSER)
- set(ExecuteNetwork_sources
- ExecuteNetwork/ExecuteNetwork.cpp)
-
- add_executable_ex(ExecuteNetwork ${ExecuteNetwork_sources})
- target_include_directories(ExecuteNetwork PRIVATE ../src/armnn)
- target_include_directories(ExecuteNetwork PRIVATE ../src/armnnUtils)
- target_include_directories(ExecuteNetwork PRIVATE ../src/backends)
-
- if (BUILD_ARMNN_SERIALIZER)
- target_link_libraries(ExecuteNetwork armnnSerializer)
- endif()
- if (BUILD_CAFFE_PARSER)
- target_link_libraries(ExecuteNetwork armnnCaffeParser)
- endif()
- if (BUILD_TF_PARSER)
- target_link_libraries(ExecuteNetwork armnnTfParser)
- endif()
-
- if (BUILD_TF_LITE_PARSER)
- target_link_libraries(ExecuteNetwork armnnTfLiteParser)
- endif()
- if (BUILD_ONNX_PARSER)
- target_link_libraries(ExecuteNetwork armnnOnnxParser)
- endif()
-
- target_link_libraries(ExecuteNetwork armnn)
- target_link_libraries(ExecuteNetwork ${CMAKE_THREAD_LIBS_INIT})
- target_link_libraries(ExecuteNetwork
- ${Boost_SYSTEM_LIBRARY}
- ${Boost_FILESYSTEM_LIBRARY}
- ${Boost_PROGRAM_OPTIONS_LIBRARY})
- addDllCopyCommands(ExecuteNetwork)
-endif()
-
-if(BUILD_ACCURACY_TOOL)
- macro(AccuracyTool executorName)
- target_link_libraries(${executorName} ${CMAKE_THREAD_LIBS_INIT})
- if (BUILD_ARMNN_SERIALIZER)
- target_link_libraries(${executorName} armnnSerializer)
- endif()
- if (BUILD_CAFFE_PARSER)
- target_link_libraries(${executorName} armnnCaffeParser)
- endif()
- if (BUILD_TF_PARSER)
- target_link_libraries(${executorName} armnnTfParser)
- endif()
- if (BUILD_TF_LITE_PARSER)
- target_link_libraries(${executorName} armnnTfLiteParser)
- endif()
- if (BUILD_ONNX_PARSER)
- target_link_libraries(${executorName} armnnOnnxParser)
- endif()
- target_link_libraries(${executorName}
- ${Boost_SYSTEM_LIBRARY}
- ${Boost_FILESYSTEM_LIBRARY}
- ${Boost_PROGRAM_OPTIONS_LIBRARY})
- addDllCopyCommands(${executorName})
- endmacro()
-
- set(ModelAccuracyTool-Armnn_sources
- ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp)
-
- add_executable_ex(ModelAccuracyTool ${ModelAccuracyTool-Armnn_sources})
- target_include_directories(ModelAccuracyTool PRIVATE ../src/armnn)
- target_include_directories(ModelAccuracyTool PRIVATE ../src/armnnUtils)
- target_include_directories(ModelAccuracyTool PRIVATE ../src/backends)
- target_link_libraries(ModelAccuracyTool inferenceTest)
- target_link_libraries(ModelAccuracyTool armnn)
- target_link_libraries(ModelAccuracyTool armnnSerializer)
- AccuracyTool(ModelAccuracyTool)
-endif()
-
-if(BUILD_ARMNN_QUANTIZER)
- macro(ImageTensorExecutor executorName)
- target_link_libraries(${executorName} ${CMAKE_THREAD_LIBS_INIT})
- target_link_libraries(${executorName}
- ${Boost_SYSTEM_LIBRARY}
- ${Boost_FILESYSTEM_LIBRARY}
- ${Boost_PROGRAM_OPTIONS_LIBRARY})
- addDllCopyCommands(${executorName})
- endmacro()
-
- set(ImageTensorGenerator_sources
- InferenceTestImage.hpp
- InferenceTestImage.cpp
- ImageTensorGenerator/ImageTensorGenerator.cpp)
-
- add_executable_ex(ImageTensorGenerator ${ImageTensorGenerator_sources})
- target_include_directories(ImageTensorGenerator PRIVATE ../src/armnn)
- target_include_directories(ImageTensorGenerator PRIVATE ../src/armnnUtils)
-
- target_link_libraries(ImageTensorGenerator armnn)
- ImageTensorExecutor(ImageTensorGenerator)
-
- set(ImageCSVFileGenerator_sources
- ImageCSVFileGenerator/ImageCSVFileGenerator.cpp)
-
- add_executable_ex(ImageCSVFileGenerator ${ImageCSVFileGenerator_sources})
- ImageTensorExecutor(ImageCSVFileGenerator)
-endif()
diff --git a/tests/CaffeAlexNet-Armnn/CaffeAlexNet-Armnn.cpp b/tests/CaffeAlexNet-Armnn/CaffeAlexNet-Armnn.cpp
deleted file mode 100644
index e6e9a754f6..0000000000
--- a/tests/CaffeAlexNet-Armnn/CaffeAlexNet-Armnn.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../CaffePreprocessor.hpp"
-#include "armnnCaffeParser/ICaffeParser.hpp"
-
-int main(int argc, char* argv[])
-{
- int retVal = EXIT_FAILURE;
- try
- {
- using DataType = float;
- using DatabaseType = CaffePreprocessor;
- using ParserType = armnnCaffeParser::ICaffeParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>(
- argc, argv, "bvlc_alexnet_1.caffemodel", true, "data", "prob", { 0 },
- [](const char* dataDir, const ModelType &) {
- return DatabaseType(dataDir);
- });
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: CaffeAlexNet-Armnn: An error has occurred when running the "
- "classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/CaffeAlexNet-Armnn/Validation.txt b/tests/CaffeAlexNet-Armnn/Validation.txt
deleted file mode 100644
index cb95f050e2..0000000000
--- a/tests/CaffeAlexNet-Armnn/Validation.txt
+++ /dev/null
@@ -1,1000 +0,0 @@
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
diff --git a/tests/CaffeCifar10AcrossChannels-Armnn/CaffeCifar10AcrossChannels-Armnn.cpp b/tests/CaffeCifar10AcrossChannels-Armnn/CaffeCifar10AcrossChannels-Armnn.cpp
deleted file mode 100644
index d2b4ade1e0..0000000000
--- a/tests/CaffeCifar10AcrossChannels-Armnn/CaffeCifar10AcrossChannels-Armnn.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../Cifar10Database.hpp"
-#include "armnnCaffeParser/ICaffeParser.hpp"
-
-int main(int argc, char* argv[])
-{
- int retVal = EXIT_FAILURE;
- try
- {
- using DataType = float;
- using DatabaseType = Cifar10Database;
- using ParserType = armnnCaffeParser::ICaffeParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>(
- argc, argv, "cifar10_full_iter_60000.caffemodel", true, "data", "prob",
- { 0, 1, 2, 4, 7 },
- [](const char* dataDir, const ModelType&) {
- return DatabaseType(dataDir);
- });
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: CaffeCifar10AcrossChannels-Armnn: An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/CaffeCifar10AcrossChannels-Armnn/Validation.txt b/tests/CaffeCifar10AcrossChannels-Armnn/Validation.txt
deleted file mode 100644
index a7b59465eb..0000000000
--- a/tests/CaffeCifar10AcrossChannels-Armnn/Validation.txt
+++ /dev/null
@@ -1,1000 +0,0 @@
-3
-8
-8
-8
-6
-8
-5
-6
-3
-8
-0
-9
-5
-7
-9
-8
-5
-7
-8
-6
-7
-0
-8
-9
-4
-3
-3
-0
-9
-6
-6
-5
-8
-3
-9
-3
-7
-9
-9
-5
-0
-6
-7
-3
-0
-9
-3
-8
-7
-2
-9
-8
-5
-5
-8
-8
-7
-5
-5
-3
-7
-5
-2
-3
-6
-7
-8
-0
-3
-7
-0
-3
-8
-8
-0
-2
-0
-8
-5
-8
-8
-0
-1
-7
-3
-0
-3
-3
-8
-9
-0
-2
-8
-6
-7
-3
-6
-0
-0
-7
-8
-5
-6
-3
-1
-1
-3
-6
-8
-7
-5
-0
-2
-3
-0
-3
-0
-3
-7
-5
-8
-0
-1
-2
-8
-8
-8
-3
-6
-0
-4
-1
-8
-9
-1
-0
-9
-4
-2
-8
-3
-5
-6
-5
-8
-0
-6
-5
-5
-5
-8
-9
-5
-0
-0
-5
-0
-9
-5
-4
-0
-0
-0
-6
-0
-0
-8
-8
-5
-8
-9
-0
-8
-8
-9
-9
-3
-7
-5
-0
-0
-5
-2
-8
-0
-8
-5
-3
-3
-8
-5
-8
-0
-1
-7
-3
-8
-8
-7
-8
-5
-0
-8
-0
-1
-3
-8
-5
-7
-8
-7
-0
-5
-8
-8
-0
-7
-9
-8
-2
-7
-5
-8
-5
-5
-9
-8
-0
-3
-6
-5
-1
-7
-8
-8
-0
-4
-0
-5
-3
-1
-1
-8
-3
-0
-8
-1
-8
-2
-0
-5
-5
-9
-9
-2
-8
-3
-0
-8
-9
-8
-8
-3
-3
-0
-8
-8
-4
-7
-0
-0
-3
-6
-3
-8
-0
-0
-3
-2
-5
-9
-0
-6
-1
-0
-9
-8
-8
-7
-9
-8
-2
-6
-9
-3
-0
-6
-0
-0
-6
-6
-3
-3
-8
-8
-8
-8
-3
-1
-0
-8
-6
-0
-0
-8
-0
-7
-7
-5
-5
-3
-3
-2
-0
-5
-0
-7
-7
-3
-6
-1
-9
-3
-6
-6
-9
-3
-8
-0
-7
-0
-6
-2
-5
-8
-5
-7
-6
-8
-9
-9
-1
-8
-2
-3
-7
-5
-2
-8
-0
-9
-5
-8
-8
-9
-4
-0
-5
-8
-0
-0
-7
-9
-3
-2
-7
-3
-7
-8
-6
-6
-9
-0
-8
-5
-0
-7
-3
-5
-5
-1
-2
-6
-2
-3
-6
-2
-3
-0
-8
-9
-8
-7
-8
-8
-4
-0
-8
-8
-3
-5
-8
-3
-8
-1
-9
-0
-5
-5
-7
-4
-7
-8
-0
-0
-9
-3
-7
-0
-6
-3
-3
-8
-7
-3
-7
-8
-5
-3
-8
-1
-3
-9
-8
-8
-7
-3
-0
-0
-0
-2
-9
-7
-0
-8
-3
-4
-5
-3
-8
-5
-6
-8
-7
-3
-8
-4
-3
-7
-8
-5
-7
-8
-8
-3
-7
-4
-0
-5
-4
-3
-6
-0
-8
-5
-8
-9
-9
-8
-0
-0
-0
-0
-1
-8
-8
-0
-5
-2
-0
-4
-0
-5
-2
-9
-4
-7
-9
-0
-4
-5
-6
-8
-9
-5
-5
-8
-9
-3
-8
-5
-7
-0
-7
-0
-5
-0
-0
-0
-6
-8
-8
-9
-5
-6
-3
-6
-3
-9
-8
-1
-7
-0
-7
-5
-9
-0
-6
-5
-5
-3
-3
-8
-3
-9
-8
-6
-4
-3
-2
-0
-7
-6
-0
-2
-3
-9
-5
-8
-0
-6
-7
-8
-3
-6
-8
-8
-8
-7
-5
-4
-0
-8
-4
-0
-8
-3
-5
-8
-9
-6
-9
-2
-3
-0
-0
-7
-8
-8
-3
-8
-5
-0
-2
-1
-6
-3
-4
-3
-9
-6
-9
-8
-8
-5
-8
-6
-3
-2
-1
-7
-7
-1
-2
-7
-9
-9
-4
-4
-0
-8
-3
-2
-8
-7
-0
-8
-3
-0
-3
-3
-8
-0
-7
-9
-1
-8
-0
-4
-5
-3
-9
-3
-0
-8
-0
-1
-5
-4
-1
-8
-0
-7
-6
-3
-0
-9
-0
-8
-2
-6
-3
-2
-3
-0
-0
-3
-8
-0
-3
-9
-6
-8
-0
-9
-2
-8
-2
-3
-0
-3
-2
-2
-7
-8
-3
-8
-0
-7
-5
-7
-0
-4
-8
-7
-4
-8
-3
-8
-8
-6
-0
-8
-7
-4
-3
-3
-8
-4
-8
-7
-8
-8
-9
-8
-8
-1
-3
-3
-5
-5
-0
-7
-9
-8
-0
-8
-4
-1
-3
-5
-7
-8
-7
-8
-7
-4
-6
-2
-5
-8
-0
-8
-1
-2
-0
-6
-8
-2
-1
-3
-5
-6
-0
-1
-2
-0
-8
-3
-0
-5
-0
-6
-8
-0
-2
-7
-6
-0
-6
-9
-1
-7
-8
-7
-0
-3
-9
-7
-8
-0
-0
-3
-3
-7
-5
-4
-8
-8
-8
-7
-1
-2
-7
-4
-4
-8
-4
-7
-7
-3
-2
-7
-2
-0
-8
-8
-5
-8
-0
-8
-2
-0
-8
-7
-5
-0
-8
-5
-0
-0
-8
-2
-2
-2
-8
-9
-2
-7
-2
-7
-0
-7
-2
-1
-0
-0
-0
-8
-4
-7
-9
-8
-0
-0
-7
-7
-0
-7
-8
-4
-4
-3
-5
-0
-1
-3
-7
-0
-1
-8
-1
-4
-2
-3
-8
-4
-5
-0
-7
-8
-8
-3
-0
-8
-8
-8
-8
-8
-4
-3
-6
-7
-3
-1
-8
-3
-7
-7
-5
-5
-6
-6
-5
-8
-8
-1
-6
-8
-8
-3
-3
-3
-2
-0
-1
-8
-8
-8
-0
-0
-9
-9
-3
-3
-5
-8
-3
-0
-0
-4
-2
-3
-3
-7
-3
-0
-5
-8
-8
-9
-8
-5
-4
-8
-3
-0
-8
-7
-8
-3
-9
-2
-8
-4
-7
-8
-3
-7
-8
-8
-8
-8
-3
-6
-3
-3
-8
-1
-9
-9
-4
-6
-8
-0
-0
-0
-8
-8
-9
-2
-8
-8
-8
-7
-8
-3
-1
-7
-0
-1
-5
-8
-3
-3
-3
-8
-9
-3
-8
diff --git a/tests/CaffeInception_BN-Armnn/CaffeInception_BN-Armnn.cpp b/tests/CaffeInception_BN-Armnn/CaffeInception_BN-Armnn.cpp
deleted file mode 100644
index efb5823fae..0000000000
--- a/tests/CaffeInception_BN-Armnn/CaffeInception_BN-Armnn.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../CaffePreprocessor.hpp"
-#include "armnnCaffeParser/ICaffeParser.hpp"
-
-int main(int argc, char* argv[])
-{
- int retVal = EXIT_FAILURE;
- try
- {
- // Coverity fix: The following code may throw an exception of type std::length_error.
- std::vector<ImageSet> imageSet =
- {
- {"shark.jpg", 3694}
- };
-
- using DataType = float;
- using DatabaseType = CaffePreprocessor;
- using ParserType = armnnCaffeParser::ICaffeParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>(
- argc, argv, "Inception-BN-batchsize1.caffemodel", true,
- "data", "softmax", { 0 },
- [&imageSet](const char* dataDir, const ModelType&) {
- return DatabaseType(dataDir, 224, 224, imageSet);
- });
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: CaffeInception_BN-Armnn: An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/CaffeInception_BN-Armnn/Validation.txt b/tests/CaffeInception_BN-Armnn/Validation.txt
deleted file mode 100644
index f6040137d8..0000000000
--- a/tests/CaffeInception_BN-Armnn/Validation.txt
+++ /dev/null
@@ -1,1000 +0,0 @@
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
-3694
diff --git a/tests/CaffeMnist-Armnn/CaffeMnist-Armnn.cpp b/tests/CaffeMnist-Armnn/CaffeMnist-Armnn.cpp
deleted file mode 100644
index cf27d2cc6b..0000000000
--- a/tests/CaffeMnist-Armnn/CaffeMnist-Armnn.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../MnistDatabase.hpp"
-#include "armnnCaffeParser/ICaffeParser.hpp"
-
-int main(int argc, char* argv[])
-{
- int retVal = EXIT_FAILURE;
- try
- {
- using DataType = float;
- using DatabaseType = MnistDatabase;
- using ParserType = armnnCaffeParser::ICaffeParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>(
- argc, argv, "lenet_iter_9000.caffemodel", true, "data", "prob",
- { 0, 1, 5, 8, 9 },
- [](const char* dataDir, const ModelType&) {
- return DatabaseType(dataDir);
- });
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: CaffeMnist-Armnn: An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/CaffeMnist-Armnn/Validation.txt b/tests/CaffeMnist-Armnn/Validation.txt
deleted file mode 100644
index 63cbca6c56..0000000000
--- a/tests/CaffeMnist-Armnn/Validation.txt
+++ /dev/null
@@ -1,1000 +0,0 @@
-7
-2
-1
-0
-4
-1
-4
-9
-5
-9
-0
-6
-9
-0
-1
-5
-9
-7
-3
-4
-9
-6
-6
-5
-4
-0
-7
-4
-0
-1
-3
-1
-3
-4
-7
-2
-7
-1
-2
-1
-1
-7
-4
-2
-3
-5
-1
-2
-4
-4
-6
-3
-5
-5
-6
-0
-4
-1
-9
-5
-7
-8
-9
-3
-7
-4
-6
-4
-3
-0
-7
-0
-2
-9
-1
-7
-3
-2
-9
-7
-7
-6
-2
-7
-8
-4
-7
-3
-6
-1
-3
-6
-9
-3
-1
-4
-1
-7
-6
-9
-6
-0
-5
-4
-9
-9
-2
-1
-9
-4
-8
-7
-3
-9
-7
-9
-4
-4
-9
-2
-5
-4
-7
-6
-7
-9
-0
-5
-8
-5
-6
-6
-5
-7
-8
-1
-0
-1
-6
-4
-6
-7
-3
-1
-7
-1
-8
-2
-0
-2
-9
-9
-5
-5
-1
-5
-6
-0
-3
-4
-4
-6
-5
-4
-6
-5
-4
-5
-1
-4
-4
-7
-2
-3
-2
-7
-1
-8
-1
-8
-1
-8
-5
-0
-8
-9
-2
-5
-0
-1
-1
-1
-0
-9
-0
-3
-1
-6
-4
-2
-3
-6
-1
-1
-1
-3
-9
-5
-2
-9
-4
-5
-9
-3
-9
-0
-3
-6
-5
-5
-7
-2
-2
-7
-1
-2
-8
-4
-1
-7
-3
-3
-8
-8
-7
-9
-2
-2
-4
-1
-5
-9
-8
-7
-2
-3
-0
-4
-4
-2
-4
-1
-9
-5
-7
-7
-2
-8
-2
-6
-8
-5
-7
-7
-9
-1
-8
-1
-8
-0
-3
-0
-1
-9
-9
-4
-1
-8
-2
-1
-2
-9
-7
-5
-9
-2
-6
-4
-1
-5
-8
-2
-9
-2
-0
-4
-0
-0
-2
-8
-4
-7
-1
-2
-4
-0
-2
-7
-4
-3
-3
-0
-0
-3
-1
-9
-6
-5
-2
-5
-9
-2
-9
-3
-0
-4
-2
-0
-7
-1
-1
-2
-1
-5
-3
-3
-9
-7
-8
-6
-3
-6
-1
-3
-8
-1
-0
-5
-1
-3
-1
-5
-5
-6
-1
-8
-5
-1
-7
-9
-4
-6
-2
-2
-5
-0
-6
-5
-6
-3
-7
-2
-0
-8
-8
-5
-4
-1
-1
-4
-0
-3
-3
-7
-6
-1
-6
-2
-1
-9
-2
-8
-6
-1
-9
-5
-2
-5
-4
-4
-2
-8
-3
-8
-2
-4
-5
-0
-3
-1
-7
-7
-5
-7
-9
-7
-1
-9
-2
-1
-4
-2
-9
-2
-0
-4
-9
-1
-4
-8
-1
-8
-4
-5
-9
-8
-8
-3
-7
-6
-0
-0
-3
-0
-2
-0
-6
-4
-9
-5
-3
-3
-2
-3
-9
-1
-2
-6
-8
-0
-5
-6
-6
-6
-3
-8
-8
-2
-7
-5
-8
-9
-6
-1
-8
-4
-1
-2
-5
-9
-1
-9
-7
-5
-4
-0
-8
-9
-9
-1
-0
-5
-2
-3
-7
-8
-9
-4
-0
-6
-3
-9
-5
-2
-1
-3
-1
-3
-6
-5
-7
-4
-2
-2
-6
-3
-2
-6
-5
-4
-8
-9
-7
-1
-3
-0
-3
-8
-3
-1
-9
-3
-4
-4
-6
-4
-2
-1
-8
-2
-5
-4
-8
-8
-4
-0
-0
-2
-3
-2
-7
-3
-0
-8
-7
-4
-4
-7
-9
-6
-9
-0
-9
-8
-0
-4
-6
-0
-6
-3
-5
-4
-8
-3
-3
-9
-3
-3
-3
-7
-8
-0
-2
-2
-1
-7
-0
-6
-5
-4
-3
-8
-0
-9
-6
-3
-8
-0
-9
-9
-6
-8
-6
-8
-5
-7
-8
-6
-0
-2
-4
-0
-2
-2
-3
-1
-9
-7
-5
-8
-0
-8
-4
-6
-2
-6
-7
-9
-3
-2
-9
-8
-2
-2
-9
-2
-7
-3
-5
-9
-1
-8
-0
-2
-0
-5
-2
-1
-3
-7
-6
-7
-1
-2
-5
-8
-0
-3
-7
-1
-4
-0
-9
-1
-8
-6
-7
-7
-4
-3
-4
-9
-1
-9
-5
-1
-7
-3
-9
-7
-6
-9
-1
-3
-3
-8
-3
-3
-6
-7
-2
-8
-5
-8
-5
-1
-1
-4
-4
-3
-1
-0
-7
-7
-0
-7
-9
-4
-4
-8
-5
-5
-4
-0
-8
-2
-7
-0
-8
-4
-8
-0
-4
-0
-6
-1
-7
-3
-2
-6
-7
-2
-6
-9
-3
-1
-4
-6
-2
-5
-4
-2
-0
-6
-2
-1
-7
-3
-4
-1
-0
-5
-4
-3
-1
-1
-7
-4
-9
-9
-4
-8
-4
-0
-2
-4
-5
-1
-1
-6
-4
-7
-1
-9
-4
-2
-4
-1
-5
-5
-3
-8
-3
-1
-4
-5
-6
-8
-9
-4
-1
-5
-3
-8
-0
-3
-2
-5
-1
-2
-8
-3
-4
-4
-0
-8
-8
-3
-3
-1
-7
-3
-5
-9
-6
-3
-2
-6
-1
-3
-6
-0
-7
-2
-1
-7
-1
-4
-2
-4
-2
-1
-7
-9
-6
-1
-1
-2
-4
-8
-1
-7
-7
-4
-8
-0
-9
-3
-1
-3
-1
-0
-7
-7
-0
-3
-5
-5
-2
-7
-6
-6
-9
-2
-8
-3
-5
-2
-2
-5
-6
-0
-8
-2
-9
-2
-8
-8
-8
-8
-7
-4
-9
-3
-0
-6
-6
-3
-2
-1
-3
-2
-2
-9
-3
-0
-0
-5
-7
-8
-3
-4
-4
-6
-0
-2
-9
-1
-4
-7
-4
-7
-3
-9
-8
-8
-4
-7
-1
-2
-1
-2
-2
-3
-2
-3
-2
-3
-9
-1
-7
-4
-0
-3
-5
-5
-8
-6
-3
-2
-6
-7
-6
-6
-3
-2
-7
-9
-1
-1
-7
-5
-6
-4
-9
-5
-1
-3
-3
-4
-7
-8
-9
-1
-1
-6
-9
-1
-4
-4
-5
-4
-0
-6
-2
-2
-3
-1
-5
-1
-2
-0
-3
-8
-1
-2
-6
-7
-1
-6
-2
-3
-9
-0
-1
-2
-2
-0
-8
-9
diff --git a/tests/CaffePreprocessor.cpp b/tests/CaffePreprocessor.cpp
deleted file mode 100644
index 6adc75dc64..0000000000
--- a/tests/CaffePreprocessor.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "InferenceTestImage.hpp"
-#include "CaffePreprocessor.hpp"
-
-#include <boost/numeric/conversion/cast.hpp>
-#include <boost/assert.hpp>
-#include <boost/format.hpp>
-
-#include <iostream>
-#include <fcntl.h>
-#include <array>
-
-const std::vector<ImageSet> g_DefaultImageSet =
-{
- {"shark.jpg", 2}
-};
-
-CaffePreprocessor::CaffePreprocessor(const std::string& binaryFileDirectory, unsigned int width, unsigned int height,
- const std::vector<ImageSet>& imageSet)
-: m_BinaryDirectory(binaryFileDirectory)
-, m_Height(height)
-, m_Width(width)
-, m_ImageSet(imageSet.empty() ? g_DefaultImageSet : imageSet)
-{
-}
-
-std::unique_ptr<CaffePreprocessor::TTestCaseData> CaffePreprocessor::GetTestCaseData(unsigned int testCaseId)
-{
- testCaseId = testCaseId % boost::numeric_cast<unsigned int>(m_ImageSet.size());
- const ImageSet& imageSet = m_ImageSet[testCaseId];
- const std::string fullPath = m_BinaryDirectory + imageSet.first;
-
- InferenceTestImage image(fullPath.c_str());
- image.Resize(m_Width, m_Height, CHECK_LOCATION());
-
- // The model expects image data in BGR format.
- std::vector<float> inputImageData = GetImageDataInArmNnLayoutAsFloatsSubtractingMean(ImageChannelLayout::Bgr,
- image, m_MeanBgr);
-
- // List of labels: https://gist.github.com/yrevar/942d3a0ac09ec9e5eb3a
- const unsigned int label = imageSet.second;
- return std::make_unique<TTestCaseData>(label, std::move(inputImageData));
-}
diff --git a/tests/CaffePreprocessor.hpp b/tests/CaffePreprocessor.hpp
deleted file mode 100644
index 5647bff6b0..0000000000
--- a/tests/CaffePreprocessor.hpp
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#pragma once
-
-#include "ClassifierTestCaseData.hpp"
-
-#include <array>
-#include <string>
-#include <vector>
-#include <memory>
-
-/// Caffe requires BGR images, not normalized, mean adjusted and resized using smooth resize of STB library
-
-using ImageSet = std::pair<const std::string, unsigned int>;
-
-class CaffePreprocessor
-{
-public:
- using DataType = float;
- using TTestCaseData = ClassifierTestCaseData<DataType>;
-
- explicit CaffePreprocessor(const std::string& binaryFileDirectory,
- unsigned int width = 227,
- unsigned int height = 227,
- const std::vector<ImageSet>& imageSet = std::vector<ImageSet>());
- std::unique_ptr<TTestCaseData> GetTestCaseData(unsigned int testCaseId);
-
-private:
- unsigned int GetNumImageElements() const { return 3 * m_Width * m_Height; }
- unsigned int GetNumImageBytes() const { return 4 * GetNumImageElements(); }
-
- std::string m_BinaryDirectory;
- unsigned int m_Height;
- unsigned int m_Width;
- // Mean value of the database [B, G, R].
- const std::array<float, 3> m_MeanBgr = {{104.007965f, 116.669472f, 122.675102f}};
- const std::vector<ImageSet> m_ImageSet;
-};
diff --git a/tests/CaffeResNet-Armnn/CaffeResNet-Armnn.cpp b/tests/CaffeResNet-Armnn/CaffeResNet-Armnn.cpp
deleted file mode 100644
index 542a81e010..0000000000
--- a/tests/CaffeResNet-Armnn/CaffeResNet-Armnn.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../CaffePreprocessor.hpp"
-#include "armnnCaffeParser/ICaffeParser.hpp"
-
-int main(int argc, char* argv[])
-{
- int retVal = EXIT_FAILURE;
- try
- {
- // Coverity fix: The following code may throw an exception of type std::length_error.
- std::vector<ImageSet> imageSet =
- {
- {"ILSVRC2012_val_00000018.JPEG", 21 },
- {"shark.jpg", 2}
- };
-
- armnn::TensorShape inputTensorShape({ 1, 3, 224, 224 });
-
- using DataType = float;
- using DatabaseType = CaffePreprocessor;
- using ParserType = armnnCaffeParser::ICaffeParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>(
- argc, argv, "ResNet_50_ilsvrc15_model.caffemodel", true,
- "data", "prob", { 0, 1 },
- [&imageSet](const char* dataDir, const ModelType&) {
- return DatabaseType(dataDir, 224, 224, imageSet);
- }, &inputTensorShape);
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: CaffeResNet-Armnn: An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/CaffeResNet-Armnn/Validation.txt b/tests/CaffeResNet-Armnn/Validation.txt
deleted file mode 100644
index b3c5de80b7..0000000000
--- a/tests/CaffeResNet-Armnn/Validation.txt
+++ /dev/null
@@ -1,2000 +0,0 @@
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
-21
-2
diff --git a/tests/CaffeSqueezeNet1_0-Armnn/CaffeSqueezeNet1_0-Armnn.cpp b/tests/CaffeSqueezeNet1_0-Armnn/CaffeSqueezeNet1_0-Armnn.cpp
deleted file mode 100644
index f4c16fec3e..0000000000
--- a/tests/CaffeSqueezeNet1_0-Armnn/CaffeSqueezeNet1_0-Armnn.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../CaffePreprocessor.hpp"
-#include "armnnCaffeParser/ICaffeParser.hpp"
-
-int main(int argc, char* argv[])
-{
- using DataType = float;
- using DatabaseType = CaffePreprocessor;
- using ParserType = armnnCaffeParser::ICaffeParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- return armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>(
- argc, argv, "squeezenet.caffemodel", true,
- "input", "prob", { 0 },
- [](const char* dataDir, const ModelType &) { return CaffePreprocessor(dataDir); });
-}
diff --git a/tests/CaffeVGG-Armnn/CaffeVGG-Armnn.cpp b/tests/CaffeVGG-Armnn/CaffeVGG-Armnn.cpp
deleted file mode 100644
index 20ff2be0bc..0000000000
--- a/tests/CaffeVGG-Armnn/CaffeVGG-Armnn.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../CaffePreprocessor.hpp"
-#include "armnnCaffeParser/ICaffeParser.hpp"
-
-int main(int argc, char* argv[])
-{
- armnn::TensorShape inputTensorShape({ 1, 3, 224, 224 });
- int retVal = EXIT_FAILURE;
- try
- {
- using DataType = float;
- using DatabaseType = CaffePreprocessor;
- using ParserType = armnnCaffeParser::ICaffeParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>(
- argc, argv, "VGG_CNN_S.caffemodel", true,
- "input", "prob", { 0 },
- [](const char* dataDir, const ModelType&) {
- return DatabaseType(dataDir, 224, 224);
- }, &inputTensorShape);
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: CaffeVGG-Armnn: An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/CaffeVGG-Armnn/Validation.txt b/tests/CaffeVGG-Armnn/Validation.txt
deleted file mode 100644
index cb95f050e2..0000000000
--- a/tests/CaffeVGG-Armnn/Validation.txt
+++ /dev/null
@@ -1,1000 +0,0 @@
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
diff --git a/tests/CaffeYolo-Armnn/CaffeYolo-Armnn.cpp b/tests/CaffeYolo-Armnn/CaffeYolo-Armnn.cpp
deleted file mode 100644
index d563faaab2..0000000000
--- a/tests/CaffeYolo-Armnn/CaffeYolo-Armnn.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../YoloInferenceTest.hpp"
-#include "armnnCaffeParser/ICaffeParser.hpp"
-#include "armnn/TypesUtils.hpp"
-
-int main(int argc, char* argv[])
-{
- armnn::TensorShape inputTensorShape{ { 1, 3, YoloImageHeight, YoloImageWidth } };
-
- using YoloInferenceModel = InferenceModel<armnnCaffeParser::ICaffeParser,
- float>;
-
- int retVal = EXIT_FAILURE;
- try
- {
- // Coverity fix: InferenceTestMain() may throw uncaught exceptions.
- retVal = InferenceTestMain(argc, argv, { 0 },
- [&inputTensorShape]()
- {
- return make_unique<YoloTestCaseProvider<YoloInferenceModel>>(
- [&]
- (const InferenceTestOptions &commonOptions,
- typename YoloInferenceModel::CommandLineOptions modelOptions)
- {
- if (!ValidateDirectory(modelOptions.m_ModelDir))
- {
- return std::unique_ptr<YoloInferenceModel>();
- }
-
- typename YoloInferenceModel::Params modelParams;
- modelParams.m_ModelPath = modelOptions.m_ModelDir + "yolov1_tiny_voc2007_model.caffemodel";
- modelParams.m_InputBindings = { "data" };
- modelParams.m_OutputBindings = { "fc12" };
- modelParams.m_InputShapes = { inputTensorShape };
- modelParams.m_IsModelBinary = true;
- modelParams.m_ComputeDevices = modelOptions.GetComputeDevicesAsBackendIds();
- modelParams.m_VisualizePostOptimizationModel = modelOptions.m_VisualizePostOptimizationModel;
- modelParams.m_EnableFp16TurboMode = modelOptions.m_EnableFp16TurboMode;
-
- return std::make_unique<YoloInferenceModel>(modelParams,
- commonOptions.m_EnableProfiling,
- commonOptions.m_DynamicBackendsPath);
- });
- });
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: CaffeYolo-Armnn: An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/Cifar10Database.cpp b/tests/Cifar10Database.cpp
deleted file mode 100644
index b0a90592d2..0000000000
--- a/tests/Cifar10Database.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "Cifar10Database.hpp"
-
-#include <armnn/Logging.hpp>
-
-#include <boost/numeric/conversion/cast.hpp>
-#include <fstream>
-#include <vector>
-
-constexpr unsigned int g_kCifar10ImageByteSize = 1 + 3 * 32 * 32;
-
-Cifar10Database::Cifar10Database(const std::string& binaryFileDirectory, bool rgbPack)
- : m_BinaryDirectory(binaryFileDirectory), m_RgbPack(rgbPack)
-{
-}
-
-std::unique_ptr<Cifar10Database::TTestCaseData> Cifar10Database::GetTestCaseData(unsigned int testCaseId)
-{
- std::vector<unsigned char> I(g_kCifar10ImageByteSize);
-
- std::string fullpath = m_BinaryDirectory + std::string("test_batch.bin");
-
- std::ifstream fileStream(fullpath, std::ios::binary);
- if (!fileStream.is_open())
- {
- ARMNN_LOG(fatal) << "Failed to load " << fullpath;
- return nullptr;
- }
-
- fileStream.seekg(testCaseId * g_kCifar10ImageByteSize, std::ios_base::beg);
- fileStream.read(reinterpret_cast<char*>(&I[0]), g_kCifar10ImageByteSize);
-
- if (!fileStream.good())
- {
- ARMNN_LOG(fatal) << "Failed to read " << fullpath;
- return nullptr;
- }
-
-
- std::vector<float> inputImageData;
- inputImageData.resize(g_kCifar10ImageByteSize - 1);
-
- unsigned int step;
- unsigned int countR_o;
- unsigned int countG_o;
- unsigned int countB_o;
- unsigned int countR = 1;
- unsigned int countG = 1 + 32 * 32;
- unsigned int countB = 1 + 2 * 32 * 32;
-
- if (m_RgbPack)
- {
- countR_o = 0;
- countG_o = 1;
- countB_o = 2;
- step = 3;
- }
- else
- {
- countR_o = 0;
- countG_o = 32 * 32;
- countB_o = 2 * 32 * 32;
- step = 1;
- }
-
- for (unsigned int h = 0; h < 32; h++)
- {
- for (unsigned int w = 0; w < 32; w++)
- {
- inputImageData[countR_o] = boost::numeric_cast<float>(I[countR++]);
- inputImageData[countG_o] = boost::numeric_cast<float>(I[countG++]);
- inputImageData[countB_o] = boost::numeric_cast<float>(I[countB++]);
-
- countR_o += step;
- countG_o += step;
- countB_o += step;
- }
- }
-
- const unsigned int label = boost::numeric_cast<unsigned int>(I[0]);
- return std::make_unique<TTestCaseData>(label, std::move(inputImageData));
-}
diff --git a/tests/Cifar10Database.hpp b/tests/Cifar10Database.hpp
deleted file mode 100644
index f0c98f3a06..0000000000
--- a/tests/Cifar10Database.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#pragma once
-
-#include "ClassifierTestCaseData.hpp"
-
-#include <string>
-#include <memory>
-
-class Cifar10Database
-{
-public:
- using DataType = float;
- using TTestCaseData = ClassifierTestCaseData<DataType>;
-
- explicit Cifar10Database(const std::string& binaryFileDirectory, bool rgbPack = false);
- std::unique_ptr<TTestCaseData> GetTestCaseData(unsigned int testCaseId);
-
-private:
- std::string m_BinaryDirectory;
- bool m_RgbPack;
-};
diff --git a/tests/ClassifierTestCaseData.hpp b/tests/ClassifierTestCaseData.hpp
deleted file mode 100644
index a86ab61c7f..0000000000
--- a/tests/ClassifierTestCaseData.hpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#pragma once
-
-#include <vector>
-
-template <typename DataType>
-class ClassifierTestCaseData
-{
-public:
- ClassifierTestCaseData(unsigned int label, std::vector<DataType> inputImage)
- : m_Label(label)
- , m_InputImage(std::move(inputImage))
- {
- }
-
- const unsigned int m_Label;
- std::vector<DataType> m_InputImage;
-};
diff --git a/tests/DeepSpeechV1Database.hpp b/tests/DeepSpeechV1Database.hpp
deleted file mode 100644
index 81523775db..0000000000
--- a/tests/DeepSpeechV1Database.hpp
+++ /dev/null
@@ -1,202 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#pragma once
-
-#include "LstmCommon.hpp"
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <armnn/TypesUtils.hpp>
-
-#include <boost/numeric/conversion/cast.hpp>
-
-#include <array>
-#include <string>
-
-#include "InferenceTestImage.hpp"
-
-namespace
-{
-
-template<typename T, typename TParseElementFunc>
-std::vector<T> ParseArrayImpl(std::istream& stream, TParseElementFunc parseElementFunc, const char * chars = "\t ,:")
-{
- std::vector<T> result;
- // Processes line-by-line.
- std::string line;
- while (std::getline(stream, line))
- {
- std::vector<std::string> tokens;
- try
- {
- // Coverity fix: boost::split() may throw an exception of type boost::bad_function_call.
- boost::split(tokens, line, boost::algorithm::is_any_of(chars), boost::token_compress_on);
- }
- catch (const std::exception& e)
- {
- ARMNN_LOG(error) << "An error occurred when splitting tokens: " << e.what();
- continue;
- }
- for (const std::string& token : tokens)
- {
- if (!token.empty()) // See https://stackoverflow.com/questions/10437406/
- {
- try
- {
- result.push_back(parseElementFunc(token));
- }
- catch (const std::exception&)
- {
- ARMNN_LOG(error) << "'" << token << "' is not a valid number. It has been ignored.";
- }
- }
- }
- }
-
- return result;
-}
-
-template<armnn::DataType NonQuantizedType>
-auto ParseDataArray(std::istream & stream);
-
-template<armnn::DataType QuantizedType>
-auto ParseDataArray(std::istream& stream,
- const float& quantizationScale,
- const int32_t& quantizationOffset);
-
-// NOTE: declaring the template specialisations inline to prevent them
-// being flagged as unused functions when -Werror=unused-function is in effect
-template<>
-inline auto ParseDataArray<armnn::DataType::Float32>(std::istream & stream)
-{
- return ParseArrayImpl<float>(stream, [](const std::string& s) { return std::stof(s); });
-}
-
-template<>
-inline auto ParseDataArray<armnn::DataType::Signed32>(std::istream & stream)
-{
- return ParseArrayImpl<int>(stream, [](const std::string & s) { return std::stoi(s); });
-}
-
-template<>
-inline auto ParseDataArray<armnn::DataType::QAsymmU8>(std::istream& stream,
- const float& quantizationScale,
- const int32_t& quantizationOffset)
-{
- return ParseArrayImpl<uint8_t>(stream,
- [&quantizationScale, &quantizationOffset](const std::string & s)
- {
- return boost::numeric_cast<uint8_t>(
- armnn::Quantize<u_int8_t>(std::stof(s),
- quantizationScale,
- quantizationOffset));
- });
-}
-
-struct DeepSpeechV1TestCaseData
-{
- DeepSpeechV1TestCaseData(
- const LstmInput& inputData,
- const LstmInput& expectedOutputData)
- : m_InputData(inputData)
- , m_ExpectedOutputData(expectedOutputData)
- {}
-
- LstmInput m_InputData;
- LstmInput m_ExpectedOutputData;
-};
-
-class DeepSpeechV1Database
-{
-public:
- explicit DeepSpeechV1Database(const std::string& inputSeqDir, const std::string& prevStateHDir,
- const std::string& prevStateCDir, const std::string& logitsDir,
- const std::string& newStateHDir, const std::string& newStateCDir);
-
- std::unique_ptr<DeepSpeechV1TestCaseData> GetTestCaseData(unsigned int testCaseId);
-
-private:
- std::string m_InputSeqDir;
- std::string m_PrevStateHDir;
- std::string m_PrevStateCDir;
- std::string m_LogitsDir;
- std::string m_NewStateHDir;
- std::string m_NewStateCDir;
-};
-
-DeepSpeechV1Database::DeepSpeechV1Database(const std::string& inputSeqDir, const std::string& prevStateHDir,
- const std::string& prevStateCDir, const std::string& logitsDir,
- const std::string& newStateHDir, const std::string& newStateCDir)
- : m_InputSeqDir(inputSeqDir)
- , m_PrevStateHDir(prevStateHDir)
- , m_PrevStateCDir(prevStateCDir)
- , m_LogitsDir(logitsDir)
- , m_NewStateHDir(newStateHDir)
- , m_NewStateCDir(newStateCDir)
-{}
-
-std::unique_ptr<DeepSpeechV1TestCaseData> DeepSpeechV1Database::GetTestCaseData(unsigned int testCaseId)
-{
- // Load test case input
- const std::string inputSeqPath = m_InputSeqDir + "input_node_0_flat.txt";
- const std::string prevStateCPath = m_PrevStateCDir + "previous_state_c_0.txt";
- const std::string prevStateHPath = m_PrevStateHDir + "previous_state_h_0.txt";
-
- std::vector<float> inputSeqData;
- std::vector<float> prevStateCData;
- std::vector<float> prevStateHData;
-
- std::ifstream inputSeqFile(inputSeqPath);
- std::ifstream prevStateCTensorFile(prevStateCPath);
- std::ifstream prevStateHTensorFile(prevStateHPath);
-
- try
- {
- inputSeqData = ParseDataArray<armnn::DataType::Float32>(inputSeqFile);
- prevStateCData = ParseDataArray<armnn::DataType::Float32>(prevStateCTensorFile);
- prevStateHData = ParseDataArray<armnn::DataType::Float32>(prevStateHTensorFile);
- }
- catch (const InferenceTestImageException& e)
- {
- ARMNN_LOG(fatal) << "Failed to load image for test case " << testCaseId << ". Error: " << e.what();
- return nullptr;
- }
-
- // Prepare test case expected output
- const std::string logitsPath = m_LogitsDir + "logits.txt";
- const std::string newStateCPath = m_NewStateCDir + "new_state_c.txt";
- const std::string newStateHPath = m_NewStateHDir + "new_state_h.txt";
-
- std::vector<float> logitsData;
- std::vector<float> expectedNewStateCData;
- std::vector<float> expectedNewStateHData;
-
- std::ifstream logitsTensorFile(logitsPath);
- std::ifstream newStateCTensorFile(newStateCPath);
- std::ifstream newStateHTensorFile(newStateHPath);
-
- try
- {
- logitsData = ParseDataArray<armnn::DataType::Float32>(logitsTensorFile);
- expectedNewStateCData = ParseDataArray<armnn::DataType::Float32>(newStateCTensorFile);
- expectedNewStateHData = ParseDataArray<armnn::DataType::Float32>(newStateHTensorFile);
- }
- catch (const InferenceTestImageException& e)
- {
- ARMNN_LOG(fatal) << "Failed to load image for test case " << testCaseId << ". Error: " << e.what();
- return nullptr;
- }
-
- // use the struct for representing input and output data
- LstmInput inputDataSingleTest(inputSeqData, prevStateHData, prevStateCData);
-
- LstmInput expectedOutputsSingleTest(logitsData, expectedNewStateHData, expectedNewStateCData);
-
- return std::make_unique<DeepSpeechV1TestCaseData>(inputDataSingleTest, expectedOutputsSingleTest);
-}
-
-} // anonymous namespace
diff --git a/tests/DeepSpeechV1InferenceTest.hpp b/tests/DeepSpeechV1InferenceTest.hpp
deleted file mode 100644
index ac28bbbcd4..0000000000
--- a/tests/DeepSpeechV1InferenceTest.hpp
+++ /dev/null
@@ -1,204 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#pragma once
-
-#include "InferenceTest.hpp"
-#include "DeepSpeechV1Database.hpp"
-
-#include <boost/assert.hpp>
-#include <boost/core/ignore_unused.hpp>
-#include <boost/numeric/conversion/cast.hpp>
-#include <boost/test/tools/floating_point_comparison.hpp>
-
-#include <vector>
-
-namespace
-{
-
-template<typename Model>
-class DeepSpeechV1TestCase : public InferenceModelTestCase<Model>
-{
-public:
- DeepSpeechV1TestCase(Model& model,
- unsigned int testCaseId,
- const DeepSpeechV1TestCaseData& testCaseData)
- : InferenceModelTestCase<Model>(model,
- testCaseId,
- { testCaseData.m_InputData.m_InputSeq,
- testCaseData.m_InputData.m_StateH,
- testCaseData.m_InputData.m_StateC},
- { k_OutputSize1, k_OutputSize2, k_OutputSize3 })
- , m_FloatComparer(boost::math::fpc::percent_tolerance(1.0f))
- , m_ExpectedOutputs({testCaseData.m_ExpectedOutputData.m_InputSeq, testCaseData.m_ExpectedOutputData.m_StateH,
- testCaseData.m_ExpectedOutputData.m_StateC})
- {}
-
- TestCaseResult ProcessResult(const InferenceTestOptions& options) override
- {
- boost::ignore_unused(options);
- const std::vector<float>& output1 = boost::get<std::vector<float>>(this->GetOutputs()[0]); // logits
- BOOST_ASSERT(output1.size() == k_OutputSize1);
-
- const std::vector<float>& output2 = boost::get<std::vector<float>>(this->GetOutputs()[1]); // new_state_c
- BOOST_ASSERT(output2.size() == k_OutputSize2);
-
- const std::vector<float>& output3 = boost::get<std::vector<float>>(this->GetOutputs()[2]); // new_state_h
- BOOST_ASSERT(output3.size() == k_OutputSize3);
-
- // Check each output to see whether it is the expected value
- for (unsigned int j = 0u; j < output1.size(); j++)
- {
- if(!m_FloatComparer(output1[j], m_ExpectedOutputs.m_InputSeq[j]))
- {
- ARMNN_LOG(error) << "InputSeq for Lstm " << this->GetTestCaseId() <<
- " is incorrect at" << j;
- return TestCaseResult::Failed;
- }
- }
-
- for (unsigned int j = 0u; j < output2.size(); j++)
- {
- if(!m_FloatComparer(output2[j], m_ExpectedOutputs.m_StateH[j]))
- {
- ARMNN_LOG(error) << "StateH for Lstm " << this->GetTestCaseId() <<
- " is incorrect";
- return TestCaseResult::Failed;
- }
- }
-
- for (unsigned int j = 0u; j < output3.size(); j++)
- {
- if(!m_FloatComparer(output3[j], m_ExpectedOutputs.m_StateC[j]))
- {
- ARMNN_LOG(error) << "StateC for Lstm " << this->GetTestCaseId() <<
- " is incorrect";
- return TestCaseResult::Failed;
- }
- }
- return TestCaseResult::Ok;
- }
-
-private:
-
- static constexpr unsigned int k_OutputSize1 = 464u;
- static constexpr unsigned int k_OutputSize2 = 2048u;
- static constexpr unsigned int k_OutputSize3 = 2048u;
-
- boost::math::fpc::close_at_tolerance<float> m_FloatComparer;
- LstmInput m_ExpectedOutputs;
-};
-
-template <typename Model>
-class DeepSpeechV1TestCaseProvider : public IInferenceTestCaseProvider
-{
-public:
- template <typename TConstructModelCallable>
- explicit DeepSpeechV1TestCaseProvider(TConstructModelCallable constructModel)
- : m_ConstructModel(constructModel)
- {}
-
- virtual void AddCommandLineOptions(boost::program_options::options_description& options) override
- {
- namespace po = boost::program_options;
-
- options.add_options()
- ("input-seq-dir,s", po::value<std::string>(&m_InputSeqDir)->required(),
- "Path to directory containing test data for m_InputSeq");
- options.add_options()
- ("prev-state-h-dir,h", po::value<std::string>(&m_PrevStateHDir)->required(),
- "Path to directory containing test data for m_PrevStateH");
- options.add_options()
- ("prev-state-c-dir,c", po::value<std::string>(&m_PrevStateCDir)->required(),
- "Path to directory containing test data for m_PrevStateC");
- options.add_options()
- ("logits-dir,l", po::value<std::string>(&m_LogitsDir)->required(),
- "Path to directory containing test data for m_Logits");
- options.add_options()
- ("new-state-h-dir,H", po::value<std::string>(&m_NewStateHDir)->required(),
- "Path to directory containing test data for m_NewStateH");
- options.add_options()
- ("new-state-c-dir,C", po::value<std::string>(&m_NewStateCDir)->required(),
- "Path to directory containing test data for m_NewStateC");
-
-
- Model::AddCommandLineOptions(options, m_ModelCommandLineOptions);
- }
-
- virtual bool ProcessCommandLineOptions(const InferenceTestOptions &commonOptions) override
- {
- if (!ValidateDirectory(m_InputSeqDir))
- {
- return false;
- }
-
- if (!ValidateDirectory(m_PrevStateCDir))
- {
- return false;
- }
-
- if (!ValidateDirectory(m_PrevStateHDir))
- {
- return false;
- }
-
- if (!ValidateDirectory(m_LogitsDir))
- {
- return false;
- }
-
- if (!ValidateDirectory(m_NewStateCDir))
- {
- return false;
- }
-
- if (!ValidateDirectory(m_NewStateHDir))
- {
- return false;
- }
-
- m_Model = m_ConstructModel(commonOptions, m_ModelCommandLineOptions);
- if (!m_Model)
- {
- return false;
- }
- m_Database = std::make_unique<DeepSpeechV1Database>(m_InputSeqDir.c_str(), m_PrevStateHDir.c_str(),
- m_PrevStateCDir.c_str(), m_LogitsDir.c_str(),
- m_NewStateHDir.c_str(), m_NewStateCDir.c_str());
- if (!m_Database)
- {
- return false;
- }
-
- return true;
- }
-
- std::unique_ptr<IInferenceTestCase> GetTestCase(unsigned int testCaseId) override
- {
- std::unique_ptr<DeepSpeechV1TestCaseData> testCaseData = m_Database->GetTestCaseData(testCaseId);
- if (!testCaseData)
- {
- return nullptr;
- }
-
- return std::make_unique<DeepSpeechV1TestCase<Model>>(*m_Model, testCaseId, *testCaseData);
- }
-
-private:
- typename Model::CommandLineOptions m_ModelCommandLineOptions;
- std::function<std::unique_ptr<Model>(const InferenceTestOptions&,
- typename Model::CommandLineOptions)> m_ConstructModel;
- std::unique_ptr<Model> m_Model;
-
- std::string m_InputSeqDir;
- std::string m_PrevStateCDir;
- std::string m_PrevStateHDir;
- std::string m_LogitsDir;
- std::string m_NewStateCDir;
- std::string m_NewStateHDir;
-
- std::unique_ptr<DeepSpeechV1Database> m_Database;
-};
-
-} // anonymous namespace
diff --git a/tests/ExecuteNetwork/ExecuteNetwork.cpp b/tests/ExecuteNetwork/ExecuteNetwork.cpp
deleted file mode 100644
index 55864c8e02..0000000000
--- a/tests/ExecuteNetwork/ExecuteNetwork.cpp
+++ /dev/null
@@ -1,276 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "../NetworkExecutionUtils/NetworkExecutionUtils.hpp"
-
-// MAIN
-int main(int argc, const char* argv[])
-{
- // Configures logging for both the ARMNN library and this test program.
-#ifdef NDEBUG
- armnn::LogSeverity level = armnn::LogSeverity::Info;
-#else
- armnn::LogSeverity level = armnn::LogSeverity::Debug;
-#endif
- armnn::ConfigureLogging(true, true, level);
-
- std::string testCasesFile;
-
- std::string modelFormat;
- std::string modelPath;
- std::string inputNames;
- std::string inputTensorShapes;
- std::string inputTensorDataFilePaths;
- std::string outputNames;
- std::string inputTypes;
- std::string outputTypes;
- std::string dynamicBackendsPath;
- std::string outputTensorFiles;
-
- // external profiling parameters
- std::string outgoingCaptureFile;
- std::string incomingCaptureFile;
- uint32_t counterCapturePeriod;
-
- double thresholdTime = 0.0;
-
- size_t subgraphId = 0;
-
- const std::string backendsMessage = "REQUIRED: Which device to run layers on by default. Possible choices: "
- + armnn::BackendRegistryInstance().GetBackendIdsAsString();
- po::options_description desc("Options");
- try
- {
- desc.add_options()
- ("help", "Display usage information")
- ("compute,c", po::value<std::vector<std::string>>()->multitoken()->required(),
- backendsMessage.c_str())
- ("test-cases,t", po::value(&testCasesFile), "Path to a CSV file containing test cases to run. "
- "If set, further parameters -- with the exception of compute device and concurrency -- will be ignored, "
- "as they are expected to be defined in the file for each test in particular.")
- ("concurrent,n", po::bool_switch()->default_value(false),
- "Whether or not the test cases should be executed in parallel")
- ("model-format,f", po::value(&modelFormat)->required(),
- "armnn-binary, caffe-binary, caffe-text, onnx-binary, onnx-text, tflite-binary, tensorflow-binary or "
- "tensorflow-text.")
- ("model-path,m", po::value(&modelPath)->required(), "Path to model file, e.g. .armnn, .caffemodel, "
- ".prototxt, .tflite, .onnx")
- ("dynamic-backends-path,b", po::value(&dynamicBackendsPath),
- "Path where to load any available dynamic backend from. "
- "If left empty (the default), dynamic backends will not be used.")
- ("input-name,i", po::value(&inputNames),
- "Identifier of the input tensors in the network separated by comma.")
- ("subgraph-number,x", po::value<size_t>(&subgraphId)->default_value(0), "Id of the subgraph to be executed."
- "Defaults to 0")
- ("input-tensor-shape,s", po::value(&inputTensorShapes),
- "The shape of the input tensors in the network as a flat array of integers separated by comma."
- "Several shapes can be passed by separating them with a colon (:)."
- "This parameter is optional, depending on the network.")
- ("input-tensor-data,d", po::value(&inputTensorDataFilePaths)->default_value(""),
- "Path to files containing the input data as a flat array separated by whitespace. "
- "Several paths can be passed by separating them with a comma. If not specified, the network will be run "
- "with dummy data (useful for profiling).")
- ("input-type,y",po::value(&inputTypes), "The type of the input tensors in the network separated by comma. "
- "If unset, defaults to \"float\" for all defined inputs. "
- "Accepted values (float, int or qasymm8)")
- ("quantize-input,q",po::bool_switch()->default_value(false),
- "If this option is enabled, all float inputs will be quantized to qasymm8. "
- "If unset, default to not quantized. "
- "Accepted values (true or false)")
- ("output-type,z",po::value(&outputTypes),
- "The type of the output tensors in the network separated by comma. "
- "If unset, defaults to \"float\" for all defined outputs. "
- "Accepted values (float, int or qasymm8).")
- ("output-name,o", po::value(&outputNames),
- "Identifier of the output tensors in the network separated by comma.")
- ("write-outputs-to-file,w", po::value(&outputTensorFiles),
- "Comma-separated list of output file paths keyed with the binding-id of the output slot. "
- "If left empty (the default), the output tensors will not be written to a file.")
- ("event-based-profiling,e", po::bool_switch()->default_value(false),
- "Enables built in profiler. If unset, defaults to off.")
- ("visualize-optimized-model,v", po::bool_switch()->default_value(false),
- "Enables built optimized model visualizer. If unset, defaults to off.")
- ("fp16-turbo-mode,h", po::bool_switch()->default_value(false), "If this option is enabled, FP32 layers, "
- "weights and biases will be converted to FP16 where the backend supports it")
- ("threshold-time,r", po::value<double>(&thresholdTime)->default_value(0.0),
- "Threshold time is the maximum allowed time for inference measured in milliseconds. If the actual "
- "inference time is greater than the threshold time, the test will fail. By default, no threshold "
- "time is used.")
- ("print-intermediate-layers,p", po::bool_switch()->default_value(false),
- "If this option is enabled, the output of every graph layer will be printed.")
- ("enable-external-profiling,a", po::bool_switch()->default_value(false),
- "If enabled external profiling will be switched on")
- ("outgoing-capture-file,j", po::value(&outgoingCaptureFile),
- "If specified the outgoing external profiling packets will be captured in this binary file")
- ("incoming-capture-file,k", po::value(&incomingCaptureFile),
- "If specified the incoming external profiling packets will be captured in this binary file")
- ("file-only-external-profiling,g", po::bool_switch()->default_value(false),
- "If enabled then the 'file-only' test mode of external profiling will be enabled")
- ("counter-capture-period,u", po::value<uint32_t>(&counterCapturePeriod)->default_value(150u),
- "If profiling is enabled in 'file-only' mode this is the capture period that will be used in the test")
- ("parse-unsupported", po::bool_switch()->default_value(false),
- "Add unsupported operators as stand-in layers (where supported by parser)");
- }
- catch (const std::exception& e)
- {
- // Coverity points out that default_value(...) can throw a bad_lexical_cast,
- // and that desc.add_options() can throw boost::io::too_few_args.
- // They really won't in any of these cases.
- BOOST_ASSERT_MSG(false, "Caught unexpected exception");
- ARMNN_LOG(fatal) << "Fatal internal error: " << e.what();
- return EXIT_FAILURE;
- }
-
- // Parses the command-line.
- po::variables_map vm;
- try
- {
- po::store(po::parse_command_line(argc, argv, desc), vm);
-
- if (CheckOption(vm, "help") || argc <= 1)
- {
- std::cout << "Executes a neural network model using the provided input tensor. " << std::endl;
- std::cout << "Prints the resulting output tensor." << std::endl;
- std::cout << std::endl;
- std::cout << desc << std::endl;
- return EXIT_SUCCESS;
- }
-
- po::notify(vm);
- }
- catch (const po::error& e)
- {
- std::cerr << e.what() << std::endl << std::endl;
- std::cerr << desc << std::endl;
- return EXIT_FAILURE;
- }
-
- // Get the value of the switch arguments.
- bool concurrent = vm["concurrent"].as<bool>();
- bool enableProfiling = vm["event-based-profiling"].as<bool>();
- bool enableLayerDetails = vm["visualize-optimized-model"].as<bool>();
- bool enableFp16TurboMode = vm["fp16-turbo-mode"].as<bool>();
- bool quantizeInput = vm["quantize-input"].as<bool>();
- bool printIntermediate = vm["print-intermediate-layers"].as<bool>();
- bool enableExternalProfiling = vm["enable-external-profiling"].as<bool>();
- bool fileOnlyExternalProfiling = vm["file-only-external-profiling"].as<bool>();
- bool parseUnsupported = vm["parse-unsupported"].as<bool>();
-
-
- // Check whether we have to load test cases from a file.
- if (CheckOption(vm, "test-cases"))
- {
- // Check that the file exists.
- if (!boost::filesystem::exists(testCasesFile))
- {
- ARMNN_LOG(fatal) << "Given file \"" << testCasesFile << "\" does not exist";
- return EXIT_FAILURE;
- }
-
- // Parse CSV file and extract test cases
- armnnUtils::CsvReader reader;
- std::vector<armnnUtils::CsvRow> testCases = reader.ParseFile(testCasesFile);
-
- // Check that there is at least one test case to run
- if (testCases.empty())
- {
- ARMNN_LOG(fatal) << "Given file \"" << testCasesFile << "\" has no test cases";
- return EXIT_FAILURE;
- }
-
- // Create runtime
- armnn::IRuntime::CreationOptions options;
- options.m_EnableGpuProfiling = enableProfiling;
- options.m_DynamicBackendsPath = dynamicBackendsPath;
- options.m_ProfilingOptions.m_EnableProfiling = enableExternalProfiling;
- options.m_ProfilingOptions.m_IncomingCaptureFile = incomingCaptureFile;
- options.m_ProfilingOptions.m_OutgoingCaptureFile = outgoingCaptureFile;
- options.m_ProfilingOptions.m_FileOnly = fileOnlyExternalProfiling;
- options.m_ProfilingOptions.m_CapturePeriod = counterCapturePeriod;
- std::shared_ptr<armnn::IRuntime> runtime(armnn::IRuntime::Create(options));
-
- const std::string executableName("ExecuteNetwork");
-
- // Check whether we need to run the test cases concurrently
- if (concurrent)
- {
- std::vector<std::future<int>> results;
- results.reserve(testCases.size());
-
- // Run each test case in its own thread
- for (auto& testCase : testCases)
- {
- testCase.values.insert(testCase.values.begin(), executableName);
- results.push_back(std::async(std::launch::async, RunCsvTest, std::cref(testCase), std::cref(runtime),
- enableProfiling, enableFp16TurboMode, thresholdTime, printIntermediate,
- enableLayerDetails, parseUnsupported));
- }
-
- // Check results
- for (auto& result : results)
- {
- if (result.get() != EXIT_SUCCESS)
- {
- return EXIT_FAILURE;
- }
- }
- }
- else
- {
- // Run tests sequentially
- for (auto& testCase : testCases)
- {
- testCase.values.insert(testCase.values.begin(), executableName);
- if (RunCsvTest(testCase, runtime, enableProfiling,
- enableFp16TurboMode, thresholdTime, printIntermediate,
- enableLayerDetails, parseUnsupported) != EXIT_SUCCESS)
- {
- return EXIT_FAILURE;
- }
- }
- }
-
- return EXIT_SUCCESS;
- }
- else // Run single test
- {
- // Get the preferred order of compute devices. If none are specified, default to using CpuRef
- const std::string computeOption("compute");
- std::vector<std::string> computeDevicesAsStrings =
- CheckOption(vm, computeOption.c_str()) ?
- vm[computeOption].as<std::vector<std::string>>() :
- std::vector<std::string>();
- std::vector<armnn::BackendId> computeDevices(computeDevicesAsStrings.begin(), computeDevicesAsStrings.end());
-
- // Remove duplicates from the list of compute devices.
- RemoveDuplicateDevices(computeDevices);
-
- try
- {
- CheckOptionDependencies(vm);
- }
- catch (const po::error& e)
- {
- std::cerr << e.what() << std::endl << std::endl;
- std::cerr << desc << std::endl;
- return EXIT_FAILURE;
- }
- // Create runtime
- armnn::IRuntime::CreationOptions options;
- options.m_EnableGpuProfiling = enableProfiling;
- options.m_DynamicBackendsPath = dynamicBackendsPath;
- options.m_ProfilingOptions.m_EnableProfiling = enableExternalProfiling;
- options.m_ProfilingOptions.m_IncomingCaptureFile = incomingCaptureFile;
- options.m_ProfilingOptions.m_OutgoingCaptureFile = outgoingCaptureFile;
- options.m_ProfilingOptions.m_FileOnly = fileOnlyExternalProfiling;
- options.m_ProfilingOptions.m_CapturePeriod = counterCapturePeriod;
- std::shared_ptr<armnn::IRuntime> runtime(armnn::IRuntime::Create(options));
-
- return RunTest(modelFormat, inputTensorShapes, computeDevices, dynamicBackendsPath, modelPath, inputNames,
- inputTensorDataFilePaths, inputTypes, quantizeInput, outputTypes, outputNames,
- outputTensorFiles, enableProfiling, enableFp16TurboMode, thresholdTime, printIntermediate,
- subgraphId, enableLayerDetails, parseUnsupported, runtime);
- }
-}
diff --git a/tests/ImageCSVFileGenerator/ImageCSVFileGenerator.cpp b/tests/ImageCSVFileGenerator/ImageCSVFileGenerator.cpp
deleted file mode 100644
index 706a0c0c7a..0000000000
--- a/tests/ImageCSVFileGenerator/ImageCSVFileGenerator.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include <boost/filesystem.hpp>
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
-#include <boost/program_options.hpp>
-
-#include <algorithm>
-#include <fstream>
-#include <iostream>
-#include <string>
-
-namespace
-{
-
-// parses the command line to extract
-// * the directory -i to look through .raw files from (must exist)
-// * the name of the file -o the output CSV file path (must not already exist)
-class CommandLineProcessor
-{
-public:
- bool ValidateDirectory(std::string& dir)
- {
- if (dir.empty())
- {
- std::cerr << "No directory specified" << std::endl;
- return false;
- }
-
- if (dir[dir.length() - 1] != '/')
- {
- dir += "/";
- }
-
- if (!boost::filesystem::exists(dir))
- {
- std::cerr << "Directory [" << dir << "] does not exist" << std::endl;
- return false;
- }
-
- if (!boost::filesystem::is_directory(dir))
- {
- std::cerr << "Given directory [" << dir << "] is not a directory" << std::endl;
- return false;
- }
-
- return true;
- }
-
- bool ValidateOutputFile(std::string& outputFileName)
- {
- if (outputFileName.empty())
- {
- std::cerr << "No output file name specified" << std::endl;
- return false;
- }
-
- if (boost::filesystem::exists(outputFileName))
- {
- std::cerr << "Output file [" << outputFileName << "] already exists" << std::endl;
- return false;
- }
-
- if (boost::filesystem::is_directory(outputFileName))
- {
- std::cerr << "Output file [" << outputFileName << "] is a directory" << std::endl;
- return false;
- }
-
- boost::filesystem::path outputPath(outputFileName);
- if (!boost::filesystem::exists(outputPath.parent_path()))
- {
- std::cerr << "Directory [" << outputPath.parent_path().c_str() << "] does not exist" << std::endl;
- return false;
- }
-
- return true;
- }
-
- bool ValidateBindingId(const std::string& id)
- {
- if (!std::all_of(id.begin(), id.end(), ::isdigit))
- {
- std::cerr << "Invalid input binding Id" << std::endl;
- return false;
- }
-
- return true;
- }
-
- bool ProcessCommandLine(int argc, char* argv[])
- {
- namespace po = boost::program_options;
-
- po::options_description desc("Options");
- try
- {
- desc.add_options()
- ("help,h", "Display help messages")
- ("indir,i", po::value<std::string>(&m_InputDirectory)->required(),
- "Directory that .raw files are stored in")
- ("outfile,o", po::value<std::string>(&m_OutputFileName)->required(),
- "Output CSV file path")
- ("layer-binding-id,l", po::value<std::string>(&m_InputBindingId)->default_value("0"),
- "Input layer binding Id, Defaults to 0");
- }
- catch (const std::exception& e)
- {
- std::cerr << "Fatal internal error: [" << e.what() << "]" << std::endl;
- return false;
- }
-
- po::variables_map vm;
-
- try
- {
- po::store(po::parse_command_line(argc, argv, desc), vm);
-
- if (vm.count("help"))
- {
- std::cout << desc << std::endl;
- return false;
- }
-
- po::notify(vm);
- }
- catch (const po::error& e)
- {
- std::cerr << e.what() << std::endl << std::endl;
- std::cerr << desc << std::endl;
- return false;
- }
-
- if (!ValidateDirectory(m_InputDirectory))
- {
- return false;
- }
-
- if (!ValidateOutputFile(m_OutputFileName))
- {
- return false;
- }
-
- if(!ValidateBindingId(m_InputBindingId))
- {
- return false;
- }
-
- return true;
- }
-
- std::string GetInputDirectory() {return m_InputDirectory;}
- std::string GetOutputFileName() {return m_OutputFileName;}
- std::string GetInputBindingId() {return m_InputBindingId;}
-
-private:
- std::string m_InputDirectory;
- std::string m_OutputFileName;
- std::string m_InputBindingId;
-};
-
-} // namespace anonymous
-
-int main(int argc, char* argv[])
-{
- CommandLineProcessor cmdline;
- if (!cmdline.ProcessCommandLine(argc, argv))
- {
- return -1;
- }
-
- namespace fs = boost::filesystem;
-
- const std::string fileFormat(".raw");
-
- const std::string rawDirectory(cmdline.GetInputDirectory());
- const std::string outputPath(cmdline.GetOutputFileName());
- const std::string bindingId(cmdline.GetInputBindingId());
-
- std::vector<fs::path> rawFiles;
- for (auto& entry : boost::make_iterator_range(fs::directory_iterator(rawDirectory), {}))
- {
- if (entry.path().extension().c_str() == fileFormat)
- {
- rawFiles.push_back(entry.path());
- }
- }
-
- if (!rawFiles.empty())
- {
- unsigned int pass = 0;
- std::ofstream refinementData;
- refinementData.open(outputPath, std::ofstream::out);
- if (refinementData.is_open())
- {
- for (auto const& raw : rawFiles)
- {
- refinementData << pass << ", " << bindingId << ", " << raw.c_str() << "\n";
- if (!refinementData)
- {
- std::cerr << "Failed to write to output file: " << outputPath << std::endl;
- continue;
- }
- ++pass;
- }
- refinementData.close();
- }
- else
- {
- std::cerr << "Failed to open output file: " << outputPath << std::endl;
- return -1;
- }
- }
- else
- {
- std::cerr << "No matching files with the \".raw\" extension found in the directory: "
- << rawDirectory << std::endl;
- return -1;
- }
-
- return 0;
-} \ No newline at end of file
diff --git a/tests/ImageCSVFileGenerator/README.md b/tests/ImageCSVFileGenerator/README.md
deleted file mode 100644
index 98857cb90a..0000000000
--- a/tests/ImageCSVFileGenerator/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# The ImageCSVFileGenerator
-
-The `ImageCSVFileGenerator` is a program for creating a CSV file that contains a list of .raw tensor files. These
-.raw tensor files can be generated using the`ImageTensorGenerator`.
-
-|Cmd:|||
-| ---|---|---|
-| -h | --help | Display help messages |
-| -i | --indir | Directory that .raw files are stored in |
-| -o | --outfile | Output CSV file path |
-
-Example usage: <br>
-<code>./ImageCSVFileGenerator -i /path/to/directory/ -o /output/path/csvfile.csv</code>
diff --git a/tests/ImagePreprocessor.cpp b/tests/ImagePreprocessor.cpp
deleted file mode 100644
index f0184e466e..0000000000
--- a/tests/ImagePreprocessor.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "InferenceTestImage.hpp"
-#include "ImagePreprocessor.hpp"
-
-#include <armnn/TypesUtils.hpp>
-
-#include <armnnUtils/Permute.hpp>
-
-#include <boost/numeric/conversion/cast.hpp>
-#include <boost/assert.hpp>
-#include <boost/format.hpp>
-
-#include <iostream>
-#include <fcntl.h>
-#include <array>
-
-template <typename TDataType>
-unsigned int ImagePreprocessor<TDataType>::GetLabelAndResizedImageAsFloat(unsigned int testCaseId,
- std::vector<float> & result)
-{
- testCaseId = testCaseId % boost::numeric_cast<unsigned int>(m_ImageSet.size());
- const ImageSet& imageSet = m_ImageSet[testCaseId];
- const std::string fullPath = m_BinaryDirectory + imageSet.first;
-
- InferenceTestImage image(fullPath.c_str());
-
- // this ResizeBilinear result is closer to the tensorflow one than STB.
- // there is still some difference though, but the inference results are
- // similar to tensorflow for MobileNet
-
- result = image.Resize(m_Width, m_Height, CHECK_LOCATION(),
- InferenceTestImage::ResizingMethods::BilinearAndNormalized,
- m_Mean, m_Stddev, m_Scale);
-
- // duplicate data across the batch
- for (unsigned int i = 1; i < m_BatchSize; i++)
- {
- result.insert(result.end(), result.begin(), result.begin() + boost::numeric_cast<int>(GetNumImageElements()));
- }
-
- if (m_DataFormat == DataFormat::NCHW)
- {
- const armnn::PermutationVector NHWCToArmNN = { 0, 2, 3, 1 };
- armnn::TensorShape dstShape({m_BatchSize, 3, m_Height, m_Width});
- std::vector<float> tempImage(result.size());
- armnnUtils::Permute(dstShape, NHWCToArmNN, result.data(), tempImage.data(), sizeof(float));
- result.swap(tempImage);
- }
-
- return imageSet.second;
-}
-
-template <>
-std::unique_ptr<ImagePreprocessor<float>::TTestCaseData>
-ImagePreprocessor<float>::GetTestCaseData(unsigned int testCaseId)
-{
- std::vector<float> resized;
- auto label = GetLabelAndResizedImageAsFloat(testCaseId, resized);
- return std::make_unique<TTestCaseData>(label, std::move(resized));
-}
-
-template <>
-std::unique_ptr<ImagePreprocessor<uint8_t>::TTestCaseData>
-ImagePreprocessor<uint8_t>::GetTestCaseData(unsigned int testCaseId)
-{
- std::vector<float> resized;
- auto label = GetLabelAndResizedImageAsFloat(testCaseId, resized);
-
- size_t resizedSize = resized.size();
- std::vector<uint8_t> quantized(resized.size());
-
- for (size_t i=0; i<resizedSize; ++i)
- {
- quantized[i] = static_cast<uint8_t>(resized[i]);
- }
-
- return std::make_unique<TTestCaseData>(label, std::move(quantized));
-}
diff --git a/tests/ImagePreprocessor.hpp b/tests/ImagePreprocessor.hpp
deleted file mode 100644
index cd586818c2..0000000000
--- a/tests/ImagePreprocessor.hpp
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#pragma once
-
-#include "ClassifierTestCaseData.hpp"
-
-#include <array>
-#include <string>
-#include <vector>
-#include <memory>
-
-///Tf requires RGB images, normalized in range [0, 1] and resized using Bilinear algorithm
-
-
-using ImageSet = std::pair<const std::string, unsigned int>;
-
-template <typename TDataType>
-class ImagePreprocessor
-{
-public:
- using DataType = TDataType;
- using TTestCaseData = ClassifierTestCaseData<DataType>;
-
- enum DataFormat
- {
- NHWC,
- NCHW
- };
-
- explicit ImagePreprocessor(const std::string& binaryFileDirectory,
- unsigned int width,
- unsigned int height,
- const std::vector<ImageSet>& imageSet,
- float scale=255.0f,
- const std::array<float, 3> mean={{0, 0, 0}},
- const std::array<float, 3> stddev={{1, 1, 1}},
- DataFormat dataFormat=DataFormat::NHWC,
- unsigned int batchSize=1)
- : m_BinaryDirectory(binaryFileDirectory)
- , m_Height(height)
- , m_Width(width)
- , m_BatchSize(batchSize)
- , m_Scale(scale)
- , m_ImageSet(imageSet)
- , m_Mean(mean)
- , m_Stddev(stddev)
- , m_DataFormat(dataFormat)
- {
- }
-
- std::unique_ptr<TTestCaseData> GetTestCaseData(unsigned int testCaseId);
-
-private:
- unsigned int GetNumImageElements() const { return 3 * m_Width * m_Height; }
- unsigned int GetNumImageBytes() const { return sizeof(DataType) * GetNumImageElements(); }
- unsigned int GetLabelAndResizedImageAsFloat(unsigned int testCaseId,
- std::vector<float> & result);
-
- std::string m_BinaryDirectory;
- unsigned int m_Height;
- unsigned int m_Width;
- unsigned int m_BatchSize;
- // Quantization parameters
- float m_Scale;
- const std::vector<ImageSet> m_ImageSet;
-
- const std::array<float, 3> m_Mean;
- const std::array<float, 3> m_Stddev;
-
- DataFormat m_DataFormat;
-};
diff --git a/tests/ImageTensorGenerator/ImageTensorGenerator.cpp b/tests/ImageTensorGenerator/ImageTensorGenerator.cpp
deleted file mode 100644
index 9c23200802..0000000000
--- a/tests/ImageTensorGenerator/ImageTensorGenerator.cpp
+++ /dev/null
@@ -1,313 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "ImageTensorGenerator.hpp"
-#include "../InferenceTestImage.hpp"
-#include <armnn/Logging.hpp>
-#include <armnn/TypesUtils.hpp>
-
-#include <boost/filesystem.hpp>
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
-#include <boost/program_options.hpp>
-#include <boost/variant.hpp>
-
-#include <algorithm>
-#include <fstream>
-#include <iostream>
-#include <string>
-
-namespace
-{
-
-// parses the command line to extract
-// * the input image file -i the input image file path (must exist)
-// * the layout -l the data layout output generated with (optional - default value is NHWC)
-// * the output file -o the output raw tensor file path (must not already exist)
-class CommandLineProcessor
-{
-public:
- bool ValidateInputFile(const std::string& inputFileName)
- {
- if (inputFileName.empty())
- {
- std::cerr << "No input file name specified" << std::endl;
- return false;
- }
-
- if (!boost::filesystem::exists(inputFileName))
- {
- std::cerr << "Input file [" << inputFileName << "] does not exist" << std::endl;
- return false;
- }
-
- if (boost::filesystem::is_directory(inputFileName))
- {
- std::cerr << "Input file [" << inputFileName << "] is a directory" << std::endl;
- return false;
- }
-
- return true;
- }
-
- bool ValidateLayout(const std::string& layout)
- {
- if (layout.empty())
- {
- std::cerr << "No layout specified" << std::endl;
- return false;
- }
-
- std::vector<std::string> supportedLayouts = { "NHWC", "NCHW" };
-
- auto iterator = std::find(supportedLayouts.begin(), supportedLayouts.end(), layout);
- if (iterator == supportedLayouts.end())
- {
- std::cerr << "Layout [" << layout << "] is not supported" << std::endl;
- return false;
- }
-
- return true;
- }
-
- bool ValidateOutputFile(std::string& outputFileName)
- {
- if (outputFileName.empty())
- {
- std::cerr << "No output file name specified" << std::endl;
- return false;
- }
-
- if (boost::filesystem::exists(outputFileName))
- {
- std::cerr << "Output file [" << outputFileName << "] already exists" << std::endl;
- return false;
- }
-
- if (boost::filesystem::is_directory(outputFileName))
- {
- std::cerr << "Output file [" << outputFileName << "] is a directory" << std::endl;
- return false;
- }
-
- boost::filesystem::path outputPath(outputFileName);
- if (!boost::filesystem::exists(outputPath.parent_path()))
- {
- std::cerr << "Output directory [" << outputPath.parent_path().c_str() << "] does not exist" << std::endl;
- return false;
- }
-
- return true;
- }
-
- bool ProcessCommandLine(int argc, char* argv[])
- {
- namespace po = boost::program_options;
-
- po::options_description desc("Options");
- try
- {
- desc.add_options()
- ("help,h", "Display help messages")
- ("infile,i", po::value<std::string>(&m_InputFileName)->required(),
- "Input image file to generate tensor from")
- ("model-format,f", po::value<std::string>(&m_ModelFormat)->required(),
- "Format of the intended model file that uses the images."
- "Different formats have different image normalization styles."
- "Accepted values (caffe, tensorflow, tflite)")
- ("outfile,o", po::value<std::string>(&m_OutputFileName)->required(),
- "Output raw tensor file path")
- ("output-type,z", po::value<std::string>(&m_OutputType)->default_value("float"),
- "The data type of the output tensors."
- "If unset, defaults to \"float\" for all defined inputs. "
- "Accepted values (float, int or qasymm8)")
- ("new-width", po::value<std::string>(&m_NewWidth)->default_value("0"),
- "Resize image to new width. Keep original width if unspecified")
- ("new-height", po::value<std::string>(&m_NewHeight)->default_value("0"),
- "Resize image to new height. Keep original height if unspecified")
- ("layout,l", po::value<std::string>(&m_Layout)->default_value("NHWC"),
- "Output data layout, \"NHWC\" or \"NCHW\", default value NHWC");
- }
- catch (const std::exception& e)
- {
- std::cerr << "Fatal internal error: [" << e.what() << "]" << std::endl;
- return false;
- }
-
- po::variables_map vm;
-
- try
- {
- po::store(po::parse_command_line(argc, argv, desc), vm);
-
- if (vm.count("help"))
- {
- std::cout << desc << std::endl;
- return false;
- }
-
- po::notify(vm);
- }
- catch (const po::error& e)
- {
- std::cerr << e.what() << std::endl << std::endl;
- std::cerr << desc << std::endl;
- return false;
- }
-
- if (!ValidateInputFile(m_InputFileName))
- {
- return false;
- }
-
- if (!ValidateLayout(m_Layout))
- {
- return false;
- }
-
- if (!ValidateOutputFile(m_OutputFileName))
- {
- return false;
- }
-
- return true;
- }
-
- std::string GetInputFileName() {return m_InputFileName;}
- armnn::DataLayout GetLayout()
- {
- if (m_Layout == "NHWC")
- {
- return armnn::DataLayout::NHWC;
- }
- else if (m_Layout == "NCHW")
- {
- return armnn::DataLayout::NCHW;
- }
- else
- {
- throw armnn::Exception("Unsupported data layout: " + m_Layout);
- }
- }
- std::string GetOutputFileName() {return m_OutputFileName;}
- unsigned int GetNewWidth() {return static_cast<unsigned int>(std::stoi(m_NewWidth));}
- unsigned int GetNewHeight() {return static_cast<unsigned int>(std::stoi(m_NewHeight));}
- SupportedFrontend GetModelFormat()
- {
- if (m_ModelFormat == "caffe")
- {
- return SupportedFrontend::Caffe;
- }
- else if (m_ModelFormat == "tensorflow")
- {
- return SupportedFrontend::TensorFlow;
- }
- else if (m_ModelFormat == "tflite")
- {
- return SupportedFrontend::TFLite;
- }
- else
- {
- throw armnn::Exception("Unsupported model format" + m_ModelFormat);
- }
- }
- armnn::DataType GetOutputType()
- {
- if (m_OutputType == "float")
- {
- return armnn::DataType::Float32;
- }
- else if (m_OutputType == "int")
- {
- return armnn::DataType::Signed32;
- }
- else if (m_OutputType == "qasymm8")
- {
- return armnn::DataType::QAsymmU8;
- }
- else
- {
- throw armnn::Exception("Unsupported input type" + m_OutputType);
- }
- }
-
-private:
- std::string m_InputFileName;
- std::string m_Layout;
- std::string m_OutputFileName;
- std::string m_NewWidth;
- std::string m_NewHeight;
- std::string m_ModelFormat;
- std::string m_OutputType;
-};
-
-} // namespace anonymous
-
-int main(int argc, char* argv[])
-{
- CommandLineProcessor cmdline;
- if (!cmdline.ProcessCommandLine(argc, argv))
- {
- return -1;
- }
- const std::string imagePath(cmdline.GetInputFileName());
- const std::string outputPath(cmdline.GetOutputFileName());
- const SupportedFrontend& modelFormat(cmdline.GetModelFormat());
- const armnn::DataType outputType(cmdline.GetOutputType());
- const unsigned int newWidth = cmdline.GetNewWidth();
- const unsigned int newHeight = cmdline.GetNewHeight();
- const unsigned int batchSize = 1;
- const armnn::DataLayout outputLayout(cmdline.GetLayout());
-
- using TContainer = boost::variant<std::vector<float>, std::vector<int>, std::vector<uint8_t>>;
- std::vector<TContainer> imageDataContainers;
- const NormalizationParameters& normParams = GetNormalizationParameters(modelFormat, outputType);
- try
- {
- switch (outputType)
- {
- case armnn::DataType::Signed32:
- imageDataContainers.push_back(PrepareImageTensor<int>(
- imagePath, newWidth, newHeight, normParams, batchSize, outputLayout));
- break;
- case armnn::DataType::QAsymmU8:
- imageDataContainers.push_back(PrepareImageTensor<uint8_t>(
- imagePath, newWidth, newHeight, normParams, batchSize, outputLayout));
- break;
- case armnn::DataType::Float32:
- default:
- imageDataContainers.push_back(PrepareImageTensor<float>(
- imagePath, newWidth, newHeight, normParams, batchSize, outputLayout));
- break;
- }
- }
- catch (const InferenceTestImageException& e)
- {
- ARMNN_LOG(fatal) << "Failed to load image file " << imagePath << " with error: " << e.what();
- return -1;
- }
-
- std::ofstream imageTensorFile;
- imageTensorFile.open(outputPath, std::ofstream::out);
- if (imageTensorFile.is_open())
- {
- boost::apply_visitor([&imageTensorFile](auto&& imageData) { WriteImageTensorImpl(imageData, imageTensorFile); },
- imageDataContainers[0]);
- if (!imageTensorFile)
- {
- ARMNN_LOG(fatal) << "Failed to write to output file" << outputPath;
- imageTensorFile.close();
- return -1;
- }
- imageTensorFile.close();
- }
- else
- {
- ARMNN_LOG(fatal) << "Failed to open output file" << outputPath;
- return -1;
- }
-
- return 0;
-}
diff --git a/tests/ImageTensorGenerator/ImageTensorGenerator.hpp b/tests/ImageTensorGenerator/ImageTensorGenerator.hpp
deleted file mode 100644
index 4793f822fb..0000000000
--- a/tests/ImageTensorGenerator/ImageTensorGenerator.hpp
+++ /dev/null
@@ -1,183 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "../InferenceTestImage.hpp"
-
-#include <armnn/TypesUtils.hpp>
-
-#include <armnnUtils/Permute.hpp>
-
-#include <algorithm>
-#include <fstream>
-#include <iterator>
-#include <string>
-
-// Parameters used in normalizing images
-struct NormalizationParameters
-{
- float scale{ 1.0 };
- std::array<float, 3> mean{ { 0.0, 0.0, 0.0 } };
- std::array<float, 3> stddev{ { 1.0, 1.0, 1.0 } };
-};
-
-enum class SupportedFrontend
-{
- Caffe = 0,
- TensorFlow = 1,
- TFLite = 2,
-};
-
-/** Get normalization parameters.
- * Note that different flavours of models and different model data types have different normalization methods.
- * This tool currently only supports Caffe, TF and TFLite models
- *
- * @param[in] modelFormat One of the supported frontends
- * @param[in] outputType Output type of the image tensor, also the type of the intended model
- */
-NormalizationParameters GetNormalizationParameters(const SupportedFrontend& modelFormat,
- const armnn::DataType& outputType)
-{
- NormalizationParameters normParams;
- // Explicitly set default parameters
- normParams.scale = 1.0;
- normParams.mean = { 0.0, 0.0, 0.0 };
- normParams.stddev = { 1.0, 1.0, 1.0 };
- switch (modelFormat)
- {
- case SupportedFrontend::Caffe:
- break;
- case SupportedFrontend::TensorFlow:
- case SupportedFrontend::TFLite:
- default:
- switch (outputType)
- {
- case armnn::DataType::Float32:
- normParams.scale = 127.5;
- normParams.mean = { 1.0, 1.0, 1.0 };
- break;
- case armnn::DataType::Signed32:
- normParams.mean = { 128.0, 128.0, 128.0 };
- break;
- case armnn::DataType::QAsymmU8:
- default:
- break;
- }
- break;
- }
- return normParams;
-}
-
-/** Prepare raw image tensor data by loading the image from imagePath and preprocessing it.
- *
- * @param[in] imagePath Path to the image file
- * @param[in] newWidth The new width of the output image tensor
- * @param[in] newHeight The new height of the output image tensor
- * @param[in] normParams Normalization parameters for the normalization of the image
- * @param[in] batchSize Batch size
- * @param[in] outputLayout Data layout of the output image tensor
- */
-template <typename ElemType>
-std::vector<ElemType> PrepareImageTensor(const std::string& imagePath,
- unsigned int newWidth,
- unsigned int newHeight,
- const NormalizationParameters& normParams,
- unsigned int batchSize = 1,
- const armnn::DataLayout& outputLayout = armnn::DataLayout::NHWC);
-
-// Prepare float32 image tensor
-template <>
-std::vector<float> PrepareImageTensor<float>(const std::string& imagePath,
- unsigned int newWidth,
- unsigned int newHeight,
- const NormalizationParameters& normParams,
- unsigned int batchSize,
- const armnn::DataLayout& outputLayout)
-{
- // Generate image tensor
- std::vector<float> imageData;
- InferenceTestImage testImage(imagePath.c_str());
- if (newWidth == 0)
- {
- newWidth = testImage.GetWidth();
- }
- if (newHeight == 0)
- {
- newHeight = testImage.GetHeight();
- }
- // Resize the image to new width and height or keep at original dimensions if the new width and height are specified
- // as 0 Centre/Normalise the image.
- imageData = testImage.Resize(newWidth, newHeight, CHECK_LOCATION(),
- InferenceTestImage::ResizingMethods::BilinearAndNormalized, normParams.mean,
- normParams.stddev, normParams.scale);
- if (outputLayout == armnn::DataLayout::NCHW)
- {
- // Convert to NCHW format
- const armnn::PermutationVector NHWCToArmNN = { 0, 2, 3, 1 };
- armnn::TensorShape dstShape({ batchSize, 3, newHeight, newWidth });
- std::vector<float> tempImage(imageData.size());
- armnnUtils::Permute(dstShape, NHWCToArmNN, imageData.data(), tempImage.data(), sizeof(float));
- imageData.swap(tempImage);
- }
- return imageData;
-}
-
-// Prepare int32 image tensor
-template <>
-std::vector<int> PrepareImageTensor<int>(const std::string& imagePath,
- unsigned int newWidth,
- unsigned int newHeight,
- const NormalizationParameters& normParams,
- unsigned int batchSize,
- const armnn::DataLayout& outputLayout)
-{
- // Get float32 image tensor
- std::vector<float> imageDataFloat =
- PrepareImageTensor<float>(imagePath, newWidth, newHeight, normParams, batchSize, outputLayout);
- // Convert to int32 image tensor with static cast
- std::vector<int> imageDataInt;
- imageDataInt.reserve(imageDataFloat.size());
- std::transform(imageDataFloat.begin(), imageDataFloat.end(), std::back_inserter(imageDataInt),
- [](float val) { return static_cast<int>(val); });
- return imageDataInt;
-}
-
-// Prepare qasymm8 image tensor
-template <>
-std::vector<uint8_t> PrepareImageTensor<uint8_t>(const std::string& imagePath,
- unsigned int newWidth,
- unsigned int newHeight,
- const NormalizationParameters& normParams,
- unsigned int batchSize,
- const armnn::DataLayout& outputLayout)
-{
- // Get float32 image tensor
- std::vector<float> imageDataFloat =
- PrepareImageTensor<float>(imagePath, newWidth, newHeight, normParams, batchSize, outputLayout);
- std::vector<uint8_t> imageDataQasymm8;
- imageDataQasymm8.reserve(imageDataFloat.size());
- // Convert to uint8 image tensor with static cast
- std::transform(imageDataFloat.begin(), imageDataFloat.end(), std::back_inserter(imageDataQasymm8),
- [](float val) { return static_cast<uint8_t>(val); });
- return imageDataQasymm8;
-}
-
-/** Write image tensor to ofstream
- *
- * @param[in] imageData Image tensor data
- * @param[in] imageTensorFile Output filestream (ofstream) to which the image tensor data is written
- */
-template <typename ElemType>
-void WriteImageTensorImpl(const std::vector<ElemType>& imageData, std::ofstream& imageTensorFile)
-{
- std::copy(imageData.begin(), imageData.end(), std::ostream_iterator<ElemType>(imageTensorFile, " "));
-}
-
-// For uint8_t image tensor, cast it to int before writing it to prevent writing data as characters instead of
-// numerical values
-template <>
-void WriteImageTensorImpl<uint8_t>(const std::vector<uint8_t>& imageData, std::ofstream& imageTensorFile)
-{
- std::copy(imageData.begin(), imageData.end(), std::ostream_iterator<int>(imageTensorFile, " "));
-}
diff --git a/tests/ImageTensorGenerator/README.md b/tests/ImageTensorGenerator/README.md
deleted file mode 100644
index a7e149cc3a..0000000000
--- a/tests/ImageTensorGenerator/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# The ImageTensorGenerator
-
-The `ImageTensorGenerator` is a program for pre-processing a .jpg image before generating a .raw tensor file from it.
-
-Build option:
-To build ModelAccuracyTool, pass the following options to Cmake:
-* -DBUILD_ARMNN_QUANTIZER=1
-
-|Cmd:|||
-| ---|---|---|
-| -h | --help | Display help messages |
-| -f | --model-format | Format of the intended model file that uses the images.Different formats have different image normalization styles.Accepted values (caffe, tensorflow, tflite) |
-| -i | --infile | Input image file to generate tensor from |
-| -o | --outfile | Output raw tensor file path |
-| -z | --output-type | The data type of the output tensors.If unset, defaults to "float" for all defined inputs. Accepted values (float, int or qasymm8)
-| | --new-width |Resize image to new width. Keep original width if unspecified |
-| | --new-height | Resize image to new height. Keep original height if unspecified |
-| -l | --layout | Output data layout, "NHWC" or "NCHW". Default value: NHWC |
-
-Example usage: <br>
-<code>./ImageTensorGenerator -i /path/to/image/dog.jpg -o /output/path/dog.raw --new-width 224 --new-height 224</code> \ No newline at end of file
diff --git a/tests/InferenceModel.hpp b/tests/InferenceModel.hpp
deleted file mode 100644
index 50b1607743..0000000000
--- a/tests/InferenceModel.hpp
+++ /dev/null
@@ -1,593 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include <armnn/ArmNN.hpp>
-#include <armnn/BackendRegistry.hpp>
-
-#if defined(ARMNN_SERIALIZER)
-#include "armnnDeserializer/IDeserializer.hpp"
-#endif
-#if defined(ARMNN_TF_LITE_PARSER)
-#include <armnnTfLiteParser/ITfLiteParser.hpp>
-#endif
-#if defined(ARMNN_ONNX_PARSER)
-#include <armnnOnnxParser/IOnnxParser.hpp>
-#endif
-
-#include <HeapProfiling.hpp>
-#include <TensorIOUtils.hpp>
-
-#include <boost/algorithm/string/join.hpp>
-#include <boost/exception/exception.hpp>
-#include <boost/exception/diagnostic_information.hpp>
-#include <boost/format.hpp>
-#include <boost/program_options.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/lexical_cast.hpp>
-#include <boost/variant.hpp>
-
-#include <algorithm>
-#include <chrono>
-#include <iterator>
-#include <fstream>
-#include <map>
-#include <string>
-#include <vector>
-#include <type_traits>
-
-namespace
-{
-
-inline bool CheckRequestedBackendsAreValid(const std::vector<armnn::BackendId>& backendIds,
- armnn::Optional<std::string&> invalidBackendIds = armnn::EmptyOptional())
-{
- if (backendIds.empty())
- {
- return false;
- }
-
- armnn::BackendIdSet validBackendIds = armnn::BackendRegistryInstance().GetBackendIds();
-
- bool allValid = true;
- for (const auto& backendId : backendIds)
- {
- if (std::find(validBackendIds.begin(), validBackendIds.end(), backendId) == validBackendIds.end())
- {
- allValid = false;
- if (invalidBackendIds)
- {
- if (!invalidBackendIds.value().empty())
- {
- invalidBackendIds.value() += ", ";
- }
- invalidBackendIds.value() += backendId;
- }
- }
- }
- return allValid;
-}
-
-} // anonymous namespace
-
-namespace InferenceModelInternal
-{
-using BindingPointInfo = armnn::BindingPointInfo;
-
-using QuantizationParams = std::pair<float,int32_t>;
-
-struct Params
-{
- std::string m_ModelPath;
- std::vector<std::string> m_InputBindings;
- std::vector<armnn::TensorShape> m_InputShapes;
- std::vector<std::string> m_OutputBindings;
- std::vector<armnn::BackendId> m_ComputeDevices;
- std::string m_DynamicBackendsPath;
- size_t m_SubgraphId;
- bool m_IsModelBinary;
- bool m_VisualizePostOptimizationModel;
- bool m_EnableFp16TurboMode;
- bool m_PrintIntermediateLayers;
- bool m_ParseUnsupported;
-
- Params()
- : m_ComputeDevices{}
- , m_SubgraphId(0)
- , m_IsModelBinary(true)
- , m_VisualizePostOptimizationModel(false)
- , m_EnableFp16TurboMode(false)
- , m_PrintIntermediateLayers(false)
- , m_ParseUnsupported(false)
- {}
-};
-
-} // namespace InferenceModelInternal
-
-template <typename IParser>
-struct CreateNetworkImpl
-{
-public:
- using Params = InferenceModelInternal::Params;
-
- static armnn::INetworkPtr Create(const Params& params,
- std::vector<armnn::BindingPointInfo>& inputBindings,
- std::vector<armnn::BindingPointInfo>& outputBindings)
- {
- const std::string& modelPath = params.m_ModelPath;
-
- // Create a network from a file on disk
- auto parser(IParser::Create());
-
- std::map<std::string, armnn::TensorShape> inputShapes;
- if (!params.m_InputShapes.empty())
- {
- const size_t numInputShapes = params.m_InputShapes.size();
- const size_t numInputBindings = params.m_InputBindings.size();
- if (numInputShapes < numInputBindings)
- {
- throw armnn::Exception(boost::str(boost::format(
- "Not every input has its tensor shape specified: expected=%1%, got=%2%")
- % numInputBindings % numInputShapes));
- }
-
- for (size_t i = 0; i < numInputShapes; i++)
- {
- inputShapes[params.m_InputBindings[i]] = params.m_InputShapes[i];
- }
- }
-
- std::vector<std::string> requestedOutputs = params.m_OutputBindings;
- armnn::INetworkPtr network{nullptr, [](armnn::INetwork *){}};
-
- {
- ARMNN_SCOPED_HEAP_PROFILING("Parsing");
- // Handle text and binary input differently by calling the corresponding parser function
- network = (params.m_IsModelBinary ?
- parser->CreateNetworkFromBinaryFile(modelPath.c_str(), inputShapes, requestedOutputs) :
- parser->CreateNetworkFromTextFile(modelPath.c_str(), inputShapes, requestedOutputs));
- }
-
- for (const std::string& inputLayerName : params.m_InputBindings)
- {
- inputBindings.push_back(parser->GetNetworkInputBindingInfo(inputLayerName));
- }
-
- for (const std::string& outputLayerName : params.m_OutputBindings)
- {
- outputBindings.push_back(parser->GetNetworkOutputBindingInfo(outputLayerName));
- }
-
- return network;
- }
-};
-
-#if defined(ARMNN_SERIALIZER)
-template <>
-struct CreateNetworkImpl<armnnDeserializer::IDeserializer>
-{
-public:
- using IParser = armnnDeserializer::IDeserializer;
- using Params = InferenceModelInternal::Params;
-
- static armnn::INetworkPtr Create(const Params& params,
- std::vector<armnn::BindingPointInfo>& inputBindings,
- std::vector<armnn::BindingPointInfo>& outputBindings)
- {
- auto parser(IParser::Create());
- BOOST_ASSERT(parser);
-
- armnn::INetworkPtr network{nullptr, [](armnn::INetwork *){}};
-
- {
- ARMNN_SCOPED_HEAP_PROFILING("Parsing");
-
- boost::system::error_code errorCode;
- boost::filesystem::path pathToFile(params.m_ModelPath);
- if (!boost::filesystem::exists(pathToFile, errorCode))
- {
- throw armnn::FileNotFoundException(boost::str(
- boost::format("Cannot find the file (%1%) errorCode: %2% %3%") %
- params.m_ModelPath %
- errorCode %
- CHECK_LOCATION().AsString()));
- }
- std::ifstream file(params.m_ModelPath, std::ios::binary);
-
- network = parser->CreateNetworkFromBinary(file);
- }
-
- unsigned int subgraphId = boost::numeric_cast<unsigned int>(params.m_SubgraphId);
-
- for (const std::string& inputLayerName : params.m_InputBindings)
- {
- armnnDeserializer::BindingPointInfo inputBinding =
- parser->GetNetworkInputBindingInfo(subgraphId, inputLayerName);
- inputBindings.push_back(std::make_pair(inputBinding.m_BindingId, inputBinding.m_TensorInfo));
- }
-
- for (const std::string& outputLayerName : params.m_OutputBindings)
- {
- armnnDeserializer::BindingPointInfo outputBinding =
- parser->GetNetworkOutputBindingInfo(subgraphId, outputLayerName);
- outputBindings.push_back(std::make_pair(outputBinding.m_BindingId, outputBinding.m_TensorInfo));
- }
-
- return network;
- }
-};
-#endif
-
-#if defined(ARMNN_TF_LITE_PARSER)
-template <>
-struct CreateNetworkImpl<armnnTfLiteParser::ITfLiteParser>
-{
-public:
- using IParser = armnnTfLiteParser::ITfLiteParser;
- using Params = InferenceModelInternal::Params;
-
- static armnn::INetworkPtr Create(const Params& params,
- std::vector<armnn::BindingPointInfo>& inputBindings,
- std::vector<armnn::BindingPointInfo>& outputBindings)
- {
- const std::string& modelPath = params.m_ModelPath;
-
- // Create a network from a file on disk
- IParser::TfLiteParserOptions options;
- options.m_StandInLayerForUnsupported = params.m_ParseUnsupported;
- auto parser(IParser::Create(options));
-
- armnn::INetworkPtr network{nullptr, [](armnn::INetwork *){}};
-
- {
- ARMNN_SCOPED_HEAP_PROFILING("Parsing");
- network = parser->CreateNetworkFromBinaryFile(modelPath.c_str());
- }
-
- for (const std::string& inputLayerName : params.m_InputBindings)
- {
- armnn::BindingPointInfo inputBinding =
- parser->GetNetworkInputBindingInfo(params.m_SubgraphId, inputLayerName);
- inputBindings.push_back(inputBinding);
- }
-
- for (const std::string& outputLayerName : params.m_OutputBindings)
- {
- armnn::BindingPointInfo outputBinding =
- parser->GetNetworkOutputBindingInfo(params.m_SubgraphId, outputLayerName);
- outputBindings.push_back(outputBinding);
- }
-
- return network;
- }
-};
-#endif
-
-#if defined(ARMNN_ONNX_PARSER)
-template <>
-struct CreateNetworkImpl<armnnOnnxParser::IOnnxParser>
-{
-public:
- using IParser = armnnOnnxParser::IOnnxParser;
- using Params = InferenceModelInternal::Params;
- using BindingPointInfo = InferenceModelInternal::BindingPointInfo;
-
- static armnn::INetworkPtr Create(const Params& params,
- std::vector<BindingPointInfo>& inputBindings,
- std::vector<BindingPointInfo>& outputBindings)
- {
- const std::string& modelPath = params.m_ModelPath;
-
- // Create a network from a file on disk
- auto parser(IParser::Create());
-
- armnn::INetworkPtr network{nullptr, [](armnn::INetwork *){}};
-
- {
- ARMNN_SCOPED_HEAP_PROFILING("Parsing");
- network = (params.m_IsModelBinary ?
- parser->CreateNetworkFromBinaryFile(modelPath.c_str()) :
- parser->CreateNetworkFromTextFile(modelPath.c_str()));
- }
-
- for (const std::string& inputLayerName : params.m_InputBindings)
- {
- BindingPointInfo inputBinding = parser->GetNetworkInputBindingInfo(inputLayerName);
- inputBindings.push_back(inputBinding);
- }
-
- for (const std::string& outputLayerName : params.m_OutputBindings)
- {
- BindingPointInfo outputBinding = parser->GetNetworkOutputBindingInfo(outputLayerName);
- outputBindings.push_back(outputBinding);
- }
-
- return network;
- }
-};
-#endif
-
-
-
-template <typename IParser, typename TDataType>
-class InferenceModel
-{
-public:
- using DataType = TDataType;
- using Params = InferenceModelInternal::Params;
- using QuantizationParams = InferenceModelInternal::QuantizationParams;
- using TContainer = boost::variant<std::vector<float>, std::vector<int>, std::vector<unsigned char>>;
-
- struct CommandLineOptions
- {
- std::string m_ModelDir;
- std::vector<std::string> m_ComputeDevices;
- std::string m_DynamicBackendsPath;
- bool m_VisualizePostOptimizationModel;
- bool m_EnableFp16TurboMode;
- std::string m_Labels;
-
- std::vector<armnn::BackendId> GetComputeDevicesAsBackendIds()
- {
- std::vector<armnn::BackendId> backendIds;
- std::copy(m_ComputeDevices.begin(), m_ComputeDevices.end(), std::back_inserter(backendIds));
- return backendIds;
- }
- };
-
- static void AddCommandLineOptions(boost::program_options::options_description& desc, CommandLineOptions& options)
- {
- namespace po = boost::program_options;
-
- const std::vector<std::string> defaultComputes = { "CpuAcc", "CpuRef" };
-
- const std::string backendsMessage = "Which device to run layers on by default. Possible choices: "
- + armnn::BackendRegistryInstance().GetBackendIdsAsString();
-
- desc.add_options()
- ("model-dir,m", po::value<std::string>(&options.m_ModelDir)->required(),
- "Path to directory containing model files (.caffemodel/.prototxt/.tflite)")
- ("compute,c", po::value<std::vector<std::string>>(&options.m_ComputeDevices)->
- default_value(defaultComputes, boost::algorithm::join(defaultComputes, ", "))->
- multitoken(), backendsMessage.c_str())
- ("dynamic-backends-path,b", po::value(&options.m_DynamicBackendsPath),
- "Path where to load any available dynamic backend from. "
- "If left empty (the default), dynamic backends will not be used.")
- ("labels,l", po::value<std::string>(&options.m_Labels),
- "Text file containing one image filename - correct label pair per line, "
- "used to test the accuracy of the network.")
- ("visualize-optimized-model,v",
- po::value<bool>(&options.m_VisualizePostOptimizationModel)->default_value(false),
- "Produce a dot file useful for visualizing the graph post optimization."
- "The file will have the same name as the model with the .dot extention.")
- ("fp16-turbo-mode", po::value<bool>(&options.m_EnableFp16TurboMode)->default_value(false),
- "If this option is enabled FP32 layers, weights and biases will be converted "
- "to FP16 where the backend supports it.");
- }
-
- InferenceModel(const Params& params,
- bool enableProfiling,
- const std::string& dynamicBackendsPath,
- const std::shared_ptr<armnn::IRuntime>& runtime = nullptr)
- : m_EnableProfiling(enableProfiling)
- , m_DynamicBackendsPath(dynamicBackendsPath)
- {
- if (runtime)
- {
- m_Runtime = runtime;
- }
- else
- {
- armnn::IRuntime::CreationOptions options;
- options.m_EnableGpuProfiling = m_EnableProfiling;
- options.m_DynamicBackendsPath = m_DynamicBackendsPath;
- m_Runtime = std::move(armnn::IRuntime::Create(options));
- }
-
- std::string invalidBackends;
- if (!CheckRequestedBackendsAreValid(params.m_ComputeDevices, armnn::Optional<std::string&>(invalidBackends)))
- {
- throw armnn::Exception("Some backend IDs are invalid: " + invalidBackends);
- }
-
- armnn::INetworkPtr network = CreateNetworkImpl<IParser>::Create(params, m_InputBindings, m_OutputBindings);
-
- armnn::IOptimizedNetworkPtr optNet{nullptr, [](armnn::IOptimizedNetwork*){}};
- {
- ARMNN_SCOPED_HEAP_PROFILING("Optimizing");
-
- armnn::OptimizerOptions options;
- options.m_ReduceFp32ToFp16 = params.m_EnableFp16TurboMode;
- options.m_Debug = params.m_PrintIntermediateLayers;
-
- optNet = armnn::Optimize(*network, params.m_ComputeDevices, m_Runtime->GetDeviceSpec(), options);
- if (!optNet)
- {
- throw armnn::Exception("Optimize returned nullptr");
- }
- }
-
- if (params.m_VisualizePostOptimizationModel)
- {
- boost::filesystem::path filename = params.m_ModelPath;
- filename.replace_extension("dot");
- std::fstream file(filename.c_str(), std::ios_base::out);
- optNet->SerializeToDot(file);
- }
-
- armnn::Status ret;
- {
- ARMNN_SCOPED_HEAP_PROFILING("LoadNetwork");
- ret = m_Runtime->LoadNetwork(m_NetworkIdentifier, std::move(optNet));
- }
-
- if (ret == armnn::Status::Failure)
- {
- throw armnn::Exception("IRuntime::LoadNetwork failed");
- }
- }
-
- void CheckInputIndexIsValid(unsigned int inputIndex) const
- {
- if (m_InputBindings.size() < inputIndex + 1)
- {
- throw armnn::Exception(boost::str(boost::format("Input index out of range: %1%") % inputIndex));
- }
- }
-
- void CheckOutputIndexIsValid(unsigned int outputIndex) const
- {
- if (m_OutputBindings.size() < outputIndex + 1)
- {
- throw armnn::Exception(boost::str(boost::format("Output index out of range: %1%") % outputIndex));
- }
- }
-
- unsigned int GetInputSize(unsigned int inputIndex = 0u) const
- {
- CheckInputIndexIsValid(inputIndex);
- return m_InputBindings[inputIndex].second.GetNumElements();
- }
-
- unsigned int GetOutputSize(unsigned int outputIndex = 0u) const
- {
- CheckOutputIndexIsValid(outputIndex);
- return m_OutputBindings[outputIndex].second.GetNumElements();
- }
-
- std::chrono::duration<double, std::milli> Run(
- const std::vector<TContainer>& inputContainers,
- std::vector<TContainer>& outputContainers)
- {
- for (unsigned int i = 0; i < outputContainers.size(); ++i)
- {
- const unsigned int expectedOutputDataSize = GetOutputSize(i);
-
- boost::apply_visitor([expectedOutputDataSize, i](auto&& value)
- {
- const unsigned int actualOutputDataSize = boost::numeric_cast<unsigned int>(value.size());
- if (actualOutputDataSize < expectedOutputDataSize)
- {
- unsigned int outputIndex = boost::numeric_cast<unsigned int>(i);
- throw armnn::Exception(
- boost::str(boost::format("Not enough data for output #%1%: expected "
- "%2% elements, got %3%") % outputIndex % expectedOutputDataSize % actualOutputDataSize));
- }
- },
- outputContainers[i]);
- }
-
- std::shared_ptr<armnn::IProfiler> profiler = m_Runtime->GetProfiler(m_NetworkIdentifier);
- if (profiler)
- {
- profiler->EnableProfiling(m_EnableProfiling);
- }
-
- // Start timer to record inference time in EnqueueWorkload (in milliseconds)
- const auto start_time = GetCurrentTime();
-
- armnn::Status ret = m_Runtime->EnqueueWorkload(m_NetworkIdentifier,
- MakeInputTensors(inputContainers),
- MakeOutputTensors(outputContainers));
-
- const auto end_time = GetCurrentTime();
-
- // if profiling is enabled print out the results
- if (profiler && profiler->IsProfilingEnabled())
- {
- profiler->Print(std::cout);
- }
-
- if (ret == armnn::Status::Failure)
- {
- throw armnn::Exception("IRuntime::EnqueueWorkload failed");
- }
- else
- {
- return std::chrono::duration<double, std::milli>(end_time - start_time);
- }
- }
-
- const armnn::BindingPointInfo& GetInputBindingInfo(unsigned int inputIndex = 0u) const
- {
- CheckInputIndexIsValid(inputIndex);
- return m_InputBindings[inputIndex];
- }
-
- const std::vector<armnn::BindingPointInfo>& GetInputBindingInfos() const
- {
- return m_InputBindings;
- }
-
- const armnn::BindingPointInfo& GetOutputBindingInfo(unsigned int outputIndex = 0u) const
- {
- CheckOutputIndexIsValid(outputIndex);
- return m_OutputBindings[outputIndex];
- }
-
- const std::vector<armnn::BindingPointInfo>& GetOutputBindingInfos() const
- {
- return m_OutputBindings;
- }
-
- QuantizationParams GetQuantizationParams(unsigned int outputIndex = 0u) const
- {
- CheckOutputIndexIsValid(outputIndex);
- return std::make_pair(m_OutputBindings[outputIndex].second.GetQuantizationScale(),
- m_OutputBindings[outputIndex].second.GetQuantizationOffset());
- }
-
- QuantizationParams GetInputQuantizationParams(unsigned int inputIndex = 0u) const
- {
- CheckInputIndexIsValid(inputIndex);
- return std::make_pair(m_InputBindings[inputIndex].second.GetQuantizationScale(),
- m_InputBindings[inputIndex].second.GetQuantizationOffset());
- }
-
- std::vector<QuantizationParams> GetAllQuantizationParams() const
- {
- std::vector<QuantizationParams> quantizationParams;
- for (unsigned int i = 0u; i < m_OutputBindings.size(); i++)
- {
- quantizationParams.push_back(GetQuantizationParams(i));
- }
- return quantizationParams;
- }
-
-private:
- armnn::NetworkId m_NetworkIdentifier;
- std::shared_ptr<armnn::IRuntime> m_Runtime;
-
- std::vector<armnn::BindingPointInfo> m_InputBindings;
- std::vector<armnn::BindingPointInfo> m_OutputBindings;
- bool m_EnableProfiling;
- std::string m_DynamicBackendsPath;
-
- template<typename TContainer>
- armnn::InputTensors MakeInputTensors(const std::vector<TContainer>& inputDataContainers)
- {
- return armnnUtils::MakeInputTensors(m_InputBindings, inputDataContainers);
- }
-
- template<typename TContainer>
- armnn::OutputTensors MakeOutputTensors(std::vector<TContainer>& outputDataContainers)
- {
- return armnnUtils::MakeOutputTensors(m_OutputBindings, outputDataContainers);
- }
-
- std::chrono::high_resolution_clock::time_point GetCurrentTime()
- {
- return std::chrono::high_resolution_clock::now();
- }
-
- std::chrono::duration<double, std::milli> GetTimeDuration(
- std::chrono::high_resolution_clock::time_point& start_time,
- std::chrono::high_resolution_clock::time_point& end_time)
- {
- return std::chrono::duration<double, std::milli>(end_time - start_time);
- }
-
-};
diff --git a/tests/InferenceTest.cpp b/tests/InferenceTest.cpp
deleted file mode 100644
index c6e5011ae4..0000000000
--- a/tests/InferenceTest.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "InferenceTest.hpp"
-
-#include "../src/armnn/Profiling.hpp"
-#include <boost/algorithm/string.hpp>
-#include <boost/numeric/conversion/cast.hpp>
-#include <boost/filesystem/path.hpp>
-#include <boost/assert.hpp>
-#include <boost/format.hpp>
-#include <boost/program_options.hpp>
-#include <boost/filesystem/operations.hpp>
-
-#include <fstream>
-#include <iostream>
-#include <iomanip>
-#include <array>
-
-using namespace std;
-using namespace std::chrono;
-using namespace armnn::test;
-
-namespace armnn
-{
-namespace test
-{
-/// Parse the command line of an ArmNN (or referencetests) inference test program.
-/// \return false if any error occurred during options processing, otherwise true
-bool ParseCommandLine(int argc, char** argv, IInferenceTestCaseProvider& testCaseProvider,
- InferenceTestOptions& outParams)
-{
- namespace po = boost::program_options;
-
- po::options_description desc("Options");
-
- try
- {
- // Adds generic options needed for all inference tests.
- desc.add_options()
- ("help", "Display help messages")
- ("iterations,i", po::value<unsigned int>(&outParams.m_IterationCount)->default_value(0),
- "Sets the number number of inferences to perform. If unset, a default number will be ran.")
- ("inference-times-file", po::value<std::string>(&outParams.m_InferenceTimesFile)->default_value(""),
- "If non-empty, each individual inference time will be recorded and output to this file")
- ("event-based-profiling,e", po::value<bool>(&outParams.m_EnableProfiling)->default_value(0),
- "Enables built in profiler. If unset, defaults to off.");
-
- // Adds options specific to the ITestCaseProvider.
- testCaseProvider.AddCommandLineOptions(desc);
- }
- catch (const std::exception& e)
- {
- // Coverity points out that default_value(...) can throw a bad_lexical_cast,
- // and that desc.add_options() can throw boost::io::too_few_args.
- // They really won't in any of these cases.
- BOOST_ASSERT_MSG(false, "Caught unexpected exception");
- std::cerr << "Fatal internal error: " << e.what() << std::endl;
- return false;
- }
-
- po::variables_map vm;
-
- try
- {
- po::store(po::parse_command_line(argc, argv, desc), vm);
-
- if (vm.count("help"))
- {
- std::cout << desc << std::endl;
- return false;
- }
-
- po::notify(vm);
- }
- catch (po::error& e)
- {
- std::cerr << e.what() << std::endl << std::endl;
- std::cerr << desc << std::endl;
- return false;
- }
-
- if (!testCaseProvider.ProcessCommandLineOptions(outParams))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateDirectory(std::string& dir)
-{
- if (dir.empty())
- {
- std::cerr << "No directory specified" << std::endl;
- return false;
- }
-
- if (dir[dir.length() - 1] != '/')
- {
- dir += "/";
- }
-
- if (!boost::filesystem::exists(dir))
- {
- std::cerr << "Given directory " << dir << " does not exist" << std::endl;
- return false;
- }
-
- if (!boost::filesystem::is_directory(dir))
- {
- std::cerr << "Given directory [" << dir << "] is not a directory" << std::endl;
- return false;
- }
-
- return true;
-}
-
-bool InferenceTest(const InferenceTestOptions& params,
- const std::vector<unsigned int>& defaultTestCaseIds,
- IInferenceTestCaseProvider& testCaseProvider)
-{
-#if !defined (NDEBUG)
- if (params.m_IterationCount > 0) // If just running a few select images then don't bother to warn.
- {
- ARMNN_LOG(warning) << "Performance test running in DEBUG build - results may be inaccurate.";
- }
-#endif
-
- double totalTime = 0;
- unsigned int nbProcessed = 0;
- bool success = true;
-
- // Opens the file to write inference times too, if needed.
- ofstream inferenceTimesFile;
- const bool recordInferenceTimes = !params.m_InferenceTimesFile.empty();
- if (recordInferenceTimes)
- {
- inferenceTimesFile.open(params.m_InferenceTimesFile.c_str(), ios_base::trunc | ios_base::out);
- if (!inferenceTimesFile.good())
- {
- ARMNN_LOG(error) << "Failed to open inference times file for writing: "
- << params.m_InferenceTimesFile;
- return false;
- }
- }
-
- // Create a profiler and register it for the current thread.
- std::unique_ptr<Profiler> profiler = std::make_unique<Profiler>();
- ProfilerManager::GetInstance().RegisterProfiler(profiler.get());
-
- // Enable profiling if requested.
- profiler->EnableProfiling(params.m_EnableProfiling);
-
- // Run a single test case to 'warm-up' the model. The first one can sometimes take up to 10x longer
- std::unique_ptr<IInferenceTestCase> warmupTestCase = testCaseProvider.GetTestCase(0);
- if (warmupTestCase == nullptr)
- {
- ARMNN_LOG(error) << "Failed to load test case";
- return false;
- }
-
- try
- {
- warmupTestCase->Run();
- }
- catch (const TestFrameworkException& testError)
- {
- ARMNN_LOG(error) << testError.what();
- return false;
- }
-
- const unsigned int nbTotalToProcess = params.m_IterationCount > 0 ? params.m_IterationCount
- : static_cast<unsigned int>(defaultTestCaseIds.size());
-
- for (; nbProcessed < nbTotalToProcess; nbProcessed++)
- {
- const unsigned int testCaseId = params.m_IterationCount > 0 ? nbProcessed : defaultTestCaseIds[nbProcessed];
- std::unique_ptr<IInferenceTestCase> testCase = testCaseProvider.GetTestCase(testCaseId);
-
- if (testCase == nullptr)
- {
- ARMNN_LOG(error) << "Failed to load test case";
- return false;
- }
-
- time_point<high_resolution_clock> predictStart;
- time_point<high_resolution_clock> predictEnd;
-
- TestCaseResult result = TestCaseResult::Ok;
-
- try
- {
- predictStart = high_resolution_clock::now();
-
- testCase->Run();
-
- predictEnd = high_resolution_clock::now();
-
- // duration<double> will convert the time difference into seconds as a double by default.
- double timeTakenS = duration<double>(predictEnd - predictStart).count();
- totalTime += timeTakenS;
-
- // Outputss inference times, if needed.
- if (recordInferenceTimes)
- {
- inferenceTimesFile << testCaseId << " " << (timeTakenS * 1000.0) << std::endl;
- }
-
- result = testCase->ProcessResult(params);
-
- }
- catch (const TestFrameworkException& testError)
- {
- ARMNN_LOG(error) << testError.what();
- result = TestCaseResult::Abort;
- }
-
- switch (result)
- {
- case TestCaseResult::Ok:
- break;
- case TestCaseResult::Abort:
- return false;
- case TestCaseResult::Failed:
- // This test failed so we will fail the entire program eventually, but keep going for now.
- success = false;
- break;
- default:
- BOOST_ASSERT_MSG(false, "Unexpected TestCaseResult");
- return false;
- }
- }
-
- const double averageTimePerTestCaseMs = totalTime / nbProcessed * 1000.0f;
-
- ARMNN_LOG(info) << std::fixed << std::setprecision(3) <<
- "Total time for " << nbProcessed << " test cases: " << totalTime << " seconds";
- ARMNN_LOG(info) << std::fixed << std::setprecision(3) <<
- "Average time per test case: " << averageTimePerTestCaseMs << " ms";
-
- // if profiling is enabled print out the results
- if (profiler && profiler->IsProfilingEnabled())
- {
- profiler->Print(std::cout);
- }
-
- if (!success)
- {
- ARMNN_LOG(error) << "One or more test cases failed";
- return false;
- }
-
- return testCaseProvider.OnInferenceTestFinished();
-}
-
-} // namespace test
-
-} // namespace armnn
diff --git a/tests/InferenceTest.hpp b/tests/InferenceTest.hpp
deleted file mode 100644
index 6423d1c7ff..0000000000
--- a/tests/InferenceTest.hpp
+++ /dev/null
@@ -1,236 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#pragma once
-
-#include <armnn/ArmNN.hpp>
-#include <armnn/Logging.hpp>
-#include <armnn/TypesUtils.hpp>
-#include "InferenceModel.hpp"
-
-#include <boost/core/ignore_unused.hpp>
-#include <boost/program_options.hpp>
-
-
-namespace armnn
-{
-
-inline std::istream& operator>>(std::istream& in, armnn::Compute& compute)
-{
- std::string token;
- in >> token;
- compute = armnn::ParseComputeDevice(token.c_str());
- if (compute == armnn::Compute::Undefined)
- {
- in.setstate(std::ios_base::failbit);
- throw boost::program_options::validation_error(boost::program_options::validation_error::invalid_option_value);
- }
- return in;
-}
-
-inline std::istream& operator>>(std::istream& in, armnn::BackendId& backend)
-{
- std::string token;
- in >> token;
- armnn::Compute compute = armnn::ParseComputeDevice(token.c_str());
- if (compute == armnn::Compute::Undefined)
- {
- in.setstate(std::ios_base::failbit);
- throw boost::program_options::validation_error(boost::program_options::validation_error::invalid_option_value);
- }
- backend = compute;
- return in;
-}
-
-namespace test
-{
-
-class TestFrameworkException : public Exception
-{
-public:
- using Exception::Exception;
-};
-
-struct InferenceTestOptions
-{
- unsigned int m_IterationCount;
- std::string m_InferenceTimesFile;
- bool m_EnableProfiling;
- std::string m_DynamicBackendsPath;
-
- InferenceTestOptions()
- : m_IterationCount(0)
- , m_EnableProfiling(0)
- , m_DynamicBackendsPath()
- {}
-};
-
-enum class TestCaseResult
-{
- /// The test completed without any errors.
- Ok,
- /// The test failed (e.g. the prediction didn't match the validation file).
- /// This will eventually fail the whole program but the remaining test cases will still be run.
- Failed,
- /// The test failed with a fatal error. The remaining tests will not be run.
- Abort
-};
-
-class IInferenceTestCase
-{
-public:
- virtual ~IInferenceTestCase() {}
-
- virtual void Run() = 0;
- virtual TestCaseResult ProcessResult(const InferenceTestOptions& options) = 0;
-};
-
-class IInferenceTestCaseProvider
-{
-public:
- virtual ~IInferenceTestCaseProvider() {}
-
- virtual void AddCommandLineOptions(boost::program_options::options_description& options)
- {
- boost::ignore_unused(options);
- };
- virtual bool ProcessCommandLineOptions(const InferenceTestOptions &commonOptions)
- {
- boost::ignore_unused(commonOptions);
- return true;
- };
- virtual std::unique_ptr<IInferenceTestCase> GetTestCase(unsigned int testCaseId) = 0;
- virtual bool OnInferenceTestFinished() { return true; };
-};
-
-template <typename TModel>
-class InferenceModelTestCase : public IInferenceTestCase
-{
-public:
- using TContainer = boost::variant<std::vector<float>, std::vector<int>, std::vector<unsigned char>>;
-
- InferenceModelTestCase(TModel& model,
- unsigned int testCaseId,
- const std::vector<TContainer>& inputs,
- const std::vector<unsigned int>& outputSizes)
- : m_Model(model)
- , m_TestCaseId(testCaseId)
- , m_Inputs(std::move(inputs))
- {
- // Initialize output vector
- const size_t numOutputs = outputSizes.size();
- m_Outputs.reserve(numOutputs);
-
- for (size_t i = 0; i < numOutputs; i++)
- {
- m_Outputs.push_back(std::vector<typename TModel::DataType>(outputSizes[i]));
- }
- }
-
- virtual void Run() override
- {
- m_Model.Run(m_Inputs, m_Outputs);
- }
-
-protected:
- unsigned int GetTestCaseId() const { return m_TestCaseId; }
- const std::vector<TContainer>& GetOutputs() const { return m_Outputs; }
-
-private:
- TModel& m_Model;
- unsigned int m_TestCaseId;
- std::vector<TContainer> m_Inputs;
- std::vector<TContainer> m_Outputs;
-};
-
-template <typename TTestCaseDatabase, typename TModel>
-class ClassifierTestCase : public InferenceModelTestCase<TModel>
-{
-public:
- ClassifierTestCase(int& numInferencesRef,
- int& numCorrectInferencesRef,
- const std::vector<unsigned int>& validationPredictions,
- std::vector<unsigned int>* validationPredictionsOut,
- TModel& model,
- unsigned int testCaseId,
- unsigned int label,
- std::vector<typename TModel::DataType> modelInput);
-
- virtual TestCaseResult ProcessResult(const InferenceTestOptions& params) override;
-
-private:
- unsigned int m_Label;
- InferenceModelInternal::QuantizationParams m_QuantizationParams;
-
- /// These fields reference the corresponding member in the ClassifierTestCaseProvider.
- /// @{
- int& m_NumInferencesRef;
- int& m_NumCorrectInferencesRef;
- const std::vector<unsigned int>& m_ValidationPredictions;
- std::vector<unsigned int>* m_ValidationPredictionsOut;
- /// @}
-};
-
-template <typename TDatabase, typename InferenceModel>
-class ClassifierTestCaseProvider : public IInferenceTestCaseProvider
-{
-public:
- template <typename TConstructDatabaseCallable, typename TConstructModelCallable>
- ClassifierTestCaseProvider(TConstructDatabaseCallable constructDatabase, TConstructModelCallable constructModel);
-
- virtual void AddCommandLineOptions(boost::program_options::options_description& options) override;
- virtual bool ProcessCommandLineOptions(const InferenceTestOptions &commonOptions) override;
- virtual std::unique_ptr<IInferenceTestCase> GetTestCase(unsigned int testCaseId) override;
- virtual bool OnInferenceTestFinished() override;
-
-private:
- void ReadPredictions();
-
- typename InferenceModel::CommandLineOptions m_ModelCommandLineOptions;
- std::function<std::unique_ptr<InferenceModel>(const InferenceTestOptions& commonOptions,
- typename InferenceModel::CommandLineOptions)> m_ConstructModel;
- std::unique_ptr<InferenceModel> m_Model;
-
- std::string m_DataDir;
- std::function<TDatabase(const char*, const InferenceModel&)> m_ConstructDatabase;
- std::unique_ptr<TDatabase> m_Database;
-
- int m_NumInferences; // Referenced by test cases.
- int m_NumCorrectInferences; // Referenced by test cases.
-
- std::string m_ValidationFileIn;
- std::vector<unsigned int> m_ValidationPredictions; // Referenced by test cases.
-
- std::string m_ValidationFileOut;
- std::vector<unsigned int> m_ValidationPredictionsOut; // Referenced by test cases.
-};
-
-bool ParseCommandLine(int argc, char** argv, IInferenceTestCaseProvider& testCaseProvider,
- InferenceTestOptions& outParams);
-
-bool ValidateDirectory(std::string& dir);
-
-bool InferenceTest(const InferenceTestOptions& params,
- const std::vector<unsigned int>& defaultTestCaseIds,
- IInferenceTestCaseProvider& testCaseProvider);
-
-template<typename TConstructTestCaseProvider>
-int InferenceTestMain(int argc,
- char* argv[],
- const std::vector<unsigned int>& defaultTestCaseIds,
- TConstructTestCaseProvider constructTestCaseProvider);
-
-template<typename TDatabase,
- typename TParser,
- typename TConstructDatabaseCallable>
-int ClassifierInferenceTestMain(int argc, char* argv[], const char* modelFilename, bool isModelBinary,
- const char* inputBindingName, const char* outputBindingName,
- const std::vector<unsigned int>& defaultTestCaseIds,
- TConstructDatabaseCallable constructDatabase,
- const armnn::TensorShape* inputTensorShape = nullptr);
-
-} // namespace test
-} // namespace armnn
-
-#include "InferenceTest.inl"
diff --git a/tests/InferenceTest.inl b/tests/InferenceTest.inl
deleted file mode 100644
index c05e70d9f7..0000000000
--- a/tests/InferenceTest.inl
+++ /dev/null
@@ -1,407 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "InferenceTest.hpp"
-
-#include <boost/algorithm/string.hpp>
-#include <boost/numeric/conversion/cast.hpp>
-#include <boost/filesystem/path.hpp>
-#include <boost/assert.hpp>
-#include <boost/format.hpp>
-#include <boost/program_options.hpp>
-#include <boost/filesystem/operations.hpp>
-
-#include <fstream>
-#include <iostream>
-#include <iomanip>
-#include <array>
-#include <chrono>
-
-using namespace std;
-using namespace std::chrono;
-using namespace armnn::test;
-
-namespace armnn
-{
-namespace test
-{
-
-using TContainer = boost::variant<std::vector<float>, std::vector<int>, std::vector<unsigned char>>;
-
-template <typename TTestCaseDatabase, typename TModel>
-ClassifierTestCase<TTestCaseDatabase, TModel>::ClassifierTestCase(
- int& numInferencesRef,
- int& numCorrectInferencesRef,
- const std::vector<unsigned int>& validationPredictions,
- std::vector<unsigned int>* validationPredictionsOut,
- TModel& model,
- unsigned int testCaseId,
- unsigned int label,
- std::vector<typename TModel::DataType> modelInput)
- : InferenceModelTestCase<TModel>(
- model, testCaseId, std::vector<TContainer>{ modelInput }, { model.GetOutputSize() })
- , m_Label(label)
- , m_QuantizationParams(model.GetQuantizationParams())
- , m_NumInferencesRef(numInferencesRef)
- , m_NumCorrectInferencesRef(numCorrectInferencesRef)
- , m_ValidationPredictions(validationPredictions)
- , m_ValidationPredictionsOut(validationPredictionsOut)
-{
-}
-
-struct ClassifierResultProcessor : public boost::static_visitor<>
-{
- using ResultMap = std::map<float,int>;
-
- ClassifierResultProcessor(float scale, int offset)
- : m_Scale(scale)
- , m_Offset(offset)
- {}
-
- void operator()(const std::vector<float>& values)
- {
- SortPredictions(values, [](float value)
- {
- return value;
- });
- }
-
- void operator()(const std::vector<uint8_t>& values)
- {
- auto& scale = m_Scale;
- auto& offset = m_Offset;
- SortPredictions(values, [&scale, &offset](uint8_t value)
- {
- return armnn::Dequantize(value, scale, offset);
- });
- }
-
- void operator()(const std::vector<int>& values)
- {
- boost::ignore_unused(values);
- BOOST_ASSERT_MSG(false, "Non-float predictions output not supported.");
- }
-
- ResultMap& GetResultMap() { return m_ResultMap; }
-
-private:
- template<typename Container, typename Delegate>
- void SortPredictions(const Container& c, Delegate delegate)
- {
- int index = 0;
- for (const auto& value : c)
- {
- int classification = index++;
- // Take the first class with each probability
- // This avoids strange results when looping over batched results produced
- // with identical test data.
- ResultMap::iterator lb = m_ResultMap.lower_bound(value);
-
- if (lb == m_ResultMap.end() || !m_ResultMap.key_comp()(value, lb->first))
- {
- // If the key is not already in the map, insert it.
- m_ResultMap.insert(lb, ResultMap::value_type(delegate(value), classification));
- }
- }
- }
-
- ResultMap m_ResultMap;
-
- float m_Scale=0.0f;
- int m_Offset=0;
-};
-
-template <typename TTestCaseDatabase, typename TModel>
-TestCaseResult ClassifierTestCase<TTestCaseDatabase, TModel>::ProcessResult(const InferenceTestOptions& params)
-{
- auto& output = this->GetOutputs()[0];
- const auto testCaseId = this->GetTestCaseId();
-
- ClassifierResultProcessor resultProcessor(m_QuantizationParams.first, m_QuantizationParams.second);
- boost::apply_visitor(resultProcessor, output);
-
- ARMNN_LOG(info) << "= Prediction values for test #" << testCaseId;
- auto it = resultProcessor.GetResultMap().rbegin();
- for (int i=0; i<5 && it != resultProcessor.GetResultMap().rend(); ++i)
- {
- ARMNN_LOG(info) << "Top(" << (i+1) << ") prediction is " << it->second <<
- " with value: " << (it->first);
- ++it;
- }
-
- unsigned int prediction = 0;
- boost::apply_visitor([&](auto&& value)
- {
- prediction = boost::numeric_cast<unsigned int>(
- std::distance(value.begin(), std::max_element(value.begin(), value.end())));
- },
- output);
-
- // If we're just running the defaultTestCaseIds, each one must be classified correctly.
- if (params.m_IterationCount == 0 && prediction != m_Label)
- {
- ARMNN_LOG(error) << "Prediction for test case " << testCaseId << " (" << prediction << ")" <<
- " is incorrect (should be " << m_Label << ")";
- return TestCaseResult::Failed;
- }
-
- // If a validation file was provided as input, it checks that the prediction matches.
- if (!m_ValidationPredictions.empty() && prediction != m_ValidationPredictions[testCaseId])
- {
- ARMNN_LOG(error) << "Prediction for test case " << testCaseId << " (" << prediction << ")" <<
- " doesn't match the prediction in the validation file (" << m_ValidationPredictions[testCaseId] << ")";
- return TestCaseResult::Failed;
- }
-
- // If a validation file was requested as output, it stores the predictions.
- if (m_ValidationPredictionsOut)
- {
- m_ValidationPredictionsOut->push_back(prediction);
- }
-
- // Updates accuracy stats.
- m_NumInferencesRef++;
- if (prediction == m_Label)
- {
- m_NumCorrectInferencesRef++;
- }
-
- return TestCaseResult::Ok;
-}
-
-template <typename TDatabase, typename InferenceModel>
-template <typename TConstructDatabaseCallable, typename TConstructModelCallable>
-ClassifierTestCaseProvider<TDatabase, InferenceModel>::ClassifierTestCaseProvider(
- TConstructDatabaseCallable constructDatabase, TConstructModelCallable constructModel)
- : m_ConstructModel(constructModel)
- , m_ConstructDatabase(constructDatabase)
- , m_NumInferences(0)
- , m_NumCorrectInferences(0)
-{
-}
-
-template <typename TDatabase, typename InferenceModel>
-void ClassifierTestCaseProvider<TDatabase, InferenceModel>::AddCommandLineOptions(
- boost::program_options::options_description& options)
-{
- namespace po = boost::program_options;
-
- options.add_options()
- ("validation-file-in", po::value<std::string>(&m_ValidationFileIn)->default_value(""),
- "Reads expected predictions from the given file and confirms they match the actual predictions.")
- ("validation-file-out", po::value<std::string>(&m_ValidationFileOut)->default_value(""),
- "Predictions are saved to the given file for later use via --validation-file-in.")
- ("data-dir,d", po::value<std::string>(&m_DataDir)->required(),
- "Path to directory containing test data");
-
- InferenceModel::AddCommandLineOptions(options, m_ModelCommandLineOptions);
-}
-
-template <typename TDatabase, typename InferenceModel>
-bool ClassifierTestCaseProvider<TDatabase, InferenceModel>::ProcessCommandLineOptions(
- const InferenceTestOptions& commonOptions)
-{
- if (!ValidateDirectory(m_DataDir))
- {
- return false;
- }
-
- ReadPredictions();
-
- m_Model = m_ConstructModel(commonOptions, m_ModelCommandLineOptions);
- if (!m_Model)
- {
- return false;
- }
-
- m_Database = std::make_unique<TDatabase>(m_ConstructDatabase(m_DataDir.c_str(), *m_Model));
- if (!m_Database)
- {
- return false;
- }
-
- return true;
-}
-
-template <typename TDatabase, typename InferenceModel>
-std::unique_ptr<IInferenceTestCase>
-ClassifierTestCaseProvider<TDatabase, InferenceModel>::GetTestCase(unsigned int testCaseId)
-{
- std::unique_ptr<typename TDatabase::TTestCaseData> testCaseData = m_Database->GetTestCaseData(testCaseId);
- if (testCaseData == nullptr)
- {
- return nullptr;
- }
-
- return std::make_unique<ClassifierTestCase<TDatabase, InferenceModel>>(
- m_NumInferences,
- m_NumCorrectInferences,
- m_ValidationPredictions,
- m_ValidationFileOut.empty() ? nullptr : &m_ValidationPredictionsOut,
- *m_Model,
- testCaseId,
- testCaseData->m_Label,
- std::move(testCaseData->m_InputImage));
-}
-
-template <typename TDatabase, typename InferenceModel>
-bool ClassifierTestCaseProvider<TDatabase, InferenceModel>::OnInferenceTestFinished()
-{
- const double accuracy = boost::numeric_cast<double>(m_NumCorrectInferences) /
- boost::numeric_cast<double>(m_NumInferences);
- ARMNN_LOG(info) << std::fixed << std::setprecision(3) << "Overall accuracy: " << accuracy;
-
- // If a validation file was requested as output, the predictions are saved to it.
- if (!m_ValidationFileOut.empty())
- {
- std::ofstream validationFileOut(m_ValidationFileOut.c_str(), std::ios_base::trunc | std::ios_base::out);
- if (validationFileOut.good())
- {
- for (const unsigned int prediction : m_ValidationPredictionsOut)
- {
- validationFileOut << prediction << std::endl;
- }
- }
- else
- {
- ARMNN_LOG(error) << "Failed to open output validation file: " << m_ValidationFileOut;
- return false;
- }
- }
-
- return true;
-}
-
-template <typename TDatabase, typename InferenceModel>
-void ClassifierTestCaseProvider<TDatabase, InferenceModel>::ReadPredictions()
-{
- // Reads the expected predictions from the input validation file (if provided).
- if (!m_ValidationFileIn.empty())
- {
- std::ifstream validationFileIn(m_ValidationFileIn.c_str(), std::ios_base::in);
- if (validationFileIn.good())
- {
- while (!validationFileIn.eof())
- {
- unsigned int i;
- validationFileIn >> i;
- m_ValidationPredictions.emplace_back(i);
- }
- }
- else
- {
- throw armnn::Exception(boost::str(boost::format("Failed to open input validation file: %1%")
- % m_ValidationFileIn));
- }
- }
-}
-
-template<typename TConstructTestCaseProvider>
-int InferenceTestMain(int argc,
- char* argv[],
- const std::vector<unsigned int>& defaultTestCaseIds,
- TConstructTestCaseProvider constructTestCaseProvider)
-{
- // Configures logging for both the ARMNN library and this test program.
-#ifdef NDEBUG
- armnn::LogSeverity level = armnn::LogSeverity::Info;
-#else
- armnn::LogSeverity level = armnn::LogSeverity::Debug;
-#endif
- armnn::ConfigureLogging(true, true, level);
-
- try
- {
- std::unique_ptr<IInferenceTestCaseProvider> testCaseProvider = constructTestCaseProvider();
- if (!testCaseProvider)
- {
- return 1;
- }
-
- InferenceTestOptions inferenceTestOptions;
- if (!ParseCommandLine(argc, argv, *testCaseProvider, inferenceTestOptions))
- {
- return 1;
- }
-
- const bool success = InferenceTest(inferenceTestOptions, defaultTestCaseIds, *testCaseProvider);
- return success ? 0 : 1;
- }
- catch (armnn::Exception const& e)
- {
- ARMNN_LOG(fatal) << "Armnn Error: " << e.what();
- return 1;
- }
-}
-
-//
-// This function allows us to create a classifier inference test based on:
-// - a model file name
-// - which can be a binary or a text file for protobuf formats
-// - an input tensor name
-// - an output tensor name
-// - a set of test case ids
-// - a callback method which creates an object that can return images
-// called 'Database' in these tests
-// - and an input tensor shape
-//
-template<typename TDatabase,
- typename TParser,
- typename TConstructDatabaseCallable>
-int ClassifierInferenceTestMain(int argc,
- char* argv[],
- const char* modelFilename,
- bool isModelBinary,
- const char* inputBindingName,
- const char* outputBindingName,
- const std::vector<unsigned int>& defaultTestCaseIds,
- TConstructDatabaseCallable constructDatabase,
- const armnn::TensorShape* inputTensorShape)
-
-{
- BOOST_ASSERT(modelFilename);
- BOOST_ASSERT(inputBindingName);
- BOOST_ASSERT(outputBindingName);
-
- return InferenceTestMain(argc, argv, defaultTestCaseIds,
- [=]
- ()
- {
- using InferenceModel = InferenceModel<TParser, typename TDatabase::DataType>;
- using TestCaseProvider = ClassifierTestCaseProvider<TDatabase, InferenceModel>;
-
- return make_unique<TestCaseProvider>(constructDatabase,
- [&]
- (const InferenceTestOptions &commonOptions,
- typename InferenceModel::CommandLineOptions modelOptions)
- {
- if (!ValidateDirectory(modelOptions.m_ModelDir))
- {
- return std::unique_ptr<InferenceModel>();
- }
-
- typename InferenceModel::Params modelParams;
- modelParams.m_ModelPath = modelOptions.m_ModelDir + modelFilename;
- modelParams.m_InputBindings = { inputBindingName };
- modelParams.m_OutputBindings = { outputBindingName };
-
- if (inputTensorShape)
- {
- modelParams.m_InputShapes.push_back(*inputTensorShape);
- }
-
- modelParams.m_IsModelBinary = isModelBinary;
- modelParams.m_ComputeDevices = modelOptions.GetComputeDevicesAsBackendIds();
- modelParams.m_VisualizePostOptimizationModel = modelOptions.m_VisualizePostOptimizationModel;
- modelParams.m_EnableFp16TurboMode = modelOptions.m_EnableFp16TurboMode;
-
- return std::make_unique<InferenceModel>(modelParams,
- commonOptions.m_EnableProfiling,
- commonOptions.m_DynamicBackendsPath);
- });
- });
-}
-
-} // namespace test
-} // namespace armnn
diff --git a/tests/InferenceTestImage.cpp b/tests/InferenceTestImage.cpp
deleted file mode 100644
index 92c67ae225..0000000000
--- a/tests/InferenceTestImage.cpp
+++ /dev/null
@@ -1,363 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "InferenceTestImage.hpp"
-
-#include <boost/core/ignore_unused.hpp>
-#include <boost/format.hpp>
-#include <boost/core/ignore_unused.hpp>
-#include <boost/numeric/conversion/cast.hpp>
-
-#include <array>
-
-#define STB_IMAGE_IMPLEMENTATION
-#include <stb/stb_image.h>
-
-#define STB_IMAGE_RESIZE_IMPLEMENTATION
-#include <stb/stb_image_resize.h>
-
-#define STB_IMAGE_WRITE_IMPLEMENTATION
-#include <stb/stb_image_write.h>
-
-namespace
-{
-
-unsigned int GetImageChannelIndex(ImageChannelLayout channelLayout, ImageChannel channel)
-{
- switch (channelLayout)
- {
- case ImageChannelLayout::Rgb:
- return static_cast<unsigned int>(channel);
- case ImageChannelLayout::Bgr:
- return 2u - static_cast<unsigned int>(channel);
- default:
- throw UnknownImageChannelLayout(boost::str(boost::format("Unknown layout %1%")
- % static_cast<int>(channelLayout)));
- }
-}
-
-inline float Lerp(float a, float b, float w)
-{
- return w * b + (1.f - w) * a;
-}
-
-inline void PutData(std::vector<float> & data,
- const unsigned int width,
- const unsigned int x,
- const unsigned int y,
- const unsigned int c,
- float value)
-{
- data[(3*((y*width)+x)) + c] = value;
-}
-
-std::vector<float> ResizeBilinearAndNormalize(const InferenceTestImage & image,
- const unsigned int outputWidth,
- const unsigned int outputHeight,
- const float scale,
- const std::array<float, 3>& mean,
- const std::array<float, 3>& stddev)
-{
- std::vector<float> out;
- out.resize(outputWidth * outputHeight * 3);
-
- // We follow the definition of TensorFlow and AndroidNN: the top-left corner of a texel in the output
- // image is projected into the input image to figure out the interpolants and weights. Note that this
- // will yield different results than if projecting the centre of output texels.
-
- const unsigned int inputWidth = image.GetWidth();
- const unsigned int inputHeight = image.GetHeight();
-
- // How much to scale pixel coordinates in the output image to get the corresponding pixel coordinates
- // in the input image.
- const float scaleY = boost::numeric_cast<float>(inputHeight) / boost::numeric_cast<float>(outputHeight);
- const float scaleX = boost::numeric_cast<float>(inputWidth) / boost::numeric_cast<float>(outputWidth);
-
- uint8_t rgb_x0y0[3];
- uint8_t rgb_x1y0[3];
- uint8_t rgb_x0y1[3];
- uint8_t rgb_x1y1[3];
-
- for (unsigned int y = 0; y < outputHeight; ++y)
- {
- // Corresponding real-valued height coordinate in input image.
- const float iy = boost::numeric_cast<float>(y) * scaleY;
-
- // Discrete height coordinate of top-left texel (in the 2x2 texel area used for interpolation).
- const float fiy = floorf(iy);
- const unsigned int y0 = boost::numeric_cast<unsigned int>(fiy);
-
- // Interpolation weight (range [0,1])
- const float yw = iy - fiy;
-
- for (unsigned int x = 0; x < outputWidth; ++x)
- {
- // Real-valued and discrete width coordinates in input image.
- const float ix = boost::numeric_cast<float>(x) * scaleX;
- const float fix = floorf(ix);
- const unsigned int x0 = boost::numeric_cast<unsigned int>(fix);
-
- // Interpolation weight (range [0,1]).
- const float xw = ix - fix;
-
- // Discrete width/height coordinates of texels below and to the right of (x0, y0).
- const unsigned int x1 = std::min(x0 + 1, inputWidth - 1u);
- const unsigned int y1 = std::min(y0 + 1, inputHeight - 1u);
-
- std::tie(rgb_x0y0[0], rgb_x0y0[1], rgb_x0y0[2]) = image.GetPixelAs3Channels(x0, y0);
- std::tie(rgb_x1y0[0], rgb_x1y0[1], rgb_x1y0[2]) = image.GetPixelAs3Channels(x1, y0);
- std::tie(rgb_x0y1[0], rgb_x0y1[1], rgb_x0y1[2]) = image.GetPixelAs3Channels(x0, y1);
- std::tie(rgb_x1y1[0], rgb_x1y1[1], rgb_x1y1[2]) = image.GetPixelAs3Channels(x1, y1);
-
- for (unsigned c=0; c<3; ++c)
- {
- const float ly0 = Lerp(float(rgb_x0y0[c]), float(rgb_x1y0[c]), xw);
- const float ly1 = Lerp(float(rgb_x0y1[c]), float(rgb_x1y1[c]), xw);
- const float l = Lerp(ly0, ly1, yw);
- PutData(out, outputWidth, x, y, c, ((l / scale) - mean[c]) / stddev[c]);
- }
- }
- }
- return out;
-}
-
-} // namespace
-
-InferenceTestImage::InferenceTestImage(char const* filePath)
- : m_Width(0u)
- , m_Height(0u)
- , m_NumChannels(0u)
-{
- int width;
- int height;
- int channels;
-
- using StbImageDataPtr = std::unique_ptr<unsigned char, decltype(&stbi_image_free)>;
- StbImageDataPtr stbData(stbi_load(filePath, &width, &height, &channels, 0), &stbi_image_free);
-
- if (stbData == nullptr)
- {
- throw InferenceTestImageLoadFailed(boost::str(boost::format("Could not load the image at %1%") % filePath));
- }
-
- if (width == 0 || height == 0)
- {
- throw InferenceTestImageLoadFailed(boost::str(boost::format("Could not load empty image at %1%") % filePath));
- }
-
- m_Width = boost::numeric_cast<unsigned int>(width);
- m_Height = boost::numeric_cast<unsigned int>(height);
- m_NumChannels = boost::numeric_cast<unsigned int>(channels);
-
- const unsigned int sizeInBytes = GetSizeInBytes();
- m_Data.resize(sizeInBytes);
- memcpy(m_Data.data(), stbData.get(), sizeInBytes);
-}
-
-std::tuple<uint8_t, uint8_t, uint8_t> InferenceTestImage::GetPixelAs3Channels(unsigned int x, unsigned int y) const
-{
- if (x >= m_Width || y >= m_Height)
- {
- throw InferenceTestImageOutOfBoundsAccess(boost::str(boost::format("Attempted out of bounds image access. "
- "Requested (%1%, %2%). Maximum valid coordinates (%3%, %4%).") % x % y % (m_Width - 1) % (m_Height - 1)));
- }
-
- const unsigned int pixelOffset = x * GetNumChannels() + y * GetWidth() * GetNumChannels();
- const uint8_t* const pixelData = m_Data.data() + pixelOffset;
- BOOST_ASSERT(pixelData <= (m_Data.data() + GetSizeInBytes()));
-
- std::array<uint8_t, 3> outPixelData;
- outPixelData.fill(0);
-
- const unsigned int maxChannelsInPixel = std::min(GetNumChannels(), static_cast<unsigned int>(outPixelData.size()));
- for (unsigned int c = 0; c < maxChannelsInPixel; ++c)
- {
- outPixelData[c] = pixelData[c];
- }
-
- return std::make_tuple(outPixelData[0], outPixelData[1], outPixelData[2]);
-}
-
-
-void InferenceTestImage::StbResize(InferenceTestImage& im, const unsigned int newWidth, const unsigned int newHeight)
-{
- std::vector<uint8_t> newData;
- newData.resize(newWidth * newHeight * im.GetNumChannels() * im.GetSingleElementSizeInBytes());
-
- // boost::numeric_cast<>() is used for user-provided data (protecting about overflows).
- // static_cast<> is ok for internal data (assumes that, when internal data was originally provided by a user,
- // a boost::numeric_cast<>() handled the conversion).
- const int nW = boost::numeric_cast<int>(newWidth);
- const int nH = boost::numeric_cast<int>(newHeight);
-
- const int w = static_cast<int>(im.GetWidth());
- const int h = static_cast<int>(im.GetHeight());
- const int numChannels = static_cast<int>(im.GetNumChannels());
-
- const int res = stbir_resize_uint8(im.m_Data.data(), w, h, 0, newData.data(), nW, nH, 0, numChannels);
- if (res == 0)
- {
- throw InferenceTestImageResizeFailed("The resizing operation failed");
- }
-
- im.m_Data.swap(newData);
- im.m_Width = newWidth;
- im.m_Height = newHeight;
-}
-
-std::vector<float> InferenceTestImage::Resize(unsigned int newWidth,
- unsigned int newHeight,
- const armnn::CheckLocation& location,
- const ResizingMethods meth,
- const std::array<float, 3>& mean,
- const std::array<float, 3>& stddev,
- const float scale)
-{
- std::vector<float> out;
- if (newWidth == 0 || newHeight == 0)
- {
- throw InferenceTestImageResizeFailed(boost::str(boost::format("None of the dimensions passed to a resize "
- "operation can be zero. Requested width: %1%. Requested height: %2%.") % newWidth % newHeight));
- }
-
- switch (meth) {
- case ResizingMethods::STB:
- {
- StbResize(*this, newWidth, newHeight);
- break;
- }
- case ResizingMethods::BilinearAndNormalized:
- {
- out = ResizeBilinearAndNormalize(*this, newWidth, newHeight, scale, mean, stddev);
- break;
- }
- default:
- throw InferenceTestImageResizeFailed(boost::str(
- boost::format("Unknown resizing method asked ArmNN only supports {STB, BilinearAndNormalized} %1%")
- % location.AsString()));
- }
- return out;
-}
-
-void InferenceTestImage::Write(WriteFormat format, const char* filePath) const
-{
- const int w = static_cast<int>(GetWidth());
- const int h = static_cast<int>(GetHeight());
- const int numChannels = static_cast<int>(GetNumChannels());
- int res = 0;
-
- switch (format)
- {
- case WriteFormat::Png:
- {
- res = stbi_write_png(filePath, w, h, numChannels, m_Data.data(), 0);
- break;
- }
- case WriteFormat::Bmp:
- {
- res = stbi_write_bmp(filePath, w, h, numChannels, m_Data.data());
- break;
- }
- case WriteFormat::Tga:
- {
- res = stbi_write_tga(filePath, w, h, numChannels, m_Data.data());
- break;
- }
- default:
- throw InferenceTestImageWriteFailed(boost::str(boost::format("Unknown format %1%")
- % static_cast<int>(format)));
- }
-
- if (res == 0)
- {
- throw InferenceTestImageWriteFailed(boost::str(boost::format("An error occurred when writing to file %1%")
- % filePath));
- }
-}
-
-template <typename TProcessValueCallable>
-std::vector<float> GetImageDataInArmNnLayoutAsFloats(ImageChannelLayout channelLayout,
- const InferenceTestImage& image,
- TProcessValueCallable processValue)
-{
- const unsigned int h = image.GetHeight();
- const unsigned int w = image.GetWidth();
-
- std::vector<float> imageData;
- imageData.resize(h * w * 3);
-
- for (unsigned int j = 0; j < h; ++j)
- {
- for (unsigned int i = 0; i < w; ++i)
- {
- uint8_t r, g, b;
- std::tie(r, g, b) = image.GetPixelAs3Channels(i, j);
-
- // ArmNN order: C, H, W
- const unsigned int rDstIndex = GetImageChannelIndex(channelLayout, ImageChannel::R) * h * w + j * w + i;
- const unsigned int gDstIndex = GetImageChannelIndex(channelLayout, ImageChannel::G) * h * w + j * w + i;
- const unsigned int bDstIndex = GetImageChannelIndex(channelLayout, ImageChannel::B) * h * w + j * w + i;
-
- imageData[rDstIndex] = processValue(ImageChannel::R, float(r));
- imageData[gDstIndex] = processValue(ImageChannel::G, float(g));
- imageData[bDstIndex] = processValue(ImageChannel::B, float(b));
- }
- }
-
- return imageData;
-}
-
-std::vector<float> GetImageDataInArmNnLayoutAsNormalizedFloats(ImageChannelLayout layout,
- const InferenceTestImage& image)
-{
- return GetImageDataInArmNnLayoutAsFloats(layout, image,
- [](ImageChannel channel, float value)
- {
- boost::ignore_unused(channel);
- return value / 255.f;
- });
-}
-
-std::vector<float> GetImageDataInArmNnLayoutAsFloatsSubtractingMean(ImageChannelLayout layout,
- const InferenceTestImage& image,
- const std::array<float, 3>& mean)
-{
- return GetImageDataInArmNnLayoutAsFloats(layout, image,
- [layout, &mean](ImageChannel channel, float value)
- {
- const unsigned int channelIndex = GetImageChannelIndex(layout, channel);
- return value - mean[channelIndex];
- });
-}
-
-std::vector<float> GetImageDataAsNormalizedFloats(ImageChannelLayout layout,
- const InferenceTestImage& image)
-{
- std::vector<float> imageData;
- const unsigned int h = image.GetHeight();
- const unsigned int w = image.GetWidth();
-
- const unsigned int rDstIndex = GetImageChannelIndex(layout, ImageChannel::R);
- const unsigned int gDstIndex = GetImageChannelIndex(layout, ImageChannel::G);
- const unsigned int bDstIndex = GetImageChannelIndex(layout, ImageChannel::B);
-
- imageData.resize(h * w * 3);
- unsigned int offset = 0;
-
- for (unsigned int j = 0; j < h; ++j)
- {
- for (unsigned int i = 0; i < w; ++i)
- {
- uint8_t r, g, b;
- std::tie(r, g, b) = image.GetPixelAs3Channels(i, j);
-
- imageData[offset+rDstIndex] = float(r) / 255.0f;
- imageData[offset+gDstIndex] = float(g) / 255.0f;
- imageData[offset+bDstIndex] = float(b) / 255.0f;
- offset += 3;
- }
- }
-
- return imageData;
-}
diff --git a/tests/InferenceTestImage.hpp b/tests/InferenceTestImage.hpp
deleted file mode 100644
index d15f263609..0000000000
--- a/tests/InferenceTestImage.hpp
+++ /dev/null
@@ -1,145 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#pragma once
-
-#include <armnn/Exceptions.hpp>
-#include <VerificationHelpers.hpp>
-
-#include <array>
-#include <cstdint>
-#include <vector>
-#include <utility>
-
-class InferenceTestImageException : public armnn::Exception
-{
-public:
- using Exception::Exception;
-};
-
-class InferenceTestImageLoadFailed : public InferenceTestImageException
-{
-public:
- using InferenceTestImageException::InferenceTestImageException;
-};
-
-class InferenceTestImageOutOfBoundsAccess : public InferenceTestImageException
-{
-public:
- using InferenceTestImageException::InferenceTestImageException;
-};
-
-class InferenceTestImageResizeFailed : public InferenceTestImageException
-{
-public:
- using InferenceTestImageException::InferenceTestImageException;
-};
-
-class InferenceTestImageWriteFailed : public InferenceTestImageException
-{
-public:
- using InferenceTestImageException::InferenceTestImageException;
-};
-
-class UnknownImageChannelLayout : public InferenceTestImageException
-{
-public:
- using InferenceTestImageException::InferenceTestImageException;
-};
-
-class InferenceTestImage
-{
-public:
- enum class WriteFormat
- {
- Png,
- Bmp,
- Tga
- };
-
- // Common names used to identify a channel in a pixel.
- enum class ResizingMethods
- {
- STB,
- BilinearAndNormalized,
- };
-
- explicit InferenceTestImage(const char* filePath);
-
- InferenceTestImage(InferenceTestImage&&) = delete;
- InferenceTestImage(const InferenceTestImage&) = delete;
- InferenceTestImage& operator=(const InferenceTestImage&) = delete;
- InferenceTestImage& operator=(InferenceTestImage&&) = delete;
-
- unsigned int GetWidth() const { return m_Width; }
- unsigned int GetHeight() const { return m_Height; }
- unsigned int GetNumChannels() const { return m_NumChannels; }
- unsigned int GetNumElements() const { return GetWidth() * GetHeight() * GetNumChannels(); }
- unsigned int GetSizeInBytes() const { return GetNumElements() * GetSingleElementSizeInBytes(); }
-
- // Returns the pixel identified by the given coordinates as a 3-channel value.
- // Channels beyond the third are dropped. If the image provides less than 3 channels, the non-existent
- // channels of the pixel will be filled with 0. Channels are returned in RGB order (that is, the first element
- // of the tuple corresponds to the Red channel, whereas the last element is the Blue channel).
- std::tuple<uint8_t, uint8_t, uint8_t> GetPixelAs3Channels(unsigned int x, unsigned int y) const;
-
- void StbResize(InferenceTestImage& im, const unsigned int newWidth, const unsigned int newHeight);
-
-
- std::vector<float> Resize(unsigned int newWidth,
- unsigned int newHeight,
- const armnn::CheckLocation& location,
- const ResizingMethods meth = ResizingMethods::STB,
- const std::array<float, 3>& mean = {{0.0, 0.0, 0.0}},
- const std::array<float, 3>& stddev = {{1.0, 1.0, 1.0}},
- const float scale = 255.0f);
-
- void Write(WriteFormat format, const char* filePath) const;
-
-private:
- static unsigned int GetSingleElementSizeInBytes()
- {
- return sizeof(decltype(std::declval<InferenceTestImage>().m_Data[0]));
- }
-
- std::vector<uint8_t> m_Data;
- unsigned int m_Width;
- unsigned int m_Height;
- unsigned int m_NumChannels;
-};
-
-// Common names used to identify a channel in a pixel.
-enum class ImageChannel
-{
- R,
- G,
- B
-};
-
-// Channel layouts handled by the test framework.
-enum class ImageChannelLayout
-{
- Rgb,
- Bgr
-};
-
-// Reads the contents of an inference test image as 3-channel pixels whose channel values have been normalized (scaled)
-// and now lie in the range [0,1]. Channel data is stored according to the ArmNN layout (CHW). The order in which
-// channels appear in the resulting vector is defined by the provided layout.
-std::vector<float> GetImageDataInArmNnLayoutAsNormalizedFloats(ImageChannelLayout layout,
- const InferenceTestImage& image);
-
-// Reads the contents of an inference test image as 3-channel pixels, whose value is the result of subtracting the mean
-// from the values in the original image. Channel data is stored according to the ArmNN layout (CHW). The order in
-// which channels appear in the resulting vector is defined by the provided layout. The order of the channels of the
-// provided mean should also match the given layout.
-std::vector<float> GetImageDataInArmNnLayoutAsFloatsSubtractingMean(ImageChannelLayout layout,
- const InferenceTestImage& image,
- const std::array<float, 3>& mean);
-
-// Reads the contents of an inference test image as 3-channel pixels and returns the image data as normalized float
-// values. The returned image stay in the original order (HWC) order. The C order may be changed according to the
-// supplied layout value.
-std::vector<float> GetImageDataAsNormalizedFloats(ImageChannelLayout layout,
- const InferenceTestImage& image);
diff --git a/tests/LstmCommon.hpp b/tests/LstmCommon.hpp
deleted file mode 100644
index 0876d263ed..0000000000
--- a/tests/LstmCommon.hpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#pragma once
-
-#include <string>
-#include <utility>
-
-namespace
-{
-
-struct LstmInput
-{
- LstmInput(const std::vector<float>& inputSeq,
- const std::vector<float>& stateH,
- const std::vector<float>& stateC)
- : m_InputSeq(inputSeq)
- , m_StateH(stateH)
- , m_StateC(stateC)
- {}
-
- std::vector<float> m_InputSeq;
- std::vector<float> m_StateH;
- std::vector<float> m_StateC;
-};
-
-using LstmInputs = std::pair<std::string, std::vector<LstmInput>>;
-
-} // anonymous namespace \ No newline at end of file
diff --git a/tests/MnistDatabase.cpp b/tests/MnistDatabase.cpp
deleted file mode 100644
index bd5029f841..0000000000
--- a/tests/MnistDatabase.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "MnistDatabase.hpp"
-
-#include <armnn/Logging.hpp>
-
-#include <boost/numeric/conversion/cast.hpp>
-#include <boost/assert.hpp>
-#include <fstream>
-#include <vector>
-
-constexpr int g_kMnistImageByteSize = 28 * 28;
-
-void EndianSwap(unsigned int &x)
-{
- x = (x >> 24) | ((x << 8) & 0x00FF0000) | ((x >> 8) & 0x0000FF00) | (x << 24);
-}
-
-MnistDatabase::MnistDatabase(const std::string& binaryFileDirectory, bool scaleValues)
- : m_BinaryDirectory(binaryFileDirectory)
- , m_ScaleValues(scaleValues)
-{
-}
-
-std::unique_ptr<MnistDatabase::TTestCaseData> MnistDatabase::GetTestCaseData(unsigned int testCaseId)
-{
- std::vector<unsigned char> I(g_kMnistImageByteSize);
- unsigned int label = 0;
-
- std::string imagePath = m_BinaryDirectory + std::string("t10k-images.idx3-ubyte");
- std::string labelPath = m_BinaryDirectory + std::string("t10k-labels.idx1-ubyte");
-
- std::ifstream imageStream(imagePath, std::ios::binary);
- std::ifstream labelStream(labelPath, std::ios::binary);
-
- if (!imageStream.is_open())
- {
- ARMNN_LOG(fatal) << "Failed to load " << imagePath;
- return nullptr;
- }
- if (!labelStream.is_open())
- {
- ARMNN_LOG(fatal) << "Failed to load " << imagePath;
- return nullptr;
- }
-
- unsigned int magic, num, row, col;
-
- // Checks the files have the correct header.
- imageStream.read(reinterpret_cast<char*>(&magic), sizeof(magic));
- if (magic != 0x03080000)
- {
- ARMNN_LOG(fatal) << "Failed to read " << imagePath;
- return nullptr;
- }
- labelStream.read(reinterpret_cast<char*>(&magic), sizeof(magic));
- if (magic != 0x01080000)
- {
- ARMNN_LOG(fatal) << "Failed to read " << labelPath;
- return nullptr;
- }
-
- // Endian swaps the image and label file - all the integers in the files are stored in MSB first(high endian)
- // format, hence it needs to flip the bytes of the header if using it on Intel processors or low-endian machines
- labelStream.read(reinterpret_cast<char*>(&num), sizeof(num));
- imageStream.read(reinterpret_cast<char*>(&num), sizeof(num));
- EndianSwap(num);
- imageStream.read(reinterpret_cast<char*>(&row), sizeof(row));
- EndianSwap(row);
- imageStream.read(reinterpret_cast<char*>(&col), sizeof(col));
- EndianSwap(col);
-
- // Reads image and label into memory.
- imageStream.seekg(testCaseId * g_kMnistImageByteSize, std::ios_base::cur);
- imageStream.read(reinterpret_cast<char*>(&I[0]), g_kMnistImageByteSize);
- labelStream.seekg(testCaseId, std::ios_base::cur);
- labelStream.read(reinterpret_cast<char*>(&label), 1);
-
- if (!imageStream.good())
- {
- ARMNN_LOG(fatal) << "Failed to read " << imagePath;
- return nullptr;
- }
- if (!labelStream.good())
- {
- ARMNN_LOG(fatal) << "Failed to read " << labelPath;
- return nullptr;
- }
-
- std::vector<float> inputImageData;
- inputImageData.resize(g_kMnistImageByteSize);
-
- for (unsigned int i = 0; i < col * row; ++i)
- {
- inputImageData[i] = boost::numeric_cast<float>(I[i]);
-
- if(m_ScaleValues)
- {
- inputImageData[i] /= 255.0f;
- }
- }
-
- return std::make_unique<TTestCaseData>(label, std::move(inputImageData));
-}
diff --git a/tests/MnistDatabase.hpp b/tests/MnistDatabase.hpp
deleted file mode 100644
index 813f13aa55..0000000000
--- a/tests/MnistDatabase.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#pragma once
-
-#include "ClassifierTestCaseData.hpp"
-
-#include <string>
-#include <memory>
-
-class MnistDatabase
-{
-public:
- using DataType = float;
- using TTestCaseData = ClassifierTestCaseData<DataType>;
-
- explicit MnistDatabase(const std::string& binaryFileDirectory, bool scaleValues = false);
- std::unique_ptr<TTestCaseData> GetTestCaseData(unsigned int testCaseId);
-
-private:
- std::string m_BinaryDirectory;
- bool m_ScaleValues;
-}; \ No newline at end of file
diff --git a/tests/MobileNetSsdDatabase.hpp b/tests/MobileNetSsdDatabase.hpp
deleted file mode 100644
index 1921831fa3..0000000000
--- a/tests/MobileNetSsdDatabase.hpp
+++ /dev/null
@@ -1,135 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include "InferenceTestImage.hpp"
-#include "ObjectDetectionCommon.hpp"
-
-#include <QuantizeHelper.hpp>
-
-#include <armnn/TypesUtils.hpp>
-
-#include <boost/numeric/conversion/cast.hpp>
-
-#include <array>
-#include <memory>
-#include <string>
-#include <vector>
-
-namespace
-{
-
-struct MobileNetSsdTestCaseData
-{
- MobileNetSsdTestCaseData(
- const std::vector<uint8_t>& inputData,
- const std::vector<DetectedObject>& expectedDetectedObject,
- const std::vector<std::vector<float>>& expectedOutput)
- : m_InputData(inputData)
- , m_ExpectedDetectedObject(expectedDetectedObject)
- , m_ExpectedOutput(expectedOutput)
- {}
-
- std::vector<uint8_t> m_InputData;
- std::vector<DetectedObject> m_ExpectedDetectedObject;
- std::vector<std::vector<float>> m_ExpectedOutput;
-};
-
-class MobileNetSsdDatabase
-{
-public:
- explicit MobileNetSsdDatabase(const std::string& imageDir, float scale, int offset);
-
- std::unique_ptr<MobileNetSsdTestCaseData> GetTestCaseData(unsigned int testCaseId);
-
-private:
- std::string m_ImageDir;
- float m_Scale;
- int m_Offset;
-};
-
-constexpr unsigned int k_MobileNetSsdImageWidth = 300u;
-constexpr unsigned int k_MobileNetSsdImageHeight = k_MobileNetSsdImageWidth;
-
-// Test cases
-const std::array<ObjectDetectionInput, 1> g_PerTestCaseInput =
-{
- ObjectDetectionInput
- {
- "Cat.jpg",
- {
- DetectedObject(16.0f, BoundingBox(0.216785252f, 0.079726994f, 0.927124202f, 0.939067304f), 0.79296875f)
- }
- }
-};
-
-MobileNetSsdDatabase::MobileNetSsdDatabase(const std::string& imageDir, float scale, int offset)
- : m_ImageDir(imageDir)
- , m_Scale(scale)
- , m_Offset(offset)
-{}
-
-std::unique_ptr<MobileNetSsdTestCaseData> MobileNetSsdDatabase::GetTestCaseData(unsigned int testCaseId)
-{
- const unsigned int safeTestCaseId =
- testCaseId % boost::numeric_cast<unsigned int>(g_PerTestCaseInput.size());
- const ObjectDetectionInput& testCaseInput = g_PerTestCaseInput[safeTestCaseId];
-
- // Load test case input
- const std::string imagePath = m_ImageDir + testCaseInput.first;
- std::vector<uint8_t> imageData;
- try
- {
- InferenceTestImage image(imagePath.c_str());
-
- // Resize image (if needed)
- const unsigned int width = image.GetWidth();
- const unsigned int height = image.GetHeight();
- if (width != k_MobileNetSsdImageWidth || height != k_MobileNetSsdImageHeight)
- {
- image.Resize(k_MobileNetSsdImageWidth, k_MobileNetSsdImageHeight, CHECK_LOCATION());
- }
-
- // Get image data as a vector of floats
- std::vector<float> floatImageData = GetImageDataAsNormalizedFloats(ImageChannelLayout::Rgb, image);
- imageData = armnnUtils::QuantizedVector<uint8_t>(floatImageData, m_Scale, m_Offset);
- }
- catch (const InferenceTestImageException& e)
- {
- ARMNN_LOG(fatal) << "Failed to load image for test case " << testCaseId << ". Error: " << e.what();
- return nullptr;
- }
-
- std::vector<float> numDetections = { static_cast<float>(testCaseInput.second.size()) };
-
- std::vector<float> detectionBoxes;
- std::vector<float> detectionClasses;
- std::vector<float> detectionScores;
-
- for (DetectedObject expectedObject : testCaseInput.second)
- {
- detectionBoxes.push_back(expectedObject.m_BoundingBox.m_YMin);
- detectionBoxes.push_back(expectedObject.m_BoundingBox.m_XMin);
- detectionBoxes.push_back(expectedObject.m_BoundingBox.m_YMax);
- detectionBoxes.push_back(expectedObject.m_BoundingBox.m_XMax);
-
- detectionClasses.push_back(expectedObject.m_Class);
-
- detectionScores.push_back(expectedObject.m_Confidence);
- }
-
- // Prepare test case expected output
- std::vector<std::vector<float>> expectedOutputs;
- expectedOutputs.reserve(4);
- expectedOutputs.push_back(detectionBoxes);
- expectedOutputs.push_back(detectionClasses);
- expectedOutputs.push_back(detectionScores);
- expectedOutputs.push_back(numDetections);
-
- return std::make_unique<MobileNetSsdTestCaseData>(imageData, testCaseInput.second, expectedOutputs);
-}
-
-} // anonymous namespace
diff --git a/tests/MobileNetSsdInferenceTest.hpp b/tests/MobileNetSsdInferenceTest.hpp
deleted file mode 100644
index c99844b6bb..0000000000
--- a/tests/MobileNetSsdInferenceTest.hpp
+++ /dev/null
@@ -1,203 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#pragma once
-
-#include "InferenceTest.hpp"
-#include "MobileNetSsdDatabase.hpp"
-
-#include <boost/assert.hpp>
-#include <boost/numeric/conversion/cast.hpp>
-#include <boost/test/tools/floating_point_comparison.hpp>
-
-#include <vector>
-
-namespace
-{
-
-template<typename Model>
-class MobileNetSsdTestCase : public InferenceModelTestCase<Model>
-{
-public:
- MobileNetSsdTestCase(Model& model,
- unsigned int testCaseId,
- const MobileNetSsdTestCaseData& testCaseData)
- : InferenceModelTestCase<Model>(model,
- testCaseId,
- { std::move(testCaseData.m_InputData) },
- { k_OutputSize1, k_OutputSize2, k_OutputSize3, k_OutputSize4 })
- , m_FloatComparer(boost::math::fpc::percent_tolerance(1.0f))
- , m_DetectedObjects(testCaseData.m_ExpectedDetectedObject)
- {}
-
- TestCaseResult ProcessResult(const InferenceTestOptions& options) override
- {
- boost::ignore_unused(options);
-
- const std::vector<float>& output1 = boost::get<std::vector<float>>(this->GetOutputs()[0]); // bounding boxes
- BOOST_ASSERT(output1.size() == k_OutputSize1);
-
- const std::vector<float>& output2 = boost::get<std::vector<float>>(this->GetOutputs()[1]); // classes
- BOOST_ASSERT(output2.size() == k_OutputSize2);
-
- const std::vector<float>& output3 = boost::get<std::vector<float>>(this->GetOutputs()[2]); // scores
- BOOST_ASSERT(output3.size() == k_OutputSize3);
-
- const std::vector<float>& output4 = boost::get<std::vector<float>>(this->GetOutputs()[3]); // valid detections
- BOOST_ASSERT(output4.size() == k_OutputSize4);
-
- const size_t numDetections = boost::numeric_cast<size_t>(output4[0]);
-
- // Check if number of valid detections matches expectations
- const size_t expectedNumDetections = m_DetectedObjects.size();
- if (numDetections != expectedNumDetections)
- {
- ARMNN_LOG(error) << "Number of detections is incorrect: Expected (" <<
- expectedNumDetections << ")" << " but got (" << numDetections << ")";
- return TestCaseResult::Failed;
- }
-
- // Extract detected objects from output data
- std::vector<DetectedObject> detectedObjects;
- const float* outputData = output1.data();
- for (unsigned int i = 0u; i < numDetections; i++)
- {
- // NOTE: Order of coordinates in output data is yMin, xMin, yMax, xMax
- float yMin = *outputData++;
- float xMin = *outputData++;
- float yMax = *outputData++;
- float xMax = *outputData++;
-
- DetectedObject detectedObject(
- output2.at(i),
- BoundingBox(xMin, yMin, xMax, yMax),
- output3.at(i));
-
- detectedObjects.push_back(detectedObject);
- }
-
- std::sort(detectedObjects.begin(), detectedObjects.end());
- std::sort(m_DetectedObjects.begin(), m_DetectedObjects.end());
-
- // Compare detected objects with expected results
- std::vector<DetectedObject>::const_iterator it = detectedObjects.begin();
- for (unsigned int i = 0; i < numDetections; i++)
- {
- if (it == detectedObjects.end())
- {
- ARMNN_LOG(error) << "No more detected objects found! Index out of bounds: " << i;
- return TestCaseResult::Abort;
- }
-
- const DetectedObject& detectedObject = *it;
- const DetectedObject& expectedObject = m_DetectedObjects[i];
-
- if (detectedObject.m_Class != expectedObject.m_Class)
- {
- ARMNN_LOG(error) << "Prediction for test case " << this->GetTestCaseId() <<
- " is incorrect: Expected (" << expectedObject.m_Class << ")" <<
- " but predicted (" << detectedObject.m_Class << ")";
- return TestCaseResult::Failed;
- }
-
- if(!m_FloatComparer(detectedObject.m_Confidence, expectedObject.m_Confidence))
- {
- ARMNN_LOG(error) << "Confidence of prediction for test case " << this->GetTestCaseId() <<
- " is incorrect: Expected (" << expectedObject.m_Confidence << ") +- 1.0 pc" <<
- " but predicted (" << detectedObject.m_Confidence << ")";
- return TestCaseResult::Failed;
- }
-
- if (!m_FloatComparer(detectedObject.m_BoundingBox.m_XMin, expectedObject.m_BoundingBox.m_XMin) ||
- !m_FloatComparer(detectedObject.m_BoundingBox.m_YMin, expectedObject.m_BoundingBox.m_YMin) ||
- !m_FloatComparer(detectedObject.m_BoundingBox.m_XMax, expectedObject.m_BoundingBox.m_XMax) ||
- !m_FloatComparer(detectedObject.m_BoundingBox.m_YMax, expectedObject.m_BoundingBox.m_YMax))
- {
- ARMNN_LOG(error) << "Detected bounding box for test case " << this->GetTestCaseId() <<
- " is incorrect";
- return TestCaseResult::Failed;
- }
-
- ++it;
- }
-
- return TestCaseResult::Ok;
- }
-
-private:
- static constexpr unsigned int k_Shape = 10u;
-
- static constexpr unsigned int k_OutputSize1 = k_Shape * 4u;
- static constexpr unsigned int k_OutputSize2 = k_Shape;
- static constexpr unsigned int k_OutputSize3 = k_Shape;
- static constexpr unsigned int k_OutputSize4 = 1u;
-
- boost::math::fpc::close_at_tolerance<float> m_FloatComparer;
- std::vector<DetectedObject> m_DetectedObjects;
-};
-
-template <typename Model>
-class MobileNetSsdTestCaseProvider : public IInferenceTestCaseProvider
-{
-public:
- template <typename TConstructModelCallable>
- explicit MobileNetSsdTestCaseProvider(TConstructModelCallable constructModel)
- : m_ConstructModel(constructModel)
- {}
-
- virtual void AddCommandLineOptions(boost::program_options::options_description& options) override
- {
- namespace po = boost::program_options;
-
- options.add_options()
- ("data-dir,d", po::value<std::string>(&m_DataDir)->required(),
- "Path to directory containing test data");
-
- Model::AddCommandLineOptions(options, m_ModelCommandLineOptions);
- }
-
- virtual bool ProcessCommandLineOptions(const InferenceTestOptions &commonOptions) override
- {
- if (!ValidateDirectory(m_DataDir))
- {
- return false;
- }
-
- m_Model = m_ConstructModel(commonOptions, m_ModelCommandLineOptions);
- if (!m_Model)
- {
- return false;
- }
- std::pair<float, int32_t> qParams = m_Model->GetInputQuantizationParams();
- m_Database = std::make_unique<MobileNetSsdDatabase>(m_DataDir.c_str(), qParams.first, qParams.second);
- if (!m_Database)
- {
- return false;
- }
-
- return true;
- }
-
- std::unique_ptr<IInferenceTestCase> GetTestCase(unsigned int testCaseId) override
- {
- std::unique_ptr<MobileNetSsdTestCaseData> testCaseData = m_Database->GetTestCaseData(testCaseId);
- if (!testCaseData)
- {
- return nullptr;
- }
-
- return std::make_unique<MobileNetSsdTestCase<Model>>(*m_Model, testCaseId, *testCaseData);
- }
-
-private:
- typename Model::CommandLineOptions m_ModelCommandLineOptions;
- std::function<std::unique_ptr<Model>(const InferenceTestOptions &,
- typename Model::CommandLineOptions)> m_ConstructModel;
- std::unique_ptr<Model> m_Model;
-
- std::string m_DataDir;
- std::unique_ptr<MobileNetSsdDatabase> m_Database;
-};
-
-} // anonymous namespace \ No newline at end of file
diff --git a/tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp b/tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp
deleted file mode 100644
index ecfc21209c..0000000000
--- a/tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp
+++ /dev/null
@@ -1,480 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "../ImageTensorGenerator/ImageTensorGenerator.hpp"
-#include "../InferenceTest.hpp"
-#include "ModelAccuracyChecker.hpp"
-#include "armnnDeserializer/IDeserializer.hpp"
-
-#include <boost/algorithm/string.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/program_options/variables_map.hpp>
-#include <boost/range/iterator_range.hpp>
-#include <map>
-
-using namespace armnn::test;
-
-/** Load image names and ground-truth labels from the image directory and the ground truth label file
- *
- * @pre \p validationLabelPath exists and is valid regular file
- * @pre \p imageDirectoryPath exists and is valid directory
- * @pre labels in validation file correspond to images which are in lexicographical order with the image name
- * @pre image index starts at 1
- * @pre \p begIndex and \p endIndex are end-inclusive
- *
- * @param[in] validationLabelPath Path to validation label file
- * @param[in] imageDirectoryPath Path to directory containing validation images
- * @param[in] begIndex Begin index of images to be loaded. Inclusive
- * @param[in] endIndex End index of images to be loaded. Inclusive
- * @param[in] blacklistPath Path to blacklist file
- * @return A map mapping image file names to their corresponding ground-truth labels
- */
-map<std::string, std::string> LoadValidationImageFilenamesAndLabels(const string& validationLabelPath,
- const string& imageDirectoryPath,
- size_t begIndex = 0,
- size_t endIndex = 0,
- const string& blacklistPath = "");
-
-/** Load model output labels from file
- *
- * @pre \p modelOutputLabelsPath exists and is a regular file
- *
- * @param[in] modelOutputLabelsPath path to model output labels file
- * @return A vector of labels, which in turn is described by a list of category names
- */
-std::vector<armnnUtils::LabelCategoryNames> LoadModelOutputLabels(const std::string& modelOutputLabelsPath);
-
-int main(int argc, char* argv[])
-{
- try
- {
- using namespace boost::filesystem;
- armnn::LogSeverity level = armnn::LogSeverity::Debug;
- armnn::ConfigureLogging(true, true, level);
-
- // Set-up program Options
- namespace po = boost::program_options;
-
- std::vector<armnn::BackendId> computeDevice;
- std::vector<armnn::BackendId> defaultBackends = {armnn::Compute::CpuAcc, armnn::Compute::CpuRef};
- std::string modelPath;
- std::string modelFormat;
- std::string dataDir;
- std::string inputName;
- std::string inputLayout;
- std::string outputName;
- std::string modelOutputLabelsPath;
- std::string validationLabelPath;
- std::string validationRange;
- std::string blacklistPath;
-
- const std::string backendsMessage = "Which device to run layers on by default. Possible choices: "
- + armnn::BackendRegistryInstance().GetBackendIdsAsString();
-
- po::options_description desc("Options");
- try
- {
- // Adds generic options needed to run Accuracy Tool.
- desc.add_options()
- ("help,h", "Display help messages")
- ("model-path,m", po::value<std::string>(&modelPath)->required(), "Path to armnn format model file")
- ("model-format,f", po::value<std::string>(&modelFormat)->required(),
- "The model format. Supported values: caffe, tensorflow, tflite")
- ("input-name,i", po::value<std::string>(&inputName)->required(),
- "Identifier of the input tensors in the network separated by comma.")
- ("output-name,o", po::value<std::string>(&outputName)->required(),
- "Identifier of the output tensors in the network separated by comma.")
- ("data-dir,d", po::value<std::string>(&dataDir)->required(),
- "Path to directory containing the ImageNet test data")
- ("model-output-labels,p", po::value<std::string>(&modelOutputLabelsPath)->required(),
- "Path to model output labels file.")
- ("validation-labels-path,v", po::value<std::string>(&validationLabelPath)->required(),
- "Path to ImageNet Validation Label file")
- ("data-layout,l", po::value<std::string>(&inputLayout)->default_value("NHWC"),
- "Data layout. Supported value: NHWC, NCHW. Default: NHWC")
- ("compute,c", po::value<std::vector<armnn::BackendId>>(&computeDevice)->default_value(defaultBackends),
- backendsMessage.c_str())
- ("validation-range,r", po::value<std::string>(&validationRange)->default_value("1:0"),
- "The range of the images to be evaluated. Specified in the form <begin index>:<end index>."
- "The index starts at 1 and the range is inclusive."
- "By default the evaluation will be performed on all images.")
- ("blacklist-path,b", po::value<std::string>(&blacklistPath)->default_value(""),
- "Path to a blacklist file where each line denotes the index of an image to be "
- "excluded from evaluation.");
- }
- catch (const std::exception& e)
- {
- // Coverity points out that default_value(...) can throw a bad_lexical_cast,
- // and that desc.add_options() can throw boost::io::too_few_args.
- // They really won't in any of these cases.
- BOOST_ASSERT_MSG(false, "Caught unexpected exception");
- std::cerr << "Fatal internal error: " << e.what() << std::endl;
- return 1;
- }
-
- po::variables_map vm;
- try
- {
- po::store(po::parse_command_line(argc, argv, desc), vm);
-
- if (vm.count("help"))
- {
- std::cout << desc << std::endl;
- return 1;
- }
- po::notify(vm);
- }
- catch (po::error& e)
- {
- std::cerr << e.what() << std::endl << std::endl;
- std::cerr << desc << std::endl;
- return 1;
- }
-
- // Check if the requested backend are all valid
- std::string invalidBackends;
- if (!CheckRequestedBackendsAreValid(computeDevice, armnn::Optional<std::string&>(invalidBackends)))
- {
- ARMNN_LOG(fatal) << "The list of preferred devices contains invalid backend IDs: "
- << invalidBackends;
- return EXIT_FAILURE;
- }
- armnn::Status status;
-
- // Create runtime
- armnn::IRuntime::CreationOptions options;
- armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options));
- std::ifstream file(modelPath);
-
- // Create Parser
- using IParser = armnnDeserializer::IDeserializer;
- auto armnnparser(IParser::Create());
-
- // Create a network
- armnn::INetworkPtr network = armnnparser->CreateNetworkFromBinary(file);
-
- // Optimizes the network.
- armnn::IOptimizedNetworkPtr optimizedNet(nullptr, nullptr);
- try
- {
- optimizedNet = armnn::Optimize(*network, computeDevice, runtime->GetDeviceSpec());
- }
- catch (armnn::Exception& e)
- {
- std::stringstream message;
- message << "armnn::Exception (" << e.what() << ") caught from optimize.";
- ARMNN_LOG(fatal) << message.str();
- return 1;
- }
-
- // Loads the network into the runtime.
- armnn::NetworkId networkId;
- status = runtime->LoadNetwork(networkId, std::move(optimizedNet));
- if (status == armnn::Status::Failure)
- {
- ARMNN_LOG(fatal) << "armnn::IRuntime: Failed to load network";
- return 1;
- }
-
- // Set up Network
- using BindingPointInfo = InferenceModelInternal::BindingPointInfo;
-
- const armnnDeserializer::BindingPointInfo&
- inputBindingInfo = armnnparser->GetNetworkInputBindingInfo(0, inputName);
-
- std::pair<armnn::LayerBindingId, armnn::TensorInfo>
- m_InputBindingInfo(inputBindingInfo.m_BindingId, inputBindingInfo.m_TensorInfo);
- std::vector<BindingPointInfo> inputBindings = { m_InputBindingInfo };
-
- const armnnDeserializer::BindingPointInfo&
- outputBindingInfo = armnnparser->GetNetworkOutputBindingInfo(0, outputName);
-
- std::pair<armnn::LayerBindingId, armnn::TensorInfo>
- m_OutputBindingInfo(outputBindingInfo.m_BindingId, outputBindingInfo.m_TensorInfo);
- std::vector<BindingPointInfo> outputBindings = { m_OutputBindingInfo };
-
- // Load model output labels
- if (modelOutputLabelsPath.empty() || !boost::filesystem::exists(modelOutputLabelsPath) ||
- !boost::filesystem::is_regular_file(modelOutputLabelsPath))
- {
- ARMNN_LOG(fatal) << "Invalid model output labels path at " << modelOutputLabelsPath;
- }
- const std::vector<armnnUtils::LabelCategoryNames> modelOutputLabels =
- LoadModelOutputLabels(modelOutputLabelsPath);
-
- // Parse begin and end image indices
- std::vector<std::string> imageIndexStrs = armnnUtils::SplitBy(validationRange, ":");
- size_t imageBegIndex;
- size_t imageEndIndex;
- if (imageIndexStrs.size() != 2)
- {
- ARMNN_LOG(fatal) << "Invalid validation range specification: Invalid format " << validationRange;
- return 1;
- }
- try
- {
- imageBegIndex = std::stoul(imageIndexStrs[0]);
- imageEndIndex = std::stoul(imageIndexStrs[1]);
- }
- catch (const std::exception& e)
- {
- ARMNN_LOG(fatal) << "Invalid validation range specification: " << validationRange;
- return 1;
- }
-
- // Validate blacklist file if it's specified
- if (!blacklistPath.empty() &&
- !(boost::filesystem::exists(blacklistPath) && boost::filesystem::is_regular_file(blacklistPath)))
- {
- ARMNN_LOG(fatal) << "Invalid path to blacklist file at " << blacklistPath;
- return 1;
- }
-
- path pathToDataDir(dataDir);
- const map<std::string, std::string> imageNameToLabel = LoadValidationImageFilenamesAndLabels(
- validationLabelPath, pathToDataDir.string(), imageBegIndex, imageEndIndex, blacklistPath);
- armnnUtils::ModelAccuracyChecker checker(imageNameToLabel, modelOutputLabels);
- using TContainer = boost::variant<std::vector<float>, std::vector<int>, std::vector<uint8_t>>;
-
- if (ValidateDirectory(dataDir))
- {
- InferenceModel<armnnDeserializer::IDeserializer, float>::Params params;
- params.m_ModelPath = modelPath;
- params.m_IsModelBinary = true;
- params.m_ComputeDevices = computeDevice;
- params.m_InputBindings.push_back(inputName);
- params.m_OutputBindings.push_back(outputName);
-
- using TParser = armnnDeserializer::IDeserializer;
- InferenceModel<TParser, float> model(params, false);
- // Get input tensor information
- const armnn::TensorInfo& inputTensorInfo = model.GetInputBindingInfo().second;
- const armnn::TensorShape& inputTensorShape = inputTensorInfo.GetShape();
- const armnn::DataType& inputTensorDataType = inputTensorInfo.GetDataType();
- armnn::DataLayout inputTensorDataLayout;
- if (inputLayout == "NCHW")
- {
- inputTensorDataLayout = armnn::DataLayout::NCHW;
- }
- else if (inputLayout == "NHWC")
- {
- inputTensorDataLayout = armnn::DataLayout::NHWC;
- }
- else
- {
- ARMNN_LOG(fatal) << "Invalid Data layout: " << inputLayout;
- return 1;
- }
- const unsigned int inputTensorWidth =
- inputTensorDataLayout == armnn::DataLayout::NCHW ? inputTensorShape[3] : inputTensorShape[2];
- const unsigned int inputTensorHeight =
- inputTensorDataLayout == armnn::DataLayout::NCHW ? inputTensorShape[2] : inputTensorShape[1];
- // Get output tensor info
- const unsigned int outputNumElements = model.GetOutputSize();
- // Check output tensor shape is valid
- if (modelOutputLabels.size() != outputNumElements)
- {
- ARMNN_LOG(fatal) << "Number of output elements: " << outputNumElements
- << " , mismatches the number of output labels: " << modelOutputLabels.size();
- return 1;
- }
-
- const unsigned int batchSize = 1;
- // Get normalisation parameters
- SupportedFrontend modelFrontend;
- if (modelFormat == "caffe")
- {
- modelFrontend = SupportedFrontend::Caffe;
- }
- else if (modelFormat == "tensorflow")
- {
- modelFrontend = SupportedFrontend::TensorFlow;
- }
- else if (modelFormat == "tflite")
- {
- modelFrontend = SupportedFrontend::TFLite;
- }
- else
- {
- ARMNN_LOG(fatal) << "Unsupported frontend: " << modelFormat;
- return 1;
- }
- const NormalizationParameters& normParams = GetNormalizationParameters(modelFrontend, inputTensorDataType);
- for (const auto& imageEntry : imageNameToLabel)
- {
- const std::string imageName = imageEntry.first;
- std::cout << "Processing image: " << imageName << "\n";
-
- vector<TContainer> inputDataContainers;
- vector<TContainer> outputDataContainers;
-
- auto imagePath = pathToDataDir / boost::filesystem::path(imageName);
- switch (inputTensorDataType)
- {
- case armnn::DataType::Signed32:
- inputDataContainers.push_back(
- PrepareImageTensor<int>(imagePath.string(),
- inputTensorWidth, inputTensorHeight,
- normParams,
- batchSize,
- inputTensorDataLayout));
- outputDataContainers = { vector<int>(outputNumElements) };
- break;
- case armnn::DataType::QAsymmU8:
- inputDataContainers.push_back(
- PrepareImageTensor<uint8_t>(imagePath.string(),
- inputTensorWidth, inputTensorHeight,
- normParams,
- batchSize,
- inputTensorDataLayout));
- outputDataContainers = { vector<uint8_t>(outputNumElements) };
- break;
- case armnn::DataType::Float32:
- default:
- inputDataContainers.push_back(
- PrepareImageTensor<float>(imagePath.string(),
- inputTensorWidth, inputTensorHeight,
- normParams,
- batchSize,
- inputTensorDataLayout));
- outputDataContainers = { vector<float>(outputNumElements) };
- break;
- }
-
- status = runtime->EnqueueWorkload(networkId,
- armnnUtils::MakeInputTensors(inputBindings, inputDataContainers),
- armnnUtils::MakeOutputTensors(outputBindings, outputDataContainers));
-
- if (status == armnn::Status::Failure)
- {
- ARMNN_LOG(fatal) << "armnn::IRuntime: Failed to enqueue workload for image: " << imageName;
- }
-
- checker.AddImageResult<TContainer>(imageName, outputDataContainers);
- }
- }
- else
- {
- return 1;
- }
-
- for(unsigned int i = 1; i <= 5; ++i)
- {
- std::cout << "Top " << i << " Accuracy: " << checker.GetAccuracy(i) << "%" << "\n";
- }
-
- ARMNN_LOG(info) << "Accuracy Tool ran successfully!";
- return 0;
- }
- catch (armnn::Exception const & e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "Armnn Error: " << e.what() << std::endl;
- return 1;
- }
- catch (const std::exception & e)
- {
- // Coverity fix: various boost exceptions can be thrown by methods called by this test.
- std::cerr << "WARNING: ModelAccuracyTool-Armnn: An error has occurred when running the "
- "Accuracy Tool: " << e.what() << std::endl;
- return 1;
- }
-}
-
-map<std::string, std::string> LoadValidationImageFilenamesAndLabels(const string& validationLabelPath,
- const string& imageDirectoryPath,
- size_t begIndex,
- size_t endIndex,
- const string& blacklistPath)
-{
- // Populate imageFilenames with names of all .JPEG, .PNG images
- std::vector<std::string> imageFilenames;
- for (const auto& imageEntry :
- boost::make_iterator_range(boost::filesystem::directory_iterator(boost::filesystem::path(imageDirectoryPath))))
- {
- boost::filesystem::path imagePath = imageEntry.path();
- std::string imageExtension = boost::to_upper_copy<std::string>(imagePath.extension().string());
- if (boost::filesystem::is_regular_file(imagePath) && (imageExtension == ".JPEG" || imageExtension == ".PNG"))
- {
- imageFilenames.push_back(imagePath.filename().string());
- }
- }
- if (imageFilenames.empty())
- {
- throw armnn::Exception("No image file (JPEG, PNG) found at " + imageDirectoryPath);
- }
-
- // Sort the image filenames lexicographically
- std::sort(imageFilenames.begin(), imageFilenames.end());
-
- std::cout << imageFilenames.size() << " images found at " << imageDirectoryPath << std::endl;
-
- // Get default end index
- if (begIndex < 1 || endIndex > imageFilenames.size())
- {
- throw armnn::Exception("Invalid image index range");
- }
- endIndex = endIndex == 0 ? imageFilenames.size() : endIndex;
- if (begIndex > endIndex)
- {
- throw armnn::Exception("Invalid image index range");
- }
-
- // Load blacklist if there is one
- std::vector<unsigned int> blacklist;
- if (!blacklistPath.empty())
- {
- std::ifstream blacklistFile(blacklistPath);
- unsigned int index;
- while (blacklistFile >> index)
- {
- blacklist.push_back(index);
- }
- }
-
- // Load ground truth labels and pair them with corresponding image names
- std::string classification;
- map<std::string, std::string> imageNameToLabel;
- ifstream infile(validationLabelPath);
- size_t imageIndex = begIndex;
- size_t blacklistIndexCount = 0;
- while (std::getline(infile, classification))
- {
- if (imageIndex > endIndex)
- {
- break;
- }
- // If current imageIndex is included in blacklist, skip the current image
- if (blacklistIndexCount < blacklist.size() && imageIndex == blacklist[blacklistIndexCount])
- {
- ++imageIndex;
- ++blacklistIndexCount;
- continue;
- }
- imageNameToLabel.insert(std::pair<std::string, std::string>(imageFilenames[imageIndex - 1], classification));
- ++imageIndex;
- }
- std::cout << blacklistIndexCount << " images blacklisted" << std::endl;
- std::cout << imageIndex - begIndex - blacklistIndexCount << " images to be loaded" << std::endl;
- return imageNameToLabel;
-}
-
-std::vector<armnnUtils::LabelCategoryNames> LoadModelOutputLabels(const std::string& modelOutputLabelsPath)
-{
- std::vector<armnnUtils::LabelCategoryNames> modelOutputLabels;
- ifstream modelOutputLablesFile(modelOutputLabelsPath);
- std::string line;
- while (std::getline(modelOutputLablesFile, line))
- {
- armnnUtils::LabelCategoryNames tokens = armnnUtils::SplitBy(line, ":");
- armnnUtils::LabelCategoryNames predictionCategoryNames = armnnUtils::SplitBy(tokens.back(), ",");
- std::transform(predictionCategoryNames.begin(), predictionCategoryNames.end(), predictionCategoryNames.begin(),
- [](const std::string& category) { return armnnUtils::Strip(category); });
- modelOutputLabels.push_back(predictionCategoryNames);
- }
- return modelOutputLabels;
-} \ No newline at end of file
diff --git a/tests/ModelAccuracyTool-Armnn/README.md b/tests/ModelAccuracyTool-Armnn/README.md
deleted file mode 100644
index 7a29bc8aa5..0000000000
--- a/tests/ModelAccuracyTool-Armnn/README.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# The ModelAccuracyTool-Armnn
-
-The `ModelAccuracyTool-Armnn` is a program for measuring the Top 5 accuracy results of a model against an image dataset.
-
-Prerequisites:
-1. The model is in .armnn format model file. The `ArmnnConverter` can be used to convert a model to this format.
-
-Build option:
-To build ModelAccuracyTool, pass the following options to Cmake:
-* -DFLATC_DIR=/path/to/flatbuffers/x86build/
-* -DBUILD_ACCURACY_TOOL=1
-* -DBUILD_ARMNN_SERIALIZER=1
-
-|Cmd:|||
-| ---|---|---|
-| -h | --help | Display help messages |
-| -m | --model-path | Path to armnn format model file |
-| -f | --model-format | The model format. Supported values: caffe, tensorflow, tflite |
-| -i | --input-name | Identifier of the input tensors in the network separated by comma |
-| -o | --output-name | Identifier of the output tensors in the network separated by comma |
-| -d | --data-dir | Path to directory containing the ImageNet test data |
-| -p | --model-output-labels | Path to model output labels file.
-| -v | --validation-labels-path | Path to ImageNet Validation Label file
-| -l | --data-layout ] | Data layout. Supported value: NHWC, NCHW. Default: NHWC
-| -c | --compute | Which device to run layers on by default. Possible choices: CpuRef, CpuAcc, GpuAcc. Default: CpuAcc, CpuRef |
-| -r | --validation-range | The range of the images to be evaluated. Specified in the form <begin index>:<end index>. The index starts at 1 and the range is inclusive. By default the evaluation will be performed on all images. |
-| -b | --blacklist-path | Path to a blacklist file where each line denotes the index of an image to be excluded from evaluation. |
-
-Example usage: <br>
-<code>./ModelAccuracyTool -m /path/to/model/model.armnn -f tflite -i input -o output -d /path/to/test/directory/ -p /path/to/model-output-labels -v /path/to/file/val.txt -c CpuRef -r 1:100</code> \ No newline at end of file
diff --git a/tests/MultipleNetworksCifar10/MultipleNetworksCifar10.cpp b/tests/MultipleNetworksCifar10/MultipleNetworksCifar10.cpp
deleted file mode 100644
index 5c969c68dd..0000000000
--- a/tests/MultipleNetworksCifar10/MultipleNetworksCifar10.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include <iostream>
-#include <chrono>
-#include <vector>
-#include <array>
-
-#include "armnn/ArmNN.hpp"
-#include "armnn/Utils.hpp"
-#include "armnn/INetwork.hpp"
-#include "armnnCaffeParser/ICaffeParser.hpp"
-#include "../Cifar10Database.hpp"
-#include "../InferenceTest.hpp"
-#include "../InferenceModel.hpp"
-
-using namespace std;
-using namespace std::chrono;
-using namespace armnn::test;
-
-int main(int argc, char* argv[])
-{
-#ifdef NDEBUG
- armnn::LogSeverity level = armnn::LogSeverity::Info;
-#else
- armnn::LogSeverity level = armnn::LogSeverity::Debug;
-#endif
-
- try
- {
- // Configures logging for both the ARMNN library and this test program.
- armnn::ConfigureLogging(true, true, level);
- namespace po = boost::program_options;
-
- std::vector<armnn::BackendId> computeDevice;
- std::vector<armnn::BackendId> defaultBackends = {armnn::Compute::CpuAcc, armnn::Compute::CpuRef};
- std::string modelDir;
- std::string dataDir;
-
- const std::string backendsMessage = "Which device to run layers on by default. Possible choices: "
- + armnn::BackendRegistryInstance().GetBackendIdsAsString();
-
- po::options_description desc("Options");
- try
- {
- // Adds generic options needed for all inference tests.
- desc.add_options()
- ("help", "Display help messages")
- ("model-dir,m", po::value<std::string>(&modelDir)->required(),
- "Path to directory containing the Cifar10 model file")
- ("compute,c", po::value<std::vector<armnn::BackendId>>(&computeDevice)->default_value(defaultBackends),
- backendsMessage.c_str())
- ("data-dir,d", po::value<std::string>(&dataDir)->required(),
- "Path to directory containing the Cifar10 test data");
- }
- catch (const std::exception& e)
- {
- // Coverity points out that default_value(...) can throw a bad_lexical_cast,
- // and that desc.add_options() can throw boost::io::too_few_args.
- // They really won't in any of these cases.
- BOOST_ASSERT_MSG(false, "Caught unexpected exception");
- std::cerr << "Fatal internal error: " << e.what() << std::endl;
- return 1;
- }
-
- po::variables_map vm;
-
- try
- {
- po::store(po::parse_command_line(argc, argv, desc), vm);
-
- if (vm.count("help"))
- {
- std::cout << desc << std::endl;
- return 1;
- }
-
- po::notify(vm);
- }
- catch (po::error& e)
- {
- std::cerr << e.what() << std::endl << std::endl;
- std::cerr << desc << std::endl;
- return 1;
- }
-
- if (!ValidateDirectory(modelDir))
- {
- return 1;
- }
- string modelPath = modelDir + "cifar10_full_iter_60000.caffemodel";
-
- // Create runtime
- // This will also load dynamic backend in case that the dynamic backend path is specified
- armnn::IRuntime::CreationOptions options;
- armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options));
-
- // Check if the requested backend are all valid
- std::string invalidBackends;
- if (!CheckRequestedBackendsAreValid(computeDevice, armnn::Optional<std::string&>(invalidBackends)))
- {
- ARMNN_LOG(fatal) << "The list of preferred devices contains invalid backend IDs: "
- << invalidBackends;
- return EXIT_FAILURE;
- }
-
- // Loads networks.
- armnn::Status status;
- struct Net
- {
- Net(armnn::NetworkId netId,
- const std::pair<armnn::LayerBindingId, armnn::TensorInfo>& in,
- const std::pair<armnn::LayerBindingId, armnn::TensorInfo>& out)
- : m_Network(netId)
- , m_InputBindingInfo(in)
- , m_OutputBindingInfo(out)
- {}
-
- armnn::NetworkId m_Network;
- std::pair<armnn::LayerBindingId, armnn::TensorInfo> m_InputBindingInfo;
- std::pair<armnn::LayerBindingId, armnn::TensorInfo> m_OutputBindingInfo;
- };
- std::vector<Net> networks;
-
- armnnCaffeParser::ICaffeParserPtr parser(armnnCaffeParser::ICaffeParser::Create());
-
- const int networksCount = 4;
- for (int i = 0; i < networksCount; ++i)
- {
- // Creates a network from a file on the disk.
- armnn::INetworkPtr network = parser->CreateNetworkFromBinaryFile(modelPath.c_str(), {}, { "prob" });
-
- // Optimizes the network.
- armnn::IOptimizedNetworkPtr optimizedNet(nullptr, nullptr);
- try
- {
- optimizedNet = armnn::Optimize(*network, computeDevice, runtime->GetDeviceSpec());
- }
- catch (armnn::Exception& e)
- {
- std::stringstream message;
- message << "armnn::Exception ("<<e.what()<<") caught from optimize.";
- ARMNN_LOG(fatal) << message.str();
- return 1;
- }
-
- // Loads the network into the runtime.
- armnn::NetworkId networkId;
- status = runtime->LoadNetwork(networkId, std::move(optimizedNet));
- if (status == armnn::Status::Failure)
- {
- ARMNN_LOG(fatal) << "armnn::IRuntime: Failed to load network";
- return 1;
- }
-
- networks.emplace_back(networkId,
- parser->GetNetworkInputBindingInfo("data"),
- parser->GetNetworkOutputBindingInfo("prob"));
- }
-
- // Loads a test case and tests inference.
- if (!ValidateDirectory(dataDir))
- {
- return 1;
- }
- Cifar10Database cifar10(dataDir);
-
- for (unsigned int i = 0; i < 3; ++i)
- {
- // Loads test case data (including image data).
- std::unique_ptr<Cifar10Database::TTestCaseData> testCaseData = cifar10.GetTestCaseData(i);
-
- // Tests inference.
- std::vector<TContainer> outputs;
- outputs.reserve(networksCount);
-
- for (unsigned int j = 0; j < networksCount; ++j)
- {
- outputs.push_back(std::vector<float>(10));
- }
-
- for (unsigned int k = 0; k < networksCount; ++k)
- {
- std::vector<armnn::BindingPointInfo> inputBindings = { networks[k].m_InputBindingInfo };
- std::vector<armnn::BindingPointInfo> outputBindings = { networks[k].m_OutputBindingInfo };
-
- std::vector<TContainer> inputDataContainers = { testCaseData->m_InputImage };
- std::vector<TContainer> outputDataContainers = { outputs[k] };
-
- status = runtime->EnqueueWorkload(networks[k].m_Network,
- armnnUtils::MakeInputTensors(inputBindings, inputDataContainers),
- armnnUtils::MakeOutputTensors(outputBindings, outputDataContainers));
- if (status == armnn::Status::Failure)
- {
- ARMNN_LOG(fatal) << "armnn::IRuntime: Failed to enqueue workload";
- return 1;
- }
- }
-
- // Compares outputs.
- std::vector<float> output0 = boost::get<std::vector<float>>(outputs[0]);
-
- for (unsigned int k = 1; k < networksCount; ++k)
- {
- std::vector<float> outputK = boost::get<std::vector<float>>(outputs[k]);
-
- if (!std::equal(output0.begin(), output0.end(), outputK.begin(), outputK.end()))
- {
- ARMNN_LOG(error) << "Multiple networks inference failed!";
- return 1;
- }
- }
- }
-
- ARMNN_LOG(info) << "Multiple networks inference ran successfully!";
- return 0;
- }
- catch (armnn::Exception const& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "Armnn Error: " << e.what() << std::endl;
- return 1;
- }
- catch (const std::exception& e)
- {
- // Coverity fix: various boost exceptions can be thrown by methods called by this test.
- std::cerr << "WARNING: MultipleNetworksCifar10: An error has occurred when running the "
- "multiple networks inference tests: " << e.what() << std::endl;
- return 1;
- }
-}
diff --git a/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp b/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp
deleted file mode 100644
index 97cf7c2b52..0000000000
--- a/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp
+++ /dev/null
@@ -1,849 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include <armnn/ArmNN.hpp>
-#include <armnn/TypesUtils.hpp>
-
-#if defined(ARMNN_SERIALIZER)
-#include "armnnDeserializer/IDeserializer.hpp"
-#endif
-#if defined(ARMNN_CAFFE_PARSER)
-#include "armnnCaffeParser/ICaffeParser.hpp"
-#endif
-#if defined(ARMNN_TF_PARSER)
-#include "armnnTfParser/ITfParser.hpp"
-#endif
-#if defined(ARMNN_TF_LITE_PARSER)
-#include "armnnTfLiteParser/ITfLiteParser.hpp"
-#endif
-#if defined(ARMNN_ONNX_PARSER)
-#include "armnnOnnxParser/IOnnxParser.hpp"
-#endif
-#include "CsvReader.hpp"
-#include "../InferenceTest.hpp"
-
-#include <Profiling.hpp>
-#include <ResolveType.hpp>
-
-#include <boost/algorithm/string/trim.hpp>
-#include <boost/algorithm/string/split.hpp>
-#include <boost/algorithm/string/classification.hpp>
-#include <boost/program_options.hpp>
-#include <boost/variant.hpp>
-
-#include <iostream>
-#include <fstream>
-#include <functional>
-#include <future>
-#include <algorithm>
-#include <iterator>
-
-namespace
-{
-
-// Configure boost::program_options for command-line parsing and validation.
-namespace po = boost::program_options;
-
-template<typename T, typename TParseElementFunc>
-std::vector<T> ParseArrayImpl(std::istream& stream, TParseElementFunc parseElementFunc, const char * chars = "\t ,:")
-{
- std::vector<T> result;
- // Processes line-by-line.
- std::string line;
- while (std::getline(stream, line))
- {
- std::vector<std::string> tokens;
- try
- {
- // Coverity fix: boost::split() may throw an exception of type boost::bad_function_call.
- boost::split(tokens, line, boost::algorithm::is_any_of(chars), boost::token_compress_on);
- }
- catch (const std::exception& e)
- {
- ARMNN_LOG(error) << "An error occurred when splitting tokens: " << e.what();
- continue;
- }
- for (const std::string& token : tokens)
- {
- if (!token.empty()) // See https://stackoverflow.com/questions/10437406/
- {
- try
- {
- result.push_back(parseElementFunc(token));
- }
- catch (const std::exception&)
- {
- ARMNN_LOG(error) << "'" << token << "' is not a valid number. It has been ignored.";
- }
- }
- }
- }
-
- return result;
-}
-
-bool CheckOption(const po::variables_map& vm,
- const char* option)
-{
- // Check that the given option is valid.
- if (option == nullptr)
- {
- return false;
- }
-
- // Check whether 'option' is provided.
- return vm.find(option) != vm.end();
-}
-
-void CheckOptionDependency(const po::variables_map& vm,
- const char* option,
- const char* required)
-{
- // Check that the given options are valid.
- if (option == nullptr || required == nullptr)
- {
- throw po::error("Invalid option to check dependency for");
- }
-
- // Check that if 'option' is provided, 'required' is also provided.
- if (CheckOption(vm, option) && !vm[option].defaulted())
- {
- if (CheckOption(vm, required) == 0 || vm[required].defaulted())
- {
- throw po::error(std::string("Option '") + option + "' requires option '" + required + "'.");
- }
- }
-}
-
-void CheckOptionDependencies(const po::variables_map& vm)
-{
- CheckOptionDependency(vm, "model-path", "model-format");
- CheckOptionDependency(vm, "model-path", "input-name");
- CheckOptionDependency(vm, "model-path", "output-name");
- CheckOptionDependency(vm, "input-tensor-shape", "model-path");
-}
-
-template<armnn::DataType NonQuantizedType>
-auto ParseDataArray(std::istream & stream);
-
-template<armnn::DataType QuantizedType>
-auto ParseDataArray(std::istream& stream,
- const float& quantizationScale,
- const int32_t& quantizationOffset);
-
-template<>
-auto ParseDataArray<armnn::DataType::Float32>(std::istream & stream)
-{
- return ParseArrayImpl<float>(stream, [](const std::string& s) { return std::stof(s); });
-}
-
-template<>
-auto ParseDataArray<armnn::DataType::Signed32>(std::istream & stream)
-{
- return ParseArrayImpl<int>(stream, [](const std::string & s) { return std::stoi(s); });
-}
-
-template<>
-auto ParseDataArray<armnn::DataType::QAsymmU8>(std::istream& stream)
-{
- return ParseArrayImpl<uint8_t>(stream,
- [](const std::string& s) { return boost::numeric_cast<uint8_t>(std::stoi(s)); });
-}
-
-template<>
-auto ParseDataArray<armnn::DataType::QAsymmU8>(std::istream& stream,
- const float& quantizationScale,
- const int32_t& quantizationOffset)
-{
- return ParseArrayImpl<uint8_t>(stream,
- [&quantizationScale, &quantizationOffset](const std::string & s)
- {
- return boost::numeric_cast<uint8_t>(
- armnn::Quantize<uint8_t>(std::stof(s),
- quantizationScale,
- quantizationOffset));
- });
-}
-std::vector<unsigned int> ParseArray(std::istream& stream)
-{
- return ParseArrayImpl<unsigned int>(stream,
- [](const std::string& s) { return boost::numeric_cast<unsigned int>(std::stoi(s)); });
-}
-
-std::vector<std::string> ParseStringList(const std::string & inputString, const char * delimiter)
-{
- std::stringstream stream(inputString);
- return ParseArrayImpl<std::string>(stream, [](const std::string& s) { return boost::trim_copy(s); }, delimiter);
-}
-
-void RemoveDuplicateDevices(std::vector<armnn::BackendId>& computeDevices)
-{
- // Mark the duplicate devices as 'Undefined'.
- for (auto i = computeDevices.begin(); i != computeDevices.end(); ++i)
- {
- for (auto j = std::next(i); j != computeDevices.end(); ++j)
- {
- if (*j == *i)
- {
- *j = armnn::Compute::Undefined;
- }
- }
- }
-
- // Remove 'Undefined' devices.
- computeDevices.erase(std::remove(computeDevices.begin(), computeDevices.end(), armnn::Compute::Undefined),
- computeDevices.end());
-}
-
-struct TensorPrinter : public boost::static_visitor<>
-{
- TensorPrinter(const std::string& binding, const armnn::TensorInfo& info, const std::string& outputTensorFile)
- : m_OutputBinding(binding)
- , m_Scale(info.GetQuantizationScale())
- , m_Offset(info.GetQuantizationOffset())
- , m_OutputTensorFile(outputTensorFile)
- {}
-
- void operator()(const std::vector<float>& values)
- {
- ForEachValue(values, [](float value)
- {
- printf("%f ", value);
- });
- WriteToFile(values);
- }
-
- void operator()(const std::vector<uint8_t>& values)
- {
- auto& scale = m_Scale;
- auto& offset = m_Offset;
- std::vector<float> dequantizedValues;
- ForEachValue(values, [&scale, &offset, &dequantizedValues](uint8_t value)
- {
- auto dequantizedValue = armnn::Dequantize(value, scale, offset);
- printf("%f ", dequantizedValue);
- dequantizedValues.push_back(dequantizedValue);
- });
- WriteToFile(dequantizedValues);
- }
-
- void operator()(const std::vector<int>& values)
- {
- ForEachValue(values, [](int value)
- {
- printf("%d ", value);
- });
- WriteToFile(values);
- }
-
-private:
- template<typename Container, typename Delegate>
- void ForEachValue(const Container& c, Delegate delegate)
- {
- std::cout << m_OutputBinding << ": ";
- for (const auto& value : c)
- {
- delegate(value);
- }
- printf("\n");
- }
-
- template<typename T>
- void WriteToFile(const std::vector<T>& values)
- {
- if (!m_OutputTensorFile.empty())
- {
- std::ofstream outputTensorFile;
- outputTensorFile.open(m_OutputTensorFile, std::ofstream::out | std::ofstream::trunc);
- if (outputTensorFile.is_open())
- {
- outputTensorFile << m_OutputBinding << ": ";
- std::copy(values.begin(), values.end(), std::ostream_iterator<T>(outputTensorFile, " "));
- }
- else
- {
- ARMNN_LOG(info) << "Output Tensor File: " << m_OutputTensorFile << " could not be opened!";
- }
- outputTensorFile.close();
- }
- }
-
- std::string m_OutputBinding;
- float m_Scale=0.0f;
- int m_Offset=0;
- std::string m_OutputTensorFile;
-};
-
-
-
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
-std::vector<T> GenerateDummyTensorData(unsigned int numElements)
-{
- return std::vector<T>(numElements, static_cast<T>(0));
-}
-
-using TContainer = boost::variant<std::vector<float>, std::vector<int>, std::vector<unsigned char>>;
-using QuantizationParams = std::pair<float, int32_t>;
-
-void PopulateTensorWithData(TContainer& tensorData,
- unsigned int numElements,
- const std::string& dataTypeStr,
- const armnn::Optional<QuantizationParams>& qParams,
- const armnn::Optional<std::string>& dataFile)
-{
- const bool readFromFile = dataFile.has_value() && !dataFile.value().empty();
- const bool quantizeData = qParams.has_value();
-
- std::ifstream inputTensorFile;
- if (readFromFile)
- {
- inputTensorFile = std::ifstream(dataFile.value());
- }
-
- if (dataTypeStr.compare("float") == 0)
- {
- if (quantizeData)
- {
- const float qScale = qParams.value().first;
- const int qOffset = qParams.value().second;
-
- tensorData = readFromFile ?
- ParseDataArray<armnn::DataType::QAsymmU8>(inputTensorFile, qScale, qOffset) :
- GenerateDummyTensorData<armnn::DataType::QAsymmU8>(numElements);
- }
- else
- {
- tensorData = readFromFile ?
- ParseDataArray<armnn::DataType::Float32>(inputTensorFile) :
- GenerateDummyTensorData<armnn::DataType::Float32>(numElements);
- }
- }
- else if (dataTypeStr.compare("int") == 0)
- {
- tensorData = readFromFile ?
- ParseDataArray<armnn::DataType::Signed32>(inputTensorFile) :
- GenerateDummyTensorData<armnn::DataType::Signed32>(numElements);
- }
- else if (dataTypeStr.compare("qasymm8") == 0)
- {
- tensorData = readFromFile ?
- ParseDataArray<armnn::DataType::QAsymmU8>(inputTensorFile) :
- GenerateDummyTensorData<armnn::DataType::QAsymmU8>(numElements);
- }
- else
- {
- std::string errorMessage = "Unsupported tensor data type " + dataTypeStr;
- ARMNN_LOG(fatal) << errorMessage;
-
- inputTensorFile.close();
- throw armnn::Exception(errorMessage);
- }
-
- inputTensorFile.close();
-}
-
-} // anonymous namespace
-
-bool generateTensorData = true;
-
-struct ExecuteNetworkParams
-{
- using TensorShapePtr = std::unique_ptr<armnn::TensorShape>;
-
- const char* m_ModelPath;
- bool m_IsModelBinary;
- std::vector<armnn::BackendId> m_ComputeDevices;
- std::string m_DynamicBackendsPath;
- std::vector<string> m_InputNames;
- std::vector<TensorShapePtr> m_InputTensorShapes;
- std::vector<string> m_InputTensorDataFilePaths;
- std::vector<string> m_InputTypes;
- bool m_QuantizeInput;
- std::vector<string> m_OutputTypes;
- std::vector<string> m_OutputNames;
- std::vector<string> m_OutputTensorFiles;
- bool m_EnableProfiling;
- bool m_EnableFp16TurboMode;
- double m_ThresholdTime;
- bool m_PrintIntermediate;
- size_t m_SubgraphId;
- bool m_EnableLayerDetails = false;
- bool m_GenerateTensorData;
- bool m_ParseUnsupported = false;
-};
-
-template<typename TParser, typename TDataType>
-int MainImpl(const ExecuteNetworkParams& params,
- const std::shared_ptr<armnn::IRuntime>& runtime = nullptr)
-{
- using TContainer = boost::variant<std::vector<float>, std::vector<int>, std::vector<unsigned char>>;
-
- std::vector<TContainer> inputDataContainers;
-
- try
- {
- // Creates an InferenceModel, which will parse the model and load it into an IRuntime.
- typename InferenceModel<TParser, TDataType>::Params inferenceModelParams;
- inferenceModelParams.m_ModelPath = params.m_ModelPath;
- inferenceModelParams.m_IsModelBinary = params.m_IsModelBinary;
- inferenceModelParams.m_ComputeDevices = params.m_ComputeDevices;
- inferenceModelParams.m_DynamicBackendsPath = params.m_DynamicBackendsPath;
- inferenceModelParams.m_PrintIntermediateLayers = params.m_PrintIntermediate;
- inferenceModelParams.m_VisualizePostOptimizationModel = params.m_EnableLayerDetails;
- inferenceModelParams.m_ParseUnsupported = params.m_ParseUnsupported;
-
- for(const std::string& inputName: params.m_InputNames)
- {
- inferenceModelParams.m_InputBindings.push_back(inputName);
- }
-
- for(unsigned int i = 0; i < params.m_InputTensorShapes.size(); ++i)
- {
- inferenceModelParams.m_InputShapes.push_back(*params.m_InputTensorShapes[i]);
- }
-
- for(const std::string& outputName: params.m_OutputNames)
- {
- inferenceModelParams.m_OutputBindings.push_back(outputName);
- }
-
- inferenceModelParams.m_SubgraphId = params.m_SubgraphId;
- inferenceModelParams.m_EnableFp16TurboMode = params.m_EnableFp16TurboMode;
-
- InferenceModel<TParser, TDataType> model(inferenceModelParams,
- params.m_EnableProfiling,
- params.m_DynamicBackendsPath,
- runtime);
-
- const size_t numInputs = inferenceModelParams.m_InputBindings.size();
- for(unsigned int i = 0; i < numInputs; ++i)
- {
- armnn::Optional<QuantizationParams> qParams = params.m_QuantizeInput ?
- armnn::MakeOptional<QuantizationParams>(model.GetInputQuantizationParams()) :
- armnn::EmptyOptional();
-
- armnn::Optional<std::string> dataFile = params.m_GenerateTensorData ?
- armnn::EmptyOptional() :
- armnn::MakeOptional<std::string>(params.m_InputTensorDataFilePaths[i]);
-
- unsigned int numElements = model.GetInputSize(i);
- if (params.m_InputTensorShapes.size() > i && params.m_InputTensorShapes[i])
- {
- // If the user has provided a tensor shape for the current input,
- // override numElements
- numElements = params.m_InputTensorShapes[i]->GetNumElements();
- }
-
- TContainer tensorData;
- PopulateTensorWithData(tensorData,
- numElements,
- params.m_InputTypes[i],
- qParams,
- dataFile);
-
- inputDataContainers.push_back(tensorData);
- }
-
- const size_t numOutputs = inferenceModelParams.m_OutputBindings.size();
- std::vector<TContainer> outputDataContainers;
-
- for (unsigned int i = 0; i < numOutputs; ++i)
- {
- if (params.m_OutputTypes[i].compare("float") == 0)
- {
- outputDataContainers.push_back(std::vector<float>(model.GetOutputSize(i)));
- }
- else if (params.m_OutputTypes[i].compare("int") == 0)
- {
- outputDataContainers.push_back(std::vector<int>(model.GetOutputSize(i)));
- }
- else if (params.m_OutputTypes[i].compare("qasymm8") == 0)
- {
- outputDataContainers.push_back(std::vector<uint8_t>(model.GetOutputSize(i)));
- }
- else
- {
- ARMNN_LOG(fatal) << "Unsupported tensor data type \"" << params.m_OutputTypes[i] << "\". ";
- return EXIT_FAILURE;
- }
- }
-
- // model.Run returns the inference time elapsed in EnqueueWorkload (in milliseconds)
- auto inference_duration = model.Run(inputDataContainers, outputDataContainers);
-
- if (params.m_GenerateTensorData)
- {
- ARMNN_LOG(warning) << "The input data was generated, note that the output will not be useful";
- }
-
- // Print output tensors
- const auto& infosOut = model.GetOutputBindingInfos();
- for (size_t i = 0; i < numOutputs; i++)
- {
- const armnn::TensorInfo& infoOut = infosOut[i].second;
- auto outputTensorFile = params.m_OutputTensorFiles.empty() ? "" : params.m_OutputTensorFiles[i];
-
- TensorPrinter printer(inferenceModelParams.m_OutputBindings[i], infoOut, outputTensorFile);
- boost::apply_visitor(printer, outputDataContainers[i]);
- }
-
- ARMNN_LOG(info) << "\nInference time: " << std::setprecision(2)
- << std::fixed << inference_duration.count() << " ms";
-
- // If thresholdTime == 0.0 (default), then it hasn't been supplied at command line
- if (params.m_ThresholdTime != 0.0)
- {
- ARMNN_LOG(info) << "Threshold time: " << std::setprecision(2)
- << std::fixed << params.m_ThresholdTime << " ms";
- auto thresholdMinusInference = params.m_ThresholdTime - inference_duration.count();
- ARMNN_LOG(info) << "Threshold time - Inference time: " << std::setprecision(2)
- << std::fixed << thresholdMinusInference << " ms" << "\n";
-
- if (thresholdMinusInference < 0)
- {
- std::string errorMessage = "Elapsed inference time is greater than provided threshold time.";
- ARMNN_LOG(fatal) << errorMessage;
- }
- }
- }
- catch (armnn::Exception const& e)
- {
- ARMNN_LOG(fatal) << "Armnn Error: " << e.what();
- return EXIT_FAILURE;
- }
-
- return EXIT_SUCCESS;
-}
-
-// This will run a test
-int RunTest(const std::string& format,
- const std::string& inputTensorShapesStr,
- const vector<armnn::BackendId>& computeDevices,
- const std::string& dynamicBackendsPath,
- const std::string& path,
- const std::string& inputNames,
- const std::string& inputTensorDataFilePaths,
- const std::string& inputTypes,
- bool quantizeInput,
- const std::string& outputTypes,
- const std::string& outputNames,
- const std::string& outputTensorFiles,
- bool enableProfiling,
- bool enableFp16TurboMode,
- const double& thresholdTime,
- bool printIntermediate,
- const size_t subgraphId,
- bool enableLayerDetails = false,
- bool parseUnsupported = false,
- const std::shared_ptr<armnn::IRuntime>& runtime = nullptr)
-{
- std::string modelFormat = boost::trim_copy(format);
- std::string modelPath = boost::trim_copy(path);
- std::vector<std::string> inputNamesVector = ParseStringList(inputNames, ",");
- std::vector<std::string> inputTensorShapesVector = ParseStringList(inputTensorShapesStr, ":");
- std::vector<std::string> inputTensorDataFilePathsVector = ParseStringList(
- inputTensorDataFilePaths, ",");
- std::vector<std::string> outputNamesVector = ParseStringList(outputNames, ",");
- std::vector<std::string> inputTypesVector = ParseStringList(inputTypes, ",");
- std::vector<std::string> outputTypesVector = ParseStringList(outputTypes, ",");
- std::vector<std::string> outputTensorFilesVector = ParseStringList(outputTensorFiles, ",");
-
- // Parse model binary flag from the model-format string we got from the command-line
- bool isModelBinary;
- if (modelFormat.find("bin") != std::string::npos)
- {
- isModelBinary = true;
- }
- else if (modelFormat.find("txt") != std::string::npos || modelFormat.find("text") != std::string::npos)
- {
- isModelBinary = false;
- }
- else
- {
- ARMNN_LOG(fatal) << "Unknown model format: '" << modelFormat << "'. Please include 'binary' or 'text'";
- return EXIT_FAILURE;
- }
-
- if ((inputTensorShapesVector.size() != 0) && (inputTensorShapesVector.size() != inputNamesVector.size()))
- {
- ARMNN_LOG(fatal) << "input-name and input-tensor-shape must have the same amount of elements.";
- return EXIT_FAILURE;
- }
-
- if ((inputTensorDataFilePathsVector.size() != 0) &&
- (inputTensorDataFilePathsVector.size() != inputNamesVector.size()))
- {
- ARMNN_LOG(fatal) << "input-name and input-tensor-data must have the same amount of elements.";
- return EXIT_FAILURE;
- }
-
- if ((outputTensorFilesVector.size() != 0) &&
- (outputTensorFilesVector.size() != outputNamesVector.size()))
- {
- ARMNN_LOG(fatal) << "output-name and write-outputs-to-file must have the same amount of elements.";
- return EXIT_FAILURE;
- }
-
- if (inputTypesVector.size() == 0)
- {
- //Defaults the value of all inputs to "float"
- inputTypesVector.assign(inputNamesVector.size(), "float");
- }
- else if ((inputTypesVector.size() != 0) && (inputTypesVector.size() != inputNamesVector.size()))
- {
- ARMNN_LOG(fatal) << "input-name and input-type must have the same amount of elements.";
- return EXIT_FAILURE;
- }
-
- if (outputTypesVector.size() == 0)
- {
- //Defaults the value of all outputs to "float"
- outputTypesVector.assign(outputNamesVector.size(), "float");
- }
- else if ((outputTypesVector.size() != 0) && (outputTypesVector.size() != outputNamesVector.size()))
- {
- ARMNN_LOG(fatal) << "output-name and output-type must have the same amount of elements.";
- return EXIT_FAILURE;
- }
-
- // Parse input tensor shape from the string we got from the command-line.
- std::vector<std::unique_ptr<armnn::TensorShape>> inputTensorShapes;
-
- if (!inputTensorShapesVector.empty())
- {
- inputTensorShapes.reserve(inputTensorShapesVector.size());
-
- for(const std::string& shape : inputTensorShapesVector)
- {
- std::stringstream ss(shape);
- std::vector<unsigned int> dims = ParseArray(ss);
-
- try
- {
- // Coverity fix: An exception of type armnn::InvalidArgumentException is thrown and never caught.
- inputTensorShapes.push_back(std::make_unique<armnn::TensorShape>(dims.size(), dims.data()));
- }
- catch (const armnn::InvalidArgumentException& e)
- {
- ARMNN_LOG(fatal) << "Cannot create tensor shape: " << e.what();
- return EXIT_FAILURE;
- }
- }
- }
-
- // Check that threshold time is not less than zero
- if (thresholdTime < 0)
- {
- ARMNN_LOG(fatal) << "Threshold time supplied as a command line argument is less than zero.";
- return EXIT_FAILURE;
- }
-
- ExecuteNetworkParams params;
- params.m_ModelPath = modelPath.c_str();
- params.m_IsModelBinary = isModelBinary;
- params.m_ComputeDevices = computeDevices;
- params.m_DynamicBackendsPath = dynamicBackendsPath;
- params.m_InputNames = inputNamesVector;
- params.m_InputTensorShapes = std::move(inputTensorShapes);
- params.m_InputTensorDataFilePaths = inputTensorDataFilePathsVector;
- params.m_InputTypes = inputTypesVector;
- params.m_QuantizeInput = quantizeInput;
- params.m_OutputTypes = outputTypesVector;
- params.m_OutputNames = outputNamesVector;
- params.m_OutputTensorFiles = outputTensorFilesVector;
- params.m_EnableProfiling = enableProfiling;
- params.m_EnableFp16TurboMode = enableFp16TurboMode;
- params.m_ThresholdTime = thresholdTime;
- params.m_PrintIntermediate = printIntermediate;
- params.m_SubgraphId = subgraphId;
- params.m_EnableLayerDetails = enableLayerDetails;
- params.m_GenerateTensorData = inputTensorDataFilePathsVector.empty();
- params.m_ParseUnsupported = parseUnsupported;
-
- // Warn if ExecuteNetwork will generate dummy input data
- if (params.m_GenerateTensorData)
- {
- ARMNN_LOG(warning) << "No input files provided, input tensors will be filled with 0s.";
- }
-
- // Forward to implementation based on the parser type
- if (modelFormat.find("armnn") != std::string::npos)
- {
-#if defined(ARMNN_SERIALIZER)
- return MainImpl<armnnDeserializer::IDeserializer, float>(params, runtime);
-#else
- ARMNN_LOG(fatal) << "Not built with serialization support.";
- return EXIT_FAILURE;
-#endif
- }
- else if (modelFormat.find("caffe") != std::string::npos)
- {
-#if defined(ARMNN_CAFFE_PARSER)
- return MainImpl<armnnCaffeParser::ICaffeParser, float>(params, runtime);
-#else
- ARMNN_LOG(fatal) << "Not built with Caffe parser support.";
- return EXIT_FAILURE;
-#endif
- }
- else if (modelFormat.find("onnx") != std::string::npos)
-{
-#if defined(ARMNN_ONNX_PARSER)
- return MainImpl<armnnOnnxParser::IOnnxParser, float>(params, runtime);
-#else
- ARMNN_LOG(fatal) << "Not built with Onnx parser support.";
- return EXIT_FAILURE;
-#endif
- }
- else if (modelFormat.find("tensorflow") != std::string::npos)
- {
-#if defined(ARMNN_TF_PARSER)
- return MainImpl<armnnTfParser::ITfParser, float>(params, runtime);
-#else
- ARMNN_LOG(fatal) << "Not built with Tensorflow parser support.";
- return EXIT_FAILURE;
-#endif
- }
- else if(modelFormat.find("tflite") != std::string::npos)
- {
-#if defined(ARMNN_TF_LITE_PARSER)
- if (! isModelBinary)
- {
- ARMNN_LOG(fatal) << "Unknown model format: '" << modelFormat << "'. Only 'binary' format supported \
- for tflite files";
- return EXIT_FAILURE;
- }
- return MainImpl<armnnTfLiteParser::ITfLiteParser, float>(params, runtime);
-#else
- ARMNN_LOG(fatal) << "Unknown model format: '" << modelFormat <<
- "'. Please include 'caffe', 'tensorflow', 'tflite' or 'onnx'";
- return EXIT_FAILURE;
-#endif
- }
- else
- {
- ARMNN_LOG(fatal) << "Unknown model format: '" << modelFormat <<
- "'. Please include 'caffe', 'tensorflow', 'tflite' or 'onnx'";
- return EXIT_FAILURE;
- }
-}
-
-int RunCsvTest(const armnnUtils::CsvRow &csvRow, const std::shared_ptr<armnn::IRuntime>& runtime,
- const bool enableProfiling, const bool enableFp16TurboMode, const double& thresholdTime,
- const bool printIntermediate, bool enableLayerDetails = false, bool parseUnuspported = false)
-{
- boost::ignore_unused(runtime);
- std::string modelFormat;
- std::string modelPath;
- std::string inputNames;
- std::string inputTensorShapes;
- std::string inputTensorDataFilePaths;
- std::string outputNames;
- std::string inputTypes;
- std::string outputTypes;
- std::string dynamicBackendsPath;
- std::string outputTensorFiles;
-
- size_t subgraphId = 0;
-
- const std::string backendsMessage = std::string("The preferred order of devices to run layers on by default. ")
- + std::string("Possible choices: ")
- + armnn::BackendRegistryInstance().GetBackendIdsAsString();
-
- po::options_description desc("Options");
- try
- {
- desc.add_options()
- ("model-format,f", po::value(&modelFormat),
- "armnn-binary, caffe-binary, caffe-text, tflite-binary, onnx-binary, onnx-text, tensorflow-binary or "
- "tensorflow-text.")
- ("model-path,m", po::value(&modelPath), "Path to model file, e.g. .armnn, .caffemodel, .prototxt, "
- ".tflite, .onnx")
- ("compute,c", po::value<std::vector<armnn::BackendId>>()->multitoken(),
- backendsMessage.c_str())
- ("dynamic-backends-path,b", po::value(&dynamicBackendsPath),
- "Path where to load any available dynamic backend from. "
- "If left empty (the default), dynamic backends will not be used.")
- ("input-name,i", po::value(&inputNames), "Identifier of the input tensors in the network separated by comma.")
- ("subgraph-number,n", po::value<size_t>(&subgraphId)->default_value(0), "Id of the subgraph to be "
- "executed. Defaults to 0.")
- ("input-tensor-shape,s", po::value(&inputTensorShapes),
- "The shape of the input tensors in the network as a flat array of integers separated by comma. "
- "Several shapes can be passed separating them by semicolon. "
- "This parameter is optional, depending on the network.")
- ("input-tensor-data,d", po::value(&inputTensorDataFilePaths)->default_value(""),
- "Path to files containing the input data as a flat array separated by whitespace. "
- "Several paths can be passed separating them by comma. If not specified, the network will be run with dummy "
- "data (useful for profiling).")
- ("input-type,y",po::value(&inputTypes), "The type of the input tensors in the network separated by comma. "
- "If unset, defaults to \"float\" for all defined inputs. "
- "Accepted values (float, int or qasymm8).")
- ("quantize-input,q",po::bool_switch()->default_value(false),
- "If this option is enabled, all float inputs will be quantized to qasymm8. "
- "If unset, default to not quantized. "
- "Accepted values (true or false)")
- ("output-type,z",po::value(&outputTypes), "The type of the output tensors in the network separated by comma. "
- "If unset, defaults to \"float\" for all defined outputs. "
- "Accepted values (float, int or qasymm8).")
- ("output-name,o", po::value(&outputNames),
- "Identifier of the output tensors in the network separated by comma.")
- ("write-outputs-to-file,w", po::value(&outputTensorFiles),
- "Comma-separated list of output file paths keyed with the binding-id of the output slot. "
- "If left empty (the default), the output tensors will not be written to a file.");
- }
- catch (const std::exception& e)
- {
- // Coverity points out that default_value(...) can throw a bad_lexical_cast,
- // and that desc.add_options() can throw boost::io::too_few_args.
- // They really won't in any of these cases.
- BOOST_ASSERT_MSG(false, "Caught unexpected exception");
- ARMNN_LOG(fatal) << "Fatal internal error: " << e.what();
- return EXIT_FAILURE;
- }
-
- std::vector<const char*> clOptions;
- clOptions.reserve(csvRow.values.size());
- for (const std::string& value : csvRow.values)
- {
- clOptions.push_back(value.c_str());
- }
-
- po::variables_map vm;
- try
- {
- po::store(po::parse_command_line(static_cast<int>(clOptions.size()), clOptions.data(), desc), vm);
-
- po::notify(vm);
-
- CheckOptionDependencies(vm);
- }
- catch (const po::error& e)
- {
- std::cerr << e.what() << std::endl << std::endl;
- std::cerr << desc << std::endl;
- return EXIT_FAILURE;
- }
-
- // Get the value of the switch arguments.
- bool quantizeInput = vm["quantize-input"].as<bool>();
-
- // Get the preferred order of compute devices.
- std::vector<armnn::BackendId> computeDevices = vm["compute"].as<std::vector<armnn::BackendId>>();
-
- // Remove duplicates from the list of compute devices.
- RemoveDuplicateDevices(computeDevices);
-
- // Check that the specified compute devices are valid.
- std::string invalidBackends;
- if (!CheckRequestedBackendsAreValid(computeDevices, armnn::Optional<std::string&>(invalidBackends)))
- {
- ARMNN_LOG(fatal) << "The list of preferred devices contains invalid backend IDs: "
- << invalidBackends;
- return EXIT_FAILURE;
- }
-
- return RunTest(modelFormat, inputTensorShapes, computeDevices, dynamicBackendsPath, modelPath, inputNames,
- inputTensorDataFilePaths, inputTypes, quantizeInput, outputTypes, outputNames, outputTensorFiles,
- enableProfiling, enableFp16TurboMode, thresholdTime, printIntermediate, subgraphId,
- enableLayerDetails, parseUnuspported);
-}
diff --git a/tests/ObjectDetectionCommon.hpp b/tests/ObjectDetectionCommon.hpp
deleted file mode 100644
index ee3afb5788..0000000000
--- a/tests/ObjectDetectionCommon.hpp
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#pragma once
-
-#include <string>
-#include <utility>
-
-namespace
-{
-
-struct BoundingBox
-{
- BoundingBox()
- : BoundingBox(0.0f, 0.0f, 0.0f, 0.0f)
- {}
-
- BoundingBox(float xMin, float yMin, float xMax, float yMax)
- : m_XMin(xMin)
- , m_YMin(yMin)
- , m_XMax(xMax)
- , m_YMax(yMax)
- {}
-
- float m_XMin;
- float m_YMin;
- float m_XMax;
- float m_YMax;
-};
-
-struct DetectedObject
-{
- DetectedObject(float detectedClass,
- const BoundingBox& boundingBox,
- float confidence)
- : m_Class(detectedClass)
- , m_BoundingBox(boundingBox)
- , m_Confidence(confidence)
- {}
-
- bool operator<(const DetectedObject& other) const
- {
- return m_Confidence < other.m_Confidence ||
- (m_Confidence == other.m_Confidence && m_Class < other.m_Class);
- }
-
- float m_Class;
- BoundingBox m_BoundingBox;
- float m_Confidence;
-};
-
-using ObjectDetectionInput = std::pair<std::string, std::vector<DetectedObject>>;
-
-} // anonymous namespace \ No newline at end of file
diff --git a/tests/OnnxMnist-Armnn/OnnxMnist-Armnn.cpp b/tests/OnnxMnist-Armnn/OnnxMnist-Armnn.cpp
deleted file mode 100644
index 33eb7f1ec2..0000000000
--- a/tests/OnnxMnist-Armnn/OnnxMnist-Armnn.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../MnistDatabase.hpp"
-#include "armnnOnnxParser/IOnnxParser.hpp"
-
-int main(int argc, char* argv[])
-{
- armnn::TensorShape inputTensorShape({ 1, 1, 28, 28 });
-
- int retVal = EXIT_FAILURE;
- try
- {
- using DataType = float;
- using DatabaseType = MnistDatabase;
- using ParserType = armnnOnnxParser::IOnnxParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>(
- argc, argv, "mnist_onnx.onnx", true,
- "Input3", "Plus214_Output_0", { 0, 1, 2, 3, 4},
- [](const char* dataDir, const ModelType&) {
- return DatabaseType(dataDir, true);
- },
- &inputTensorShape);
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: OnnxMnist-Armnn: An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/OnnxMnist-Armnn/Validation.txt b/tests/OnnxMnist-Armnn/Validation.txt
deleted file mode 100644
index 8ddde9340a..0000000000
--- a/tests/OnnxMnist-Armnn/Validation.txt
+++ /dev/null
@@ -1,1000 +0,0 @@
-7
-2
-1
-0
-4
-1
-4
-9
-5
-9
-0
-6
-9
-0
-1
-5
-9
-7
-3
-4
-9
-6
-6
-5
-4
-0
-7
-4
-0
-1
-3
-1
-3
-4
-7
-2
-7
-1
-2
-1
-1
-7
-4
-2
-3
-5
-1
-2
-4
-4
-6
-3
-5
-5
-6
-0
-4
-1
-9
-5
-7
-8
-5
-3
-7
-4
-6
-4
-3
-0
-7
-0
-2
-9
-1
-7
-3
-2
-9
-7
-7
-6
-2
-7
-8
-4
-7
-3
-6
-1
-3
-6
-4
-3
-1
-4
-1
-7
-6
-9
-6
-0
-5
-4
-9
-9
-2
-1
-9
-4
-8
-7
-3
-9
-7
-4
-4
-4
-9
-2
-5
-4
-7
-6
-7
-9
-0
-5
-8
-5
-6
-6
-5
-7
-8
-1
-0
-1
-6
-4
-6
-7
-3
-1
-7
-1
-8
-2
-0
-2
-9
-9
-5
-5
-1
-5
-6
-0
-3
-4
-4
-6
-5
-4
-6
-5
-4
-5
-1
-4
-4
-7
-2
-3
-2
-7
-1
-8
-1
-8
-1
-8
-5
-0
-8
-9
-2
-5
-0
-1
-1
-1
-0
-9
-0
-3
-1
-6
-4
-2
-3
-6
-1
-1
-1
-3
-9
-5
-2
-9
-4
-5
-9
-3
-9
-0
-3
-6
-5
-5
-7
-2
-2
-7
-1
-2
-8
-4
-1
-7
-3
-3
-8
-8
-7
-9
-2
-2
-4
-1
-5
-9
-8
-7
-2
-3
-0
-2
-4
-2
-4
-1
-9
-5
-7
-7
-2
-8
-2
-6
-8
-5
-7
-7
-9
-1
-0
-1
-8
-0
-3
-0
-1
-9
-9
-4
-1
-8
-2
-1
-2
-9
-7
-5
-9
-2
-6
-4
-1
-5
-8
-2
-9
-2
-0
-4
-0
-0
-2
-8
-4
-7
-1
-2
-4
-0
-2
-7
-4
-3
-3
-0
-0
-3
-1
-9
-6
-5
-2
-5
-9
-2
-9
-3
-0
-4
-2
-0
-7
-1
-1
-2
-1
-5
-3
-3
-9
-7
-8
-6
-5
-6
-1
-3
-8
-1
-0
-5
-1
-3
-1
-5
-5
-6
-1
-8
-5
-1
-7
-9
-4
-6
-2
-2
-5
-0
-6
-5
-6
-3
-7
-2
-0
-8
-8
-5
-4
-1
-1
-4
-0
-3
-3
-7
-6
-1
-6
-2
-1
-9
-2
-8
-6
-1
-9
-5
-2
-5
-4
-4
-2
-8
-3
-8
-2
-4
-5
-0
-3
-1
-7
-7
-5
-7
-9
-7
-1
-9
-2
-1
-4
-2
-9
-2
-0
-4
-9
-1
-4
-8
-1
-8
-4
-5
-9
-8
-8
-3
-7
-6
-0
-0
-3
-0
-2
-0
-6
-4
-9
-5
-3
-3
-2
-3
-9
-1
-2
-6
-8
-0
-5
-6
-6
-6
-3
-8
-8
-2
-7
-5
-8
-9
-6
-1
-8
-4
-1
-2
-5
-9
-1
-9
-7
-5
-4
-0
-8
-9
-9
-1
-0
-5
-2
-3
-7
-0
-9
-4
-0
-6
-3
-9
-5
-2
-1
-3
-1
-3
-6
-5
-7
-4
-2
-2
-6
-3
-2
-6
-5
-4
-8
-9
-7
-1
-3
-0
-3
-8
-3
-1
-9
-3
-4
-4
-6
-4
-2
-1
-8
-2
-5
-4
-8
-8
-4
-0
-0
-2
-3
-2
-7
-7
-0
-8
-7
-4
-4
-7
-9
-6
-9
-0
-9
-8
-0
-4
-6
-0
-6
-3
-5
-4
-8
-3
-3
-9
-3
-3
-3
-7
-8
-0
-8
-2
-1
-7
-0
-6
-5
-4
-3
-8
-0
-9
-6
-3
-8
-0
-9
-9
-6
-8
-6
-8
-5
-7
-8
-6
-0
-2
-4
-0
-2
-2
-3
-1
-9
-7
-5
-8
-0
-8
-4
-6
-2
-6
-7
-9
-3
-2
-9
-8
-2
-2
-9
-2
-7
-3
-5
-9
-1
-8
-0
-2
-0
-5
-2
-1
-3
-7
-6
-7
-1
-2
-5
-8
-0
-3
-7
-1
-4
-0
-9
-1
-8
-6
-7
-7
-4
-3
-4
-9
-1
-9
-5
-1
-7
-3
-9
-7
-6
-9
-1
-3
-2
-8
-3
-3
-6
-7
-2
-8
-5
-8
-5
-1
-1
-4
-4
-3
-1
-0
-7
-7
-0
-7
-9
-4
-4
-8
-5
-5
-4
-0
-8
-2
-1
-0
-8
-4
-5
-0
-4
-0
-6
-1
-5
-3
-2
-6
-7
-2
-6
-9
-3
-1
-4
-6
-2
-5
-9
-2
-0
-6
-2
-1
-7
-3
-4
-1
-0
-5
-4
-3
-1
-1
-7
-4
-9
-9
-4
-8
-4
-0
-2
-4
-5
-1
-1
-6
-4
-7
-1
-9
-4
-2
-4
-1
-5
-5
-3
-8
-3
-1
-4
-5
-6
-8
-9
-4
-1
-5
-3
-8
-0
-3
-2
-5
-1
-2
-8
-3
-4
-4
-0
-8
-8
-3
-3
-1
-7
-3
-5
-9
-6
-3
-2
-6
-1
-3
-6
-0
-7
-2
-1
-7
-1
-4
-2
-4
-2
-1
-7
-9
-6
-1
-1
-2
-4
-8
-1
-7
-7
-4
-7
-0
-7
-3
-1
-3
-1
-0
-7
-7
-0
-3
-5
-5
-2
-7
-6
-6
-9
-2
-8
-3
-5
-2
-2
-5
-6
-0
-8
-2
-9
-2
-8
-8
-8
-8
-7
-4
-7
-3
-0
-6
-6
-3
-2
-1
-3
-2
-2
-9
-3
-0
-0
-5
-7
-8
-1
-4
-4
-6
-0
-2
-9
-1
-4
-7
-4
-7
-3
-9
-8
-8
-4
-7
-1
-2
-1
-2
-2
-3
-2
-3
-2
-3
-9
-1
-7
-4
-0
-3
-5
-5
-8
-6
-3
-2
-6
-7
-6
-6
-3
-2
-7
-9
-1
-1
-7
-5
-6
-4
-9
-5
-1
-3
-3
-4
-7
-8
-9
-1
-1
-0
-9
-1
-4
-4
-5
-4
-0
-6
-2
-2
-3
-1
-5
-1
-2
-0
-3
-8
-1
-2
-6
-7
-1
-6
-2
-3
-9
-0
-1
-2
-2
-0
-8
-9
diff --git a/tests/OnnxMobileNet-Armnn/OnnxMobileNet-Armnn.cpp b/tests/OnnxMobileNet-Armnn/OnnxMobileNet-Armnn.cpp
deleted file mode 100644
index 8786feacf9..0000000000
--- a/tests/OnnxMobileNet-Armnn/OnnxMobileNet-Armnn.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../ImagePreprocessor.hpp"
-#include "armnnOnnxParser/IOnnxParser.hpp"
-
-int main(int argc, char* argv[])
-{
- int retVal = EXIT_FAILURE;
- try
- {
- // Coverity fix: The following code may throw an exception of type std::length_error.
- std::vector<ImageSet> imageSet =
- {
- {"Dog.jpg", 208},
- {"Cat.jpg", 281},
- {"shark.jpg", 2},
- };
-
- armnn::TensorShape inputTensorShape({ 1, 3, 224, 224 });
-
- using DataType = float;
- using DatabaseType = ImagePreprocessor<float>;
- using ParserType = armnnOnnxParser::IOnnxParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>(
- argc, argv,
- "mobilenetv2-1.0.onnx", // model name
- true, // model is binary
- "data", "mobilenetv20_output_flatten0_reshape0", // input and output tensor names
- { 0, 1, 2 }, // test images to test with as above
- [&imageSet](const char* dataDir, const ModelType&) {
- // This creates create a 1, 3, 224, 224 normalized input with mean and stddev to pass to Armnn
- return DatabaseType(
- dataDir,
- 224,
- 224,
- imageSet,
- 255.0, // scale
- {{0.485f, 0.456f, 0.406f}}, // mean
- {{0.229f, 0.224f, 0.225f}}, // stddev
- DatabaseType::DataFormat::NCHW); // format
- },
- &inputTensorShape);
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: OnnxMobileNet-Armnn: An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/OnnxMobileNet-Armnn/Validation.txt b/tests/OnnxMobileNet-Armnn/Validation.txt
deleted file mode 100644
index ccadd10253..0000000000
--- a/tests/OnnxMobileNet-Armnn/Validation.txt
+++ /dev/null
@@ -1,201 +0,0 @@
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2
-208
-281
-2 \ No newline at end of file
diff --git a/tests/OnnxMobileNet-Armnn/labels.txt b/tests/OnnxMobileNet-Armnn/labels.txt
deleted file mode 100644
index d74ff557dd..0000000000
--- a/tests/OnnxMobileNet-Armnn/labels.txt
+++ /dev/null
@@ -1,1001 +0,0 @@
-0:background
-1:tench, Tinca tinca
-2:goldfish, Carassius auratus
-3:great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias
-4:tiger shark, Galeocerdo cuvieri
-5:hammerhead, hammerhead shark
-6:electric ray, crampfish, numbfish, torpedo
-7:stingray
-8:cock
-9:hen
-10:ostrich, Struthio camelus
-11:brambling, Fringilla montifringilla
-12:goldfinch, Carduelis carduelis
-13:house finch, linnet, Carpodacus mexicanus
-14:junco, snowbird
-15:indigo bunting, indigo finch, indigo bird, Passerina cyanea
-16:robin, American robin, Turdus migratorius
-17:bulbul
-18:jay
-19:magpie
-20:chickadee
-21:water ouzel, dipper
-22:kite
-23:bald eagle, American eagle, Haliaeetus leucocephalus
-24:vulture
-25:great grey owl, great gray owl, Strix nebulosa
-26:European fire salamander, Salamandra salamandra
-27:common newt, Triturus vulgaris
-28:eft
-29:spotted salamander, Ambystoma maculatum
-30:axolotl, mud puppy, Ambystoma mexicanum
-31:bullfrog, Rana catesbeiana
-32:tree frog, tree-frog
-33:tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui
-34:loggerhead, loggerhead turtle, Caretta caretta
-35:leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea
-36:mud turtle
-37:terrapin
-38:box turtle, box tortoise
-39:banded gecko
-40:common iguana, iguana, Iguana iguana
-41:American chameleon, anole, Anolis carolinensis
-42:whiptail, whiptail lizard
-43:agama
-44:frilled lizard, Chlamydosaurus kingi
-45:alligator lizard
-46:Gila monster, Heloderma suspectum
-47:green lizard, Lacerta viridis
-48:African chameleon, Chamaeleo chamaeleon
-49:Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis
-50:African crocodile, Nile crocodile, Crocodylus niloticus
-51:American alligator, Alligator mississipiensis
-52:triceratops
-53:thunder snake, worm snake, Carphophis amoenus
-54:ringneck snake, ring-necked snake, ring snake
-55:hognose snake, puff adder, sand viper
-56:green snake, grass snake
-57:king snake, kingsnake
-58:garter snake, grass snake
-59:water snake
-60:vine snake
-61:night snake, Hypsiglena torquata
-62:boa constrictor, Constrictor constrictor
-63:rock python, rock snake, Python sebae
-64:Indian cobra, Naja naja
-65:green mamba
-66:sea snake
-67:horned viper, cerastes, sand viper, horned asp, Cerastes cornutus
-68:diamondback, diamondback rattlesnake, Crotalus adamanteus
-69:sidewinder, horned rattlesnake, Crotalus cerastes
-70:trilobite
-71:harvestman, daddy longlegs, Phalangium opilio
-72:scorpion
-73:black and gold garden spider, Argiope aurantia
-74:barn spider, Araneus cavaticus
-75:garden spider, Aranea diademata
-76:black widow, Latrodectus mactans
-77:tarantula
-78:wolf spider, hunting spider
-79:tick
-80:centipede
-81:black grouse
-82:ptarmigan
-83:ruffed grouse, partridge, Bonasa umbellus
-84:prairie chicken, prairie grouse, prairie fowl
-85:peacock
-86:quail
-87:partridge
-88:African grey, African gray, Psittacus erithacus
-89:macaw
-90:sulphur-crested cockatoo, Kakatoe galerita, Cacatua galerita
-91:lorikeet
-92:coucal
-93:bee eater
-94:hornbill
-95:hummingbird
-96:jacamar
-97:toucan
-98:drake
-99:red-breasted merganser, Mergus serrator
-100:goose
-101:black swan, Cygnus atratus
-102:tusker
-103:echidna, spiny anteater, anteater
-104:platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus
-105:wallaby, brush kangaroo
-106:koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus
-107:wombat
-108:jellyfish
-109:sea anemone, anemone
-110:brain coral
-111:flatworm, platyhelminth
-112:nematode, nematode worm, roundworm
-113:conch
-114:snail
-115:slug
-116:sea slug, nudibranch
-117:chiton, coat-of-mail shell, sea cradle, polyplacophore
-118:chambered nautilus, pearly nautilus, nautilus
-119:Dungeness crab, Cancer magister
-120:rock crab, Cancer irroratus
-121:fiddler crab
-122:king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica
-123:American lobster, Northern lobster, Maine lobster, Homarus americanus
-124:spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish
-125:crayfish, crawfish, crawdad, crawdaddy
-126:hermit crab
-127:isopod
-128:white stork, Ciconia ciconia
-129:black stork, Ciconia nigra
-130:spoonbill
-131:flamingo
-132:little blue heron, Egretta caerulea
-133:American egret, great white heron, Egretta albus
-134:bittern
-135:crane
-136:limpkin, Aramus pictus
-137:European gallinule, Porphyrio porphyrio
-138:American coot, marsh hen, mud hen, water hen, Fulica americana
-139:bustard
-140:ruddy turnstone, Arenaria interpres
-141:red-backed sandpiper, dunlin, Erolia alpina
-142:redshank, Tringa totanus
-143:dowitcher
-144:oystercatcher, oyster catcher
-145:pelican
-146:king penguin, Aptenodytes patagonica
-147:albatross, mollymawk
-148:grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus
-149:killer whale, killer, orca, grampus, sea wolf, Orcinus orca
-150:dugong, Dugong dugon
-151:sea lion
-152:Chihuahua
-153:Japanese spaniel
-154:Maltese dog, Maltese terrier, Maltese
-155:Pekinese, Pekingese, Peke
-156:Shih-Tzu
-157:Blenheim spaniel
-158:papillon
-159:toy terrier
-160:Rhodesian ridgeback
-161:Afghan hound, Afghan
-162:basset, basset hound
-163:beagle
-164:bloodhound, sleuthhound
-165:bluetick
-166:black-and-tan coonhound
-167:Walker hound, Walker foxhound
-168:English foxhound
-169:redbone
-170:borzoi, Russian wolfhound
-171:Irish wolfhound
-172:Italian greyhound
-173:whippet
-174:Ibizan hound, Ibizan Podenco
-175:Norwegian elkhound, elkhound
-176:otterhound, otter hound
-177:Saluki, gazelle hound
-178:Scottish deerhound, deerhound
-179:Weimaraner
-180:Staffordshire bullterrier, Staffordshire bull terrier
-181:American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier
-182:Bedlington terrier
-183:Border terrier
-184:Kerry blue terrier
-185:Irish terrier
-186:Norfolk terrier
-187:Norwich terrier
-188:Yorkshire terrier
-189:wire-haired fox terrier
-190:Lakeland terrier
-191:Sealyham terrier, Sealyham
-192:Airedale, Airedale terrier
-193:cairn, cairn terrier
-194:Australian terrier
-195:Dandie Dinmont, Dandie Dinmont terrier
-196:Boston bull, Boston terrier
-197:miniature schnauzer
-198:giant schnauzer
-199:standard schnauzer
-200:Scotch terrier, Scottish terrier, Scottie
-201:Tibetan terrier, chrysanthemum dog
-202:silky terrier, Sydney silky
-203:soft-coated wheaten terrier
-204:West Highland white terrier
-205:Lhasa, Lhasa apso
-206:flat-coated retriever
-207:curly-coated retriever
-208:golden retriever
-209:Labrador retriever
-210:Chesapeake Bay retriever
-211:German short-haired pointer
-212:vizsla, Hungarian pointer
-213:English setter
-214:Irish setter, red setter
-215:Gordon setter
-216:Brittany spaniel
-217:clumber, clumber spaniel
-218:English springer, English springer spaniel
-219:Welsh springer spaniel
-220:cocker spaniel, English cocker spaniel, cocker
-221:Sussex spaniel
-222:Irish water spaniel
-223:kuvasz
-224:schipperke
-225:groenendael
-226:malinois
-227:briard
-228:kelpie
-229:komondor
-230:Old English sheepdog, bobtail
-231:Shetland sheepdog, Shetland sheep dog, Shetland
-232:collie
-233:Border collie
-234:Bouvier des Flandres, Bouviers des Flandres
-235:Rottweiler
-236:German shepherd, German shepherd dog, German police dog, alsatian
-237:Doberman, Doberman pinscher
-238:miniature pinscher
-239:Greater Swiss Mountain dog
-240:Bernese mountain dog
-241:Appenzeller
-242:EntleBucher
-243:boxer
-244:bull mastiff
-245:Tibetan mastiff
-246:French bulldog
-247:Great Dane
-248:Saint Bernard, St Bernard
-249:Eskimo dog, husky
-250:malamute, malemute, Alaskan malamute
-251:Siberian husky
-252:dalmatian, coach dog, carriage dog
-253:affenpinscher, monkey pinscher, monkey dog
-254:basenji
-255:pug, pug-dog
-256:Leonberg
-257:Newfoundland, Newfoundland dog
-258:Great Pyrenees
-259:Samoyed, Samoyede
-260:Pomeranian
-261:chow, chow chow
-262:keeshond
-263:Brabancon griffon
-264:Pembroke, Pembroke Welsh corgi
-265:Cardigan, Cardigan Welsh corgi
-266:toy poodle
-267:miniature poodle
-268:standard poodle
-269:Mexican hairless
-270:timber wolf, grey wolf, gray wolf, Canis lupus
-271:white wolf, Arctic wolf, Canis lupus tundrarum
-272:red wolf, maned wolf, Canis rufus, Canis niger
-273:coyote, prairie wolf, brush wolf, Canis latrans
-274:dingo, warrigal, warragal, Canis dingo
-275:dhole, Cuon alpinus
-276:African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus
-277:hyena, hyaena
-278:red fox, Vulpes vulpes
-279:kit fox, Vulpes macrotis
-280:Arctic fox, white fox, Alopex lagopus
-281:grey fox, gray fox, Urocyon cinereoargenteus
-282:tabby, tabby cat
-283:tiger cat
-284:Persian cat
-285:Siamese cat, Siamese
-286:Egyptian cat
-287:cougar, puma, catamount, mountain lion, painter, panther, Felis concolor
-288:lynx, catamount
-289:leopard, Panthera pardus
-290:snow leopard, ounce, Panthera uncia
-291:jaguar, panther, Panthera onca, Felis onca
-292:lion, king of beasts, Panthera leo
-293:tiger, Panthera tigris
-294:cheetah, chetah, Acinonyx jubatus
-295:brown bear, bruin, Ursus arctos
-296:American black bear, black bear, Ursus americanus, Euarctos americanus
-297:ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus
-298:sloth bear, Melursus ursinus, Ursus ursinus
-299:mongoose
-300:meerkat, mierkat
-301:tiger beetle
-302:ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle
-303:ground beetle, carabid beetle
-304:long-horned beetle, longicorn, longicorn beetle
-305:leaf beetle, chrysomelid
-306:dung beetle
-307:rhinoceros beetle
-308:weevil
-309:fly
-310:bee
-311:ant, emmet, pismire
-312:grasshopper, hopper
-313:cricket
-314:walking stick, walkingstick, stick insect
-315:cockroach, roach
-316:mantis, mantid
-317:cicada, cicala
-318:leafhopper
-319:lacewing, lacewing fly
-320:dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk
-321:damselfly
-322:admiral
-323:ringlet, ringlet butterfly
-324:monarch, monarch butterfly, milkweed butterfly, Danaus plexippus
-325:cabbage butterfly
-326:sulphur butterfly, sulfur butterfly
-327:lycaenid, lycaenid butterfly
-328:starfish, sea star
-329:sea urchin
-330:sea cucumber, holothurian
-331:wood rabbit, cottontail, cottontail rabbit
-332:hare
-333:Angora, Angora rabbit
-334:hamster
-335:porcupine, hedgehog
-336:fox squirrel, eastern fox squirrel, Sciurus niger
-337:marmot
-338:beaver
-339:guinea pig, Cavia cobaya
-340:sorrel
-341:zebra
-342:hog, pig, grunter, squealer, Sus scrofa
-343:wild boar, boar, Sus scrofa
-344:warthog
-345:hippopotamus, hippo, river horse, Hippopotamus amphibius
-346:ox
-347:water buffalo, water ox, Asiatic buffalo, Bubalus bubalis
-348:bison
-349:ram, tup
-350:bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis
-351:ibex, Capra ibex
-352:hartebeest
-353:impala, Aepyceros melampus
-354:gazelle
-355:Arabian camel, dromedary, Camelus dromedarius
-356:llama
-357:weasel
-358:mink
-359:polecat, fitch, foulmart, foumart, Mustela putorius
-360:black-footed ferret, ferret, Mustela nigripes
-361:otter
-362:skunk, polecat, wood pussy
-363:badger
-364:armadillo
-365:three-toed sloth, ai, Bradypus tridactylus
-366:orangutan, orang, orangutang, Pongo pygmaeus
-367:gorilla, Gorilla gorilla
-368:chimpanzee, chimp, Pan troglodytes
-369:gibbon, Hylobates lar
-370:siamang, Hylobates syndactylus, Symphalangus syndactylus
-371:guenon, guenon monkey
-372:patas, hussar monkey, Erythrocebus patas
-373:baboon
-374:macaque
-375:langur
-376:colobus, colobus monkey
-377:proboscis monkey, Nasalis larvatus
-378:marmoset
-379:capuchin, ringtail, Cebus capucinus
-380:howler monkey, howler
-381:titi, titi monkey
-382:spider monkey, Ateles geoffroyi
-383:squirrel monkey, Saimiri sciureus
-384:Madagascar cat, ring-tailed lemur, Lemur catta
-385:indri, indris, Indri indri, Indri brevicaudatus
-386:Indian elephant, Elephas maximus
-387:African elephant, Loxodonta africana
-388:lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens
-389:giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca
-390:barracouta, snoek
-391:eel
-392:coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch
-393:rock beauty, Holocanthus tricolor
-394:anemone fish
-395:sturgeon
-396:gar, garfish, garpike, billfish, Lepisosteus osseus
-397:lionfish
-398:puffer, pufferfish, blowfish, globefish
-399:abacus
-400:abaya
-401:academic gown, academic robe, judge's robe
-402:accordion, piano accordion, squeeze box
-403:acoustic guitar
-404:aircraft carrier, carrier, flattop, attack aircraft carrier
-405:airliner
-406:airship, dirigible
-407:altar
-408:ambulance
-409:amphibian, amphibious vehicle
-410:analog clock
-411:apiary, bee house
-412:apron
-413:ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin
-414:assault rifle, assault gun
-415:backpack, back pack, knapsack, packsack, rucksack, haversack
-416:bakery, bakeshop, bakehouse
-417:balance beam, beam
-418:balloon
-419:ballpoint, ballpoint pen, ballpen, Biro
-420:Band Aid
-421:banjo
-422:bannister, banister, balustrade, balusters, handrail
-423:barbell
-424:barber chair
-425:barbershop
-426:barn
-427:barometer
-428:barrel, cask
-429:barrow, garden cart, lawn cart, wheelbarrow
-430:baseball
-431:basketball
-432:bassinet
-433:bassoon
-434:bathing cap, swimming cap
-435:bath towel
-436:bathtub, bathing tub, bath, tub
-437:beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon
-438:beacon, lighthouse, beacon light, pharos
-439:beaker
-440:bearskin, busby, shako
-441:beer bottle
-442:beer glass
-443:bell cote, bell cot
-444:bib
-445:bicycle-built-for-two, tandem bicycle, tandem
-446:bikini, two-piece
-447:binder, ring-binder
-448:binoculars, field glasses, opera glasses
-449:birdhouse
-450:boathouse
-451:bobsled, bobsleigh, bob
-452:bolo tie, bolo, bola tie, bola
-453:bonnet, poke bonnet
-454:bookcase
-455:bookshop, bookstore, bookstall
-456:bottlecap
-457:bow
-458:bow tie, bow-tie, bowtie
-459:brass, memorial tablet, plaque
-460:brassiere, bra, bandeau
-461:breakwater, groin, groyne, mole, bulwark, seawall, jetty
-462:breastplate, aegis, egis
-463:broom
-464:bucket, pail
-465:buckle
-466:bulletproof vest
-467:bullet train, bullet
-468:butcher shop, meat market
-469:cab, hack, taxi, taxicab
-470:caldron, cauldron
-471:candle, taper, wax light
-472:cannon
-473:canoe
-474:can opener, tin opener
-475:cardigan
-476:car mirror
-477:carousel, carrousel, merry-go-round, roundabout, whirligig
-478:carpenter's kit, tool kit
-479:carton
-480:car wheel
-481:cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM
-482:cassette
-483:cassette player
-484:castle
-485:catamaran
-486:CD player
-487:cello, violoncello
-488:cellular telephone, cellular phone, cellphone, cell, mobile phone
-489:chain
-490:chainlink fence
-491:chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour
-492:chain saw, chainsaw
-493:chest
-494:chiffonier, commode
-495:chime, bell, gong
-496:china cabinet, china closet
-497:Christmas stocking
-498:church, church building
-499:cinema, movie theater, movie theatre, movie house, picture palace
-500:cleaver, meat cleaver, chopper
-501:cliff dwelling
-502:cloak
-503:clog, geta, patten, sabot
-504:cocktail shaker
-505:coffee mug
-506:coffeepot
-507:coil, spiral, volute, whorl, helix
-508:combination lock
-509:computer keyboard, keypad
-510:confectionery, confectionary, candy store
-511:container ship, containership, container vessel
-512:convertible
-513:corkscrew, bottle screw
-514:cornet, horn, trumpet, trump
-515:cowboy boot
-516:cowboy hat, ten-gallon hat
-517:cradle
-518:crane
-519:crash helmet
-520:crate
-521:crib, cot
-522:Crock Pot
-523:croquet ball
-524:crutch
-525:cuirass
-526:dam, dike, dyke
-527:desk
-528:desktop computer
-529:dial telephone, dial phone
-530:diaper, nappy, napkin
-531:digital clock
-532:digital watch
-533:dining table, board
-534:dishrag, dishcloth
-535:dishwasher, dish washer, dishwashing machine
-536:disk brake, disc brake
-537:dock, dockage, docking facility
-538:dogsled, dog sled, dog sleigh
-539:dome
-540:doormat, welcome mat
-541:drilling platform, offshore rig
-542:drum, membranophone, tympan
-543:drumstick
-544:dumbbell
-545:Dutch oven
-546:electric fan, blower
-547:electric guitar
-548:electric locomotive
-549:entertainment center
-550:envelope
-551:espresso maker
-552:face powder
-553:feather boa, boa
-554:file, file cabinet, filing cabinet
-555:fireboat
-556:fire engine, fire truck
-557:fire screen, fireguard
-558:flagpole, flagstaff
-559:flute, transverse flute
-560:folding chair
-561:football helmet
-562:forklift
-563:fountain
-564:fountain pen
-565:four-poster
-566:freight car
-567:French horn, horn
-568:frying pan, frypan, skillet
-569:fur coat
-570:garbage truck, dustcart
-571:gasmask, respirator, gas helmet
-572:gas pump, gasoline pump, petrol pump, island dispenser
-573:goblet
-574:go-kart
-575:golf ball
-576:golfcart, golf cart
-577:gondola
-578:gong, tam-tam
-579:gown
-580:grand piano, grand
-581:greenhouse, nursery, glasshouse
-582:grille, radiator grille
-583:grocery store, grocery, food market, market
-584:guillotine
-585:hair slide
-586:hair spray
-587:half track
-588:hammer
-589:hamper
-590:hand blower, blow dryer, blow drier, hair dryer, hair drier
-591:hand-held computer, hand-held microcomputer
-592:handkerchief, hankie, hanky, hankey
-593:hard disc, hard disk, fixed disk
-594:harmonica, mouth organ, harp, mouth harp
-595:harp
-596:harvester, reaper
-597:hatchet
-598:holster
-599:home theater, home theatre
-600:honeycomb
-601:hook, claw
-602:hoopskirt, crinoline
-603:horizontal bar, high bar
-604:horse cart, horse-cart
-605:hourglass
-606:iPod
-607:iron, smoothing iron
-608:jack-o'-lantern
-609:jean, blue jean, denim
-610:jeep, landrover
-611:jersey, T-shirt, tee shirt
-612:jigsaw puzzle
-613:jinrikisha, ricksha, rickshaw
-614:joystick
-615:kimono
-616:knee pad
-617:knot
-618:lab coat, laboratory coat
-619:ladle
-620:lampshade, lamp shade
-621:laptop, laptop computer
-622:lawn mower, mower
-623:lens cap, lens cover
-624:letter opener, paper knife, paperknife
-625:library
-626:lifeboat
-627:lighter, light, igniter, ignitor
-628:limousine, limo
-629:liner, ocean liner
-630:lipstick, lip rouge
-631:Loafer
-632:lotion
-633:loudspeaker, speaker, speaker unit, loudspeaker system, speaker system
-634:loupe, jeweler's loupe
-635:lumbermill, sawmill
-636:magnetic compass
-637:mailbag, postbag
-638:mailbox, letter box
-639:maillot
-640:maillot, tank suit
-641:manhole cover
-642:maraca
-643:marimba, xylophone
-644:mask
-645:matchstick
-646:maypole
-647:maze, labyrinth
-648:measuring cup
-649:medicine chest, medicine cabinet
-650:megalith, megalithic structure
-651:microphone, mike
-652:microwave, microwave oven
-653:military uniform
-654:milk can
-655:minibus
-656:miniskirt, mini
-657:minivan
-658:missile
-659:mitten
-660:mixing bowl
-661:mobile home, manufactured home
-662:Model T
-663:modem
-664:monastery
-665:monitor
-666:moped
-667:mortar
-668:mortarboard
-669:mosque
-670:mosquito net
-671:motor scooter, scooter
-672:mountain bike, all-terrain bike, off-roader
-673:mountain tent
-674:mouse, computer mouse
-675:mousetrap
-676:moving van
-677:muzzle
-678:nail
-679:neck brace
-680:necklace
-681:nipple
-682:notebook, notebook computer
-683:obelisk
-684:oboe, hautboy, hautbois
-685:ocarina, sweet potato
-686:odometer, hodometer, mileometer, milometer
-687:oil filter
-688:organ, pipe organ
-689:oscilloscope, scope, cathode-ray oscilloscope, CRO
-690:overskirt
-691:oxcart
-692:oxygen mask
-693:packet
-694:paddle, boat paddle
-695:paddlewheel, paddle wheel
-696:padlock
-697:paintbrush
-698:pajama, pyjama, pj's, jammies
-699:palace
-700:panpipe, pandean pipe, syrinx
-701:paper towel
-702:parachute, chute
-703:parallel bars, bars
-704:park bench
-705:parking meter
-706:passenger car, coach, carriage
-707:patio, terrace
-708:pay-phone, pay-station
-709:pedestal, plinth, footstall
-710:pencil box, pencil case
-711:pencil sharpener
-712:perfume, essence
-713:Petri dish
-714:photocopier
-715:pick, plectrum, plectron
-716:pickelhaube
-717:picket fence, paling
-718:pickup, pickup truck
-719:pier
-720:piggy bank, penny bank
-721:pill bottle
-722:pillow
-723:ping-pong ball
-724:pinwheel
-725:pirate, pirate ship
-726:pitcher, ewer
-727:plane, carpenter's plane, woodworking plane
-728:planetarium
-729:plastic bag
-730:plate rack
-731:plow, plough
-732:plunger, plumber's helper
-733:Polaroid camera, Polaroid Land camera
-734:pole
-735:police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria
-736:poncho
-737:pool table, billiard table, snooker table
-738:pop bottle, soda bottle
-739:pot, flowerpot
-740:potter's wheel
-741:power drill
-742:prayer rug, prayer mat
-743:printer
-744:prison, prison house
-745:projectile, missile
-746:projector
-747:puck, hockey puck
-748:punching bag, punch bag, punching ball, punchball
-749:purse
-750:quill, quill pen
-751:quilt, comforter, comfort, puff
-752:racer, race car, racing car
-753:racket, racquet
-754:radiator
-755:radio, wireless
-756:radio telescope, radio reflector
-757:rain barrel
-758:recreational vehicle, RV, R.V.
-759:reel
-760:reflex camera
-761:refrigerator, icebox
-762:remote control, remote
-763:restaurant, eating house, eating place, eatery
-764:revolver, six-gun, six-shooter
-765:rifle
-766:rocking chair, rocker
-767:rotisserie
-768:rubber eraser, rubber, pencil eraser
-769:rugby ball
-770:rule, ruler
-771:running shoe
-772:safe
-773:safety pin
-774:saltshaker, salt shaker
-775:sandal
-776:sarong
-777:sax, saxophone
-778:scabbard
-779:scale, weighing machine
-780:school bus
-781:schooner
-782:scoreboard
-783:screen, CRT screen
-784:screw
-785:screwdriver
-786:seat belt, seatbelt
-787:sewing machine
-788:shield, buckler
-789:shoe shop, shoe-shop, shoe store
-790:shoji
-791:shopping basket
-792:shopping cart
-793:shovel
-794:shower cap
-795:shower curtain
-796:ski
-797:ski mask
-798:sleeping bag
-799:slide rule, slipstick
-800:sliding door
-801:slot, one-armed bandit
-802:snorkel
-803:snowmobile
-804:snowplow, snowplough
-805:soap dispenser
-806:soccer ball
-807:sock
-808:solar dish, solar collector, solar furnace
-809:sombrero
-810:soup bowl
-811:space bar
-812:space heater
-813:space shuttle
-814:spatula
-815:speedboat
-816:spider web, spider's web
-817:spindle
-818:sports car, sport car
-819:spotlight, spot
-820:stage
-821:steam locomotive
-822:steel arch bridge
-823:steel drum
-824:stethoscope
-825:stole
-826:stone wall
-827:stopwatch, stop watch
-828:stove
-829:strainer
-830:streetcar, tram, tramcar, trolley, trolley car
-831:stretcher
-832:studio couch, day bed
-833:stupa, tope
-834:submarine, pigboat, sub, U-boat
-835:suit, suit of clothes
-836:sundial
-837:sunglass
-838:sunglasses, dark glasses, shades
-839:sunscreen, sunblock, sun blocker
-840:suspension bridge
-841:swab, swob, mop
-842:sweatshirt
-843:swimming trunks, bathing trunks
-844:swing
-845:switch, electric switch, electrical switch
-846:syringe
-847:table lamp
-848:tank, army tank, armored combat vehicle, armoured combat vehicle
-849:tape player
-850:teapot
-851:teddy, teddy bear
-852:television, television system
-853:tennis ball
-854:thatch, thatched roof
-855:theater curtain, theatre curtain
-856:thimble
-857:thresher, thrasher, threshing machine
-858:throne
-859:tile roof
-860:toaster
-861:tobacco shop, tobacconist shop, tobacconist
-862:toilet seat
-863:torch
-864:totem pole
-865:tow truck, tow car, wrecker
-866:toyshop
-867:tractor
-868:trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi
-869:tray
-870:trench coat
-871:tricycle, trike, velocipede
-872:trimaran
-873:tripod
-874:triumphal arch
-875:trolleybus, trolley coach, trackless trolley
-876:trombone
-877:tub, vat
-878:turnstile
-879:typewriter keyboard
-880:umbrella
-881:unicycle, monocycle
-882:upright, upright piano
-883:vacuum, vacuum cleaner
-884:vase
-885:vault
-886:velvet
-887:vending machine
-888:vestment
-889:viaduct
-890:violin, fiddle
-891:volleyball
-892:waffle iron
-893:wall clock
-894:wallet, billfold, notecase, pocketbook
-895:wardrobe, closet, press
-896:warplane, military plane
-897:washbasin, handbasin, washbowl, lavabo, wash-hand basin
-898:washer, automatic washer, washing machine
-899:water bottle
-900:water jug
-901:water tower
-902:whiskey jug
-903:whistle
-904:wig
-905:window screen
-906:window shade
-907:Windsor tie
-908:wine bottle
-909:wing
-910:wok
-911:wooden spoon
-912:wool, woolen, woollen
-913:worm fence, snake fence, snake-rail fence, Virginia fence
-914:wreck
-915:yawl
-916:yurt
-917:web site, website, internet site, site
-918:comic book
-919:crossword puzzle, crossword
-920:street sign
-921:traffic light, traffic signal, stoplight
-922:book jacket, dust cover, dust jacket, dust wrapper
-923:menu
-924:plate
-925:guacamole
-926:consomme
-927:hot pot, hotpot
-928:trifle
-929:ice cream, icecream
-930:ice lolly, lolly, lollipop, popsicle
-931:French loaf
-932:bagel, beigel
-933:pretzel
-934:cheeseburger
-935:hotdog, hot dog, red hot
-936:mashed potato
-937:head cabbage
-938:broccoli
-939:cauliflower
-940:zucchini, courgette
-941:spaghetti squash
-942:acorn squash
-943:butternut squash
-944:cucumber, cuke
-945:artichoke, globe artichoke
-946:bell pepper
-947:cardoon
-948:mushroom
-949:Granny Smith
-950:strawberry
-951:orange
-952:lemon
-953:fig
-954:pineapple, ananas
-955:banana
-956:jackfruit, jak, jack
-957:custard apple
-958:pomegranate
-959:hay
-960:carbonara
-961:chocolate sauce, chocolate syrup
-962:dough
-963:meat loaf, meatloaf
-964:pizza, pizza pie
-965:potpie
-966:burrito
-967:red wine
-968:espresso
-969:cup
-970:eggnog
-971:alp
-972:bubble
-973:cliff, drop, drop-off
-974:coral reef
-975:geyser
-976:lakeside, lakeshore
-977:promontory, headland, head, foreland
-978:sandbar, sand bar
-979:seashore, coast, seacoast, sea-coast
-980:valley, vale
-981:volcano
-982:ballplayer, baseball player
-983:groom, bridegroom
-984:scuba diver
-985:rapeseed
-986:daisy
-987:yellow lady's slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum
-988:corn
-989:acorn
-990:hip, rose hip, rosehip
-991:buckeye, horse chestnut, conker
-992:coral fungus
-993:agaric
-994:gyromitra
-995:stinkhorn, carrion fungus
-996:earthstar
-997:hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa
-998:bolete
-999:ear, spike, capitulum
-1000:toilet tissue, toilet paper, bathroom tissue
diff --git a/tests/TfCifar10-Armnn/TfCifar10-Armnn.cpp b/tests/TfCifar10-Armnn/TfCifar10-Armnn.cpp
deleted file mode 100644
index d42dd2d804..0000000000
--- a/tests/TfCifar10-Armnn/TfCifar10-Armnn.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../Cifar10Database.hpp"
-#include "armnnTfParser/ITfParser.hpp"
-
-int main(int argc, char* argv[])
-{
- armnn::TensorShape inputTensorShape({ 1, 32, 32, 3 });
-
- int retVal = EXIT_FAILURE;
- try
- {
- using DataType = float;
- using DatabaseType = Cifar10Database;
- using ParserType = armnnTfParser::ITfParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>(
- argc, argv, "cifar10_tf.prototxt", false,
- "data", "prob", { 0, 1, 2, 4, 7 },
- [](const char* dataDir, const ModelType&) {
- return DatabaseType(dataDir, true);
- }, &inputTensorShape);
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: TfCifar10-Armnn: An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/TfCifar10-Armnn/Validation.txt b/tests/TfCifar10-Armnn/Validation.txt
deleted file mode 100644
index a7b59465eb..0000000000
--- a/tests/TfCifar10-Armnn/Validation.txt
+++ /dev/null
@@ -1,1000 +0,0 @@
-3
-8
-8
-8
-6
-8
-5
-6
-3
-8
-0
-9
-5
-7
-9
-8
-5
-7
-8
-6
-7
-0
-8
-9
-4
-3
-3
-0
-9
-6
-6
-5
-8
-3
-9
-3
-7
-9
-9
-5
-0
-6
-7
-3
-0
-9
-3
-8
-7
-2
-9
-8
-5
-5
-8
-8
-7
-5
-5
-3
-7
-5
-2
-3
-6
-7
-8
-0
-3
-7
-0
-3
-8
-8
-0
-2
-0
-8
-5
-8
-8
-0
-1
-7
-3
-0
-3
-3
-8
-9
-0
-2
-8
-6
-7
-3
-6
-0
-0
-7
-8
-5
-6
-3
-1
-1
-3
-6
-8
-7
-5
-0
-2
-3
-0
-3
-0
-3
-7
-5
-8
-0
-1
-2
-8
-8
-8
-3
-6
-0
-4
-1
-8
-9
-1
-0
-9
-4
-2
-8
-3
-5
-6
-5
-8
-0
-6
-5
-5
-5
-8
-9
-5
-0
-0
-5
-0
-9
-5
-4
-0
-0
-0
-6
-0
-0
-8
-8
-5
-8
-9
-0
-8
-8
-9
-9
-3
-7
-5
-0
-0
-5
-2
-8
-0
-8
-5
-3
-3
-8
-5
-8
-0
-1
-7
-3
-8
-8
-7
-8
-5
-0
-8
-0
-1
-3
-8
-5
-7
-8
-7
-0
-5
-8
-8
-0
-7
-9
-8
-2
-7
-5
-8
-5
-5
-9
-8
-0
-3
-6
-5
-1
-7
-8
-8
-0
-4
-0
-5
-3
-1
-1
-8
-3
-0
-8
-1
-8
-2
-0
-5
-5
-9
-9
-2
-8
-3
-0
-8
-9
-8
-8
-3
-3
-0
-8
-8
-4
-7
-0
-0
-3
-6
-3
-8
-0
-0
-3
-2
-5
-9
-0
-6
-1
-0
-9
-8
-8
-7
-9
-8
-2
-6
-9
-3
-0
-6
-0
-0
-6
-6
-3
-3
-8
-8
-8
-8
-3
-1
-0
-8
-6
-0
-0
-8
-0
-7
-7
-5
-5
-3
-3
-2
-0
-5
-0
-7
-7
-3
-6
-1
-9
-3
-6
-6
-9
-3
-8
-0
-7
-0
-6
-2
-5
-8
-5
-7
-6
-8
-9
-9
-1
-8
-2
-3
-7
-5
-2
-8
-0
-9
-5
-8
-8
-9
-4
-0
-5
-8
-0
-0
-7
-9
-3
-2
-7
-3
-7
-8
-6
-6
-9
-0
-8
-5
-0
-7
-3
-5
-5
-1
-2
-6
-2
-3
-6
-2
-3
-0
-8
-9
-8
-7
-8
-8
-4
-0
-8
-8
-3
-5
-8
-3
-8
-1
-9
-0
-5
-5
-7
-4
-7
-8
-0
-0
-9
-3
-7
-0
-6
-3
-3
-8
-7
-3
-7
-8
-5
-3
-8
-1
-3
-9
-8
-8
-7
-3
-0
-0
-0
-2
-9
-7
-0
-8
-3
-4
-5
-3
-8
-5
-6
-8
-7
-3
-8
-4
-3
-7
-8
-5
-7
-8
-8
-3
-7
-4
-0
-5
-4
-3
-6
-0
-8
-5
-8
-9
-9
-8
-0
-0
-0
-0
-1
-8
-8
-0
-5
-2
-0
-4
-0
-5
-2
-9
-4
-7
-9
-0
-4
-5
-6
-8
-9
-5
-5
-8
-9
-3
-8
-5
-7
-0
-7
-0
-5
-0
-0
-0
-6
-8
-8
-9
-5
-6
-3
-6
-3
-9
-8
-1
-7
-0
-7
-5
-9
-0
-6
-5
-5
-3
-3
-8
-3
-9
-8
-6
-4
-3
-2
-0
-7
-6
-0
-2
-3
-9
-5
-8
-0
-6
-7
-8
-3
-6
-8
-8
-8
-7
-5
-4
-0
-8
-4
-0
-8
-3
-5
-8
-9
-6
-9
-2
-3
-0
-0
-7
-8
-8
-3
-8
-5
-0
-2
-1
-6
-3
-4
-3
-9
-6
-9
-8
-8
-5
-8
-6
-3
-2
-1
-7
-7
-1
-2
-7
-9
-9
-4
-4
-0
-8
-3
-2
-8
-7
-0
-8
-3
-0
-3
-3
-8
-0
-7
-9
-1
-8
-0
-4
-5
-3
-9
-3
-0
-8
-0
-1
-5
-4
-1
-8
-0
-7
-6
-3
-0
-9
-0
-8
-2
-6
-3
-2
-3
-0
-0
-3
-8
-0
-3
-9
-6
-8
-0
-9
-2
-8
-2
-3
-0
-3
-2
-2
-7
-8
-3
-8
-0
-7
-5
-7
-0
-4
-8
-7
-4
-8
-3
-8
-8
-6
-0
-8
-7
-4
-3
-3
-8
-4
-8
-7
-8
-8
-9
-8
-8
-1
-3
-3
-5
-5
-0
-7
-9
-8
-0
-8
-4
-1
-3
-5
-7
-8
-7
-8
-7
-4
-6
-2
-5
-8
-0
-8
-1
-2
-0
-6
-8
-2
-1
-3
-5
-6
-0
-1
-2
-0
-8
-3
-0
-5
-0
-6
-8
-0
-2
-7
-6
-0
-6
-9
-1
-7
-8
-7
-0
-3
-9
-7
-8
-0
-0
-3
-3
-7
-5
-4
-8
-8
-8
-7
-1
-2
-7
-4
-4
-8
-4
-7
-7
-3
-2
-7
-2
-0
-8
-8
-5
-8
-0
-8
-2
-0
-8
-7
-5
-0
-8
-5
-0
-0
-8
-2
-2
-2
-8
-9
-2
-7
-2
-7
-0
-7
-2
-1
-0
-0
-0
-8
-4
-7
-9
-8
-0
-0
-7
-7
-0
-7
-8
-4
-4
-3
-5
-0
-1
-3
-7
-0
-1
-8
-1
-4
-2
-3
-8
-4
-5
-0
-7
-8
-8
-3
-0
-8
-8
-8
-8
-8
-4
-3
-6
-7
-3
-1
-8
-3
-7
-7
-5
-5
-6
-6
-5
-8
-8
-1
-6
-8
-8
-3
-3
-3
-2
-0
-1
-8
-8
-8
-0
-0
-9
-9
-3
-3
-5
-8
-3
-0
-0
-4
-2
-3
-3
-7
-3
-0
-5
-8
-8
-9
-8
-5
-4
-8
-3
-0
-8
-7
-8
-3
-9
-2
-8
-4
-7
-8
-3
-7
-8
-8
-8
-8
-3
-6
-3
-3
-8
-1
-9
-9
-4
-6
-8
-0
-0
-0
-8
-8
-9
-2
-8
-8
-8
-7
-8
-3
-1
-7
-0
-1
-5
-8
-3
-3
-3
-8
-9
-3
-8
diff --git a/tests/TfInceptionV3-Armnn/TfInceptionV3-Armnn.cpp b/tests/TfInceptionV3-Armnn/TfInceptionV3-Armnn.cpp
deleted file mode 100644
index fcee978ded..0000000000
--- a/tests/TfInceptionV3-Armnn/TfInceptionV3-Armnn.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../ImagePreprocessor.hpp"
-#include "armnnTfParser/ITfParser.hpp"
-
-int main(int argc, char* argv[])
-{
- int retVal = EXIT_FAILURE;
- try
- {
- // Coverity fix: The following code may throw an exception of type std::length_error.
- std::vector<ImageSet> imageSet =
- {
- { "Dog.jpg", 208 },
- // Top five predictions in tensorflow:
- // -----------------------------------
- // 208:golden retriever 0.57466376
- // 209:Labrador retriever 0.30202731
- // 853:tennis ball 0.0060001756
- // 223:kuvasz 0.0053707925
- // 160:Rhodesian ridgeback 0.0018179063
-
- { "Cat.jpg", 283 },
- // Top five predictions in tensorflow:
- // -----------------------------------
- // 283:tiger cat 0.4667799
- // 282:tabby, tabby cat 0.32511184
- // 286:Egyptian cat 0.1038616
- // 288:lynx, catamount 0.0017019814
- // 284:Persian cat 0.0011340436
-
- { "shark.jpg", 3 },
- // Top five predictions in tensorflow:
- // -----------------------------------
- // 3:great white shark, white shark, ... 0.98808634
- // 148:grey whale, gray whale, ... 0.00070245547
- // 234:Bouvier des Flandres, ... 0.00024639888
- // 149:killer whale, killer, ... 0.00014115588
- // 95:hummingbird 0.00011129203
- };
-
- armnn::TensorShape inputTensorShape({ 1, 299, 299, 3 });
-
- using DataType = float;
- using DatabaseType = ImagePreprocessor<float>;
- using ParserType = armnnTfParser::ITfParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: InferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>(
- argc, argv, "inception_v3_2016_08_28_frozen.pb", true,
- "input", "InceptionV3/Predictions/Reshape_1", { 0, 1, 2, },
- [&imageSet](const char* dataDir, const ModelType&) {
- return DatabaseType(dataDir, 299, 299, imageSet);
- },
- &inputTensorShape);
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: TfInceptionV3-Armnn: An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/TfInceptionV3-Armnn/Validation.txt b/tests/TfInceptionV3-Armnn/Validation.txt
deleted file mode 100644
index 81b64dd7c5..0000000000
--- a/tests/TfInceptionV3-Armnn/Validation.txt
+++ /dev/null
@@ -1,201 +0,0 @@
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
-208
-283
-3
diff --git a/tests/TfLiteInceptionV3Quantized-Armnn/TfLiteInceptionV3Quantized-Armnn.cpp b/tests/TfLiteInceptionV3Quantized-Armnn/TfLiteInceptionV3Quantized-Armnn.cpp
deleted file mode 100644
index f4b395598e..0000000000
--- a/tests/TfLiteInceptionV3Quantized-Armnn/TfLiteInceptionV3Quantized-Armnn.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../ImagePreprocessor.hpp"
-#include "armnnTfLiteParser/ITfLiteParser.hpp"
-
-using namespace armnnTfLiteParser;
-
-int main(int argc, char* argv[])
-{
- int retVal = EXIT_FAILURE;
- try
- {
- std::vector<ImageSet> imageSet =
- {
- {"Dog.jpg", 209},
- {"Cat.jpg", 283},
- {"shark.jpg", 3},
-
- };
-
- armnn::TensorShape inputTensorShape({ 1, 299, 299, 3 });
-
- using DataType = uint8_t;
- using DatabaseType = ImagePreprocessor<DataType>;
- using ParserType = armnnTfLiteParser::ITfLiteParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType,
- ParserType>(
- argc, argv,
- "inception_v3_quant.tflite", // model name
- true, // model is binary
- "input", // input tensor name
- "output", // output tensor name
- { 0, 1, 2 }, // test images to test with as above
- [&imageSet](const char* dataDir, const ModelType &) {
- // we need to get the input quantization parameters from
- // the parsed model
- return DatabaseType(
- dataDir,
- 299,
- 299,
- imageSet,
- 1);
- },
- &inputTensorShape);
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: " << *argv << ": An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/TfLiteInceptionV3Quantized-Armnn/Validation.txt b/tests/TfLiteInceptionV3Quantized-Armnn/Validation.txt
deleted file mode 100644
index 9e3eb5ad7d..0000000000
--- a/tests/TfLiteInceptionV3Quantized-Armnn/Validation.txt
+++ /dev/null
@@ -1,201 +0,0 @@
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
diff --git a/tests/TfLiteInceptionV4Quantized-Armnn/TfLiteInceptionV4Quantized-Armnn.cpp b/tests/TfLiteInceptionV4Quantized-Armnn/TfLiteInceptionV4Quantized-Armnn.cpp
deleted file mode 100644
index 169ecb064b..0000000000
--- a/tests/TfLiteInceptionV4Quantized-Armnn/TfLiteInceptionV4Quantized-Armnn.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../ImagePreprocessor.hpp"
-#include "armnnTfLiteParser/ITfLiteParser.hpp"
-
-using namespace armnnTfLiteParser;
-
-int main(int argc, char* argv[])
-{
- int retVal = EXIT_FAILURE;
- try
- {
- std::vector<ImageSet> imageSet =
- {
- {"Dog.jpg", 209},
- {"Cat.jpg", 283},
- {"shark.jpg", 3},
-
- };
-
- armnn::TensorShape inputTensorShape({ 1, 299, 299, 3 });
-
- using DataType = uint8_t;
- using DatabaseType = ImagePreprocessor<DataType>;
- using ParserType = armnnTfLiteParser::ITfLiteParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType,
- ParserType>(
- argc, argv,
- "inception_v4_299_quant.tflite", // model name
- true, // model is binary
- "input", // input tensor name
- "InceptionV4/Logits/Predictions", // output tensor name
- { 0, 1, 2 }, // test images to test with as above
- [&imageSet](const char* dataDir, const ModelType &) {
- // we need to get the input quantization parameters from
- // the parsed model
- return DatabaseType(
- dataDir,
- 299,
- 299,
- imageSet,
- 1);
- },
- &inputTensorShape);
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: " << *argv << ": An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/TfLiteInceptionV4Quantized-Armnn/Validation.txt b/tests/TfLiteInceptionV4Quantized-Armnn/Validation.txt
deleted file mode 100644
index 94a11bdabc..0000000000
--- a/tests/TfLiteInceptionV4Quantized-Armnn/Validation.txt
+++ /dev/null
@@ -1,201 +0,0 @@
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3 \ No newline at end of file
diff --git a/tests/TfLiteMnasNet-Armnn/TfLiteMnasNet-Armnn.cpp b/tests/TfLiteMnasNet-Armnn/TfLiteMnasNet-Armnn.cpp
deleted file mode 100644
index 4194d4b30a..0000000000
--- a/tests/TfLiteMnasNet-Armnn/TfLiteMnasNet-Armnn.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../ImagePreprocessor.hpp"
-#include "armnnTfLiteParser/ITfLiteParser.hpp"
-
-using namespace armnnTfLiteParser;
-
-int main(int argc, char* argv[])
-{
- int retVal = EXIT_FAILURE;
- try
- {
- // Coverity fix: The following code may throw an exception of type std::length_error.
- std::vector<ImageSet> imageSet =
- {
- {"Dog.jpg", 209},
- {"Cat.jpg", 283},
- {"shark.jpg", 3},
- };
-
- armnn::TensorShape inputTensorShape({ 2, 224, 224, 3 });
-
- using DataType = float;
- using DatabaseType = ImagePreprocessor<DataType>;
- using ParserType = armnnTfLiteParser::ITfLiteParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType,
- ParserType>(
- argc, argv,
- "mnasnet_1.3_224.tflite", // model name
- true, // model is binary
- "input", // input tensor name
- "output", // output tensor name
- { 0, 1, 2 }, // test images to test with as above
- [&imageSet](const char* dataDir, const ModelType &) {
- return DatabaseType(
- dataDir,
- 224,
- 224,
- imageSet,
- 127.5f,
- {0.5f,0.5f,0.5f});
- },
- &inputTensorShape);
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: " << *argv << ": An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/TfLiteMobileNetQuantizedSoftmax-Armnn/TfLiteMobileNetQuantizedSoftmax-Armnn.cpp b/tests/TfLiteMobileNetQuantizedSoftmax-Armnn/TfLiteMobileNetQuantizedSoftmax-Armnn.cpp
deleted file mode 100644
index f497de5660..0000000000
--- a/tests/TfLiteMobileNetQuantizedSoftmax-Armnn/TfLiteMobileNetQuantizedSoftmax-Armnn.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../ImagePreprocessor.hpp"
-#include "armnnTfLiteParser/ITfLiteParser.hpp"
-
-using namespace armnnTfLiteParser;
-
-int main(int argc, char* argv[])
-{
- int retVal = EXIT_FAILURE;
- try
- {
- // Coverity fix: The following code may throw an exception of type std::length_error.
- // The model we are using incorrectly classifies the images
- // But can still be used for benchmarking the layers.
- std::vector<ImageSet> imageSet =
- {
- {"Dog.jpg", 789},
- {"Cat.jpg", 592},
- {"shark.jpg", 755},
- };
-
- armnn::TensorShape inputTensorShape({ 1, 128, 128, 3 });
-
- using DataType = uint8_t;
- using DatabaseType = ImagePreprocessor<DataType>;
- using ParserType = armnnTfLiteParser::ITfLiteParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType,
- ParserType>(
- argc, argv,
- "mobilenet_v1_0.25_128_quant.tflite", // model name
- true, // model is binary
- "input", // input tensor name
- "MobilenetV1/Predictions/Reshape_1", // output tensor name
- { 0, 1, 2 }, // test images to test with as above
- [&imageSet](const char* dataDir, const ModelType &) {
- // we need to get the input quantization parameters from
- // the parsed model
- return DatabaseType(
- dataDir,
- 128,
- 128,
- imageSet,
- 1,
- {{0, 0, 0}},
- {{1, 1, 1}},
- DatabaseType::DataFormat::NCHW,
- 1);
- },
- &inputTensorShape);
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: " << *argv << ": An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/TfLiteMobileNetQuantizedSoftmax-Armnn/Validation.txt b/tests/TfLiteMobileNetQuantizedSoftmax-Armnn/Validation.txt
deleted file mode 100644
index b506155926..0000000000
--- a/tests/TfLiteMobileNetQuantizedSoftmax-Armnn/Validation.txt
+++ /dev/null
@@ -1,201 +0,0 @@
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755
-789
-592
-755 \ No newline at end of file
diff --git a/tests/TfLiteMobileNetSsd-Armnn/TfLiteMobileNetSsd-Armnn.cpp b/tests/TfLiteMobileNetSsd-Armnn/TfLiteMobileNetSsd-Armnn.cpp
deleted file mode 100644
index 787102ed45..0000000000
--- a/tests/TfLiteMobileNetSsd-Armnn/TfLiteMobileNetSsd-Armnn.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../MobileNetSsdInferenceTest.hpp"
-
-#include "armnnTfLiteParser/ITfLiteParser.hpp"
-
-#include <algorithm>
-#include <iterator>
-
-using namespace armnnTfLiteParser;
-
-int main(int argc, char* argv[])
-{
- int retVal = EXIT_FAILURE;
- try
- {
- using DataType = float;
- using Parser = armnnTfLiteParser::ITfLiteParser;
- using Model = InferenceModel<Parser, DataType>;
-
- armnn::TensorShape inputTensorShape({ 1, 300, 300, 3 });
-
- std::vector<const char*> inputLayerNames =
- {
- "normalized_input_image_tensor"
- };
-
- std::vector<const char*> outputLayerNames =
- {
- "TFLite_Detection_PostProcess",
- "TFLite_Detection_PostProcess:1",
- "TFLite_Detection_PostProcess:2",
- "TFLite_Detection_PostProcess:3"
- };
-
- retVal = InferenceTestMain(argc, argv, { 0 },
- [&inputTensorShape, inputLayerNames, outputLayerNames]()
- {
- return make_unique<MobileNetSsdTestCaseProvider<Model>>(
- [&]
- (const InferenceTestOptions& commonOptions,
- typename Model::CommandLineOptions modelOptions)
- {
- if (!ValidateDirectory(modelOptions.m_ModelDir))
- {
- return std::unique_ptr<Model>();
- }
-
- typename Model::Params modelParams;
- modelParams.m_ModelPath =
- modelOptions.m_ModelDir + "ssd_mobilenet_v1.tflite";
-
- std::copy(inputLayerNames.begin(), inputLayerNames.end(),
- std::back_inserter(modelParams.m_InputBindings));
-
- std::copy(outputLayerNames.begin(), outputLayerNames.end(),
- std::back_inserter(modelParams.m_OutputBindings));
-
- modelParams.m_InputShapes = { inputTensorShape };
- modelParams.m_IsModelBinary = true;
- modelParams.m_ComputeDevices = modelOptions.GetComputeDevicesAsBackendIds();
- modelParams.m_VisualizePostOptimizationModel = modelOptions.m_VisualizePostOptimizationModel;
- modelParams.m_EnableFp16TurboMode = modelOptions.m_EnableFp16TurboMode;
-
- return std::make_unique<Model>(modelParams,
- commonOptions.m_EnableProfiling,
- commonOptions.m_DynamicBackendsPath);
- });
- });
- }
- catch (const std::exception& e)
- {
- std::cerr << "WARNING: " << *argv << ": An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/TfLiteMobilenetQuantized-Armnn/TfLiteMobilenetQuantized-Armnn.cpp b/tests/TfLiteMobilenetQuantized-Armnn/TfLiteMobilenetQuantized-Armnn.cpp
deleted file mode 100644
index b2d3f0f3f5..0000000000
--- a/tests/TfLiteMobilenetQuantized-Armnn/TfLiteMobilenetQuantized-Armnn.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../ImagePreprocessor.hpp"
-#include "armnnTfLiteParser/ITfLiteParser.hpp"
-
-#include "boost/program_options.hpp"
-#include <fstream>
-
-using namespace armnnTfLiteParser;
-
-std::vector<ImageSet> ParseDataset(const std::string& filename)
-{
- std::ifstream read(filename);
- std::vector<ImageSet> imageSet;
- if (read.is_open())
- {
- // Get the images and the correct corresponding label from the given file
- for (std::string line; std::getline(read, line);)
- {
- stringstream ss(line);
- std::string image_name;
- std::string label;
- getline(ss, image_name, ' ');
- getline(ss, label, ' ');
- imageSet.push_back(ImageSet(image_name, std::stoi(label)));
- }
- }
- else
- {
- // Use the default images
- imageSet.push_back(ImageSet("Dog.jpg", 209));
- // top five predictions in tensorflow:
- // -----------------------------------
- // 209:Labrador retriever 0.949995
- // 160:Rhodesian ridgeback 0.0270182
- // 208:golden retriever 0.0192866
- // 853:tennis ball 0.000470382
- // 239:Greater Swiss Mountain dog 0.000464451
- imageSet.push_back(ImageSet("Cat.jpg", 283));
- // top five predictions in tensorflow:
- // -----------------------------------
- // 283:tiger cat 0.579016
- // 286:Egyptian cat 0.319676
- // 282:tabby, tabby cat 0.0873346
- // 288:lynx, catamount 0.011163
- // 289:leopard, Panthera pardus 0.000856755
- imageSet.push_back(ImageSet("shark.jpg", 3));
- // top five predictions in tensorflow:
- // -----------------------------------
- // 3:great white shark, white shark, ... 0.996926
- // 4:tiger shark, Galeocerdo cuvieri 0.00270528
- // 149:killer whale, killer, orca, ... 0.000121848
- // 395:sturgeon 7.78977e-05
- // 5:hammerhead, hammerhead shark 6.44127e-055
- };
- return imageSet;
-}
-
-std::string GetLabelsFilenameFromOptions(int argc, char* argv[])
-{
- namespace po = boost::program_options;
- po::options_description desc("Validation Options");
- std::string fn("");
- desc.add_options()
- ("labels", po::value<std::string>(&fn), "Filename of a text file where in each line contains an image "
- "filename and the correct label the network should predict when fed that image");
- po::variables_map vm;
- po::parsed_options parsed = po::command_line_parser(argc, argv).options(desc).allow_unregistered().run();
- po::store(parsed, vm);
- if (vm.count("labels"))
- {
- fn = vm["labels"].as<std::string>();
- }
- return fn;
-}
-
-
-int main(int argc, char* argv[])
-{
- int retVal = EXIT_FAILURE;
- try
- {
- // Coverity fix: The following code may throw an exception of type std::length_error.
- const std::string labels_file = GetLabelsFilenameFromOptions(argc,argv);
- std::vector<ImageSet> imageSet = ParseDataset(labels_file);
- std::vector<unsigned int> indices(imageSet.size());
- std::generate(indices.begin(), indices.end(), [n = 0] () mutable { return n++; });
-
- armnn::TensorShape inputTensorShape({ 1, 224, 224, 3 });
-
- using DataType = uint8_t;
- using DatabaseType = ImagePreprocessor<DataType>;
- using ParserType = armnnTfLiteParser::ITfLiteParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType,
- ParserType>(
- argc, argv,
- "mobilenet_v1_1.0_224_quant.tflite", // model name
- true, // model is binary
- "input", // input tensor name
- "MobilenetV1/Predictions/Reshape_1", // output tensor name
- indices, // vector of indices to select which images to validate
- [&imageSet](const char* dataDir, const ModelType &) {
- // we need to get the input quantization parameters from
- // the parsed model
- return DatabaseType(
- dataDir,
- 224,
- 224,
- imageSet,
- 1);
- },
- &inputTensorShape);
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: " << *argv << ": An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/TfLiteMobilenetQuantized-Armnn/Validation.txt b/tests/TfLiteMobilenetQuantized-Armnn/Validation.txt
deleted file mode 100644
index 94a11bdabc..0000000000
--- a/tests/TfLiteMobilenetQuantized-Armnn/Validation.txt
+++ /dev/null
@@ -1,201 +0,0 @@
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3 \ No newline at end of file
diff --git a/tests/TfLiteMobilenetQuantized-Armnn/labels.txt b/tests/TfLiteMobilenetQuantized-Armnn/labels.txt
deleted file mode 100644
index d74ff557dd..0000000000
--- a/tests/TfLiteMobilenetQuantized-Armnn/labels.txt
+++ /dev/null
@@ -1,1001 +0,0 @@
-0:background
-1:tench, Tinca tinca
-2:goldfish, Carassius auratus
-3:great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias
-4:tiger shark, Galeocerdo cuvieri
-5:hammerhead, hammerhead shark
-6:electric ray, crampfish, numbfish, torpedo
-7:stingray
-8:cock
-9:hen
-10:ostrich, Struthio camelus
-11:brambling, Fringilla montifringilla
-12:goldfinch, Carduelis carduelis
-13:house finch, linnet, Carpodacus mexicanus
-14:junco, snowbird
-15:indigo bunting, indigo finch, indigo bird, Passerina cyanea
-16:robin, American robin, Turdus migratorius
-17:bulbul
-18:jay
-19:magpie
-20:chickadee
-21:water ouzel, dipper
-22:kite
-23:bald eagle, American eagle, Haliaeetus leucocephalus
-24:vulture
-25:great grey owl, great gray owl, Strix nebulosa
-26:European fire salamander, Salamandra salamandra
-27:common newt, Triturus vulgaris
-28:eft
-29:spotted salamander, Ambystoma maculatum
-30:axolotl, mud puppy, Ambystoma mexicanum
-31:bullfrog, Rana catesbeiana
-32:tree frog, tree-frog
-33:tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui
-34:loggerhead, loggerhead turtle, Caretta caretta
-35:leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea
-36:mud turtle
-37:terrapin
-38:box turtle, box tortoise
-39:banded gecko
-40:common iguana, iguana, Iguana iguana
-41:American chameleon, anole, Anolis carolinensis
-42:whiptail, whiptail lizard
-43:agama
-44:frilled lizard, Chlamydosaurus kingi
-45:alligator lizard
-46:Gila monster, Heloderma suspectum
-47:green lizard, Lacerta viridis
-48:African chameleon, Chamaeleo chamaeleon
-49:Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis
-50:African crocodile, Nile crocodile, Crocodylus niloticus
-51:American alligator, Alligator mississipiensis
-52:triceratops
-53:thunder snake, worm snake, Carphophis amoenus
-54:ringneck snake, ring-necked snake, ring snake
-55:hognose snake, puff adder, sand viper
-56:green snake, grass snake
-57:king snake, kingsnake
-58:garter snake, grass snake
-59:water snake
-60:vine snake
-61:night snake, Hypsiglena torquata
-62:boa constrictor, Constrictor constrictor
-63:rock python, rock snake, Python sebae
-64:Indian cobra, Naja naja
-65:green mamba
-66:sea snake
-67:horned viper, cerastes, sand viper, horned asp, Cerastes cornutus
-68:diamondback, diamondback rattlesnake, Crotalus adamanteus
-69:sidewinder, horned rattlesnake, Crotalus cerastes
-70:trilobite
-71:harvestman, daddy longlegs, Phalangium opilio
-72:scorpion
-73:black and gold garden spider, Argiope aurantia
-74:barn spider, Araneus cavaticus
-75:garden spider, Aranea diademata
-76:black widow, Latrodectus mactans
-77:tarantula
-78:wolf spider, hunting spider
-79:tick
-80:centipede
-81:black grouse
-82:ptarmigan
-83:ruffed grouse, partridge, Bonasa umbellus
-84:prairie chicken, prairie grouse, prairie fowl
-85:peacock
-86:quail
-87:partridge
-88:African grey, African gray, Psittacus erithacus
-89:macaw
-90:sulphur-crested cockatoo, Kakatoe galerita, Cacatua galerita
-91:lorikeet
-92:coucal
-93:bee eater
-94:hornbill
-95:hummingbird
-96:jacamar
-97:toucan
-98:drake
-99:red-breasted merganser, Mergus serrator
-100:goose
-101:black swan, Cygnus atratus
-102:tusker
-103:echidna, spiny anteater, anteater
-104:platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus
-105:wallaby, brush kangaroo
-106:koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus
-107:wombat
-108:jellyfish
-109:sea anemone, anemone
-110:brain coral
-111:flatworm, platyhelminth
-112:nematode, nematode worm, roundworm
-113:conch
-114:snail
-115:slug
-116:sea slug, nudibranch
-117:chiton, coat-of-mail shell, sea cradle, polyplacophore
-118:chambered nautilus, pearly nautilus, nautilus
-119:Dungeness crab, Cancer magister
-120:rock crab, Cancer irroratus
-121:fiddler crab
-122:king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica
-123:American lobster, Northern lobster, Maine lobster, Homarus americanus
-124:spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish
-125:crayfish, crawfish, crawdad, crawdaddy
-126:hermit crab
-127:isopod
-128:white stork, Ciconia ciconia
-129:black stork, Ciconia nigra
-130:spoonbill
-131:flamingo
-132:little blue heron, Egretta caerulea
-133:American egret, great white heron, Egretta albus
-134:bittern
-135:crane
-136:limpkin, Aramus pictus
-137:European gallinule, Porphyrio porphyrio
-138:American coot, marsh hen, mud hen, water hen, Fulica americana
-139:bustard
-140:ruddy turnstone, Arenaria interpres
-141:red-backed sandpiper, dunlin, Erolia alpina
-142:redshank, Tringa totanus
-143:dowitcher
-144:oystercatcher, oyster catcher
-145:pelican
-146:king penguin, Aptenodytes patagonica
-147:albatross, mollymawk
-148:grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus
-149:killer whale, killer, orca, grampus, sea wolf, Orcinus orca
-150:dugong, Dugong dugon
-151:sea lion
-152:Chihuahua
-153:Japanese spaniel
-154:Maltese dog, Maltese terrier, Maltese
-155:Pekinese, Pekingese, Peke
-156:Shih-Tzu
-157:Blenheim spaniel
-158:papillon
-159:toy terrier
-160:Rhodesian ridgeback
-161:Afghan hound, Afghan
-162:basset, basset hound
-163:beagle
-164:bloodhound, sleuthhound
-165:bluetick
-166:black-and-tan coonhound
-167:Walker hound, Walker foxhound
-168:English foxhound
-169:redbone
-170:borzoi, Russian wolfhound
-171:Irish wolfhound
-172:Italian greyhound
-173:whippet
-174:Ibizan hound, Ibizan Podenco
-175:Norwegian elkhound, elkhound
-176:otterhound, otter hound
-177:Saluki, gazelle hound
-178:Scottish deerhound, deerhound
-179:Weimaraner
-180:Staffordshire bullterrier, Staffordshire bull terrier
-181:American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier
-182:Bedlington terrier
-183:Border terrier
-184:Kerry blue terrier
-185:Irish terrier
-186:Norfolk terrier
-187:Norwich terrier
-188:Yorkshire terrier
-189:wire-haired fox terrier
-190:Lakeland terrier
-191:Sealyham terrier, Sealyham
-192:Airedale, Airedale terrier
-193:cairn, cairn terrier
-194:Australian terrier
-195:Dandie Dinmont, Dandie Dinmont terrier
-196:Boston bull, Boston terrier
-197:miniature schnauzer
-198:giant schnauzer
-199:standard schnauzer
-200:Scotch terrier, Scottish terrier, Scottie
-201:Tibetan terrier, chrysanthemum dog
-202:silky terrier, Sydney silky
-203:soft-coated wheaten terrier
-204:West Highland white terrier
-205:Lhasa, Lhasa apso
-206:flat-coated retriever
-207:curly-coated retriever
-208:golden retriever
-209:Labrador retriever
-210:Chesapeake Bay retriever
-211:German short-haired pointer
-212:vizsla, Hungarian pointer
-213:English setter
-214:Irish setter, red setter
-215:Gordon setter
-216:Brittany spaniel
-217:clumber, clumber spaniel
-218:English springer, English springer spaniel
-219:Welsh springer spaniel
-220:cocker spaniel, English cocker spaniel, cocker
-221:Sussex spaniel
-222:Irish water spaniel
-223:kuvasz
-224:schipperke
-225:groenendael
-226:malinois
-227:briard
-228:kelpie
-229:komondor
-230:Old English sheepdog, bobtail
-231:Shetland sheepdog, Shetland sheep dog, Shetland
-232:collie
-233:Border collie
-234:Bouvier des Flandres, Bouviers des Flandres
-235:Rottweiler
-236:German shepherd, German shepherd dog, German police dog, alsatian
-237:Doberman, Doberman pinscher
-238:miniature pinscher
-239:Greater Swiss Mountain dog
-240:Bernese mountain dog
-241:Appenzeller
-242:EntleBucher
-243:boxer
-244:bull mastiff
-245:Tibetan mastiff
-246:French bulldog
-247:Great Dane
-248:Saint Bernard, St Bernard
-249:Eskimo dog, husky
-250:malamute, malemute, Alaskan malamute
-251:Siberian husky
-252:dalmatian, coach dog, carriage dog
-253:affenpinscher, monkey pinscher, monkey dog
-254:basenji
-255:pug, pug-dog
-256:Leonberg
-257:Newfoundland, Newfoundland dog
-258:Great Pyrenees
-259:Samoyed, Samoyede
-260:Pomeranian
-261:chow, chow chow
-262:keeshond
-263:Brabancon griffon
-264:Pembroke, Pembroke Welsh corgi
-265:Cardigan, Cardigan Welsh corgi
-266:toy poodle
-267:miniature poodle
-268:standard poodle
-269:Mexican hairless
-270:timber wolf, grey wolf, gray wolf, Canis lupus
-271:white wolf, Arctic wolf, Canis lupus tundrarum
-272:red wolf, maned wolf, Canis rufus, Canis niger
-273:coyote, prairie wolf, brush wolf, Canis latrans
-274:dingo, warrigal, warragal, Canis dingo
-275:dhole, Cuon alpinus
-276:African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus
-277:hyena, hyaena
-278:red fox, Vulpes vulpes
-279:kit fox, Vulpes macrotis
-280:Arctic fox, white fox, Alopex lagopus
-281:grey fox, gray fox, Urocyon cinereoargenteus
-282:tabby, tabby cat
-283:tiger cat
-284:Persian cat
-285:Siamese cat, Siamese
-286:Egyptian cat
-287:cougar, puma, catamount, mountain lion, painter, panther, Felis concolor
-288:lynx, catamount
-289:leopard, Panthera pardus
-290:snow leopard, ounce, Panthera uncia
-291:jaguar, panther, Panthera onca, Felis onca
-292:lion, king of beasts, Panthera leo
-293:tiger, Panthera tigris
-294:cheetah, chetah, Acinonyx jubatus
-295:brown bear, bruin, Ursus arctos
-296:American black bear, black bear, Ursus americanus, Euarctos americanus
-297:ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus
-298:sloth bear, Melursus ursinus, Ursus ursinus
-299:mongoose
-300:meerkat, mierkat
-301:tiger beetle
-302:ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle
-303:ground beetle, carabid beetle
-304:long-horned beetle, longicorn, longicorn beetle
-305:leaf beetle, chrysomelid
-306:dung beetle
-307:rhinoceros beetle
-308:weevil
-309:fly
-310:bee
-311:ant, emmet, pismire
-312:grasshopper, hopper
-313:cricket
-314:walking stick, walkingstick, stick insect
-315:cockroach, roach
-316:mantis, mantid
-317:cicada, cicala
-318:leafhopper
-319:lacewing, lacewing fly
-320:dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk
-321:damselfly
-322:admiral
-323:ringlet, ringlet butterfly
-324:monarch, monarch butterfly, milkweed butterfly, Danaus plexippus
-325:cabbage butterfly
-326:sulphur butterfly, sulfur butterfly
-327:lycaenid, lycaenid butterfly
-328:starfish, sea star
-329:sea urchin
-330:sea cucumber, holothurian
-331:wood rabbit, cottontail, cottontail rabbit
-332:hare
-333:Angora, Angora rabbit
-334:hamster
-335:porcupine, hedgehog
-336:fox squirrel, eastern fox squirrel, Sciurus niger
-337:marmot
-338:beaver
-339:guinea pig, Cavia cobaya
-340:sorrel
-341:zebra
-342:hog, pig, grunter, squealer, Sus scrofa
-343:wild boar, boar, Sus scrofa
-344:warthog
-345:hippopotamus, hippo, river horse, Hippopotamus amphibius
-346:ox
-347:water buffalo, water ox, Asiatic buffalo, Bubalus bubalis
-348:bison
-349:ram, tup
-350:bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis
-351:ibex, Capra ibex
-352:hartebeest
-353:impala, Aepyceros melampus
-354:gazelle
-355:Arabian camel, dromedary, Camelus dromedarius
-356:llama
-357:weasel
-358:mink
-359:polecat, fitch, foulmart, foumart, Mustela putorius
-360:black-footed ferret, ferret, Mustela nigripes
-361:otter
-362:skunk, polecat, wood pussy
-363:badger
-364:armadillo
-365:three-toed sloth, ai, Bradypus tridactylus
-366:orangutan, orang, orangutang, Pongo pygmaeus
-367:gorilla, Gorilla gorilla
-368:chimpanzee, chimp, Pan troglodytes
-369:gibbon, Hylobates lar
-370:siamang, Hylobates syndactylus, Symphalangus syndactylus
-371:guenon, guenon monkey
-372:patas, hussar monkey, Erythrocebus patas
-373:baboon
-374:macaque
-375:langur
-376:colobus, colobus monkey
-377:proboscis monkey, Nasalis larvatus
-378:marmoset
-379:capuchin, ringtail, Cebus capucinus
-380:howler monkey, howler
-381:titi, titi monkey
-382:spider monkey, Ateles geoffroyi
-383:squirrel monkey, Saimiri sciureus
-384:Madagascar cat, ring-tailed lemur, Lemur catta
-385:indri, indris, Indri indri, Indri brevicaudatus
-386:Indian elephant, Elephas maximus
-387:African elephant, Loxodonta africana
-388:lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens
-389:giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca
-390:barracouta, snoek
-391:eel
-392:coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch
-393:rock beauty, Holocanthus tricolor
-394:anemone fish
-395:sturgeon
-396:gar, garfish, garpike, billfish, Lepisosteus osseus
-397:lionfish
-398:puffer, pufferfish, blowfish, globefish
-399:abacus
-400:abaya
-401:academic gown, academic robe, judge's robe
-402:accordion, piano accordion, squeeze box
-403:acoustic guitar
-404:aircraft carrier, carrier, flattop, attack aircraft carrier
-405:airliner
-406:airship, dirigible
-407:altar
-408:ambulance
-409:amphibian, amphibious vehicle
-410:analog clock
-411:apiary, bee house
-412:apron
-413:ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin
-414:assault rifle, assault gun
-415:backpack, back pack, knapsack, packsack, rucksack, haversack
-416:bakery, bakeshop, bakehouse
-417:balance beam, beam
-418:balloon
-419:ballpoint, ballpoint pen, ballpen, Biro
-420:Band Aid
-421:banjo
-422:bannister, banister, balustrade, balusters, handrail
-423:barbell
-424:barber chair
-425:barbershop
-426:barn
-427:barometer
-428:barrel, cask
-429:barrow, garden cart, lawn cart, wheelbarrow
-430:baseball
-431:basketball
-432:bassinet
-433:bassoon
-434:bathing cap, swimming cap
-435:bath towel
-436:bathtub, bathing tub, bath, tub
-437:beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon
-438:beacon, lighthouse, beacon light, pharos
-439:beaker
-440:bearskin, busby, shako
-441:beer bottle
-442:beer glass
-443:bell cote, bell cot
-444:bib
-445:bicycle-built-for-two, tandem bicycle, tandem
-446:bikini, two-piece
-447:binder, ring-binder
-448:binoculars, field glasses, opera glasses
-449:birdhouse
-450:boathouse
-451:bobsled, bobsleigh, bob
-452:bolo tie, bolo, bola tie, bola
-453:bonnet, poke bonnet
-454:bookcase
-455:bookshop, bookstore, bookstall
-456:bottlecap
-457:bow
-458:bow tie, bow-tie, bowtie
-459:brass, memorial tablet, plaque
-460:brassiere, bra, bandeau
-461:breakwater, groin, groyne, mole, bulwark, seawall, jetty
-462:breastplate, aegis, egis
-463:broom
-464:bucket, pail
-465:buckle
-466:bulletproof vest
-467:bullet train, bullet
-468:butcher shop, meat market
-469:cab, hack, taxi, taxicab
-470:caldron, cauldron
-471:candle, taper, wax light
-472:cannon
-473:canoe
-474:can opener, tin opener
-475:cardigan
-476:car mirror
-477:carousel, carrousel, merry-go-round, roundabout, whirligig
-478:carpenter's kit, tool kit
-479:carton
-480:car wheel
-481:cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM
-482:cassette
-483:cassette player
-484:castle
-485:catamaran
-486:CD player
-487:cello, violoncello
-488:cellular telephone, cellular phone, cellphone, cell, mobile phone
-489:chain
-490:chainlink fence
-491:chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour
-492:chain saw, chainsaw
-493:chest
-494:chiffonier, commode
-495:chime, bell, gong
-496:china cabinet, china closet
-497:Christmas stocking
-498:church, church building
-499:cinema, movie theater, movie theatre, movie house, picture palace
-500:cleaver, meat cleaver, chopper
-501:cliff dwelling
-502:cloak
-503:clog, geta, patten, sabot
-504:cocktail shaker
-505:coffee mug
-506:coffeepot
-507:coil, spiral, volute, whorl, helix
-508:combination lock
-509:computer keyboard, keypad
-510:confectionery, confectionary, candy store
-511:container ship, containership, container vessel
-512:convertible
-513:corkscrew, bottle screw
-514:cornet, horn, trumpet, trump
-515:cowboy boot
-516:cowboy hat, ten-gallon hat
-517:cradle
-518:crane
-519:crash helmet
-520:crate
-521:crib, cot
-522:Crock Pot
-523:croquet ball
-524:crutch
-525:cuirass
-526:dam, dike, dyke
-527:desk
-528:desktop computer
-529:dial telephone, dial phone
-530:diaper, nappy, napkin
-531:digital clock
-532:digital watch
-533:dining table, board
-534:dishrag, dishcloth
-535:dishwasher, dish washer, dishwashing machine
-536:disk brake, disc brake
-537:dock, dockage, docking facility
-538:dogsled, dog sled, dog sleigh
-539:dome
-540:doormat, welcome mat
-541:drilling platform, offshore rig
-542:drum, membranophone, tympan
-543:drumstick
-544:dumbbell
-545:Dutch oven
-546:electric fan, blower
-547:electric guitar
-548:electric locomotive
-549:entertainment center
-550:envelope
-551:espresso maker
-552:face powder
-553:feather boa, boa
-554:file, file cabinet, filing cabinet
-555:fireboat
-556:fire engine, fire truck
-557:fire screen, fireguard
-558:flagpole, flagstaff
-559:flute, transverse flute
-560:folding chair
-561:football helmet
-562:forklift
-563:fountain
-564:fountain pen
-565:four-poster
-566:freight car
-567:French horn, horn
-568:frying pan, frypan, skillet
-569:fur coat
-570:garbage truck, dustcart
-571:gasmask, respirator, gas helmet
-572:gas pump, gasoline pump, petrol pump, island dispenser
-573:goblet
-574:go-kart
-575:golf ball
-576:golfcart, golf cart
-577:gondola
-578:gong, tam-tam
-579:gown
-580:grand piano, grand
-581:greenhouse, nursery, glasshouse
-582:grille, radiator grille
-583:grocery store, grocery, food market, market
-584:guillotine
-585:hair slide
-586:hair spray
-587:half track
-588:hammer
-589:hamper
-590:hand blower, blow dryer, blow drier, hair dryer, hair drier
-591:hand-held computer, hand-held microcomputer
-592:handkerchief, hankie, hanky, hankey
-593:hard disc, hard disk, fixed disk
-594:harmonica, mouth organ, harp, mouth harp
-595:harp
-596:harvester, reaper
-597:hatchet
-598:holster
-599:home theater, home theatre
-600:honeycomb
-601:hook, claw
-602:hoopskirt, crinoline
-603:horizontal bar, high bar
-604:horse cart, horse-cart
-605:hourglass
-606:iPod
-607:iron, smoothing iron
-608:jack-o'-lantern
-609:jean, blue jean, denim
-610:jeep, landrover
-611:jersey, T-shirt, tee shirt
-612:jigsaw puzzle
-613:jinrikisha, ricksha, rickshaw
-614:joystick
-615:kimono
-616:knee pad
-617:knot
-618:lab coat, laboratory coat
-619:ladle
-620:lampshade, lamp shade
-621:laptop, laptop computer
-622:lawn mower, mower
-623:lens cap, lens cover
-624:letter opener, paper knife, paperknife
-625:library
-626:lifeboat
-627:lighter, light, igniter, ignitor
-628:limousine, limo
-629:liner, ocean liner
-630:lipstick, lip rouge
-631:Loafer
-632:lotion
-633:loudspeaker, speaker, speaker unit, loudspeaker system, speaker system
-634:loupe, jeweler's loupe
-635:lumbermill, sawmill
-636:magnetic compass
-637:mailbag, postbag
-638:mailbox, letter box
-639:maillot
-640:maillot, tank suit
-641:manhole cover
-642:maraca
-643:marimba, xylophone
-644:mask
-645:matchstick
-646:maypole
-647:maze, labyrinth
-648:measuring cup
-649:medicine chest, medicine cabinet
-650:megalith, megalithic structure
-651:microphone, mike
-652:microwave, microwave oven
-653:military uniform
-654:milk can
-655:minibus
-656:miniskirt, mini
-657:minivan
-658:missile
-659:mitten
-660:mixing bowl
-661:mobile home, manufactured home
-662:Model T
-663:modem
-664:monastery
-665:monitor
-666:moped
-667:mortar
-668:mortarboard
-669:mosque
-670:mosquito net
-671:motor scooter, scooter
-672:mountain bike, all-terrain bike, off-roader
-673:mountain tent
-674:mouse, computer mouse
-675:mousetrap
-676:moving van
-677:muzzle
-678:nail
-679:neck brace
-680:necklace
-681:nipple
-682:notebook, notebook computer
-683:obelisk
-684:oboe, hautboy, hautbois
-685:ocarina, sweet potato
-686:odometer, hodometer, mileometer, milometer
-687:oil filter
-688:organ, pipe organ
-689:oscilloscope, scope, cathode-ray oscilloscope, CRO
-690:overskirt
-691:oxcart
-692:oxygen mask
-693:packet
-694:paddle, boat paddle
-695:paddlewheel, paddle wheel
-696:padlock
-697:paintbrush
-698:pajama, pyjama, pj's, jammies
-699:palace
-700:panpipe, pandean pipe, syrinx
-701:paper towel
-702:parachute, chute
-703:parallel bars, bars
-704:park bench
-705:parking meter
-706:passenger car, coach, carriage
-707:patio, terrace
-708:pay-phone, pay-station
-709:pedestal, plinth, footstall
-710:pencil box, pencil case
-711:pencil sharpener
-712:perfume, essence
-713:Petri dish
-714:photocopier
-715:pick, plectrum, plectron
-716:pickelhaube
-717:picket fence, paling
-718:pickup, pickup truck
-719:pier
-720:piggy bank, penny bank
-721:pill bottle
-722:pillow
-723:ping-pong ball
-724:pinwheel
-725:pirate, pirate ship
-726:pitcher, ewer
-727:plane, carpenter's plane, woodworking plane
-728:planetarium
-729:plastic bag
-730:plate rack
-731:plow, plough
-732:plunger, plumber's helper
-733:Polaroid camera, Polaroid Land camera
-734:pole
-735:police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria
-736:poncho
-737:pool table, billiard table, snooker table
-738:pop bottle, soda bottle
-739:pot, flowerpot
-740:potter's wheel
-741:power drill
-742:prayer rug, prayer mat
-743:printer
-744:prison, prison house
-745:projectile, missile
-746:projector
-747:puck, hockey puck
-748:punching bag, punch bag, punching ball, punchball
-749:purse
-750:quill, quill pen
-751:quilt, comforter, comfort, puff
-752:racer, race car, racing car
-753:racket, racquet
-754:radiator
-755:radio, wireless
-756:radio telescope, radio reflector
-757:rain barrel
-758:recreational vehicle, RV, R.V.
-759:reel
-760:reflex camera
-761:refrigerator, icebox
-762:remote control, remote
-763:restaurant, eating house, eating place, eatery
-764:revolver, six-gun, six-shooter
-765:rifle
-766:rocking chair, rocker
-767:rotisserie
-768:rubber eraser, rubber, pencil eraser
-769:rugby ball
-770:rule, ruler
-771:running shoe
-772:safe
-773:safety pin
-774:saltshaker, salt shaker
-775:sandal
-776:sarong
-777:sax, saxophone
-778:scabbard
-779:scale, weighing machine
-780:school bus
-781:schooner
-782:scoreboard
-783:screen, CRT screen
-784:screw
-785:screwdriver
-786:seat belt, seatbelt
-787:sewing machine
-788:shield, buckler
-789:shoe shop, shoe-shop, shoe store
-790:shoji
-791:shopping basket
-792:shopping cart
-793:shovel
-794:shower cap
-795:shower curtain
-796:ski
-797:ski mask
-798:sleeping bag
-799:slide rule, slipstick
-800:sliding door
-801:slot, one-armed bandit
-802:snorkel
-803:snowmobile
-804:snowplow, snowplough
-805:soap dispenser
-806:soccer ball
-807:sock
-808:solar dish, solar collector, solar furnace
-809:sombrero
-810:soup bowl
-811:space bar
-812:space heater
-813:space shuttle
-814:spatula
-815:speedboat
-816:spider web, spider's web
-817:spindle
-818:sports car, sport car
-819:spotlight, spot
-820:stage
-821:steam locomotive
-822:steel arch bridge
-823:steel drum
-824:stethoscope
-825:stole
-826:stone wall
-827:stopwatch, stop watch
-828:stove
-829:strainer
-830:streetcar, tram, tramcar, trolley, trolley car
-831:stretcher
-832:studio couch, day bed
-833:stupa, tope
-834:submarine, pigboat, sub, U-boat
-835:suit, suit of clothes
-836:sundial
-837:sunglass
-838:sunglasses, dark glasses, shades
-839:sunscreen, sunblock, sun blocker
-840:suspension bridge
-841:swab, swob, mop
-842:sweatshirt
-843:swimming trunks, bathing trunks
-844:swing
-845:switch, electric switch, electrical switch
-846:syringe
-847:table lamp
-848:tank, army tank, armored combat vehicle, armoured combat vehicle
-849:tape player
-850:teapot
-851:teddy, teddy bear
-852:television, television system
-853:tennis ball
-854:thatch, thatched roof
-855:theater curtain, theatre curtain
-856:thimble
-857:thresher, thrasher, threshing machine
-858:throne
-859:tile roof
-860:toaster
-861:tobacco shop, tobacconist shop, tobacconist
-862:toilet seat
-863:torch
-864:totem pole
-865:tow truck, tow car, wrecker
-866:toyshop
-867:tractor
-868:trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi
-869:tray
-870:trench coat
-871:tricycle, trike, velocipede
-872:trimaran
-873:tripod
-874:triumphal arch
-875:trolleybus, trolley coach, trackless trolley
-876:trombone
-877:tub, vat
-878:turnstile
-879:typewriter keyboard
-880:umbrella
-881:unicycle, monocycle
-882:upright, upright piano
-883:vacuum, vacuum cleaner
-884:vase
-885:vault
-886:velvet
-887:vending machine
-888:vestment
-889:viaduct
-890:violin, fiddle
-891:volleyball
-892:waffle iron
-893:wall clock
-894:wallet, billfold, notecase, pocketbook
-895:wardrobe, closet, press
-896:warplane, military plane
-897:washbasin, handbasin, washbowl, lavabo, wash-hand basin
-898:washer, automatic washer, washing machine
-899:water bottle
-900:water jug
-901:water tower
-902:whiskey jug
-903:whistle
-904:wig
-905:window screen
-906:window shade
-907:Windsor tie
-908:wine bottle
-909:wing
-910:wok
-911:wooden spoon
-912:wool, woolen, woollen
-913:worm fence, snake fence, snake-rail fence, Virginia fence
-914:wreck
-915:yawl
-916:yurt
-917:web site, website, internet site, site
-918:comic book
-919:crossword puzzle, crossword
-920:street sign
-921:traffic light, traffic signal, stoplight
-922:book jacket, dust cover, dust jacket, dust wrapper
-923:menu
-924:plate
-925:guacamole
-926:consomme
-927:hot pot, hotpot
-928:trifle
-929:ice cream, icecream
-930:ice lolly, lolly, lollipop, popsicle
-931:French loaf
-932:bagel, beigel
-933:pretzel
-934:cheeseburger
-935:hotdog, hot dog, red hot
-936:mashed potato
-937:head cabbage
-938:broccoli
-939:cauliflower
-940:zucchini, courgette
-941:spaghetti squash
-942:acorn squash
-943:butternut squash
-944:cucumber, cuke
-945:artichoke, globe artichoke
-946:bell pepper
-947:cardoon
-948:mushroom
-949:Granny Smith
-950:strawberry
-951:orange
-952:lemon
-953:fig
-954:pineapple, ananas
-955:banana
-956:jackfruit, jak, jack
-957:custard apple
-958:pomegranate
-959:hay
-960:carbonara
-961:chocolate sauce, chocolate syrup
-962:dough
-963:meat loaf, meatloaf
-964:pizza, pizza pie
-965:potpie
-966:burrito
-967:red wine
-968:espresso
-969:cup
-970:eggnog
-971:alp
-972:bubble
-973:cliff, drop, drop-off
-974:coral reef
-975:geyser
-976:lakeside, lakeshore
-977:promontory, headland, head, foreland
-978:sandbar, sand bar
-979:seashore, coast, seacoast, sea-coast
-980:valley, vale
-981:volcano
-982:ballplayer, baseball player
-983:groom, bridegroom
-984:scuba diver
-985:rapeseed
-986:daisy
-987:yellow lady's slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum
-988:corn
-989:acorn
-990:hip, rose hip, rosehip
-991:buckeye, horse chestnut, conker
-992:coral fungus
-993:agaric
-994:gyromitra
-995:stinkhorn, carrion fungus
-996:earthstar
-997:hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa
-998:bolete
-999:ear, spike, capitulum
-1000:toilet tissue, toilet paper, bathroom tissue
diff --git a/tests/TfLiteMobilenetV2Quantized-Armnn/TfLiteMobilenetV2Quantized-Armnn.cpp b/tests/TfLiteMobilenetV2Quantized-Armnn/TfLiteMobilenetV2Quantized-Armnn.cpp
deleted file mode 100644
index b8def4fbb4..0000000000
--- a/tests/TfLiteMobilenetV2Quantized-Armnn/TfLiteMobilenetV2Quantized-Armnn.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../ImagePreprocessor.hpp"
-#include "armnnTfLiteParser/ITfLiteParser.hpp"
-
-using namespace armnnTfLiteParser;
-
-int main(int argc, char* argv[])
-{
- int retVal = EXIT_FAILURE;
- try
- {
- // Coverity fix: The following code may throw an exception of type std::length_error.
- std::vector<ImageSet> imageSet =
- {
- {"Dog.jpg", 209},
- {"Cat.jpg", 283},
- {"shark.jpg", 3},
- };
-
- armnn::TensorShape inputTensorShape({ 1, 224, 224, 3 });
-
- using DataType = uint8_t;
- using DatabaseType = ImagePreprocessor<DataType>;
- using ParserType = armnnTfLiteParser::ITfLiteParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType,
- ParserType>(
- argc, argv,
- "mobilenet_v2_1.0_224_quant.tflite", // model name
- true, // model is binary
- "input", // input tensor name
- "output", // output tensor name
- { 0, 1, 2 }, // test images to test with as above
- [&imageSet](const char* dataDir, const ModelType &) {
- // we need to get the input quantization parameters from
- // the parsed model
- return DatabaseType(
- dataDir,
- 224,
- 224,
- imageSet,
- 1);
- },
- &inputTensorShape);
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: " << *argv << ": An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/TfLiteResNetV2-50-Quantized-Armnn/TfLiteResNetV2-50-Quantized-Armnn.cpp b/tests/TfLiteResNetV2-50-Quantized-Armnn/TfLiteResNetV2-50-Quantized-Armnn.cpp
deleted file mode 100644
index 7446809e3a..0000000000
--- a/tests/TfLiteResNetV2-50-Quantized-Armnn/TfLiteResNetV2-50-Quantized-Armnn.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../ImagePreprocessor.hpp"
-#include "armnnTfLiteParser/ITfLiteParser.hpp"
-
-using namespace armnnTfLiteParser;
-
-int main(int argc, char* argv[])
-{
- int retVal = EXIT_FAILURE;
- try
- {
- std::vector<ImageSet> imageSet =
- {
- {"Dog.jpg", 209},
- {"Cat.jpg", 283},
- {"shark.jpg", 3},
-
- };
-
- armnn::TensorShape inputTensorShape({ 1, 224, 224, 3 });
-
- using DataType = uint8_t;
- using DatabaseType = ImagePreprocessor<DataType>;
- using ParserType = armnnTfLiteParser::ITfLiteParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType,
- ParserType>(
- argc, argv,
- "resnet_v2_50_default_minmax.tflite", // model name
- true, // model is binary
- "input", // input tensor name
- "resnet_v2_50/predictions/Reshape_1", // output tensor name
- { 0, 1, 2 }, // test images to test with as above
- [&imageSet](const char* dataDir, const ModelType &) {
- // we need to get the input quantization parameters from
- // the parsed model
- return DatabaseType(
- dataDir,
- 224,
- 224,
- imageSet,
- 1);
- },
- &inputTensorShape);
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: " << *argv << ": An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/TfLiteResNetV2-Armnn/TfLiteResNetV2-Armnn.cpp b/tests/TfLiteResNetV2-Armnn/TfLiteResNetV2-Armnn.cpp
deleted file mode 100644
index 107660ef1a..0000000000
--- a/tests/TfLiteResNetV2-Armnn/TfLiteResNetV2-Armnn.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../ImagePreprocessor.hpp"
-#include "armnnTfLiteParser/ITfLiteParser.hpp"
-
-using namespace armnnTfLiteParser;
-
-int main(int argc, char* argv[])
-{
- int retVal = EXIT_FAILURE;
- try
- {
- // Coverity fix: The following code may throw an exception of type std::length_error.
- std::vector<ImageSet> imageSet =
- {
- {"Dog.jpg", 209},
- {"Cat.jpg", 283},
- {"shark.jpg", 3},
-
- };
-
- armnn::TensorShape inputTensorShape({ 1, 299, 299, 3 });
-
- using DataType = float;
- using DatabaseType = ImagePreprocessor<DataType>;
- using ParserType = armnnTfLiteParser::ITfLiteParser;
- using ModelType = InferenceModel<ParserType, DataType>;
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType,
- ParserType>(
- argc, argv,
- "resnet_v2_101_299.tflite", // model name
- true, // model is binary
- "input", // input tensor name
- "output", // output tensor name
- { 0, 1, 2 }, // test images to test with as above
- [&imageSet](const char* dataDir, const ModelType &) {
- return DatabaseType(
- dataDir,
- 299,
- 299,
- imageSet,
- 127.5f,
- {0.5f,0.5f,0.5f});
- },
- &inputTensorShape);
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: " << *argv << ": An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/TfLiteVGG16Quantized-Armnn/TfLiteVGG16Quantized-Armnn.cpp b/tests/TfLiteVGG16Quantized-Armnn/TfLiteVGG16Quantized-Armnn.cpp
deleted file mode 100644
index 8da553f0c2..0000000000
--- a/tests/TfLiteVGG16Quantized-Armnn/TfLiteVGG16Quantized-Armnn.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../ImagePreprocessor.hpp"
-#include "armnnTfLiteParser/ITfLiteParser.hpp"
-
-using namespace armnnTfLiteParser;
-
-int main(int argc, char* argv[])
-{
- int retVal = EXIT_FAILURE;
- try
- {
- // Coverity fix: The following code may throw an exception of type std::length_error.
- std::vector<ImageSet> imageSet =
- {
- // The model we are using incorrectly classifies the images
- // But can still be used for benchmarking the layers.
- {"Dog.jpg", 178},
- {"Cat.jpg", 39},
- {"shark.jpg", 598},
- };
-
- armnn::TensorShape inputTensorShape({ 1, 224, 224, 3 });
-
- using DataType = uint8_t;
- using DatabaseType = ImagePreprocessor<DataType>;
- using ParserType = armnnTfLiteParser::ITfLiteParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType,
- ParserType>(
- argc, argv,
- "vgg_16_int8.tflite", // model name
- true, // model is binary
- "input", // input tensor name
- "vgg_16/fc8/squeezed", // output tensor name
- { 0, 1, 2 }, // test images to test with as above
- [&imageSet](const char* dataDir, const ModelType &) {
- // we need to get the input quantization parameters from
- // the parsed model
- return DatabaseType(
- dataDir,
- 224,
- 224,
- imageSet,
- 1,
- {{0, 0, 0}},
- {{1, 1, 1}},
- DatabaseType::DataFormat::NCHW,
- 1);
- },
- &inputTensorShape);
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: " << *argv << ": An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/TfLiteVGG16Quantized-Armnn/Validation.txt b/tests/TfLiteVGG16Quantized-Armnn/Validation.txt
deleted file mode 100644
index 32c74a723d..0000000000
--- a/tests/TfLiteVGG16Quantized-Armnn/Validation.txt
+++ /dev/null
@@ -1,201 +0,0 @@
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598
-178
-39
-598 \ No newline at end of file
diff --git a/tests/TfMnist-Armnn/TfMnist-Armnn.cpp b/tests/TfMnist-Armnn/TfMnist-Armnn.cpp
deleted file mode 100644
index 6d15681d7e..0000000000
--- a/tests/TfMnist-Armnn/TfMnist-Armnn.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../MnistDatabase.hpp"
-#include "armnnTfParser/ITfParser.hpp"
-
-int main(int argc, char* argv[])
-{
- armnn::TensorShape inputTensorShape({ 1, 784, 1, 1 });
-
- int retVal = EXIT_FAILURE;
- try
- {
- using DataType = float;
- using DatabaseType = MnistDatabase;
- using ParserType = armnnTfParser::ITfParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>(
- argc, argv, "simple_mnist_tf.prototxt", false,
- "Placeholder", "Softmax", { 0, 1, 2, 3, 4 },
- [](const char* dataDir, const ModelType&) {
- return DatabaseType(dataDir, true);
- },
- &inputTensorShape);
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: TfMnist-Armnn: An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/TfMnist-Armnn/Validation.txt b/tests/TfMnist-Armnn/Validation.txt
deleted file mode 100644
index 175778ff07..0000000000
--- a/tests/TfMnist-Armnn/Validation.txt
+++ /dev/null
@@ -1,1000 +0,0 @@
-7
-2
-1
-0
-4
-1
-4
-9
-6
-9
-0
-6
-9
-0
-1
-5
-9
-7
-3
-4
-9
-6
-6
-5
-4
-0
-7
-4
-0
-1
-3
-1
-3
-6
-7
-2
-7
-1
-2
-1
-1
-9
-9
-2
-3
-5
-3
-2
-4
-4
-6
-3
-5
-5
-6
-0
-4
-1
-9
-5
-7
-8
-9
-2
-3
-4
-3
-4
-3
-0
-7
-0
-2
-9
-1
-7
-3
-2
-9
-7
-9
-6
-2
-7
-8
-4
-7
-3
-6
-1
-3
-6
-9
-3
-1
-4
-1
-7
-6
-9
-6
-0
-5
-4
-9
-9
-2
-1
-9
-4
-8
-1
-3
-9
-7
-9
-4
-4
-9
-2
-5
-9
-7
-6
-9
-9
-0
-5
-8
-5
-6
-6
-5
-7
-8
-1
-0
-1
-6
-9
-6
-7
-3
-1
-9
-1
-8
-2
-0
-9
-9
-9
-5
-5
-1
-5
-6
-0
-3
-9
-4
-6
-5
-4
-6
-5
-4
-5
-1
-4
-4
-7
-2
-3
-2
-7
-1
-8
-1
-8
-1
-8
-5
-0
-8
-9
-2
-5
-0
-1
-1
-1
-0
-3
-0
-5
-1
-6
-4
-2
-3
-6
-1
-1
-1
-3
-9
-5
-2
-9
-4
-5
-9
-3
-9
-0
-3
-6
-5
-5
-7
-2
-2
-7
-2
-2
-8
-4
-1
-7
-3
-3
-8
-9
-7
-9
-2
-2
-4
-1
-5
-5
-8
-7
-2
-5
-0
-2
-4
-2
-4
-5
-9
-5
-7
-7
-2
-2
-2
-0
-8
-5
-7
-7
-9
-1
-8
-1
-8
-0
-3
-0
-1
-9
-9
-4
-1
-8
-2
-1
-2
-9
-2
-5
-9
-2
-6
-4
-1
-5
-4
-2
-9
-2
-0
-4
-0
-0
-2
-8
-4
-7
-1
-2
-4
-0
-2
-9
-4
-3
-3
-0
-0
-5
-1
-9
-6
-5
-2
-5
-7
-7
-9
-3
-0
-9
-2
-0
-7
-1
-1
-2
-1
-5
-3
-2
-9
-7
-8
-6
-3
-6
-1
-3
-5
-1
-0
-5
-1
-3
-1
-5
-0
-6
-2
-8
-5
-1
-9
-9
-4
-6
-7
-2
-5
-0
-6
-5
-6
-3
-7
-2
-0
-8
-8
-5
-9
-1
-1
-4
-0
-3
-3
-7
-6
-1
-6
-2
-1
-9
-2
-8
-6
-1
-9
-5
-2
-5
-4
-4
-2
-8
-3
-9
-2
-4
-5
-0
-3
-1
-7
-7
-3
-7
-9
-7
-1
-9
-2
-1
-4
-2
-9
-2
-0
-2
-9
-1
-9
-8
-1
-8
-4
-5
-9
-7
-8
-3
-7
-6
-0
-0
-3
-0
-8
-0
-6
-9
-9
-5
-3
-3
-2
-3
-9
-1
-2
-6
-8
-0
-9
-6
-6
-6
-3
-8
-8
-2
-9
-5
-8
-9
-6
-1
-8
-4
-1
-2
-8
-3
-1
-9
-7
-5
-4
-0
-8
-9
-9
-1
-0
-5
-2
-3
-7
-2
-9
-4
-0
-6
-3
-9
-3
-2
-1
-3
-1
-5
-6
-5
-2
-8
-2
-2
-6
-2
-6
-6
-5
-4
-8
-9
-3
-1
-3
-0
-3
-8
-2
-1
-9
-6
-9
-4
-6
-4
-1
-1
-8
-2
-5
-4
-2
-3
-4
-0
-0
-2
-3
-2
-7
-1
-0
-8
-7
-4
-4
-7
-9
-6
-9
-0
-9
-8
-0
-9
-6
-0
-6
-4
-5
-9
-9
-3
-3
-9
-3
-3
-2
-7
-8
-0
-2
-2
-1
-7
-0
-6
-5
-4
-3
-2
-0
-9
-6
-3
-8
-0
-9
-9
-6
-8
-6
-8
-5
-9
-5
-6
-0
-2
-9
-0
-2
-8
-3
-1
-9
-7
-5
-1
-0
-8
-4
-6
-2
-6
-7
-9
-3
-6
-9
-8
-2
-2
-9
-2
-7
-3
-5
-9
-1
-8
-0
-2
-0
-5
-2
-1
-3
-7
-6
-7
-1
-2
-5
-8
-0
-3
-9
-9
-4
-0
-9
-1
-8
-6
-9
-7
-4
-3
-4
-9
-1
-9
-5
-1
-7
-3
-9
-7
-6
-9
-1
-3
-2
-8
-3
-3
-6
-9
-2
-4
-7
-8
-5
-1
-3
-4
-4
-3
-1
-0
-7
-7
-0
-7
-9
-9
-4
-8
-5
-5
-9
-0
-5
-2
-1
-6
-8
-4
-8
-0
-4
-0
-6
-1
-7
-3
-8
-6
-7
-2
-6
-9
-3
-1
-4
-6
-2
-5
-9
-2
-0
-6
-2
-1
-7
-3
-9
-1
-0
-5
-9
-3
-1
-1
-7
-4
-9
-9
-9
-8
-4
-0
-2
-4
-5
-1
-1
-6
-4
-7
-1
-9
-4
-2
-4
-1
-5
-5
-3
-5
-3
-1
-4
-5
-6
-8
-9
-4
-1
-9
-3
-8
-0
-3
-2
-5
-1
-2
-9
-3
-4
-4
-0
-8
-8
-3
-3
-1
-3
-3
-5
-9
-6
-3
-2
-6
-1
-3
-6
-0
-7
-2
-1
-7
-1
-4
-2
-8
-2
-1
-9
-9
-6
-1
-1
-2
-4
-3
-1
-7
-7
-4
-7
-0
-7
-3
-1
-3
-1
-0
-7
-7
-0
-3
-5
-3
-2
-9
-6
-6
-9
-2
-8
-3
-4
-2
-2
-5
-6
-0
-9
-2
-9
-2
-8
-2
-8
-8
-7
-9
-9
-3
-0
-6
-6
-3
-2
-1
-5
-2
-2
-9
-3
-0
-5
-5
-2
-8
-1
-4
-4
-6
-0
-2
-9
-1
-4
-7
-4
-7
-3
-9
-8
-8
-4
-7
-1
-2
-1
-2
-2
-3
-2
-3
-2
-3
-9
-1
-7
-4
-0
-3
-5
-5
-8
-6
-5
-0
-6
-7
-6
-6
-3
-2
-7
-9
-1
-1
-2
-4
-6
-4
-9
-5
-2
-3
-3
-4
-7
-8
-9
-1
-1
-0
-9
-1
-4
-4
-5
-4
-0
-6
-2
-3
-3
-1
-5
-1
-2
-0
-2
-8
-1
-2
-6
-7
-1
-6
-2
-3
-9
-0
-3
-2
-2
-0
-9
-9
diff --git a/tests/TfMobileNet-Armnn/TfMobileNet-Armnn.cpp b/tests/TfMobileNet-Armnn/TfMobileNet-Armnn.cpp
deleted file mode 100644
index 6748b12d9d..0000000000
--- a/tests/TfMobileNet-Armnn/TfMobileNet-Armnn.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../ImagePreprocessor.hpp"
-#include "armnnTfParser/ITfParser.hpp"
-
-int main(int argc, char* argv[])
-{
- int retVal = EXIT_FAILURE;
- try
- {
- // Coverity fix: The following code may throw an exception of type std::length_error.
- std::vector<ImageSet> imageSet =
- {
- {"Dog.jpg", 209},
- // Top five predictions in tensorflow:
- // -----------------------------------
- // 209:Labrador retriever 0.46392533
- // 160:Rhodesian ridgeback 0.29911423
- // 208:golden retriever 0.108059585
- // 169:redbone 0.033753652
- // 274:dingo, warrigal, warragal, ... 0.01232666
-
- {"Cat.jpg", 283},
- // Top five predictions in tensorflow:
- // -----------------------------------
- // 283:tiger cat 0.6508582
- // 286:Egyptian cat 0.2604343
- // 282:tabby, tabby cat 0.028786005
- // 288:lynx, catamount 0.020673484
- // 40:common iguana, iguana, ... 0.0080499435
-
- {"shark.jpg", 3},
- // Top five predictions in tensorflow:
- // -----------------------------------
- // 3:great white shark, white shark, ... 0.96672016
- // 4:tiger shark, Galeocerdo cuvieri 0.028302953
- // 149:killer whale, killer, orca, ... 0.0020228163
- // 5:hammerhead, hammerhead shark 0.0017547971
- // 150:dugong, Dugong dugon 0.0003968083
- };
-
- armnn::TensorShape inputTensorShape({ 1, 224, 224, 3 });
-
- using DataType = float;
- using DatabaseType = ImagePreprocessor<float>;
- using ParserType = armnnTfParser::ITfParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>(
- argc, argv,
- "mobilenet_v1_1.0_224_frozen.pb", // model name
- true, // model is binary
- "input", "MobilenetV1/Predictions/Reshape_1", // input and output tensor names
- { 0, 1, 2 }, // test images to test with as above
- [&imageSet](const char* dataDir, const ModelType&) {
- // This creates a 224x224x3 NHWC float tensor to pass to Armnn
- return DatabaseType(
- dataDir,
- 224,
- 224,
- imageSet);
- },
- &inputTensorShape);
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: TfMobileNet-Armnn: An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/TfMobileNet-Armnn/Validation.txt b/tests/TfMobileNet-Armnn/Validation.txt
deleted file mode 100644
index 94a11bdabc..0000000000
--- a/tests/TfMobileNet-Armnn/Validation.txt
+++ /dev/null
@@ -1,201 +0,0 @@
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3
-209
-283
-3 \ No newline at end of file
diff --git a/tests/TfMobileNet-Armnn/labels.txt b/tests/TfMobileNet-Armnn/labels.txt
deleted file mode 100644
index d74ff557dd..0000000000
--- a/tests/TfMobileNet-Armnn/labels.txt
+++ /dev/null
@@ -1,1001 +0,0 @@
-0:background
-1:tench, Tinca tinca
-2:goldfish, Carassius auratus
-3:great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias
-4:tiger shark, Galeocerdo cuvieri
-5:hammerhead, hammerhead shark
-6:electric ray, crampfish, numbfish, torpedo
-7:stingray
-8:cock
-9:hen
-10:ostrich, Struthio camelus
-11:brambling, Fringilla montifringilla
-12:goldfinch, Carduelis carduelis
-13:house finch, linnet, Carpodacus mexicanus
-14:junco, snowbird
-15:indigo bunting, indigo finch, indigo bird, Passerina cyanea
-16:robin, American robin, Turdus migratorius
-17:bulbul
-18:jay
-19:magpie
-20:chickadee
-21:water ouzel, dipper
-22:kite
-23:bald eagle, American eagle, Haliaeetus leucocephalus
-24:vulture
-25:great grey owl, great gray owl, Strix nebulosa
-26:European fire salamander, Salamandra salamandra
-27:common newt, Triturus vulgaris
-28:eft
-29:spotted salamander, Ambystoma maculatum
-30:axolotl, mud puppy, Ambystoma mexicanum
-31:bullfrog, Rana catesbeiana
-32:tree frog, tree-frog
-33:tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui
-34:loggerhead, loggerhead turtle, Caretta caretta
-35:leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea
-36:mud turtle
-37:terrapin
-38:box turtle, box tortoise
-39:banded gecko
-40:common iguana, iguana, Iguana iguana
-41:American chameleon, anole, Anolis carolinensis
-42:whiptail, whiptail lizard
-43:agama
-44:frilled lizard, Chlamydosaurus kingi
-45:alligator lizard
-46:Gila monster, Heloderma suspectum
-47:green lizard, Lacerta viridis
-48:African chameleon, Chamaeleo chamaeleon
-49:Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis
-50:African crocodile, Nile crocodile, Crocodylus niloticus
-51:American alligator, Alligator mississipiensis
-52:triceratops
-53:thunder snake, worm snake, Carphophis amoenus
-54:ringneck snake, ring-necked snake, ring snake
-55:hognose snake, puff adder, sand viper
-56:green snake, grass snake
-57:king snake, kingsnake
-58:garter snake, grass snake
-59:water snake
-60:vine snake
-61:night snake, Hypsiglena torquata
-62:boa constrictor, Constrictor constrictor
-63:rock python, rock snake, Python sebae
-64:Indian cobra, Naja naja
-65:green mamba
-66:sea snake
-67:horned viper, cerastes, sand viper, horned asp, Cerastes cornutus
-68:diamondback, diamondback rattlesnake, Crotalus adamanteus
-69:sidewinder, horned rattlesnake, Crotalus cerastes
-70:trilobite
-71:harvestman, daddy longlegs, Phalangium opilio
-72:scorpion
-73:black and gold garden spider, Argiope aurantia
-74:barn spider, Araneus cavaticus
-75:garden spider, Aranea diademata
-76:black widow, Latrodectus mactans
-77:tarantula
-78:wolf spider, hunting spider
-79:tick
-80:centipede
-81:black grouse
-82:ptarmigan
-83:ruffed grouse, partridge, Bonasa umbellus
-84:prairie chicken, prairie grouse, prairie fowl
-85:peacock
-86:quail
-87:partridge
-88:African grey, African gray, Psittacus erithacus
-89:macaw
-90:sulphur-crested cockatoo, Kakatoe galerita, Cacatua galerita
-91:lorikeet
-92:coucal
-93:bee eater
-94:hornbill
-95:hummingbird
-96:jacamar
-97:toucan
-98:drake
-99:red-breasted merganser, Mergus serrator
-100:goose
-101:black swan, Cygnus atratus
-102:tusker
-103:echidna, spiny anteater, anteater
-104:platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus
-105:wallaby, brush kangaroo
-106:koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus
-107:wombat
-108:jellyfish
-109:sea anemone, anemone
-110:brain coral
-111:flatworm, platyhelminth
-112:nematode, nematode worm, roundworm
-113:conch
-114:snail
-115:slug
-116:sea slug, nudibranch
-117:chiton, coat-of-mail shell, sea cradle, polyplacophore
-118:chambered nautilus, pearly nautilus, nautilus
-119:Dungeness crab, Cancer magister
-120:rock crab, Cancer irroratus
-121:fiddler crab
-122:king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica
-123:American lobster, Northern lobster, Maine lobster, Homarus americanus
-124:spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish
-125:crayfish, crawfish, crawdad, crawdaddy
-126:hermit crab
-127:isopod
-128:white stork, Ciconia ciconia
-129:black stork, Ciconia nigra
-130:spoonbill
-131:flamingo
-132:little blue heron, Egretta caerulea
-133:American egret, great white heron, Egretta albus
-134:bittern
-135:crane
-136:limpkin, Aramus pictus
-137:European gallinule, Porphyrio porphyrio
-138:American coot, marsh hen, mud hen, water hen, Fulica americana
-139:bustard
-140:ruddy turnstone, Arenaria interpres
-141:red-backed sandpiper, dunlin, Erolia alpina
-142:redshank, Tringa totanus
-143:dowitcher
-144:oystercatcher, oyster catcher
-145:pelican
-146:king penguin, Aptenodytes patagonica
-147:albatross, mollymawk
-148:grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus
-149:killer whale, killer, orca, grampus, sea wolf, Orcinus orca
-150:dugong, Dugong dugon
-151:sea lion
-152:Chihuahua
-153:Japanese spaniel
-154:Maltese dog, Maltese terrier, Maltese
-155:Pekinese, Pekingese, Peke
-156:Shih-Tzu
-157:Blenheim spaniel
-158:papillon
-159:toy terrier
-160:Rhodesian ridgeback
-161:Afghan hound, Afghan
-162:basset, basset hound
-163:beagle
-164:bloodhound, sleuthhound
-165:bluetick
-166:black-and-tan coonhound
-167:Walker hound, Walker foxhound
-168:English foxhound
-169:redbone
-170:borzoi, Russian wolfhound
-171:Irish wolfhound
-172:Italian greyhound
-173:whippet
-174:Ibizan hound, Ibizan Podenco
-175:Norwegian elkhound, elkhound
-176:otterhound, otter hound
-177:Saluki, gazelle hound
-178:Scottish deerhound, deerhound
-179:Weimaraner
-180:Staffordshire bullterrier, Staffordshire bull terrier
-181:American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier
-182:Bedlington terrier
-183:Border terrier
-184:Kerry blue terrier
-185:Irish terrier
-186:Norfolk terrier
-187:Norwich terrier
-188:Yorkshire terrier
-189:wire-haired fox terrier
-190:Lakeland terrier
-191:Sealyham terrier, Sealyham
-192:Airedale, Airedale terrier
-193:cairn, cairn terrier
-194:Australian terrier
-195:Dandie Dinmont, Dandie Dinmont terrier
-196:Boston bull, Boston terrier
-197:miniature schnauzer
-198:giant schnauzer
-199:standard schnauzer
-200:Scotch terrier, Scottish terrier, Scottie
-201:Tibetan terrier, chrysanthemum dog
-202:silky terrier, Sydney silky
-203:soft-coated wheaten terrier
-204:West Highland white terrier
-205:Lhasa, Lhasa apso
-206:flat-coated retriever
-207:curly-coated retriever
-208:golden retriever
-209:Labrador retriever
-210:Chesapeake Bay retriever
-211:German short-haired pointer
-212:vizsla, Hungarian pointer
-213:English setter
-214:Irish setter, red setter
-215:Gordon setter
-216:Brittany spaniel
-217:clumber, clumber spaniel
-218:English springer, English springer spaniel
-219:Welsh springer spaniel
-220:cocker spaniel, English cocker spaniel, cocker
-221:Sussex spaniel
-222:Irish water spaniel
-223:kuvasz
-224:schipperke
-225:groenendael
-226:malinois
-227:briard
-228:kelpie
-229:komondor
-230:Old English sheepdog, bobtail
-231:Shetland sheepdog, Shetland sheep dog, Shetland
-232:collie
-233:Border collie
-234:Bouvier des Flandres, Bouviers des Flandres
-235:Rottweiler
-236:German shepherd, German shepherd dog, German police dog, alsatian
-237:Doberman, Doberman pinscher
-238:miniature pinscher
-239:Greater Swiss Mountain dog
-240:Bernese mountain dog
-241:Appenzeller
-242:EntleBucher
-243:boxer
-244:bull mastiff
-245:Tibetan mastiff
-246:French bulldog
-247:Great Dane
-248:Saint Bernard, St Bernard
-249:Eskimo dog, husky
-250:malamute, malemute, Alaskan malamute
-251:Siberian husky
-252:dalmatian, coach dog, carriage dog
-253:affenpinscher, monkey pinscher, monkey dog
-254:basenji
-255:pug, pug-dog
-256:Leonberg
-257:Newfoundland, Newfoundland dog
-258:Great Pyrenees
-259:Samoyed, Samoyede
-260:Pomeranian
-261:chow, chow chow
-262:keeshond
-263:Brabancon griffon
-264:Pembroke, Pembroke Welsh corgi
-265:Cardigan, Cardigan Welsh corgi
-266:toy poodle
-267:miniature poodle
-268:standard poodle
-269:Mexican hairless
-270:timber wolf, grey wolf, gray wolf, Canis lupus
-271:white wolf, Arctic wolf, Canis lupus tundrarum
-272:red wolf, maned wolf, Canis rufus, Canis niger
-273:coyote, prairie wolf, brush wolf, Canis latrans
-274:dingo, warrigal, warragal, Canis dingo
-275:dhole, Cuon alpinus
-276:African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus
-277:hyena, hyaena
-278:red fox, Vulpes vulpes
-279:kit fox, Vulpes macrotis
-280:Arctic fox, white fox, Alopex lagopus
-281:grey fox, gray fox, Urocyon cinereoargenteus
-282:tabby, tabby cat
-283:tiger cat
-284:Persian cat
-285:Siamese cat, Siamese
-286:Egyptian cat
-287:cougar, puma, catamount, mountain lion, painter, panther, Felis concolor
-288:lynx, catamount
-289:leopard, Panthera pardus
-290:snow leopard, ounce, Panthera uncia
-291:jaguar, panther, Panthera onca, Felis onca
-292:lion, king of beasts, Panthera leo
-293:tiger, Panthera tigris
-294:cheetah, chetah, Acinonyx jubatus
-295:brown bear, bruin, Ursus arctos
-296:American black bear, black bear, Ursus americanus, Euarctos americanus
-297:ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus
-298:sloth bear, Melursus ursinus, Ursus ursinus
-299:mongoose
-300:meerkat, mierkat
-301:tiger beetle
-302:ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle
-303:ground beetle, carabid beetle
-304:long-horned beetle, longicorn, longicorn beetle
-305:leaf beetle, chrysomelid
-306:dung beetle
-307:rhinoceros beetle
-308:weevil
-309:fly
-310:bee
-311:ant, emmet, pismire
-312:grasshopper, hopper
-313:cricket
-314:walking stick, walkingstick, stick insect
-315:cockroach, roach
-316:mantis, mantid
-317:cicada, cicala
-318:leafhopper
-319:lacewing, lacewing fly
-320:dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk
-321:damselfly
-322:admiral
-323:ringlet, ringlet butterfly
-324:monarch, monarch butterfly, milkweed butterfly, Danaus plexippus
-325:cabbage butterfly
-326:sulphur butterfly, sulfur butterfly
-327:lycaenid, lycaenid butterfly
-328:starfish, sea star
-329:sea urchin
-330:sea cucumber, holothurian
-331:wood rabbit, cottontail, cottontail rabbit
-332:hare
-333:Angora, Angora rabbit
-334:hamster
-335:porcupine, hedgehog
-336:fox squirrel, eastern fox squirrel, Sciurus niger
-337:marmot
-338:beaver
-339:guinea pig, Cavia cobaya
-340:sorrel
-341:zebra
-342:hog, pig, grunter, squealer, Sus scrofa
-343:wild boar, boar, Sus scrofa
-344:warthog
-345:hippopotamus, hippo, river horse, Hippopotamus amphibius
-346:ox
-347:water buffalo, water ox, Asiatic buffalo, Bubalus bubalis
-348:bison
-349:ram, tup
-350:bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis
-351:ibex, Capra ibex
-352:hartebeest
-353:impala, Aepyceros melampus
-354:gazelle
-355:Arabian camel, dromedary, Camelus dromedarius
-356:llama
-357:weasel
-358:mink
-359:polecat, fitch, foulmart, foumart, Mustela putorius
-360:black-footed ferret, ferret, Mustela nigripes
-361:otter
-362:skunk, polecat, wood pussy
-363:badger
-364:armadillo
-365:three-toed sloth, ai, Bradypus tridactylus
-366:orangutan, orang, orangutang, Pongo pygmaeus
-367:gorilla, Gorilla gorilla
-368:chimpanzee, chimp, Pan troglodytes
-369:gibbon, Hylobates lar
-370:siamang, Hylobates syndactylus, Symphalangus syndactylus
-371:guenon, guenon monkey
-372:patas, hussar monkey, Erythrocebus patas
-373:baboon
-374:macaque
-375:langur
-376:colobus, colobus monkey
-377:proboscis monkey, Nasalis larvatus
-378:marmoset
-379:capuchin, ringtail, Cebus capucinus
-380:howler monkey, howler
-381:titi, titi monkey
-382:spider monkey, Ateles geoffroyi
-383:squirrel monkey, Saimiri sciureus
-384:Madagascar cat, ring-tailed lemur, Lemur catta
-385:indri, indris, Indri indri, Indri brevicaudatus
-386:Indian elephant, Elephas maximus
-387:African elephant, Loxodonta africana
-388:lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens
-389:giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca
-390:barracouta, snoek
-391:eel
-392:coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch
-393:rock beauty, Holocanthus tricolor
-394:anemone fish
-395:sturgeon
-396:gar, garfish, garpike, billfish, Lepisosteus osseus
-397:lionfish
-398:puffer, pufferfish, blowfish, globefish
-399:abacus
-400:abaya
-401:academic gown, academic robe, judge's robe
-402:accordion, piano accordion, squeeze box
-403:acoustic guitar
-404:aircraft carrier, carrier, flattop, attack aircraft carrier
-405:airliner
-406:airship, dirigible
-407:altar
-408:ambulance
-409:amphibian, amphibious vehicle
-410:analog clock
-411:apiary, bee house
-412:apron
-413:ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin
-414:assault rifle, assault gun
-415:backpack, back pack, knapsack, packsack, rucksack, haversack
-416:bakery, bakeshop, bakehouse
-417:balance beam, beam
-418:balloon
-419:ballpoint, ballpoint pen, ballpen, Biro
-420:Band Aid
-421:banjo
-422:bannister, banister, balustrade, balusters, handrail
-423:barbell
-424:barber chair
-425:barbershop
-426:barn
-427:barometer
-428:barrel, cask
-429:barrow, garden cart, lawn cart, wheelbarrow
-430:baseball
-431:basketball
-432:bassinet
-433:bassoon
-434:bathing cap, swimming cap
-435:bath towel
-436:bathtub, bathing tub, bath, tub
-437:beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon
-438:beacon, lighthouse, beacon light, pharos
-439:beaker
-440:bearskin, busby, shako
-441:beer bottle
-442:beer glass
-443:bell cote, bell cot
-444:bib
-445:bicycle-built-for-two, tandem bicycle, tandem
-446:bikini, two-piece
-447:binder, ring-binder
-448:binoculars, field glasses, opera glasses
-449:birdhouse
-450:boathouse
-451:bobsled, bobsleigh, bob
-452:bolo tie, bolo, bola tie, bola
-453:bonnet, poke bonnet
-454:bookcase
-455:bookshop, bookstore, bookstall
-456:bottlecap
-457:bow
-458:bow tie, bow-tie, bowtie
-459:brass, memorial tablet, plaque
-460:brassiere, bra, bandeau
-461:breakwater, groin, groyne, mole, bulwark, seawall, jetty
-462:breastplate, aegis, egis
-463:broom
-464:bucket, pail
-465:buckle
-466:bulletproof vest
-467:bullet train, bullet
-468:butcher shop, meat market
-469:cab, hack, taxi, taxicab
-470:caldron, cauldron
-471:candle, taper, wax light
-472:cannon
-473:canoe
-474:can opener, tin opener
-475:cardigan
-476:car mirror
-477:carousel, carrousel, merry-go-round, roundabout, whirligig
-478:carpenter's kit, tool kit
-479:carton
-480:car wheel
-481:cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM
-482:cassette
-483:cassette player
-484:castle
-485:catamaran
-486:CD player
-487:cello, violoncello
-488:cellular telephone, cellular phone, cellphone, cell, mobile phone
-489:chain
-490:chainlink fence
-491:chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour
-492:chain saw, chainsaw
-493:chest
-494:chiffonier, commode
-495:chime, bell, gong
-496:china cabinet, china closet
-497:Christmas stocking
-498:church, church building
-499:cinema, movie theater, movie theatre, movie house, picture palace
-500:cleaver, meat cleaver, chopper
-501:cliff dwelling
-502:cloak
-503:clog, geta, patten, sabot
-504:cocktail shaker
-505:coffee mug
-506:coffeepot
-507:coil, spiral, volute, whorl, helix
-508:combination lock
-509:computer keyboard, keypad
-510:confectionery, confectionary, candy store
-511:container ship, containership, container vessel
-512:convertible
-513:corkscrew, bottle screw
-514:cornet, horn, trumpet, trump
-515:cowboy boot
-516:cowboy hat, ten-gallon hat
-517:cradle
-518:crane
-519:crash helmet
-520:crate
-521:crib, cot
-522:Crock Pot
-523:croquet ball
-524:crutch
-525:cuirass
-526:dam, dike, dyke
-527:desk
-528:desktop computer
-529:dial telephone, dial phone
-530:diaper, nappy, napkin
-531:digital clock
-532:digital watch
-533:dining table, board
-534:dishrag, dishcloth
-535:dishwasher, dish washer, dishwashing machine
-536:disk brake, disc brake
-537:dock, dockage, docking facility
-538:dogsled, dog sled, dog sleigh
-539:dome
-540:doormat, welcome mat
-541:drilling platform, offshore rig
-542:drum, membranophone, tympan
-543:drumstick
-544:dumbbell
-545:Dutch oven
-546:electric fan, blower
-547:electric guitar
-548:electric locomotive
-549:entertainment center
-550:envelope
-551:espresso maker
-552:face powder
-553:feather boa, boa
-554:file, file cabinet, filing cabinet
-555:fireboat
-556:fire engine, fire truck
-557:fire screen, fireguard
-558:flagpole, flagstaff
-559:flute, transverse flute
-560:folding chair
-561:football helmet
-562:forklift
-563:fountain
-564:fountain pen
-565:four-poster
-566:freight car
-567:French horn, horn
-568:frying pan, frypan, skillet
-569:fur coat
-570:garbage truck, dustcart
-571:gasmask, respirator, gas helmet
-572:gas pump, gasoline pump, petrol pump, island dispenser
-573:goblet
-574:go-kart
-575:golf ball
-576:golfcart, golf cart
-577:gondola
-578:gong, tam-tam
-579:gown
-580:grand piano, grand
-581:greenhouse, nursery, glasshouse
-582:grille, radiator grille
-583:grocery store, grocery, food market, market
-584:guillotine
-585:hair slide
-586:hair spray
-587:half track
-588:hammer
-589:hamper
-590:hand blower, blow dryer, blow drier, hair dryer, hair drier
-591:hand-held computer, hand-held microcomputer
-592:handkerchief, hankie, hanky, hankey
-593:hard disc, hard disk, fixed disk
-594:harmonica, mouth organ, harp, mouth harp
-595:harp
-596:harvester, reaper
-597:hatchet
-598:holster
-599:home theater, home theatre
-600:honeycomb
-601:hook, claw
-602:hoopskirt, crinoline
-603:horizontal bar, high bar
-604:horse cart, horse-cart
-605:hourglass
-606:iPod
-607:iron, smoothing iron
-608:jack-o'-lantern
-609:jean, blue jean, denim
-610:jeep, landrover
-611:jersey, T-shirt, tee shirt
-612:jigsaw puzzle
-613:jinrikisha, ricksha, rickshaw
-614:joystick
-615:kimono
-616:knee pad
-617:knot
-618:lab coat, laboratory coat
-619:ladle
-620:lampshade, lamp shade
-621:laptop, laptop computer
-622:lawn mower, mower
-623:lens cap, lens cover
-624:letter opener, paper knife, paperknife
-625:library
-626:lifeboat
-627:lighter, light, igniter, ignitor
-628:limousine, limo
-629:liner, ocean liner
-630:lipstick, lip rouge
-631:Loafer
-632:lotion
-633:loudspeaker, speaker, speaker unit, loudspeaker system, speaker system
-634:loupe, jeweler's loupe
-635:lumbermill, sawmill
-636:magnetic compass
-637:mailbag, postbag
-638:mailbox, letter box
-639:maillot
-640:maillot, tank suit
-641:manhole cover
-642:maraca
-643:marimba, xylophone
-644:mask
-645:matchstick
-646:maypole
-647:maze, labyrinth
-648:measuring cup
-649:medicine chest, medicine cabinet
-650:megalith, megalithic structure
-651:microphone, mike
-652:microwave, microwave oven
-653:military uniform
-654:milk can
-655:minibus
-656:miniskirt, mini
-657:minivan
-658:missile
-659:mitten
-660:mixing bowl
-661:mobile home, manufactured home
-662:Model T
-663:modem
-664:monastery
-665:monitor
-666:moped
-667:mortar
-668:mortarboard
-669:mosque
-670:mosquito net
-671:motor scooter, scooter
-672:mountain bike, all-terrain bike, off-roader
-673:mountain tent
-674:mouse, computer mouse
-675:mousetrap
-676:moving van
-677:muzzle
-678:nail
-679:neck brace
-680:necklace
-681:nipple
-682:notebook, notebook computer
-683:obelisk
-684:oboe, hautboy, hautbois
-685:ocarina, sweet potato
-686:odometer, hodometer, mileometer, milometer
-687:oil filter
-688:organ, pipe organ
-689:oscilloscope, scope, cathode-ray oscilloscope, CRO
-690:overskirt
-691:oxcart
-692:oxygen mask
-693:packet
-694:paddle, boat paddle
-695:paddlewheel, paddle wheel
-696:padlock
-697:paintbrush
-698:pajama, pyjama, pj's, jammies
-699:palace
-700:panpipe, pandean pipe, syrinx
-701:paper towel
-702:parachute, chute
-703:parallel bars, bars
-704:park bench
-705:parking meter
-706:passenger car, coach, carriage
-707:patio, terrace
-708:pay-phone, pay-station
-709:pedestal, plinth, footstall
-710:pencil box, pencil case
-711:pencil sharpener
-712:perfume, essence
-713:Petri dish
-714:photocopier
-715:pick, plectrum, plectron
-716:pickelhaube
-717:picket fence, paling
-718:pickup, pickup truck
-719:pier
-720:piggy bank, penny bank
-721:pill bottle
-722:pillow
-723:ping-pong ball
-724:pinwheel
-725:pirate, pirate ship
-726:pitcher, ewer
-727:plane, carpenter's plane, woodworking plane
-728:planetarium
-729:plastic bag
-730:plate rack
-731:plow, plough
-732:plunger, plumber's helper
-733:Polaroid camera, Polaroid Land camera
-734:pole
-735:police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria
-736:poncho
-737:pool table, billiard table, snooker table
-738:pop bottle, soda bottle
-739:pot, flowerpot
-740:potter's wheel
-741:power drill
-742:prayer rug, prayer mat
-743:printer
-744:prison, prison house
-745:projectile, missile
-746:projector
-747:puck, hockey puck
-748:punching bag, punch bag, punching ball, punchball
-749:purse
-750:quill, quill pen
-751:quilt, comforter, comfort, puff
-752:racer, race car, racing car
-753:racket, racquet
-754:radiator
-755:radio, wireless
-756:radio telescope, radio reflector
-757:rain barrel
-758:recreational vehicle, RV, R.V.
-759:reel
-760:reflex camera
-761:refrigerator, icebox
-762:remote control, remote
-763:restaurant, eating house, eating place, eatery
-764:revolver, six-gun, six-shooter
-765:rifle
-766:rocking chair, rocker
-767:rotisserie
-768:rubber eraser, rubber, pencil eraser
-769:rugby ball
-770:rule, ruler
-771:running shoe
-772:safe
-773:safety pin
-774:saltshaker, salt shaker
-775:sandal
-776:sarong
-777:sax, saxophone
-778:scabbard
-779:scale, weighing machine
-780:school bus
-781:schooner
-782:scoreboard
-783:screen, CRT screen
-784:screw
-785:screwdriver
-786:seat belt, seatbelt
-787:sewing machine
-788:shield, buckler
-789:shoe shop, shoe-shop, shoe store
-790:shoji
-791:shopping basket
-792:shopping cart
-793:shovel
-794:shower cap
-795:shower curtain
-796:ski
-797:ski mask
-798:sleeping bag
-799:slide rule, slipstick
-800:sliding door
-801:slot, one-armed bandit
-802:snorkel
-803:snowmobile
-804:snowplow, snowplough
-805:soap dispenser
-806:soccer ball
-807:sock
-808:solar dish, solar collector, solar furnace
-809:sombrero
-810:soup bowl
-811:space bar
-812:space heater
-813:space shuttle
-814:spatula
-815:speedboat
-816:spider web, spider's web
-817:spindle
-818:sports car, sport car
-819:spotlight, spot
-820:stage
-821:steam locomotive
-822:steel arch bridge
-823:steel drum
-824:stethoscope
-825:stole
-826:stone wall
-827:stopwatch, stop watch
-828:stove
-829:strainer
-830:streetcar, tram, tramcar, trolley, trolley car
-831:stretcher
-832:studio couch, day bed
-833:stupa, tope
-834:submarine, pigboat, sub, U-boat
-835:suit, suit of clothes
-836:sundial
-837:sunglass
-838:sunglasses, dark glasses, shades
-839:sunscreen, sunblock, sun blocker
-840:suspension bridge
-841:swab, swob, mop
-842:sweatshirt
-843:swimming trunks, bathing trunks
-844:swing
-845:switch, electric switch, electrical switch
-846:syringe
-847:table lamp
-848:tank, army tank, armored combat vehicle, armoured combat vehicle
-849:tape player
-850:teapot
-851:teddy, teddy bear
-852:television, television system
-853:tennis ball
-854:thatch, thatched roof
-855:theater curtain, theatre curtain
-856:thimble
-857:thresher, thrasher, threshing machine
-858:throne
-859:tile roof
-860:toaster
-861:tobacco shop, tobacconist shop, tobacconist
-862:toilet seat
-863:torch
-864:totem pole
-865:tow truck, tow car, wrecker
-866:toyshop
-867:tractor
-868:trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi
-869:tray
-870:trench coat
-871:tricycle, trike, velocipede
-872:trimaran
-873:tripod
-874:triumphal arch
-875:trolleybus, trolley coach, trackless trolley
-876:trombone
-877:tub, vat
-878:turnstile
-879:typewriter keyboard
-880:umbrella
-881:unicycle, monocycle
-882:upright, upright piano
-883:vacuum, vacuum cleaner
-884:vase
-885:vault
-886:velvet
-887:vending machine
-888:vestment
-889:viaduct
-890:violin, fiddle
-891:volleyball
-892:waffle iron
-893:wall clock
-894:wallet, billfold, notecase, pocketbook
-895:wardrobe, closet, press
-896:warplane, military plane
-897:washbasin, handbasin, washbowl, lavabo, wash-hand basin
-898:washer, automatic washer, washing machine
-899:water bottle
-900:water jug
-901:water tower
-902:whiskey jug
-903:whistle
-904:wig
-905:window screen
-906:window shade
-907:Windsor tie
-908:wine bottle
-909:wing
-910:wok
-911:wooden spoon
-912:wool, woolen, woollen
-913:worm fence, snake fence, snake-rail fence, Virginia fence
-914:wreck
-915:yawl
-916:yurt
-917:web site, website, internet site, site
-918:comic book
-919:crossword puzzle, crossword
-920:street sign
-921:traffic light, traffic signal, stoplight
-922:book jacket, dust cover, dust jacket, dust wrapper
-923:menu
-924:plate
-925:guacamole
-926:consomme
-927:hot pot, hotpot
-928:trifle
-929:ice cream, icecream
-930:ice lolly, lolly, lollipop, popsicle
-931:French loaf
-932:bagel, beigel
-933:pretzel
-934:cheeseburger
-935:hotdog, hot dog, red hot
-936:mashed potato
-937:head cabbage
-938:broccoli
-939:cauliflower
-940:zucchini, courgette
-941:spaghetti squash
-942:acorn squash
-943:butternut squash
-944:cucumber, cuke
-945:artichoke, globe artichoke
-946:bell pepper
-947:cardoon
-948:mushroom
-949:Granny Smith
-950:strawberry
-951:orange
-952:lemon
-953:fig
-954:pineapple, ananas
-955:banana
-956:jackfruit, jak, jack
-957:custard apple
-958:pomegranate
-959:hay
-960:carbonara
-961:chocolate sauce, chocolate syrup
-962:dough
-963:meat loaf, meatloaf
-964:pizza, pizza pie
-965:potpie
-966:burrito
-967:red wine
-968:espresso
-969:cup
-970:eggnog
-971:alp
-972:bubble
-973:cliff, drop, drop-off
-974:coral reef
-975:geyser
-976:lakeside, lakeshore
-977:promontory, headland, head, foreland
-978:sandbar, sand bar
-979:seashore, coast, seacoast, sea-coast
-980:valley, vale
-981:volcano
-982:ballplayer, baseball player
-983:groom, bridegroom
-984:scuba diver
-985:rapeseed
-986:daisy
-987:yellow lady's slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum
-988:corn
-989:acorn
-990:hip, rose hip, rosehip
-991:buckeye, horse chestnut, conker
-992:coral fungus
-993:agaric
-994:gyromitra
-995:stinkhorn, carrion fungus
-996:earthstar
-997:hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa
-998:bolete
-999:ear, spike, capitulum
-1000:toilet tissue, toilet paper, bathroom tissue
diff --git a/tests/TfResNext_Quantized-Armnn/TfResNext_Quantized-Armnn.cpp b/tests/TfResNext_Quantized-Armnn/TfResNext_Quantized-Armnn.cpp
deleted file mode 100644
index c152c0f6c2..0000000000
--- a/tests/TfResNext_Quantized-Armnn/TfResNext_Quantized-Armnn.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "../InferenceTest.hpp"
-#include "../CaffePreprocessor.hpp"
-#include "armnnTfParser/ITfParser.hpp"
-
-int main(int argc, char* argv[])
-{
- int retVal = EXIT_FAILURE;
- try
- {
- // Coverity fix: The following code may throw an exception of type std::length_error.
- std::vector<ImageSet> imageSet =
- {
- {"ILSVRC2012_val_00000018.JPEG", 21 },
- {"shark.jpg", 2}
- };
-
- armnn::TensorShape inputTensorShape({ 1, 3, 224, 224 });
-
- using DataType = float;
- using DatabaseType = CaffePreprocessor;
- using ParserType = armnnTfParser::ITfParser;
- using ModelType = InferenceModel<ParserType, DataType>;
-
- // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
- retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>(
- argc, argv, "resnext_TF_quantized_for_armnn_team.pb", true,
- "inputs", "pool1", { 0, 1 },
- [&imageSet](const char* dataDir, const ModelType &) {
- return DatabaseType(dataDir, 224, 224, imageSet);
- },
- &inputTensorShape);
- }
- catch (const std::exception& e)
- {
- // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
- // exception of type std::length_error.
- // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
- std::cerr << "WARNING: TfResNext_Quantized-Armnn: An error has occurred when running "
- "the classifier inference tests: " << e.what() << std::endl;
- }
- return retVal;
-}
diff --git a/tests/YoloDatabase.cpp b/tests/YoloDatabase.cpp
deleted file mode 100644
index 98db8d4871..0000000000
--- a/tests/YoloDatabase.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "YoloDatabase.hpp"
-
-#include <armnn/Exceptions.hpp>
-#include <armnn/Logging.hpp>
-
-#include <array>
-#include <cstdint>
-#include <tuple>
-#include <utility>
-
-#include <boost/assert.hpp>
-#include <boost/format.hpp>
-#include <boost/numeric/conversion/cast.hpp>
-
-#include "InferenceTestImage.hpp"
-
-namespace
-{
-enum class YoloVocClass : unsigned int
-{
- Aeroplane,
- Bicycle,
- Bird,
- Boat,
- Bottle,
- Bus,
- Car,
- Cat,
- Chair,
- Cow,
- DiningTable,
- Dog,
- Horse,
- Motorbike,
- Person,
- PottedPlant,
- Sheep,
- Sofa,
- Train,
- TvMonitor
-};
-
-template <typename E>
-constexpr auto to_underlying(E e) noexcept
-{
- return static_cast<std::underlying_type_t<E>>(e);
-}
-
-class ImageNotFoundException : public armnn::Exception
-{
- using Exception::Exception;
-};
-
-using YoloInputOutput = std::pair<const char* const, YoloDetectedObject>;
-
-const std::array<YoloInputOutput,1> g_PerTestCaseInputOutput =
-{
- YoloInputOutput{
- "yolo_dog_448x448.png",
- { to_underlying(YoloVocClass::Dog), YoloBoundingBox{ 233.0f, 256.0f, 299.0f, 462.0f }, 0.5088733434677124f }
- },
-};
-
-} // namespace
-
-YoloDatabase::YoloDatabase(const std::string& imageDir)
- : m_ImageDir(imageDir)
-{
-}
-
-std::unique_ptr<YoloDatabase::TTestCaseData> YoloDatabase::GetTestCaseData(unsigned int testCaseId)
-{
- testCaseId = testCaseId % boost::numeric_cast<unsigned int>(g_PerTestCaseInputOutput.size());
- const auto& testCaseInputOutput = g_PerTestCaseInputOutput[testCaseId];
- const std::string imagePath = m_ImageDir + testCaseInputOutput.first;
-
- // Loads test case input image.
- std::vector<float> imageData;
- try
- {
- InferenceTestImage image(imagePath.c_str());
- if (YoloImageWidth != image.GetWidth() || YoloImageHeight != image.GetHeight())
- {
- image.Resize(YoloImageWidth, YoloImageHeight, CHECK_LOCATION());
- }
- imageData = GetImageDataInArmNnLayoutAsNormalizedFloats(ImageChannelLayout::Rgb, image);
- }
- catch (const InferenceTestImageException& e)
- {
- ARMNN_LOG(fatal) << "Failed to load test case " << testCaseId << " with error: " << e.what();
- return nullptr;
- }
-
- // Prepares test case output.
- std::vector<YoloDetectedObject> topObjectDetections;
- topObjectDetections.reserve(1);
- topObjectDetections.push_back(testCaseInputOutput.second);
-
- return std::make_unique<YoloTestCaseData>(std::move(imageData), std::move(topObjectDetections));
-}
diff --git a/tests/YoloDatabase.hpp b/tests/YoloDatabase.hpp
deleted file mode 100644
index 220262c522..0000000000
--- a/tests/YoloDatabase.hpp
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#pragma once
-
-#include "ClassifierTestCaseData.hpp"
-
-#include <array>
-#include <string>
-#include <memory>
-
-struct YoloBoundingBox
-{
- float m_X;
- float m_Y;
- float m_W;
- float m_H;
-};
-
-struct YoloDetectedObject
-{
- YoloDetectedObject(unsigned int yoloClass,
- const YoloBoundingBox& box,
- float confidence)
- : m_Class(yoloClass)
- , m_Box(box)
- , m_Confidence(confidence)
- {}
-
- unsigned int m_Class;
- YoloBoundingBox m_Box;
- float m_Confidence;
-};
-
-class YoloTestCaseData
-{
-public:
- YoloTestCaseData(std::vector<float> inputImage,
- std::vector<YoloDetectedObject> topObjectDetections)
- : m_InputImage(std::move(inputImage))
- , m_TopObjectDetections(std::move(topObjectDetections))
- {
- }
-
- std::vector<float> m_InputImage;
- std::vector<YoloDetectedObject> m_TopObjectDetections;
-};
-
-constexpr unsigned int YoloImageWidth = 448;
-constexpr unsigned int YoloImageHeight = 448;
-
-class YoloDatabase
-{
-public:
- using TTestCaseData = YoloTestCaseData;
-
- explicit YoloDatabase(const std::string& imageDir);
- std::unique_ptr<TTestCaseData> GetTestCaseData(unsigned int testCaseId);
-
-private:
- std::string m_ImageDir;
-};
diff --git a/tests/YoloInferenceTest.hpp b/tests/YoloInferenceTest.hpp
deleted file mode 100644
index 16d0355d9d..0000000000
--- a/tests/YoloInferenceTest.hpp
+++ /dev/null
@@ -1,240 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#pragma once
-
-#include "InferenceTest.hpp"
-#include "YoloDatabase.hpp"
-
-#include <algorithm>
-#include <array>
-#include <utility>
-
-#include <boost/assert.hpp>
-#include <boost/multi_array.hpp>
-#include <boost/test/tools/floating_point_comparison.hpp>
-
-constexpr size_t YoloOutputSize = 1470;
-
-template <typename Model>
-class YoloTestCase : public InferenceModelTestCase<Model>
-{
-public:
- YoloTestCase(Model& model,
- unsigned int testCaseId,
- YoloTestCaseData& testCaseData)
- : InferenceModelTestCase<Model>(model, testCaseId, { std::move(testCaseData.m_InputImage) }, { YoloOutputSize })
- , m_FloatComparer(boost::math::fpc::percent_tolerance(1.0f))
- , m_TopObjectDetections(std::move(testCaseData.m_TopObjectDetections))
- {
- }
-
- virtual TestCaseResult ProcessResult(const InferenceTestOptions& options) override
- {
- boost::ignore_unused(options);
-
- using Boost3dArray = boost::multi_array<float, 3>;
-
- const std::vector<float>& output = boost::get<std::vector<float>>(this->GetOutputs()[0]);
- BOOST_ASSERT(output.size() == YoloOutputSize);
-
- constexpr Boost3dArray::index gridSize = 7;
- constexpr Boost3dArray::index numClasses = 20;
- constexpr Boost3dArray::index numScales = 2;
-
- const float* outputPtr = output.data();
-
- // Range 0-980. Class probabilities. 7x7x20
- Boost3dArray classProbabilities(boost::extents[gridSize][gridSize][numClasses]);
- for (Boost3dArray::index y = 0; y < gridSize; ++y)
- {
- for (Boost3dArray::index x = 0; x < gridSize; ++x)
- {
- for (Boost3dArray::index c = 0; c < numClasses; ++c)
- {
- classProbabilities[y][x][c] = *outputPtr++;
- }
- }
- }
-
- // Range 980-1078. Scales. 7x7x2
- Boost3dArray scales(boost::extents[gridSize][gridSize][numScales]);
- for (Boost3dArray::index y = 0; y < gridSize; ++y)
- {
- for (Boost3dArray::index x = 0; x < gridSize; ++x)
- {
- for (Boost3dArray::index s = 0; s < numScales; ++s)
- {
- scales[y][x][s] = *outputPtr++;
- }
- }
- }
-
- // Range 1078-1469. Bounding boxes. 7x7x2x4
- constexpr float imageWidthAsFloat = static_cast<float>(YoloImageWidth);
- constexpr float imageHeightAsFloat = static_cast<float>(YoloImageHeight);
-
- boost::multi_array<float, 4> boxes(boost::extents[gridSize][gridSize][numScales][4]);
- for (Boost3dArray::index y = 0; y < gridSize; ++y)
- {
- for (Boost3dArray::index x = 0; x < gridSize; ++x)
- {
- for (Boost3dArray::index s = 0; s < numScales; ++s)
- {
- float bx = *outputPtr++;
- float by = *outputPtr++;
- float bw = *outputPtr++;
- float bh = *outputPtr++;
-
- boxes[y][x][s][0] = ((bx + static_cast<float>(x)) / 7.0f) * imageWidthAsFloat;
- boxes[y][x][s][1] = ((by + static_cast<float>(y)) / 7.0f) * imageHeightAsFloat;
- boxes[y][x][s][2] = bw * bw * static_cast<float>(imageWidthAsFloat);
- boxes[y][x][s][3] = bh * bh * static_cast<float>(imageHeightAsFloat);
- }
- }
- }
- BOOST_ASSERT(output.data() + YoloOutputSize == outputPtr);
-
- std::vector<YoloDetectedObject> detectedObjects;
- detectedObjects.reserve(gridSize * gridSize * numScales * numClasses);
-
- for (Boost3dArray::index y = 0; y < gridSize; ++y)
- {
- for (Boost3dArray::index x = 0; x < gridSize; ++x)
- {
- for (Boost3dArray::index s = 0; s < numScales; ++s)
- {
- for (Boost3dArray::index c = 0; c < numClasses; ++c)
- {
- // Resolved confidence: class probabilities * scales.
- const float confidence = classProbabilities[y][x][c] * scales[y][x][s];
-
- // Resolves bounding box and stores.
- YoloBoundingBox box;
- box.m_X = boxes[y][x][s][0];
- box.m_Y = boxes[y][x][s][1];
- box.m_W = boxes[y][x][s][2];
- box.m_H = boxes[y][x][s][3];
-
- detectedObjects.emplace_back(c, box, confidence);
- }
- }
- }
- }
-
- // Sorts detected objects by confidence.
- std::sort(detectedObjects.begin(), detectedObjects.end(),
- [](const YoloDetectedObject& a, const YoloDetectedObject& b)
- {
- // Sorts by largest confidence first, then by class.
- return a.m_Confidence > b.m_Confidence
- || (a.m_Confidence == b.m_Confidence && a.m_Class > b.m_Class);
- });
-
- // Checks the top N detections.
- auto outputIt = detectedObjects.begin();
- auto outputEnd = detectedObjects.end();
-
- for (const YoloDetectedObject& expectedDetection : m_TopObjectDetections)
- {
- if (outputIt == outputEnd)
- {
- // Somehow expected more things to check than detections found by the model.
- return TestCaseResult::Abort;
- }
-
- const YoloDetectedObject& detectedObject = *outputIt;
- if (detectedObject.m_Class != expectedDetection.m_Class)
- {
- ARMNN_LOG(error) << "Prediction for test case " << this->GetTestCaseId() <<
- " is incorrect: Expected (" << expectedDetection.m_Class << ")" <<
- " but predicted (" << detectedObject.m_Class << ")";
- return TestCaseResult::Failed;
- }
-
- if (!m_FloatComparer(detectedObject.m_Box.m_X, expectedDetection.m_Box.m_X) ||
- !m_FloatComparer(detectedObject.m_Box.m_Y, expectedDetection.m_Box.m_Y) ||
- !m_FloatComparer(detectedObject.m_Box.m_W, expectedDetection.m_Box.m_W) ||
- !m_FloatComparer(detectedObject.m_Box.m_H, expectedDetection.m_Box.m_H) ||
- !m_FloatComparer(detectedObject.m_Confidence, expectedDetection.m_Confidence))
- {
- ARMNN_LOG(error) << "Detected bounding box for test case " << this->GetTestCaseId() <<
- " is incorrect";
- return TestCaseResult::Failed;
- }
-
- ++outputIt;
- }
-
- return TestCaseResult::Ok;
- }
-
-private:
- boost::math::fpc::close_at_tolerance<float> m_FloatComparer;
- std::vector<YoloDetectedObject> m_TopObjectDetections;
-};
-
-template <typename Model>
-class YoloTestCaseProvider : public IInferenceTestCaseProvider
-{
-public:
- template <typename TConstructModelCallable>
- explicit YoloTestCaseProvider(TConstructModelCallable constructModel)
- : m_ConstructModel(constructModel)
- {
- }
-
- virtual void AddCommandLineOptions(boost::program_options::options_description& options) override
- {
- namespace po = boost::program_options;
-
- options.add_options()
- ("data-dir,d", po::value<std::string>(&m_DataDir)->required(),
- "Path to directory containing test data");
-
- Model::AddCommandLineOptions(options, m_ModelCommandLineOptions);
- }
-
- virtual bool ProcessCommandLineOptions(const InferenceTestOptions &commonOptions) override
- {
- if (!ValidateDirectory(m_DataDir))
- {
- return false;
- }
-
- m_Model = m_ConstructModel(commonOptions, m_ModelCommandLineOptions);
- if (!m_Model)
- {
- return false;
- }
-
- m_Database = std::make_unique<YoloDatabase>(m_DataDir.c_str());
- if (!m_Database)
- {
- return false;
- }
-
- return true;
- }
-
- virtual std::unique_ptr<IInferenceTestCase> GetTestCase(unsigned int testCaseId) override
- {
- std::unique_ptr<YoloTestCaseData> testCaseData = m_Database->GetTestCaseData(testCaseId);
- if (!testCaseData)
- {
- return nullptr;
- }
-
- return std::make_unique<YoloTestCase<Model>>(*m_Model, testCaseId, *testCaseData);
- }
-
-private:
- typename Model::CommandLineOptions m_ModelCommandLineOptions;
- std::function<std::unique_ptr<Model>(const InferenceTestOptions&,
- typename Model::CommandLineOptions)> m_ConstructModel;
- std::unique_ptr<Model> m_Model;
-
- std::string m_DataDir;
- std::unique_ptr<YoloDatabase> m_Database;
-};
diff --git a/tests/profiling/gatordmock/CommandFileParser.cpp b/tests/profiling/gatordmock/CommandFileParser.cpp
deleted file mode 100644
index 7c746f16e9..0000000000
--- a/tests/profiling/gatordmock/CommandFileParser.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "CommandFileParser.hpp"
-
-#include <algorithm>
-#include <fstream>
-#include <iostream>
-#include <iterator>
-
-namespace armnn
-{
-
-namespace gatordmock
-{
-
-void CommandFileParser::ParseFile(std::string CommandFile, GatordMockService& mockService)
-{
- std::ifstream infile(CommandFile);
- std::string line;
-
- std::cout << "Parsing command file: " << CommandFile << std::endl;
-
- while (mockService.ReceiveThreadRunning() && std::getline(infile, line))
- {
- std::istringstream iss(line);
-
- std::vector<std::string> tokens;
-
- std::copy(std::istream_iterator<std::string>(iss), std::istream_iterator<std::string>(),
- std::back_inserter(tokens));
-
- std::string command = tokens[0];
-
- if (command == "LIST")
- {
- // Expected format for the SET command
- //
- // LIST
- //
-
- mockService.SendRequestCounterDir();
- }
- if (command == "SET")
- {
- // Expected format for the SET command
- //
- // SET 500000 1 2 5 10
- //
- // This breaks down to:
- // SET command
- // 500000 polling period in micro seconds
- // 1 2 5 10 counter list
-
- uint32_t period = static_cast<uint32_t>(std::stoul(tokens[1]));
-
- std::vector<uint16_t> counters;
-
- std::transform(tokens.begin() + 2, tokens.end(), std::back_inserter(counters),
- [](const std::string& str) { return static_cast<uint16_t>(std::stoul(str)); });
-
- mockService.SendPeriodicCounterSelectionList(period, counters);
- }
- else if (command == "WAIT")
- {
- // Expected format for the SET command
- //
- // WAIT 11000000
- //
- // This breaks down to:
- // WAIT command
- // 11000000 timeout period in micro seconds
-
- uint32_t timeout = static_cast<uint32_t>(std::stoul(tokens[1]));
-
- mockService.WaitCommand(timeout);
- }
- }
-}
-
-} // namespace gatordmock
-
-} // namespace armnn
diff --git a/tests/profiling/gatordmock/CommandFileParser.hpp b/tests/profiling/gatordmock/CommandFileParser.hpp
deleted file mode 100644
index fd4a4fdf38..0000000000
--- a/tests/profiling/gatordmock/CommandFileParser.hpp
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include "GatordMockService.hpp"
-#include <string>
-
-namespace armnn
-{
-
-namespace gatordmock
-{
-
-/// This class parses a command file for the GatordMockService. The file contains one command per line.
-/// Valid commands are: SET and WAIT.
-///
-/// SET: Will construct and send a PeriodicCounterSelection packet to enable a set of counters.
-/// WAIT: Will pause for a set period of time to allow for data to be received.
-class CommandFileParser
-{
-public:
- void ParseFile(std::string CommandFile, GatordMockService& mockService);
-};
-
-} // namespace gatordmock
-} // namespace armnn
diff --git a/tests/profiling/gatordmock/CommandLineProcessor.cpp b/tests/profiling/gatordmock/CommandLineProcessor.cpp
deleted file mode 100644
index 55b51137bc..0000000000
--- a/tests/profiling/gatordmock/CommandLineProcessor.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "CommandLineProcessor.hpp"
-
-#include <boost/program_options.hpp>
-#include <iostream>
-
-namespace armnn
-{
-namespace gatordmock
-{
-
-bool CommandLineProcessor::ProcessCommandLine(int argc, char *argv[])
-{
- namespace po = boost::program_options;
- po::options_description desc("Options");
- try
- {
- desc.add_options()
- ("help,h", "Display help messages")
- ("file,f", po::value<std::string>(&m_File),
- "The path to the file that contains instructions for the mock gatord")
- ("namespace,n", po::value<std::string>(&m_UdsNamespace)->default_value("gatord_namespace"),
- "The Unix domain socket namespace this server will bind to.\n"
- "This will always be prepended with \\0 to use the abstract namespace")
- ("echo,e", po::bool_switch(&m_Echo)->default_value(false),
- "Echo packets sent and received to stdout. Disabled by default.\n");
- }
- catch (const std::exception& e)
- {
- std::cerr << "Fatal internal error: [" << e.what() << "]" << std::endl;
- return false;
- }
-
- po::variables_map vm;
- try
- {
- po::store(po::parse_command_line(argc, argv, desc), vm);
-
- if (vm.count("help"))
- {
- std::cout << "Simulate a Gatord server to interact with ArmNN external profiling." << std::endl;
- std::cout << std::endl;
- std::cout << desc << std::endl;
- return false;
- }
- // Currently the file parameter is mandatory.
- if (!vm.count("file"))
- {
- std::cout << std::endl << "*** Expected --file or -f parameter." << std::endl;
- std::cout << std::endl;
- std::cout << desc << std::endl;
- return false;
- }
- po::notify(vm);
- }
- catch (const po::error& e)
- {
- std::cerr << e.what() << std::endl << std::endl;
- std::cerr << desc << std::endl;
- return false;
- }
-
- return true;
-}
-
-} // namespace gatordmock
-
-} // namespace armnn \ No newline at end of file
diff --git a/tests/profiling/gatordmock/CommandLineProcessor.hpp b/tests/profiling/gatordmock/CommandLineProcessor.hpp
deleted file mode 100644
index 532948a5cf..0000000000
--- a/tests/profiling/gatordmock/CommandLineProcessor.hpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#pragma once
-
-#include <string>
-
-namespace armnn
-{
-
-namespace gatordmock
-{
-
-/// Use Boost program options to process the command line.
-/// -h or --help to print the options.
-/// -n or --namespace to specify the UDS namespace that the server will be listening on.
-/// -e or --echo print all sent and received packets to stdout.
-/// -f or --file The path to the file that contains instructions for the mock gatord.
-class CommandLineProcessor
-{
-public:
- bool ProcessCommandLine(int argc, char* argv[]);
- bool IsEchoEnabled()
- {
- return m_Echo;
- }
-
- std::string GetUdsNamespace()
- {
- return m_UdsNamespace;
- }
- std::string GetCommandFile()
- {
- return m_File;
- }
-
-private:
- std::string m_UdsNamespace;
- std::string m_File;
-
- bool m_Echo;
-};
-
-} // namespace gatordmock
-
-} // namespace armnn
diff --git a/tests/profiling/gatordmock/CounterDirectory.hpp b/tests/profiling/gatordmock/CounterDirectory.hpp
deleted file mode 100644
index 7b45e661e0..0000000000
--- a/tests/profiling/gatordmock/CounterDirectory.hpp
+++ /dev/null
@@ -1,263 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-
-#include "GatordMockService.hpp"
-#include "MockUtils.hpp"
-
-#include "Packet.hpp"
-#include "CommandHandlerFunctor.hpp"
-#include "SendCounterPacket.hpp"
-#include "IPeriodicCounterCapture.hpp"
-
-#include <vector>
-#include <thread>
-#include <atomic>
-#include <iostream>
-#include <functional>
-
-namespace armnn
-{
-
-namespace gatordmock
-{
-
-struct EventRecord
-{
- uint16_t m_CounterUid;
- uint16_t m_MaxCounterUid;
- uint16_t m_DeviceUid;
- uint16_t m_CounterSetUid;
- uint16_t m_CounterClass;
- uint16_t m_CounterInterpolation;
- double m_CounterMultiplier;
- std::string m_CounterName;
- std::string m_CounterDescription;
- std::string m_CounterUnits;
-
- static void printHeader(std::string categoryName)
- {
- std::string header;
-
- header.append(gatordmock::CentreAlignFormatting("Counter Name", 20));
- header.append(" | ");
- header.append(gatordmock::CentreAlignFormatting("Description", 50));
- header.append(" | ");
- header.append(gatordmock::CentreAlignFormatting("Units", 14));
- header.append(" | ");
- header.append(gatordmock::CentreAlignFormatting("UID", 6));
- header.append(" | ");
- header.append(gatordmock::CentreAlignFormatting("Max UID",10));
- header.append(" | ");
- header.append(gatordmock::CentreAlignFormatting("Class", 8));
- header.append(" | ");
- header.append(gatordmock::CentreAlignFormatting("Interpolation", 14));
- header.append(" | ");
- header.append(gatordmock::CentreAlignFormatting("Multiplier", 20));
- header.append(" | ");
- header.append(gatordmock::CentreAlignFormatting("Counter set UID", 16));
- header.append(" | ");
- header.append(gatordmock::CentreAlignFormatting("Device UID", 14));
- header.append("\n");
-
- std::cout << "\n" << "\n";
- std::cout << gatordmock::CentreAlignFormatting("EVENTS IN CATEGORY: " + categoryName,
- static_cast<int>(header.size()));
- std::cout << "\n";
- std::cout << std::string(header.size(), '=') << "\n";
- std::cout << header;
- }
-
- void printContents() const
- {
- std::string body;
-
- body.append(gatordmock::CentreAlignFormatting(m_CounterName, 20));
- body.append(" | ");
- body.append(gatordmock::CentreAlignFormatting(m_CounterDescription, 50));
- body.append(" | ");
- body.append(gatordmock::CentreAlignFormatting(m_CounterUnits, 14));
- body.append(" | ");
- body.append(gatordmock::CentreAlignFormatting(std::to_string(m_CounterUid), 6));
- body.append(" | ");
- body.append(gatordmock::CentreAlignFormatting(std::to_string(m_MaxCounterUid), 10));
- body.append(" | ");
- body.append(gatordmock::CentreAlignFormatting(std::to_string(m_CounterClass), 8));
- body.append(" | ");
- body.append(gatordmock::CentreAlignFormatting(std::to_string(m_CounterInterpolation), 14));
- body.append(" | ");
- body.append(gatordmock::CentreAlignFormatting(std::to_string(m_CounterMultiplier), 20));
- body.append(" | ");
- body.append(gatordmock::CentreAlignFormatting(std::to_string(m_CounterSetUid), 16));
- body.append(" | ");
- body.append(gatordmock::CentreAlignFormatting(std::to_string(m_DeviceUid), 14));
-
- body.append("\n");
-
- std::cout << std::string(body.size(), '-') << "\n";
-
- std::cout << body;
- }
-};
-
-struct CategoryRecord
-{
- uint16_t m_DeviceUid;
- uint16_t m_CounterSet;
- uint16_t m_EventCount;
- std::string m_CategoryName;
- std::vector<EventRecord> m_EventRecords;
-
- void print() const
- {
- std::string body;
- std::string header;
-
- header.append(gatordmock::CentreAlignFormatting("Name", 20));
- header.append(" | ");
- header.append(gatordmock::CentreAlignFormatting("Device", 12));
- header.append(" | ");
- header.append(gatordmock::CentreAlignFormatting("Counter set UID:", 16));
- header.append(" | ");
- header.append(gatordmock::CentreAlignFormatting("Event Count", 14));
- header.append("\n");
-
- body.append(gatordmock::CentreAlignFormatting(m_CategoryName, 20));
- body.append(" | ");
- body.append(gatordmock::CentreAlignFormatting(std::to_string(m_DeviceUid), 12));
- body.append(" | ");
- body.append(gatordmock::CentreAlignFormatting(std::to_string(m_CounterSet), 16));
- body.append(" | ");
- body.append(gatordmock::CentreAlignFormatting(std::to_string(m_EventCount), 14));
-
- std::cout << "\n" << "\n";
- std::cout << gatordmock::CentreAlignFormatting("CATEGORY", static_cast<int>(header.size()));
- std::cout << "\n";
- std::cout << std::string(header.size(), '=') << "\n";
-
- std::cout<< header;
-
- std::cout << std::string(body.size(), '-') << "\n";
-
- std::cout<< body;
-
- if(m_EventRecords.size() > 0)
- {
- EventRecord::printHeader(m_CategoryName);
-
- std::for_each(m_EventRecords.begin(), m_EventRecords.end(), std::mem_fun_ref(&EventRecord::printContents));
- }
- }
-};
-
-struct CounterSetRecord
-{
- uint16_t m_CounterSetUid;
- uint16_t m_CounterSetCount;
- std::string m_CounterSetName;
-
- static void printHeader()
- {
- std::string header;
-
- header.append(gatordmock::CentreAlignFormatting("Counter set name", 20));
- header.append(" | ");
- header.append(gatordmock::CentreAlignFormatting("UID",13));
- header.append(" | ");
- header.append(gatordmock::CentreAlignFormatting("Count",10));
- header.append("\n");
-
- std::cout << "\n" << "\n";
- std::cout << gatordmock::CentreAlignFormatting("COUNTER SETS", static_cast<int>(header.size()));
- std::cout << "\n";
- std::cout << std::string(header.size(), '=') << "\n";
-
- std::cout<< header;
- }
-
- void printContents() const
- {
- std::string body;
-
- body.append(gatordmock::CentreAlignFormatting(m_CounterSetName, 20));
- body.append(" | ");
- body.append(gatordmock::CentreAlignFormatting(std::to_string(m_CounterSetUid), 13));
- body.append(" | ");
- body.append(gatordmock::CentreAlignFormatting(std::to_string(m_CounterSetCount), 10));
- body.append("\n");
-
- std::cout << std::string(body.size(), '-') << "\n";
-
- std::cout<< body;
- }
-};
-
-struct DeviceRecord
-{
- uint16_t m_DeviceUid;
- uint16_t m_DeviceCores;
- std::string m_DeviceName;
-
- static void printHeader()
- {
- std::string header;
-
- header.append(gatordmock::CentreAlignFormatting("Device name", 20));
- header.append(" | ");
- header.append(gatordmock::CentreAlignFormatting("UID",13));
- header.append(" | ");
- header.append(gatordmock::CentreAlignFormatting("Cores",10));
- header.append("\n");
-
- std::cout << "\n" << "\n";
- std::cout << gatordmock::CentreAlignFormatting("DEVICES", static_cast<int>(header.size()));
- std::cout << "\n";
- std::cout << std::string(header.size(), '=') << "\n";
- std::cout<< header;
- }
-
- void printContents() const
- {
- std::string body;
-
- body.append(gatordmock::CentreAlignFormatting(m_DeviceName, 20));
- body.append(" | ");
- body.append(gatordmock::CentreAlignFormatting(std::to_string(m_DeviceUid), 13));
- body.append(" | ");
- body.append(gatordmock::CentreAlignFormatting(std::to_string(m_DeviceCores), 10));
- body.append("\n");
-
- std::cout << std::string(body.size(), '-') << "\n";
- std::cout<< body;
- }
-};
-
-struct CounterDirectory
-{
- std::vector<CategoryRecord> m_Categories;
- std::vector<CounterSetRecord> m_CounterSets;
- std::vector<DeviceRecord> m_DeviceRecords;
-
- void print() const
- {
- DeviceRecord::printHeader();
- std::for_each(m_DeviceRecords.begin(), m_DeviceRecords.end(),
- std::mem_fun_ref(&DeviceRecord::printContents));
-
- CounterSetRecord::printHeader();
- std::for_each(m_CounterSets.begin(), m_CounterSets.end(),
- std::mem_fun_ref(&CounterSetRecord::printContents));
-
- std::for_each(m_Categories.begin(), m_Categories.end(),
- std::mem_fun_ref(&CategoryRecord::print));
- std::cout << "\n";
- }
-};
-
-} // namespace gatordmock
-
-} // namespace armnn \ No newline at end of file
diff --git a/tests/profiling/gatordmock/GatordMockMain.cpp b/tests/profiling/gatordmock/GatordMockMain.cpp
deleted file mode 100644
index edad85cffe..0000000000
--- a/tests/profiling/gatordmock/GatordMockMain.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "../../../src/profiling/PacketVersionResolver.hpp"
-#include "../../../src/profiling/PeriodicCounterSelectionCommandHandler.hpp"
-#include "CommandFileParser.hpp"
-#include "CommandLineProcessor.hpp"
-#include "DirectoryCaptureCommandHandler.hpp"
-#include "GatordMockService.hpp"
-#include "PeriodicCounterCaptureCommandHandler.hpp"
-#include "PeriodicCounterSelectionResponseHandler.hpp"
-
-#include <iostream>
-#include <string>
-
-int main(int argc, char* argv[])
-{
- // Process command line arguments
- armnn::gatordmock::CommandLineProcessor cmdLine;
- if (!cmdLine.ProcessCommandLine(argc, argv))
- {
- return EXIT_FAILURE;
- }
-
- armnn::profiling::PacketVersionResolver packetVersionResolver;
- // Create the Command Handler Registry
- armnn::profiling::CommandHandlerRegistry registry;
-
- // This functor will receive back the selection response packet.
- armnn::gatordmock::PeriodicCounterSelectionResponseHandler periodicCounterSelectionResponseHandler(
- 0, 4, packetVersionResolver.ResolvePacketVersion(0, 4).GetEncodedValue());
- // This functor will receive the counter data.
- armnn::gatordmock::PeriodicCounterCaptureCommandHandler counterCaptureCommandHandler(
- 3, 0, packetVersionResolver.ResolvePacketVersion(3, 0).GetEncodedValue());
-
- armnn::profiling::DirectoryCaptureCommandHandler directoryCaptureCommandHandler(
- 0, 2, packetVersionResolver.ResolvePacketVersion(0, 2).GetEncodedValue(), false);
-
- // Register different derived functors
- registry.RegisterFunctor(&periodicCounterSelectionResponseHandler);
- registry.RegisterFunctor(&counterCaptureCommandHandler);
- registry.RegisterFunctor(&directoryCaptureCommandHandler);
-
- armnn::gatordmock::GatordMockService mockService(registry, cmdLine.IsEchoEnabled());
-
- if (!mockService.OpenListeningSocket(cmdLine.GetUdsNamespace()))
- {
- return EXIT_FAILURE;
- }
- std::cout << "Bound to UDS namespace: \\0" << cmdLine.GetUdsNamespace() << std::endl;
-
- // Wait for a single connection.
- if (-1 == mockService.BlockForOneClient())
- {
- return EXIT_FAILURE;
- }
- std::cout << "Client connection established." << std::endl;
-
- // Send receive the strweam metadata and send connection ack.
- if (!mockService.WaitForStreamMetaData())
- {
- return EXIT_FAILURE;
- }
- mockService.SendConnectionAck();
-
- // Prepare to receive data.
- mockService.LaunchReceivingThread();
-
- // Process the SET and WAIT command from the file.
- armnn::gatordmock::CommandFileParser commandLineParser;
- commandLineParser.ParseFile(cmdLine.GetCommandFile(), mockService);
-
- // Once we've finished processing the file wait for the receiving thread to close.
- mockService.WaitForReceivingThread();
-
- return EXIT_SUCCESS;
-}
diff --git a/tests/profiling/gatordmock/GatordMockService.cpp b/tests/profiling/gatordmock/GatordMockService.cpp
deleted file mode 100644
index c5211962d3..0000000000
--- a/tests/profiling/gatordmock/GatordMockService.cpp
+++ /dev/null
@@ -1,485 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "GatordMockService.hpp"
-
-#include <CommandHandlerRegistry.hpp>
-#include <PacketVersionResolver.hpp>
-#include <ProfilingUtils.hpp>
-#include <NetworkSockets.hpp>
-
-#include <cerrno>
-#include <fcntl.h>
-#include <iomanip>
-#include <iostream>
-#include <string>
-
-using namespace armnnUtils;
-
-namespace armnn
-{
-
-namespace gatordmock
-{
-
-bool GatordMockService::OpenListeningSocket(std::string udsNamespace)
-{
- Sockets::Initialize();
- m_ListeningSocket = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
- if (-1 == m_ListeningSocket)
- {
- std::cerr << ": Socket construction failed: " << strerror(errno) << std::endl;
- return false;
- }
-
- sockaddr_un udsAddress;
- memset(&udsAddress, 0, sizeof(sockaddr_un));
- // We've set the first element of sun_path to be 0, skip over it and copy the namespace after it.
- memcpy(udsAddress.sun_path + 1, udsNamespace.c_str(), strlen(udsNamespace.c_str()));
- udsAddress.sun_family = AF_UNIX;
-
- // Bind the socket to the UDS namespace.
- if (-1 == bind(m_ListeningSocket, reinterpret_cast<const sockaddr*>(&udsAddress), sizeof(sockaddr_un)))
- {
- std::cerr << ": Binding on socket failed: " << strerror(errno) << std::endl;
- return false;
- }
- // Listen for 1 connection.
- if (-1 == listen(m_ListeningSocket, 1))
- {
- std::cerr << ": Listen call on socket failed: " << strerror(errno) << std::endl;
- return false;
- }
- return true;
-}
-
-Sockets::Socket GatordMockService::BlockForOneClient()
-{
- m_ClientConnection = Sockets::Accept(m_ListeningSocket, nullptr, nullptr, SOCK_CLOEXEC);
- if (-1 == m_ClientConnection)
- {
- std::cerr << ": Failure when waiting for a client connection: " << strerror(errno) << std::endl;
- return -1;
- }
- return m_ClientConnection;
-}
-
-bool GatordMockService::WaitForStreamMetaData()
-{
- if (m_EchoPackets)
- {
- std::cout << "Waiting for stream meta data..." << std::endl;
- }
- // The start of the stream metadata is 2x32bit words, 0 and packet length.
- uint8_t header[8];
- if (!ReadFromSocket(header, 8))
- {
- return false;
- }
- EchoPacket(PacketDirection::ReceivedHeader, header, 8);
- // The first word, stream_metadata_identifer, should always be 0.
- if (ToUint32(&header[0], TargetEndianness::BeWire) != 0)
- {
- std::cerr << ": Protocol error. The stream_metadata_identifer was not 0." << std::endl;
- return false;
- }
-
- uint8_t pipeMagic[4];
- if (!ReadFromSocket(pipeMagic, 4))
- {
- return false;
- }
- EchoPacket(PacketDirection::ReceivedData, pipeMagic, 4);
-
- // Before we interpret the length we need to read the pipe_magic word to determine endianness.
- if (ToUint32(&pipeMagic[0], TargetEndianness::BeWire) == PIPE_MAGIC)
- {
- m_Endianness = TargetEndianness::BeWire;
- }
- else if (ToUint32(&pipeMagic[0], TargetEndianness::LeWire) == PIPE_MAGIC)
- {
- m_Endianness = TargetEndianness::LeWire;
- }
- else
- {
- std::cerr << ": Protocol read error. Unable to read PIPE_MAGIC value." << std::endl;
- return false;
- }
- // Now we know the endianness we can get the length from the header.
- // Remember we already read the pipe magic 4 bytes.
- uint32_t metaDataLength = ToUint32(&header[4], m_Endianness) - 4;
- // Read the entire packet.
- std::vector<uint8_t> packetData(metaDataLength);
- if (metaDataLength !=
- boost::numeric_cast<uint32_t>(Sockets::Read(m_ClientConnection, packetData.data(), metaDataLength)))
- {
- std::cerr << ": Protocol read error. Data length mismatch." << std::endl;
- return false;
- }
- EchoPacket(PacketDirection::ReceivedData, packetData.data(), metaDataLength);
- m_StreamMetaDataVersion = ToUint32(&packetData[0], m_Endianness);
- m_StreamMetaDataMaxDataLen = ToUint32(&packetData[4], m_Endianness);
- m_StreamMetaDataPid = ToUint32(&packetData[8], m_Endianness);
-
- return true;
-}
-
-void GatordMockService::SendConnectionAck()
-{
- if (m_EchoPackets)
- {
- std::cout << "Sending connection acknowledgement." << std::endl;
- }
- // The connection ack packet is an empty data packet with packetId == 1.
- SendPacket(0, 1, nullptr, 0);
-}
-
-void GatordMockService::SendRequestCounterDir()
-{
- if (m_EchoPackets)
- {
- std::cout << "Sending connection acknowledgement." << std::endl;
- }
- // The connection ack packet is an empty data packet with packetId == 1.
- SendPacket(0, 3, nullptr, 0);
-}
-
-bool GatordMockService::LaunchReceivingThread()
-{
- if (m_EchoPackets)
- {
- std::cout << "Launching receiving thread." << std::endl;
- }
- // At this point we want to make the socket non blocking.
- if (!Sockets::SetNonBlocking(m_ClientConnection))
- {
- Sockets::Close(m_ClientConnection);
- std::cerr << "Failed to set socket as non blocking: " << strerror(errno) << std::endl;
- return false;
- }
- m_ListeningThread = std::thread(&GatordMockService::ReceiveLoop, this, std::ref(*this));
- return true;
-}
-
-void GatordMockService::WaitForReceivingThread()
-{
- // The receiving thread may already have died.
- if (m_CloseReceivingThread != true)
- {
- m_CloseReceivingThread.store(true);
- }
- // Check that the receiving thread is running
- if (m_ListeningThread.joinable())
- {
- // Wait for the receiving thread to complete operations
- m_ListeningThread.join();
- }
-}
-
-void GatordMockService::SendPeriodicCounterSelectionList(uint32_t period, std::vector<uint16_t> counters)
-{
- // The packet body consists of a UINT32 representing the period following by zero or more
- // UINT16's representing counter UID's. If the list is empty it implies all counters are to
- // be disabled.
-
- if (m_EchoPackets)
- {
- std::cout << "SendPeriodicCounterSelectionList: Period=" << std::dec << period << "uSec" << std::endl;
- std::cout << "List length=" << counters.size() << std::endl;
- ;
- }
- // Start by calculating the length of the packet body in bytes. This will be at least 4.
- uint32_t dataLength = static_cast<uint32_t>(4 + (counters.size() * 2));
-
- std::unique_ptr<unsigned char[]> uniqueData = std::make_unique<unsigned char[]>(dataLength);
- unsigned char* data = reinterpret_cast<unsigned char*>(uniqueData.get());
-
- uint32_t offset = 0;
- profiling::WriteUint32(data, offset, period);
- offset += 4;
- for (std::vector<uint16_t>::iterator it = counters.begin(); it != counters.end(); ++it)
- {
- profiling::WriteUint16(data, offset, *it);
- offset += 2;
- }
-
- // Send the packet.
- SendPacket(0, 4, data, dataLength);
- // There will be an echo response packet sitting in the receive thread. PeriodicCounterSelectionResponseHandler
- // should deal with it.
-}
-
-void GatordMockService::WaitCommand(uint32_t timeout)
-{
- // Wait for a maximum of timeout microseconds or if the receive thread has closed.
- // There is a certain level of rounding involved in this timing.
- uint32_t iterations = timeout / 1000;
- std::cout << std::dec << "Wait command with timeout of " << timeout << " iterations = " << iterations << std::endl;
- uint32_t count = 0;
- while ((this->ReceiveThreadRunning() && (count < iterations)))
- {
- std::this_thread::sleep_for(std::chrono::microseconds(1000));
- ++count;
- }
- if (m_EchoPackets)
- {
- std::cout << std::dec << "Wait command with timeout of " << timeout << " microseconds completed. " << std::endl;
- }
-}
-
-void GatordMockService::ReceiveLoop(GatordMockService& mockService)
-{
- m_CloseReceivingThread.store(false);
- while (!m_CloseReceivingThread.load())
- {
- try
- {
- armnn::profiling::Packet packet = mockService.WaitForPacket(500);
- }
- catch (const armnn::TimeoutException&)
- {
- // In this case we ignore timeouts and and keep trying to receive.
- }
- catch (const armnn::InvalidArgumentException& e)
- {
- // We couldn't find a functor to handle the packet?
- std::cerr << "Packet received that could not be processed: " << e.what() << std::endl;
- }
- catch (const armnn::RuntimeException& e)
- {
- // A runtime exception occurred which means we must exit the loop.
- std::cerr << "Receive thread closing: " << e.what() << std::endl;
- m_CloseReceivingThread.store(true);
- }
- }
-}
-
-armnn::profiling::Packet GatordMockService::WaitForPacket(uint32_t timeoutMs)
-{
- // Is there currently more than a headers worth of data waiting to be read?
- int bytes_available;
- Sockets::Ioctl(m_ClientConnection, FIONREAD, &bytes_available);
- if (bytes_available > 8)
- {
- // Yes there is. Read it:
- return ReceivePacket();
- }
- else
- {
- // No there's not. Poll for more data.
- struct pollfd pollingFd[1]{};
- pollingFd[0].fd = m_ClientConnection;
- int pollResult = Sockets::Poll(pollingFd, 1, static_cast<int>(timeoutMs));
-
- switch (pollResult)
- {
- // Error
- case -1:
- throw armnn::RuntimeException(std::string("File descriptor reported an error during polling: ") +
- strerror(errno));
-
- // Timeout
- case 0:
- throw armnn::TimeoutException("Timeout while waiting to receive packet.");
-
- // Normal poll return. It could still contain an error signal
- default:
- // Check if the socket reported an error
- if (pollingFd[0].revents & (POLLNVAL | POLLERR | POLLHUP))
- {
- if (pollingFd[0].revents == POLLNVAL)
- {
- throw armnn::RuntimeException(std::string("Error while polling receiving socket: POLLNVAL"));
- }
- if (pollingFd[0].revents == POLLERR)
- {
- throw armnn::RuntimeException(std::string("Error while polling receiving socket: POLLERR: ") +
- strerror(errno));
- }
- if (pollingFd[0].revents == POLLHUP)
- {
- throw armnn::RuntimeException(std::string("Connection closed by remote client: POLLHUP"));
- }
- }
-
- // Check if there is data to read
- if (!(pollingFd[0].revents & (POLLIN)))
- {
- // This is a corner case. The socket as been woken up but not with any data.
- // We'll throw a timeout exception to loop around again.
- throw armnn::TimeoutException("File descriptor was polled but no data was available to receive.");
- }
- return ReceivePacket();
- }
- }
-}
-
-armnn::profiling::Packet GatordMockService::ReceivePacket()
-{
- uint32_t header[2];
- if (!ReadHeader(header))
- {
- return armnn::profiling::Packet();
- }
- // Read data_length bytes from the socket.
- std::unique_ptr<unsigned char[]> uniquePacketData = std::make_unique<unsigned char[]>(header[1]);
- unsigned char* packetData = reinterpret_cast<unsigned char*>(uniquePacketData.get());
-
- if (!ReadFromSocket(packetData, header[1]))
- {
- return armnn::profiling::Packet();
- }
-
- EchoPacket(PacketDirection::ReceivedData, packetData, header[1]);
-
- // Construct received packet
- armnn::profiling::PacketVersionResolver packetVersionResolver;
- armnn::profiling::Packet packetRx = armnn::profiling::Packet(header[0], header[1], uniquePacketData);
- if (m_EchoPackets)
- {
- std::cout << "Processing packet ID= " << packetRx.GetPacketId() << " Length=" << packetRx.GetLength()
- << std::endl;
- }
-
- profiling::Version version =
- packetVersionResolver.ResolvePacketVersion(packetRx.GetPacketFamily(), packetRx.GetPacketId());
-
- profiling::CommandHandlerFunctor* commandHandlerFunctor =
- m_HandlerRegistry.GetFunctor(packetRx.GetPacketFamily(), packetRx.GetPacketId(), version.GetEncodedValue());
- BOOST_ASSERT(commandHandlerFunctor);
- commandHandlerFunctor->operator()(packetRx);
- return packetRx;
-}
-
-bool GatordMockService::SendPacket(uint32_t packetFamily, uint32_t packetId, const uint8_t* data, uint32_t dataLength)
-{
- // Construct a packet from the id and data given and send it to the client.
- // Encode the header.
- uint32_t header[2];
- header[0] = packetFamily << 26 | packetId << 16;
- header[1] = dataLength;
- // Add the header to the packet.
- std::vector<uint8_t> packet(8 + dataLength);
- InsertU32(header[0], packet.data(), m_Endianness);
- InsertU32(header[1], packet.data() + 4, m_Endianness);
- // And the rest of the data if there is any.
- if (dataLength > 0)
- {
- memcpy((packet.data() + 8), data, dataLength);
- }
- EchoPacket(PacketDirection::Sending, packet.data(), packet.size());
- if (-1 == Sockets::Write(m_ClientConnection, packet.data(), packet.size()))
- {
- std::cerr << ": Failure when writing to client socket: " << strerror(errno) << std::endl;
- return false;
- }
- return true;
-}
-
-bool GatordMockService::ReadHeader(uint32_t headerAsWords[2])
-{
- // The header will always be 2x32bit words.
- uint8_t header[8];
- if (!ReadFromSocket(header, 8))
- {
- return false;
- }
- EchoPacket(PacketDirection::ReceivedHeader, header, 8);
- headerAsWords[0] = ToUint32(&header[0], m_Endianness);
- headerAsWords[1] = ToUint32(&header[4], m_Endianness);
- return true;
-}
-
-bool GatordMockService::ReadFromSocket(uint8_t* packetData, uint32_t expectedLength)
-{
- // This is a blocking read until either expectedLength has been received or an error is detected.
- long totalBytesRead = 0;
- while (boost::numeric_cast<uint32_t>(totalBytesRead) < expectedLength)
- {
- long bytesRead = Sockets::Read(m_ClientConnection, packetData, expectedLength);
- if (bytesRead < 0)
- {
- std::cerr << ": Failure when reading from client socket: " << strerror(errno) << std::endl;
- return false;
- }
- if (bytesRead == 0)
- {
- std::cerr << ": EOF while reading from client socket." << std::endl;
- return false;
- }
- totalBytesRead += bytesRead;
- }
- return true;
-};
-
-void GatordMockService::EchoPacket(PacketDirection direction, uint8_t* packet, size_t lengthInBytes)
-{
- // If enabled print the contents of the data packet to the console.
- if (m_EchoPackets)
- {
- if (direction == PacketDirection::Sending)
- {
- std::cout << "TX " << std::dec << lengthInBytes << " bytes : ";
- }
- else if (direction == PacketDirection::ReceivedHeader)
- {
- std::cout << "RX Header " << std::dec << lengthInBytes << " bytes : ";
- }
- else
- {
- std::cout << "RX Data " << std::dec << lengthInBytes << " bytes : ";
- }
- for (unsigned int i = 0; i < lengthInBytes; i++)
- {
- if ((i % 10) == 0)
- {
- std::cout << std::endl;
- }
- std::cout << "0x" << std::setfill('0') << std::setw(2) << std::hex << static_cast<unsigned int>(packet[i])
- << " ";
- }
- std::cout << std::endl;
- }
-}
-
-uint32_t GatordMockService::ToUint32(uint8_t* data, TargetEndianness endianness)
-{
- // Extract the first 4 bytes starting at data and push them into a 32bit integer based on the
- // specified endianness.
- if (endianness == TargetEndianness::BeWire)
- {
- return static_cast<uint32_t>(data[0]) << 24 | static_cast<uint32_t>(data[1]) << 16 |
- static_cast<uint32_t>(data[2]) << 8 | static_cast<uint32_t>(data[3]);
- }
- else
- {
- return static_cast<uint32_t>(data[3]) << 24 | static_cast<uint32_t>(data[2]) << 16 |
- static_cast<uint32_t>(data[1]) << 8 | static_cast<uint32_t>(data[0]);
- }
-}
-
-void GatordMockService::InsertU32(uint32_t value, uint8_t* data, TargetEndianness endianness)
-{
- // Take the bytes of a 32bit integer and copy them into char array starting at data considering
- // the endianness value.
- if (endianness == TargetEndianness::BeWire)
- {
- *data = static_cast<uint8_t>((value >> 24) & 0xFF);
- *(data + 1) = static_cast<uint8_t>((value >> 16) & 0xFF);
- *(data + 2) = static_cast<uint8_t>((value >> 8) & 0xFF);
- *(data + 3) = static_cast<uint8_t>(value & 0xFF);
- }
- else
- {
- *(data + 3) = static_cast<uint8_t>((value >> 24) & 0xFF);
- *(data + 2) = static_cast<uint8_t>((value >> 16) & 0xFF);
- *(data + 1) = static_cast<uint8_t>((value >> 8) & 0xFF);
- *data = static_cast<uint8_t>(value & 0xFF);
- }
-}
-
-} // namespace gatordmock
-
-} // namespace armnn
diff --git a/tests/profiling/gatordmock/GatordMockService.hpp b/tests/profiling/gatordmock/GatordMockService.hpp
deleted file mode 100644
index f91e902db8..0000000000
--- a/tests/profiling/gatordmock/GatordMockService.hpp
+++ /dev/null
@@ -1,158 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include <CommandHandlerRegistry.hpp>
-#include <Packet.hpp>
-#include <NetworkSockets.hpp>
-
-#include <atomic>
-#include <string>
-#include <thread>
-
-namespace armnn
-{
-
-namespace gatordmock
-{
-
-enum class TargetEndianness
-{
- BeWire,
- LeWire
-};
-
-enum class PacketDirection
-{
- Sending,
- ReceivedHeader,
- ReceivedData
-};
-
-/// A class that implements a Mock Gatord server. It will listen on a specified Unix domain socket (UDS)
-/// namespace for client connections. It will then allow opertaions to manage coutners while receiving counter data.
-class GatordMockService
-{
-public:
- /// @param registry reference to a command handler registry.
- /// @param echoPackets if true the raw packets will be printed to stdout.
- GatordMockService(armnn::profiling::CommandHandlerRegistry& registry, bool echoPackets)
- : m_HandlerRegistry(registry)
- , m_EchoPackets(echoPackets)
- , m_CloseReceivingThread(false)
- {
- m_PacketsReceivedCount.store(0, std::memory_order_relaxed);
- }
-
- ~GatordMockService()
- {
- // We have set SOCK_CLOEXEC on these sockets but we'll close them to be good citizens.
- armnnUtils::Sockets::Close(m_ClientConnection);
- armnnUtils::Sockets::Close(m_ListeningSocket);
- }
-
- /// Establish the Unix domain socket and set it to listen for connections.
- /// @param udsNamespace the namespace (socket address) associated with the listener.
- /// @return true only if the socket has been correctly setup.
- bool OpenListeningSocket(std::string udsNamespace);
-
- /// Block waiting to accept one client to connect to the UDS.
- /// @return the file descriptor of the client connection.
- armnnUtils::Sockets::Socket BlockForOneClient();
-
- /// Once the connection is open wait to receive the stream meta data packet from the client. Reading this
- /// packet differs from others as we need to determine endianness.
- /// @return true only if a valid stream met data packet has been received.
- bool WaitForStreamMetaData();
-
- /// Send a connection acknowledged packet back to the client.
- void SendConnectionAck();
-
- /// Send a request counter directory packet back to the client.
- void SendRequestCounterDir();
-
- /// Start the thread that will receive all packets and print them nicely to stdout.
- bool LaunchReceivingThread();
-
- /// Return the total number of periodic counter capture packets received since the receive thread started.
- /// @return number of periodic counter capture packets received.
- uint32_t GetPacketsReceivedCount()
- {
- return m_PacketsReceivedCount.load(std::memory_order_acquire);
- }
-
- /// This is a placeholder method to prevent main exiting. It can be removed once the
- /// command handling code is added.
- void WaitForReceivingThread();
-
- // @return true only if the receive thread is closed or closing.
- bool ReceiveThreadRunning()
- {
- return !m_CloseReceivingThread.load();
- }
-
- /// Send the counter list to ArmNN.
- void SendPeriodicCounterSelectionList(uint32_t period, std::vector<uint16_t> counters);
-
- /// Execute the WAIT command from the comamnd file.
- void WaitCommand(uint32_t timeout);
-
- uint32_t GetStreamMetadataVersion()
- {
- return m_StreamMetaDataVersion;
- }
-
- uint32_t GetStreamMetadataMaxDataLen()
- {
- return m_StreamMetaDataMaxDataLen;
- }
-
- uint32_t GetStreamMetadataPid()
- {
- return m_StreamMetaDataPid;
- }
-
-private:
- void ReceiveLoop(GatordMockService& mockService);
-
- /// Block on the client connection until a complete packet has been received. This is a placeholder function to
- /// enable early testing of the tool.
- /// @return true if a valid packet has been received.
- armnn::profiling::Packet WaitForPacket(uint32_t timeoutMs);
-
- armnn::profiling::Packet ReceivePacket();
-
- bool SendPacket(uint32_t packetFamily, uint32_t packetId, const uint8_t* data, uint32_t dataLength);
-
- void EchoPacket(PacketDirection direction, uint8_t* packet, size_t lengthInBytes);
-
- bool ReadHeader(uint32_t headerAsWords[2]);
-
- bool ReadFromSocket(uint8_t* packetData, uint32_t expectedLength);
-
- uint32_t ToUint32(uint8_t* data, TargetEndianness endianness);
-
- void InsertU32(uint32_t value, uint8_t* data, TargetEndianness endianness);
-
- static const uint32_t PIPE_MAGIC = 0x45495434;
-
- std::atomic<uint32_t> m_PacketsReceivedCount;
- TargetEndianness m_Endianness;
- uint32_t m_StreamMetaDataVersion;
- uint32_t m_StreamMetaDataMaxDataLen;
- uint32_t m_StreamMetaDataPid;
-
- armnn::profiling::CommandHandlerRegistry& m_HandlerRegistry;
-
- bool m_EchoPackets;
- armnnUtils::Sockets::Socket m_ListeningSocket;
- armnnUtils::Sockets::Socket m_ClientConnection;
- std::thread m_ListeningThread;
- std::atomic<bool> m_CloseReceivingThread;
-};
-} // namespace gatordmock
-
-} // namespace armnn
diff --git a/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.cpp b/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.cpp
deleted file mode 100644
index 9dd7064c90..0000000000
--- a/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "PeriodicCounterCaptureCommandHandler.hpp"
-
-#include <ProfilingUtils.hpp>
-
-#include <boost/numeric/conversion/cast.hpp>
-
-#include <iostream>
-
-namespace armnn
-{
-
-namespace gatordmock
-{
-
-using boost::numeric_cast;
-
-void PeriodicCounterCaptureCommandHandler::ParseData(const armnn::profiling::Packet& packet)
-{
- std::vector<uint16_t> counterIds;
- std::vector<uint32_t> counterValues;
-
- uint32_t sizeOfUint64 = numeric_cast<uint32_t>(sizeof(uint64_t));
- uint32_t sizeOfUint32 = numeric_cast<uint32_t>(sizeof(uint32_t));
- uint32_t sizeOfUint16 = numeric_cast<uint32_t>(sizeof(uint16_t));
-
- uint32_t offset = 0;
-
- if (packet.GetLength() >= 8)
- {
- offset = 0;
-
- uint64_t timestamp = profiling::ReadUint64(reinterpret_cast<const unsigned char*>(packet.GetData()), offset);
-
- if (m_FirstTimestamp == 0) // detect the first timestamp we receive.
- {
- m_FirstTimestamp = timestamp;
- }
- else
- {
- m_SecondTimestamp = timestamp;
- m_CurrentPeriodValue = m_SecondTimestamp - m_FirstTimestamp;
- m_FirstTimestamp = m_SecondTimestamp;
- }
-
- // Length minus timestamp and header divided by the length of an indexPair
- unsigned int counters = (packet.GetLength() - 8) / 6;
-
- if (counters > 0)
- {
- counterIds.reserve(counters);
- counterValues.reserve(counters);
- // Move offset over timestamp area
- offset += sizeOfUint64;
- for (unsigned int pos = 0; pos < counters; ++pos)
- {
- counterIds.emplace_back(
- profiling::ReadUint16(reinterpret_cast<const unsigned char*>(packet.GetData()), offset));
- offset += sizeOfUint16;
-
- counterValues.emplace_back(
- profiling::ReadUint32(reinterpret_cast<const unsigned char*>(packet.GetData()), offset));
- offset += sizeOfUint32;
- }
- }
-
- m_CounterCaptureValues.m_Timestamp = timestamp;
- m_CounterCaptureValues.m_Uids = counterIds;
- m_CounterCaptureValues.m_Values = counterValues;
- }
-}
-
-void PeriodicCounterCaptureCommandHandler::operator()(const profiling::Packet& packet)
-{
- ParseData(packet);
- if (!m_QuietOperation) // Are we supposed to print to stdout?
- {
- std::string header, body, uidString, valueString;
-
- for (uint16_t uid : m_CounterCaptureValues.m_Uids)
- {
- uidString.append(std::to_string(uid));
- uidString.append(", ");
- }
-
- for (uint32_t val : m_CounterCaptureValues.m_Values)
- {
- valueString.append(std::to_string(val));
- valueString.append(", ");
- }
-
- body.append(profiling::CentreAlignFormatting(std::to_string(m_CounterCaptureValues.m_Timestamp), 10));
- body.append(" | ");
- body.append(profiling::CentreAlignFormatting(std::to_string(m_CurrentPeriodValue), 13));
- body.append(" | ");
- body.append(profiling::CentreAlignFormatting(uidString, 10));
- body.append(" | ");
- body.append(profiling::CentreAlignFormatting(valueString, 10));
- body.append("\n");
-
- if (!m_HeaderPrinted)
- {
- header.append(profiling::CentreAlignFormatting(" Timestamp", 11));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("Period (us)", 13));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("UID's", static_cast<int>(uidString.size())));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("Values", 10));
- header.append("\n");
-
- std::cout << header;
- m_HeaderPrinted = true;
- }
-
- std::cout << std::string(body.size(), '-') << "\n";
-
- std::cout << body;
- }
-}
-
-} // namespace gatordmock
-
-} // namespace armnn
diff --git a/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp b/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp
deleted file mode 100644
index 478d0a6ca9..0000000000
--- a/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include <Packet.hpp>
-#include <CommandHandlerFunctor.hpp>
-
-#include <vector>
-
-namespace armnn
-{
-
-namespace gatordmock
-{
-
-struct CounterCaptureValues
-{
- uint64_t m_Timestamp;
- std::vector<uint16_t> m_Uids;
- std::vector<uint32_t> m_Values;
-};
-
-class PeriodicCounterCaptureCommandHandler : public profiling::CommandHandlerFunctor
-{
-
-public:
- /**
- * @param familyId The family of the packets this handler will service
- * @param packetId The id of packets this handler will process.
- * @param version The version of that id.
- * @param quietOperation Optional parameter to turn off printouts. This is useful for unittests.
- */
- PeriodicCounterCaptureCommandHandler(uint32_t familyId,
- uint32_t packetId,
- uint32_t version,
- bool quietOperation = false)
- : CommandHandlerFunctor(familyId, packetId, version)
- , m_QuietOperation(quietOperation)
- {}
-
- void operator()(const armnn::profiling::Packet& packet) override;
-
- CounterCaptureValues m_CounterCaptureValues;
-
- uint64_t m_CurrentPeriodValue = 0;
-
-private:
- void ParseData(const armnn::profiling::Packet& packet);
-
- uint64_t m_FirstTimestamp = 0, m_SecondTimestamp = 0;
-
- bool m_HeaderPrinted = false;
- bool m_QuietOperation;
-};
-
-} // namespace gatordmock
-
-} // namespace armnn
diff --git a/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.cpp b/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.cpp
deleted file mode 100644
index 645b0b3507..0000000000
--- a/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "PeriodicCounterSelectionResponseHandler.hpp"
-
-#include "../../../src/profiling/ProfilingUtils.hpp"
-
-#include <iostream>
-
-namespace armnn
-{
-
-namespace gatordmock
-{
-
-void PeriodicCounterSelectionResponseHandler::operator()(const profiling::Packet& packet)
-{
- if (!m_QuietOperation) // Are we supposed to print to stdout?
- {
- uint32_t period = profiling::ReadUint32(reinterpret_cast<const unsigned char*>(packet.GetData()), 0);
- uint32_t numCounters = 0;
- // First check if there are any counters mentioned.
- if(packet.GetLength() > 4)
- {
- // Length will be 4 bytes for the period and then a list of 16 bit UIDS.
- numCounters = ((packet.GetLength() - 4) / 2);
- }
- std::cout << "PeriodicCounterSelectionResponse: Collection interval = " << std::dec << period << "uSec"
- << " Num counters activated = " << numCounters << std::endl;
- }
-}
-
-} // namespace gatordmock
-
-} // namespace armnn \ No newline at end of file
diff --git a/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp b/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp
deleted file mode 100644
index 6b82280e81..0000000000
--- a/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include <CommandHandlerFunctor.hpp>
-#include <Packet.hpp>
-
-#include <vector>
-
-namespace armnn
-{
-
-namespace gatordmock
-{
-
-#pragma once
-
-class PeriodicCounterSelectionResponseHandler : public profiling::CommandHandlerFunctor
-{
-
-public:
- /**
- *
- * @param packetId The id of packets this handler will process.
- * @param version The version of that id.
- * @param quietOperation Optional parameter to turn off printouts. This is useful for unittests.
- */
- PeriodicCounterSelectionResponseHandler(uint32_t familyId,
- uint32_t packetId,
- uint32_t version,
- bool quietOperation = true)
- : CommandHandlerFunctor(familyId, packetId, version)
- , m_QuietOperation(quietOperation)
- {}
-
- void operator()(const armnn::profiling::Packet& packet) override;
-
-private:
- bool m_QuietOperation;
-};
-
-} // namespace gatordmock
-
-} // namespace armnn \ No newline at end of file
diff --git a/tests/profiling/gatordmock/StreamMetadataCommandHandler.cpp b/tests/profiling/gatordmock/StreamMetadataCommandHandler.cpp
deleted file mode 100644
index 09255a57a1..0000000000
--- a/tests/profiling/gatordmock/StreamMetadataCommandHandler.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "StreamMetadataCommandHandler.hpp"
-
-#include <ProfilingUtils.hpp>
-
-#include <boost/cast.hpp>
-
-#include <sstream>
-#include <iostream>
-
-using namespace armnn::profiling;
-
-namespace armnn
-{
-
-namespace gatordmock
-{
-
-void StreamMetadataCommandHandler::operator()(const Packet& packet)
-{
- ParseData(packet);
-
- if (m_QuietOperation)
- {
- return;
- }
-
- std::stringstream ss;
-
- ss << "Stream metadata packet received" << std::endl << std::endl;
-
- ss << "Pipe magic: " << m_PipeMagic << std::endl;
- ss << "Stream metadata version: " << m_StreamMetadataVersion << std::endl;
- ss << "Max data len: " << m_MaxDataLen << std::endl;
- ss << "Pid: " << m_Pid << std::endl;
- ss << "Software info: " << m_SoftwareInfo << std::endl;
- ss << "Hardware version: " << m_HardwareVersion << std::endl;
- ss << "Software version: " << m_SoftwareVersion << std::endl;
- ss << "Process name: " << m_ProcessName << std::endl;
- ss << "Packet versions: " << m_PacketVersionTable.size() << std::endl;
-
- for (const auto& packetVersion : m_PacketVersionTable)
- {
- ss << "-----------------------" << std::endl;
- ss << "Packet family: " << packetVersion.m_PacketFamily << std::endl;
- ss << "Packet id: " << packetVersion.m_PacketId << std::endl;
- ss << "Packet version: " << packetVersion.m_PacketVersion << std::endl;
- }
-
- std::cout << ss.str() << std::endl;
-}
-
-std::string ReadString(const unsigned char* buffer, unsigned int &offset)
-{
- const char* stringPtr = reinterpret_cast<const char*>(&buffer[offset]);
- return stringPtr != nullptr ? std::string(stringPtr) : "";
-}
-
-void StreamMetadataCommandHandler::ParseData(const Packet &packet)
-{
- // Check that at least the packet contains the fixed-length fields
- if (packet.GetLength() < 80)
- {
- return;
- }
-
- // Utils
- unsigned int uint16_t_size = sizeof(uint16_t);
- unsigned int uint32_t_size = sizeof(uint32_t);
-
- const unsigned char* buffer = packet.GetData();
- unsigned int offset = 0;
-
- // Get the fixed-length fields
- m_PipeMagic = ReadUint32(buffer, offset);
- offset += uint32_t_size;
- m_StreamMetadataVersion = ReadUint32(buffer, offset);
- offset += uint32_t_size;
- m_MaxDataLen = ReadUint32(buffer, offset);
- offset += uint32_t_size;
- m_Pid = ReadUint32(buffer, offset);
- offset += uint32_t_size;
- m_OffsetInfo = ReadUint32(buffer, offset);
- offset += uint32_t_size;
- m_OffsetHwVersion = ReadUint32(buffer, offset);
- offset += uint32_t_size;
- m_OffsetSwVersion = ReadUint32(buffer, offset);
- offset += uint32_t_size;
- m_OffsetProcessName = ReadUint32(buffer, offset);
- offset += uint32_t_size;
- m_OffsetPacketVersionTable = ReadUint32(buffer, offset);
- offset += uint32_t_size * 2; // Also skipping the reserved word (all zeros)
-
- // Get the string fields
- m_SoftwareInfo = m_OffsetInfo > 0 ? ReadString(buffer, m_OffsetInfo) : "";
- m_HardwareVersion = m_OffsetHwVersion > 0 ? ReadString(buffer, m_OffsetHwVersion) : "";
- m_SoftwareVersion = m_OffsetSwVersion > 0 ? ReadString(buffer, m_OffsetSwVersion) : "";
- m_ProcessName = m_OffsetProcessName > 0 ? ReadString(buffer, m_OffsetProcessName) : "";
-
- // Get the packet versions
- m_PacketVersionTable.clear();
- if (m_OffsetPacketVersionTable > 0)
- {
- offset = m_OffsetPacketVersionTable;
- uint16_t packetEntries = ReadUint16(buffer, offset + uint16_t_size);
- offset += uint32_t_size; // Also skipping the reserved bytes (all zeros)
- for (uint16_t i = 0; i < packetEntries; i++)
- {
- uint16_t packetFamilyAndId = ReadUint16(buffer, offset + uint16_t_size);
- uint16_t packetFamily = (packetFamilyAndId >> 10) & 0x003F;
- uint16_t packetId = (packetFamilyAndId >> 0) & 0x03FF;
- offset += uint32_t_size; // Also skipping the reserved bytes (all zeros)
- uint32_t packetVersion = ReadUint32(buffer, offset);
- offset += uint32_t_size;
-
- m_PacketVersionTable.push_back({ packetFamily, packetId, packetVersion });
- }
- }
-}
-
-} // namespace gatordmock
-
-} // namespace armnn
diff --git a/tests/profiling/gatordmock/StreamMetadataCommandHandler.hpp b/tests/profiling/gatordmock/StreamMetadataCommandHandler.hpp
deleted file mode 100644
index 4558345e67..0000000000
--- a/tests/profiling/gatordmock/StreamMetadataCommandHandler.hpp
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include <Packet.hpp>
-#include <CommandHandlerFunctor.hpp>
-
-#include <vector>
-
-namespace armnn
-{
-
-namespace gatordmock
-{
-
-struct PacketVersion
-{
- uint16_t m_PacketFamily;
- uint16_t m_PacketId;
- uint32_t m_PacketVersion;
-};
-
-class StreamMetadataCommandHandler : public profiling::CommandHandlerFunctor
-{
-
-public:
- /**
- * @param familyId The family of the packets this handler will service
- * @param packetId The id of packets this handler will process
- * @param version The version of that id
- * @param quietOperation Optional parameter to turn off printouts. This is useful for unit tests
- */
- StreamMetadataCommandHandler(uint32_t familyId,
- uint32_t packetId,
- uint32_t version,
- bool quietOperation = false)
- : CommandHandlerFunctor(familyId, packetId, version)
- , m_QuietOperation(quietOperation)
- {}
-
- void operator()(const armnn::profiling::Packet& packet) override;
-
-private:
- void ParseData(const armnn::profiling::Packet& packet);
-
- uint32_t m_PipeMagic;
- uint32_t m_StreamMetadataVersion;
- uint32_t m_MaxDataLen;
- uint32_t m_Pid;
- uint32_t m_OffsetInfo;
- uint32_t m_OffsetHwVersion;
- uint32_t m_OffsetSwVersion;
- uint32_t m_OffsetProcessName;
- uint32_t m_OffsetPacketVersionTable;
-
- std::string m_SoftwareInfo;
- std::string m_HardwareVersion;
- std::string m_SoftwareVersion;
- std::string m_ProcessName;
-
- std::vector<PacketVersion> m_PacketVersionTable;
-
- bool m_QuietOperation;
-};
-
-} // namespace gatordmock
-
-} // namespace armnn
diff --git a/tests/profiling/gatordmock/tests/GatordMockTests.cpp b/tests/profiling/gatordmock/tests/GatordMockTests.cpp
deleted file mode 100644
index 02adffb2cc..0000000000
--- a/tests/profiling/gatordmock/tests/GatordMockTests.cpp
+++ /dev/null
@@ -1,295 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include <CommandHandlerRegistry.hpp>
-#include <DirectoryCaptureCommandHandler.hpp>
-#include <ProfilingService.hpp>
-#include <GatordMockService.hpp>
-#include <PeriodicCounterCaptureCommandHandler.hpp>
-#include <StreamMetadataCommandHandler.hpp>
-#include <TimelineDirectoryCaptureCommandHandler.hpp>
-
-#include <test/ProfilingMocks.hpp>
-
-#include <boost/cast.hpp>
-#include <boost/test/test_tools.hpp>
-#include <boost/test/unit_test_suite.hpp>
-
-BOOST_AUTO_TEST_SUITE(GatordMockTests)
-
-using namespace armnn;
-using namespace std::this_thread; // sleep_for, sleep_until
-using namespace std::chrono_literals;
-
-BOOST_AUTO_TEST_CASE(CounterCaptureHandlingTest)
-{
- using boost::numeric_cast;
-
- profiling::PacketVersionResolver packetVersionResolver;
-
- // Data with timestamp, counter idx & counter values
- std::vector<std::pair<uint16_t, uint32_t>> indexValuePairs;
- indexValuePairs.reserve(5);
- indexValuePairs.emplace_back(std::make_pair<uint16_t, uint32_t>(0, 100));
- indexValuePairs.emplace_back(std::make_pair<uint16_t, uint32_t>(1, 200));
- indexValuePairs.emplace_back(std::make_pair<uint16_t, uint32_t>(2, 300));
- indexValuePairs.emplace_back(std::make_pair<uint16_t, uint32_t>(3, 400));
- indexValuePairs.emplace_back(std::make_pair<uint16_t, uint32_t>(4, 500));
-
- // ((uint16_t (2 bytes) + uint32_t (4 bytes)) * 5) + word1 + word2
- uint32_t dataLength = 38;
-
- // Simulate two different packets incoming 500 ms apart
- uint64_t time = static_cast<uint64_t>(
- std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now().time_since_epoch())
- .count());
-
- uint64_t time2 = time + 5000;
-
- // UniqueData required for Packet class
- std::unique_ptr<unsigned char[]> uniqueData1 = std::make_unique<unsigned char[]>(dataLength);
- unsigned char* data1 = reinterpret_cast<unsigned char*>(uniqueData1.get());
-
- std::unique_ptr<unsigned char[]> uniqueData2 = std::make_unique<unsigned char[]>(dataLength);
- unsigned char* data2 = reinterpret_cast<unsigned char*>(uniqueData2.get());
-
- uint32_t sizeOfUint64 = numeric_cast<uint32_t>(sizeof(uint64_t));
- uint32_t sizeOfUint32 = numeric_cast<uint32_t>(sizeof(uint32_t));
- uint32_t sizeOfUint16 = numeric_cast<uint32_t>(sizeof(uint16_t));
- // Offset index to point to mem address
- uint32_t offset = 0;
-
- profiling::WriteUint64(data1, offset, time);
- offset += sizeOfUint64;
- for (const auto& pair : indexValuePairs)
- {
- profiling::WriteUint16(data1, offset, pair.first);
- offset += sizeOfUint16;
- profiling::WriteUint32(data1, offset, pair.second);
- offset += sizeOfUint32;
- }
-
- offset = 0;
-
- profiling::WriteUint64(data2, offset, time2);
- offset += sizeOfUint64;
- for (const auto& pair : indexValuePairs)
- {
- profiling::WriteUint16(data2, offset, pair.first);
- offset += sizeOfUint16;
- profiling::WriteUint32(data2, offset, pair.second);
- offset += sizeOfUint32;
- }
-
- uint32_t headerWord1 = packetVersionResolver.ResolvePacketVersion(0, 4).GetEncodedValue();
- // Create packet to send through to the command functor
- profiling::Packet packet1(headerWord1, dataLength, uniqueData1);
- profiling::Packet packet2(headerWord1, dataLength, uniqueData2);
-
- gatordmock::PeriodicCounterCaptureCommandHandler commandHandler(0, 4, headerWord1, true);
-
- // Simulate two separate packets coming in to calculate period
- commandHandler(packet1);
- commandHandler(packet2);
-
- BOOST_ASSERT(commandHandler.m_CurrentPeriodValue == 5000);
-
- for (size_t i = 0; i < commandHandler.m_CounterCaptureValues.m_Uids.size(); ++i)
- {
- BOOST_ASSERT(commandHandler.m_CounterCaptureValues.m_Uids[i] == i);
- }
-}
-
-BOOST_AUTO_TEST_CASE(GatorDMockEndToEnd)
-{
- // The purpose of this test is to setup both sides of the profiling service and get to the point of receiving
- // performance data.
-
- //These variables are used to wait for the profiling service
- uint32_t timeout = 2000;
- uint32_t sleepTime = 50;
- uint32_t timeSlept = 0;
-
- profiling::PacketVersionResolver packetVersionResolver;
-
- // Create the Command Handler Registry
- profiling::CommandHandlerRegistry registry;
-
- // Update with derived functors
- gatordmock::StreamMetadataCommandHandler streamMetadataCommandHandler(
- 0, 0, packetVersionResolver.ResolvePacketVersion(0, 0).GetEncodedValue(), true);
-
- gatordmock::PeriodicCounterCaptureCommandHandler counterCaptureCommandHandler(
- 0, 4, packetVersionResolver.ResolvePacketVersion(0, 4).GetEncodedValue(), true);
-
- profiling::DirectoryCaptureCommandHandler directoryCaptureCommandHandler(
- 0, 2, packetVersionResolver.ResolvePacketVersion(0, 2).GetEncodedValue(), true);
-
- gatordmock::TimelineDirectoryCaptureCommandHandler timelineDirectoryCaptureCommandHandler(
- 1, 0, packetVersionResolver.ResolvePacketVersion(1, 0).GetEncodedValue(), true);
-
- // Register different derived functors
- registry.RegisterFunctor(&streamMetadataCommandHandler);
- registry.RegisterFunctor(&counterCaptureCommandHandler);
- registry.RegisterFunctor(&directoryCaptureCommandHandler);
- registry.RegisterFunctor(&timelineDirectoryCaptureCommandHandler);
- // Setup the mock service to bind to the UDS.
- std::string udsNamespace = "gatord_namespace";
- gatordmock::GatordMockService mockService(registry, false);
- mockService.OpenListeningSocket(udsNamespace);
-
- // Enable the profiling service.
- armnn::IRuntime::CreationOptions::ExternalProfilingOptions options;
- options.m_EnableProfiling = true;
- profiling::ProfilingService& profilingService = profiling::ProfilingService::Instance();
- profilingService.ResetExternalProfilingOptions(options, true);
-
- // Bring the profiling service to the "WaitingForAck" state
- BOOST_CHECK(profilingService.GetCurrentState() == profiling::ProfilingState::Uninitialised);
- profilingService.Update();
- BOOST_CHECK(profilingService.GetCurrentState() == profiling::ProfilingState::NotConnected);
- profilingService.Update();
-
- // Connect the profiling service to the mock Gatord.
- int clientFd = mockService.BlockForOneClient();
- if (-1 == clientFd)
- {
- BOOST_FAIL("Failed to connect client");
- }
-
- // Give the profiling service sending thread time start executing and send the stream metadata.
- while (profilingService.GetCurrentState() != profiling::ProfilingState::WaitingForAck)
- {
- if (timeSlept >= timeout)
- {
- BOOST_FAIL("Timeout: Profiling service did not switch to WaitingForAck state");
- }
- std::this_thread::sleep_for(std::chrono::milliseconds(sleepTime));
- timeSlept += sleepTime;
- }
-
- profilingService.Update();
- // Read the stream metadata on the mock side.
- if (!mockService.WaitForStreamMetaData())
- {
- BOOST_FAIL("Failed to receive StreamMetaData");
- }
- // Send Ack from GatorD
- mockService.SendConnectionAck();
-
- timeSlept = 0;
- while (profilingService.GetCurrentState() != profiling::ProfilingState::Active)
- {
- if (timeSlept >= timeout)
- {
- BOOST_FAIL("Timeout: Profiling service did not switch to Active state");
- }
- std::this_thread::sleep_for(std::chrono::milliseconds(sleepTime));
- timeSlept += sleepTime;
- }
-
- mockService.LaunchReceivingThread();
- // As part of the default startup of the profiling service a counter directory packet will be sent.
- timeSlept = 0;
- while (!directoryCaptureCommandHandler.ParsedCounterDirectory())
- {
- if (timeSlept >= timeout)
- {
- BOOST_FAIL("Timeout: MockGatord did not receive counter directory packet");
- }
- std::this_thread::sleep_for(std::chrono::milliseconds(sleepTime));
- timeSlept += sleepTime;
- }
-
- const profiling::ICounterDirectory& serviceCounterDirectory = profilingService.GetCounterDirectory();
- const profiling::ICounterDirectory& receivedCounterDirectory = directoryCaptureCommandHandler.GetCounterDirectory();
-
- // Compare thre basics of the counter directory from the service and the one we received over the wire.
- BOOST_ASSERT(serviceCounterDirectory.GetDeviceCount() == receivedCounterDirectory.GetDeviceCount());
- BOOST_ASSERT(serviceCounterDirectory.GetCounterSetCount() == receivedCounterDirectory.GetCounterSetCount());
- BOOST_ASSERT(serviceCounterDirectory.GetCategoryCount() == receivedCounterDirectory.GetCategoryCount());
- BOOST_ASSERT(serviceCounterDirectory.GetCounterCount() == receivedCounterDirectory.GetCounterCount());
-
- receivedCounterDirectory.GetDeviceCount();
- serviceCounterDirectory.GetDeviceCount();
-
- const profiling::Devices& serviceDevices = serviceCounterDirectory.GetDevices();
- for (auto& device : serviceDevices)
- {
- // Find the same device in the received counter directory.
- auto foundDevice = receivedCounterDirectory.GetDevices().find(device.second->m_Uid);
- BOOST_CHECK(foundDevice != receivedCounterDirectory.GetDevices().end());
- BOOST_CHECK(device.second->m_Name.compare((*foundDevice).second->m_Name) == 0);
- BOOST_CHECK(device.second->m_Cores == (*foundDevice).second->m_Cores);
- }
-
- const profiling::CounterSets& serviceCounterSets = serviceCounterDirectory.GetCounterSets();
- for (auto& counterSet : serviceCounterSets)
- {
- // Find the same counter set in the received counter directory.
- auto foundCounterSet = receivedCounterDirectory.GetCounterSets().find(counterSet.second->m_Uid);
- BOOST_CHECK(foundCounterSet != receivedCounterDirectory.GetCounterSets().end());
- BOOST_CHECK(counterSet.second->m_Name.compare((*foundCounterSet).second->m_Name) == 0);
- BOOST_CHECK(counterSet.second->m_Count == (*foundCounterSet).second->m_Count);
- }
-
- const profiling::Categories& serviceCategories = serviceCounterDirectory.GetCategories();
- for (auto& category : serviceCategories)
- {
- for (auto& receivedCategory : receivedCounterDirectory.GetCategories())
- {
- if (receivedCategory->m_Name.compare(category->m_Name) == 0)
- {
- // We've found the matching category.
- BOOST_CHECK(category->m_DeviceUid == receivedCategory->m_DeviceUid);
- BOOST_CHECK(category->m_CounterSetUid == receivedCategory->m_CounterSetUid);
- // Now look at the interiors of the counters. Start by sorting them.
- std::sort(category->m_Counters.begin(), category->m_Counters.end());
- std::sort(receivedCategory->m_Counters.begin(), receivedCategory->m_Counters.end());
- // When comparing uid's here we need to translate them.
- std::function<bool(const uint16_t&, const uint16_t&)> comparator =
- [&directoryCaptureCommandHandler](const uint16_t& first, const uint16_t& second) {
- uint16_t translated = directoryCaptureCommandHandler.TranslateUIDCopyToOriginal(second);
- if (translated == first)
- {
- return true;
- }
- return false;
- };
- // Then let vector == do the work.
- BOOST_CHECK(std::equal(category->m_Counters.begin(), category->m_Counters.end(),
- receivedCategory->m_Counters.begin(), comparator));
- break;
- }
- }
- }
-
- // Finally check the content of the counters.
- const profiling::Counters& receivedCounters = receivedCounterDirectory.GetCounters();
- for (auto& receivedCounter : receivedCounters)
- {
- // Translate the Uid and find the corresponding counter in the original counter directory.
- // Note we can't check m_MaxCounterUid here as it will likely differ between the two counter directories.
- uint16_t translated = directoryCaptureCommandHandler.TranslateUIDCopyToOriginal(receivedCounter.first);
- const profiling::Counter* serviceCounter = serviceCounterDirectory.GetCounter(translated);
- BOOST_CHECK(serviceCounter->m_DeviceUid == receivedCounter.second->m_DeviceUid);
- BOOST_CHECK(serviceCounter->m_Name.compare(receivedCounter.second->m_Name) == 0);
- BOOST_CHECK(serviceCounter->m_CounterSetUid == receivedCounter.second->m_CounterSetUid);
- BOOST_CHECK(serviceCounter->m_Multiplier == receivedCounter.second->m_Multiplier);
- BOOST_CHECK(serviceCounter->m_Interpolation == receivedCounter.second->m_Interpolation);
- BOOST_CHECK(serviceCounter->m_Class == receivedCounter.second->m_Class);
- BOOST_CHECK(serviceCounter->m_Units.compare(receivedCounter.second->m_Units) == 0);
- BOOST_CHECK(serviceCounter->m_Description.compare(receivedCounter.second->m_Description) == 0);
- }
-
- mockService.WaitForReceivingThread();
- options.m_EnableProfiling = false;
- profilingService.ResetExternalProfilingOptions(options, true);
-
- // Future tests here will add counters to the ProfilingService, increment values and examine
- // PeriodicCounterCapture data received. These are yet to be integrated.
-}
-
-BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/profiling/timelineDecoder/ITimelineDecoder.h b/tests/profiling/timelineDecoder/ITimelineDecoder.h
deleted file mode 100644
index 65ec8bfa6e..0000000000
--- a/tests/profiling/timelineDecoder/ITimelineDecoder.h
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#ifndef ARMNN_ITIMELINEDECODER_H
-#define ARMNN_ITIMELINEDECODER_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include "TimelineModel.h"
-
-typedef enum ErrorCode
-{
- ErrorCode_Success,
- ErrorCode_Fail
-} ErrorCode;
-
-ErrorCode CreateModel(Model** model);
-ErrorCode DestroyModel(Model** model);
-
-ErrorCode SetEntityCallback(OnNewEntityCallback cb, Model* model);
-ErrorCode SetEventClassCallback(OnNewEventClassCallback cb, Model* model);
-ErrorCode SetEventCallback(OnNewEventCallback cb, Model* model);
-ErrorCode SetLabelCallback(OnNewLabelCallback cb, Model* model);
-ErrorCode SetRelationshipCallback(OnNewRelationshipCallback cb, Model* model);
-
-ErrorCode CreateEntity(const Entity entity, Model* model);
-ErrorCode CreateEventClass(const EventClass eventClass, Model* model);
-ErrorCode CreateEvent(const Event event, Model* model);
-ErrorCode CreateLabel(const Label label, Model* model);
-ErrorCode CreateRelationship(const Relationship relationship, Model* model);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //ARMNN_ITIMELINEDECODER_H \ No newline at end of file
diff --git a/tests/profiling/timelineDecoder/TimelineCaptureCommandHandler.cpp b/tests/profiling/timelineDecoder/TimelineCaptureCommandHandler.cpp
deleted file mode 100644
index 78b1300ed3..0000000000
--- a/tests/profiling/timelineDecoder/TimelineCaptureCommandHandler.cpp
+++ /dev/null
@@ -1,300 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "TimelineCaptureCommandHandler.hpp"
-
-#include <iostream>
-#include <string>
-
-namespace armnn
-{
-
-namespace gatordmock
-{
-
-//Array of member functions, the array index matches the decl_id
-const TimelineCaptureCommandHandler::ReadFunction TimelineCaptureCommandHandler::m_ReadFunctions[5]
-{
- &TimelineCaptureCommandHandler::ReadLabel, // Label decl_id = 0
- &TimelineCaptureCommandHandler::ReadEntity, // Entity decl_id = 1
- &TimelineCaptureCommandHandler::ReadEventClass, // EventClass decl_id = 2
- &TimelineCaptureCommandHandler::ReadRelationship, // Relationship decl_id = 3
- &TimelineCaptureCommandHandler::ReadEvent // Event decl_id = 4
-};
-
-void TimelineCaptureCommandHandler::ParseData(const armnn::profiling::Packet& packet)
-{
- uint32_t offset = 0;
-
- if (packet.GetLength() < 8)
- {
- return;
- }
-
- const unsigned char* data = reinterpret_cast<const unsigned char*>(packet.GetData());
-
- uint32_t declId = 0;
-
- declId = profiling::ReadUint32(data, offset);
- offset += uint32_t_size;
-
- (this->*m_ReadFunctions[declId])(data, offset);
-}
-
-void TimelineCaptureCommandHandler::ReadLabel(const unsigned char* data, uint32_t offset)
-{
- Label label;
- label.m_Guid = profiling::ReadUint64(data, offset);
- offset += uint64_t_size;
-
- uint32_t nameLength = profiling::ReadUint32(data, offset);
- offset += uint32_t_size;
-
- label.m_Name = new char[nameLength];
- for (uint32_t i = 0; i< nameLength; ++i)
- {
- label.m_Name[i] = static_cast<char>(profiling::ReadUint8(data, offset + i));
- }
-
- CreateLabel(label, m_Model);
-
- if (!m_QuietOperation)
- {
- printLabels();
- }
-}
-
-void TimelineCaptureCommandHandler::ReadEntity(const unsigned char* data, uint32_t offset)
-{
- Entity entity;
- entity.m_Guid = profiling::ReadUint64(data, offset);
-
- CreateEntity(entity, m_Model);
-
- if (!m_QuietOperation)
- {
- printEntities();
- }
-}
-
-void TimelineCaptureCommandHandler::ReadEventClass(const unsigned char* data, uint32_t offset)
-{
- EventClass eventClass;
- eventClass.m_Guid = profiling::ReadUint64(data, offset);
-
- CreateEventClass(eventClass, m_Model);
-
- if (!m_QuietOperation)
- {
- printEventClasses();
- }
-}
-
-void TimelineCaptureCommandHandler::ReadRelationship(const unsigned char* data, uint32_t offset)
-{
- Relationship relationship;
- relationship.m_RelationshipType = static_cast<RelationshipType>(profiling::ReadUint32(data, offset));
- offset += uint32_t_size;
-
- relationship.m_Guid = profiling::ReadUint64(data, offset);
- offset += uint64_t_size;
-
- relationship.m_HeadGuid = profiling::ReadUint64(data, offset);
- offset += uint64_t_size;
-
- relationship.m_TailGuid = profiling::ReadUint64(data, offset);
-
- CreateRelationship(relationship, m_Model);
-
- if (!m_QuietOperation)
- {
- printRelationships();
- }
-}
-
-
-
-void TimelineCaptureCommandHandler::ReadEvent(const unsigned char* data, uint32_t offset)
-{
- Event event;
- event.m_TimeStamp = profiling::ReadUint64(data, offset);
- offset += uint64_t_size;
-
- event.m_ThreadId = new uint8_t[threadId_size];
- profiling::ReadBytes(data, offset, threadId_size, event.m_ThreadId);
- offset += threadId_size;
-
- event.m_Guid = profiling::ReadUint64(data, offset);
-
- CreateEvent(event, m_Model);
-
- if (!m_QuietOperation)
- {
- printEvents();
- }
-}
-
-void TimelineCaptureCommandHandler::operator()(const profiling::Packet& packet)
-{
- ParseData(packet);
-}
-
-void TimelineCaptureCommandHandler::printLabels()
-{
- std::string header;
-
- header.append(profiling::CentreAlignFormatting("guid", 12));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("value", 30));
- header.append("\n");
-
- std::cout << "\n" << "\n";
- std::cout << profiling::CentreAlignFormatting("LABELS", static_cast<int>(header.size()));
- std::cout << "\n";
- std::cout << std::string(header.size(), '=') << "\n";
- std::cout << header;
-
- for (uint32_t i = 0; i < m_Model->m_LabelCount; ++i)
- {
- std::string body;
-
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model->m_Labels[i]->m_Guid), 12));
- body.append(" | ");
- body.append(profiling::CentreAlignFormatting(m_Model->m_Labels[i]->m_Name, 30));
- body.append("\n");
-
- std::cout << std::string(body.size(), '-') << "\n";
- std::cout<< body;
- }
-}
-
-void TimelineCaptureCommandHandler::printEntities()
-{
- std::string header;
- header.append(profiling::CentreAlignFormatting("guid", 12));
- header.append("\n");
-
- std::cout << "\n" << "\n";
- std::cout << profiling::CentreAlignFormatting("ENTITIES", static_cast<int>(header.size()));
- std::cout << "\n";
- std::cout << std::string(header.size(), '=') << "\n";
- std::cout << header;
-
- for (uint32_t i = 0; i < m_Model->m_EntityCount; ++i)
- {
- std::string body;
-
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model->m_Entities[i]->m_Guid), 12));
- body.append("\n");
-
- std::cout << std::string(body.size(), '-') << "\n";
- std::cout<< body;
- }
-}
-
-void TimelineCaptureCommandHandler::printEventClasses()
-{
- std::string header;
- header.append(profiling::CentreAlignFormatting("guid", 12));
- header.append("\n");
-
- std::cout << "\n" << "\n";
- std::cout << profiling::CentreAlignFormatting("EVENT CLASSES", static_cast<int>(header.size()));
- std::cout << "\n";
- std::cout << std::string(header.size(), '=') << "\n";
- std::cout << header;
-
- for (uint32_t i = 0; i < m_Model->m_EventClassCount; ++i)
- {
- std::string body;
-
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model->m_EventClasses[i]->m_Guid), 12));
- body.append("\n");
-
- std::cout << std::string(body.size(), '-') << "\n";
- std::cout<< body;
- }
-}
-
-void TimelineCaptureCommandHandler::printRelationships()
-{
- std::string header;
- header.append(profiling::CentreAlignFormatting("relationshipType", 20));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("relationshipGuid", 20));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("headGuid", 12));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("tailGuid", 12));
- header.append("\n");
-
- std::cout << "\n" << "\n";
- std::cout << profiling::CentreAlignFormatting("RELATIONSHIPS", static_cast<int>(header.size()));
- std::cout << "\n";
- std::cout << std::string(header.size(), '=') << "\n";
- std::cout << header;
-
- for (uint32_t i = 0; i < m_Model->m_RelationshipCount; ++i)
- {
- std::string body;
-
- body.append(
- profiling::CentreAlignFormatting(std::to_string(m_Model->m_Relationships[i]->m_RelationshipType), 20));
- body.append(" | ");
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model->m_Relationships[i]->m_Guid), 20));
- body.append(" | ");
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model->m_Relationships[i]->m_HeadGuid), 12));
- body.append(" | ");
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model->m_Relationships[i]->m_TailGuid), 12));
- body.append(" | ");
- body.append("\n");
-
- std::cout << std::string(body.size(), '-') << "\n";
- std::cout<< body;
- }
-}
-
-void TimelineCaptureCommandHandler::printEvents()
-{
- std::string header;
-
- header.append(profiling::CentreAlignFormatting("timestamp", 12));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("threadId", 12));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("eventGuid", 12));
- header.append("\n");
-
- std::cout << "\n" << "\n";
- std::cout << profiling::CentreAlignFormatting("EVENTS", static_cast<int>(header.size()));
- std::cout << "\n";
- std::cout << std::string(header.size(), '=') << "\n";
- std::cout << header;
-
- for (uint32_t i = 0; i < m_Model->m_EventCount; ++i)
- {
- std::string body;
-
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model->m_Events[i]->m_TimeStamp), 12));
- body.append(" | ");
-
- std::string threadId;
- for(uint32_t j =0; j< threadId_size; j++)
- {
- threadId += static_cast<char>(m_Model->m_Events[i]->m_ThreadId[j]);
- }
- body.append(profiling::CentreAlignFormatting(threadId, 12));
- body.append(" | ");
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model->m_Events[i]->m_Guid), 12));
- body.append("\n");
-
- std::cout << std::string(body.size(), '-') << "\n";
- std::cout<< body;
- }
-}
-
-} //namespace gatordmock
-
-} //namespace armnn
diff --git a/tests/profiling/timelineDecoder/TimelineCaptureCommandHandler.hpp b/tests/profiling/timelineDecoder/TimelineCaptureCommandHandler.hpp
deleted file mode 100644
index 3f3240491f..0000000000
--- a/tests/profiling/timelineDecoder/TimelineCaptureCommandHandler.hpp
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include "ITimelineDecoder.h"
-
-#include <CommandHandlerFunctor.hpp>
-#include <Packet.hpp>
-#include <ProfilingUtils.hpp>
-
-namespace armnn
-{
-
-namespace gatordmock
-{
-
-class TimelineCaptureCommandHandler : public profiling::CommandHandlerFunctor
-{
- // Utils
- uint32_t uint32_t_size = sizeof(uint32_t);
- uint32_t uint64_t_size = sizeof(uint64_t);
- uint32_t threadId_size = sizeof(std::thread::id);
-
- using ReadFunction = void (TimelineCaptureCommandHandler::*)(const unsigned char*, uint32_t);
-
-public:
- TimelineCaptureCommandHandler(uint32_t familyId,
- uint32_t packetId,
- uint32_t version,
- Model* model,
- bool quietOperation = false)
- : CommandHandlerFunctor(familyId, packetId, version)
- , m_Model(model)
- , m_QuietOperation(quietOperation)
- {}
-
- void operator()(const armnn::profiling::Packet& packet) override;
-
- void ReadLabel(const unsigned char* data, uint32_t offset);
- void ReadEntity(const unsigned char* data, uint32_t offset);
- void ReadEventClass(const unsigned char* data, uint32_t offset);
- void ReadRelationship(const unsigned char* data, uint32_t offset);
- void ReadEvent(const unsigned char* data, uint32_t offset);
-
- void print();
-
-private:
- void ParseData(const armnn::profiling::Packet& packet);
-
- Model* m_Model;
- bool m_QuietOperation;
- static const ReadFunction m_ReadFunctions[];
-
- void printLabels();
- void printEntities();
- void printEventClasses();
- void printRelationships();
- void printEvents();
-};
-
-} //namespace gatordmock
-
-} //namespace armnn
diff --git a/tests/profiling/timelineDecoder/TimelineDecoder.cpp b/tests/profiling/timelineDecoder/TimelineDecoder.cpp
deleted file mode 100644
index b6f051b745..0000000000
--- a/tests/profiling/timelineDecoder/TimelineDecoder.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "ITimelineDecoder.h"
-
-ErrorCode CreateEntity(const Entity entity, Model* model)
-{
- if (model == nullptr || model->m_EntityCb == nullptr)
- {
- return ErrorCode::ErrorCode_Fail;
- }
- model->m_EntityCb(entity, model);
- return ErrorCode::ErrorCode_Success;
-}
-
-ErrorCode CreateEventClass(const EventClass eventClass, Model* model)
-{
- if (model == nullptr || model->m_EventClassCb == nullptr)
- {
- return ErrorCode::ErrorCode_Fail;
- }
- model->m_EventClassCb(eventClass, model);
- return ErrorCode::ErrorCode_Success;
-}
-
-ErrorCode CreateEvent(const Event event, Model* model)
-{
- if (model == nullptr || model->m_EventCb == nullptr)
- {
- return ErrorCode::ErrorCode_Fail;
- }
- model->m_EventCb(event, model);
- return ErrorCode::ErrorCode_Success;
-}
-
-ErrorCode CreateLabel(const Label label, Model* model)
-{
- if (model == nullptr || model->m_LabelCb == nullptr)
- {
- return ErrorCode::ErrorCode_Fail;
- }
- model->m_LabelCb(label, model);
- return ErrorCode::ErrorCode_Success;
-}
-
-ErrorCode CreateRelationship(Relationship relationship, Model* model)
-{
- if (model == nullptr || model->m_RelationshipCb == nullptr)
- {
- return ErrorCode::ErrorCode_Fail;
- }
- model->m_RelationshipCb(relationship, model);
- return ErrorCode::ErrorCode_Success;
-}
-
-ErrorCode SetEntityCallback(OnNewEntityCallback cb, Model* model)
-{
- if (cb == nullptr || model == nullptr)
- {
- return ErrorCode::ErrorCode_Fail;
- }
- model->m_EntityCb = cb;
- return ErrorCode::ErrorCode_Success;
-}
-
-ErrorCode SetEventClassCallback(OnNewEventClassCallback cb, Model* model)
-{
- if (cb == nullptr || model == nullptr)
- {
- return ErrorCode::ErrorCode_Fail;
- }
- model->m_EventClassCb = cb;
- return ErrorCode::ErrorCode_Success;
-}
-
-ErrorCode SetEventCallback(OnNewEventCallback cb, Model* model)
-{
- if (cb == nullptr || model == nullptr)
- {
- return ErrorCode::ErrorCode_Fail;
- }
- model->m_EventCb = cb;
- return ErrorCode::ErrorCode_Success;
-}
-
-ErrorCode SetLabelCallback(OnNewLabelCallback cb, Model* model)
-{
- if (cb == nullptr || model == nullptr)
- {
- return ErrorCode::ErrorCode_Fail;
- }
- model->m_LabelCb = cb;
- return ErrorCode::ErrorCode_Success;
-}
-
-ErrorCode SetRelationshipCallback(OnNewRelationshipCallback cb, Model* model)
-{
- if (cb == nullptr || model == nullptr)
- {
- return ErrorCode::ErrorCode_Fail;
- }
- model->m_RelationshipCb = cb;
- return ErrorCode::ErrorCode_Success;
-}
-
-ErrorCode CreateModel(Model** model)
-{
- Model* modelPtr = new Model;
-
- modelPtr->m_EntityCount = 0;
- modelPtr->m_EventClassCount = 0;
- modelPtr->m_EventCount = 0;
- modelPtr->m_LabelCount = 0;
- modelPtr->m_RelationshipCount = 0;
-
- *model = modelPtr;
- return ErrorCode::ErrorCode_Success;
-}
-
-ErrorCode DestroyModel(Model** model)
-{
- if (*model == nullptr)
- {
- return ErrorCode::ErrorCode_Fail;
- }
-
- Model* modelPtr = *model;
-
- for (uint32_t i = 0; i < modelPtr->m_EntityCount; ++i)
- {
- delete modelPtr->m_Entities[i];
- }
-
- for (uint32_t i = 0; i < modelPtr->m_EventClassCount; ++i)
- {
- delete modelPtr->m_EventClasses[i];
- }
-
- for (uint32_t i = 0; i < modelPtr->m_EventCount; ++i)
- {
- delete[] modelPtr->m_Events[i]->m_ThreadId;
- delete modelPtr->m_Events[i];
- }
-
- for (uint32_t i = 0; i < modelPtr->m_LabelCount; ++i)
- {
- delete[] modelPtr->m_Labels[i]->m_Name;
- delete modelPtr->m_Labels[i];
- }
-
- for (uint32_t i = 0; i < modelPtr->m_RelationshipCount; ++i)
- {
- delete modelPtr->m_Relationships[i];
- }
-
- delete[] modelPtr->m_Entities;
- delete[] modelPtr->m_EventClasses;
- delete[] modelPtr->m_Events;
- delete[] modelPtr->m_Labels;
- delete[] modelPtr->m_Relationships;
-
- delete modelPtr;
- return ErrorCode::ErrorCode_Success;
-} \ No newline at end of file
diff --git a/tests/profiling/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp b/tests/profiling/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp
deleted file mode 100644
index f28c7b50bf..0000000000
--- a/tests/profiling/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "TimelineDirectoryCaptureCommandHandler.hpp"
-
-#include <ProfilingUtils.hpp>
-
-#include <iostream>
-#include <string>
-
-using namespace armnn::profiling;
-
-namespace armnn
-{
-
-namespace gatordmock
-{
-
-void TimelineDirectoryCaptureCommandHandler::ParseData(const armnn::profiling::Packet& packet)
-{
- uint32_t offset = 0;
-
- if (packet.GetLength() < 8)
- {
- return;
- }
-
- const unsigned char* data = packet.GetData();
-
- m_SwTraceHeader.m_StreamVersion = ReadUint8(data, offset);
- offset += uint8_t_size;
- m_SwTraceHeader.m_PointerBytes = ReadUint8(data, offset);
- offset += uint8_t_size;
- m_SwTraceHeader.m_ThreadIdBytes = ReadUint8(data, offset);
- offset += uint8_t_size;
-
- uint32_t numberOfDeclarations = profiling::ReadUint32(data, offset);
- offset += uint32_t_size;
-
- for (uint32_t declaration = 0; declaration < numberOfDeclarations; ++declaration)
- {
- m_SwTraceMessages.push_back(profiling::ReadSwTraceMessage(data, offset));
- }
-}
-
-void TimelineDirectoryCaptureCommandHandler::Print()
-{
- std::string header;
-
- header.append(profiling::CentreAlignFormatting("decl_id", 12));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("decl_name", 20));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("ui_name", 20));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("arg_types", 16));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("arg_names", 80));
- header.append("\n");
-
- std::cout << "\n" << "\n";
- std::cout << profiling::CentreAlignFormatting("SW DIRECTORY", static_cast<int>(header.size()));
- std::cout << "\n";
- std::cout << std::string(header.size(), '=') << "\n";
-
- std::cout << header;
-
- for (const auto& swTraceMessage : m_SwTraceMessages)
- {
- std::string body;
-
- body.append(profiling::CentreAlignFormatting(std::to_string(swTraceMessage.m_Id), 12));
- body.append(" | ");
- body.append(profiling::CentreAlignFormatting(swTraceMessage.m_Name, 20));
- body.append(" | ");
- body.append(profiling::CentreAlignFormatting(swTraceMessage.m_UiName, 20));
- body.append(" | ");
-
- std::string argTypes;
- for (auto argType: swTraceMessage.m_ArgTypes)
- {
- argTypes += argType;
- argTypes += " ";
- }
- body.append(profiling::CentreAlignFormatting(argTypes, 16));
- body.append(" | ");
-
- std::string argNames;
- for (auto argName: swTraceMessage.m_ArgNames)
- {
- argNames += argName + " ";
- }
- body.append(profiling::CentreAlignFormatting(argNames, 80));
-
- body.append("\n");
-
- std::cout << std::string(body.size(), '-') << "\n";
-
- std::cout << body;
- }
-}
-
-void TimelineDirectoryCaptureCommandHandler::operator()(const profiling::Packet& packet)
-{
- ParseData(packet);
-
- if (!m_QuietOperation)
- {
- Print();
- }
-}
-
-} //namespace gatordmock
-
-} //namespace armnn
diff --git a/tests/profiling/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp b/tests/profiling/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp
deleted file mode 100644
index 36a82b5510..0000000000
--- a/tests/profiling/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-
-#include <CommandHandlerFunctor.hpp>
-#include <Packet.hpp>
-#include <PacketBuffer.hpp>
-#include <ProfilingUtils.hpp>
-
-namespace armnn
-{
-
-namespace gatordmock
-{
-
-class TimelineDirectoryCaptureCommandHandler : public profiling::CommandHandlerFunctor
-{
- // Utils
- uint32_t uint8_t_size = sizeof(uint8_t);
- uint32_t uint32_t_size = sizeof(uint32_t);
-
-public:
- TimelineDirectoryCaptureCommandHandler(uint32_t familyId,
- uint32_t packetId,
- uint32_t version,
- bool quietOperation = false)
- : CommandHandlerFunctor(familyId, packetId, version)
- , m_QuietOperation(quietOperation)
- {}
-
- void operator()(const armnn::profiling::Packet& packet) override;
-
- profiling::SwTraceHeader m_SwTraceHeader;
- std::vector<profiling::SwTraceMessage> m_SwTraceMessages;
-
-private:
- void ParseData(const armnn::profiling::Packet& packet);
- void Print();
-
- bool m_QuietOperation;
-};
-
-} //namespace gatordmock
-
-} //namespace armnn
diff --git a/tests/profiling/timelineDecoder/TimelineModel.h b/tests/profiling/timelineDecoder/TimelineModel.h
deleted file mode 100644
index a4fbd0dbde..0000000000
--- a/tests/profiling/timelineDecoder/TimelineModel.h
+++ /dev/null
@@ -1,96 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#ifndef ARMNN_ITIMELINEMODEL_H
-#define ARMNN_ITIMELINEMODEL_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include <stdint.h>
-
-struct Model;
-
-typedef enum RelationshipType
-{
- RetentionLink, /// Head retains(parents) Tail
- ExecutionLink, /// Head execution start depends on Tail execution completion
- DataLink, /// Head uses data of Tail
- LabelLink /// Head uses label Tail (Tail MUST be a guid of a label).
-} RelationshipType;
-
-typedef struct Entity
-{
- uint64_t m_Guid;
-} Entity;
-
-typedef struct EventClass
-{
- uint64_t m_Guid;
-} EventClass;
-
-typedef struct Event
-{
- uint64_t m_Guid;
- uint64_t m_TimeStamp;
- unsigned char* m_ThreadId;
-} ProfilingEvent;
-
-typedef struct Label
-{
- uint64_t m_Guid;
- char* m_Name;
-} Label;
-
-typedef struct Relationship
-{
- RelationshipType m_RelationshipType;
- uint64_t m_Guid;
- uint64_t m_HeadGuid;
- uint64_t m_TailGuid;
-} Relationship;
-
-typedef void (*OnNewEntityCallback)(const Entity, struct Model* model);
-typedef void (*OnNewEventClassCallback)(const EventClass, struct Model* model);
-typedef void (*OnNewEventCallback)(const Event, struct Model* model);
-typedef void (*OnNewLabelCallback)(const Label, struct Model* model);
-typedef void (*OnNewRelationshipCallback)(const Relationship, struct Model* model) ;
-
-typedef struct Model
-{
- OnNewEntityCallback m_EntityCb;
- OnNewEventClassCallback m_EventClassCb;
- OnNewEventCallback m_EventCb;
- OnNewLabelCallback m_LabelCb;
- OnNewRelationshipCallback m_RelationshipCb;
-
- Entity** m_Entities;
- EventClass** m_EventClasses;
- Event** m_Events;
- Label** m_Labels;
- Relationship** m_Relationships;
-
- uint32_t m_EntityCount;
- uint32_t m_EntityCapacity;
-
- uint32_t m_EventClassCount;
- uint32_t m_EventClassCapacity;
-
- uint32_t m_EventCount;
- uint32_t m_EventCapacity;
-
- uint32_t m_LabelCount;
- uint32_t m_LabelCapacity;
-
- uint32_t m_RelationshipCount;
- uint32_t m_RelationshipCapacity;
-} Model;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //ARMNN_ITIMELINEMODEL_H \ No newline at end of file
diff --git a/tests/profiling/timelineDecoder/tests/TimelineTestFunctions.hpp b/tests/profiling/timelineDecoder/tests/TimelineTestFunctions.hpp
deleted file mode 100644
index 3fd9d04dbc..0000000000
--- a/tests/profiling/timelineDecoder/tests/TimelineTestFunctions.hpp
+++ /dev/null
@@ -1,143 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include <algorithm>
-#include "../TimelineModel.h"
-
-void PushEntity(const Entity entity, Model* model)
-{
- if(model->m_EntityCount == 0)
- {
- model->m_EntityCapacity = 1;
- model->m_Entities = new Entity*[model->m_EntityCapacity];
- }
- else if(model->m_EntityCount >= model->m_EntityCapacity)
- {
- Entity** newEntityArray = new Entity*[model->m_EntityCapacity*2];
-
- std::copy(model->m_Entities, model->m_Entities + model->m_EntityCapacity, newEntityArray);
- delete[] model->m_Entities;
- model->m_Entities = newEntityArray;
-
- model->m_EntityCapacity = model->m_EntityCapacity *2;
- }
-
- Entity* newEntity = new Entity;
-
- newEntity->m_Guid = entity.m_Guid;
-
- model->m_Entities[model->m_EntityCount] = newEntity;
- model->m_EntityCount++;
-};
-
-void PushEventClass(const EventClass eventClass, Model* model)
-{
- if(model->m_EventClassCount == 0)
- {
- model->m_EventClassCapacity = 1;
- model->m_EventClasses = new EventClass*[model->m_EventClassCapacity];
- }
- else if(model->m_EventClassCount >= model->m_EventClassCapacity)
- {
- EventClass** newEventClassArray = new EventClass*[model->m_EventClassCapacity *2];
-
- std::copy(model->m_EventClasses, model->m_EventClasses + model->m_EventClassCapacity, newEventClassArray);
- delete[] model->m_EventClasses;
- model->m_EventClasses = newEventClassArray;
-
- model->m_EventClassCapacity = model->m_EventClassCapacity *2;
- }
-
- EventClass* newEventClass = new EventClass;
-
- newEventClass->m_Guid = eventClass.m_Guid;
-
- model->m_EventClasses[model->m_EventClassCount] = newEventClass;
- model->m_EventClassCount++;
-};
-
-void PushEvent(const Event event, Model* model)
-{
- if(model->m_EventCount == 0)
- {
- model->m_EventCapacity = 1;
- model->m_Events = new Event*[model->m_EventCapacity];
- }
- else if(model->m_EventCount >= model->m_EventCapacity)
- {
- Event** newEventArray = new Event*[model->m_EventCapacity * 2];
-
- std::copy(model->m_Events, model->m_Events + model->m_EventCapacity, newEventArray);
- delete[] model->m_Events;
- model->m_Events = newEventArray;
-
- model->m_EventCapacity = model->m_EventCapacity *2;
- }
-
- Event* newEvent = new Event;
-
- newEvent->m_TimeStamp = event.m_TimeStamp;
- newEvent->m_ThreadId = event.m_ThreadId;
- newEvent->m_Guid = event.m_Guid;
-
- model->m_Events[model->m_EventCount] = newEvent;
- model->m_EventCount++;
-};
-
-void PushLabel(const Label label, Model* model)
-{
- if(model->m_LabelCount == 0)
- {
- model->m_LabelCapacity = 1;
- model->m_Labels = new Label*[model->m_LabelCapacity];
- }
- else if(model->m_LabelCount >= model->m_LabelCapacity)
- {
- Label** newLabelArray = new Label*[model->m_LabelCapacity *2];
-
- std::copy(model->m_Labels, model->m_Labels + model->m_LabelCapacity, newLabelArray);
- delete[] model->m_Labels;
- model->m_Labels = newLabelArray;
-
- model->m_LabelCapacity = model->m_LabelCapacity *2;
- }
-
- Label* newLabel = new Label;
-
- newLabel->m_Guid = label.m_Guid;
- newLabel->m_Name = label.m_Name;
-
- model->m_Labels[model->m_LabelCount] = newLabel;
- model->m_LabelCount++;
-};
-
-void PushRelationship(const Relationship relationship, Model* model)
-{
- if(model->m_RelationshipCount == 0)
- {
- model->m_RelationshipCapacity = 1;
- model->m_Relationships = new Relationship*[model->m_RelationshipCapacity];
- }
- else if(model->m_RelationshipCount >= model->m_RelationshipCapacity)
- {
- Relationship** newRelationshipArray = new Relationship*[model->m_RelationshipCapacity *2];
-
- std::copy(model->m_Relationships, model->m_Relationships + model->m_RelationshipCapacity, newRelationshipArray);
- delete[] model->m_Relationships;
- model->m_Relationships = newRelationshipArray;
-
- model->m_RelationshipCapacity = model->m_RelationshipCapacity *2;
- }
-
- Relationship* newRelationship = new Relationship;
-
- newRelationship->m_Guid = relationship.m_Guid;
- newRelationship->m_RelationshipType = relationship.m_RelationshipType;
- newRelationship->m_HeadGuid = relationship.m_HeadGuid;
- newRelationship->m_TailGuid = relationship.m_TailGuid;
-
- model->m_Relationships[model->m_RelationshipCount] = newRelationship;
- model->m_RelationshipCount++;
-};
diff --git a/tests/profiling/timelineDecoder/tests/TimelineTests.cpp b/tests/profiling/timelineDecoder/tests/TimelineTests.cpp
deleted file mode 100644
index 8106e6a996..0000000000
--- a/tests/profiling/timelineDecoder/tests/TimelineTests.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "../TimelineCaptureCommandHandler.hpp"
-#include "../TimelineDirectoryCaptureCommandHandler.hpp"
-#include "../ITimelineDecoder.h"
-#include "../TimelineModel.h"
-#include "TimelineTestFunctions.hpp"
-
-#include <CommandHandlerFunctor.hpp>
-#include <ProfilingService.hpp>
-#include <PacketBuffer.hpp>
-#include <TimelinePacketWriterFactory.hpp>
-
-#include <boost/test/test_tools.hpp>
-#include <boost/test/unit_test_suite.hpp>
-
-BOOST_AUTO_TEST_SUITE(TimelineDecoderTests)
-
-using namespace armnn;
-
-void SendTimelinePacketToCommandHandler(const unsigned char* packetBuffer,
- profiling::CommandHandlerFunctor &CommandHandler)
-{
- uint32_t uint32_t_size = sizeof(uint32_t);
- unsigned int offset = 0;
-
- uint32_t header[2];
- header[0] = profiling::ReadUint32(packetBuffer, offset);
- offset += uint32_t_size;
- header[1] = profiling::ReadUint32(packetBuffer, offset);
- offset += uint32_t_size;
-
- uint32_t PacketDataLength = header[1] & 0x00FFFFFF;
-
- auto uniquePacketData = std::make_unique<unsigned char[]>(PacketDataLength);
- std::memcpy(uniquePacketData.get(), packetBuffer + offset, PacketDataLength);
-
- armnn::profiling::Packet packet(header[0], PacketDataLength, uniquePacketData);
-
- BOOST_CHECK(std::memcmp(packetBuffer + offset, packet.GetData(), packet.GetLength()) == 0);
-
- CommandHandler(packet);
-}
-
-BOOST_AUTO_TEST_CASE(TimelineDirectoryTest)
-{
- uint32_t uint8_t_size = sizeof(uint8_t);
- uint32_t uint32_t_size = sizeof(uint32_t);
- uint32_t uint64_t_size = sizeof(uint64_t);
- uint32_t threadId_size = sizeof(std::thread::id);
-
- profiling::BufferManager bufferManager(5);
- profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
-
- std::unique_ptr<profiling::ISendTimelinePacket> sendTimelinePacket =
- timelinePacketWriterFactory.GetSendTimelinePacket();
-
- profiling::PacketVersionResolver packetVersionResolver;
-
- gatordmock::TimelineDirectoryCaptureCommandHandler timelineDirectoryCaptureCommandHandler(
- 1, 0, packetVersionResolver.ResolvePacketVersion(1, 0).GetEncodedValue(), true);
-
- sendTimelinePacket->SendTimelineMessageDirectoryPackage();
- sendTimelinePacket->Commit();
-
- std::vector<profiling::SwTraceMessage> swTraceBufferMessages;
-
- unsigned int offset = uint32_t_size * 2;
-
- std::unique_ptr<profiling::IPacketBuffer> packetBuffer = bufferManager.GetReadableBuffer();
-
- uint8_t readStreamVersion = ReadUint8(packetBuffer, offset);
- BOOST_CHECK(readStreamVersion == 4);
- offset += uint8_t_size;
- uint8_t readPointerBytes = ReadUint8(packetBuffer, offset);
- BOOST_CHECK(readPointerBytes == uint64_t_size);
- offset += uint8_t_size;
- uint8_t readThreadIdBytes = ReadUint8(packetBuffer, offset);
- BOOST_CHECK(readThreadIdBytes == threadId_size);
- offset += uint8_t_size;
-
- uint32_t declarationSize = profiling::ReadUint32(packetBuffer, offset);
- offset += uint32_t_size;
- for(uint32_t i = 0; i < declarationSize; ++i)
- {
- swTraceBufferMessages.push_back(profiling::ReadSwTraceMessage(packetBuffer->GetReadableData(), offset));
- }
-
- SendTimelinePacketToCommandHandler(packetBuffer->GetReadableData(), timelineDirectoryCaptureCommandHandler);
-
- for(uint32_t index = 0; index < declarationSize; ++index)
- {
- profiling::SwTraceMessage& bufferMessage = swTraceBufferMessages[index];
- profiling::SwTraceMessage& handlerMessage = timelineDirectoryCaptureCommandHandler.m_SwTraceMessages[index];
-
- BOOST_CHECK(bufferMessage.m_Name == handlerMessage.m_Name);
- BOOST_CHECK(bufferMessage.m_UiName == handlerMessage.m_UiName);
- BOOST_CHECK(bufferMessage.m_Id == handlerMessage.m_Id);
-
- BOOST_CHECK(bufferMessage.m_ArgTypes.size() == handlerMessage.m_ArgTypes.size());
- for(uint32_t i = 0; i < bufferMessage.m_ArgTypes.size(); ++i)
- {
- BOOST_CHECK(bufferMessage.m_ArgTypes[i] == handlerMessage.m_ArgTypes[i]);
- }
-
- BOOST_CHECK(bufferMessage.m_ArgNames.size() == handlerMessage.m_ArgNames.size());
- for(uint32_t i = 0; i < bufferMessage.m_ArgNames.size(); ++i)
- {
- BOOST_CHECK(bufferMessage.m_ArgNames[i] == handlerMessage.m_ArgNames[i]);
- }
- }
-}
-
-BOOST_AUTO_TEST_CASE(TimelineCaptureTest)
-{
- uint32_t threadId_size = sizeof(std::thread::id);
-
- profiling::BufferManager bufferManager(50);
- profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
-
- std::unique_ptr<profiling::ISendTimelinePacket> sendTimelinePacket =
- timelinePacketWriterFactory.GetSendTimelinePacket();
-
- profiling::PacketVersionResolver packetVersionResolver;
-
- Model* modelPtr;
- CreateModel(&modelPtr);
-
- gatordmock::TimelineCaptureCommandHandler timelineCaptureCommandHandler(
- 1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), modelPtr, true);
-
- BOOST_CHECK(SetEntityCallback(PushEntity, modelPtr) == ErrorCode_Success);
- BOOST_CHECK(SetEventClassCallback(PushEventClass, modelPtr) == ErrorCode_Success);
- BOOST_CHECK(SetEventCallback(PushEvent, modelPtr) == ErrorCode_Success);
- BOOST_CHECK(SetLabelCallback(PushLabel, modelPtr) == ErrorCode_Success);
- BOOST_CHECK(SetRelationshipCallback(PushRelationship, modelPtr) == ErrorCode_Success);
-
- const uint64_t entityGuid = 22222u;
-
- const uint64_t eventClassGuid = 33333u;
-
- const uint64_t timestamp = 111111u;
- const uint64_t eventGuid = 55555u;
-
- const std::thread::id threadId = std::this_thread::get_id();;
-
- const uint64_t labelGuid = 11111u;
- std::string labelName = "test_label";
-
- const uint64_t relationshipGuid = 44444u;
- const uint64_t headGuid = 111111u;
- const uint64_t tailGuid = 222222u;
-
- for (int i = 0; i < 10; ++i)
- {
- // Send entity
- sendTimelinePacket->SendTimelineEntityBinaryPacket(entityGuid);
- sendTimelinePacket->Commit();
- SendTimelinePacketToCommandHandler(bufferManager.GetReadableBuffer()->GetReadableData(),
- timelineCaptureCommandHandler);
-
- // Send event class
- sendTimelinePacket->SendTimelineEventClassBinaryPacket(eventClassGuid);
- sendTimelinePacket->Commit();
- SendTimelinePacketToCommandHandler(bufferManager.GetReadableBuffer()->GetReadableData(),
- timelineCaptureCommandHandler);
-
- // Send event
- sendTimelinePacket->SendTimelineEventBinaryPacket(timestamp, threadId, eventGuid);
- sendTimelinePacket->Commit();
- SendTimelinePacketToCommandHandler(bufferManager.GetReadableBuffer()->GetReadableData(),
- timelineCaptureCommandHandler);
-
- // Send label
- sendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName);
- sendTimelinePacket->Commit();
- SendTimelinePacketToCommandHandler(bufferManager.GetReadableBuffer()->GetReadableData(),
- timelineCaptureCommandHandler);
-
- // Send relationship
- profiling::ProfilingRelationshipType relationshipType = profiling::ProfilingRelationshipType::DataLink;
- sendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType,
- relationshipGuid,
- headGuid,
- tailGuid);
- sendTimelinePacket->Commit();
- SendTimelinePacketToCommandHandler(bufferManager.GetReadableBuffer()->GetReadableData(),
- timelineCaptureCommandHandler);
- }
-
- for (int i = 0; i < 10; ++i)
- {
- BOOST_CHECK(modelPtr->m_Entities[i]->m_Guid == entityGuid);
-
- BOOST_CHECK(modelPtr->m_EventClasses[i]->m_Guid == eventClassGuid);
-
- BOOST_CHECK(modelPtr->m_Events[i]->m_TimeStamp == timestamp);
-
- std::vector<uint8_t> readThreadId(threadId_size, 0);
- profiling::ReadBytes(modelPtr->m_Events[i]->m_ThreadId, 0, threadId_size, readThreadId.data());
- BOOST_CHECK(readThreadId == threadId);
-
- BOOST_CHECK(modelPtr->m_Events[i]->m_Guid == eventGuid);
-
- BOOST_CHECK(modelPtr->m_Labels[i]->m_Guid == labelGuid);
- BOOST_CHECK(std::string(modelPtr->m_Labels[i]->m_Name) == labelName);
-
- BOOST_CHECK(modelPtr->m_Relationships[i]->m_RelationshipType == RelationshipType::DataLink);
- BOOST_CHECK(modelPtr->m_Relationships[i]->m_Guid == relationshipGuid);
- BOOST_CHECK(modelPtr->m_Relationships[i]->m_HeadGuid == headGuid);
- BOOST_CHECK(modelPtr->m_Relationships[i]->m_TailGuid == tailGuid);
- }
-
- DestroyModel(&modelPtr);
-}
-
-BOOST_AUTO_TEST_SUITE_END()