aboutsummaryrefslogtreecommitdiff
path: root/src/armnnUtils
diff options
context:
space:
mode:
authorSiCong Li <sicong.li@arm.com>2019-06-19 18:07:25 +0100
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-06-25 09:37:27 +0000
commite440329a22e03e1813ecaaa9dad34a7d9dfd446e (patch)
treee53865f9aadd224f7661d702aebf6f742fd74790 /src/armnnUtils
parent57f13d5905a1fbdc89b53d68b2bdc6b753b9e8d5 (diff)
downloadarmnn-e440329a22e03e1813ecaaa9dad34a7d9dfd446e.tar.gz
MLCE-103 Fix out-of-bound bug in ModelAccuracyChecker
* Inside method AddImageResult, the number of generated output may exceed the size of m_TopK. Limit the check to the size of m_TopK. Signed-off-by: SiCong Li <sicong.li@arm.com> Change-Id: Ic7513ca27a283ef6d098d5aa0a94b4f17ff04f66
Diffstat (limited to 'src/armnnUtils')
-rw-r--r--src/armnnUtils/ModelAccuracyChecker.hpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/armnnUtils/ModelAccuracyChecker.hpp b/src/armnnUtils/ModelAccuracyChecker.hpp
index abf994b5e1..cdd2af0ac5 100644
--- a/src/armnnUtils/ModelAccuracyChecker.hpp
+++ b/src/armnnUtils/ModelAccuracyChecker.hpp
@@ -70,13 +70,16 @@ public:
unsigned int index = 1;
for (std::pair<int, float> element : setOfPredictions)
{
- if(element.first == value)
+ if (index >= m_TopK.size())
{
- ++m_TopK[index];
- } else
+ break;
+ }
+ if (element.first == value)
{
- ++index;
+ ++m_TopK[index];
+ break;
}
+ ++index;
}
}