summaryrefslogtreecommitdiff
path: root/docs/use_cases
diff options
context:
space:
mode:
authorKshitij Sisodia <kshitij.sisodia@arm.com>2021-05-27 13:57:35 +0100
committerIsabella Gottardi <isabella.gottardi@arm.com>2021-05-27 16:27:44 +0100
commitb9e9c899dcbbe35cac72bceb117ae4ec56494d81 (patch)
tree5984a5ba1453c09e55094f9971e0b244169287a6 /docs/use_cases
parent698c5a7316044c64ed98500a9a602554c69c9f3f (diff)
downloadml-embedded-evaluation-kit-b9e9c899dcbbe35cac72bceb117ae4ec56494d81.tar.gz
MLECO-1943: Documentation review
Major update for the documentation. Also, a minor logging change in helper scripts. Change-Id: Ia79f78a45c9fa2d139418fbc0ca9e52245704ba3
Diffstat (limited to 'docs/use_cases')
-rw-r--r--docs/use_cases/ad.md273
-rw-r--r--docs/use_cases/asr.md351
-rw-r--r--docs/use_cases/img_class.md256
-rw-r--r--docs/use_cases/inference_runner.md159
-rw-r--r--docs/use_cases/kws.md300
-rw-r--r--docs/use_cases/kws_asr.md460
6 files changed, 974 insertions, 825 deletions
diff --git a/docs/use_cases/ad.md b/docs/use_cases/ad.md
index a6e368c..d41f970 100644
--- a/docs/use_cases/ad.md
+++ b/docs/use_cases/ad.md
@@ -17,38 +17,40 @@
## Introduction
-This document describes the process of setting up and running the Arm® Ethos™-U55 Anomaly Detection example.
+This document describes the process of setting up and running the Arm® *Ethos™-U55* Anomaly Detection example.
-Use case code could be found in [source/use_case/ad](../../source/use_case/ad]) directory.
+Use-case code could be found in the following directory: [source/use_case/ad](../../source/use_case/ad]).
### Preprocessing and feature extraction
-The Anomaly Detection model that is used with the Code Samples expects audio data to be preprocessed
-in a specific way before performing an inference. This section aims to provide an overview of the feature extraction
-process used.
+The Anomaly Detection model that is used with the Code Samples andexpects audio data to be preprocessed in a specific
+way before performing an inference.
-First the audio data is normalized to the range (-1, 1).
+Therefore, this section provides an overview of the feature extraction process used.
-Next, a window of 1024 audio samples are taken from the start of the audio clip. From these 1024 samples we calculate 64
+First, the audio data is normalized to the range (`-1`, `1`).
+
+Next, a window of 1024 audio samples is taken from the start of the audio clip. From these 1024 samples, we calculate 64
Log Mel Energies that form part of a Log Mel Spectrogram.
The window is shifted by 512 audio samples and another 64 Log Mel Energies are calculated. This is repeated until we
have 64 sets of Log Mel Energies.
-This 64x64 matrix of values is resized by a factor of 2 resulting in a 32x32 matrix of values.
+This 64x64 matrix of values is then resized by a factor of two, resulting in a 32x32 matrix of values.
-The average of the training dataset is subtracted from this 32x32 matrix and an inference can then be performed.
+The average of the training dataset is then subtracted from this 32x32 matrix and an inference can now be performed.
-We start this process again but shifting the start by 20\*512=10240 audio samples. This keeps repeating until enough
+We start this process again, but shift the start by 20\*512=10240 audio samples. This keeps repeating until enough
inferences have been performed to cover the whole audio clip.
### Postprocessing
-Softmax is applied to the result of each inference. Based on the machine ID of the wav clip being processed we look at a
-specific index in each output vector. An average of the negative value at this index across all the inferences performed
-for the audio clip is taken. If this average value is greater than a chosen threshold score, then the machine in the
-clip is not behaving anomalously. If the score is lower than the threshold then the machine in the clip is behaving
-anomalously.
+Softmax is then applied to the result of each inference. Based on the machine ID of the wav clip being processed, we
+look at a specific index in each output vector. An average of the negative value at this index across all the inferences
+performed for the audio clip is taken.
+
+If this average value is greater than a chosen threshold score, then the machine in the clip is not behaving
+anomalously. If the score is lower than the threshold, then the machine in the clip is behaving anomalously.
### Prerequisites
@@ -58,61 +60,66 @@ See [Prerequisites](../documentation.md#prerequisites)
### Build options
-In addition to the already specified build option in the main documentation, Anomaly Detection use case adds:
+In addition to the already specified build option in the main documentation, the Anomaly Detection use-case adds:
+
+- `ad_MODEL_TFLITE_PATH` - Path to the NN model file in the `TFLite` format. The model is then processed and included in
+ the application `axf` file. The default value points to one of the delivered set of models.
-- `ad_MODEL_TFLITE_PATH` - Path to the NN model file in TFLite format. Model will be processed and included into
-the application axf
- file. The default value points to one of the delivered set of models. Note that the parameters `ad_LABELS_TXT_FILE`,
- `TARGET_PLATFORM` and `ETHOS_U55_ENABLED` should be aligned with the chosen model, i.e.:
- - if `ETHOS_U55_ENABLED` is set to `On` or `1`, the NN model is assumed to be optimized. The model will naturally fall
-back to the Arm® Cortex®-M CPU if an unoptimized model is supplied.
+ Note that the parameters `ad_LABELS_TXT_FILE`, `TARGET_PLATFORM`, and `ETHOS_U55_ENABLED` must be aligned with the
+ chosen model. In other words:
+
+ - If `ETHOS_U55_ENABLED` is set to `On` or `1`, then the NN model is assumed to be optimized. The model naturally
+ falls back to the Arm® *Cortex®-M* CPU if an unoptimized model is supplied.
- if `ETHOS_U55_ENABLED` is set to `Off` or `0`, the NN model is assumed to be unoptimized. Supplying an optimized
-model in this case will result in a runtime error.
+ model in this case results in a runtime error.
- `ad_FILE_PATH`: Path to the directory containing audio files, or a path to single WAV file, to be used in the
- application. The default value points to the resources/ad/samples folder containing the delivered set of audio clips.
+ application. The default value points to the `resources/ad/samples` folder containing the delivered set of audio
+ clips.
-- `ad_AUDIO_RATE`: Input data sampling rate. Each audio file from ad_FILE_PATH is preprocessed during the build to match
-NN model input requirements.
- Default value is 16000.
+- `ad_AUDIO_RATE`: The input data sampling rate. Each audio file from `ad_FILE_PATH` is preprocessed during the build to
+ match the NN model input requirements. The default value is `16000`.
-- `ad_AUDIO_MONO`: If set to ON the audio data will be converted to mono. Default is ON.
+- `ad_AUDIO_MONO`: If set to `ON`, then the audio data is converted to mono. The default value is `ON`.
-- `ad_AUDIO_OFFSET`: Start loading audio data starting from this offset (in seconds). Default value is 0.
+- `ad_AUDIO_OFFSET`: begin loading the audio data, while starting from this offset amount, defined in seconds. The
+ default value is set to `0`.
-- `ad_AUDIO_DURATION`: Length of the audio data to be used in the application in seconds. Default is 0 meaning the
- whole audio file will be taken.
+- `ad_AUDIO_DURATION`: Length of the audio data to be used in the application in seconds. Default is `0`, meaning that
+ the whole audio file is used.
- `ad_AUDIO_MIN_SAMPLES`: Minimum number of samples required by the network model. If the audio clip is shorter than
- this number, it is padded with zeros. Default value is 16000.
+ this number, then it is padded with zeros. The default value is `16000`.
-- `ad_MODEL_SCORE_THRESHOLD`: Threshold value to be applied to average softmax score over the clip, if larger than this
-score we have an anomaly.
+- `ad_MODEL_SCORE_THRESHOLD`: Threshold value to be applied to average Softmax score over the clip, if larger than this
+ value, then there is an anomaly.
-- `ad_ACTIVATION_BUF_SZ`: The intermediate/activation buffer size reserved for the NN model. By default, it is set to
- 2MiB and should be enough for most models.
+- `ad_ACTIVATION_BUF_SZ`: The intermediate, or activation, buffer size reserved for the NN model. By default, it is set
+ to 2MiB and is enough for most models.
-In order to build **ONLY** Anomaly Detection example application add to the `cmake` command line specified in [Building](../documentation.md#Building) `-DUSE_CASE_BUILD=ad`.
+In order to **ONLY** build the Anomaly Detection example application, add `-DUSE_CASE_BUILD=ad` to the `cmake` command
+line that is specified in: [Building](../documentation.md#Building).
### Build process
-> **Note:** This section describes the process for configuring the build for `MPS3: SSE-300` for different target
->platform see [Building](../documentation.md#Building).
+> **Note:** This section describes the process for configuring the build for the `MPS3: SSE-300` for a different target
+> platform. Additional information can be found at: [Building](../documentation.md#Building).
-Create a build directory folder and navigate inside:
+Create a build directory folder and then navigate inside using:
```commandline
mkdir build_ad && cd build_ad
```
-On Linux, execute the following command to build **only** Anomaly Detection application to run on the Ethos-U55 Fast Model when providing only the mandatory arguments for CMake configuration:
+On Linux, when providing only the mandatory arguments for CMake configuration, execute the following command to **only**
+build the Anomaly Detection application to run on the *Ethos-U55* Fast Model:
```commandline
cmake ../ -DUSE_CASE_BUILD=ad
```
-To configure a build that can be debugged using Arm-DS, we can just specify
-the build type as `Debug` and use the `Arm Compiler` toolchain file:
+To configure a build that can be debugged using Arm DS, specify the build type as `Debug` and use the `Arm Compiler`
+toolchain file, like so:
```commandline
cmake .. \
@@ -121,15 +128,15 @@ cmake .. \
-DUSE_CASE_BUILD=ad
```
-Also see:
+For additional information, please refer to:
- [Configuring with custom TPIP dependencies](../sections/building.md#configuring-with-custom-tpip-dependencies)
- [Using Arm Compiler](../sections/building.md#using-arm-compiler)
- [Configuring the build for simple_platform](../sections/building.md#configuring-the-build-for-simple_platform)
-- [Working with model debugger from Arm FastModel Tools](../sections/building.md#working-with-model-debugger-from-arm-fastmodel-tools)
+- [Working with model debugger from Arm Fast Model Tools](../sections/building.md#working-with-model-debugger-from-arm-fastmodel-tools)
-> **Note:** If re-building with changed parameters values, it is highly advised to clean the build directory and re-run
->the CMake command.
+> **Note:** If re-building with changed parameters values, we recommend that you clean the build directory and then
+> re-run the CMake command.
If the CMake command succeeded, build the application as follows:
@@ -137,9 +144,9 @@ If the CMake command succeeded, build the application as follows:
make -j4
```
-Add VERBOSE=1 to see compilation and link details.
+To see compilation and link details, add `VERBOSE=1`.
-Results of the build will be placed under `build/bin` folder:
+Results of the build are placed under `build/bin` folder. For example:
```tree
bin
@@ -149,30 +156,31 @@ bin
 └── sectors
├── images.txt
└── ad
- ├── dram.bin
+ ├── ddr.bin
└── itcm.bin
```
-Where:
+The bin folder contains the following files and folders:
-- `ethos-u-ad.axf`: The built application binary for the Anomaly Detection use case.
+- `ethos-u-ad.axf`: The built application binary for the Anomaly Detection use-case.
-- `ethos-u-ad.map`: Information from building the application (e.g. libraries used, what was optimized, location of
- objects)
+- `ethos-u-ad.map`: Information from building the application. For example, the libraries used, what was optimized, and
+ the location of objects.
- `ethos-u-ad.htm`: Human readable file containing the call graph of application functions.
-- `sectors/ad`: Folder containing the built application, split into files for loading into different FPGA memory regions.
+- `sectors/ad`: Folder containing the built application. is split into files for loading into different FPGA memory
+ regions.
-- `sectors/images.txt`: Tells the FPGA which memory regions to use for loading the binaries in sectors/\*\* folder.
+- `sectors/images.txt`: Tells the FPGA which memory regions to use for loading the binaries in the `sectors/..` folder.
### Add custom input
-The application anomaly detection on audio data found in the folder, or an individual file, set by the CMake parameter
-``ad_FILE_PATH``.
+The application anomaly detection is set up to perform inferences on data found in the folder, or an individual file,
+that is pointed to by the parameter `ad_FILE_PATH`.
-To run the application with your own audio clips first create a folder to hold them and then copy the custom clips into
-this folder:
+To run the application with your own audio clips, first create a folder to hold them and then copy the custom clips into
+the following folder:
```commandline
mkdir /tmp/custom_files
@@ -181,16 +189,16 @@ cp custom_id_00.wav /tmp/custom_files/
```
> **Note:** The data used for this example comes from
-[https://zenodo.org/record/3384388\#.X6GILFNKiqA](https://zenodo.org/record/3384388\#.X6GILFNKiqA)
-and the model included in this example is trained on the ‘Slider’ part of the dataset.
-The machine ID (00, 02, 04, 06) the clip comes from must be in the file name for the application to work.
-The file name should have a pattern that matches
-e.g. `<any>_<text>_00_<here>.wav` if the audio was from machine ID 00
-or `<any>_<text>_02_<here>.wav` if it was from machine ID 02 etc.
+> [https://zenodo.org/record/3384388\#.X6GILFNKiqA](https://zenodo.org/record/3384388\#.X6GILFNKiqA) and the model
+> included in this example is trained on the "Slider" part of the dataset.\
+> The machine ID for the clip, so: `00`, `02`, `04`, `06`, comes from must be in the file name for the application to
+> work.\
+> The file name must have a pattern that matches. For example: `<any>_<text>_00_<here>.wav` if the audio was from machine
+> ID `00`, or `<any>_<text>_02_<here>.wav` if it was from machine ID `02`, and so on.
>
> **Note:** Clean the build directory before re-running the CMake command.
-Next set ad_FILE_PATH to the location of this folder when building:
+Next, set `ad_FILE_PATH` to the location of the following folder when building:
```commandline
cmake .. \
@@ -198,25 +206,27 @@ cmake .. \
-DUSE_CASE_BUILD=ad
```
-The audio flies found in the `ad_FILE_PATH` folder will be picked up and automatically converted to C++ files during the CMake
-configuration stage and then compiled into the application during the build phase for performing inference with.
+The audio flies found in the `ad_FILE_PATH` folder are picked up and automatically converted to C++ files during the
+CMake configuration stage. They are then compiled into the application during the build phase for performing inference
+with.
-The log from the configuration stage should tell you what image directory path has been used:
+The log from the configuration stage tells you what image directory path has been used:
```log
-- User option ad_FILE_PATH is set to /tmp/custom_files
```
-After compiling, your custom inputs will have now replaced the default ones in the application.
+After compiling, your custom inputs have now replaced the default ones in the application.
### Add custom model
The application performs inference using the model pointed to by the CMake parameter ``ad_MODEL_TFLITE_PATH``.
-> **Note:** If you want to run the model using Ethos-U55, ensure your custom model has been run through the Vela compiler
->successfully before continuing. See [Optimize model with Vela compiler](../sections/building.md#Optimize-custom-model-with-Vela-compiler).
+> **Note:** If you want to run the model using an *Ethos-U55*, ensure that your custom model has been successfully run
+> through the Vela compiler *before* continuing. Please refer to this section for more help:
+> [Optimize model with Vela compiler](../sections/building.md#Optimize-custom-model-with-Vela-compiler).
-An example:
+For example:
```commandline
cmake .. \
@@ -226,11 +236,10 @@ cmake .. \
> **Note:** Clean the build directory before re-running the CMake command.
-The `.tflite` model file pointed to by `ad_MODEL_TFLITE_PATH` will be converted
-to C++ files during the CMake configuration
-stage and then compiled into the application for performing inference with.
+The `.tflite` model file pointed to by `ad_MODEL_TFLITE_PATH` is converted to C++ files during the CMake configuration
+stage and is then compiled into the application for performing inference with.
-The log from the configuration stage should tell you what model path has been used:
+The log from the configuration stage tells you what model path has been used. For example:
```log
-- User option TARGET_PLATFORM is set to fastmodel
@@ -241,44 +250,46 @@ The log from the configuration stage should tell you what model path has been us
...
```
-After compiling, your custom model will have now replaced the default one in the application.
+After compiling, your custom model has now replaced the default one in the application.
- >**Note:** In order to successfully run the model, the NPU needs to be enabled and
- the platform `TARGET_PLATFORM` is set to `mps3` and `TARGET_SUBSYSTEM` is `SSE-300`.
+ >**Note:** To successfully run the model, the NPU must be enabled and the platform `TARGET_PLATFORM` is set to `mps3`
+ >and `TARGET_SUBSYSTEM` is `SSE-300`.
## Setting-up and running Ethos-U55 Code Sample
### Setting up the Ethos-U55 Fast Model
-The FVP is available publicly from [Arm Ecosystem FVP downloads
-](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps).
+The FVP is available publicly from
+[Arm Ecosystem FVP downloads](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps).
+
+For the *Ethos-U55* evaluation, please download the MPS3 version of the Arm® *Corstone™-300* model that contains both
+the *Ethos-U55* and *Cortex-M55*. The model is currently only supported on Linux-based machines.
-For Ethos-U55 evaluation, please download the MPS3 version of the Arm® Corstone™-300 model that contains Ethos-U55 and
-Cortex-M55. The model is currently only supported on Linux based machines. To install the FVP:
+To install the FVP:
-- Unpack the archive
+- Unpack the archive.
-- Run the install script in the extracted package
+- Run the install script in the extracted package:
```commandline
.FVP_Corstone_SSE-300_Ethos-U55.sh
```
-- Follow the instructions to install the FVP to your desired location
+- Follow the instructions to install the FVP to the required location.
### Starting Fast Model simulation
-> **Note:** The anomaly detection example does not come pre-built. You will first need to follow the instructions in
->section 3 for building the application from source.
+> **Note:** The anomaly detection example does not come pre-built. Therefore, you must first follow the instructions in
+> section three for building the application from source.
-After building, and assuming the install location of the FVP was set to ~/FVP_install_location, the simulation can be
-started by:
+After building, and assuming the install location of the FVP was set to the `~/FVP_install_location`, the simulation can
+be started by running:
```commandline
~/FVP_install_location/models/Linux64_GCC-6.4/FVP_Corstone_SSE-300_Ethos-U55 ./bin/ethos-u-ad.axf
```
-A log output should appear on the terminal:
+A log output now appears on the terminal:
```log
telnetterminal0: Listening for serial connection on port 5000
@@ -287,13 +298,13 @@ telnetterminal2: Listening for serial connection on port 5002
telnetterminal5: Listening for serial connection on port 5003
```
-This will also launch a telnet window with the sample application's standard output and error log entries containing
-information about the pre-built application version, TensorFlow Lite Micro library version used, data type as well as
-the input and output tensor sizes of the model compiled into the executable binary.
+This also launches a telnet window with the standard output of the sample application. It also includes error log
+entries containing information about the pre-built application version, TensorFlow Lite Micro library version used, and
+data types. The log also includes the input and output tensor sizes of the model compiled into the executable binary.
-After the application has started if `ad_FILE_PATH` pointed to a single file (or a folder containing a single input file)
-the inference starts immediately. In case of multiple inputs choice, it outputs a menu and waits for the user input from
-telnet terminal:
+After the application has started, if `ad_FILE_PATH` points to a single file, or even a folder that contains a single
+input file, then the inference starts immediately. If there are multiple inputs, it outputs a menu and then waits for
+input from the user. For example:
```log
User input required
@@ -309,44 +320,46 @@ Choice:
```
-1. “Classify next audio clip” menu option will run single inference on the next in line.
+What the preceding choices do:
+
+1. Classify next audio clip: Runs a single inference on the next in line.
-2. “Classify audio clip at chosen index” menu option will run inference on the chosen audio clip.
+2. Classify audio clip at chosen index: Runs inference on the chosen audio clip.
- > **Note:** Please make sure to select audio clip index in the range of supplied audio clips during application build.
- By default, pre-built application has 4 files, indexes from 0 to 3.
+ > **Note:** Please make sure to select audio clip index within the range of supplied audio clips during application
+ > build. By default, a pre-built application has four files, with indexes from `0` to `3`.
-3. “Run ... on all” menu option triggers sequential inference executions on all built-in .
+3. Run ... on all: Triggers sequential inference executions on all built-in applications.
-4. “Show NN model info” menu option prints information about model data type, input and output tensor sizes:
+4. Show NN model info: Prints information about the model data type, input, and output, tensor sizes:
```log
INFO - uTFL version: 2.5.0
INFO - Model info:
INFO - Model INPUT tensors:
- INFO - tensor type is INT8
- INFO - tensor occupies 1024 bytes with dimensions
- INFO - 0: 1
- INFO - 1: 32
- INFO - 2: 32
- INFO - 3: 1
+ INFO - tensor type is INT8
+ INFO - tensor occupies 1024 bytes with dimensions
+ INFO - 0: 1
+ INFO - 1: 32
+ INFO - 2: 32
+ INFO - 3: 1
INFO - Quant dimension: 0
INFO - Scale[0] = 0.192437
INFO - ZeroPoint[0] = 11
INFO - Model OUTPUT tensors:
- INFO - tensor type is INT8
- INFO - tensor occupies 8 bytes with dimensions
- INFO - 0: 1
- INFO - 1: 8
+ INFO - tensor type is INT8
+ INFO - tensor occupies 8 bytes with dimensions
+ INFO - 0: 1
+ INFO - 1: 8
INFO - Quant dimension: 0
INFO - Scale[0] = 0.048891
INFO - ZeroPoint[0] = -30
INFO - Activation buffer (a.k.a tensor arena) size used: 198016
INFO - Number of operators: 1
- INFO - Operator 0: ethos-u
+ INFO - Operator 0: ethos-u
```
-5. “List” menu option prints a list of pair ... indexes - the original filenames embedded in the application:
+5. List: Prints a list of pair ... indexes. The original filenames are embedded in the application, like so:
```log
INFO - List of Files:
@@ -358,9 +371,9 @@ Choice:
### Running Anomaly Detection
-Please select the first menu option to execute Anomaly Detection.
+Please select the first menu option to execute the Anomaly Detection.
-The following example illustrates application output:
+The following example illustrates the output of an application:
```log
INFO - Running inference on audio clip 0 => anomaly_id_00_00000000.wav
@@ -389,14 +402,14 @@ INFO - NPU IDLE cycles: 626
INFO - NPU total cycles: 1081634
```
-As multiple inferences have to be run for one clip it will take around a minute or so for all inferences to complete.
+As multiple inferences must be run for one clip, it takes around a minute for all inferences to complete.
-For the anomaly_id_00_00000000.wav clip, after averaging results across all inferences the score is greater than the
-chosen anomaly threshold so an anomaly was detected with the machine in this clip.
+For the `anomaly_id_00_00000000.wav` clip, after averaging results across all inferences, the score is greater than the
+chosen anomaly threshold. Therefore, an anomaly was detected with the machine in this clip.
-The profiling section of the log shows that for each inference. For the last inference the profiling reports:
+The profiling section of the log shows that for each inference. For the last inference, the profiling reports:
-- Ethos-U55's PMU report:
+- *Ethos-U55* PMU report:
- 1,081,634 total cycle: The number of NPU cycles
@@ -404,13 +417,13 @@ The profiling section of the log shows that for each inference. For the last inf
- 626 idle cycles: number of cycles for which the NPU was idle
- - 628,122 AXI0 read beats: The number of AXI beats with read transactions from AXI0 bus.
- AXI0 is the bus where Ethos-U55 NPU reads and writes to the computation buffers (activation buf/tensor arenas).
+ - 628,122 AXI0 read beats: The number of AXI beats with read transactions from AXI0 bus. AXI0 is the bus where
+ Ethos-U55 NPU reads and writes to the computation buffers, activation buf, or tensor arenas.
- 135,087 AXI0 write beats: The number of AXI beats with write transactions to AXI0 bus.
- - 62,870 AXI1 read beats: The number of AXI beats with read transactions from AXI1 bus.
- AXI1 is the bus where Ethos-U55 NPU reads the model (read only)
+ - 62,870 AXI1 read beats: The number of AXI beats with read transactions from AXI1 bus. AXI1 is the bus where
+ Ethos-U55 NPU reads the model. So, read-only.
-- For FPGA platforms, CPU cycle count can also be enabled. For FVP, however, CPU cycle counters should not be used as
- the CPU model is not cycle-approximate or cycle-accurate.
+- For FPGA platforms, a CPU cycle count can also be enabled. However, do not use cycle counters for FVP, as the CPU
+ model is not cycle-approximate or cycle-accurate.
diff --git a/docs/use_cases/asr.md b/docs/use_cases/asr.md
index 0f5da40..a12455c 100644
--- a/docs/use_cases/asr.md
+++ b/docs/use_cases/asr.md
@@ -10,79 +10,91 @@
- [Build process](#build-process)
- [Add custom input](#add-custom-input)
- [Add custom model](#add-custom-model)
- - [Setting-up and running Ethos-U55 Code Sample](#setting-up-and-running-ethos-u55-code-sample)
+ - [Setting-up and running Ethos-U55 Code Samples](#setting-up-and-running-ethos-u55-code-samples)
- [Setting up the Ethos-U55 Fast Model](#setting-up-the-ethos-u55-fast-model)
- [Starting Fast Model simulation](#starting-fast-model-simulation)
- [Running Automatic Speech Recognition](#running-automatic-speech-recognition)
## Introduction
-This document describes the process of setting up and running the Arm® Ethos™-U55 Automatic Speech Recognition example.
+This document describes the process of setting up and running the Arm® *Ethos™-U55* Automatic Speech Recognition
+example.
-Use case code could be found in [source/use_case/asr](../../source/use_case/asr]) directory.
+Use-case code could be found in the following directory: [source/use_case/asr](../../source/use_case/asr]).
### Preprocessing and feature extraction
-The wav2letter automatic speech recognition model that is used with the Code Samples expects audio data to be
-preprocessed in a specific way before performing an inference. This section aims to provide an overview of the feature
-extraction process used.
+The *wav2letter* automatic speech recognition model that is used with the code samples, expects audio data to be
+preprocessed in a specific way before performing an inference.
-First the audio data is normalized to the range (-1, 1).
+This section provides an overview of the feature extraction process used.
-> **Note:** Mel-frequency cepstral coefficients (MFCCs) are a common feature extracted from audio data and can be used as
->input for machine learning tasks like keyword spotting and speech recognition. See source/application/main/include/Mfcc.hpp
->for implementation details.
+First, the audio data is normalized to the range (`-1`, `1`).
-Next, a window of 512 audio samples is taken from the start of the audio clip. From these 512 samples we calculate 13
+> **Note:** Mel-Frequency Cepstral Coefficients (MFCCs) are a common feature that is extracted from audio data and can
+> be used as input for machine learning tasks. Such as keyword spotting and speech recognition. For implementation
+> details, please refer to: `source/application/main/include/Mfcc.hpp`
+
+Next, a window of 512 audio samples is taken from the start of the audio clip. From these 512 samples, we calculate 13
MFCC features.
The whole window is shifted to the right by 160 audio samples and 13 new MFCC features are calculated. This process of
-shifting and calculating is repeated until enough audio samples to perform an inference have been processed. In total
-this will be 296 windows that each have 13 MFCC features calculated for them.
+shifting and calculating is repeated until enough audio samples to perform an inference have been processed.
+
+In total, this is 296 windows that each have 13 MFCC features calculated for them.
+
+After extracting MFCC features, the first and second order derivatives of these features, regarding time, are
+calculated.
-After extracting MFCC features the first and second order derivatives of these features with respect to time are
-calculated. These derivative features are then standardized and concatenated with the MFCC features (which also get
-standardized). At this point the input tensor will have a shape of 296x39.
+These derivative features are then standardized and concatenated with the MFCC features (which also get standardized).
+At this point, the input tensor has a shape of 296x39.
-These extracted features are quantized, and an inference is performed.
+These extracted features are quantized and an inference is performed.
![ASR preprocessing](../media/ASR_preprocessing.png)
-For longer audio clips where multiple inferences need to be performed, then the initial starting position is offset by
-(100*160) = 16000 audio samples. From this new starting point, MFCC and derivative features are calculated as before
-until there is enough to perform another inference. Padding can be used if there are not enough audio samples for at
-least 1 inference. This step is repeated until the whole audio clip has been processed. If there are not enough audio
-samples for a final complete inference the MFCC features will be padded by repeating the last calculated feature until
-an inference can be performed.
+For longer audio clips, where multiple inferences must be performed, then the initial starting position is offset by
+`(100*160) = 16000` audio samples. From this new starting point, MFCC and derivative features are calculated as before,
+until there is enough to perform another inference.
-> **Note:** Parameters of the MFCC feature extraction such as window size, stride, number of features etc. all depend on
->what was used during model training. These values are specific to each model. If you switch to a different ASR model
->than the one supplied, then the feature extraction process could be completely different to the one currently implemented.
+Padding can be used if there are not enough audio samples for at least one inference. This step is repeated until the
+whole audio clip has been processed. If there are not enough audio samples for a final complete inference, then the MFCC
+features are padded by repeating the last calculated feature until an inference can be performed.
-The amount of audio samples we offset by for long audio clips is specific to the included wav2letter model.
+> **Note:** Parameters of the MFCC feature extraction all depend on what was used during model training. These values
+> are specific to each model.\
+If you switch to a different ASR model than the one supplied, then the feature extraction process could be completely
+different to the one currently implemented.
+
+The amount of time that audio samples that are offset for long audio clips is specific to the included *wav2letter*
+model.
### Postprocessing
-After performing an inference, the raw output need to be postprocessed to get a usable result.
+After performing an inference, the raw output must be postprocessed to get a usable result.
The raw output from the model is a tensor of shape 148x29 where each row is a probability distribution over the possible
29 characters that can appear at each of the 148 time steps.
-This wav2letter model is trained using context windows, this means that only certain parts of the output are usable
-depending on the bit of the audio clip that is currently being processed.
+This *wav2letter* model is trained using context windows. This means that, depending on the bit of the audio clip that
+is currently being processed, only certain parts of the output are usable.
+
+If this is the first inference, and multiple inferences are required, then ignore the final 49 rows of the output.
+Similarly, if this is the final inference from multiple inferences, then ignore the first 49 rows of the output.
+
+Finally, if this inference is not the last, or the first inference, then ignore the first and last 49 rows of the model
+output.
-If this is the first inference and multiple inferences are required, then ignore the final 49 rows of the output.
-Similarly, if this is the final inference from multiple inferences then ignore the first 49 rows of the output. Finally,
-if this inference is not the last or first inference then ignore the first and last 49 rows of the model output.
+> **Note:** If the audio clip is small enough, then the whole of the model output is usable and there is no need to
+> throw away any of the outputs before continuing.
-> **Note:** If the audio clip is small enough then the whole of the model output is usable and there is no need to throw
->away any of the output before continuing.
+Once any rows have been removed, the final processing can be done. To process the output, the letter with the highest
+probability at each time step is found first. Next, any letters that are repeated multiple times in a row are removed.
-Once any rows have been removed the final processing can be done. To process the output, first the letter with the
-highest probability at each time step is found. Next, any letters that are repeated multiple times in a row are removed
-(e.g. [t, t, t, o, p, p] becomes [t, o, p]). Finally, the 29th blank token letter is removed from the output.
+For example: [`t`, `t`, `t`, `o`, `p`, `p`] becomes [`t`, `o`, `p`]). Finally, the 29th blank token letter is removed
+from the output.
-For the final output, the result from all inferences are combined before decoding. What you are left with is then
+For the final output, the results from all inferences are combined before decoding. What you are left with is then
displayed to the console.
### Prerequisites
@@ -93,66 +105,68 @@ See [Prerequisites](../documentation.md#prerequisites)
### Build options
-In addition to the already specified build option in the main documentation, Automatic Speech Recognition use case
+In addition to the already specified build option in the main documentation, the Automatic Speech Recognition use-case
adds:
-- `asr_MODEL_TFLITE_PATH` - Path to the NN model file in TFLite format. Model will be processed and included into the
-application axf file. The default value points to one of the delivered set of models. Note that the parameters
-`asr_LABELS_TXT_FILE`,`TARGET_PLATFORM` and `ETHOS_U55_ENABLED` should be aligned with the chosen model, i.e.:
- - if `ETHOS_U55_ENABLED` is set to `On` or `1`, the NN model is assumed to be optimized. The model will naturally
-fall back to the Arm® Cortex®-M CPU if an unoptimized model is supplied.
- - if `ETHOS_U55_ENABLED` is set to `Off` or `0`, the NN model is assumed to be unoptimized. Supplying an optimized
-model in this case will result in a runtime error.
+- `asr_MODEL_TFLITE_PATH` - The path to the NN model file in `TFLite` format. The model is processed and then included
+ into the application `axf` file. The default value points to one of the delivered set of models. Note that the
+ parameters `asr_LABELS_TXT_FILE`,`TARGET_PLATFORM`, and `ETHOS_U55_ENABLED` must be aligned with the chosen model. In
+ other words:
+ - If `ETHOS_U55_ENABLED` is set to `On` or `1`, then the NN model is assumed to be optimized. The model naturally
+ falls back to the Arm® *Cortex®-M* CPU if an unoptimized model is supplied.
+ - If `ETHOS_U55_ENABLED` is set to `Off` or `0`, then the NN model is assumed to be unoptimized. Supplying an
+ optimized model in this case results in a runtime error.
-- `asr_FILE_PATH`: Path to the directory containing audio files, or a path to single WAV file, to be used in the
- application. The default value points
- to the resources/asr/samples folder containing the delivered set of audio clips.
+- `asr_FILE_PATH`: The path to the directory containing audio files, or a path to single WAV file, to be used in the
+ application. The default value points to the `resources/asr/samples` folder that contains the delivered set of audio
+ clips.
-- `asr_LABELS_TXT_FILE`: Path to the labels' text file. The file is used to map letter class index to the text label.
- The default value points to the delivered labels.txt file inside the delivery package.
+- `asr_LABELS_TXT_FILE`: The path to the text file for the label. The file is used to map letter class index to the text
+ label. The default value points to the delivered `labels.txt` file inside the delivery package.
-- `asr_AUDIO_RATE`: Input data sampling rate. Each audio file from asr_FILE_PATH is preprocessed during the build to
- match NN model input requirements. Default value is 16000.
+- `asr_AUDIO_RATE`: The input data sampling rate. Each audio file from `asr_FILE_PATH` is preprocessed during the build
+ to match the NN model input requirements. The default value is `16000`.
-- `asr_AUDIO_MONO`: If set to ON the audio data will be converted to mono. Default is ON.
+- `asr_AUDIO_MONO`: If set to `ON`, then the audio data is converted to mono. The default value is `ON`.
-- `asr_AUDIO_OFFSET`: Start loading audio data starting from this offset (in seconds). Default value is 0.
+- `asr_AUDIO_OFFSET`: Begins loading audio data and starts from this specified offset, defined in seconds. the default
+ value is set to `0`.
-- `asr_AUDIO_DURATION`: Length of the audio data to be used in the application in seconds. Default is 0 meaning the
- whole audio file will be taken.
+- `asr_AUDIO_DURATION`: The length of the audio data to be used in the application in seconds. The default is `0`,
+ meaning that the whole audio file is used.
- `asr_AUDIO_MIN_SAMPLES`: Minimum number of samples required by the network model. If the audio clip is shorter than
- this number, it is padded with zeros. Default value is 16000.
+ this number, then it is padded with zeros. The default value is `16000`.
-- `asr_MODEL_SCORE_THRESHOLD`: Threshold value that must be applied to the inference results for a label to be
- deemed valid. Default is 0.5.
+- `asr_MODEL_SCORE_THRESHOLD`: Threshold value that must be applied to the inference results for a label to be deemed
+ valid. The default is `0.5`.
-- `asr_ACTIVATION_BUF_SZ`: The intermediate/activation buffer size reserved for the NN model. By default, it is set
- to 2MiB and should be enough for most models.
+- `asr_ACTIVATION_BUF_SZ`: The intermediate, or activation, buffer size reserved for the NN model. By default, it is set
+ to 2MiB and is enough for most models.
-In order to build **ONLY** automatic speech recognition example application add to the `cmake` command line specified in
-[Building](../documentation.md#Building) `-DUSE_CASE_BUILD=asr`.
+To **ONLY** build the automatic speech recognition example application, add `-DUSE_CASE_BUILD=asr` to the `cmake`
+command line, as specified in: [Building](../documentation.md#Building).
### Build process
-> **Note:** This section describes the process for configuring the build for `MPS3: SSE-300` for different target
->platform see [Building](../documentation.md#Building) section.
+> **Note:** This section describes the process for configuring the build for the *MPS3: SSE-300*. To build for a
+> different target platform, please refer to: [Building](../documentation.md#Building).
-In order to build **only** the automatic speech recognition example, create a build directory and navigate inside:
+To build **only** the automatic speech recognition example, create a build directory and navigate inside, like so:
```commandline
mkdir build_asr && cd build_asr
```
-On Linux, execute the following command to build **only** Automatic Speech Recognition application to run on the
-Ethos-U55 Fast Model when providing only the mandatory arguments for CMake configuration:
+On Linux, when providing only the mandatory arguments for CMake configuration, execute the following command to build
+**only** Automatic Speech Recognition application to run on the *Ethos-U55* Fast Model:
```commandline
cmake ../ -DUSE_CASE_BUILD=asr
```
-To configure a build that can be debugged using Arm-DS, we can just specify
-the build type as `Debug` and use the `Arm Compiler` toolchain file:
+To configure a build that can be debugged using Arm DS specify the build type as `Debug` and then use the `Arm Compiler`
+toolchain file:
```commandline
cmake .. \
@@ -161,24 +175,25 @@ cmake .. \
-DUSE_CASE_BUILD=asr
```
-Also see:
+For further information, please refer to:
+
- [Configuring with custom TPIP dependencies](../sections/building.md#configuring-with-custom-tpip-dependencies)
- [Using Arm Compiler](../sections/building.md#using-arm-compiler)
- [Configuring the build for simple_platform](../sections/building.md#configuring-the-build-for-simple_platform)
-- [Working with model debugger from Arm FastModel Tools](../sections/building.md#working-with-model-debugger-from-arm-fastmodel-tools)
+- [Working with model debugger from Arm Fast Model Tools](../sections/building.md#working-with-model-debugger-from-arm-fastmodel-tools)
-> **Note:** If re-building with changed parameters values, it is highly advised to clean the build directory and re-run
->the CMake command.
+> **Note:** If re-building with changed parameters values, we recommend that you clean the build directory and re-run
+> the CMake command.
-If the CMake command succeeded, build the application as follows:
+If the CMake command succeeds, build the application as follows:
```commandline
make -j4
```
-Add `VERBOSE=1` to see compilation and link details.
+To see compilation and link details, add `VERBOSE=1`.
-Results of the build will be placed under `build/bin` folder:
+Results of the build are placed under the `build/bin` folder, like so:
```tree
bin
@@ -188,30 +203,31 @@ bin
 └── sectors
├── images.txt
└── asr
- ├── dram.bin
+ ├── ddr.bin
└── itcm.bin
```
-Where:
+The `bin` folder contains the following files:
-- `ethos-u-asr.axf`: The built application binary for the Automatic Speech Recognition use case.
+- `ethos-u-asr.axf`: The built application binary for the Automatic Speech Recognition use-case.
-- `ethos-u-asr.map`: Information from building the application (e.g. libraries used, what was optimized, location of
- objects)
+- `ethos-u-asr.map`: Information from building the application. For example: The libraries used, what was optimized, and
+ the location of objects.
- `ethos-u-asr.htm`: Human readable file containing the call graph of application functions.
-- `sectors/asr`: Folder containing the built application, split into files for loading into different FPGA memory regions.
+- `sectors/asr`: Folder containing the built application. It is split into files for loading into different FPGA memory
+ regions.
-- `sectors/images.txt`: Tells the FPGA which memory regions to use for loading the binaries in sectors/** folder.
+- `sectors/images.txt`: Tells the FPGA which memory regions to use for loading the binaries in the `sectors/..` folder.
### Add custom input
-The application performs inference on audio data found in the folder, or an individual file, set by the CMake parameter
-`asr_FILE_PATH`.
+The application anomaly detection is set up to perform inferences on data found in the folder, or an individual file,
+that is pointed to by the parameter `asr_FILE_PATH`.
-To run the application with your own audio clips first create a folder to hold them and then copy the custom audio clips
-into this folder:
+To run the application with your own audio clips, first create a folder to hold them and then copy the custom clips into
+the following folder:
```commandline
mkdir /tmp/custom_wavs
@@ -221,7 +237,7 @@ cp my_clip.wav /tmp/custom_wavs/
> **Note:** Clean the build directory before re-running the CMake command.
-Next set `asr_FILE_PATH` to the location of this folder when building:
+Next, when building, set `asr_FILE_PATH` to the location of the following folder:
```commandline
cmake .. \
@@ -229,10 +245,11 @@ cmake .. \
-DUSE_CASE_BUILD=asr
```
-The audio clips found in the `asr_FILE_PATH` folder will be picked up and automatically converted to C++ files during the
-CMake configuration stage and then compiled into the application during the build phase for performing inference with.
+The audio flies found in the `asr_FILE_PATH` folder are picked up and automatically converted to C++ files during the
+CMake configuration stage. They are then compiled into the application during the build phase for performing inference
+with.
-The log from the configuration stage should tell you what audio clip directory path has been used:
+The log from the configuration stage tells you what audio directory path has been used:
```log
-- User option asr_FILE_PATH is set to /tmp/custom_wavs
@@ -244,26 +261,29 @@ The log from the configuration stage should tell you what audio clip directory p
-- asr_FILE_PATH=/tmp/custom_wavs
```
-After compiling, your custom inputs will have now replaced the default ones in the application.
+After compiling, your custom inputs have now replaced the default ones in the application.
-> **Note:** The CMake parameter asr_AUDIO_MIN_SAMPLES determine the minimum number of input sample. When building the
->application, if the size of the audio clips is less then asr_AUDIO_MIN_SAMPLES then it will be padded so that it does.
+> **Note:** The CMake parameter `asr_AUDIO_MIN_SAMPLES` determines the minimum number of input samples. When building
+> the application, if the size of the audio clips is less than `asr_AUDIO_MIN_SAMPLES`, then it is padded until it
+> matches.
### Add custom model
-The application performs inference using the model pointed to by the CMake parameter MODEL_TFLITE_PATH.
+The application performs inference using the model pointed to by the CMake parameter `MODEL_TFLITE_PATH`.
+
+> **Note:** If you want to run the model using an *Ethos-U55*, ensure that your custom model has been successfully run
+> through the Vela compiler *before* continuing.
-> **Note:** If you want to run the model using Ethos-U55, ensure your custom model has been run through the Vela
->compiler successfully before continuing. See [Optimize model with Vela compiler](../sections/building.md#Optimize-custom-model-with-Vela-compiler).
+For further information: [Optimize model with Vela compiler](../sections/building.md#Optimize-custom-model-with-Vela-compiler).
-To run the application with a custom model you will need to provide a labels_<model_name>.txt file of labels
-associated with the model. Each line of the file should correspond to one of the outputs in your model. See the provided
-labels_wav2letter.txt file for an example.
+To run the application with a custom model, you must provide a `labels_<model_name>.txt` file of labels that are
+associated with the model. Each line of the file must correspond to one of the outputs in your model. Refer to the
+provided `labels_wav2letter.txt` file for an example.
Then, you must set `asr_MODEL_TFLITE_PATH` to the location of the Vela processed model file and `asr_LABELS_TXT_FILE`to
the location of the associated labels file.
-An example:
+For example:
```commandline
cmake .. \
@@ -274,11 +294,11 @@ cmake .. \
> **Note:** Clean the build directory before re-running the CMake command.
-The `.tflite` model file pointed to by `asr_MODEL_TFLITE_PATH` and labels text file pointed to by `asr_LABELS_TXT_FILE`
-will be converted to C++ files during the CMake configuration stage and then compiled into the application for performing
-inference with.
+The `.tflite` model file pointed to by `asr_MODEL_TFLITE_PATH`, and the labels text file pointed to by
+`asr_LABELS_TXT_FILE` are converted to C++ files during the CMake configuration stage. They are then compiled into the
+application for performing inference with.
-The log from the configuration stage should tell you what model path and labels file have been used:
+The log from the configuration stage tells you what model path and labels file have been used, for example:
```log
-- User option TARGET_PLATFORM is set to mps3
@@ -294,39 +314,43 @@ custom_model_after_vela.tflite.cc
...
```
-After compiling, your custom model will have now replaced the default one in the application.
+After compiling, your custom model has now replaced the default one in the application.
-## Setting-up and running Ethos-U55 Code Sample
+## Setting-up and running Ethos-U55 Code Samples
### Setting up the Ethos-U55 Fast Model
-The FVP is available publicly from [Arm Ecosystem FVP downloads
-](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps).
+The FVP is available publicly from
+[Arm Ecosystem FVP downloads](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps).
+
+For the *Ethos-U55* evaluation, please download the MPS3 version of the Arm® *Corstone™-300* model that contains both
+the *Ethos-U55* and *Cortex-M55*. The model is currently only supported on Linux-based machines.
-For Ethos-U55 evaluation, please download the MPS3 version of the Arm® Corstone™-300 model that contains Ethos-U55 and
-Cortex-M55. The model is currently only supported on Linux based machines. To install the FVP:
+To install the FVP:
-- Unpack the archive
+- Unpack the archive.
-- Run the install script in the extracted package
+- Run the install script in the extracted package:
```commandline
./FVP_Corstone_SSE-300_Ethos-U55.sh
```
-- Follow the instructions to install the FVP to your desired location
+- Follow the instructions to install the FVP to the required location.
### Starting Fast Model simulation
-Once completed the building step, application binary ethos-u-asr.axf can be found in the `build/bin` folder.
-Assuming the install location of the FVP was set to ~/FVP_install_location, the simulation can be started by:
+Once the building has been completed, the application binary `ethos-u-asr.axf` can be found in the `build/bin` folder.
+
+Assuming that the install location of the FVP was set to `~/FVP_install_location`, then the simulation can be started by
+using:
```commandline
~/FVP_install_location/models/Linux64_GCC-6.4/FVP_Corstone_SSE-300_Ethos-U55
./bin/mps3-sse-300/ethos-u-asr.axf
```
-A log output should appear on the terminal:
+A log output appears on the terminal:
```log
telnetterminal0: Listening for serial connection on port 5000
@@ -335,13 +359,15 @@ telnetterminal2: Listening for serial connection on port 5002
telnetterminal5: Listening for serial connection on port 5003
```
-This will also launch a telnet window with the sample application's standard output and error log entries containing
-information about the pre-built application version, TensorFlow Lite Micro library version used, data type as well as
-the input and output tensor sizes of the model compiled into the executable binary.
+This also launches a telnet window with the standard output of the sample application. It also includes error log
+entries containing information about the pre-built application version, TensorFlow Lite Micro library version used, and
+data types. The log also includes the input and output tensor sizes of the model compiled into the executable binary.
+
+After the application has started, if `asr_FILE_PATH` points to a single file, or even a folder that contains a single
+input file, then the inference starts immediately. If there are multiple inputs, it outputs a menu and then waits for
+input from the user.
-After the application has started if `asr_FILE_PATH` pointed to a single file (or a folder containing a single input file)
-the inference starts immediately. In case of multiple inputs choice, it outputs a menu and waits for the user input from
-telnet terminal:
+For example:
```log
User input required
@@ -357,50 +383,47 @@ Choice:
```
-1. “Classify next audio clip” menu option will run inference on the next in line voice clip from the collection of the
- compiled audio.
+What the preceding choices do:
- > **Note:** Note that if the clip is over a certain length, the application will invoke multiple inference runs to
- >cover the entire file.
+1. Classify next audio clip: Runs a single inference on the next in line.
-2. “Classify audio clip at chosen index” menu option will run inference on the chosen audio clip.
+2. Classify audio clip at chosen index: Runs inference on the chosen audio clip.
- > **Note:** Please make sure to select audio clip index in the range of supplied audio clips during application build.
- By default, pre-built application has 4 files, indexes from 0 to 3.
+ > **Note:** Please make sure to select audio clip index within the range of supplied audio clips during application
+ > build. By default, a pre-built application has four files, with indexes from `0` to `3`.
-3. “Run classification on all audio clips” menu option triggers sequential inference executions on all built-in voice
- samples.
+3. Run ... on all: Triggers sequential inference executions on all built-in applications.
-4. “Show NN model info” menu option prints information about model data type, input and output tensor sizes:
+4. Show NN model info: Prints information about the model data type, input, and output, tensor sizes:
```log
INFO - uTFL version: 2.5.0
INFO - Model info:
INFO - Model INPUT tensors:
- INFO - tensor type is INT8
- INFO - tensor occupies 11544 bytes with dimensions
- INFO - 0: 1
- INFO - 1: 296
- INFO - 2: 39
+ INFO - tensor type is INT8
+ INFO - tensor occupies 11544 bytes with dimensions
+ INFO - 0: 1
+ INFO - 1: 296
+ INFO - 2: 39
INFO - Quant dimension: 0
INFO - Scale[0] = 0.110316
INFO - ZeroPoint[0] = -11
INFO - Model OUTPUT tensors:
- INFO - tensor type is INT8
- INFO - tensor occupies 4292 bytes with dimensions
- INFO - 0: 1
- INFO - 1: 1
- INFO - 2: 148
- INFO - 3: 29
+ INFO - tensor type is INT8
+ INFO - tensor occupies 4292 bytes with dimensions
+ INFO - 0: 1
+ INFO - 1: 1
+ INFO - 2: 148
+ INFO - 3: 29
INFO - Quant dimension: 0
INFO - Scale[0] = 0.003906
INFO - ZeroPoint[0] = -128
INFO - Activation buffer (a.k.a tensor arena) size used: 783168
INFO - Number of operators: 1
- INFO - Operator 0: ethos-u
+ INFO - Operator 0: ethos-u
```
-5. “List” menu option prints a list of pair audio clip indexes - the original filenames embedded in the application:
+5. List audio clips: Prints a list of pair ... indexes. The original filenames are embedded in the application, like so:
```log
[INFO] List of Files:
@@ -414,7 +437,7 @@ Choice:
Please select the first menu option to execute Automatic Speech Recognition.
-The following example illustrates application output:
+The following example illustrates the output of an application:
```log
INFO - Running inference on audio clip 0 => another_door.wav
@@ -434,28 +457,28 @@ INFO - NPU IDLE cycles: 476
INFO - NPU total cycles: 28451172
```
-It could take several minutes to complete each inference (average time is 5-7 minutes), and on this audio clip multiple
-inferences were required to cover the whole clip.
+It can take several minutes to complete each inference. The average time is around 5-7 minutes, and on this audio clip,
+multiple inferences were required to cover the whole clip.
The profiling section of the log shows that for the first inference:
-- Ethos-U55's PMU report:
+- *Ethos-U55* PMU report:
- - 28,451,172 total cycle: The number of NPU cycles
+ - 28,451,172 total cycle: The number of NPU cycles.
- - 28,450,696 active cycles: number of NPU cycles that were used for computation
+ - 28,450,696 active cycles: The number of NPU cycles that were used for computation.
- - 476 idle cycles: number of cycles for which the NPU was idle
+ - 476 idle cycles: The number of cycles for which the NPU was idle.
- - 6,564,262 AXI0 read beats: The number of AXI beats with read transactions from AXI0 bus.
- AXI0 is the bus where Ethos-U55 NPU reads and writes to the computation buffers (activation buf/tensor arenas).
+ - 6,564,262 AXI0 read beats: The number of AXI beats with read transactions from the AXI0 bus. AXI0 is the bus where
+ the *Ethos-U55* NPU reads and writes to the computation buffers, activation buf, or tensor arenas.
- - 928,889 AXI0 write beats: The number of AXI beats with write transactions to AXI0 bus.
+ - 928,889 AXI0 write beats: The number of AXI beats with write transactions to the AXI0 bus.
- - 841,712 AXI1 read beats: The number of AXI beats with read transactions from AXI1 bus.
- AXI1 is the bus where Ethos-U55 NPU reads the model (read only)
+ - 841,712 AXI1 read beats: The number of AXI beats with read transactions from the AXI1 bus. AXI1 is the bus where the
+ *Ethos-U55* NPU reads the model. So, read-only.
-- For FPGA platforms, CPU cycle count can also be enabled. For FVP, however, CPU cycle counters should not be used as
- the CPU model is not cycle-approximate or cycle-accurate.
+- For FPGA platforms, a CPU cycle count can also be enabled. However, do not use cycle counters for FVP, as the CPU
+ model is not cycle-approximate or cycle-accurate.
-The application prints the decoded output from each of the inference runs as well as the final combined result.
+The application prints the decoded output from each of the inference runs, and the final combined result.
diff --git a/docs/use_cases/img_class.md b/docs/use_cases/img_class.md
index 2a31322..9a3451d 100644
--- a/docs/use_cases/img_class.md
+++ b/docs/use_cases/img_class.md
@@ -15,13 +15,12 @@
## Introduction
-This document describes the process of setting up and running the Arm® Ethos™-U55 Image Classification
-example.
+This document describes the process of setting up and running the Arm® *Ethos™-U55* Image Classification example.
-Use case solves classical computer vision problem: image classification. The ML sample was developed using MobileNet v2
-model trained on ImageNet dataset.
+This use-case example solves the classical computer vision problem of image classification. The ML sample was developed
+using the *MobileNet v2* model that was trained on the *ImageNet* dataset.
-Use case code could be found in [source/use_case/img_class](../../source/use_case/img_class]) directory.
+Use-case code could be found in the following directory:[source/use_case/img_class](../../source/use_case/img_class]).
### Prerequisites
@@ -31,57 +30,62 @@ See [Prerequisites](../documentation.md#prerequisites)
### Build options
-In addition to the already specified build option in the main documentation, Image Classification use case specifies:
+In addition to the already specified build option in the main documentation, the Image Classification use-case
+specifies:
-- `img_class_MODEL_TFLITE_PATH` - Path to the NN model file in TFLite format. Model will be processed and included into
- the application axf file. The default value points to one of the delivered set of models. Note that the parameters
- `img_class_LABELS_TXT_FILE`,`TARGET_PLATFORM` and `ETHOS_U55_ENABLED` should be aligned with the chosen model, i.e.:
- - if `ETHOS_U55_ENABLED` is set to `On` or `1`, the NN model is assumed to be optimized. The model will naturally
- fall back to the Arm® Cortex®-M CPU if an unoptimized model is supplied.
+- `img_class_MODEL_TFLITE_PATH` - The path to the NN model file in the `TFLite` format. The model is then processed and
+ included in the application `axf` file. The default value points to one of the delivered set of models.
+
+ Note that the parameters `img_class_LABELS_TXT_FILE`,`TARGET_PLATFORM`, and `ETHOS_U55_ENABLED` must be aligned with
+ the chosen model. In other words:
+
+ - If `ETHOS_U55_ENABLED` is set to `On` or `1`, then the NN model is assumed to be optimized. The model naturally
+ falls back to the Arm® *Cortex®-M* CPU if an unoptimized model is supplied.
- if `ETHOS_U55_ENABLED` is set to `Off` or `0`, the NN model is assumed to be unoptimized. Supplying an optimized
- model in this case will result in a runtime error.
+ model in this case results in a runtime error.
-- `img_class_FILE_PATH`: Path to the directory containing images, or path to a single image file, to be used file(s) in
- the application. The default value points to the resources/img_class/samples folder containing the delivered
- set of images. See more in the [Add custom input data section](#add-custom-input).
+- `img_class_FILE_PATH`: The path to the directory containing the images, or a path to a single image file, that is to
+ be used in the application. The default value points to the `resources/img_class/samples` folder containing the
+ delivered set of images.
-- `img_class_IMAGE_SIZE`: The NN model requires input images to be of a specific size. This parameter defines the
- size of the image side in pixels. Images are considered squared. Default value is 224, which is what the supplied
- MobilenetV2-1.0 model expects.
+ For further information, please refer to: [Add custom input data section](#add-custom-input).
-- `img_class_LABELS_TXT_FILE`: Path to the labels' text file to be baked into the application. The file is used to
- map classified classes index to the text label. Change this parameter to point to the custom labels file to map
- custom NN model output correctly.\
- The default value points to the delivered labels.txt file inside the delivery package.
+- `img_class_IMAGE_SIZE`: The NN model requires input images to be of a specific size. This parameter defines the size
+ of the image side in pixels. Images are considered squared. The default value is `224`, which is what the supplied
+ *MobilenetV2-1.0* model expects.
-- `img_class_ACTIVATION_BUF_SZ`: The intermediate/activation buffer size reserved for the NN model. By default, it
- is set to 2MiB and should be enough for most models.
+- `img_class_LABELS_TXT_FILE`: The path to the text file for the label. The file is used to map a classified class index
+ to the text label. The default value points to the delivered `labels.txt` file inside the delivery package. Change
+ this parameter to point to the custom labels file to map custom NN model output correctly.
-- `USE_CASE_BUILD`: set to img_class to build only this example.
+- `img_class_ACTIVATION_BUF_SZ`: The intermediate, or activation, buffer size reserved for the NN model. By default, it
+ is set to 2MiB and is enough for most models.
-In order to build **ONLY** Image Classification example application add to the `cmake` command line specified in
-[Building](../documentation.md#Building) `-DUSE_CASE_BUILD=img_class`.
+- `USE_CASE_BUILD`: is set to `img_class` to only build this example.
+
+To build **ONLY** the Image Classification example application, add `-DUSE_CASE_BUILD=img_class` to the `cmake` command
+line, as specified in: [Building](../documentation.md#Building).
### Build process
-> **Note:** This section describes the process for configuring the build for `MPS3: SSE-300` for different target platform
-see [Building](../documentation.md#Building).
+> **Note:** This section describes the process for configuring the build for the *MPS3: SSE-300*. To build for a
+> different target platform, please refer to: [Building](../documentation.md#Building).
-Create a build directory folder and navigate inside:
+Create a build directory and navigate inside, like so:
```commandline
mkdir build_img_class && cd build_img_class
```
-On Linux, execute the following command to build **only** Image Classification application to run on the Ethos-U55 Fast
-Model when providing only the mandatory arguments for CMake configuration:
+On Linux, when providing only the mandatory arguments for the CMake configuration, execute the following command to
+build **only** Image Classification application to run on the *Ethos-U55* Fast Model:
```commandline
cmake ../ -DUSE_CASE_BUILD=img_class
```
-To configure a build that can be debugged using Arm-DS, we can just specify
-the build type as `Debug` and use the `Arm Compiler` toolchain file:
+To configure a build that can be debugged using Arm DS specify the build type as `Debug` and then use the `Arm Compiler`
+toolchain file:
```commandline
cmake .. \
@@ -90,15 +94,15 @@ cmake .. \
-DUSE_CASE_BUILD=img_class
```
-Also see:
+For further information, please refer to:
- [Configuring with custom TPIP dependencies](../sections/building.md#configuring-with-custom-tpip-dependencies)
- [Using Arm Compiler](../sections/building.md#using-arm-compiler)
- [Configuring the build for simple_platform](../sections/building.md#configuring-the-build-for-simple_platform)
-- [Working with model debugger from Arm FastModel Tools](../sections/building.md#working-with-model-debugger-from-arm-fastmodel-tools)
+- [Working with model debugger from Arm Fast Model Tools](../sections/building.md#working-with-model-debugger-from-arm-fastmodel-tools)
-> **Note:** If re-building with changed parameters values, it is highly advised to clean the build directory and re-run
->the CMake command.
+> **Note:** If re-building with changed parameters values, we recommend that you clean the build directory and re-run
+> the CMake command.
If the CMake command succeeds, build the application as follows:
@@ -106,9 +110,9 @@ If the CMake command succeeds, build the application as follows:
make -j4
```
-Add VERBOSE=1 to see compilation and link details.
+To see compilation and link details, add `VERBOSE=1`.
-Results of the build will be placed under `build/bin` folder:
+Results of the build are placed under the `build/bin` folder, like so:
```tree
bin
@@ -118,30 +122,32 @@ bin
 └── sectors
├── images.txt
└── img_class
- ├── dram.bin
+ ├── ddr.bin
└── itcm.bin
```
-Where:
+The `bin` folder contains the following files:
-- `ethos-u-img_class.axf`: The built application binary for the Image Classification use case.
+- `ethos-u-img_class.axf`: The built application binary for the Image Classification use-case.
-- `ethos-u-img_class.map`: Information from building the application (e.g. libraries used, what was optimized, location
- of objects)
+- `ethos-u-img_class.map`: Information from building the application. For example: The libraries used, what was
+ optimized, and the location of objects.
- `ethos-u-img_class.htm`: Human readable file containing the call graph of application functions.
-- `sectors/img_class`: Folder containing the built application, split into files for loading into different FPGA memory regions.
+- `sectors/img_class`: Folder containing the built application. It is split into files for loading into different FPGA memory
+ regions.
-- `sectors/images.txt`: Tells the FPGA which memory regions to use for loading the binaries in sectors/** folder.
+- `sectors/images.txt`: Tells the FPGA which memory regions to use for loading the binaries in the `sectors/..`
+ folder.
### Add custom input
-The application performs inference on input data found in the folder, or an individual file set by the CMake parameter
-img_class_FILE_PATH.
+The application anomaly detection is set up to perform inferences on data found in the folder, or an individual file,
+that is pointed to by the parameter `img_class_FILE_PATH`.
-To run the application with your own images, first create a folder to hold them and then copy the custom images into
-this folder, for example:
+To run the application with your own images, first create a folder to hold them and then copy the custom images into the
+following folder:
```commandline
mkdir /tmp/custom_images
@@ -151,7 +157,7 @@ cp custom_image1.bmp /tmp/custom_images/
> **Note:** Clean the build directory before re-running the CMake command.
-Next set `img_class_FILE_PATH` to the location of this folder when building:
+Next, set `img_class_FILE_PATH` to the location of this folder when building:
```commandline
cmake .. \
@@ -159,11 +165,11 @@ cmake .. \
-DUSE_CASE_BUILD=img_class
```
-The images found in the `img_class_FILE_PATH` folder will be picked up and automatically converted to C++ files during
-the CMake configuration stage and then compiled into the application during the build phase for performing inference
+The images found in the `img_class_FILE_PATH` folder are picked up and automatically converted to C++ files during the
+CMake configuration stage. They are then compiled into the application during the build phase for performing inference
with.
-The log from the configuration stage should tell you what image directory path has been used:
+The log from the configuration stage tells you what image directory path has been used:
```log
-- User option img_class_FILE_PATH is set to /tmp/custom_images
@@ -178,26 +184,29 @@ The log from the configuration stage should tell you what image directory path h
-- img_class_IMAGE_SIZE=224
```
-After compiling, your custom images will have now replaced the default ones in the application.
+After compiling, your custom images have now replaced the default ones in the application.
-> **Note:** The CMake parameter IMAGE_SIZE should match the model input size. When building the application,
-if the size of any image does not match IMAGE_SIZE then it will be rescaled and padded so that it does.
+> **Note:** The CMake parameter `IMAGE_SIZE` must match the model input size. When building the application, if the size
+of any image does not match `IMAGE_SIZE`, then it is rescaled and padded so that it does.
### Add custom model
-The application performs inference using the model pointed to by the CMake parameter MODEL_TFLITE_PATH.
+The application performs inference using the model pointed to by the CMake parameter `MODEL_TFLITE_PATH`.
+
+> **Note:** If you want to run the model using an *Ethos-U55*, ensure that your custom model has been successfully run
+> through the Vela compiler *before* continuing.
-> **Note:** If you want to run the model using Ethos-U55, ensure your custom model has been run through the Vela compiler
->successfully before continuing. See [Optimize model with Vela compiler](../sections/building.md#Optimize-custom-model-with-Vela-compiler).
+For further information: [Optimize model with Vela compiler](../sections/building.md#Optimize-custom-model-with-Vela-compiler).
-To run the application with a custom model you will need to provide a labels_<model_name>.txt file of labels
-associated with the model. Each line of the file should correspond to one of the outputs in your model. See the provided
-labels_mobilenet_v2_1.0_224.txt file for an example.
+To run the application with a custom model, you must provide a `labels_<model_name>.txt` file of labels that are
+associated with the model. Each line of the file must correspond to one of the outputs in your model.
+
+Refer to the provided `labels_mobilenet_v2_1.0_224.txt` file for an example.
Then, you must set `img_class_MODEL_TFLITE_PATH` to the location of the Vela processed model file and
`img_class_LABELS_TXT_FILE` to the location of the associated labels file.
-An example:
+For example:
```commandline
cmake .. \
@@ -208,11 +217,11 @@ cmake .. \
> **Note:** Clean the build directory before re-running the CMake command.
-The `.tflite` model file pointed to by `img_class_MODEL_TFLITE_PATH` and labels text file pointed to by
-`img_class_LABELS_TXT_FILE` will be converted to C++ files during the CMake configuration stage and then compiled into
+The `.tflite` model file pointed to by `img_class_MODEL_TFLITE_PATH`, and the labels text file pointed to by
+`img_class_LABELS_TXT_FILE` are converted to C++ files during the CMake configuration stage. They are then compiled into
the application for performing inference with.
-The log from the configuration stage should tell you what model path and labels file have been used:
+The log from the configuration stage tells you what model path and labels file have been used, for example:
```log
-- User option img_class_MODEL_TFLITE_PATH is set to <path/to/custom_model_after_vela.tflite>
@@ -227,38 +236,44 @@ custom_model_after_vela.tflite.cc
...
```
-After compiling, your custom model will have now replaced the default one in the application.
+After compiling, your custom model has now replaced the default one in the application.
## Setting up and running Ethos-U55 code sample
### Setting up the Ethos-U55 Fast Model
-The FVP is available publicly from [Arm Ecosystem FVP downloads](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps).
+The FVP is available publicly from
+[Arm Ecosystem FVP downloads](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps).
+
+For the *Ethos-U55* evaluation, please download the MPS3 version of the Arm® *Corstone™-300* model that contains both
+the *Ethos-U55* and *Cortex-M55*. The model is currently only supported on Linux-based machines.
-For Ethos-U55 evaluation, please download the MPS3 version of the Arm® Corstone™-300 model that contains Ethos-U55 and
-Cortex-M55. The model is currently only supported on Linux based machines. To install the FVP:
+To install the FVP:
-- Unpack the archive
+- Unpack the archive.
-- Run the install script in the extracted package
+- Run the install script in the extracted package:
```commandline
-$./FVP_Corstone_SSE-300_Ethos-U55.sh
+./FVP_Corstone_SSE-300_Ethos-U55.sh
```
-- Follow the instructions to install the FVP to your desired location
+- Follow the instructions to install the FVP to the required location.
### Starting Fast Model simulation
-Pre-built application binary ethos-u-img_class.axf can be found in the bin/mps3-sse-300 folder of the delivery package.
-Assuming the install location of the FVP was set to ~/FVP_install_location, the simulation can be started by:
+The pre-built application binary `ethos-u-img_class.axf` can be found in the `bin/mps3-sse-300` folder of the delivery
+package.
+
+Assuming that the install location of the FVP was set to `~/FVP_install_location`, then the simulation can be started by
+using:
```commandline
~/FVP_install_location/models/Linux64_GCC-6.4/FVP_Corstone_SSE-300_Ethos-U55
./bin/mps3-sse-300/ethos-u-img_class.axf
```
-A log output should appear on the terminal:
+A log output appears on the terminal:
```log
telnetterminal0: Listening for serial connection on port 5000
@@ -267,13 +282,13 @@ telnetterminal2: Listening for serial connection on port 5002
telnetterminal5: Listening for serial connection on port 5003
```
-This will also launch a telnet window with the sample application's standard output and error log entries containing
-information about the pre-built application version, TensorFlow Lite Micro library version used, data type as well as
-the input and output tensor sizes of the model compiled into the executable binary.
+This also launches a telnet window with the standard output of the sample application. It also includes error log
+entries containing information about the pre-built application version, TensorFlow Lite Micro library version used, and
+data types. The log also includes the input and output tensor sizes of the model compiled into the executable binary.
-After the application has started if `img_class_FILE_PATH` pointed to a single file (or a folder containing a single image)
-the inference starts immediately. In case of multiple inputs choice, it outputs a menu and waits for the user input from
-telnet terminal:
+After the application has started, if `img_class_FILE_PATH` points to a single file, or even a folder that contains a
+single image, then the inference starts immediately. If there are multiple inputs, it outputs a menu and then waits for
+input from the user:
```log
User input required
@@ -289,45 +304,46 @@ Choice:
```
-1. “Classify next image” menu option will run single inference on the next in line image from the collection of the
- compiled images.
+What the preceding choices do:
+
+1. Classify next image: Runs a single inference on the next in line image from the collection of the compiled images.
-2. “Classify image at chosen index” menu option will run single inference on the chosen image.
+2. Classify image at chosen index: Runs inference on the chosen image.
- > **Note:** Please make sure to select image index in the range of supplied images during application build.
- By default, pre-built application has 4 images, indexes from 0 to 3.
+ > **Note:** Please make sure to select image index from within the range of supplied audio clips during application
+ > build. By default, a pre-built application has four images, with indexes from `0` to `3`.
-3. “Run classification on all images” menu option triggers sequential inference executions on all built-in images.
+3. Run classification on all images: Triggers sequential inference executions on all built-in images.
-4. “Show NN model info” menu option prints information about model data type, input and output tensor sizes:
+4. Show NN model info: Prints information about the model data type, input, and output, tensor sizes:
```log
INFO - uTFL version: 2.5.0
INFO - Model info:
INFO - Model INPUT tensors:
- INFO - tensor type is UINT8
- INFO - tensor occupies 150528 bytes with dimensions
- INFO - 0: 1
- INFO - 1: 224
- INFO - 2: 224
- INFO - 3: 3
+ INFO - tensor type is UINT8
+ INFO - tensor occupies 150528 bytes with dimensions
+ INFO - 0: 1
+ INFO - 1: 224
+ INFO - 2: 224
+ INFO - 3: 3
INFO - Quant dimension: 0
INFO - Scale[0] = 0.007812
INFO - ZeroPoint[0] = 128
INFO - Model OUTPUT tensors:
- INFO - tensor type is UINT8
- INFO - tensor occupies 1001 bytes with dimensions
- INFO - 0: 1
- INFO - 1: 1001
+ INFO - tensor type is UINT8
+ INFO - tensor occupies 1001 bytes with dimensions
+ INFO - 0: 1
+ INFO - 1: 1001
INFO - Quant dimension: 0
INFO - Scale[0] = 0.098893
INFO - ZeroPoint[0] = 58
INFO - Activation buffer (a.k.a tensor arena) size used: 521760
INFO - Number of operators: 1
- INFO - Operator 0: ethos-u
+ INFO - Operator 0: ethos-u
```
-5. “List Images” menu option prints a list of pair image indexes - the original filenames embedded in the application:
+5. List Images: Prints a list of pair image indexes. The original filenames are embedded in the application, like so:
```log
INFO - List of Files:
@@ -341,7 +357,7 @@ Choice:
Please select the first menu option to execute Image Classification.
-The following example illustrates application output for classification:
+The following example illustrates an application output for classification:
```log
INFO - Running inference on image 0 => cat.bmp
@@ -361,31 +377,31 @@ INFO - NPU IDLE cycles: 914
INFO - NPU total cycles: 7490172
```
-It could take several minutes to complete one inference run (average time is 2-3 minutes).
+It can take several minutes to complete one inference run. The average time is around 2-3 minutes.
-The log shows the inference results for “image 0” (0 - index) that corresponds to “cat.bmp” in the sample image resource
-folder.
+The log shows the inference results for `image 0`, so `0` - `index`, that corresponds to `cat.bmp` in the sample image
+resource folder.
The profiling section of the log shows that for this inference:
-- Ethos-U55's PMU report:
+- *Ethos-U55* PMU report:
- - 7,490,172 total cycle: The number of NPU cycles
+ - 7,490,172 total cycle: The number of NPU cycles.
- - 7,489,258 active cycles: number of NPU cycles that were used for computation
+ - 7,489,258 active cycles: The number of NPU cycles that were used for computation.
- - 914 idle cycles: number of cycles for which the NPU was idle
+ - 914 idle cycles: The number of cycles for which the NPU was idle.
- - 2,489,726 AXI0 read beats: The number of AXI beats with read transactions from AXI0 bus.
- AXI0 is the bus where Ethos-U55 NPU reads and writes to the computation buffers (activation buf/tensor arenas).
+ - 2,489,726 AXI0 read beats: The number of AXI beats with read transactions from AXI0 bus. AXI0 is the bus where the
+ *Ethos-U55* NPU reads and writes to the computation buffers, activation buf, or tensor arenas.
- 1,098,726 AXI0 write beats: The number of AXI beats with write transactions to AXI0 bus.
- - 471,129 AXI1 read beats: The number of AXI beats with read transactions from AXI1 bus.
- AXI1 is the bus where Ethos-U55 NPU reads the model (read only)
+ - 471,129 AXI1 read beats: The number of AXI beats with read transactions from AXI1 bus. AXI1 is the bus where the
+ *Ethos-U55* NPU reads the model. So, read-only.
-- For FPGA platforms, CPU cycle count can also be enabled. For FVP, however, CPU cycle counters should not be used as
- the CPU model is not cycle-approximate or cycle-accurate.
+- For FPGA platforms, a CPU cycle count can also be enabled. However, do not use cycle counters for FVP, as the CPU
+ model is not cycle-approximate or cycle-accurate
-The application prints the top 5 classes with indexes, confidence score and labels from associated
-labels_mobilenet_v2_1.0_224.txt file. The FVP window also shows the output on its LCD section.
+The application prints the top five classes with indexes, a confidence score, and labels from the associated
+*labels_mobilenet_v2_1.0_224.txt* file. The FVP window also shows the output on its LCD section.
diff --git a/docs/use_cases/inference_runner.md b/docs/use_cases/inference_runner.md
index 0ac604b..acfdb78 100644
--- a/docs/use_cases/inference_runner.md
+++ b/docs/use_cases/inference_runner.md
@@ -14,20 +14,21 @@
## Introduction
-This document describes the process of setting up and running the Arm® Ethos™-U55 NPU Inference Runner.
-The inference runner is intended for quickly checking profiling results for any desired network, providing it has been
+This document describes the process of setting up and running the Arm® *Ethos™-U55* NPU Inference Runner.
+
+The inference runner is intended for quickly checking profiling results for any wanted network, providing it has been
processed by the Vela compiler.
-A simple model is provided with the Inference Runner as an example, but it is expected that the user will replace this
-model with one they wish to profile, see [Add custom model](./inference_runner.md#Add-custom-model) for more details.
+A simple model is provided with the Inference Runner as an example. However, we expect you to replace this model with
+one that you must profile.
-The inference runner is intended for quickly checking profiling results for any desired network
-providing it has been processed by the Vela compiler.
+For further details, refer to: [Add custom model](./inference_runner.md#Add-custom-model).
-The inference runner will populate all input tensors for the provided model with randomly generated data and an
-inference is then performed. Profiling results are then displayed in the console.
+The inference runner populates all input tensors for the provided model with randomly generated data and an inference is
+then performed. Profiling results are then displayed in the console.
-Use case code could be found in [source/use_case/inference_runner](../../source/use_case/inference_runner]) directory.
+The example use-case code can be found in the following directory:
+[source/use_case/inference_runner](../../source/use_case/inference_runner]).
### Prerequisites
@@ -37,42 +38,46 @@ See [Prerequisites](../documentation.md#prerequisites)
### Build options
-In addition to the already specified build option in the main documentation, the Inference Runner use case adds:
+In addition to the already specified build option in the main documentation, the Inference Runner use-case adds the
+following:
+
+- `inference_runner_MODEL_TFLITE_PATH` - The path to the NN model file in the `TFLite` format. The model is then
+ processed and included in the application `axf` file. The default value points to one of the delivered set of models.
+
+ Note that the parameters `TARGET_PLATFORM` and `ETHOS_U55_ENABLED` must be aligned with the chosen model. In other
+ words:
-- `inference_runner_MODEL_TFLITE_PATH` - Path to the NN model file in TFLite format. Model will be processed and
- included into the application axf file. The default value points to one of the delivered set of models.
- Note that the parameters `TARGET_PLATFORM` and `ETHOS_U55_ENABLED` should be aligned with the chosen model, i.e.:
- - if `ETHOS_U55_ENABLED` is set to `On` or `1`, the NN model is assumed to be optimized. The model will naturally
- all back to the Arm® Cortex®-M CPU if an unoptimized model is supplied.
- - if `ETHOS_U55_ENABLED` is set to `Off` or `0`, the NN model is assumed to be unoptimized. Supplying an optimized model
- in this case will result in a runtime error.
+ - If `ETHOS_U55_ENABLED` is set to `On` or `1`, then the NN model is assumed to be optimized. The model naturally
+ falls back to the Arm® *Cortex®-M* CPU if an unoptimized model is supplied.
+ - if `ETHOS_U55_ENABLED` is set to `Off` or `0`, the NN model is assumed to be unoptimized. Supplying an optimized
+ model in this case results in a runtime error.
-- `inference_runner_ACTIVATION_BUF_SZ`: The intermediate/activation buffer size reserved for the NN model. By
- default, it is set to 2MiB and should be enough for most models.
+- `inference_runner_ACTIVATION_BUF_SZ`: The intermediate, or activation, buffer size reserved for the NN model. By
+ default, it is set to 2MiB and is enough for most models.
-In order to build **ONLY** Inference Runner example application add to the `cmake` command line specified in
-[Building](../documentation.md#Building) `-DUSE_CASE_BUILD=inferece_runner`.
+To build **ONLY** the Inference Runner example application, add `-DUSE_CASE_BUILD=inferece_runner` to the `cmake`
+command line, as specified in: [Building](../documentation.md#Building).
### Build process
-> **Note:** This section describes the process for configuring the build for `MPS3: SSE-300` for different target platform
->see [Building](../documentation.md#Building) section.
+> **Note:** This section describes the process for configuring the build for the *MPS3: SSE-300*. To build for a
+> different target platform, please refer to: [Building](../documentation.md#Building).
-Create a build directory and navigate inside:
+Create a build directory and navigate inside, like so:
```commandline
mkdir build_inference_runner && cd build_inference_runner
```
-On Linux, execute the following command to build **only** Inference Runner application to run on the Ethos-U55 Fast
-Model when providing only the mandatory arguments for CMake configuration:
+On Linux, when providing only the mandatory arguments for the CMake configuration, execute the following command to
+build **only** Image Classification application to run on the *Ethos-U55* Fast Model:
```commandline
cmake ../ -DUSE_CASE_BUILD=inference_runner
```
-To configure a build that can be debugged using Arm-DS, we can just specify
-the build type as `Debug` and use the `Arm Compiler` toolchain file:
+To configure a build that can be debugged using Arm DS specify the build type as `Debug` and then use the `Arm Compiler`
+toolchain file:
```commandline
cmake .. \
@@ -81,25 +86,25 @@ cmake .. \
-DUSE_CASE_BUILD=inference_runner
```
-Also see:
+For further information, please refer to:
- [Configuring with custom TPIP dependencies](../sections/building.md#configuring-with-custom-tpip-dependencies)
- [Using Arm Compiler](../sections/building.md#using-arm-compiler)
- [Configuring the build for simple_platform](../sections/building.md#configuring-the-build-for-simple_platform)
-- [Working with model debugger from Arm FastModel Tools](../sections/building.md#working-with-model-debugger-from-arm-fastmodel-tools)
+- [Working with model debugger from Arm Fast Model Tools](../sections/building.md#working-with-model-debugger-from-arm-fastmodel-tools)
-> **Note:** If re-building with changed parameters values, it is highly advised to clean the build directory and re-run
->the CMake command.
+> **Note:** If re-building with changed parameters values, we recommend that you clean the build directory and re-run
+> the CMake command.
-If the CMake command succeeded, build the application as follows:
+If the CMake command succeeds, build the application as follows:
```commandline
make -j4
```
-Add VERBOSE=1 to see compilation and link details.
+To see compilation and link details, add `VERBOSE=1`.
-Results of the build will be placed under `build/bin` folder:
+Results of the build are placed under the `build/bin` folder, like so:
```tree
bin
@@ -107,32 +112,35 @@ bin
 ├── ethos-u-inference_runner.htm
 ├── ethos-u-inference_runner.map
 └── sectors
- ├── images.txt
└── inference_runner
- ├── dram.bin
+ ├── ddr.bin
└── itcm.bin
```
-Where:
+The `bin` folder contains the following files:
-- `ethos-u-inference_runner.axf`: The built application binary for the Inference Runner use case.
+- `ethos-u-inference_runner.axf`: The built application binary for the Inference Runner use-case.
-- `ethos-u-inference_runner.map`: Information from building the application (e.g. libraries used, what was optimized,
- location of objects)
+- `ethos-u-inference_runner.map`: Information from building the application. For example: The libraries used, what was
+ optimized, and the location of objects.
- `ethos-u-inference_runner.htm`: Human readable file containing the call graph of application functions.
-- `sectors/inference_runner`: Folder containing the built application, split into files for loading into different FPGA memory regions.
+- `sectors/inference_runner`: Folder containing the built application. It is split into files for loading into different FPGA memory
+ regions.
-- `sectors/images.txt`: Tells the FPGA which memory regions to use for loading the binaries in sectors/**
- folder.
+- `sectors/images.txt`: Tells the FPGA which memory regions to use for loading the binaries in the `sectors/..`
+ folder.
### Add custom model
-The application performs inference using the model pointed to by the CMake parameter `inference_runner_MODEL_TFLITE_PATH`.
+The application performs inference using the model pointed to by the CMake parameter
+`inference_runner_MODEL_TFLITE_PATH`.
-> **Note:** If you want to run the model using Ethos-U55, ensure your custom model has been run through the Vela compiler
->successfully before continuing. See [Optimize model with Vela compiler](../sections/building.md#Optimize-custom-model-with-Vela-compiler).
+> **Note:** If you want to run the model using an *Ethos-U55*, ensure that your custom model has been successfully run
+> through the Vela compiler *before* continuing.
+
+For further information: [Optimize model with Vela compiler](../sections/building.md#Optimize-custom-model-with-Vela-compiler).
Then, you must set `inference_runner_MODEL_TFLITE_PATH` to the location of the Vela processed model file.
@@ -146,10 +154,10 @@ cmake .. \
> **Note:** Clean the build directory before re-running the CMake command.
-The `.tflite` model file pointed to by `inference_runner_MODEL_TFLITE_PATH` will be converted to C++ files during the CMake
-configuration stage and then compiled into the application for performing inference with.
+The `.tflite` model file pointed to by `inference_runner_MODEL_TFLITE_PATH` is converted to C++ files during the CMake
+configuration stage. It is then compiled into the application for performing inference with.
-The log from the configuration stage should tell you what model path has been used:
+The log from the configuration stage tells you what model path and labels file have been used, for example:
```stdout
-- User option inference_runner_MODEL_TFLITE_PATH is set to <path/to/custom_model_after_vela.tflite>
@@ -160,7 +168,7 @@ custom_model_after_vela.tflite.cc
...
```
-After compiling, your custom model will have now replaced the default one in the application.
+After compiling, your custom model has now replaced the default one in the application.
## Setting up and running Ethos-U55 code sample
@@ -169,30 +177,35 @@ After compiling, your custom model will have now replaced the default one in the
The FVP is available publicly from
[Arm Ecosystem FVP downloads](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps).
-For Ethos-U55 evaluation, please download the MPS3 version of the Arm® Corstone™-300 model that contains Ethos-U55 and
-Cortex-M55. The model is currently only supported on Linux based machines. To install the FVP:
+For the *Ethos-U55* evaluation, please download the MPS3 version of the Arm® *Corstone™-300* model that contains both
+the *Ethos-U55* and *Cortex-M55*. The model is currently only supported on Linux-based machines.
+
+To install the FVP:
-- Unpack the archive
+- Unpack the archive.
-- Run the install script in the extracted package
+- Run the install script in the extracted package:
```commandline
./FVP_Corstone_SSE-300_Ethos-U55.sh
```
-- Follow the instructions to install the FVP to your desired location
+- Follow the instructions to install the FVP to the required location.
### Starting Fast Model simulation
-Once completed the building step, application binary ethos-u-infernce_runner.axf can be found in the `build/bin` folder.
-Assuming the install location of the FVP was set to ~/FVP_install_location, the simulation can be started by:
+Once completed the building step, the application binary `ethos-u-infernce_runner.axf` can be found in the `build/bin`
+folder.
+
+Assuming that the install location of the FVP was set to `~/FVP_install_location`, then the simulation can be started by
+using:
```commandline
~/FVP_install_location/models/Linux64_GCC-6.4/FVP_Corstone_SSE-300_Ethos-U55
./bin/mps3-sse-300/ethos-u-inference_runner.axf
```
-A log output should appear on the terminal:
+A log output appears on the terminal:
```log
telnetterminal0: Listening for serial connection on port 5000
@@ -201,9 +214,9 @@ telnetterminal2: Listening for serial connection on port 5002
telnetterminal5: Listening for serial connection on port 5003
```
-This will also launch a telnet window with the sample application's standard output and error log entries containing
-information about the pre-built application version, TensorFlow Lite Micro library version used, data type as well as
-the input and output tensor sizes of the model compiled into the executable binary.
+This also launches a telnet window with the standard output of the sample application. It also includes error log
+entries containing information about the pre-built application version, TensorFlow Lite Micro library version used, and
+data types. The log also includes the input and output tensor sizes of the model compiled into the executable binary.
### Running Inference Runner
@@ -223,23 +236,23 @@ INFO - NPU total cycles: 34178
```
After running an inference on randomly generated data, the output of the log shows the profiling results that for this
-inference:
+inference. For example:
-- Ethos-U55's PMU report:
+- *Ethos-U55* PMU report:
- - 34,178 total cycle: The number of NPU cycles
+ - 34,178 total cycle: The number of NPU cycles.
- - 33,145 active cycles: number of NPU cycles that were used for computation
+ - 33,145 active cycles: The number of NPU cycles that were used for computation.
- - 1,033 idle cycles: number of cycles for which the NPU was idle
+ - 1,033 idle cycles: The number of cycles for which the NPU was idle.
- - 9,332 AXI0 read beats: The number of AXI beats with read transactions from AXI0 bus.
- AXI0 is the bus where Ethos-U55 NPU reads and writes to the computation buffers (activation buf/tensor arenas).
+ - 9,332 AXI0 read beats: The number of AXI beats with read transactions from AXI0 bus. AXI0 is the bus where the
+ *Ethos-U55* NPU reads and writes to the computation buffers, activation buf, or tensor arenas.
- 3,248 AXI0 write beats: The number of AXI beats with write transactions to AXI0 bus.
- - 2,219 AXI1 read beats: The number of AXI beats with read transactions from AXI1 bus.
- AXI1 is the bus where Ethos-U55 NPU reads the model (read only)
+ - 2,219 AXI1 read beats: The number of AXI beats with read transactions from AXI1 bus. AXI1 is the bus where the
+ *Ethos-U55* NPU reads the model. So, read-only.
-- For FPGA platforms, CPU cycle count can also be enabled. For FVP, however, CPU cycle counters should not be used as
- the CPU model is not cycle-approximate or cycle-accurate.
+- For FPGA platforms, a CPU cycle count can also be enabled. However, do not use cycle counters for FVP, as the CPU
+ model is not cycle-approximate or cycle-accurate.
diff --git a/docs/use_cases/kws.md b/docs/use_cases/kws.md
index dc0e1f5..9b0372c 100644
--- a/docs/use_cases/kws.md
+++ b/docs/use_cases/kws.md
@@ -17,50 +17,54 @@
## Introduction
-This document describes the process of setting up and running the Arm® Ethos™-U55 Keyword Spotting
-example.
+This document describes the process of setting up and running the Arm® *Ethos™-U55* Keyword Spotting example.
-Use case code could be found in [source/use_case/kws](../../source/use_case/kws]) directory.
+Use-case code could be found in the following directory: [source/use_case/kws](../../source/use_case/kws]).
### Preprocessing and feature extraction
-The DS-CNN keyword spotting model that is supplied with the Code Samples expects audio data to be preprocessed in
-a specific way before performing an inference. This section aims to provide an overview of the feature extraction
-process used.
+The `DS-CNN` keyword spotting model that is used with the Code Samples expects audio data to be preprocessed in a
+specific way before performing an inference.
-First the audio data is normalized to the range (-1, 1).
+Therefore, this section aims to provide an overview of the feature extraction process used.
-> **Note:** Mel-frequency cepstral coefficients (MFCCs) are a common feature extracted from audio data and can be used as
->input for machine learning tasks like keyword spotting and speech recognition.
->See source/application/main/include/Mfcc.hpp for implementation details.
+First, the audio data is normalized to the range (`-1`, `1`).
-Next, a window of 640 audio samples is taken from the start of the audio clip. From these 640 samples we calculate 10
+> **Note:** Mel-Frequency Cepstral Coefficients (MFCCs) are a common feature that is extracted from audio data and can
+> be used as input for machine learning tasks. Such as keyword spotting and speech recognition. For implementation
+> details, please refer to: `source/application/main/include/Mfcc.hpp`
+
+Next, a window of 640 audio samples is taken from the start of the audio clip. From these 640 samples, we calculate 10
MFCC features.
The whole window is shifted to the right by 320 audio samples and 10 new MFCC features are calculated. This process of
-shifting and calculating is repeated until the end of the 16000 audio samples needed to perform an inference is reached.
-In total this will be 49 windows that each have 10 MFCC features calculated for them, giving an input tensor of shape
-49x10.
+shifting and calculating is repeated until the end of the 16000 audio samples required to perform an inference is
+reached.
+
+In total, this is 49 windows that each have 10 MFCC features calculated for them, giving an input tensor of shape 49x10.
-These extracted features are quantized, and an inference is performed.
+These extracted features are quantized and an inference is performed.
![KWS preprocessing](../media/KWS_preprocessing.png)
-If the audio clip is longer than 16000 audio samples then the initial starting position is offset by 16000/2 = 8000
-audio samples. From this new starting point, MFCC features for the next 16000 audio samples are calculated and another
-inference is performed (i.e. do an inference for samples 8000-24000).
+If the audio clip is longer than 16000 audio samples, then the initial starting position is offset by `16000/2 = 8000`
+audio samples. From this new starting point, MFCC features for the next `16000` audio samples are calculated and another
+inference is performed. In other words, do an inference for samples `8000-24000`.
-> **Note:** Parameters of the MFCC feature extraction such as window size, stride, number of features etc. all depend on
->what was used during model training. These values are specific to each model and if you try a different keyword spotting
->model that uses MFCC input then values are likely to need changing to match the new model.
-In addition, MFCC feature extraction methods can vary slightly with different normalization methods or scaling etc. being used.
+> **Note:** Parameters of the MFCC feature extraction all depend on what was used during model training. These values
+> are specific to each model.\
+If you try a different keyword spotting model that uses MFCC input, then values check to see if the values need changing
+to match the new model.
+
+In addition, MFCC feature extraction methods can vary slightly with different normalization methods or scaling being
+used.
### Postprocessing
-After an inference is complete the highest probability detected word is output to console, providing its probability is
-larger than a threshold value (default 0.9).
+After an inference is complete, the word with the highest detected probability is output to console. Providing that the
+probability is larger than a threshold value. The default is set to `0.9`.
-If multiple inferences are performed for an audio clip, then multiple results will be output.
+If multiple inferences are performed for an audio clip, then multiple results are output.
### Prerequisites
@@ -70,58 +74,67 @@ See [Prerequisites](../documentation.md#prerequisites)
### Build options
-In addition to the already specified build option in the main documentation, keyword spotting use case adds:
+In addition to the already specified build option in the main documentation, the Keyword Spotting use-case adds:
-- `kws_MODEL_TFLITE_PATH` - Path to the NN model file in TFLite format. Model will be processed and included into the application axf file. The default value points to one of the delivered set of models. Note that the parameters `kws_LABELS_TXT_FILE`,`TARGET_PLATFORM` and `ETHOS_U55_ENABLED` should be aligned with the chosen model, i.e.:
- - if `ETHOS_U55_ENABLED` is set to `On` or `1`, the NN model is assumed to be optimized. The model will naturally fall back to the Arm® Cortex®-M CPU if an unoptimized model is supplied.
- - if `ETHOS_U55_ENABLED` is set to `Off` or `0`, the NN model is assumed to be unoptimized. Supplying an optimized model in this case will result in a runtime error.
+- `kws_MODEL_TFLITE_PATH` - The path to the NN model file in `TFLite` format. The model is processed and then included
+ into the application `axf` file. The default value points to one of the delivered set of models. Note that the
+ parameters `kws_LABELS_TXT_FILE`,`TARGET_PLATFORM`, and `ETHOS_U55_ENABLED` must be aligned with the chosen model. In
+ other words:
+ - If `ETHOS_U55_ENABLED` is set to `On` or `1`, then the NN model is assumed to be optimized. The model naturally
+ falls back to the Arm® *Cortex®-M* CPU if an unoptimized model is supplied.
+ - If `ETHOS_U55_ENABLED` is set to `Off` or `0`, then the NN model is assumed to be unoptimized. Supplying an
+ optimized model in this case results in a runtime error.
-- `kws_FILE_PATH`: Path to the directory containing audio files, or a path to single WAV file, to be used in the application. The default value points
- to the resources/kws/samples folder containing the delivered set of audio clips.
+- `kws_FILE_PATH`: The path to the directory containing audio files, or a path to single WAV file, to be used in the
+ application. The default value points to the `resources/kws/samples` folder that contains the delivered set of audio
+ clips.
-- `kws_LABELS_TXT_FILE`: Path to the labels' text file. The file is used to map key word class index to the text
- label. The default value points to the delivered labels.txt file inside the delivery package.
+- `kws_LABELS_TXT_FILE`: Path to the text file of the label. The file is used to map letter class index to the text
+ label. The default value points to the delivered `labels.txt` file inside the delivery package.
-- `kws_AUDIO_RATE`: Input data sampling rate. Each audio file from kws_FILE_PATH is preprocessed during the build to
- match NN model input requirements. Default value is 16000.
+- `kws_AUDIO_RATE`: The input data sampling rate. Each audio file from `kws_FILE_PATH` is preprocessed during the build
+ to match the NN model input requirements. The default value is `16000`.
-- `kws_AUDIO_MONO`: If set to ON the audio data will be converted to mono. Default is ON.
+- `kws_AUDIO_MONO`: If set to `ON`, then the audio data is converted to mono. The default value is `ON`.
-- `kws_AUDIO_OFFSET`: Start loading audio data starting from this offset (in seconds). Default value is 0.
+- `kws_AUDIO_OFFSET`: Begins loading audio data and starts from this specified offset, defined in seconds. the default
+ value is set to `0`.
-- `kws_AUDIO_DURATION`: Length of the audio data to be used in the application in seconds. Default is 0 meaning the
- whole audio file will be taken.
+- `kws_AUDIO_DURATION`: The length of the audio data to be used in the application in seconds. The default is `0`,
+ meaning that the whole audio file is used.
- `kws_AUDIO_MIN_SAMPLES`: Minimum number of samples required by the network model. If the audio clip is shorter than
- this number, it is padded with zeros. Default value is 16000.
+ this number, then it is padded with zeros. The default value is `16000`.
-- `kws_MODEL_SCORE_THRESHOLD`: Threshold value [0.0, 1.0] that must be applied to the inference results for a
- label to be deemed valid. Default is 0.9
+- `kws_MODEL_SCORE_THRESHOLD`: Threshold value that must be applied to the inference results for a label to be deemed
+ valid. Goes from 0.00 to 1.0. The default is `0.9`.
-- `kws_ACTIVATION_BUF_SZ`: The intermediate/activation buffer size reserved for the NN model. By default, it is set
- to 1MiB and should be enough for most models.
+- `kws_ACTIVATION_BUF_SZ`: The intermediate, or activation, buffer size reserved for the NN model. By default, it is set
+ to 2MiB and is enough for most models
-In order to build **ONLY** keyword spotting example application add to the `cmake` command line specified in [Building](../documentation.md#Building) `-DUSE_CASE_BUILD=kws`.
+To **ONLY** build the automatic speech recognition example application, add `-DUSE_CASE_BUILD=kws` to the `cmake`
+command line, as specified in: [Building](../documentation.md#Building).
### Build process
-> **Note:** This section describes the process for configuring the build for `MPS3: SSE-300` for different target platform see [Building](../documentation.md#Building) section.
+> **Note:** This section describes the process for configuring the build for the *MPS3: SSE-300*. To build for a
+> different target platform, please refer to: [Building](../documentation.md#Building).
-In order to build **only** the keyword spotting example, create a build directory and
-navigate inside, for example:
+To build **only** the keyword spotting example, create a build directory and navigate inside, like so:
```commandline
mkdir build_kws && cd build_kws
```
-On Linux, execute the following command to build Keyword Spotting application to run on the Ethos-U55 Fast Model when providing only the mandatory arguments for CMake configuration:
+On Linux, when providing only the mandatory arguments for CMake configuration, execute the following command to build
+**only** the Keyword Spotting application to run on the *Ethos-U55* Fast Model:
```commandline
cmake ../ -DUSE_CASE_BUILD=kws
```
-To configure a build that can be debugged using Arm-DS, we can just specify
-the build type as `Debug` and use the `Arm Compiler` toolchain file:
+To configure a build that can be debugged using Arm DS specify the build type as `Debug` and then use the `Arm Compiler`
+toolchain file:
```commandline
cmake .. \
@@ -130,24 +143,25 @@ cmake .. \
-DUSE_CASE_BUILD=kws
```
-Also see:
+For further information, please refer to:
- [Configuring with custom TPIP dependencies](../sections/building.md#configuring-with-custom-tpip-dependencies)
- [Using Arm Compiler](../sections/building.md#using-arm-compiler)
- [Configuring the build for simple_platform](../sections/building.md#configuring-the-build-for-simple_platform)
-- [Working with model debugger from Arm FastModel Tools](../sections/building.md#working-with-model-debugger-from-arm-fastmodel-tools)
+- [Working with model debugger from Arm Fast Model Tools](../sections/building.md#working-with-model-debugger-from-arm-fastmodel-tools)
-> **Note:** If re-building with changed parameters values, it is highly advised to clean the build directory and re-run the CMake command.
+> **Note:** If re-building with changed parameters values, we recommend that you clean the build directory and re-run
+> the CMake command.
-If the CMake command succeeded, build the application as follows:
+If the CMake command succeeds, build the application as follows:
```commandline
make -j4
```
-Add VERBOSE=1 to see compilation and link details.
+To see compilation and link details, add `VERBOSE=1`.
-Results of the build will be placed under `build/bin` folder:
+Results of the build are placed under the `build/bin` folder, like so:
```tree
bin
@@ -157,29 +171,31 @@ bin
 └── sectors
├── images.txt
└── kws
- ├── dram.bin
+ ├── ddr.bin
└── itcm.bin
```
-Where:
+The `bin` folder contains the following files:
-- `ethos-u-kws.axf`: The built application binary for the Keyword Spotting use case.
+- `ethos-u-kws.axf`: The built application binary for the Keyword Spotting use-case.
-- `ethos-u-kws.map`: Information from building the application (e.g. libraries used, what was optimized, location of
- objects)
+- `ethos-u-kws.map`: Information from building the application. For example: The libraries used, what was optimized, and
+ the location of objects.
- `ethos-u-kws.htm`: Human readable file containing the call graph of application functions.
-- `sectors/kws`: Folder containing the built application, split into files for loading into different FPGA memory regions.
+- `sectors/kws`: Folder containing the built application. It is split into files for loading into different FPGA memory
+ regions.
-- `sectors/images.txt`: Tells the FPGA which memory regions to use for loading the binaries in sectors/\*\* folder.
+- `sectors/images.txt`: Tells the FPGA which memory regions to use for loading the binaries in the `sectors/..` folder.
### Add custom input
-The application performs inference on audio data found in the folder, or an individual file, set by the CMake parameter `kws_FILE_PATH`.
+The application anomaly detection is set up to perform inferences on data found in the folder, or an individual file,
+that is pointed to by the parameter `kws_FILE_PATH`.
-To run the application with your own audio clips first create a folder to hold them and then copy the custom audio files
-into this folder, for example:
+To run the application with your own audio clips, first create a folder to hold them and then copy the custom clips into
+the following folder:
```commandline
mkdir /tmp/custom_wavs
@@ -189,7 +205,7 @@ cp my_clip.wav /tmp/custom_wavs/
> **Note:** Clean the build directory before re-running the CMake command.
-Next set `kws_FILE_PATH` to the location of this folder when building:
+Next, when building, set `kws_FILE_PATH` to the location of the following folder:
```commandline
cmake .. \
@@ -197,10 +213,11 @@ cmake .. \
-DUSE_CASE_BUILD=kws
```
-The audio clips found in the `kws_FILE_PATH` folder will be picked up and automatically converted to C++ files during the
-CMake configuration stage and then compiled into the application during the build phase for performing inference with.
+The audio flies found in the `kws_FILE_PATH` folder are picked up and automatically converted to C++ files during the
+CMake configuration stage. They are then compiled into the application during the build phase for performing inference
+with.
-The log from the configuration stage should tell you what audio clip directory path has been used:
+The log from the configuration stage tells you what audio directory path has been used:
```log
-- User option kws_FILE_PATH is set to /tmp/custom_wavs
@@ -212,25 +229,29 @@ The log from the configuration stage should tell you what audio clip directory p
-- kws_FILE_PATH=/tmp/custom_wavs
```
-After compiling, your custom inputs will have now replaced the default ones in the application.
+After compiling, your custom inputs have now replaced the default ones in the application.
-> **Note:** The CMake parameter `kws_AUDIO_MIN_SAMPLES` determine the minimum number of input sample. When building the application,
-if the size of the audio clips is less then `kws_AUDIO_MIN_SAMPLES` then it will be padded so that it does.
+> **Note:** The CMake parameter `kws_AUDIO_MIN_SAMPLES` determines the minimum number of input samples. When building
+> the application, if the size of the audio clips is less then `kws_AUDIO_MIN_SAMPLES`, then it is padded until it
+> matches.
### Add custom model
The application performs inference using the model pointed to by the CMake parameter `kws_MODEL_TFLITE_PATH`.
-> **Note:** If you want to run the model using Ethos-U55, ensure your custom model has been run through the Vela compiler successfully before continuing. See [Optimize model with Vela compiler](../sections/building.md#Optimize-custom-model-with-Vela-compiler).
+> **Note:** If you want to run the model using an *Ethos-U55*, ensure that your custom model has been successfully run
+> through the Vela compiler *before* continuing.
+
+For further information: [Optimize model with Vela compiler](../sections/building.md#Optimize-custom-model-with-Vela-compiler).
-To run the application with a custom model you will need to provide a labels_<model_name>.txt file of labels
-associated with the model. Each line of the file should correspond to one of the outputs in your model. See the provided
-ds_cnn_labels.txt file for an example.
+To run the application with a custom model, you must provide a `labels_<model_name>.txt` file of labels that are
+associated with the model. Each line of the file must correspond to one of the outputs in your model. Refer to the
+provided `ds_cnn_labels.txt` file for an example.
-Then, you must set kws_MODEL_TFLITE_PATH to the location of the Vela processed model file and kws_LABELS_TXT_FILE
-to the location of the associated labels file.
+Then, you must set `kws_MODEL_TFLITE_PATH` to the location of the Vela processed model file and `kws_LABELS_TXT_FILE`to
+the location of the associated labels file.
-An example:
+For example:
```commandline
cmake .. \
@@ -241,11 +262,11 @@ cmake .. \
> **Note:** Clean the build directory before re-running the CMake command.
-The `.tflite` model file pointed to by `kws_MODEL_TFLITE_PATH` and labels text file pointed to by `kws_LABELS_TXT_FILE` will
-be converted to C++ files during the CMake configuration stage and then compiled into the application for performing
-inference with.
+The `.tflite` model file pointed to by `kws_MODEL_TFLITE_PATH` and labels text file pointed to by `kws_LABELS_TXT_FILE`
+are converted to C++ files during the CMake configuration stage. They are then compiled into the application for
+performing inference with.
-The log from the configuration stage should tell you what model path and labels file have been used:
+The log from the configuration stage tells you what model path and labels file have been used, for example:
```log
-- User option kws_MODEL_TFLITE_PATH is set to <path/to/custom_model_after_vela.tflite>
@@ -260,38 +281,43 @@ custom_model_after_vela.tflite.cc
...
```
-After compiling, your custom model will have now replaced the default one in the application.
+After compiling, your custom model has now replaced the default one in the application.
## Setting up and running Ethos-U55 code sample
### Setting up the Ethos-U55 Fast Model
-The FVP is available publicly from [Arm Ecosystem FVP downloads](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps).
+The FVP is available publicly from
+[Arm Ecosystem FVP downloads](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps).
-For Ethos-U55 evaluation, please download the MPS3 version of the Arm® Corstone™-300 model that contains Ethos-U55 and
-Cortex-M55. The model is currently only supported on Linux based machines. To install the FVP:
+For the *Ethos-U55* evaluation, please download the MPS3 version of the Arm® *Corstone™-300* model that contains both
+the *Ethos-U55* and *Cortex-M55*. The model is only supported on Linux-based machines.
-- Unpack the archive
+To install the FVP:
-- Run the install script in the extracted package
+- Unpack the archive.
+
+- Run the install script in the extracted package:
```commandline
./FVP_Corstone_SSE-300_Ethos-U55.sh
```
-- Follow the instructions to install the FVP to your desired location
+- Follow the instructions to install the FVP to the required location.
### Starting Fast Model simulation
-Once completed the building step, application binary ethos-u-kws.axf can be found in the `build/bin` folder.
-Assuming the install location of the FVP was set to ~/FVP_install_location, the simulation can be started by:
+Once the building has been completed, the application binary `ethos-u-kws.axf` can be found in the `build/bin` folder.
+
+Assuming that the install location of the FVP was set to `~/FVP_install_location`, then the simulation can be started by
+using:
```commandline
~/FVP_install_location/models/Linux64_GCC-6.4/FVP_Corstone_SSE-300_Ethos-U55
./bin/mps3-sse-300/ethos-u-kws.axf
```
-A log output should appear on the terminal:
+A log output appears on the terminal:
```log
telnetterminal0: Listening for serial connection on port 5000
@@ -300,12 +326,15 @@ telnetterminal2: Listening for serial connection on port 5002
telnetterminal5: Listening for serial connection on port 5003
```
-This will also launch a telnet window with the sample application's standard output and error log entries containing
-information about the pre-built application version, TensorFlow Lite Micro library version used, data type as well as
-the input and output tensor sizes of the model compiled into the executable binary.
+This also launches a telnet window with the standard output of the sample application. It also includes error log
+entries containing information about the pre-built application version, TensorFlow Lite Micro library version used, and
+data types. The log also includes the input and output tensor sizes of the model compiled into the executable binary.
-After the application has started if `kws_FILE_PATH` pointed to a single file (or a folder containing a single input file)
-the inference starts immediately. In case of multiple inputs choice, it outputs a menu and waits for the user input from telnet terminal:
+After the application has started, if `kws_FILE_PATH` points to a single file, or even a folder that contains a single
+input file, then the inference starts immediately. If there are multiple inputs, it outputs a menu and then waits for
+input from the user.
+
+For example:
```log
User input required
@@ -321,49 +350,46 @@ Choice:
```
-1. “Classify next audio clip” menu option will run inference on the next in line voice clip from the collection of the
- compiled audio.
+What the preceding choices do:
- > **Note:** Note that if the clip is over a certain length, the application will invoke multiple inference runs to cover the entire file.
+1. Classify next audio clip: Runs a single inference on the next in line.
-2. “Classify audio clip at chosen index” menu option will run inference on the chosen audio clip.
+2. Classify audio clip at chosen index: Runs inference on the chosen audio clip.
- > **Note:** Please make sure to select audio clip index in the range of supplied audio clips during application build.
- By default, pre-built application has 4 files, indexes from 0 to 3.
+ > **Note:** Please make sure to select audio clip index within the range of supplied audio clips during application
+ > build. By default, a pre-built application has four files, with indexes from `0` to `3`.
-3. “Run classification on all audio clips” menu option triggers sequential inference executions on all built-in voice
- samples.
+3. Run ... on all: Triggers sequential inference executions on all built-in applications.
-4. “Show NN model info” menu option prints information about model data type, input and output tensor sizes:
+4. Show NN model info: Prints information about the model data type, input, and output, tensor sizes:
```log
INFO - uTFL version: 2.5.0
INFO - Model info:
INFO - Model INPUT tensors:
- INFO - tensor type is INT8
- INFO - tensor occupies 490 bytes with dimensions
- INFO - 0: 1
- INFO - 1: 1
- INFO - 2: 49
- INFO - 3: 10
+ INFO - tensor type is INT8
+ INFO - tensor occupies 490 bytes with dimensions
+ INFO - 0: 1
+ INFO - 1: 1
+ INFO - 2: 49
+ INFO - 3: 10
INFO - Quant dimension: 0
INFO - Scale[0] = 1.107164
INFO - ZeroPoint[0] = 95
INFO - Model OUTPUT tensors:
- INFO - tensor type is INT8
- INFO - tensor occupies 12 bytes with dimensions
- INFO - 0: 1
- INFO - 1: 12
+ INFO - tensor type is INT8
+ INFO - tensor occupies 12 bytes with dimensions
+ INFO - 0: 1
+ INFO - 1: 12
INFO - Quant dimension: 0
INFO - Scale[0] = 0.003906
INFO - ZeroPoint[0] = -128
INFO - Activation buffer (a.k.a tensor arena) size used: 72848
INFO - Number of operators: 1
- INFO - Operator 0: ethos-u
+ INFO - Operator 0: ethos-u
```
-5. “List audio clips” menu option prints a list of pair audio indexes - the original filenames embedded in the
- application:
+5. List audio clips: Prints a list of pair ... indexes. The original filenames are embedded in the application, like so:
```log
[INFO] List of Files:
@@ -375,9 +401,9 @@ Choice:
### Running Keyword Spotting
-Selecting the first option will run inference on the first file.
+Please select the first menu option to execute inference on the first file.
-The following example illustrates application output for classification:
+The following example illustrates the output for classification:
```logINFO - Running inference on audio clip 0 => down.wav
INFO - Inference 1/1
@@ -393,26 +419,28 @@ INFO - NPU IDLE cycles: 561
INFO - NPU total cycles: 681172
```
-Each inference should take less than 30 seconds on most systems running Fast Model.
+On most systems running Fast Model, each inference takes under 30 seconds.
+
The profiling section of the log shows that for this inference:
-- Ethos-U55's PMU report:
+- *Ethos-U55* PMU report:
- - 681,172 total cycle: The number of NPU cycles
+ - 681,172 total cycle: The number of NPU cycles.
- - 680,611 active cycles: The number of NPU cycles that were used for computation
+ - 680,611 active cycles: The number of NPU cycles that were used for computation.
- - 561 idle cycles: number of cycles for which the NPU was idle
+ - 561 idle cycles: The number of cycles for which the NPU was idle.
- - 217,385 AXI0 read beats: The number of AXI beats with read transactions from AXI0 bus.
- AXI0 is the bus where Ethos-U55 NPU reads and writes to the computation buffers (activation buf/tensor arenas).
+ - 217,385 AXI0 read beats: The number of AXI beats with read transactions from the AXI0 bus. AXI0 is the bus where the
+ *Ethos-U55* NPU reads and writes to the computation buffers, activation buf, or tensor arenas.
- 82,607 write cycles: The number of AXI beats with write transactions to AXI0 bus.
- - 59,608 AXI1 read beats: The number of AXI beats with read transactions from AXI1 bus.
- AXI1 is the bus where Ethos-U55 NPU reads the model (read only)
+ - 59,608 AXI1 read beats: The number of AXI beats with read transactions from the AXI1 bus. AXI1 is the bus where the
+ *Ethos-U55* NPU reads the model. So, read-only.
-- For FPGA platforms, CPU cycle count can also be enabled. For FVP, however, CPU cycle counters should not be used as
- the CPU model is not cycle-approximate or cycle-accurate.
+- For FPGA platforms, a CPU cycle count can also be enabled. However, do not use cycle counters for FVP, as the CPU
+ model is not cycle-approximate or cycle-accurate.
-The application prints the highest confidence score and the associated label from ds_cnn_labels.txt file.
+> **Note:** The application prints the highest confidence score and the associated label from the `ds_cnn_labels.txt`
+> file.
diff --git a/docs/use_cases/kws_asr.md b/docs/use_cases/kws_asr.md
index 9fbab26..0297f05 100644
--- a/docs/use_cases/kws_asr.md
+++ b/docs/use_cases/kws_asr.md
@@ -20,108 +20,136 @@
## Introduction
This document describes the process of setting up and running an example of sequential execution of the Keyword Spotting
-and Automatic Speech Recognition models on Cortex-M CPU and Ethos-U NPU.
+and Automatic Speech Recognition models on a *Cortex-M* CPU and *Ethos-U* NPU.
-The Keyword Spotting and Automatic Speech Recognition example demonstrates how to run multiple models sequentially. A
-Keyword Spotting model is first run on the CPU and if a set keyword is detected then an Automatic Speech Recognition
-model is run on Ethos-U55 on the remaining audio.
-Tensor arena memory region is reused between models to optimise application memory footprint.
+The Keyword Spotting and Automatic Speech Recognition example demonstrates how to run multiple models sequentially.
-"Yes" key word is used to trigger full command recognition following the key word.
-Use case code could be found in [source/use_case/kws_asr](../../source/use_case/kws_asr]) directory.
+A Keyword Spotting model is first run on the CPU. If a set keyword is detected on the remaining audio, then an Automatic
+Speech Recognition model is run on the *Ethos-U55*.
+
+The tensor arena memory region is reused between models to optimize application memory footprint.
+
+The `Yes` keyword is used to trigger full command recognition following the keyword.
+
+Use-case code could be found in the following directory: [source/use_case/kws_asr](../../source/use_case/kws_asr]).
### Preprocessing and feature extraction
-In this use-case there are 2 different models being used with different requirements for preprocessing. As such each
-preprocessing process is detailed below. Note that Automatic Speech Recognition only occurs if a keyword is detected in
-the audio clip.
+In this use-case, there are two different models being used with different requirements for preprocessing. As such, each
+preprocessing process is detailed as follows.
-By default the KWS model is run purely on CPU and not on the Ethos-U55.
+> **Note:** Automatic Speech Recognition only occurs if a keyword is detected in the audio clip.
+
+By default, the KWS model is run purely on the CPU and **not** on the *Ethos-U55*.
#### Keyword Spotting Preprocessing
-The DS-CNN keyword spotting model that is used with the Code Samples expects audio data to be preprocessed in
-a specific way before performing an inference. This section aims to provide an overview of the feature extraction
-process used.
+The `DS-CNN` keyword spotting model that is used with the Code Samples expects audio data to be preprocessed in a
+specific way before performing an inference.
+
+Therefore, this section aims to provide an overview of the feature extraction process used.
-First the audio data is normalized to the range (-1, 1).
+First, the audio data is normalized to the range (`-1`, `1`).
-> **Note:** Mel-frequency cepstral coefficients (MFCCs) are a common feature extracted from audio data and can be used as input for machine learning tasks like keyword spotting and speech recognition. See source/application/main/include/Mfcc.hpp for implementation details.
+> **Note:** Mel-Frequency Cepstral Coefficients (MFCCs) are a common feature that is extracted from audio data and can
+> be used as input for machine learning tasks. Such as keyword spotting and speech recognition. For implementation
+> details, please refer to: `source/application/main/include/Mfcc.hpp`
-Next, a window of 640 audio samples is taken from the start of the audio clip. From these 640 samples we calculate 10
+Next, a window of 640 audio samples is taken from the start of the audio clip. From these 640 samples, we calculate 10
MFCC features.
The whole window is shifted to the right by 320 audio samples and 10 new MFCC features are calculated. This process of
-shifting and calculating is repeated until the end of the 16000 audio samples needed to perform an inference is reached.
-In total this will be 49 windows that each have 10 MFCC features calculated for them, giving an input tensor of shape
-49x10.
+shifting and calculating is repeated until the end of the 16000 audio samples required to perform an inference is
+reached.
-These extracted features are quantized, and an inference is performed.
+In total, this is 49 windows that each have 10 MFCC features calculated for them, giving an input tensor of shape 49x10.
-If the audio clip is longer than 16000 audio samples then the initial starting position is offset by 16000/2 = 8000
-audio samples. From this new starting point, MFCC features for the next 16000 audio samples are calculated and another
-inference is performed (i.e. do an inference for samples 8000-24000).
+These extracted features are quantized and an inference is performed.
-> **Note:** Parameters of the MFCC feature extraction such as window size, stride, number of features etc. all depend on what was used during model training. These values are specific to each model and if you try a different keyword spotting model that uses MFCC input then values are likely to need changing to match the new model.
+If the audio clip is longer than 16000 audio samples, then the initial starting position is offset by `16000/2 = 8000`
+audio samples. From this new starting point, MFCC features for the next `16000` audio samples are calculated and another
+inference is performed. In other words, do an inference for samples `8000-24000`.
-In addition, MFCC feature extraction methods can vary slightly with different normalization methods or scaling etc. being used.
+> **Note:** Parameters of the MFCC feature extraction all depend on what was used during model training. These values
+> are specific to each model.
+
+If you try a different keyword spotting model that uses MFCC input, then values check to see if the values need changing
+to match the new model.
+
+In addition, MFCC feature extraction methods can vary slightly with different normalization methods or scaling being
+used.
#### Automatic Speech Recognition Preprocessing
-The wav2letter automatic speech recognition model that is used with the Code Samples expects audio data to be
+The *wav2letter* automatic speech recognition model that is used with the Code Samples expects audio data to be
preprocessed in a specific way before performing an inference. This section aims to provide an overview of the feature
extraction process used.
-First the audio data is normalized to the range (-1, 1).
+First, the audio data is normalized to the range (`-1`, `1`).
-> **Note:** Mel-frequency cepstral coefficients (MFCCs) are a common feature extracted from audio data and can be used as input for machine learning tasks like keyword spotting and speech recognition. See source/application/main/include/Mfcc.hpp for implementation details.
+> **Note:** Mel-Frequency Cepstral Coefficients (MFCCs) are a common feature that is extracted from audio data and can
+> be used as input for machine learning tasks. Such as keyword spotting and speech recognition. For implementation
+> details, please refer to: `source/application/main/include/Mfcc.hpp`
-Next, a window of 512 audio samples is taken from the start of the audio clip. From these 512 samples we calculate 13
+Next, a window of 512 audio samples is taken from the start of the audio clip. From these 512 samples, we calculate 13
MFCC features.
The whole window is shifted to the right by 160 audio samples and 13 new MFCC features are calculated. This process of
-shifting and calculating is repeated until enough audio samples to perform an inference have been processed. In total
-this will be 296 windows that each have 13 MFCC features calculated for them.
+shifting and calculating is repeated until enough audio samples to perform an inference have been processed.
+
+In total, this is 296 windows that each have 13 MFCC features calculated for them.
+
+After extracting MFCC features, the first and second order derivatives of these features, regarding time, are
+calculated.
-After extracting MFCC features the first and second order derivatives of these features with respect to time are
-calculated. These derivative features are then standardized and concatenated with the MFCC features (which also get
-standardized). At this point the input tensor will have a shape of 296x39.
+These derivative features are then standardized and concatenated with the MFCC features (which also get standardized).
+At this point, the input tensor has a shape of 296x39.
-These extracted features are quantized, and an inference is performed.
+These extracted features are quantized and an inference is performed.
-For longer audio clips where multiple inferences need to be performed, then the initial starting position is offset by
-(100\*160) = 16000 audio samples. From this new starting point, MFCC and derivative features are calculated as before
-until there is enough to perform another inference. Padding can be used if there are not enough audio samples for at
-least 1 inference. This step is repeated until the whole audio clip has been processed. If there are not enough audio
-samples for a final complete inference the MFCC features will be padded by repeating the last calculated feature until
-an inference can be performed.
+For longer audio clips, where multiple inferences must be performed, then the initial starting position is offset by
+`(100*160) = 16000` audio samples. From this new starting point, MFCC and derivative features are calculated as before,
+until there is enough to perform another inference.
-> **Note:** Parameters of the MFCC feature extraction such as window size, stride, number of features etc. all depend on what was used during model training. These values are specific to each model. If you switch to a different ASR model than the one supplied, then the feature extraction process could be completely different to the one currently implemented.
+Padding can be used if there are not enough audio samples for at least one inference. This step is repeated until the
+whole audio clip has been processed. If there are not enough audio samples for a final complete inference, then the MFCC
+features are padded by repeating the last calculated feature until an inference can be performed.
-The amount of audio samples we offset by for long audio clips is specific to the included wav2letter model.
+> **Note:** Parameters of the MFCC feature extraction all depend on what was used during model training. These values
+> are specific to each model.\
+If you switch to a different ASR model than the one supplied, then the feature extraction process could be completely
+different to the one currently implemented.
+
+The amount of time that audio samples that are offset for long audio clips is specific to the included *wav2letter*
+model.
### Postprocessing
-If a keyword is detected then the ASR process is run and the raw output of that inference needs to be postprocessed to
-get a usable result.
+If a keyword is detected, then the ASR process is run and the raw output of that inference must be postprocessed to get
+a usable result.
The raw output from the model is a tensor of shape 148x29 where each row is a probability distribution over the possible
29 characters that can appear at each of the 148 time steps.
-This wav2letter model is trained using context windows, this means that only certain parts of the output are usable
-depending on the bit of the audio clip that is currently being processed.
+This *wav2letter* model is trained using context windows. This means that, depending on the bit of the audio clip that
+is being processed, only certain parts of the output are usable.
+
+If this is the first inference, and multiple inferences are required, then ignore the final 49 rows of the output.
+Similarly, if this is the final inference from multiple inferences, then ignore the first 49 rows of the output.
-If this is the first inference and multiple inferences are required, then ignore the final 49 rows of the output.
-Similarly, if this is the final inference from multiple inferences then ignore the first 49 rows of the output. Finally,
-if this inference is not the last or first inference then ignore the first and last 49 rows of the model output.
+Finally, if this inference is not the last, or the first inference, then ignore the first and last 49 rows of the model
+output.
-> **Note:** If the audio clip is small enough then the whole of the model output is usable and there is no need to throw away any of the output before continuing.
+> **Note:** If the audio clip is small enough, then the whole of the model output is usable and there is no need to
+> throw away any of the outputs before continuing.
-Once any rows have been removed the final processing can be done. To process the output, first the letter with the
-highest probability at each time step is found. Next, any letters that are repeated multiple times in a row are removed
-(e.g. [t, t, t, o, p, p] becomes [t, o, p]). Finally, the 29^th^ blank token letter is removed from the output.
+Once any rows have been removed, the final processing can be done. To process the output, the letter with the highest
+probability at each time step is found first. Next, any letters that are repeated multiple times in a row are removed.
-For the final output, the result from all inferences are combined before decoding. What you are left with is then
+For example: [`t`, `t`, `t`, `o`, `p`, `p`] becomes [`t`, `o`, `p`]). Finally, the 29th blank token letter is removed
+from the output.
+
+For the final output, the results from all inferences are combined before decoding. What you are left with is then
displayed to the console.
### Prerequisites
@@ -132,67 +160,74 @@ See [Prerequisites](../documentation.md#prerequisites)
### Build options
-In addition to the already specified build option in the main documentation, Keyword Spotting and Automatic Speech
-Recognition use case adds:
+In addition to the already specified build option in the main documentation, the Keyword Spotting and Automatic Speech
+Recognition use-case adds:
-- `kws_asr_MODEL_TFLITE_PATH_ASR` and `kws_asr_MODEL_TFLITE_PATH_KWS`: Path to the NN model files in TFLite format.
- Models will be processed and included into the application axf file. The default value points to one of the delivered set of models.
- Note that the parameters `kws_asr_LABELS_TXT_FILE_KWS`, `kws_asr_LABELS_TXT_FILE_ASR`,`TARGET_PLATFORM` and `ETHOS_U55_ENABLED`
- should be aligned with the chosen model, i.e:
- - if `ETHOS_U55_ENABLED` is set to `On` or `1`, the NN model is assumed to be optimized. The model will naturally fall back to the Arm® Cortex®-M CPU if an unoptimized model is supplied.
- - if `ETHOS_U55_ENABLED` is set to `Off` or `0`, the NN model is assumed to be unoptimized. Supplying an optimized model in this case will result in a runtime error.
+- `kws_asr_MODEL_TFLITE_PATH_ASR` and `kws_asr_MODEL_TFLITE_PATH_KWS`: The path to the NN model file in `TFLite` format.
+ The model is processed and then included into the application `axf` file. The default value points to one of the
+ delivered set of models. Note that the parameters `kws_asr_LABELS_TXT_FILE_KWS`,
+ `kws_asr_LABELS_TXT_FILE_ASR`,`TARGET_PLATFORM`, and `ETHOS_U55_ENABLED` must be aligned with the chosen model. In
+ other words:
+ - If `ETHOS_U55_ENABLED` is set to `On` or `1`, then the NN model is assumed to be optimized. The model naturally
+ falls back to the Arm® *Cortex®-M* CPU if an unoptimized model is supplied.
+ - If `ETHOS_U55_ENABLED` is set to `Off` or `0`, then the NN model is assumed to be unoptimized. Supplying an
+ optimized model in this case results in a runtime error.
-- `kws_asr_FILE_PATH`: Path to the directory containing audio files, or a path to single WAV file, to be used in the application. The default value
- points to the resources/kws_asr/samples folder containing the delivered set of audio clips.
+- `kws_asr_FILE_PATH`: The path to the directory containing audio files, or a path to single WAV file, to be used in the
+ application. The default value points to the `resources/kws_asr/samples` folder that contains the delivered set of
+ audio clips.
-- `kws_asr_LABELS_TXT_FILE_KWS` and `kws_asr_LABELS_TXT_FILE_ASR`: Path respectively to keyword spotting labels' and the automatic speech
- recognition labels' text files. The file is used to map
- letter class index to the text label. The default value points to the delivered labels.txt file inside the delivery
- package.
+- `kws_asr_LABELS_TXT_FILE_KWS` and `kws_asr_LABELS_TXT_FILE_ASR`: The respective paths to the keyword spotting labels
+ and the automatic speech recognition labels text files. The file is used to map letter class index to the text
+ label. The default value points to the delivered `labels.txt` file inside the delivery package.
-- `kws_asr_AUDIO_RATE`: Input data sampling rate. Each audio file from kws_asr_FILE_PATH is preprocessed during the
- build to match NN model input requirements. Default value is 16000.
+- `kws_asr_AUDIO_RATE`: The input data sampling rate. Each audio file from `kws_asr_FILE_PATH` is preprocessed during
+ the build to match the NN model input requirements. The default value is `16000`.
-- `kws_asr_AUDIO_MONO`: If set to ON the audio data will be converted to mono. Default is ON.
+- `kws_asr_AUDIO_MONO`: If set to `ON`, then the audio data is converted to mono. The default value is `ON`.
-- `kws_asr_AUDIO_OFFSET`: Start loading audio data starting from this offset (in seconds). Default value is 0.
+- `kws_asr_AUDIO_OFFSET`: Begins loading audio data and starts from this specified offset, defined in seconds. the
+ default value is set to `0`.
-- `kws_asr_AUDIO_DURATION`: Length of the audio data to be used in the application in seconds. Default is 0 meaning
- the whole audio file will be taken.
+- `kws_asr_AUDIO_DURATION`: The length of the audio data to be used in the application in seconds. The default is `0`,
+ meaning that the whole audio file is used.
- `kws_asr_AUDIO_MIN_SAMPLES`: Minimum number of samples required by the network model. If the audio clip is shorter
- than this number, it is padded with zeros. Default value is 16000.
+ than this number, then it is padded with zeros. The default value is `16000`.
-- `kws_asr_MODEL_SCORE_THRESHOLD_KWS`: Threshold value that must be applied to the keyword spotting inference
- results for a label to be deemed valid. Default is 0.9.
+- `kws_asr_MODEL_SCORE_THRESHOLD_KWS`: Threshold value that must be applied to the inference results for a label to be
+ deemed valid. The default is `0.9`.
- `kws_asr_MODEL_SCORE_THRESHOLD_ASR`: Threshold value that must be applied to the automatic speech recognition
- inference results for a label to be deemed valid. Default is 0.5.
+ inference results for a label to be deemed valid. The default is `0.5`.
-- `kws_asr_ACTIVATION_BUF_SZ`: The intermediate/activation buffer size reserved for the NN model. By default, it is
- set to 2MiB and should be enough for most models.
+- `kws_asr_ACTIVATION_BUF_SZ`: The intermediate, or activation, buffer size reserved for the NN model. By default, it is
+ set to 2MiB and is enough for most models.
-In order to build **ONLY** Keyword Spotting and Automatic Speech
-Recognition example application add to the `cmake` command line specified in [Building](../documentation.md#Building) `-DUSE_CASE_BUILD=kws_asr`.
+To **ONLY** build the automatic speech recognition example application, add `-DUSE_CASE_BUILD=kws_asr` to the `cmake`
+command line, as specified in: [Building](../documentation.md#Building).
### Build process
-> **Note:** This section describes the process for configuring the build for `MPS3: SSE-300` for different target platform see [Building](../documentation.md#Building).
+> **Note:** This section describes the process for configuring the build for the *MPS3: SSE-300*. To build for a
+> different target platform, please refer to: [Building](../documentation.md#Building).
-Create a build directory and navigate inside:
+To build **only** the keyword spotting and automatic speech recognition example, create a build directory and navigate
+inside, like so:
```commandline
mkdir build_kws_asr && cd build_kws_asr
```
-On Linux, execute the following command to build the application to run on the Ethos-U55 Fast Model when providing only the mandatory arguments for CMake configuration:
+On Linux, when providing only the mandatory arguments for CMake configuration, execute the following command to build
+**only** the Keyword Spotting and Automatic Speech Recognition application to run on the *Ethos-U55* Fast Model:
```commandline
cmake ../ -DUSE_CASE_BUILD=kws_asr
```
-To configure a build that can be debugged using Arm-DS, we can just specify
-the build type as `Debug` and use the `Arm Compiler` toolchain file:
+To configure a build that can be debugged using Arm DS specify the build type as `Debug` and then use the `Arm Compiler`
+toolchain file:
```commandline
cmake .. \
@@ -201,24 +236,25 @@ cmake .. \
-DUSE_CASE_BUILD=kws_asr
```
-Also see:
+For further information, please refer to:
- [Configuring with custom TPIP dependencies](../sections/building.md#configuring-with-custom-tpip-dependencies)
- [Using Arm Compiler](../sections/building.md#using-arm-compiler)
- [Configuring the build for simple_platform](../sections/building.md#configuring-the-build-for-simple_platform)
-- [Working with model debugger from Arm FastModel Tools](../sections/building.md#working-with-model-debugger-from-arm-fastmodel-tools)
+- [Working with model debugger from Arm Fast Model Tools](../sections/building.md#working-with-model-debugger-from-arm-fastmodel-tools)
-> **Note:** If re-building with changed parameters values, it is highly advised to clean the build directory and re-run the CMake command.
+> **Note:** If re-building with changed parameters values, we recommend that you clean the build directory and re-run
+> the CMake command.
-If the CMake command succeeded, build the application as follows:
+If the CMake command succeeds, build the application as follows:
```commandline
make -j4
```
-Add VERBOSE=1 to see compilation and link details.
+To see compilation and link details, add `VERBOSE=1`.
-Results of the build will be placed under `build/bin` folder:
+Results of the build are placed under the `build/bin` folder, like so:
```tree
bin
@@ -228,30 +264,32 @@ bin
 └── sectors
├── images.txt
└── kws_asr
- ├── dram.bin
+ ├── ddr.bin
└── itcm.bin
```
-Where:
+The `bin` folder contains the following files:
-- `ethos-u-kws_asr.axf`: The built application binary for the Keyword Spotting and Automatic Speech Recognition use
- case.
+- `ethos-u-kws_asr.axf`: The built application binary for the Keyword Spotting and Automatic Speech Recognition
+ use-case.
-- `ethos-u-kws_asr.map`: Information from building the application (e.g. libraries used, what was optimized, location
- of objects)
+- `ethos-u-kws_asr.map`: Information from building the application. For example: The libraries used, what was optimized,
+ and the location of objects.
- `ethos-u-kws_asr.htm`: Human readable file containing the call graph of application functions.
-- `sectors/kws_asr`: Folder containing the built application, split into files for loading into different FPGA memory regions.
+- `sectors/kws_asr`: Folder containing the built application. It is split into files for loading into different FPGA memory
+ regions.
-- `sectors/images.txt`: Tells the FPGA which memory regions to use for loading the binaries in sectors/** folder.
+- `sectors/images.txt`: Tells the FPGA which memory regions to use for loading the binaries in the `sectors/..` folder.
### Add custom input
-The application performs inference on data found in the folder set by the CMake parameter `kws_asr_FILE_PATH`.
+The application anomaly detection is set up to perform inferences on data found in the folder, or an individual file,
+that is pointed to by the parameter `kws_asr_FILE_PATH`.
-To run the application with your own audio clips first create a folder to hold them and then copy the custom files into
-this folder:
+To run the application with your own audio clips, first create a folder to hold them and then copy the custom clips into
+the following folder:
```commandline
mkdir /tmp/custom_files
@@ -261,7 +299,7 @@ cp custom_audio1.wav /tmp/custom_files/
> **Note:** Clean the build directory before re-running the CMake command.
-Next set `kws_asr_FILE_PATH` to the location of this folder when building:
+Next, when building, set `kws_asr_FILE_PATH` to the location of the following folder:
```commandline
cmake .. \
@@ -269,35 +307,41 @@ cmake .. \
-DUSE_CASE_BUILD=kws_asr
```
-The files found in the `kws_asr_FILE_PATH` folder will be picked up and automatically converted to C++ files during the
-CMake configuration stage and then compiled into the application during the build phase for performing inference with.
+The audio flies found in the `kws_asr_FILE_PATH` folder are picked up and automatically converted to C++ files during
+the CMake configuration stage. They are then compiled into the application during the build phase for performing
+inference with.
-The log from the configuration stage should tell you what directory path has been used:
+The log from the configuration stage tells you what audio directory path has been used:
```log
-- User option kws_asr_FILE_PATH is set to /tmp/custom_files
```
-After compiling, your custom inputs will have now replaced the default ones in the application.
+After compiling, your custom inputs have now replaced the default ones in the application.
### Add custom model
-The application performs KWS inference using the model pointed to by the CMake parameter `kws_asr_MODEL_TFLITE_PATH_KWS` and
-ASR inference using the model pointed to by the CMake parameter `kws_asr_MODEL_TFLITE_PATH_ASR`.
+The application performs KWS inference using the model pointed to by the CMake parameter
+`kws_asr_MODEL_TFLITE_PATH_KWS`. ASR inference is performed using the model pointed to by the CMake parameter
+`kws_asr_MODEL_TFLITE_PATH_ASR`.
+
+This section assumes you want to change the existing ASR model to a custom one. If, instead, you want to change the KWS
+model, then the instructions are the same. Except ASR changes to KWS.
-This section assumes you wish to change the existing ASR model to a custom one. If instead you wish to change the KWS
-model then the instructions will be the same except ASR will change to KWS.
+> **Note:** If you want to run the model using an *Ethos-U55*, ensure that your custom model has been successfully run
+> through the Vela compiler *before* continuing.
-> **Note:** If you want to run the model using Ethos-U55, ensure your custom model has been run through the Vela compiler successfully before continuing. See [Optimize model with Vela compiler](../sections/building.md#Optimize-custom-model-with-Vela-compiler).
+For further information:
+[Optimize model with Vela compiler](../sections/building.md#Optimize-custom-model-with-Vela-compiler).
-To run the application with a custom model you will need to provide a labels_<model_name>.txt file of labels
-associated with the model. Each line of the file should correspond to one of the outputs in your model. See the provided
-labels_wav2letter.txt file for an example.
+To run the application with a custom model, you must provide a `labels_<model_name>.txt` file of labels that are
+associated with the model. Each line of the file must correspond to one of the outputs in your model. Refer to the
+provided `labels_wav2letter.txt` file for an example.
-Then, you must set `kws_asr_MODEL_TFLITE_PATH_ASR` to the location of the Vela processed model file and
-`kws_asr_LABELS_TXT_FILE_ASR` to the location of the associated labels file.
+Then, you must set `kws_asr_MODEL_TFLITE_PATH` to the location of the Vela processed model file and
+`kws_asr_LABELS_TXT_FILE`to the location of the associated labels file.
-An example:
+For example:
```commandline
cmake .. \
@@ -308,11 +352,11 @@ cmake .. \
> **Note:** Clean the build directory before re-running the CMake command.
-The `.tflite` model files pointed to by `kws_asr_MODEL_TFLITE_PATH_KWS` and `kws_asr_MODEL_TFLITE_PATH_ASR`, labels text files pointed to by `kws_asr_LABELS_TXT_FILE_KWS` and `kws_asr_LABELS_TXT_FILE_ASR`
-will be converted to C++ files during the CMake configuration stage and then compiled into the application for
-performing inference with.
+The `.tflite` model files pointed to by `kws_asr_MODEL_TFLITE_PATH_KWS` and `kws_asr_MODEL_TFLITE_PATH_ASR`, and the
+labels text files pointed to by `kws_asr_LABELS_TXT_FILE_KWS` and `kws_asr_LABELS_TXT_FILE_ASR` are converted to C++
+files during the CMake configuration stage. They are then compiled into the application for performing inference with.
-The log from the configuration stage should tell you what model path and labels file have been used:
+The log from the configuration stage tells you what model path and labels file have been used, for example:
```log
-- User option TARGET_PLATFORM is set to mps3
@@ -328,38 +372,44 @@ custom_asr_model_after_vela.tflite.cc
...
```
-After compiling, your custom model will have now replaced the default one in the application.
+After compiling, your custom model has now replaced the default one in the application.
## Setting-up and running Ethos-U55 Code Samples
### Setting up the Ethos-U55 Fast Model
-The FVP is available publicly from [Arm Ecosystem FVP downloads](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps).
+The FVP is available publicly from
+[Arm Ecosystem FVP downloads](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps).
-For Ethos-U55 evaluation, please download the MPS3 version of the Arm® Corstone™-300 model that contains Ethos-U55 and
-Cortex-M55. The model is currently only supported on Linux based machines. To install the FVP:
+For the *Ethos-U55* evaluation, please download the MPS3 version of the Arm® *Corstone™-300* model that contains both
+the *Ethos-U55* and *Cortex-M55*. The model is only supported on Linux-based machines.
-- Unpack the archive
+To install the FVP:
-- Run the install script in the extracted package
+- Unpack the archive.
+
+- Run the install script in the extracted package:
```commandline
./FVP_Corstone_SSE-300_Ethos-U55.sh
```
-- Follow the instructions to install the FVP to your desired location
+- Follow the instructions to install the FVP to the required location.
### Starting Fast Model simulation
-Once completed the building step, application binary ethos-u-kws_asr.axf can be found in the `build/bin` folder.
-Assuming the install location of the FVP was set to ~/FVP_install_location, the simulation can be started by:
+Once the building has been completed, the application binary `ethos-u-kws_asr.axf` can be found in the `build/bin`
+folder.
+
+Assuming that the install location of the FVP was set to `~/FVP_install_location`, then the simulation can be started by
+using:
```commandline
$ ~/FVP_install_location/models/Linux64_GCC-6.4/FVP_Corstone_SSE-300_Ethos-U55
./bin/mps3-sse-300/ethos-u-kws_asr.axf
```
-A log output should appear on the terminal:
+A log output appears on the terminal:
```log
telnetterminal0: Listening for serial connection on port 5000
@@ -368,12 +418,15 @@ telnetterminal2: Listening for serial connection on port 5002
telnetterminal5: Listening for serial connection on port 5003
```
-This will also launch a telnet window with the sample application's standard output and error log entries containing
-information about the pre-built application version, TensorFlow Lite Micro library version used, data type as well as
-the input and output tensor sizes of the model compiled into the executable binary.
+This also launches a telnet window with the standard output of the sample application. It also includes error log
+entries containing information about the pre-built application version, TensorFlow Lite Micro library version used, and
+data types. The log also includes the input and output tensor sizes of the model compiled into the executable binary.
-After the application has started if `kws_asr_FILE_PATH` pointed to a single file (or a folder containing a single input file)
-the inference starts immediately. In case of multiple inputs choice, it outputs a menu and waits for the user input from telnet terminal:
+After the application has started, if `kws_asr_FILE_PATH` points to a single file, or even a folder that contains a
+single input file, then the inference starts immediately. If there are multiple inputs, it outputs a menu and then waits
+for input from the user.
+
+For example:
```log
User input required
@@ -389,79 +442,82 @@ Choice:
```
-1. “Classify next audio clip” menu option will run single inference on the next included file.
+What the preceding choices do:
+
+1. Classify next audio clip: Runs a single inference on the next in line.
-2. “Classify audio clip at chosen index” menu option will run inference on the chosen audio clip.
+2. Classify audio clip at chosen index: Runs inference on the chosen audio clip.
- > **Note:** Please make sure to select audio clip index in the range of supplied audio clips during application build.
+ > **Note:** Please make sure to select audio clip index within the range of supplied audio clips during application
+ > build. By default, a pre-built application has four files, with indexes from `0` to `3`.
-3. “Run ... on all” menu option triggers sequential inference executions on all built-in files.
+3. Run ... on all: Triggers sequential inference executions on all built-in applications.
-4. “Show NN model info” menu option prints information about model data type, input and output tensor sizes:
+4. Show NN model info: Prints information about the model data type, input, and output, tensor sizes:
```log
INFO - uTFL version: 2.5.0
INFO - Model INPUT tensors:
- INFO - tensor type is INT8
- INFO - tensor occupies 490 bytes with dimensions
- INFO - 0: 1
- INFO - 1: 1
- INFO - 2: 49
- INFO - 3: 10
+ INFO - tensor type is INT8
+ INFO - tensor occupies 490 bytes with dimensions
+ INFO - 0: 1
+ INFO - 1: 1
+ INFO - 2: 49
+ INFO - 3: 10
INFO - Quant dimension: 0
INFO - Scale[0] = 1.107164
INFO - ZeroPoint[0] = 95
INFO - Model OUTPUT tensors:
- INFO - tensor type is INT8
- INFO - tensor occupies 12 bytes with dimensions
- INFO - 0: 1
- INFO - 1: 12
+ INFO - tensor type is INT8
+ INFO - tensor occupies 12 bytes with dimensions
+ INFO - 0: 1
+ INFO - 1: 12
INFO - Quant dimension: 0
INFO - Scale[0] = 0.003906
INFO - ZeroPoint[0] = -128
INFO - Activation buffer (a.k.a tensor arena) size used: 123616
INFO - Number of operators: 16
- INFO - Operator 0: RESHAPE
- INFO - Operator 1: CONV_2D
- INFO - Operator 2: DEPTHWISE_CONV_2D
- INFO - Operator 3: CONV_2D
- INFO - Operator 4: DEPTHWISE_CONV_2D
- INFO - Operator 5: CONV_2D
- INFO - Operator 6: DEPTHWISE_CONV_2D
- INFO - Operator 7: CONV_2D
- INFO - Operator 8: DEPTHWISE_CONV_2D
- INFO - Operator 9: CONV_2D
- INFO - Operator 10: DEPTHWISE_CONV_2D
- INFO - Operator 11: CONV_2D
- INFO - Operator 12: AVERAGE_POOL_2D
- INFO - Operator 13: RESHAPE
- INFO - Operator 14: FULLY_CONNECTED
- INFO - Operator 15: SOFTMAX
+ INFO - Operator 0: RESHAPE
+ INFO - Operator 1: CONV_2D
+ INFO - Operator 2: DEPTHWISE_CONV_2D
+ INFO - Operator 3: CONV_2D
+ INFO - Operator 4: DEPTHWISE_CONV_2D
+ INFO - Operator 5: CONV_2D
+ INFO - Operator 6: DEPTHWISE_CONV_2D
+ INFO - Operator 7: CONV_2D
+ INFO - Operator 8: DEPTHWISE_CONV_2D
+ INFO - Operator 9: CONV_2D
+ INFO - Operator 10: DEPTHWISE_CONV_2D
+ INFO - Operator 11: CONV_2D
+ INFO - Operator 12: AVERAGE_POOL_2D
+ INFO - Operator 13: RESHAPE
+ INFO - Operator 14: FULLY_CONNECTED
+ INFO - Operator 15: SOFTMAX
INFO - Model INPUT tensors:
- INFO - tensor type is INT8
- INFO - tensor occupies 11544 bytes with dimensions
- INFO - 0: 1
- INFO - 1: 296
- INFO - 2: 39
+ INFO - tensor type is INT8
+ INFO - tensor occupies 11544 bytes with dimensions
+ INFO - 0: 1
+ INFO - 1: 296
+ INFO - 2: 39
INFO - Quant dimension: 0
INFO - Scale[0] = 0.110316
INFO - ZeroPoint[0] = -11
INFO - Model OUTPUT tensors:
- INFO - tensor type is INT8
- INFO - tensor occupies 4292 bytes with dimensions
- INFO - 0: 1
- INFO - 1: 1
- INFO - 2: 148
- INFO - 3: 29
+ INFO - tensor type is INT8
+ INFO - tensor occupies 4292 bytes with dimensions
+ INFO - 0: 1
+ INFO - 1: 1
+ INFO - 2: 148
+ INFO - 3: 29
INFO - Quant dimension: 0
INFO - Scale[0] = 0.003906
INFO - ZeroPoint[0] = -128
INFO - Activation buffer (a.k.a tensor arena) size used: 809808
INFO - Number of operators: 1
- INFO - Operator 0: ethos-u
+ INFO - Operator 0: ethos-u
```
-5. “List” menu option prints a list of pair ... indexes - the original filenames embedded in the application:
+5. List audio clips: Prints a list of pair ... indexes. The original filenames are embedded in the application, like so:
```log
[INFO] List of Files:
@@ -472,7 +528,7 @@ Choice:
Please select the first menu option to execute Keyword Spotting and Automatic Speech Recognition.
-The following example illustrates application output:
+The following example illustrates the output of an application:
```log
INFO - KWS audio data window size 16000
@@ -502,32 +558,32 @@ INFO - NPU IDLE cycles: 863
INFO - NPU total cycles: 28910172
```
-It could take several minutes to complete one inference run (average time is 2-3 minutes).
+It can take several minutes to complete one inference run. The average time is around 2-3 minutes.
-Using the input “yes_no_go_stop.wav”, the log shows inference results for the KWS operation first, detecting the
-trigger word “yes“ with the stated probability score (in this case 0.99). After this, the ASR inference is run,
-printing the words recognized from the input sample.
+Using the input `yes_no_go_stop.wav`, the log shows inference results for the KWS operation first. Detecting the trigger
+word `yes` with the stated probability score. In this case, `0.99`. After this, the ASR inference is run, printing the
+words recognized from the input sample.
The profiling section of the log shows that for the ASR inference:
-- Ethos-U55's PMU report:
+- *Ethos-U55* PMU report:
- - 28,910,172 total cycle: The number of NPU cycles
+ - 28,910,172 total cycle: The number of NPU cycles.
- - 28,909,309 active cycles: number of NPU cycles that were used for computation
+ - 28,909,309 active cycles: The number of NPU cycles that were used for computation.
- - 863 idle cycles: number of cycles for which the NPU was idle
+ - 863 idle cycles: The number of cycles for which the NPU was idle.
- - 13,520,864 AXI0 read beats: The number of AXI beats with read transactions from AXI0 bus.
- AXI0 is the bus where Ethos-U55 NPU reads and writes to the computation buffers (activation buf/tensor arenas).
+ - 13,520,864 AXI0 read beats: The number of AXI beats with read transactions from the AXI0 bus. AXI0 is the bus where
+ the *Ethos-U55* NPU reads and writes to the computation buffers, activation buf, or tensor arenas.
- 2,841,970 AXI0 write beats: The number of AXI beats with write transactions to AXI0 bus.
- - 2,717,670 AXI1 read beats: The number of AXI beats with read transactions from AXI1 bus.
- AXI1 is the bus where Ethos-U55 NPU reads the model (read only)
+ - 2,717,670 AXI1 read beats: The number of AXI beats with read transactions from the AXI1 bus. AXI1 is the bus where
+ the *Ethos-U55* NPU reads the model. So, read-only.
-- For FPGA platforms, CPU cycle count can also be enabled. For FVP, however, CPU cycle counters should not be used as
-the CPU model is not cycle-approximate or cycle-accurate.
+- For FPGA platforms, a CPU cycle count can also be enabled. However, do not use cycle counters for FVP, as the CPU
+ model is not cycle-approximate or cycle-accurate.
- Note that in this example the KWS inference does not use the Ethos-U55 and is run purely on CPU, therefore 0 Active
- NPU cycles is shown.
+> **Note:** In this example, the KWS inference does *not* use the *Ethos-U55* and only runs on the CPU. Therefore, `0`
+> Active NPU cycles are shown.