diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CaffePreprocessor.cpp | 1 | ||||
-rw-r--r-- | tests/Cifar10Database.cpp | 7 | ||||
-rw-r--r-- | tests/DeepSpeechV1Database.hpp | 9 | ||||
-rw-r--r-- | tests/DeepSpeechV1InferenceTest.hpp | 7 | ||||
-rw-r--r-- | tests/ExecuteNetwork/ExecuteNetwork.cpp | 7 | ||||
-rw-r--r-- | tests/ImageTensorGenerator/ImageTensorGenerator.cpp | 8 | ||||
-rw-r--r-- | tests/InferenceModel.hpp | 1 | ||||
-rw-r--r-- | tests/InferenceTest.cpp | 19 | ||||
-rw-r--r-- | tests/InferenceTest.hpp | 3 | ||||
-rw-r--r-- | tests/InferenceTest.inl | 16 | ||||
-rw-r--r-- | tests/MnistDatabase.cpp | 15 | ||||
-rw-r--r-- | tests/MobileNetSsdDatabase.hpp | 3 | ||||
-rw-r--r-- | tests/MobileNetSsdInferenceTest.hpp | 11 | ||||
-rw-r--r-- | tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp | 27 | ||||
-rw-r--r-- | tests/MultipleNetworksCifar10/MultipleNetworksCifar10.cpp | 17 | ||||
-rw-r--r-- | tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp | 59 | ||||
-rw-r--r-- | tests/YoloDatabase.cpp | 4 | ||||
-rw-r--r-- | tests/YoloInferenceTest.hpp | 4 |
18 files changed, 102 insertions, 116 deletions
diff --git a/tests/CaffePreprocessor.cpp b/tests/CaffePreprocessor.cpp index 7dd6e6955c..6adc75dc64 100644 --- a/tests/CaffePreprocessor.cpp +++ b/tests/CaffePreprocessor.cpp @@ -6,7 +6,6 @@ #include "CaffePreprocessor.hpp" #include <boost/numeric/conversion/cast.hpp> -#include <boost/log/trivial.hpp> #include <boost/assert.hpp> #include <boost/format.hpp> diff --git a/tests/Cifar10Database.cpp b/tests/Cifar10Database.cpp index 6ba5085b36..b0a90592d2 100644 --- a/tests/Cifar10Database.cpp +++ b/tests/Cifar10Database.cpp @@ -4,8 +4,9 @@ // #include "Cifar10Database.hpp" +#include <armnn/Logging.hpp> + #include <boost/numeric/conversion/cast.hpp> -#include <boost/log/trivial.hpp> #include <fstream> #include <vector> @@ -25,7 +26,7 @@ std::unique_ptr<Cifar10Database::TTestCaseData> Cifar10Database::GetTestCaseData std::ifstream fileStream(fullpath, std::ios::binary); if (!fileStream.is_open()) { - BOOST_LOG_TRIVIAL(fatal) << "Failed to load " << fullpath; + ARMNN_LOG(fatal) << "Failed to load " << fullpath; return nullptr; } @@ -34,7 +35,7 @@ std::unique_ptr<Cifar10Database::TTestCaseData> Cifar10Database::GetTestCaseData if (!fileStream.good()) { - BOOST_LOG_TRIVIAL(fatal) << "Failed to read " << fullpath; + ARMNN_LOG(fatal) << "Failed to read " << fullpath; return nullptr; } diff --git a/tests/DeepSpeechV1Database.hpp b/tests/DeepSpeechV1Database.hpp index 182f373fc2..a690e3fece 100644 --- a/tests/DeepSpeechV1Database.hpp +++ b/tests/DeepSpeechV1Database.hpp @@ -12,7 +12,6 @@ #include <armnn/TypesUtils.hpp> -#include <boost/log/trivial.hpp> #include <boost/numeric/conversion/cast.hpp> #include <array> @@ -39,7 +38,7 @@ std::vector<T> ParseArrayImpl(std::istream& stream, TParseElementFunc parseEleme } catch (const std::exception& e) { - BOOST_LOG_TRIVIAL(error) << "An error occurred when splitting tokens: " << e.what(); + ARMNN_LOG(error) << "An error occurred when splitting tokens: " << e.what(); continue; } for (const std::string& token : tokens) @@ -52,7 +51,7 @@ std::vector<T> ParseArrayImpl(std::istream& stream, TParseElementFunc parseEleme } catch (const std::exception&) { - BOOST_LOG_TRIVIAL(error) << "'" << token << "' is not a valid number. It has been ignored."; + ARMNN_LOG(error) << "'" << token << "' is not a valid number. It has been ignored."; } } } @@ -163,7 +162,7 @@ std::unique_ptr<DeepSpeechV1TestCaseData> DeepSpeechV1Database::GetTestCaseData( } catch (const InferenceTestImageException& e) { - BOOST_LOG_TRIVIAL(fatal) << "Failed to load image for test case " << testCaseId << ". Error: " << e.what(); + ARMNN_LOG(fatal) << "Failed to load image for test case " << testCaseId << ". Error: " << e.what(); return nullptr; } @@ -188,7 +187,7 @@ std::unique_ptr<DeepSpeechV1TestCaseData> DeepSpeechV1Database::GetTestCaseData( } catch (const InferenceTestImageException& e) { - BOOST_LOG_TRIVIAL(fatal) << "Failed to load image for test case " << testCaseId << ". Error: " << e.what(); + ARMNN_LOG(fatal) << "Failed to load image for test case " << testCaseId << ". Error: " << e.what(); return nullptr; } diff --git a/tests/DeepSpeechV1InferenceTest.hpp b/tests/DeepSpeechV1InferenceTest.hpp index 3195d2bb14..c46fa5799f 100644 --- a/tests/DeepSpeechV1InferenceTest.hpp +++ b/tests/DeepSpeechV1InferenceTest.hpp @@ -8,7 +8,6 @@ #include "DeepSpeechV1Database.hpp" #include <boost/assert.hpp> -#include <boost/log/trivial.hpp> #include <boost/numeric/conversion/cast.hpp> #include <boost/test/tools/floating_point_comparison.hpp> @@ -51,7 +50,7 @@ public: { if(!m_FloatComparer(output1[j], m_ExpectedOutputs.m_InputSeq[j])) { - BOOST_LOG_TRIVIAL(error) << "InputSeq for Lstm " << this->GetTestCaseId() << + ARMNN_LOG(error) << "InputSeq for Lstm " << this->GetTestCaseId() << " is incorrect at" << j; return TestCaseResult::Failed; } @@ -61,7 +60,7 @@ public: { if(!m_FloatComparer(output2[j], m_ExpectedOutputs.m_StateH[j])) { - BOOST_LOG_TRIVIAL(error) << "StateH for Lstm " << this->GetTestCaseId() << + ARMNN_LOG(error) << "StateH for Lstm " << this->GetTestCaseId() << " is incorrect"; return TestCaseResult::Failed; } @@ -71,7 +70,7 @@ public: { if(!m_FloatComparer(output3[j], m_ExpectedOutputs.m_StateC[j])) { - BOOST_LOG_TRIVIAL(error) << "StateC for Lstm " << this->GetTestCaseId() << + ARMNN_LOG(error) << "StateC for Lstm " << this->GetTestCaseId() << " is incorrect"; return TestCaseResult::Failed; } diff --git a/tests/ExecuteNetwork/ExecuteNetwork.cpp b/tests/ExecuteNetwork/ExecuteNetwork.cpp index 16e1fd3477..55864c8e02 100644 --- a/tests/ExecuteNetwork/ExecuteNetwork.cpp +++ b/tests/ExecuteNetwork/ExecuteNetwork.cpp @@ -15,7 +15,6 @@ int main(int argc, const char* argv[]) armnn::LogSeverity level = armnn::LogSeverity::Debug; #endif armnn::ConfigureLogging(true, true, level); - armnnUtils::ConfigureLogging(boost::log::core::get().get(), true, true, level); std::string testCasesFile; @@ -120,7 +119,7 @@ int main(int argc, const char* argv[]) // 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"); - BOOST_LOG_TRIVIAL(fatal) << "Fatal internal error: " << e.what(); + ARMNN_LOG(fatal) << "Fatal internal error: " << e.what(); return EXIT_FAILURE; } @@ -166,7 +165,7 @@ int main(int argc, const char* argv[]) // Check that the file exists. if (!boost::filesystem::exists(testCasesFile)) { - BOOST_LOG_TRIVIAL(fatal) << "Given file \"" << testCasesFile << "\" does not exist"; + ARMNN_LOG(fatal) << "Given file \"" << testCasesFile << "\" does not exist"; return EXIT_FAILURE; } @@ -177,7 +176,7 @@ int main(int argc, const char* argv[]) // Check that there is at least one test case to run if (testCases.empty()) { - BOOST_LOG_TRIVIAL(fatal) << "Given file \"" << testCasesFile << "\" has no test cases"; + ARMNN_LOG(fatal) << "Given file \"" << testCasesFile << "\" has no test cases"; return EXIT_FAILURE; } diff --git a/tests/ImageTensorGenerator/ImageTensorGenerator.cpp b/tests/ImageTensorGenerator/ImageTensorGenerator.cpp index 5bd8532cbd..4e8fe78ad8 100644 --- a/tests/ImageTensorGenerator/ImageTensorGenerator.cpp +++ b/tests/ImageTensorGenerator/ImageTensorGenerator.cpp @@ -5,12 +5,12 @@ #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/log/trivial.hpp> #include <boost/program_options.hpp> #include <boost/variant.hpp> @@ -285,7 +285,7 @@ int main(int argc, char* argv[]) } catch (const InferenceTestImageException& e) { - BOOST_LOG_TRIVIAL(fatal) << "Failed to load image file " << imagePath << " with error: " << e.what(); + ARMNN_LOG(fatal) << "Failed to load image file " << imagePath << " with error: " << e.what(); return -1; } @@ -297,7 +297,7 @@ int main(int argc, char* argv[]) imageDataContainers[0]); if (!imageTensorFile) { - BOOST_LOG_TRIVIAL(fatal) << "Failed to write to output file" << outputPath; + ARMNN_LOG(fatal) << "Failed to write to output file" << outputPath; imageTensorFile.close(); return -1; } @@ -305,7 +305,7 @@ int main(int argc, char* argv[]) } else { - BOOST_LOG_TRIVIAL(fatal) << "Failed to open output file" << outputPath; + ARMNN_LOG(fatal) << "Failed to open output file" << outputPath; return -1; } diff --git a/tests/InferenceModel.hpp b/tests/InferenceModel.hpp index 6ec63ba223..50b1607743 100644 --- a/tests/InferenceModel.hpp +++ b/tests/InferenceModel.hpp @@ -24,7 +24,6 @@ #include <boost/algorithm/string/join.hpp> #include <boost/exception/exception.hpp> #include <boost/exception/diagnostic_information.hpp> -#include <boost/log/trivial.hpp> #include <boost/format.hpp> #include <boost/program_options.hpp> #include <boost/filesystem.hpp> diff --git a/tests/InferenceTest.cpp b/tests/InferenceTest.cpp index cf97459ddc..c6e5011ae4 100644 --- a/tests/InferenceTest.cpp +++ b/tests/InferenceTest.cpp @@ -7,7 +7,6 @@ #include "../src/armnn/Profiling.hpp" #include <boost/algorithm/string.hpp> #include <boost/numeric/conversion/cast.hpp> -#include <boost/log/trivial.hpp> #include <boost/filesystem/path.hpp> #include <boost/assert.hpp> #include <boost/format.hpp> @@ -125,7 +124,7 @@ bool InferenceTest(const InferenceTestOptions& params, #if !defined (NDEBUG) if (params.m_IterationCount > 0) // If just running a few select images then don't bother to warn. { - BOOST_LOG_TRIVIAL(warning) << "Performance test running in DEBUG build - results may be inaccurate."; + ARMNN_LOG(warning) << "Performance test running in DEBUG build - results may be inaccurate."; } #endif @@ -141,7 +140,7 @@ bool InferenceTest(const InferenceTestOptions& params, inferenceTimesFile.open(params.m_InferenceTimesFile.c_str(), ios_base::trunc | ios_base::out); if (!inferenceTimesFile.good()) { - BOOST_LOG_TRIVIAL(error) << "Failed to open inference times file for writing: " + ARMNN_LOG(error) << "Failed to open inference times file for writing: " << params.m_InferenceTimesFile; return false; } @@ -158,7 +157,7 @@ bool InferenceTest(const InferenceTestOptions& params, std::unique_ptr<IInferenceTestCase> warmupTestCase = testCaseProvider.GetTestCase(0); if (warmupTestCase == nullptr) { - BOOST_LOG_TRIVIAL(error) << "Failed to load test case"; + ARMNN_LOG(error) << "Failed to load test case"; return false; } @@ -168,7 +167,7 @@ bool InferenceTest(const InferenceTestOptions& params, } catch (const TestFrameworkException& testError) { - BOOST_LOG_TRIVIAL(error) << testError.what(); + ARMNN_LOG(error) << testError.what(); return false; } @@ -182,7 +181,7 @@ bool InferenceTest(const InferenceTestOptions& params, if (testCase == nullptr) { - BOOST_LOG_TRIVIAL(error) << "Failed to load test case"; + ARMNN_LOG(error) << "Failed to load test case"; return false; } @@ -214,7 +213,7 @@ bool InferenceTest(const InferenceTestOptions& params, } catch (const TestFrameworkException& testError) { - BOOST_LOG_TRIVIAL(error) << testError.what(); + ARMNN_LOG(error) << testError.what(); result = TestCaseResult::Abort; } @@ -236,9 +235,9 @@ bool InferenceTest(const InferenceTestOptions& params, const double averageTimePerTestCaseMs = totalTime / nbProcessed * 1000.0f; - BOOST_LOG_TRIVIAL(info) << std::fixed << std::setprecision(3) << + ARMNN_LOG(info) << std::fixed << std::setprecision(3) << "Total time for " << nbProcessed << " test cases: " << totalTime << " seconds"; - BOOST_LOG_TRIVIAL(info) << std::fixed << std::setprecision(3) << + ARMNN_LOG(info) << std::fixed << std::setprecision(3) << "Average time per test case: " << averageTimePerTestCaseMs << " ms"; // if profiling is enabled print out the results @@ -249,7 +248,7 @@ bool InferenceTest(const InferenceTestOptions& params, if (!success) { - BOOST_LOG_TRIVIAL(error) << "One or more test cases failed"; + ARMNN_LOG(error) << "One or more test cases failed"; return false; } diff --git a/tests/InferenceTest.hpp b/tests/InferenceTest.hpp index f2b8c634cc..7b7dcecea0 100644 --- a/tests/InferenceTest.hpp +++ b/tests/InferenceTest.hpp @@ -5,12 +5,11 @@ #pragma once #include <armnn/ArmNN.hpp> +#include <armnn/Logging.hpp> #include <armnn/TypesUtils.hpp> #include "InferenceModel.hpp" -#include <Logging.hpp> -#include <boost/log/core/core.hpp> #include <boost/program_options.hpp> diff --git a/tests/InferenceTest.inl b/tests/InferenceTest.inl index c91193f187..fd888e2137 100644 --- a/tests/InferenceTest.inl +++ b/tests/InferenceTest.inl @@ -6,7 +6,6 @@ #include <boost/algorithm/string.hpp> #include <boost/numeric/conversion/cast.hpp> -#include <boost/log/trivial.hpp> #include <boost/filesystem/path.hpp> #include <boost/assert.hpp> #include <boost/format.hpp> @@ -121,11 +120,11 @@ TestCaseResult ClassifierTestCase<TTestCaseDatabase, TModel>::ProcessResult(cons ClassifierResultProcessor resultProcessor(m_QuantizationParams.first, m_QuantizationParams.second); boost::apply_visitor(resultProcessor, output); - BOOST_LOG_TRIVIAL(info) << "= Prediction values for test #" << testCaseId; + ARMNN_LOG(info) << "= Prediction values for test #" << testCaseId; auto it = resultProcessor.GetResultMap().rbegin(); for (int i=0; i<5 && it != resultProcessor.GetResultMap().rend(); ++i) { - BOOST_LOG_TRIVIAL(info) << "Top(" << (i+1) << ") prediction is " << it->second << + ARMNN_LOG(info) << "Top(" << (i+1) << ") prediction is " << it->second << " with value: " << (it->first); ++it; } @@ -141,7 +140,7 @@ TestCaseResult ClassifierTestCase<TTestCaseDatabase, TModel>::ProcessResult(cons // If we're just running the defaultTestCaseIds, each one must be classified correctly. if (params.m_IterationCount == 0 && prediction != m_Label) { - BOOST_LOG_TRIVIAL(error) << "Prediction for test case " << testCaseId << " (" << prediction << ")" << + ARMNN_LOG(error) << "Prediction for test case " << testCaseId << " (" << prediction << ")" << " is incorrect (should be " << m_Label << ")"; return TestCaseResult::Failed; } @@ -149,7 +148,7 @@ TestCaseResult ClassifierTestCase<TTestCaseDatabase, TModel>::ProcessResult(cons // If a validation file was provided as input, it checks that the prediction matches. if (!m_ValidationPredictions.empty() && prediction != m_ValidationPredictions[testCaseId]) { - BOOST_LOG_TRIVIAL(error) << "Prediction for test case " << testCaseId << " (" << prediction << ")" << + ARMNN_LOG(error) << "Prediction for test case " << testCaseId << " (" << prediction << ")" << " doesn't match the prediction in the validation file (" << m_ValidationPredictions[testCaseId] << ")"; return TestCaseResult::Failed; } @@ -250,7 +249,7 @@ bool ClassifierTestCaseProvider<TDatabase, InferenceModel>::OnInferenceTestFinis { const double accuracy = boost::numeric_cast<double>(m_NumCorrectInferences) / boost::numeric_cast<double>(m_NumInferences); - BOOST_LOG_TRIVIAL(info) << std::fixed << std::setprecision(3) << "Overall accuracy: " << accuracy; + 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()) @@ -265,7 +264,7 @@ bool ClassifierTestCaseProvider<TDatabase, InferenceModel>::OnInferenceTestFinis } else { - BOOST_LOG_TRIVIAL(error) << "Failed to open output validation file: " << m_ValidationFileOut; + ARMNN_LOG(error) << "Failed to open output validation file: " << m_ValidationFileOut; return false; } } @@ -310,7 +309,6 @@ int InferenceTestMain(int argc, armnn::LogSeverity level = armnn::LogSeverity::Debug; #endif armnn::ConfigureLogging(true, true, level); - armnnUtils::ConfigureLogging(boost::log::core::get().get(), true, true, level); try { @@ -331,7 +329,7 @@ int InferenceTestMain(int argc, } catch (armnn::Exception const& e) { - BOOST_LOG_TRIVIAL(fatal) << "Armnn Error: " << e.what(); + ARMNN_LOG(fatal) << "Armnn Error: " << e.what(); return 1; } } diff --git a/tests/MnistDatabase.cpp b/tests/MnistDatabase.cpp index d2fe1649f3..bd5029f841 100644 --- a/tests/MnistDatabase.cpp +++ b/tests/MnistDatabase.cpp @@ -4,8 +4,9 @@ // #include "MnistDatabase.hpp" +#include <armnn/Logging.hpp> + #include <boost/numeric/conversion/cast.hpp> -#include <boost/log/trivial.hpp> #include <boost/assert.hpp> #include <fstream> #include <vector> @@ -36,12 +37,12 @@ std::unique_ptr<MnistDatabase::TTestCaseData> MnistDatabase::GetTestCaseData(uns if (!imageStream.is_open()) { - BOOST_LOG_TRIVIAL(fatal) << "Failed to load " << imagePath; + ARMNN_LOG(fatal) << "Failed to load " << imagePath; return nullptr; } if (!labelStream.is_open()) { - BOOST_LOG_TRIVIAL(fatal) << "Failed to load " << imagePath; + ARMNN_LOG(fatal) << "Failed to load " << imagePath; return nullptr; } @@ -51,13 +52,13 @@ std::unique_ptr<MnistDatabase::TTestCaseData> MnistDatabase::GetTestCaseData(uns imageStream.read(reinterpret_cast<char*>(&magic), sizeof(magic)); if (magic != 0x03080000) { - BOOST_LOG_TRIVIAL(fatal) << "Failed to read " << imagePath; + ARMNN_LOG(fatal) << "Failed to read " << imagePath; return nullptr; } labelStream.read(reinterpret_cast<char*>(&magic), sizeof(magic)); if (magic != 0x01080000) { - BOOST_LOG_TRIVIAL(fatal) << "Failed to read " << labelPath; + ARMNN_LOG(fatal) << "Failed to read " << labelPath; return nullptr; } @@ -79,12 +80,12 @@ std::unique_ptr<MnistDatabase::TTestCaseData> MnistDatabase::GetTestCaseData(uns if (!imageStream.good()) { - BOOST_LOG_TRIVIAL(fatal) << "Failed to read " << imagePath; + ARMNN_LOG(fatal) << "Failed to read " << imagePath; return nullptr; } if (!labelStream.good()) { - BOOST_LOG_TRIVIAL(fatal) << "Failed to read " << labelPath; + ARMNN_LOG(fatal) << "Failed to read " << labelPath; return nullptr; } diff --git a/tests/MobileNetSsdDatabase.hpp b/tests/MobileNetSsdDatabase.hpp index 1a99ed715a..1921831fa3 100644 --- a/tests/MobileNetSsdDatabase.hpp +++ b/tests/MobileNetSsdDatabase.hpp @@ -12,7 +12,6 @@ #include <armnn/TypesUtils.hpp> -#include <boost/log/trivial.hpp> #include <boost/numeric/conversion/cast.hpp> #include <array> @@ -100,7 +99,7 @@ std::unique_ptr<MobileNetSsdTestCaseData> MobileNetSsdDatabase::GetTestCaseData( } catch (const InferenceTestImageException& e) { - BOOST_LOG_TRIVIAL(fatal) << "Failed to load image for test case " << testCaseId << ". Error: " << e.what(); + ARMNN_LOG(fatal) << "Failed to load image for test case " << testCaseId << ". Error: " << e.what(); return nullptr; } diff --git a/tests/MobileNetSsdInferenceTest.hpp b/tests/MobileNetSsdInferenceTest.hpp index 7beedf8a62..a950b93c1c 100644 --- a/tests/MobileNetSsdInferenceTest.hpp +++ b/tests/MobileNetSsdInferenceTest.hpp @@ -8,7 +8,6 @@ #include "MobileNetSsdDatabase.hpp" #include <boost/assert.hpp> -#include <boost/log/trivial.hpp> #include <boost/numeric/conversion/cast.hpp> #include <boost/test/tools/floating_point_comparison.hpp> @@ -52,7 +51,7 @@ public: const size_t expectedNumDetections = m_DetectedObjects.size(); if (numDetections != expectedNumDetections) { - BOOST_LOG_TRIVIAL(error) << "Number of detections is incorrect: Expected (" << + ARMNN_LOG(error) << "Number of detections is incorrect: Expected (" << expectedNumDetections << ")" << " but got (" << numDetections << ")"; return TestCaseResult::Failed; } @@ -85,7 +84,7 @@ public: { if (it == detectedObjects.end()) { - BOOST_LOG_TRIVIAL(error) << "No more detected objects found! Index out of bounds: " << i; + ARMNN_LOG(error) << "No more detected objects found! Index out of bounds: " << i; return TestCaseResult::Abort; } @@ -94,7 +93,7 @@ public: if (detectedObject.m_Class != expectedObject.m_Class) { - BOOST_LOG_TRIVIAL(error) << "Prediction for test case " << this->GetTestCaseId() << + ARMNN_LOG(error) << "Prediction for test case " << this->GetTestCaseId() << " is incorrect: Expected (" << expectedObject.m_Class << ")" << " but predicted (" << detectedObject.m_Class << ")"; return TestCaseResult::Failed; @@ -102,7 +101,7 @@ public: if(!m_FloatComparer(detectedObject.m_Confidence, expectedObject.m_Confidence)) { - BOOST_LOG_TRIVIAL(error) << "Confidence of prediction for test case " << this->GetTestCaseId() << + 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; @@ -113,7 +112,7 @@ public: !m_FloatComparer(detectedObject.m_BoundingBox.m_XMax, expectedObject.m_BoundingBox.m_XMax) || !m_FloatComparer(detectedObject.m_BoundingBox.m_YMax, expectedObject.m_BoundingBox.m_YMax)) { - BOOST_LOG_TRIVIAL(error) << "Detected bounding box for test case " << this->GetTestCaseId() << + ARMNN_LOG(error) << "Detected bounding box for test case " << this->GetTestCaseId() << " is incorrect"; return TestCaseResult::Failed; } diff --git a/tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp b/tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp index ee8e8e4d35..0d7d7689e3 100644 --- a/tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp +++ b/tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp @@ -53,7 +53,6 @@ int main(int argc, char* argv[]) using namespace boost::filesystem; armnn::LogSeverity level = armnn::LogSeverity::Debug; armnn::ConfigureLogging(true, true, level); - armnnUtils::ConfigureLogging(boost::log::core::get().get(), true, true, level); // Set-up program Options namespace po = boost::program_options; @@ -138,8 +137,8 @@ int main(int argc, char* argv[]) std::string invalidBackends; if (!CheckRequestedBackendsAreValid(computeDevice, armnn::Optional<std::string&>(invalidBackends))) { - BOOST_LOG_TRIVIAL(fatal) << "The list of preferred devices contains invalid backend IDs: " - << invalidBackends; + ARMNN_LOG(fatal) << "The list of preferred devices contains invalid backend IDs: " + << invalidBackends; return EXIT_FAILURE; } armnn::Status status; @@ -166,7 +165,7 @@ int main(int argc, char* argv[]) { std::stringstream message; message << "armnn::Exception (" << e.what() << ") caught from optimize."; - BOOST_LOG_TRIVIAL(fatal) << message.str(); + ARMNN_LOG(fatal) << message.str(); return 1; } @@ -175,7 +174,7 @@ int main(int argc, char* argv[]) status = runtime->LoadNetwork(networkId, std::move(optimizedNet)); if (status == armnn::Status::Failure) { - BOOST_LOG_TRIVIAL(fatal) << "armnn::IRuntime: Failed to load network"; + ARMNN_LOG(fatal) << "armnn::IRuntime: Failed to load network"; return 1; } @@ -200,7 +199,7 @@ int main(int argc, char* argv[]) if (modelOutputLabelsPath.empty() || !boost::filesystem::exists(modelOutputLabelsPath) || !boost::filesystem::is_regular_file(modelOutputLabelsPath)) { - BOOST_LOG_TRIVIAL(fatal) << "Invalid model output labels path at " << modelOutputLabelsPath; + ARMNN_LOG(fatal) << "Invalid model output labels path at " << modelOutputLabelsPath; } const std::vector<armnnUtils::LabelCategoryNames> modelOutputLabels = LoadModelOutputLabels(modelOutputLabelsPath); @@ -211,7 +210,7 @@ int main(int argc, char* argv[]) size_t imageEndIndex; if (imageIndexStrs.size() != 2) { - BOOST_LOG_TRIVIAL(fatal) << "Invalid validation range specification: Invalid format " << validationRange; + ARMNN_LOG(fatal) << "Invalid validation range specification: Invalid format " << validationRange; return 1; } try @@ -221,7 +220,7 @@ int main(int argc, char* argv[]) } catch (const std::exception& e) { - BOOST_LOG_TRIVIAL(fatal) << "Invalid validation range specification: " << validationRange; + ARMNN_LOG(fatal) << "Invalid validation range specification: " << validationRange; return 1; } @@ -229,7 +228,7 @@ int main(int argc, char* argv[]) if (!blacklistPath.empty() && !(boost::filesystem::exists(blacklistPath) && boost::filesystem::is_regular_file(blacklistPath))) { - BOOST_LOG_TRIVIAL(fatal) << "Invalid path to blacklist file at " << blacklistPath; + ARMNN_LOG(fatal) << "Invalid path to blacklist file at " << blacklistPath; return 1; } @@ -265,7 +264,7 @@ int main(int argc, char* argv[]) } else { - BOOST_LOG_TRIVIAL(fatal) << "Invalid Data layout: " << inputLayout; + ARMNN_LOG(fatal) << "Invalid Data layout: " << inputLayout; return 1; } const unsigned int inputTensorWidth = @@ -277,7 +276,7 @@ int main(int argc, char* argv[]) // Check output tensor shape is valid if (modelOutputLabels.size() != outputNumElements) { - BOOST_LOG_TRIVIAL(fatal) << "Number of output elements: " << outputNumElements + ARMNN_LOG(fatal) << "Number of output elements: " << outputNumElements << " , mismatches the number of output labels: " << modelOutputLabels.size(); return 1; } @@ -299,7 +298,7 @@ int main(int argc, char* argv[]) } else { - BOOST_LOG_TRIVIAL(fatal) << "Unsupported frontend: " << modelFormat; + ARMNN_LOG(fatal) << "Unsupported frontend: " << modelFormat; return 1; } const NormalizationParameters& normParams = GetNormalizationParameters(modelFrontend, inputTensorDataType); @@ -350,7 +349,7 @@ int main(int argc, char* argv[]) if (status == armnn::Status::Failure) { - BOOST_LOG_TRIVIAL(fatal) << "armnn::IRuntime: Failed to enqueue workload for image: " << imageName; + ARMNN_LOG(fatal) << "armnn::IRuntime: Failed to enqueue workload for image: " << imageName; } checker.AddImageResult<TContainer>(imageName, outputDataContainers); @@ -366,7 +365,7 @@ int main(int argc, char* argv[]) std::cout << "Top " << i << " Accuracy: " << checker.GetAccuracy(i) << "%" << "\n"; } - BOOST_LOG_TRIVIAL(info) << "Accuracy Tool ran successfully!"; + ARMNN_LOG(info) << "Accuracy Tool ran successfully!"; return 0; } catch (armnn::Exception const & e) diff --git a/tests/MultipleNetworksCifar10/MultipleNetworksCifar10.cpp b/tests/MultipleNetworksCifar10/MultipleNetworksCifar10.cpp index fec78ac805..4d45f5df01 100644 --- a/tests/MultipleNetworksCifar10/MultipleNetworksCifar10.cpp +++ b/tests/MultipleNetworksCifar10/MultipleNetworksCifar10.cpp @@ -6,7 +6,6 @@ #include <chrono> #include <vector> #include <array> -#include <boost/log/trivial.hpp> #include "armnn/ArmNN.hpp" #include "armnn/Utils.hpp" @@ -32,8 +31,6 @@ int main(int argc, char* argv[]) { // Configures logging for both the ARMNN library and this test program. armnn::ConfigureLogging(true, true, level); - armnnUtils::ConfigureLogging(boost::log::core::get().get(), true, true, level); - namespace po = boost::program_options; std::vector<armnn::BackendId> computeDevice; @@ -98,8 +95,8 @@ int main(int argc, char* argv[]) std::string invalidBackends; if (!CheckRequestedBackendsAreValid(computeDevice, armnn::Optional<std::string&>(invalidBackends))) { - BOOST_LOG_TRIVIAL(fatal) << "The list of preferred devices contains invalid backend IDs: " - << invalidBackends; + ARMNN_LOG(fatal) << "The list of preferred devices contains invalid backend IDs: " + << invalidBackends; return EXIT_FAILURE; } @@ -143,7 +140,7 @@ int main(int argc, char* argv[]) { std::stringstream message; message << "armnn::Exception ("<<e.what()<<") caught from optimize."; - BOOST_LOG_TRIVIAL(fatal) << message.str(); + ARMNN_LOG(fatal) << message.str(); return 1; } @@ -152,7 +149,7 @@ int main(int argc, char* argv[]) status = runtime->LoadNetwork(networkId, std::move(optimizedNet)); if (status == armnn::Status::Failure) { - BOOST_LOG_TRIVIAL(fatal) << "armnn::IRuntime: Failed to load network"; + ARMNN_LOG(fatal) << "armnn::IRuntime: Failed to load network"; return 1; } @@ -195,7 +192,7 @@ int main(int argc, char* argv[]) armnnUtils::MakeOutputTensors(outputBindings, outputDataContainers)); if (status == armnn::Status::Failure) { - BOOST_LOG_TRIVIAL(fatal) << "armnn::IRuntime: Failed to enqueue workload"; + ARMNN_LOG(fatal) << "armnn::IRuntime: Failed to enqueue workload"; return 1; } } @@ -209,13 +206,13 @@ int main(int argc, char* argv[]) if (!std::equal(output0.begin(), output0.end(), outputK.begin(), outputK.end())) { - BOOST_LOG_TRIVIAL(error) << "Multiple networks inference failed!"; + ARMNN_LOG(error) << "Multiple networks inference failed!"; return 1; } } } - BOOST_LOG_TRIVIAL(info) << "Multiple networks inference ran successfully!"; + ARMNN_LOG(info) << "Multiple networks inference ran successfully!"; return 0; } catch (armnn::Exception const& e) diff --git a/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp b/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp index cbdc327b0b..279bf30e83 100644 --- a/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp +++ b/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp @@ -23,7 +23,6 @@ #include "CsvReader.hpp" #include "../InferenceTest.hpp" -#include <Logging.hpp> #include <Profiling.hpp> #include <ResolveType.hpp> @@ -62,7 +61,7 @@ std::vector<T> ParseArrayImpl(std::istream& stream, TParseElementFunc parseEleme } catch (const std::exception& e) { - BOOST_LOG_TRIVIAL(error) << "An error occurred when splitting tokens: " << e.what(); + ARMNN_LOG(error) << "An error occurred when splitting tokens: " << e.what(); continue; } for (const std::string& token : tokens) @@ -75,7 +74,7 @@ std::vector<T> ParseArrayImpl(std::istream& stream, TParseElementFunc parseEleme } catch (const std::exception&) { - BOOST_LOG_TRIVIAL(error) << "'" << token << "' is not a valid number. It has been ignored."; + ARMNN_LOG(error) << "'" << token << "' is not a valid number. It has been ignored."; } } } @@ -264,7 +263,7 @@ private: } else { - BOOST_LOG_TRIVIAL(info) << "Output Tensor File: " << m_OutputTensorFile << " could not be opened!"; + ARMNN_LOG(info) << "Output Tensor File: " << m_OutputTensorFile << " could not be opened!"; } outputTensorFile.close(); } @@ -335,7 +334,7 @@ void PopulateTensorWithData(TContainer& tensorData, else { std::string errorMessage = "Unsupported tensor data type " + dataTypeStr; - BOOST_LOG_TRIVIAL(fatal) << errorMessage; + ARMNN_LOG(fatal) << errorMessage; inputTensorFile.close(); throw armnn::Exception(errorMessage); @@ -465,7 +464,7 @@ int MainImpl(const ExecuteNetworkParams& params, } else { - BOOST_LOG_TRIVIAL(fatal) << "Unsupported tensor data type \"" << params.m_OutputTypes[i] << "\". "; + ARMNN_LOG(fatal) << "Unsupported tensor data type \"" << params.m_OutputTypes[i] << "\". "; return EXIT_FAILURE; } } @@ -475,7 +474,7 @@ int MainImpl(const ExecuteNetworkParams& params, if (params.m_GenerateTensorData) { - BOOST_LOG_TRIVIAL(warning) << "The input data was generated, note that the output will not be useful"; + ARMNN_LOG(warning) << "The input data was generated, note that the output will not be useful"; } // Print output tensors @@ -489,28 +488,28 @@ int MainImpl(const ExecuteNetworkParams& params, boost::apply_visitor(printer, outputDataContainers[i]); } - BOOST_LOG_TRIVIAL(info) << "\nInference time: " << std::setprecision(2) + 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) { - BOOST_LOG_TRIVIAL(info) << "Threshold time: " << std::setprecision(2) + ARMNN_LOG(info) << "Threshold time: " << std::setprecision(2) << std::fixed << params.m_ThresholdTime << " ms"; auto thresholdMinusInference = params.m_ThresholdTime - inference_duration.count(); - BOOST_LOG_TRIVIAL(info) << "Threshold time - Inference time: " << std::setprecision(2) + ARMNN_LOG(info) << "Threshold time - Inference time: " << std::setprecision(2) << std::fixed << thresholdMinusInference << " ms" << "\n"; if (thresholdMinusInference < 0) { - BOOST_LOG_TRIVIAL(fatal) << "Elapsed inference time is greater than provided threshold time.\n"; + ARMNN_LOG(fatal) << "Elapsed inference time is greater than provided threshold time.\n"; return EXIT_FAILURE; } } } catch (armnn::Exception const& e) { - BOOST_LOG_TRIVIAL(fatal) << "Armnn Error: " << e.what(); + ARMNN_LOG(fatal) << "Armnn Error: " << e.what(); return EXIT_FAILURE; } @@ -562,27 +561,27 @@ int RunTest(const std::string& format, } else { - BOOST_LOG_TRIVIAL(fatal) << "Unknown model format: '" << modelFormat << "'. Please include 'binary' or 'text'"; + ARMNN_LOG(fatal) << "Unknown model format: '" << modelFormat << "'. Please include 'binary' or 'text'"; return EXIT_FAILURE; } if ((inputTensorShapesVector.size() != 0) && (inputTensorShapesVector.size() != inputNamesVector.size())) { - BOOST_LOG_TRIVIAL(fatal) << "input-name and input-tensor-shape must have the same amount of elements."; + 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())) { - BOOST_LOG_TRIVIAL(fatal) << "input-name and input-tensor-data must have the same amount of elements."; + 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())) { - BOOST_LOG_TRIVIAL(fatal) << "output-name and write-outputs-to-file must have the same amount of elements."; + ARMNN_LOG(fatal) << "output-name and write-outputs-to-file must have the same amount of elements."; return EXIT_FAILURE; } @@ -593,7 +592,7 @@ int RunTest(const std::string& format, } else if ((inputTypesVector.size() != 0) && (inputTypesVector.size() != inputNamesVector.size())) { - BOOST_LOG_TRIVIAL(fatal) << "input-name and input-type must have the same amount of elements."; + ARMNN_LOG(fatal) << "input-name and input-type must have the same amount of elements."; return EXIT_FAILURE; } @@ -604,7 +603,7 @@ int RunTest(const std::string& format, } else if ((outputTypesVector.size() != 0) && (outputTypesVector.size() != outputNamesVector.size())) { - BOOST_LOG_TRIVIAL(fatal) << "output-name and output-type must have the same amount of elements."; + ARMNN_LOG(fatal) << "output-name and output-type must have the same amount of elements."; return EXIT_FAILURE; } @@ -627,7 +626,7 @@ int RunTest(const std::string& format, } catch (const armnn::InvalidArgumentException& e) { - BOOST_LOG_TRIVIAL(fatal) << "Cannot create tensor shape: " << e.what(); + ARMNN_LOG(fatal) << "Cannot create tensor shape: " << e.what(); return EXIT_FAILURE; } } @@ -636,7 +635,7 @@ int RunTest(const std::string& format, // Check that threshold time is not less than zero if (thresholdTime < 0) { - BOOST_LOG_TRIVIAL(fatal) << "Threshold time supplied as a command line argument is less than zero."; + ARMNN_LOG(fatal) << "Threshold time supplied as a command line argument is less than zero."; return EXIT_FAILURE; } @@ -665,7 +664,7 @@ int RunTest(const std::string& format, // Warn if ExecuteNetwork will generate dummy input data if (params.m_GenerateTensorData) { - BOOST_LOG_TRIVIAL(warning) << "No input files provided, input tensors will be filled with 0s."; + ARMNN_LOG(warning) << "No input files provided, input tensors will be filled with 0s."; } // Forward to implementation based on the parser type @@ -674,7 +673,7 @@ int RunTest(const std::string& format, #if defined(ARMNN_SERIALIZER) return MainImpl<armnnDeserializer::IDeserializer, float>(params, runtime); #else - BOOST_LOG_TRIVIAL(fatal) << "Not built with serialization support."; + ARMNN_LOG(fatal) << "Not built with serialization support."; return EXIT_FAILURE; #endif } @@ -683,7 +682,7 @@ int RunTest(const std::string& format, #if defined(ARMNN_CAFFE_PARSER) return MainImpl<armnnCaffeParser::ICaffeParser, float>(params, runtime); #else - BOOST_LOG_TRIVIAL(fatal) << "Not built with Caffe parser support."; + ARMNN_LOG(fatal) << "Not built with Caffe parser support."; return EXIT_FAILURE; #endif } @@ -692,7 +691,7 @@ int RunTest(const std::string& format, #if defined(ARMNN_ONNX_PARSER) return MainImpl<armnnOnnxParser::IOnnxParser, float>(params, runtime); #else - BOOST_LOG_TRIVIAL(fatal) << "Not built with Onnx parser support."; + ARMNN_LOG(fatal) << "Not built with Onnx parser support."; return EXIT_FAILURE; #endif } @@ -701,7 +700,7 @@ int RunTest(const std::string& format, #if defined(ARMNN_TF_PARSER) return MainImpl<armnnTfParser::ITfParser, float>(params, runtime); #else - BOOST_LOG_TRIVIAL(fatal) << "Not built with Tensorflow parser support."; + ARMNN_LOG(fatal) << "Not built with Tensorflow parser support."; return EXIT_FAILURE; #endif } @@ -710,20 +709,20 @@ int RunTest(const std::string& format, #if defined(ARMNN_TF_LITE_PARSER) if (! isModelBinary) { - BOOST_LOG_TRIVIAL(fatal) << "Unknown model format: '" << modelFormat << "'. Only 'binary' format supported \ + 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 - BOOST_LOG_TRIVIAL(fatal) << "Unknown model format: '" << modelFormat << + ARMNN_LOG(fatal) << "Unknown model format: '" << modelFormat << "'. Please include 'caffe', 'tensorflow', 'tflite' or 'onnx'"; return EXIT_FAILURE; #endif } else { - BOOST_LOG_TRIVIAL(fatal) << "Unknown model format: '" << modelFormat << + ARMNN_LOG(fatal) << "Unknown model format: '" << modelFormat << "'. Please include 'caffe', 'tensorflow', 'tflite' or 'onnx'"; return EXIT_FAILURE; } @@ -797,7 +796,7 @@ int RunCsvTest(const armnnUtils::CsvRow &csvRow, const std::shared_ptr<armnn::IR // 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"); - BOOST_LOG_TRIVIAL(fatal) << "Fatal internal error: " << e.what(); + ARMNN_LOG(fatal) << "Fatal internal error: " << e.what(); return EXIT_FAILURE; } @@ -837,7 +836,7 @@ int RunCsvTest(const armnnUtils::CsvRow &csvRow, const std::shared_ptr<armnn::IR std::string invalidBackends; if (!CheckRequestedBackendsAreValid(computeDevices, armnn::Optional<std::string&>(invalidBackends))) { - BOOST_LOG_TRIVIAL(fatal) << "The list of preferred devices contains invalid backend IDs: " + ARMNN_LOG(fatal) << "The list of preferred devices contains invalid backend IDs: " << invalidBackends; return EXIT_FAILURE; } diff --git a/tests/YoloDatabase.cpp b/tests/YoloDatabase.cpp index 472fc8083d..98db8d4871 100644 --- a/tests/YoloDatabase.cpp +++ b/tests/YoloDatabase.cpp @@ -5,6 +5,7 @@ #include "YoloDatabase.hpp" #include <armnn/Exceptions.hpp> +#include <armnn/Logging.hpp> #include <array> #include <cstdint> @@ -13,7 +14,6 @@ #include <boost/assert.hpp> #include <boost/format.hpp> -#include <boost/log/trivial.hpp> #include <boost/numeric/conversion/cast.hpp> #include "InferenceTestImage.hpp" @@ -91,7 +91,7 @@ std::unique_ptr<YoloDatabase::TTestCaseData> YoloDatabase::GetTestCaseData(unsig } catch (const InferenceTestImageException& e) { - BOOST_LOG_TRIVIAL(fatal) << "Failed to load test case " << testCaseId << " with error: " << e.what(); + ARMNN_LOG(fatal) << "Failed to load test case " << testCaseId << " with error: " << e.what(); return nullptr; } diff --git a/tests/YoloInferenceTest.hpp b/tests/YoloInferenceTest.hpp index eb6b22767b..91ea97771c 100644 --- a/tests/YoloInferenceTest.hpp +++ b/tests/YoloInferenceTest.hpp @@ -145,7 +145,7 @@ public: const YoloDetectedObject& detectedObject = *outputIt; if (detectedObject.m_Class != expectedDetection.m_Class) { - BOOST_LOG_TRIVIAL(error) << "Prediction for test case " << this->GetTestCaseId() << + ARMNN_LOG(error) << "Prediction for test case " << this->GetTestCaseId() << " is incorrect: Expected (" << expectedDetection.m_Class << ")" << " but predicted (" << detectedObject.m_Class << ")"; return TestCaseResult::Failed; @@ -157,7 +157,7 @@ public: !m_FloatComparer(detectedObject.m_Box.m_H, expectedDetection.m_Box.m_H) || !m_FloatComparer(detectedObject.m_Confidence, expectedDetection.m_Confidence)) { - BOOST_LOG_TRIVIAL(error) << "Detected bounding box for test case " << this->GetTestCaseId() << + ARMNN_LOG(error) << "Detected bounding box for test case " << this->GetTestCaseId() << " is incorrect"; return TestCaseResult::Failed; } |