1/// Copyright (c) 2020 ARM Limited. 2/// 3/// SPDX-License-Identifier: MIT 4/// 5/// Permission is hereby granted, free of charge, to any person obtaining a copy 6/// of this software and associated documentation files (the "Software"), to deal 7/// in the Software without restriction, including without limitation the rights 8/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9/// copies of the Software, and to permit persons to whom the Software is 10/// furnished to do so, subject to the following conditions: 11/// 12/// The above copyright notice and this permission notice shall be included in all 13/// copies or substantial portions of the Software. 14/// 15/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21/// SOFTWARE. 22/// 23 24namespace armnn 25{ 26/** 27@page other_tools Other Tools 28@tableofcontents 29 30@section S14_image_csv_file_generator The ImageCSVFileGenerator 31 32The `ImageCSVFileGenerator` is a program for creating a CSV file that contains a list of .raw tensor files. These 33.raw tensor files can be generated using the`ImageTensorGenerator`. 34 35|Cmd:||| 36| ---|---|---| 37| -h | --help | Display help messages | 38| -i | --indir | Directory that .raw files are stored in | 39| -o | --outfile | Output CSV file path | 40 41Example usage: <br/> 42~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh 43./ImageCSVFileGenerator -i /path/to/directory/ -o /output/path/csvfile.csv 44~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 45<br/><br/><br/><br/> 46 47@section S15_image_tensor_generator The ImageTensorGenerator 48 49The `ImageTensorGenerator` is a program for pre-processing a .jpg image before generating a .raw tensor file from it. 50 51Build option: 52To build ModelAccuracyTool, pass the following options to Cmake: 53* -DBUILD_ARMNN_QUANTIZER=1 54 55|Cmd:||| 56| ---|---|---| 57| -h | --help | Display help messages | 58| -f | --model-format | Format of the intended model file that uses the images.Different formats have different image normalization styles.Accepted values (caffe, tensorflow, tflite) | 59| -i | --infile | Input image file to generate tensor from | 60| -o | --outfile | Output raw tensor file path | 61| -z | --output-type | The data type of the output tensors.If unset, defaults to "float" for all defined inputs. Accepted values (float, int or qasymm8) 62| | --new-width |Resize image to new width. Keep original width if unspecified | 63| | --new-height | Resize image to new height. Keep original height if unspecified | 64| -l | --layout | Output data layout, "NHWC" or "NCHW". Default value: NHWC | 65 66Example usage: <br/> 67~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh 68 .sh ./ImageTensorGenerator -i /path/to/image/dog.jpg -o /output/path/dog.raw --new-width 224 --new-height 224 69~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 70<br/><br/><br/><br/> 71 72@section S16_model_accuracy_tool_armnn The ModelAccuracyTool-ArmNN 73 74The `ModelAccuracyTool-Armnn` is a program for measuring the Top 5 accuracy results of a model against an image dataset. 75 76Prerequisites: 771. The model is in .armnn format model file. The `ArmnnConverter` can be used to convert a model to this format. 78 79Build option: 80To build ModelAccuracyTool, pass the following options to Cmake: 81* -DFLATC_DIR=/path/to/flatbuffers/x86build/ 82* -DBUILD_ACCURACY_TOOL=1 83* -DBUILD_ARMNN_SERIALIZER=1 84 85|Cmd:||| 86| ---|---|---| 87| -h | --help | Display help messages | 88| -m | --model-path | Path to armnn format model file | 89| -f | --model-format | The model format. Supported values: caffe, tensorflow, tflite | 90| -i | --input-name | Identifier of the input tensors in the network separated by comma | 91| -o | --output-name | Identifier of the output tensors in the network separated by comma | 92| -d | --data-dir | Path to directory containing the ImageNet test data | 93| -p | --model-output-labels | Path to model output labels file. 94| -v | --validation-labels-path | Path to ImageNet Validation Label file 95| -l | --data-layout ] | Data layout. Supported value: NHWC, NCHW. Default: NHWC 96| -c | --compute | Which device to run layers on by default. Possible choices: CpuRef, CpuAcc, GpuAcc. Default: CpuAcc, CpuRef | 97| -r | --validation-range | The range of the images to be evaluated. Specified in the form <begin index>:<end index>. The index starts at 1 and the range is inclusive. By default the evaluation will be performed on all images. | 98| -b | --blacklist-path | Path to a blacklist file where each line denotes the index of an image to be excluded from evaluation. | 99 100Example usage: <br/> 101~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh 102./ModelAccuracyTool -m /path/to/model/model.armnn -f tflite -i input -o output -d /path/to/test/directory/ -p /path/to/model-output-labels -v /path/to/file/val.txt -c CpuRef -r 1:100 103~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104<br/><br/> 105 106**/ 107}