From 03c7ff3f6188240baaeaeb405a357a0c58195fec Mon Sep 17 00:00:00 2001 From: Nikhil Raj Date: Tue, 22 Aug 2023 12:00:04 +0100 Subject: IVGCVSW-7702 Update Doxygen Docu for 23.08 Signed-off-by: Nikhil Raj Change-Id: I357a9f7e47614589327c1ac5d95b6224ff77103d --- 23.08/_model_accuracy_checker_8cpp_source.html | 197 +++++++++++++++++++++++++ 1 file changed, 197 insertions(+) create mode 100644 23.08/_model_accuracy_checker_8cpp_source.html (limited to '23.08/_model_accuracy_checker_8cpp_source.html') diff --git a/23.08/_model_accuracy_checker_8cpp_source.html b/23.08/_model_accuracy_checker_8cpp_source.html new file mode 100644 index 0000000000..e1fac81d28 --- /dev/null +++ b/23.08/_model_accuracy_checker_8cpp_source.html @@ -0,0 +1,197 @@ + + + + + + + + +Arm NN: src/armnnUtils/ModelAccuracyChecker.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  23.08 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
ModelAccuracyChecker.cpp
+
+
+Go to the documentation of this file.
1 //
+
2 // Copyright © 2017 Arm Ltd. All rights reserved.
+
3 // SPDX-License-Identifier: MIT
+
4 //
+
5 
+ +
7 
+
8 #include <armnn/Logging.hpp>
+
9 
+
10 #include <map>
+
11 #include <vector>
+
12 
+
13 namespace armnnUtils
+
14 {
+
15 
+
16 armnnUtils::ModelAccuracyChecker::ModelAccuracyChecker(const std::map<std::string, std::string>& validationLabels,
+
17  const std::vector<LabelCategoryNames>& modelOutputLabels)
+
18  : m_GroundTruthLabelSet(validationLabels)
+
19  , m_ModelOutputLabels(modelOutputLabels)
+
20 {}
+
21 
+
22 float ModelAccuracyChecker::GetAccuracy(unsigned int k)
+
23 {
+
24  if (k > 10)
+
25  {
+
26  ARMNN_LOG(warning) << "Accuracy Tool only supports a maximum of Top 10 Accuracy. "
+
27  "Printing Top 10 Accuracy result!";
+
28  k = 10;
+
29  }
+
30  unsigned int total = 0;
+
31  for (unsigned int i = k; i > 0; --i)
+
32  {
+
33  total += m_TopK[i];
+
34  }
+
35  return static_cast<float>(total * 100) / static_cast<float>(m_ImagesProcessed);
+
36 }
+
37 
+
38 // Split a string into tokens by a delimiter
+
39 std::vector<std::string>
+
40  SplitBy(const std::string& originalString, const std::string& delimiter, bool includeEmptyToken)
+
41 {
+
42  std::vector<std::string> tokens;
+
43  size_t cur = 0;
+
44  size_t next = 0;
+
45  while ((next = originalString.find(delimiter, cur)) != std::string::npos)
+
46  {
+
47  // Skip empty tokens, unless explicitly stated to include them.
+
48  if (next - cur > 0 || includeEmptyToken)
+
49  {
+
50  tokens.push_back(originalString.substr(cur, next - cur));
+
51  }
+
52  cur = next + delimiter.size();
+
53  }
+
54  // Get the remaining token
+
55  // Skip empty tokens, unless explicitly stated to include them.
+
56  if (originalString.size() - cur > 0 || includeEmptyToken)
+
57  {
+
58  tokens.push_back(originalString.substr(cur, originalString.size() - cur));
+
59  }
+
60  return tokens;
+
61 }
+
62 
+
63 // Remove any preceding and trailing character specified in the characterSet.
+
64 std::string Strip(const std::string& originalString, const std::string& characterSet)
+
65 {
+
66  ARMNN_ASSERT(!characterSet.empty());
+
67  const std::size_t firstFound = originalString.find_first_not_of(characterSet);
+
68  const std::size_t lastFound = originalString.find_last_not_of(characterSet);
+
69  // Return empty if the originalString is empty or the originalString contains only to-be-striped characters
+
70  if (firstFound == std::string::npos || lastFound == std::string::npos)
+
71  {
+
72  return "";
+
73  }
+
74  return originalString.substr(firstFound, lastFound + 1 - firstFound);
+
75 }
+
76 } // namespace armnnUtils
+
+
+
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
+
#define ARMNN_LOG(severity)
Definition: Logging.hpp:212
+ + + +
ModelAccuracyChecker(const std::map< std::string, std::string > &validationLabelSet, const std::vector< LabelCategoryNames > &modelOutputLabels)
Constructor for a model top k accuracy checker.
+
std::string Strip(const std::string &originalString, const std::string &characterSet)
Remove any preceding and trailing character specified in the characterSet.
+
float GetAccuracy(unsigned int k)
Get Top K accuracy.
+ +
std::vector< std::string > SplitBy(const std::string &originalString, const std::string &delimiter, bool includeEmptyToken)
Split a string into tokens by a delimiter.
+ + + + -- cgit v1.2.1