Ryan OShea | de36e4a | 2020-03-13 16:26:19 +0000 | [diff] [blame] | 1 | <!-- Copyright (c) 2020 ARM Limited. --> |
| 2 | <!-- --> |
| 3 | <!-- SPDX-License-Identifier: MIT --> |
| 4 | <!-- --> |
| 5 | <!-- HTML header for doxygen 1.8.13--> |
| 6 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 7 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 8 | <head> |
| 9 | <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
| 10 | <meta http-equiv="X-UA-Compatible" content="IE=9"/> |
| 11 | <meta name="generator" content="Doxygen 1.8.13"/> |
| 12 | <meta name="robots" content="NOINDEX, NOFOLLOW" /> |
| 13 | <meta name="viewport" content="width=device-width, initial-scale=1"/> |
| 14 | <title>ArmNN: src/armnn/test/ModelAccuracyCheckerTest.cpp File Reference</title> |
| 15 | <link href="tabs.css" rel="stylesheet" type="text/css"/> |
| 16 | <script type="text/javascript" src="jquery.js"></script> |
| 17 | <script type="text/javascript" src="dynsections.js"></script> |
| 18 | <link href="navtree.css" rel="stylesheet" type="text/css"/> |
| 19 | <script type="text/javascript" src="resize.js"></script> |
| 20 | <script type="text/javascript" src="navtreedata.js"></script> |
| 21 | <script type="text/javascript" src="navtree.js"></script> |
| 22 | <script type="text/javascript"> |
| 23 | $(document).ready(initResizable); |
| 24 | </script> |
| 25 | <link href="search/search.css" rel="stylesheet" type="text/css"/> |
| 26 | <script type="text/javascript" src="search/searchdata.js"></script> |
| 27 | <script type="text/javascript" src="search/search.js"></script> |
| 28 | <script type="text/x-mathjax-config"> |
| 29 | MathJax.Hub.Config({ |
| 30 | extensions: ["tex2jax.js"], |
| 31 | jax: ["input/TeX","output/HTML-CSS"], |
| 32 | }); |
| 33 | </script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script> |
| 34 | <link href="doxygen.css" rel="stylesheet" type="text/css" /> |
| 35 | <link href="stylesheet.css" rel="stylesheet" type="text/css"/> |
| 36 | </head> |
| 37 | <body> |
| 38 | <div id="top"><!-- do not remove this div, it is closed by doxygen! --> |
| 39 | <div id="titlearea"> |
| 40 | <table cellspacing="0" cellpadding="0"> |
| 41 | <tbody> |
| 42 | <tr style="height: 56px;"> |
| 43 | <img alt="ArmNN" src="Arm_NN_horizontal_blue.png" style="max-width: 10rem; margin-top: .5rem; margin-left 10px"/> |
| 44 | <td style="padding-left: 0.5em;"> |
| 45 | <div id="projectname"> |
| 46 |  <span id="projectnumber">20.02</span> |
| 47 | </div> |
| 48 | </td> |
| 49 | </tr> |
| 50 | </tbody> |
| 51 | </table> |
| 52 | </div> |
| 53 | <!-- end header part --> |
| 54 | <!-- Generated by Doxygen 1.8.13 --> |
| 55 | <script type="text/javascript"> |
| 56 | var searchBox = new SearchBox("searchBox", "search",false,'Search'); |
| 57 | </script> |
| 58 | <script type="text/javascript" src="menudata.js"></script> |
| 59 | <script type="text/javascript" src="menu.js"></script> |
| 60 | <script type="text/javascript"> |
| 61 | $(function() { |
| 62 | initMenu('',true,false,'search.php','Search'); |
| 63 | $(document).ready(function() { init_search(); }); |
| 64 | }); |
| 65 | </script> |
| 66 | <div id="main-nav"></div> |
| 67 | </div><!-- top --> |
| 68 | <div id="side-nav" class="ui-resizable side-nav-resizable"> |
| 69 | <div id="nav-tree"> |
| 70 | <div id="nav-tree-contents"> |
| 71 | <div id="nav-sync" class="sync"></div> |
| 72 | </div> |
| 73 | </div> |
| 74 | <div id="splitbar" style="-moz-user-select:none;" |
| 75 | class="ui-resizable-handle"> |
| 76 | </div> |
| 77 | </div> |
| 78 | <script type="text/javascript"> |
| 79 | $(document).ready(function(){initNavTree('_model_accuracy_checker_test_8cpp.xhtml','');}); |
| 80 | </script> |
| 81 | <div id="doc-content"> |
| 82 | <!-- window showing the filter options --> |
| 83 | <div id="MSearchSelectWindow" |
| 84 | onmouseover="return searchBox.OnSearchSelectShow()" |
| 85 | onmouseout="return searchBox.OnSearchSelectHide()" |
| 86 | onkeydown="return searchBox.OnSearchSelectKey(event)"> |
| 87 | </div> |
| 88 | |
| 89 | <!-- iframe showing the search results (closed by default) --> |
| 90 | <div id="MSearchResultsWindow"> |
| 91 | <iframe src="javascript:void(0)" frameborder="0" |
| 92 | name="MSearchResults" id="MSearchResults"> |
| 93 | </iframe> |
| 94 | </div> |
| 95 | |
| 96 | <div class="header"> |
| 97 | <div class="summary"> |
| 98 | <a href="#typedef-members">Typedefs</a> | |
| 99 | <a href="#func-members">Functions</a> </div> |
| 100 | <div class="headertitle"> |
| 101 | <div class="title">ModelAccuracyCheckerTest.cpp File Reference</div> </div> |
| 102 | </div><!--header--> |
| 103 | <div class="contents"> |
| 104 | <div class="textblock"><code>#include "<a class="el" href="_model_accuracy_checker_8hpp_source.xhtml">ModelAccuracyChecker.hpp</a>"</code><br /> |
| 105 | <code>#include <boost/algorithm/string.hpp></code><br /> |
| 106 | <code>#include <boost/test/unit_test.hpp></code><br /> |
| 107 | <code>#include <boost/filesystem.hpp></code><br /> |
| 108 | <code>#include <boost/optional.hpp></code><br /> |
| 109 | <code>#include <boost/variant.hpp></code><br /> |
| 110 | <code>#include <iostream></code><br /> |
| 111 | <code>#include <string></code><br /> |
| 112 | </div> |
| 113 | <p><a href="_model_accuracy_checker_test_8cpp_source.xhtml">Go to the source code of this file.</a></p> |
| 114 | <table class="memberdecls"> |
| 115 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> |
| 116 | Typedefs</h2></td></tr> |
| 117 | <tr class="memitem:a9eb69ebdaf4ceb8014e7c8a540266100"><td class="memItemLeft" align="right" valign="top">using </td><td class="memItemRight" valign="bottom"><a class="el" href="_model_accuracy_checker_test_8cpp.xhtml#a9eb69ebdaf4ceb8014e7c8a540266100">TContainer</a> = boost::variant< std::vector< float >, std::vector< int >, std::vector< unsigned char > ></td></tr> |
| 118 | <tr class="separator:a9eb69ebdaf4ceb8014e7c8a540266100"><td class="memSeparator" colspan="2"> </td></tr> |
| 119 | </table><table class="memberdecls"> |
| 120 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> |
| 121 | Functions</h2></td></tr> |
| 122 | <tr class="memitem:a6c84958bfa219227328e6b29df3aa3d4"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="_model_accuracy_checker_test_8cpp.xhtml#a6c84958bfa219227328e6b29df3aa3d4">BOOST_FIXTURE_TEST_CASE</a> (TestFloat32OutputTensorAccuracy, TestHelper)</td></tr> |
| 123 | <tr class="separator:a6c84958bfa219227328e6b29df3aa3d4"><td class="memSeparator" colspan="2"> </td></tr> |
| 124 | </table> |
| 125 | <h2 class="groupheader">Typedef Documentation</h2> |
| 126 | <a id="a9eb69ebdaf4ceb8014e7c8a540266100"></a> |
| 127 | <h2 class="memtitle"><span class="permalink"><a href="#a9eb69ebdaf4ceb8014e7c8a540266100">◆ </a></span>TContainer</h2> |
| 128 | |
| 129 | <div class="memitem"> |
| 130 | <div class="memproto"> |
| 131 | <table class="memname"> |
| 132 | <tr> |
| 133 | <td class="memname">using <a class="el" href="namespacearmnn.xhtml#a9eb69ebdaf4ceb8014e7c8a540266100">TContainer</a> = boost::variant<std::vector<float>, std::vector<int>, std::vector<unsigned char> ></td> |
| 134 | </tr> |
| 135 | </table> |
| 136 | </div><div class="memdoc"> |
| 137 | |
| 138 | <p class="definition">Definition at line <a class="el" href="_model_accuracy_checker_test_8cpp_source.xhtml#l00059">59</a> of file <a class="el" href="_model_accuracy_checker_test_8cpp_source.xhtml">ModelAccuracyCheckerTest.cpp</a>.</p> |
| 139 | |
| 140 | </div> |
| 141 | </div> |
| 142 | <h2 class="groupheader">Function Documentation</h2> |
| 143 | <a id="a6c84958bfa219227328e6b29df3aa3d4"></a> |
| 144 | <h2 class="memtitle"><span class="permalink"><a href="#a6c84958bfa219227328e6b29df3aa3d4">◆ </a></span>BOOST_FIXTURE_TEST_CASE()</h2> |
| 145 | |
| 146 | <div class="memitem"> |
| 147 | <div class="memproto"> |
| 148 | <table class="memname"> |
| 149 | <tr> |
| 150 | <td class="memname">BOOST_FIXTURE_TEST_CASE </td> |
| 151 | <td>(</td> |
| 152 | <td class="paramtype">TestFloat32OutputTensorAccuracy </td> |
| 153 | <td class="paramname">, </td> |
| 154 | </tr> |
| 155 | <tr> |
| 156 | <td class="paramkey"></td> |
| 157 | <td></td> |
| 158 | <td class="paramtype">TestHelper </td> |
| 159 | <td class="paramname"> </td> |
| 160 | </tr> |
| 161 | <tr> |
| 162 | <td></td> |
| 163 | <td>)</td> |
| 164 | <td></td><td></td> |
| 165 | </tr> |
| 166 | </table> |
| 167 | </div><div class="memdoc"> |
| 168 | |
| 169 | <p class="definition">Definition at line <a class="el" href="_model_accuracy_checker_test_8cpp_source.xhtml#l00061">61</a> of file <a class="el" href="_model_accuracy_checker_test_8cpp_source.xhtml">ModelAccuracyCheckerTest.cpp</a>.</p> |
| 170 | |
| 171 | <p class="reference">References <a class="el" href="_model_accuracy_checker_8hpp_source.xhtml#l00073">ModelAccuracyChecker::AddImageResult()</a>, <a class="el" href="_profiler_tests_8cpp.xhtml#af7f71af5c6c124222dd1c42c5df892f4">BOOST_AUTO_TEST_SUITE_END()</a>, <a class="el" href="_file_only_profiling_decorator_tests_8cpp.xhtml#a0c262ba6f6c189a2d092d127c1b7627b">BOOST_CHECK()</a>, and <a class="el" href="_model_accuracy_checker_8cpp_source.xhtml#l00023">ModelAccuracyChecker::GetAccuracy()</a>.</p> |
| 172 | <div class="fragment"><div class="line"><a name="l00062"></a><span class="lineno"> 62</span> {</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <a class="code" href="classarmnn_utils_1_1_model_accuracy_checker.xhtml">ModelAccuracyChecker</a> checker(GetValidationLabelSet(), GetModelOutputLabels());</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> </div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="comment">// Add image 1 and check accuracy</span></div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  std::vector<float> inferenceOutputVector1 = {0.05f, 0.10f, 0.70f, 0.15f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <a class="code" href="namespacearmnn.xhtml#a9eb69ebdaf4ceb8014e7c8a540266100">TContainer</a> inference1Container(inferenceOutputVector1);</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  std::vector<TContainer> outputTensor1;</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  outputTensor1.push_back(inference1Container);</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span> </div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  std::string imageName = <span class="stringliteral">"val_01.JPEG"</span>;</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  checker.AddImageResult<<a class="code" href="namespacearmnn.xhtml#a9eb69ebdaf4ceb8014e7c8a540266100">TContainer</a>>(imageName, outputTensor1);</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span> </div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <span class="comment">// Top 1 Accuracy</span></div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="keywordtype">float</span> totalAccuracy = checker.GetAccuracy(1);</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <a class="code" href="_file_only_profiling_decorator_tests_8cpp.xhtml#a0c262ba6f6c189a2d092d127c1b7627b">BOOST_CHECK</a>(totalAccuracy == 100.0f);</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> </div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <span class="comment">// Add image 2 and check accuracy</span></div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  std::vector<float> inferenceOutputVector2 = {0.10f, 0.0f, 0.0f, 0.0f, 0.05f, 0.70f, 0.0f, 0.0f, 0.0f, 0.15f};</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <a class="code" href="namespacearmnn.xhtml#a9eb69ebdaf4ceb8014e7c8a540266100">TContainer</a> inference2Container(inferenceOutputVector2);</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  std::vector<TContainer> outputTensor2;</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  outputTensor2.push_back(inference2Container);</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span> </div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  imageName = <span class="stringliteral">"val_02.JPEG"</span>;</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  checker.AddImageResult<<a class="code" href="namespacearmnn.xhtml#a9eb69ebdaf4ceb8014e7c8a540266100">TContainer</a>>(imageName, outputTensor2);</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span> </div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <span class="comment">// Top 1 Accuracy</span></div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  totalAccuracy = checker.GetAccuracy(1);</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  <a class="code" href="_file_only_profiling_decorator_tests_8cpp.xhtml#a0c262ba6f6c189a2d092d127c1b7627b">BOOST_CHECK</a>(totalAccuracy == 50.0f);</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span> </div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="comment">// Top 2 Accuracy</span></div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  totalAccuracy = checker.GetAccuracy(2);</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <a class="code" href="_file_only_profiling_decorator_tests_8cpp.xhtml#a0c262ba6f6c189a2d092d127c1b7627b">BOOST_CHECK</a>(totalAccuracy == 100.0f);</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span> </div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  <span class="comment">// Add image 3 and check accuracy</span></div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  std::vector<float> inferenceOutputVector3 = {0.0f, 0.10f, 0.0f, 0.0f, 0.05f, 0.70f, 0.0f, 0.0f, 0.0f, 0.15f};</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <a class="code" href="namespacearmnn.xhtml#a9eb69ebdaf4ceb8014e7c8a540266100">TContainer</a> inference3Container(inferenceOutputVector3);</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  std::vector<TContainer> outputTensor3;</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  outputTensor3.push_back(inference3Container);</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span> </div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  imageName = <span class="stringliteral">"val_03.JPEG"</span>;</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  checker.AddImageResult<<a class="code" href="namespacearmnn.xhtml#a9eb69ebdaf4ceb8014e7c8a540266100">TContainer</a>>(imageName, outputTensor3);</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span> </div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  <span class="comment">// Top 1 Accuracy</span></div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  totalAccuracy = checker.GetAccuracy(1);</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <a class="code" href="_file_only_profiling_decorator_tests_8cpp.xhtml#a0c262ba6f6c189a2d092d127c1b7627b">BOOST_CHECK</a>(totalAccuracy == 33.3333321f);</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> </div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <span class="comment">// Top 2 Accuracy</span></div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  totalAccuracy = checker.GetAccuracy(2);</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  <a class="code" href="_file_only_profiling_decorator_tests_8cpp.xhtml#a0c262ba6f6c189a2d092d127c1b7627b">BOOST_CHECK</a>(totalAccuracy == 66.6666641f);</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span> </div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  <span class="comment">// Top 3 Accuracy</span></div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  totalAccuracy = checker.GetAccuracy(3);</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  <a class="code" href="_file_only_profiling_decorator_tests_8cpp.xhtml#a0c262ba6f6c189a2d092d127c1b7627b">BOOST_CHECK</a>(totalAccuracy == 100.0f);</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span> }</div><div class="ttc" id="_file_only_profiling_decorator_tests_8cpp_xhtml_a0c262ba6f6c189a2d092d127c1b7627b"><div class="ttname"><a href="_file_only_profiling_decorator_tests_8cpp.xhtml#a0c262ba6f6c189a2d092d127c1b7627b">BOOST_CHECK</a></div><div class="ttdeci">BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)</div></div> |
| 173 | <div class="ttc" id="namespacearmnn_xhtml_a9eb69ebdaf4ceb8014e7c8a540266100"><div class="ttname"><a href="namespacearmnn.xhtml#a9eb69ebdaf4ceb8014e7c8a540266100">armnn::TContainer</a></div><div class="ttdeci">boost::variant< std::vector< float >, std::vector< int >, std::vector< unsigned char > > TContainer</div><div class="ttdef"><b>Definition:</b> <a href="_network_quantizer_8cpp_source.xhtml#l00033">NetworkQuantizer.cpp:33</a></div></div> |
| 174 | <div class="ttc" id="classarmnn_utils_1_1_model_accuracy_checker_xhtml"><div class="ttname"><a href="classarmnn_utils_1_1_model_accuracy_checker.xhtml">armnnUtils::ModelAccuracyChecker</a></div><div class="ttdef"><b>Definition:</b> <a href="_model_accuracy_checker_8hpp_source.xhtml#l00045">ModelAccuracyChecker.hpp:45</a></div></div> |
| 175 | </div><!-- fragment --> |
| 176 | </div> |
| 177 | </div> |
| 178 | </div><!-- contents --> |
| 179 | </div><!-- doc-content --> |
| 180 | <!-- start footer part --> |
| 181 | <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> |
| 182 | <ul> |
| 183 | <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.xhtml">src</a></li><li class="navelem"><a class="el" href="dir_e0a84d05c80a2ef4231141dcbbeac5c8.xhtml">armnn</a></li><li class="navelem"><a class="el" href="dir_9d86fd1fbecbedf5bdb69c7e7235fe5f.xhtml">test</a></li><li class="navelem"><a class="el" href="_model_accuracy_checker_test_8cpp.xhtml">ModelAccuracyCheckerTest.cpp</a></li> |
| 184 | <li class="footer">Generated on Fri Mar 13 2020 16:09:13 for ArmNN by |
| 185 | <a href="http://www.doxygen.org/index.html"> |
| 186 | <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li> |
| 187 | </ul> |
| 188 | </div> |
| 189 | </body> |
| 190 | </html> |