xref: /aosp_15_r20/external/armnn/tests/ModelAccuracyTool-Armnn/README.md (revision 89c4ff92f2867872bb9e2354d150bf0c8c502810)
1*89c4ff92SAndroid Build Coastguard Worker# The ModelAccuracyTool-Armnn
2*89c4ff92SAndroid Build Coastguard Worker
3*89c4ff92SAndroid Build Coastguard WorkerThe `ModelAccuracyTool-Armnn` is a program for measuring the Top 5 accuracy results of a model against an image dataset.
4*89c4ff92SAndroid Build Coastguard Worker
5*89c4ff92SAndroid Build Coastguard WorkerPrerequisites:
6*89c4ff92SAndroid Build Coastguard Worker1. The model is in .armnn format model file. The `ArmnnConverter` can be used to convert a model to this format.
7*89c4ff92SAndroid Build Coastguard Worker
8*89c4ff92SAndroid Build Coastguard WorkerBuild option:
9*89c4ff92SAndroid Build Coastguard WorkerTo build ModelAccuracyTool, pass the following options to Cmake:
10*89c4ff92SAndroid Build Coastguard Worker* -DFLATC_DIR=/path/to/flatbuffers/x86build/
11*89c4ff92SAndroid Build Coastguard Worker* -DBUILD_ACCURACY_TOOL=1
12*89c4ff92SAndroid Build Coastguard Worker* -DBUILD_ARMNN_SERIALIZER=1
13*89c4ff92SAndroid Build Coastguard Worker
14*89c4ff92SAndroid Build Coastguard Worker|Cmd:|||
15*89c4ff92SAndroid Build Coastguard Worker| ---|---|---|
16*89c4ff92SAndroid Build Coastguard Worker| -h | --help                   | Display help messages |
17*89c4ff92SAndroid Build Coastguard Worker| -m | --model-path             | Path to armnn format model file |
18*89c4ff92SAndroid Build Coastguard Worker| -f | --model-format           | The model format. Supported values: tflite |
19*89c4ff92SAndroid Build Coastguard Worker| -i | --input-name             | Identifier of the input tensors in the network separated by comma |
20*89c4ff92SAndroid Build Coastguard Worker| -o | --output-name            | Identifier of the output tensors in the network separated by comma |
21*89c4ff92SAndroid Build Coastguard Worker| -d | --data-dir               | Path to directory containing the ImageNet test data |
22*89c4ff92SAndroid Build Coastguard Worker| -p | --model-output-labels    | Path to model output labels file.
23*89c4ff92SAndroid Build Coastguard Worker| -v | --validation-labels-path | Path to ImageNet Validation Label file
24*89c4ff92SAndroid Build Coastguard Worker| -l | --data-layout ]          | Data layout. Supported value: NHWC, NCHW. Default: NHWC
25*89c4ff92SAndroid Build Coastguard Worker| -c | --compute                | Which device to run layers on by default. Possible choices: CpuRef, CpuAcc, GpuAcc. Default: CpuAcc, CpuRef |
26*89c4ff92SAndroid Build Coastguard Worker| -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. |
27*89c4ff92SAndroid Build Coastguard Worker| -e | --excludelist-path       | Path to a excludelist file where each line denotes the index of an image to be excluded from evaluation. |
28*89c4ff92SAndroid Build Coastguard Worker
29*89c4ff92SAndroid Build Coastguard WorkerExample usage: <br>
30*89c4ff92SAndroid Build Coastguard Worker<code>./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</code>