From 90bb7ab20d2c3eb34266ae2ea81a23ae641219d3 Mon Sep 17 00:00:00 2001 From: SiCong Li Date: Thu, 11 Jul 2019 12:02:45 +0100 Subject: MLCE-103 Clean up ModelAccuracyTool and ImageTensorGenerator * Fix ImageTensorGenerator command line options * Update ModelAccuracyTool README * Update ImageTensorGenerator README Signed-off-by: SiCong Li Change-Id: I19e573f2b4aa0d7ecab63dc3886a66aa9d8724bc --- .../ImageTensorGenerator/ImageTensorGenerator.cpp | 8 +++++--- tests/ImageTensorGenerator/README.md | 20 ++++++++++++++------ tests/ModelAccuracyTool-Armnn/README.md | 22 +++++++++++++++------- 3 files changed, 34 insertions(+), 16 deletions(-) (limited to 'tests') diff --git a/tests/ImageTensorGenerator/ImageTensorGenerator.cpp b/tests/ImageTensorGenerator/ImageTensorGenerator.cpp index f391a27a4d..5bd8532cbd 100644 --- a/tests/ImageTensorGenerator/ImageTensorGenerator.cpp +++ b/tests/ImageTensorGenerator/ImageTensorGenerator.cpp @@ -114,16 +114,18 @@ public: ("infile,i", po::value(&m_InputFileName)->required(), "Input image file to generate tensor from") ("model-format,f", po::value(&m_ModelFormat)->required(), - "Format of the model file, Accepted values (caffe, tensorflow, tflite)") + "Format of the intended model file that uses the images." + "Different formats have different image normalization styles." + "Accepted values (caffe, tensorflow, tflite)") ("outfile,o", po::value(&m_OutputFileName)->required(), "Output raw tensor file path") ("output-type,z", po::value(&m_OutputType)->default_value("float"), "The data type of the output tensors." "If unset, defaults to \"float\" for all defined inputs. " "Accepted values (float, int or qasymm8)") - ("new-width,w", po::value(&m_NewWidth)->default_value("0"), + ("new-width", po::value(&m_NewWidth)->default_value("0"), "Resize image to new width. Keep original width if unspecified") - ("new-height,h", po::value(&m_NewHeight)->default_value("0"), + ("new-height", po::value(&m_NewHeight)->default_value("0"), "Resize image to new height. Keep original height if unspecified") ("layout,l", po::value(&m_Layout)->default_value("NHWC"), "Output data layout, \"NHWC\" or \"NCHW\", default value NHWC"); diff --git a/tests/ImageTensorGenerator/README.md b/tests/ImageTensorGenerator/README.md index 50e68aa1e7..a7e149cc3a 100644 --- a/tests/ImageTensorGenerator/README.md +++ b/tests/ImageTensorGenerator/README.md @@ -1,13 +1,21 @@ # The ImageTensorGenerator -The `ImageTensorGenerator` is a program for generating a .raw tensor file from a .jpg image. +The `ImageTensorGenerator` is a program for pre-processing a .jpg image before generating a .raw tensor file from it. + +Build option: +To build ModelAccuracyTool, pass the following options to Cmake: +* -DBUILD_ARMNN_QUANTIZER=1 |Cmd:||| | ---|---|---| -| -h | --help | Display help messages | -| -i | --infile | Input image file to generate tensor from | -| -l | --layout | Output data layout, "NHWC" or "NCHW". Default value: NHWC | -| -o | --outfile | Output raw tensor file path | +| -h | --help | Display help messages | +| -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) | +| -i | --infile | Input image file to generate tensor from | +| -o | --outfile | Output raw tensor file path | +| -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) +| | --new-width |Resize image to new width. Keep original width if unspecified | +| | --new-height | Resize image to new height. Keep original height if unspecified | +| -l | --layout | Output data layout, "NHWC" or "NCHW". Default value: NHWC | Example usage:
-./ImageTensorGenerator -i /path/to/image/dog.jpg -l NHWC -o /output/path/dog.raw +./ImageTensorGenerator -i /path/to/image/dog.jpg -o /output/path/dog.raw --new-width 224 --new-height 224 \ No newline at end of file diff --git a/tests/ModelAccuracyTool-Armnn/README.md b/tests/ModelAccuracyTool-Armnn/README.md index d6334caa5d..454590212a 100644 --- a/tests/ModelAccuracyTool-Armnn/README.md +++ b/tests/ModelAccuracyTool-Armnn/README.md @@ -4,19 +4,27 @@ The `ModelAccuracyTool-Armnn` is a program for measuring the Top 5 accuracy resu Prerequisites: 1. The model is in .armnn format model file. The `ArmnnConverter` can be used to convert a model to this format. -2. The ImageNet test data is in raw tensor file format. The `ImageTensorGenerator` can be used to convert the test -images to this format. + +Build option: +To build ModelAccuracyTool, pass the following options to Cmake: +* -DFLATC_DIR=/path/to/flatbuffers/x86build/ +* -DBUILD_ACCURACY_TOOL=1 +* -DBUILD_ARMNN_SERIALIZER=1 |Cmd:||| | ---|---|---| | -h | --help | Display help messages | | -m | --model-path | Path to armnn format model file | -| -c | --compute | Which device to run layers on by default. Possible choices: CpuRef, CpuAcc, GpuAcc. Default: CpuAcc, CpuRef | -| -d | --data-dir | Path to directory containing the ImageNet test data | +| -f | --model-format | The model format. Supported values: caffe, tensorflow, tflite | | -i | --input-name | Identifier of the input tensors in the network separated by comma | | -o | --output-name | Identifier of the output tensors in the network separated by comma | -| -v | --validation-labels-path | Path to ImageNet Validation Label file | +| -d | --data-dir | Path to directory containing the ImageNet test data | +| -p | --model-output-labels | Path to model output labels file. +| -v | --validation-labels-path | Path to ImageNet Validation Label file +| -l | --data-layout ] | Data layout. Supported value: NHWC, NCHW. Default: NHCW +| -c | --compute | Which device to run layers on by default. Possible choices: CpuRef, CpuAcc, GpuAcc. Default: CpuAcc, CpuRef | +| -r | --validation-range | The range of the images to be evaluated. Specified in the form :. The index starts at 1 and the range is inclusive. By default the evaluation will be performed on all images. | +| -b | --blacklist-path | Path to a blacklist file where each line denotes the index of an image to be excluded from evaluation. | Example usage:
-./ModelAccuracyTool -m /path/to/model/model.armnn -c CpuRef -d /path/to/test/directory/ -i input -o output --v /path/to/file/val.txt +./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 \ No newline at end of file -- cgit v1.2.1