Ryan OShea | de36e4a | 2020-03-13 16:26:19 +0000 | [diff] [blame] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
| 5 | <meta http-equiv="X-UA-Compatible" content="IE=9"/> |
| 6 | <meta name="generator" content="Doxygen 1.8.13"/> |
| 7 | <meta name="viewport" content="width=device-width, initial-scale=1"/> |
| 8 | <title>ArmNN: tests/ImageTensorGenerator/ImageTensorGenerator.hpp File Reference</title> |
| 9 | <link href="tabs.css" rel="stylesheet" type="text/css"/> |
| 10 | <script type="text/javascript" src="jquery.js"></script> |
| 11 | <script type="text/javascript" src="dynsections.js"></script> |
| 12 | <link href="navtree.css" rel="stylesheet" type="text/css"/> |
| 13 | <script type="text/javascript" src="resize.js"></script> |
| 14 | <script type="text/javascript" src="navtreedata.js"></script> |
| 15 | <script type="text/javascript" src="navtree.js"></script> |
| 16 | <script type="text/javascript"> |
| 17 | $(document).ready(initResizable); |
| 18 | </script> |
| 19 | <link href="search/search.css" rel="stylesheet" type="text/css"/> |
| 20 | <script type="text/javascript" src="search/searchdata.js"></script> |
| 21 | <script type="text/javascript" src="search/search.js"></script> |
| 22 | <link href="doxygen.css" rel="stylesheet" type="text/css" /> |
| 23 | </head> |
| 24 | <body> |
| 25 | <div id="top"><!-- do not remove this div, it is closed by doxygen! --> |
| 26 | <div id="titlearea"> |
| 27 | <table cellspacing="0" cellpadding="0"> |
| 28 | <tbody> |
| 29 | <tr style="height: 56px;"> |
| 30 | <td id="projectalign" style="padding-left: 0.5em;"> |
| 31 | <div id="projectname">ArmNN |
| 32 |  <span id="projectnumber">NotReleased</span> |
| 33 | </div> |
| 34 | </td> |
| 35 | </tr> |
| 36 | </tbody> |
| 37 | </table> |
| 38 | </div> |
| 39 | <!-- end header part --> |
| 40 | <!-- Generated by Doxygen 1.8.13 --> |
| 41 | <script type="text/javascript"> |
| 42 | var searchBox = new SearchBox("searchBox", "search",false,'Search'); |
| 43 | </script> |
| 44 | <script type="text/javascript" src="menudata.js"></script> |
| 45 | <script type="text/javascript" src="menu.js"></script> |
| 46 | <script type="text/javascript"> |
| 47 | $(function() { |
| 48 | initMenu('',true,false,'search.php','Search'); |
| 49 | $(document).ready(function() { init_search(); }); |
| 50 | }); |
| 51 | </script> |
| 52 | <div id="main-nav"></div> |
| 53 | </div><!-- top --> |
| 54 | <div id="side-nav" class="ui-resizable side-nav-resizable"> |
| 55 | <div id="nav-tree"> |
| 56 | <div id="nav-tree-contents"> |
| 57 | <div id="nav-sync" class="sync"></div> |
| 58 | </div> |
| 59 | </div> |
| 60 | <div id="splitbar" style="-moz-user-select:none;" |
| 61 | class="ui-resizable-handle"> |
| 62 | </div> |
| 63 | </div> |
| 64 | <script type="text/javascript"> |
| 65 | $(document).ready(function(){initNavTree('_image_tensor_generator_8hpp.html','');}); |
| 66 | </script> |
| 67 | <div id="doc-content"> |
| 68 | <!-- window showing the filter options --> |
| 69 | <div id="MSearchSelectWindow" |
| 70 | onmouseover="return searchBox.OnSearchSelectShow()" |
| 71 | onmouseout="return searchBox.OnSearchSelectHide()" |
| 72 | onkeydown="return searchBox.OnSearchSelectKey(event)"> |
| 73 | </div> |
| 74 | |
| 75 | <!-- iframe showing the search results (closed by default) --> |
| 76 | <div id="MSearchResultsWindow"> |
| 77 | <iframe src="javascript:void(0)" frameborder="0" |
| 78 | name="MSearchResults" id="MSearchResults"> |
| 79 | </iframe> |
| 80 | </div> |
| 81 | |
| 82 | <div class="header"> |
| 83 | <div class="summary"> |
| 84 | <a href="#nested-classes">Classes</a> | |
| 85 | <a href="#enum-members">Enumerations</a> | |
| 86 | <a href="#func-members">Functions</a> </div> |
| 87 | <div class="headertitle"> |
| 88 | <div class="title">ImageTensorGenerator.hpp File Reference</div> </div> |
| 89 | </div><!--header--> |
| 90 | <div class="contents"> |
| 91 | <div class="textblock"><code>#include "<a class="el" href="_inference_test_image_8hpp_source.html">../InferenceTestImage.hpp</a>"</code><br /> |
| 92 | <code>#include <<a class="el" href="_types_utils_8hpp_source.html">armnn/TypesUtils.hpp</a>></code><br /> |
| 93 | <code>#include <<a class="el" href="_permute_8hpp_source.html">armnnUtils/Permute.hpp</a>></code><br /> |
| 94 | <code>#include <algorithm></code><br /> |
| 95 | <code>#include <fstream></code><br /> |
| 96 | <code>#include <iterator></code><br /> |
| 97 | <code>#include <string></code><br /> |
| 98 | </div> |
| 99 | <p><a href="_image_tensor_generator_8hpp_source.html">Go to the source code of this file.</a></p> |
| 100 | <table class="memberdecls"> |
| 101 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> |
| 102 | Classes</h2></td></tr> |
| 103 | <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_normalization_parameters.html">NormalizationParameters</a></td></tr> |
| 104 | <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> |
| 105 | </table><table class="memberdecls"> |
| 106 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a> |
| 107 | Enumerations</h2></td></tr> |
| 108 | <tr class="memitem:a7599848540a5f43e977119c054b3563e"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563e">SupportedFrontend</a> { <a class="el" href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563ea4df6064eb76f848def300474b7aef0da">Caffe</a> = 0, |
| 109 | <a class="el" href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563ea074dd699710da0ec1eb45f13b31788e3">TensorFlow</a> = 1, |
| 110 | <a class="el" href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563ea35120628a2097980f88fd49246124cae">TFLite</a> = 2 |
| 111 | }</td></tr> |
| 112 | <tr class="separator:a7599848540a5f43e977119c054b3563e"><td class="memSeparator" colspan="2"> </td></tr> |
| 113 | </table><table class="memberdecls"> |
| 114 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> |
| 115 | Functions</h2></td></tr> |
| 116 | <tr class="memitem:a572494250ece8d94b68ea490d0bf46e4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_normalization_parameters.html">NormalizationParameters</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="_image_tensor_generator_8hpp.html#a572494250ece8d94b68ea490d0bf46e4">GetNormalizationParameters</a> (const <a class="el" href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563e">SupportedFrontend</a> &modelFormat, const <a class="el" href="namespacearmnn.html#ad8ed01ff3ff33333d8e19db4d2818bb6">armnn::DataType</a> &outputType)</td></tr> |
| 117 | <tr class="separator:a572494250ece8d94b68ea490d0bf46e4"><td class="memSeparator" colspan="2"> </td></tr> |
| 118 | <tr class="memitem:af39456ac4838301c6fc5b44d6a57479c"><td class="memTemplParams" colspan="2">template<typename ElemType > </td></tr> |
| 119 | <tr class="memitem:af39456ac4838301c6fc5b44d6a57479c"><td class="memTemplItemLeft" align="right" valign="top">std::vector< ElemType > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="_image_tensor_generator_8hpp.html#af39456ac4838301c6fc5b44d6a57479c">PrepareImageTensor</a> (const std::string &imagePath, unsigned int newWidth, unsigned int newHeight, const <a class="el" href="struct_normalization_parameters.html">NormalizationParameters</a> &normParams, unsigned int batchSize=1, const <a class="el" href="namespacearmnn.html#ad1d5cce2d9e9a5d61c243e5c989112e0">armnn::DataLayout</a> &outputLayout=<a class="el" href="namespacearmnn.html#ad1d5cce2d9e9a5d61c243e5c989112e0ad066db54b89b0912e7e7c6da51e2da51">armnn::DataLayout::NHWC</a>)</td></tr> |
| 120 | <tr class="separator:af39456ac4838301c6fc5b44d6a57479c"><td class="memSeparator" colspan="2"> </td></tr> |
| 121 | <tr class="memitem:affacfe95f011fce3b897b2745880f82a"><td class="memTemplParams" colspan="2">template<> </td></tr> |
| 122 | <tr class="memitem:affacfe95f011fce3b897b2745880f82a"><td class="memTemplItemLeft" align="right" valign="top">std::vector< float > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="_image_tensor_generator_8hpp.html#affacfe95f011fce3b897b2745880f82a">PrepareImageTensor< float ></a> (const std::string &imagePath, unsigned int newWidth, unsigned int newHeight, const <a class="el" href="struct_normalization_parameters.html">NormalizationParameters</a> &normParams, unsigned int batchSize, const <a class="el" href="namespacearmnn.html#ad1d5cce2d9e9a5d61c243e5c989112e0">armnn::DataLayout</a> &outputLayout)</td></tr> |
| 123 | <tr class="separator:affacfe95f011fce3b897b2745880f82a"><td class="memSeparator" colspan="2"> </td></tr> |
| 124 | <tr class="memitem:ac1e8e68c74e5d1c8fd19a91a68de3cb7"><td class="memTemplParams" colspan="2">template<> </td></tr> |
| 125 | <tr class="memitem:ac1e8e68c74e5d1c8fd19a91a68de3cb7"><td class="memTemplItemLeft" align="right" valign="top">std::vector< int > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="_image_tensor_generator_8hpp.html#ac1e8e68c74e5d1c8fd19a91a68de3cb7">PrepareImageTensor< int ></a> (const std::string &imagePath, unsigned int newWidth, unsigned int newHeight, const <a class="el" href="struct_normalization_parameters.html">NormalizationParameters</a> &normParams, unsigned int batchSize, const <a class="el" href="namespacearmnn.html#ad1d5cce2d9e9a5d61c243e5c989112e0">armnn::DataLayout</a> &outputLayout)</td></tr> |
| 126 | <tr class="separator:ac1e8e68c74e5d1c8fd19a91a68de3cb7"><td class="memSeparator" colspan="2"> </td></tr> |
| 127 | <tr class="memitem:ac372cd2b257f33f29999217e1d2d8a37"><td class="memTemplParams" colspan="2">template<> </td></tr> |
| 128 | <tr class="memitem:ac372cd2b257f33f29999217e1d2d8a37"><td class="memTemplItemLeft" align="right" valign="top">std::vector< uint8_t > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="_image_tensor_generator_8hpp.html#ac372cd2b257f33f29999217e1d2d8a37">PrepareImageTensor< uint8_t ></a> (const std::string &imagePath, unsigned int newWidth, unsigned int newHeight, const <a class="el" href="struct_normalization_parameters.html">NormalizationParameters</a> &normParams, unsigned int batchSize, const <a class="el" href="namespacearmnn.html#ad1d5cce2d9e9a5d61c243e5c989112e0">armnn::DataLayout</a> &outputLayout)</td></tr> |
| 129 | <tr class="separator:ac372cd2b257f33f29999217e1d2d8a37"><td class="memSeparator" colspan="2"> </td></tr> |
| 130 | <tr class="memitem:a292c4c49fc943bfcb7ee1ce1435d4690"><td class="memTemplParams" colspan="2">template<typename ElemType > </td></tr> |
| 131 | <tr class="memitem:a292c4c49fc943bfcb7ee1ce1435d4690"><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="_image_tensor_generator_8hpp.html#a292c4c49fc943bfcb7ee1ce1435d4690">WriteImageTensorImpl</a> (const std::vector< ElemType > &imageData, std::ofstream &imageTensorFile)</td></tr> |
| 132 | <tr class="separator:a292c4c49fc943bfcb7ee1ce1435d4690"><td class="memSeparator" colspan="2"> </td></tr> |
| 133 | <tr class="memitem:a2120283536d91fbdee0d19fff3156994"><td class="memTemplParams" colspan="2">template<> </td></tr> |
| 134 | <tr class="memitem:a2120283536d91fbdee0d19fff3156994"><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="_image_tensor_generator_8hpp.html#a2120283536d91fbdee0d19fff3156994">WriteImageTensorImpl< uint8_t ></a> (const std::vector< uint8_t > &imageData, std::ofstream &imageTensorFile)</td></tr> |
| 135 | <tr class="separator:a2120283536d91fbdee0d19fff3156994"><td class="memSeparator" colspan="2"> </td></tr> |
| 136 | </table> |
| 137 | <h2 class="groupheader">Enumeration Type Documentation</h2> |
| 138 | <a id="a7599848540a5f43e977119c054b3563e"></a> |
| 139 | <h2 class="memtitle"><span class="permalink"><a href="#a7599848540a5f43e977119c054b3563e">◆ </a></span>SupportedFrontend</h2> |
| 140 | |
| 141 | <div class="memitem"> |
| 142 | <div class="memproto"> |
| 143 | <table class="mlabels"> |
| 144 | <tr> |
| 145 | <td class="mlabels-left"> |
| 146 | <table class="memname"> |
| 147 | <tr> |
| 148 | <td class="memname">enum <a class="el" href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563e">SupportedFrontend</a></td> |
| 149 | </tr> |
| 150 | </table> |
| 151 | </td> |
| 152 | <td class="mlabels-right"> |
| 153 | <span class="mlabels"><span class="mlabel">strong</span></span> </td> |
| 154 | </tr> |
| 155 | </table> |
| 156 | </div><div class="memdoc"> |
| 157 | <table class="fieldtable"> |
| 158 | <tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="a7599848540a5f43e977119c054b3563ea4df6064eb76f848def300474b7aef0da"></a>Caffe </td><td class="fielddoc"></td></tr> |
| 159 | <tr><td class="fieldname"><a id="a7599848540a5f43e977119c054b3563ea074dd699710da0ec1eb45f13b31788e3"></a>TensorFlow </td><td class="fielddoc"></td></tr> |
| 160 | <tr><td class="fieldname"><a id="a7599848540a5f43e977119c054b3563ea35120628a2097980f88fd49246124cae"></a>TFLite </td><td class="fielddoc"></td></tr> |
| 161 | </table> |
| 162 | |
| 163 | <p class="definition">Definition at line <a class="el" href="_image_tensor_generator_8hpp_source.html#l00025">25</a> of file <a class="el" href="_image_tensor_generator_8hpp_source.html">ImageTensorGenerator.hpp</a>.</p> |
| 164 | <div class="fragment"><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> {</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  <a class="code" href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563ea4df6064eb76f848def300474b7aef0da">Caffe</a> = 0,</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  <a class="code" href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563ea074dd699710da0ec1eb45f13b31788e3">TensorFlow</a> = 1,</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  <a class="code" href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563ea35120628a2097980f88fd49246124cae">TFLite</a> = 2,</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> };</div><div class="ttc" id="_image_tensor_generator_8hpp_html_a7599848540a5f43e977119c054b3563ea35120628a2097980f88fd49246124cae"><div class="ttname"><a href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563ea35120628a2097980f88fd49246124cae">SupportedFrontend::TFLite</a></div></div> |
| 165 | <div class="ttc" id="_image_tensor_generator_8hpp_html_a7599848540a5f43e977119c054b3563ea074dd699710da0ec1eb45f13b31788e3"><div class="ttname"><a href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563ea074dd699710da0ec1eb45f13b31788e3">SupportedFrontend::TensorFlow</a></div></div> |
| 166 | <div class="ttc" id="_image_tensor_generator_8hpp_html_a7599848540a5f43e977119c054b3563ea4df6064eb76f848def300474b7aef0da"><div class="ttname"><a href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563ea4df6064eb76f848def300474b7aef0da">SupportedFrontend::Caffe</a></div></div> |
| 167 | </div><!-- fragment --> |
| 168 | </div> |
| 169 | </div> |
| 170 | <h2 class="groupheader">Function Documentation</h2> |
| 171 | <a id="a572494250ece8d94b68ea490d0bf46e4"></a> |
| 172 | <h2 class="memtitle"><span class="permalink"><a href="#a572494250ece8d94b68ea490d0bf46e4">◆ </a></span>GetNormalizationParameters()</h2> |
| 173 | |
| 174 | <div class="memitem"> |
| 175 | <div class="memproto"> |
| 176 | <table class="memname"> |
| 177 | <tr> |
| 178 | <td class="memname"><a class="el" href="struct_normalization_parameters.html">NormalizationParameters</a> GetNormalizationParameters </td> |
| 179 | <td>(</td> |
| 180 | <td class="paramtype">const <a class="el" href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563e">SupportedFrontend</a> & </td> |
| 181 | <td class="paramname"><em>modelFormat</em>, </td> |
| 182 | </tr> |
| 183 | <tr> |
| 184 | <td class="paramkey"></td> |
| 185 | <td></td> |
| 186 | <td class="paramtype">const <a class="el" href="namespacearmnn.html#ad8ed01ff3ff33333d8e19db4d2818bb6">armnn::DataType</a> & </td> |
| 187 | <td class="paramname"><em>outputType</em> </td> |
| 188 | </tr> |
| 189 | <tr> |
| 190 | <td></td> |
| 191 | <td>)</td> |
| 192 | <td></td><td></td> |
| 193 | </tr> |
| 194 | </table> |
| 195 | </div><div class="memdoc"> |
| 196 | <p>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</p> |
| 197 | <dl class="params"><dt>Parameters</dt><dd> |
| 198 | <table class="params"> |
| 199 | <tr><td class="paramdir">[in]</td><td class="paramname">modelFormat</td><td>One of the supported frontends </td></tr> |
| 200 | <tr><td class="paramdir">[in]</td><td class="paramname">outputType</td><td>Output type of the image tensor, also the type of the intended model </td></tr> |
| 201 | </table> |
| 202 | </dd> |
| 203 | </dl> |
| 204 | |
| 205 | <p class="definition">Definition at line <a class="el" href="_image_tensor_generator_8hpp_source.html#l00039">39</a> of file <a class="el" href="_image_tensor_generator_8hpp_source.html">ImageTensorGenerator.hpp</a>.</p> |
| 206 | |
| 207 | <p class="reference">References <a class="el" href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563ea4df6064eb76f848def300474b7aef0da">Caffe</a>, <a class="el" href="namespacearmnn.html#ad8ed01ff3ff33333d8e19db4d2818bb6a166495adc0d0f53bee6baecc577f5204">armnn::Float32</a>, <a class="el" href="_image_tensor_generator_8hpp_source.html#l00021">NormalizationParameters::mean</a>, <a class="el" href="namespacearmnn.html#ad1d5cce2d9e9a5d61c243e5c989112e0ad066db54b89b0912e7e7c6da51e2da51">armnn::NHWC</a>, <a class="el" href="_image_tensor_generator_8hpp.html#af39456ac4838301c6fc5b44d6a57479c">PrepareImageTensor()</a>, <a class="el" href="namespacearmnn.html#ad8ed01ff3ff33333d8e19db4d2818bb6a0a3f57c876f5a230244c38e1453a8a6e">armnn::QAsymmU8</a>, <a class="el" href="_image_tensor_generator_8hpp_source.html#l00020">NormalizationParameters::scale</a>, <a class="el" href="namespacearmnn.html#ad8ed01ff3ff33333d8e19db4d2818bb6accedffbc6e5308e33d3843e8bdc0dad7">armnn::Signed32</a>, <a class="el" href="_image_tensor_generator_8hpp_source.html#l00022">NormalizationParameters::stddev</a>, <a class="el" href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563ea074dd699710da0ec1eb45f13b31788e3">TensorFlow</a>, and <a class="el" href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563ea35120628a2097980f88fd49246124cae">TFLite</a>.</p> |
| 208 | |
| 209 | <p class="reference">Referenced by <a class="el" href="_image_tensor_generator_8cpp_source.html#l00248">main()</a>.</p> |
| 210 | <div class="fragment"><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> {</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <a class="code" href="struct_normalization_parameters.html">NormalizationParameters</a> normParams;</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <span class="comment">// Explicitly set default parameters</span></div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  normParams.<a class="code" href="struct_normalization_parameters.html#a1d28dec57cce925ad92342891bd71e7c">scale</a> = 1.0;</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  normParams.<a class="code" href="struct_normalization_parameters.html#a6e5ac6f9d3272e6670522daaacc04442">mean</a> = { 0.0, 0.0, 0.0 };</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  normParams.<a class="code" href="struct_normalization_parameters.html#a8fdb461f0b4417f4ebff10b3413a948d">stddev</a> = { 1.0, 1.0, 1.0 };</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <span class="keywordflow">switch</span> (modelFormat)</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  {</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="keywordflow">case</span> <a class="code" href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563ea4df6064eb76f848def300474b7aef0da">SupportedFrontend::Caffe</a>:</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="keywordflow">case</span> <a class="code" href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563ea074dd699710da0ec1eb45f13b31788e3">SupportedFrontend::TensorFlow</a>:</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <span class="keywordflow">case</span> <a class="code" href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563ea35120628a2097980f88fd49246124cae">SupportedFrontend::TFLite</a>:</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <span class="keywordflow">default</span>:</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <span class="keywordflow">switch</span> (outputType)</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  {</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keywordflow">case</span> <a class="code" href="namespacearmnn.html#ad8ed01ff3ff33333d8e19db4d2818bb6a166495adc0d0f53bee6baecc577f5204">armnn::DataType::Float32</a>:</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  normParams.<a class="code" href="struct_normalization_parameters.html#a1d28dec57cce925ad92342891bd71e7c">scale</a> = 127.5;</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  normParams.<a class="code" href="struct_normalization_parameters.html#a6e5ac6f9d3272e6670522daaacc04442">mean</a> = { 1.0, 1.0, 1.0 };</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="keywordflow">case</span> <a class="code" href="namespacearmnn.html#ad8ed01ff3ff33333d8e19db4d2818bb6accedffbc6e5308e33d3843e8bdc0dad7">armnn::DataType::Signed32</a>:</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  normParams.<a class="code" href="struct_normalization_parameters.html#a6e5ac6f9d3272e6670522daaacc04442">mean</a> = { 128.0, 128.0, 128.0 };</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="keywordflow">case</span> <a class="code" href="namespacearmnn.html#ad8ed01ff3ff33333d8e19db4d2818bb6a0a3f57c876f5a230244c38e1453a8a6e">armnn::DataType::QAsymmU8</a>:</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="keywordflow">default</span>:</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  }</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  }</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <span class="keywordflow">return</span> normParams;</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span> }</div><div class="ttc" id="namespacearmnn_html_ad8ed01ff3ff33333d8e19db4d2818bb6a0a3f57c876f5a230244c38e1453a8a6e"><div class="ttname"><a href="namespacearmnn.html#ad8ed01ff3ff33333d8e19db4d2818bb6a0a3f57c876f5a230244c38e1453a8a6e">armnn::DataType::QAsymmU8</a></div></div> |
| 211 | <div class="ttc" id="struct_normalization_parameters_html_a6e5ac6f9d3272e6670522daaacc04442"><div class="ttname"><a href="struct_normalization_parameters.html#a6e5ac6f9d3272e6670522daaacc04442">NormalizationParameters::mean</a></div><div class="ttdeci">std::array< float, 3 > mean</div><div class="ttdef"><b>Definition:</b> <a href="_image_tensor_generator_8hpp_source.html#l00021">ImageTensorGenerator.hpp:21</a></div></div> |
| 212 | <div class="ttc" id="_image_tensor_generator_8hpp_html_a7599848540a5f43e977119c054b3563ea35120628a2097980f88fd49246124cae"><div class="ttname"><a href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563ea35120628a2097980f88fd49246124cae">SupportedFrontend::TFLite</a></div></div> |
| 213 | <div class="ttc" id="namespacearmnn_html_ad8ed01ff3ff33333d8e19db4d2818bb6a166495adc0d0f53bee6baecc577f5204"><div class="ttname"><a href="namespacearmnn.html#ad8ed01ff3ff33333d8e19db4d2818bb6a166495adc0d0f53bee6baecc577f5204">armnn::DataType::Float32</a></div></div> |
| 214 | <div class="ttc" id="struct_normalization_parameters_html_a1d28dec57cce925ad92342891bd71e7c"><div class="ttname"><a href="struct_normalization_parameters.html#a1d28dec57cce925ad92342891bd71e7c">NormalizationParameters::scale</a></div><div class="ttdeci">float scale</div><div class="ttdef"><b>Definition:</b> <a href="_image_tensor_generator_8hpp_source.html#l00020">ImageTensorGenerator.hpp:20</a></div></div> |
| 215 | <div class="ttc" id="_image_tensor_generator_8hpp_html_a7599848540a5f43e977119c054b3563ea074dd699710da0ec1eb45f13b31788e3"><div class="ttname"><a href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563ea074dd699710da0ec1eb45f13b31788e3">SupportedFrontend::TensorFlow</a></div></div> |
| 216 | <div class="ttc" id="struct_normalization_parameters_html_a8fdb461f0b4417f4ebff10b3413a948d"><div class="ttname"><a href="struct_normalization_parameters.html#a8fdb461f0b4417f4ebff10b3413a948d">NormalizationParameters::stddev</a></div><div class="ttdeci">std::array< float, 3 > stddev</div><div class="ttdef"><b>Definition:</b> <a href="_image_tensor_generator_8hpp_source.html#l00022">ImageTensorGenerator.hpp:22</a></div></div> |
| 217 | <div class="ttc" id="namespacearmnn_html_ad8ed01ff3ff33333d8e19db4d2818bb6accedffbc6e5308e33d3843e8bdc0dad7"><div class="ttname"><a href="namespacearmnn.html#ad8ed01ff3ff33333d8e19db4d2818bb6accedffbc6e5308e33d3843e8bdc0dad7">armnn::DataType::Signed32</a></div></div> |
| 218 | <div class="ttc" id="struct_normalization_parameters_html"><div class="ttname"><a href="struct_normalization_parameters.html">NormalizationParameters</a></div><div class="ttdef"><b>Definition:</b> <a href="_image_tensor_generator_8hpp_source.html#l00018">ImageTensorGenerator.hpp:18</a></div></div> |
| 219 | <div class="ttc" id="_image_tensor_generator_8hpp_html_a7599848540a5f43e977119c054b3563ea4df6064eb76f848def300474b7aef0da"><div class="ttname"><a href="_image_tensor_generator_8hpp.html#a7599848540a5f43e977119c054b3563ea4df6064eb76f848def300474b7aef0da">SupportedFrontend::Caffe</a></div></div> |
| 220 | </div><!-- fragment --> |
| 221 | </div> |
| 222 | </div> |
| 223 | <a id="af39456ac4838301c6fc5b44d6a57479c"></a> |
| 224 | <h2 class="memtitle"><span class="permalink"><a href="#af39456ac4838301c6fc5b44d6a57479c">◆ </a></span>PrepareImageTensor()</h2> |
| 225 | |
| 226 | <div class="memitem"> |
| 227 | <div class="memproto"> |
| 228 | <table class="memname"> |
| 229 | <tr> |
| 230 | <td class="memname">std::vector<ElemType> PrepareImageTensor </td> |
| 231 | <td>(</td> |
| 232 | <td class="paramtype">const std::string & </td> |
| 233 | <td class="paramname"><em>imagePath</em>, </td> |
| 234 | </tr> |
| 235 | <tr> |
| 236 | <td class="paramkey"></td> |
| 237 | <td></td> |
| 238 | <td class="paramtype">unsigned int </td> |
| 239 | <td class="paramname"><em>newWidth</em>, </td> |
| 240 | </tr> |
| 241 | <tr> |
| 242 | <td class="paramkey"></td> |
| 243 | <td></td> |
| 244 | <td class="paramtype">unsigned int </td> |
| 245 | <td class="paramname"><em>newHeight</em>, </td> |
| 246 | </tr> |
| 247 | <tr> |
| 248 | <td class="paramkey"></td> |
| 249 | <td></td> |
| 250 | <td class="paramtype">const <a class="el" href="struct_normalization_parameters.html">NormalizationParameters</a> & </td> |
| 251 | <td class="paramname"><em>normParams</em>, </td> |
| 252 | </tr> |
| 253 | <tr> |
| 254 | <td class="paramkey"></td> |
| 255 | <td></td> |
| 256 | <td class="paramtype">unsigned int </td> |
| 257 | <td class="paramname"><em>batchSize</em> = <code>1</code>, </td> |
| 258 | </tr> |
| 259 | <tr> |
| 260 | <td class="paramkey"></td> |
| 261 | <td></td> |
| 262 | <td class="paramtype">const <a class="el" href="namespacearmnn.html#ad1d5cce2d9e9a5d61c243e5c989112e0">armnn::DataLayout</a> & </td> |
| 263 | <td class="paramname"><em>outputLayout</em> = <code><a class="el" href="namespacearmnn.html#ad1d5cce2d9e9a5d61c243e5c989112e0ad066db54b89b0912e7e7c6da51e2da51">armnn::DataLayout::NHWC</a></code> </td> |
| 264 | </tr> |
| 265 | <tr> |
| 266 | <td></td> |
| 267 | <td>)</td> |
| 268 | <td></td><td></td> |
| 269 | </tr> |
| 270 | </table> |
| 271 | </div><div class="memdoc"> |
| 272 | <p>Prepare raw image tensor data by loading the image from imagePath and preprocessing it.</p> |
| 273 | <dl class="params"><dt>Parameters</dt><dd> |
| 274 | <table class="params"> |
| 275 | <tr><td class="paramdir">[in]</td><td class="paramname">imagePath</td><td>Path to the image file </td></tr> |
| 276 | <tr><td class="paramdir">[in]</td><td class="paramname">newWidth</td><td>The new width of the output image tensor </td></tr> |
| 277 | <tr><td class="paramdir">[in]</td><td class="paramname">newHeight</td><td>The new height of the output image tensor </td></tr> |
| 278 | <tr><td class="paramdir">[in]</td><td class="paramname">normParams</td><td>Normalization parameters for the normalization of the image </td></tr> |
| 279 | <tr><td class="paramdir">[in]</td><td class="paramname">batchSize</td><td>Batch size </td></tr> |
| 280 | <tr><td class="paramdir">[in]</td><td class="paramname">outputLayout</td><td>Data layout of the output image tensor </td></tr> |
| 281 | </table> |
| 282 | </dd> |
| 283 | </dl> |
| 284 | |
| 285 | <p class="reference">Referenced by <a class="el" href="_image_tensor_generator_8hpp_source.html#l00039">GetNormalizationParameters()</a>.</p> |
| 286 | |
| 287 | </div> |
| 288 | </div> |
| 289 | <a id="affacfe95f011fce3b897b2745880f82a"></a> |
| 290 | <h2 class="memtitle"><span class="permalink"><a href="#affacfe95f011fce3b897b2745880f82a">◆ </a></span>PrepareImageTensor< float >()</h2> |
| 291 | |
| 292 | <div class="memitem"> |
| 293 | <div class="memproto"> |
| 294 | <table class="memname"> |
| 295 | <tr> |
| 296 | <td class="memname">std::vector<float> <a class="el" href="_image_tensor_generator_8hpp.html#af39456ac4838301c6fc5b44d6a57479c">PrepareImageTensor</a>< float > </td> |
| 297 | <td>(</td> |
| 298 | <td class="paramtype">const std::string & </td> |
| 299 | <td class="paramname"><em>imagePath</em>, </td> |
| 300 | </tr> |
| 301 | <tr> |
| 302 | <td class="paramkey"></td> |
| 303 | <td></td> |
| 304 | <td class="paramtype">unsigned int </td> |
| 305 | <td class="paramname"><em>newWidth</em>, </td> |
| 306 | </tr> |
| 307 | <tr> |
| 308 | <td class="paramkey"></td> |
| 309 | <td></td> |
| 310 | <td class="paramtype">unsigned int </td> |
| 311 | <td class="paramname"><em>newHeight</em>, </td> |
| 312 | </tr> |
| 313 | <tr> |
| 314 | <td class="paramkey"></td> |
| 315 | <td></td> |
| 316 | <td class="paramtype">const <a class="el" href="struct_normalization_parameters.html">NormalizationParameters</a> & </td> |
| 317 | <td class="paramname"><em>normParams</em>, </td> |
| 318 | </tr> |
| 319 | <tr> |
| 320 | <td class="paramkey"></td> |
| 321 | <td></td> |
| 322 | <td class="paramtype">unsigned int </td> |
| 323 | <td class="paramname"><em>batchSize</em>, </td> |
| 324 | </tr> |
| 325 | <tr> |
| 326 | <td class="paramkey"></td> |
| 327 | <td></td> |
| 328 | <td class="paramtype">const <a class="el" href="namespacearmnn.html#ad1d5cce2d9e9a5d61c243e5c989112e0">armnn::DataLayout</a> & </td> |
| 329 | <td class="paramname"><em>outputLayout</em> </td> |
| 330 | </tr> |
| 331 | <tr> |
| 332 | <td></td> |
| 333 | <td>)</td> |
| 334 | <td></td><td></td> |
| 335 | </tr> |
| 336 | </table> |
| 337 | </div><div class="memdoc"> |
| 338 | |
| 339 | <p class="definition">Definition at line <a class="el" href="_image_tensor_generator_8hpp_source.html#l00091">91</a> of file <a class="el" href="_image_tensor_generator_8hpp_source.html">ImageTensorGenerator.hpp</a>.</p> |
| 340 | |
| 341 | <p class="reference">References <a class="el" href="class_inference_test_image.html#ae7a403f69a7717c1eaae1d74b7bb7bcea773b27aa8d21604182ba90d029ad2e13">InferenceTestImage::BilinearAndNormalized</a>, <a class="el" href="_exceptions_8hpp_source.html#l00169">CHECK_LOCATION</a>, <a class="el" href="_inference_test_image_8hpp_source.html#l00075">InferenceTestImage::GetWidth()</a>, <a class="el" href="_image_tensor_generator_8hpp_source.html#l00021">NormalizationParameters::mean</a>, <a class="el" href="namespacearmnn.html#ad1d5cce2d9e9a5d61c243e5c989112e0a6b99f356fe3b30a2a850b5ea897c289f">armnn::NCHW</a>, <a class="el" href="_parser_helper_8cpp_source.html#l00016">armnnUtils::NHWCToArmNN</a>, <a class="el" href="_permute_8cpp_source.html#l00121">armnnUtils::Permute()</a>, <a class="el" href="_image_tensor_generator_8hpp_source.html#l00020">NormalizationParameters::scale</a>, and <a class="el" href="_image_tensor_generator_8hpp_source.html#l00022">NormalizationParameters::stddev</a>.</p> |
| 342 | |
| 343 | <p class="reference">Referenced by <a class="el" href="_image_tensor_generator_8cpp_source.html#l00248">main()</a>, <a class="el" href="_image_tensor_generator_8hpp_source.html#l00128">PrepareImageTensor< int >()</a>, and <a class="el" href="_image_tensor_generator_8hpp_source.html#l00148">PrepareImageTensor< uint8_t >()</a>.</p> |
| 344 | <div class="fragment"><div class="line"><a name="l00097"></a><span class="lineno"> 97</span> {</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  <span class="comment">// Generate image tensor</span></div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  std::vector<float> imageData;</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  <a class="code" href="class_inference_test_image.html">InferenceTestImage</a> testImage(imagePath.c_str());</div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <span class="keywordflow">if</span> (newWidth == 0)</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  {</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  newWidth = testImage.<a class="code" href="class_inference_test_image.html#a4ec823e49ce46950b3d4cee1efff050b">GetWidth</a>();</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  }</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  <span class="keywordflow">if</span> (newHeight == 0)</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  {</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  newHeight = testImage.GetHeight();</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  }</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <span class="comment">// Resize the image to new width and height or keep at original dimensions if the new width and height are specified</span></div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  <span class="comment">// as 0 Centre/Normalise the image.</span></div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  imageData = testImage.Resize(newWidth, newHeight, <a class="code" href="_exceptions_8hpp.html#aa3be76aec4ce713822a5ea1ecbb7bc61">CHECK_LOCATION</a>(),</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  <a class="code" href="class_inference_test_image.html#ae7a403f69a7717c1eaae1d74b7bb7bcea773b27aa8d21604182ba90d029ad2e13">InferenceTestImage::ResizingMethods::BilinearAndNormalized</a>, normParams.<a class="code" href="struct_normalization_parameters.html#a6e5ac6f9d3272e6670522daaacc04442">mean</a>,</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  normParams.<a class="code" href="struct_normalization_parameters.html#a8fdb461f0b4417f4ebff10b3413a948d">stddev</a>, normParams.<a class="code" href="struct_normalization_parameters.html#a1d28dec57cce925ad92342891bd71e7c">scale</a>);</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  <span class="keywordflow">if</span> (outputLayout == <a class="code" href="namespacearmnn.html#ad1d5cce2d9e9a5d61c243e5c989112e0a6b99f356fe3b30a2a850b5ea897c289f">armnn::DataLayout::NCHW</a>)</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  {</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <span class="comment">// Convert to NCHW format</span></div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="keyword">const</span> <a class="code" href="classarmnn_1_1_permutation_vector.html">armnn::PermutationVector</a> <a class="code" href="namespacearmnn_utils.html#a12124184ac6aec018beb98b9715330c7">NHWCToArmNN</a> = { 0, 2, 3, 1 };</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  <a class="code" href="classarmnn_1_1_tensor_shape.html">armnn::TensorShape</a> dstShape({ batchSize, 3, newHeight, newWidth });</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  std::vector<float> tempImage(imageData.size());</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  <a class="code" href="namespacearmnn_utils.html#af3c74017185773dd61d8ca6662d65d43">armnnUtils::Permute</a>(dstShape, NHWCToArmNN, imageData.data(), tempImage.data(), <span class="keyword">sizeof</span>(float));</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  imageData.swap(tempImage);</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  }</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="keywordflow">return</span> imageData;</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span> }</div><div class="ttc" id="namespacearmnn_utils_html_af3c74017185773dd61d8ca6662d65d43"><div class="ttname"><a href="namespacearmnn_utils.html#af3c74017185773dd61d8ca6662d65d43">armnnUtils::Permute</a></div><div class="ttdeci">void Permute(const armnn::TensorShape &dstShape, const armnn::PermutationVector &mappings, const void *src, void *dst, size_t dataTypeSize)</div><div class="ttdef"><b>Definition:</b> <a href="_permute_8cpp_source.html#l00121">Permute.cpp:121</a></div></div> |
| 345 | <div class="ttc" id="classarmnn_1_1_permutation_vector_html"><div class="ttname"><a href="classarmnn_1_1_permutation_vector.html">armnn::PermutationVector</a></div><div class="ttdef"><b>Definition:</b> <a href="_types_8hpp_source.html#l00170">Types.hpp:170</a></div></div> |
| 346 | <div class="ttc" id="namespacearmnn_html_ad1d5cce2d9e9a5d61c243e5c989112e0a6b99f356fe3b30a2a850b5ea897c289f"><div class="ttname"><a href="namespacearmnn.html#ad1d5cce2d9e9a5d61c243e5c989112e0a6b99f356fe3b30a2a850b5ea897c289f">armnn::DataLayout::NCHW</a></div></div> |
| 347 | <div class="ttc" id="class_inference_test_image_html_ae7a403f69a7717c1eaae1d74b7bb7bcea773b27aa8d21604182ba90d029ad2e13"><div class="ttname"><a href="class_inference_test_image.html#ae7a403f69a7717c1eaae1d74b7bb7bcea773b27aa8d21604182ba90d029ad2e13">InferenceTestImage::ResizingMethods::BilinearAndNormalized</a></div></div> |
| 348 | <div class="ttc" id="struct_normalization_parameters_html_a6e5ac6f9d3272e6670522daaacc04442"><div class="ttname"><a href="struct_normalization_parameters.html#a6e5ac6f9d3272e6670522daaacc04442">NormalizationParameters::mean</a></div><div class="ttdeci">std::array< float, 3 > mean</div><div class="ttdef"><b>Definition:</b> <a href="_image_tensor_generator_8hpp_source.html#l00021">ImageTensorGenerator.hpp:21</a></div></div> |
| 349 | <div class="ttc" id="_exceptions_8hpp_html_aa3be76aec4ce713822a5ea1ecbb7bc61"><div class="ttname"><a href="_exceptions_8hpp.html#aa3be76aec4ce713822a5ea1ecbb7bc61">CHECK_LOCATION</a></div><div class="ttdeci">#define CHECK_LOCATION()</div><div class="ttdef"><b>Definition:</b> <a href="_exceptions_8hpp_source.html#l00169">Exceptions.hpp:169</a></div></div> |
| 350 | <div class="ttc" id="class_inference_test_image_html_a4ec823e49ce46950b3d4cee1efff050b"><div class="ttname"><a href="class_inference_test_image.html#a4ec823e49ce46950b3d4cee1efff050b">InferenceTestImage::GetWidth</a></div><div class="ttdeci">unsigned int GetWidth() const</div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8hpp_source.html#l00075">InferenceTestImage.hpp:75</a></div></div> |
| 351 | <div class="ttc" id="struct_normalization_parameters_html_a1d28dec57cce925ad92342891bd71e7c"><div class="ttname"><a href="struct_normalization_parameters.html#a1d28dec57cce925ad92342891bd71e7c">NormalizationParameters::scale</a></div><div class="ttdeci">float scale</div><div class="ttdef"><b>Definition:</b> <a href="_image_tensor_generator_8hpp_source.html#l00020">ImageTensorGenerator.hpp:20</a></div></div> |
| 352 | <div class="ttc" id="class_inference_test_image_html"><div class="ttname"><a href="class_inference_test_image.html">InferenceTestImage</a></div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8hpp_source.html#l00051">InferenceTestImage.hpp:51</a></div></div> |
| 353 | <div class="ttc" id="struct_normalization_parameters_html_a8fdb461f0b4417f4ebff10b3413a948d"><div class="ttname"><a href="struct_normalization_parameters.html#a8fdb461f0b4417f4ebff10b3413a948d">NormalizationParameters::stddev</a></div><div class="ttdeci">std::array< float, 3 > stddev</div><div class="ttdef"><b>Definition:</b> <a href="_image_tensor_generator_8hpp_source.html#l00022">ImageTensorGenerator.hpp:22</a></div></div> |
| 354 | <div class="ttc" id="classarmnn_1_1_tensor_shape_html"><div class="ttname"><a href="classarmnn_1_1_tensor_shape.html">armnn::TensorShape</a></div><div class="ttdef"><b>Definition:</b> <a href="_tensor_8hpp_source.html#l00020">Tensor.hpp:20</a></div></div> |
| 355 | <div class="ttc" id="namespacearmnn_utils_html_a12124184ac6aec018beb98b9715330c7"><div class="ttname"><a href="namespacearmnn_utils.html#a12124184ac6aec018beb98b9715330c7">armnnUtils::NHWCToArmNN</a></div><div class="ttdeci">const armnn::PermutationVector NHWCToArmNN</div><div class="ttdef"><b>Definition:</b> <a href="_parser_helper_8cpp_source.html#l00016">ParserHelper.cpp:16</a></div></div> |
| 356 | </div><!-- fragment --> |
| 357 | </div> |
| 358 | </div> |
| 359 | <a id="ac1e8e68c74e5d1c8fd19a91a68de3cb7"></a> |
| 360 | <h2 class="memtitle"><span class="permalink"><a href="#ac1e8e68c74e5d1c8fd19a91a68de3cb7">◆ </a></span>PrepareImageTensor< int >()</h2> |
| 361 | |
| 362 | <div class="memitem"> |
| 363 | <div class="memproto"> |
| 364 | <table class="memname"> |
| 365 | <tr> |
| 366 | <td class="memname">std::vector<int> <a class="el" href="_image_tensor_generator_8hpp.html#af39456ac4838301c6fc5b44d6a57479c">PrepareImageTensor</a>< int > </td> |
| 367 | <td>(</td> |
| 368 | <td class="paramtype">const std::string & </td> |
| 369 | <td class="paramname"><em>imagePath</em>, </td> |
| 370 | </tr> |
| 371 | <tr> |
| 372 | <td class="paramkey"></td> |
| 373 | <td></td> |
| 374 | <td class="paramtype">unsigned int </td> |
| 375 | <td class="paramname"><em>newWidth</em>, </td> |
| 376 | </tr> |
| 377 | <tr> |
| 378 | <td class="paramkey"></td> |
| 379 | <td></td> |
| 380 | <td class="paramtype">unsigned int </td> |
| 381 | <td class="paramname"><em>newHeight</em>, </td> |
| 382 | </tr> |
| 383 | <tr> |
| 384 | <td class="paramkey"></td> |
| 385 | <td></td> |
| 386 | <td class="paramtype">const <a class="el" href="struct_normalization_parameters.html">NormalizationParameters</a> & </td> |
| 387 | <td class="paramname"><em>normParams</em>, </td> |
| 388 | </tr> |
| 389 | <tr> |
| 390 | <td class="paramkey"></td> |
| 391 | <td></td> |
| 392 | <td class="paramtype">unsigned int </td> |
| 393 | <td class="paramname"><em>batchSize</em>, </td> |
| 394 | </tr> |
| 395 | <tr> |
| 396 | <td class="paramkey"></td> |
| 397 | <td></td> |
| 398 | <td class="paramtype">const <a class="el" href="namespacearmnn.html#ad1d5cce2d9e9a5d61c243e5c989112e0">armnn::DataLayout</a> & </td> |
| 399 | <td class="paramname"><em>outputLayout</em> </td> |
| 400 | </tr> |
| 401 | <tr> |
| 402 | <td></td> |
| 403 | <td>)</td> |
| 404 | <td></td><td></td> |
| 405 | </tr> |
| 406 | </table> |
| 407 | </div><div class="memdoc"> |
| 408 | |
| 409 | <p class="definition">Definition at line <a class="el" href="_image_tensor_generator_8hpp_source.html#l00128">128</a> of file <a class="el" href="_image_tensor_generator_8hpp_source.html">ImageTensorGenerator.hpp</a>.</p> |
| 410 | |
| 411 | <p class="reference">References <a class="el" href="_image_tensor_generator_8hpp_source.html#l00091">PrepareImageTensor< float >()</a>.</p> |
| 412 | |
| 413 | <p class="reference">Referenced by <a class="el" href="_image_tensor_generator_8cpp_source.html#l00248">main()</a>.</p> |
| 414 | <div class="fragment"><div class="line"><a name="l00134"></a><span class="lineno"> 134</span> {</div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  <span class="comment">// Get float32 image tensor</span></div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  std::vector<float> imageDataFloat =</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  <a class="code" href="_image_tensor_generator_8hpp.html#affacfe95f011fce3b897b2745880f82a">PrepareImageTensor<float></a>(imagePath, newWidth, newHeight, normParams, batchSize, outputLayout);</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <span class="comment">// Convert to int32 image tensor with static cast</span></div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  std::vector<int> imageDataInt;</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  imageDataInt.reserve(imageDataFloat.size());</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  std::transform(imageDataFloat.begin(), imageDataFloat.end(), std::back_inserter(imageDataInt),</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  [](<span class="keywordtype">float</span> val) { <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(val); });</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  <span class="keywordflow">return</span> imageDataInt;</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span> }</div><div class="ttc" id="_image_tensor_generator_8hpp_html_affacfe95f011fce3b897b2745880f82a"><div class="ttname"><a href="_image_tensor_generator_8hpp.html#affacfe95f011fce3b897b2745880f82a">PrepareImageTensor< float ></a></div><div class="ttdeci">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)</div><div class="ttdef"><b>Definition:</b> <a href="_image_tensor_generator_8hpp_source.html#l00091">ImageTensorGenerator.hpp:91</a></div></div> |
| 415 | </div><!-- fragment --> |
| 416 | </div> |
| 417 | </div> |
| 418 | <a id="ac372cd2b257f33f29999217e1d2d8a37"></a> |
| 419 | <h2 class="memtitle"><span class="permalink"><a href="#ac372cd2b257f33f29999217e1d2d8a37">◆ </a></span>PrepareImageTensor< uint8_t >()</h2> |
| 420 | |
| 421 | <div class="memitem"> |
| 422 | <div class="memproto"> |
| 423 | <table class="memname"> |
| 424 | <tr> |
| 425 | <td class="memname">std::vector<uint8_t> <a class="el" href="_image_tensor_generator_8hpp.html#af39456ac4838301c6fc5b44d6a57479c">PrepareImageTensor</a>< uint8_t > </td> |
| 426 | <td>(</td> |
| 427 | <td class="paramtype">const std::string & </td> |
| 428 | <td class="paramname"><em>imagePath</em>, </td> |
| 429 | </tr> |
| 430 | <tr> |
| 431 | <td class="paramkey"></td> |
| 432 | <td></td> |
| 433 | <td class="paramtype">unsigned int </td> |
| 434 | <td class="paramname"><em>newWidth</em>, </td> |
| 435 | </tr> |
| 436 | <tr> |
| 437 | <td class="paramkey"></td> |
| 438 | <td></td> |
| 439 | <td class="paramtype">unsigned int </td> |
| 440 | <td class="paramname"><em>newHeight</em>, </td> |
| 441 | </tr> |
| 442 | <tr> |
| 443 | <td class="paramkey"></td> |
| 444 | <td></td> |
| 445 | <td class="paramtype">const <a class="el" href="struct_normalization_parameters.html">NormalizationParameters</a> & </td> |
| 446 | <td class="paramname"><em>normParams</em>, </td> |
| 447 | </tr> |
| 448 | <tr> |
| 449 | <td class="paramkey"></td> |
| 450 | <td></td> |
| 451 | <td class="paramtype">unsigned int </td> |
| 452 | <td class="paramname"><em>batchSize</em>, </td> |
| 453 | </tr> |
| 454 | <tr> |
| 455 | <td class="paramkey"></td> |
| 456 | <td></td> |
| 457 | <td class="paramtype">const <a class="el" href="namespacearmnn.html#ad1d5cce2d9e9a5d61c243e5c989112e0">armnn::DataLayout</a> & </td> |
| 458 | <td class="paramname"><em>outputLayout</em> </td> |
| 459 | </tr> |
| 460 | <tr> |
| 461 | <td></td> |
| 462 | <td>)</td> |
| 463 | <td></td><td></td> |
| 464 | </tr> |
| 465 | </table> |
| 466 | </div><div class="memdoc"> |
| 467 | |
| 468 | <p class="definition">Definition at line <a class="el" href="_image_tensor_generator_8hpp_source.html#l00148">148</a> of file <a class="el" href="_image_tensor_generator_8hpp_source.html">ImageTensorGenerator.hpp</a>.</p> |
| 469 | |
| 470 | <p class="reference">References <a class="el" href="_image_tensor_generator_8hpp_source.html#l00091">PrepareImageTensor< float >()</a>.</p> |
| 471 | |
| 472 | <p class="reference">Referenced by <a class="el" href="_image_tensor_generator_8cpp_source.html#l00248">main()</a>.</p> |
| 473 | <div class="fragment"><div class="line"><a name="l00154"></a><span class="lineno"> 154</span> {</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  <span class="comment">// Get float32 image tensor</span></div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  std::vector<float> imageDataFloat =</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  <a class="code" href="_image_tensor_generator_8hpp.html#affacfe95f011fce3b897b2745880f82a">PrepareImageTensor<float></a>(imagePath, newWidth, newHeight, normParams, batchSize, outputLayout);</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  std::vector<uint8_t> imageDataQasymm8;</div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  imageDataQasymm8.reserve(imageDataFloat.size());</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  <span class="comment">// Convert to uint8 image tensor with static cast</span></div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  std::transform(imageDataFloat.begin(), imageDataFloat.end(), std::back_inserter(imageDataQasymm8),</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  [](<span class="keywordtype">float</span> val) { <span class="keywordflow">return</span> <span class="keyword">static_cast<</span>uint8_t<span class="keyword">></span>(val); });</div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  <span class="keywordflow">return</span> imageDataQasymm8;</div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span> }</div><div class="ttc" id="_image_tensor_generator_8hpp_html_affacfe95f011fce3b897b2745880f82a"><div class="ttname"><a href="_image_tensor_generator_8hpp.html#affacfe95f011fce3b897b2745880f82a">PrepareImageTensor< float ></a></div><div class="ttdeci">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)</div><div class="ttdef"><b>Definition:</b> <a href="_image_tensor_generator_8hpp_source.html#l00091">ImageTensorGenerator.hpp:91</a></div></div> |
| 474 | </div><!-- fragment --> |
| 475 | </div> |
| 476 | </div> |
| 477 | <a id="a292c4c49fc943bfcb7ee1ce1435d4690"></a> |
| 478 | <h2 class="memtitle"><span class="permalink"><a href="#a292c4c49fc943bfcb7ee1ce1435d4690">◆ </a></span>WriteImageTensorImpl()</h2> |
| 479 | |
| 480 | <div class="memitem"> |
| 481 | <div class="memproto"> |
| 482 | <table class="memname"> |
| 483 | <tr> |
| 484 | <td class="memname">void WriteImageTensorImpl </td> |
| 485 | <td>(</td> |
| 486 | <td class="paramtype">const std::vector< ElemType > & </td> |
| 487 | <td class="paramname"><em>imageData</em>, </td> |
| 488 | </tr> |
| 489 | <tr> |
| 490 | <td class="paramkey"></td> |
| 491 | <td></td> |
| 492 | <td class="paramtype">std::ofstream & </td> |
| 493 | <td class="paramname"><em>imageTensorFile</em> </td> |
| 494 | </tr> |
| 495 | <tr> |
| 496 | <td></td> |
| 497 | <td>)</td> |
| 498 | <td></td><td></td> |
| 499 | </tr> |
| 500 | </table> |
| 501 | </div><div class="memdoc"> |
| 502 | <p>Write image tensor to ofstream</p> |
| 503 | <dl class="params"><dt>Parameters</dt><dd> |
| 504 | <table class="params"> |
| 505 | <tr><td class="paramdir">[in]</td><td class="paramname">imageData</td><td>Image tensor data </td></tr> |
| 506 | <tr><td class="paramdir">[in]</td><td class="paramname">imageTensorFile</td><td>Output filestream (ofstream) to which the image tensor data is written </td></tr> |
| 507 | </table> |
| 508 | </dd> |
| 509 | </dl> |
| 510 | |
| 511 | <p class="definition">Definition at line <a class="el" href="_image_tensor_generator_8hpp_source.html#l00172">172</a> of file <a class="el" href="_image_tensor_generator_8hpp_source.html">ImageTensorGenerator.hpp</a>.</p> |
| 512 | |
| 513 | <p class="reference">Referenced by <a class="el" href="_image_tensor_generator_8cpp_source.html#l00248">main()</a>.</p> |
| 514 | <div class="fragment"><div class="line"><a name="l00173"></a><span class="lineno"> 173</span> {</div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  std::copy(imageData.begin(), imageData.end(), std::ostream_iterator<ElemType>(imageTensorFile, <span class="stringliteral">" "</span>));</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span> }</div></div><!-- fragment --> |
| 515 | </div> |
| 516 | </div> |
| 517 | <a id="a2120283536d91fbdee0d19fff3156994"></a> |
| 518 | <h2 class="memtitle"><span class="permalink"><a href="#a2120283536d91fbdee0d19fff3156994">◆ </a></span>WriteImageTensorImpl< uint8_t >()</h2> |
| 519 | |
| 520 | <div class="memitem"> |
| 521 | <div class="memproto"> |
| 522 | <table class="memname"> |
| 523 | <tr> |
| 524 | <td class="memname">void <a class="el" href="_image_tensor_generator_8hpp.html#a292c4c49fc943bfcb7ee1ce1435d4690">WriteImageTensorImpl</a>< uint8_t > </td> |
| 525 | <td>(</td> |
| 526 | <td class="paramtype">const std::vector< uint8_t > & </td> |
| 527 | <td class="paramname"><em>imageData</em>, </td> |
| 528 | </tr> |
| 529 | <tr> |
| 530 | <td class="paramkey"></td> |
| 531 | <td></td> |
| 532 | <td class="paramtype">std::ofstream & </td> |
| 533 | <td class="paramname"><em>imageTensorFile</em> </td> |
| 534 | </tr> |
| 535 | <tr> |
| 536 | <td></td> |
| 537 | <td>)</td> |
| 538 | <td></td><td></td> |
| 539 | </tr> |
| 540 | </table> |
| 541 | </div><div class="memdoc"> |
| 542 | |
| 543 | <p class="definition">Definition at line <a class="el" href="_image_tensor_generator_8hpp_source.html#l00180">180</a> of file <a class="el" href="_image_tensor_generator_8hpp_source.html">ImageTensorGenerator.hpp</a>.</p> |
| 544 | <div class="fragment"><div class="line"><a name="l00181"></a><span class="lineno"> 181</span> {</div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span>  std::copy(imageData.begin(), imageData.end(), std::ostream_iterator<int>(imageTensorFile, <span class="stringliteral">" "</span>));</div><div class="line"><a name="l00183"></a><span class="lineno"> 183</span> }</div></div><!-- fragment --> |
| 545 | </div> |
| 546 | </div> |
| 547 | </div><!-- contents --> |
| 548 | </div><!-- doc-content --> |
| 549 | <!-- start footer part --> |
| 550 | <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> |
| 551 | <ul> |
| 552 | <li class="navelem"><a class="el" href="dir_59425e443f801f1f2fd8bbe4959a3ccf.html">tests</a></li><li class="navelem"><a class="el" href="dir_db50b4cd131a46c9b297c117b868403e.html">ImageTensorGenerator</a></li><li class="navelem"><a class="el" href="_image_tensor_generator_8hpp.html">ImageTensorGenerator.hpp</a></li> |
| 553 | <li class="footer">Generated on Fri Mar 13 2020 16:07:01 for ArmNN by |
| 554 | <a href="http://www.doxygen.org/index.html"> |
| 555 | <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li> |
| 556 | </ul> |
| 557 | </div> |
| 558 | </body> |
| 559 | </html> |