Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .vscode/settings.json

This file was deleted.

4 changes: 2 additions & 2 deletions ARM.CMSIS-MLEK.pdsc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<package schemaVersion="1.7.40" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="https://raw.githubusercontent.com/Open-CMSIS-Pack/Open-CMSIS-Pack-Spec/v1.7.40/schema/PACK.xsd">
<vendor>ARM</vendor>
<name>CMSIS-MLEK</name>
<description overview="overview/README.md">MLEK (Machine Learning Evaluation Kit) for CMSIS workflows</description>
<name>cmsis-mlek</name>
<description overview="overview/README.md">Machine Learning Evaluation Kit (MLEK) for CMSIS workflows</description>
<!-- web download link -->
<url>https://www.keil.com/pack/</url>
<license>LICENSE</license>
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ Directory | Description
----------------------------------|-------------------------------
[overview](./overview) | Top-level overview of MLEK reference applications.
[docs](./docs/) | Source of the [user documentation](https://arm-examples.github.io/cmsis-mlek) of the MLEK reference applications.
[template](./template) | [MLEK reference applications](https://arm-examples.github.io/cmsis-mlek/main/template.html), a test framework for DSP and ML algorithms.
[template](./template) | MLEK reference applications source code.
[.github/workflows](./.github/workflows) | GitHub Actions for validation and publishing.
[.ci](./.ci) | Files that relate to CI tests.

## Related

- [MLEK Pack](https://www.keil.arm.com/packs/MLEK) available on [keil.arm.com/packs](https://www.keil.arm.com/packs).
- [CMSIS-MLEK Pack](https://www.keil.arm.com/packs/cmsis-mlek-arm) available on [keil.arm.com/packs](https://www.keil.arm.com/packs).
- [tensorflow-lite-micro Pack](https://www.keil.arm.com/packs/tensorflow-lite-micro-tensorflow) available on [keil.arm.com/packs](https://www.keil.arm.com/packs).
- [MLEK Examples](https://github.com/Arm-Examples/mlek-examples) a repository with MLEK applications that are configured for evaluation boards and use cases.
- [ML Developers Guide for Cortex-M Processors and Ethos-U NPU](https://developer.arm.com/documentation/109267).
Expand Down
Binary file modified docs/images/ConfigureMLEKSolution.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/KWS_preprocessing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/SelectAVHTarget.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/SelectMLEKTemplate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/kws_print.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 12 additions & 11 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
# CMSIS-MLEK Reference Application Package
# Machine Learning Evaluation Kit (MLEK) for CMSIS Workflows

This documentation explains the usage of the CMSIS-MLEK Reference Application Package for developing Machine Learning (ML) and Edge AI applications on Cortex-M processors with Ethos-U NPUs.
This documentation explains the usage of the CMSIS-MLEK Reference Application Package for developing Machine Learning (ML) and Edge AI applications on Cortex-M processors optional with Ethos-U NPUs.

## Target Audience

This user's guide assumes basic knowledge about Cortex-M software development and CMSIS-Toolbox workflows. It is written for embedded software developers who work with C/C++ compiler toolchains and develop machine learning applications for microcontroller devices with Cortex-M processors and Ethos-U NPUs.

## Manual Chapters

- [**Overview**](overview.md) explains the features and capabilities of the MLEK templates package.
- [**MLEK Audio Applications**](templates_audio.md) describes the available ML templates for audio use-cases.
- [**MLEK Video Applications**](templates_video.md) describes the available ML templates for video and image use-cases.
- [**Targeting Hardware Boards**](target_configuration_refapp.md) gives step-by-step guidance for deploying the reference applications to a hardware platform in VS Code.
- [**Targeting Arm Virtual Hardware**](target_configuration_avh.md) shows how to select a virtual target in Visual Studio code.

<!-- Duplicate of Overview.md
## Package Overview

The CMSIS-MLEK package provides ready-to-use templates and examples for machine learning applications. It includes three main template categories:
Expand All @@ -14,14 +23,6 @@ The CMSIS-MLEK package provides ready-to-use templates and examples for machine
- **Video Reference Applications** - Object detection and video processing examples
- **Generic Reference Applications** - General-purpose inference runner for custom ML models (available from version 1.0+)

## Manual Chapters

- [**Overview**](overview.md) explains the features and capabilities of the MLEK templates package.
- [**MLEK Reference Applications - Audio**](templates_audio.md) describes the available ML templates for audio use-cases.
- [**MLEK Reference Applications - Video**](templates_video.md) describes the available ML templates for video and image use-cases.
- [**Target Configuration Reference Application Hardware**](target_configuration_refapp.md) gives step-by-step guidance for deploying the reference applications to a hardware platform in Visual Studion Code.
- [**Target Configuration Arm Virtual Hardware**](target_configuration_avh.md) shows how to select a virtual target in Visual Studio code.

## Available Templates

The package includes the following example templates:
Expand All @@ -44,10 +45,10 @@ The templates support multiple Arm Cortex-M platforms:
- **Corstone-320** (Cortex-M85 + Ethos-U85)

Each template can be built for both Arm Virtual Hardware (AVH) simulation and physical evaluation boards.
-->

## Revision History

| Version | Description |
|---------|-------------|
| 0.1.0 | Initial draft release of CMSIS-MLEK templates package |
| 0.5.0 | First published release. |
6 changes: 3 additions & 3 deletions docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ The CMSIS-MLEK software pack is derived from the [Arm® ML embedded evaluation k

| ML application | Description | Neural Network Model |
|:-----------------------------------------------|:------------------------|:----------------------|
| [Keyword spotting (KWS)](https://github.com/ARM-software/cmsis-mlek/template/audio) | Recognize the presence of a key word in verbal speech | [MicroNet](https://github.com/ARM-software/ML-zoo/tree/9f506fe52b39df545f0e6c5ff9223f671bc5ae00/models/keyword_spotting/micronet_medium/tflite_int8) |
| [Object detection](https://github.com/ARM-software/cmsis-mlek/template/video) | Detects and draws face bounding box in a given image | [Yolo Fastest](https://github.com/emza-vs/ModelZoo/blob/master/object_detection/yolo-fastest_192_face_v4.tflite) |
| [Generic inference runner](https://github.com/ARM-software/cmsis-mlek/template/generic) | Code block allowing you to develop your own use case | Your custom model |
| [Keyword spotting (KWS)](https://github.com/Arm-Examples/cmsis-mlek/template/audio) | Recognize the presence of a key word in verbal speech | [MicroNet](https://github.com/ARM-software/ML-zoo/tree/9f506fe52b39df545f0e6c5ff9223f671bc5ae00/models/keyword_spotting/micronet_medium/tflite_int8) |
| [Object detection](https://github.com/Arm-Examples/cmsis-mlek/template/video) | Detects and draws face bounding box in a given image | [Yolo Fastest](https://github.com/emza-vs/ModelZoo/blob/master/object_detection/yolo-fastest_192_face_v4.tflite) |
| [Generic inference runner](https://github.com/Arm-Examples/cmsis-mlek/template/generic) | Code block allowing you to develop your own use case | Your custom model |

Each [ML reference application](https://open-cmsis-pack.github.io/cmsis-toolbox/ReferenceApplications/) is a *csolution project* which supports deployment to physical hardware or Arm Virtual Hardware (AVH-FVP) for simulation.

Expand Down
45 changes: 33 additions & 12 deletions docs/templates_audio.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# MLEK Reference Applications - Audio
# MLEK - Audio Applications

<!-- markdownlint-disable MD013 -->
<!-- markdownlint-disable MD036 -->

## Audio Processing Reference Applications

These reference applications focus on real-time audio processing:
This chapter describes the MLEK reference applications for real-time audio processing:

- **Keyword Spotting (KWS)**: Demonstrates wake word detection and voice command recognition
- **Audio User Algorithm Template**: Provides a foundation for custom audio ML processing applications
Expand All @@ -25,21 +23,44 @@ found in the [CMSIS-Driver Manual](https://arm-software.github.io/CMSIS_6/latest

## Keyword Spotting Application

Keyword spotting (KWS) is the process of detecting predefined words or phrases from a continuous audio stream. In the CMSIS-MLEK templates this allows an embedded device to listen for a "wake word" before executing further commands. The audio template provides an end-to-end implementation using TensorFlow Lite Micro and CMSIS-NN for optimized inference on Cortex-M processors.
Keyword spotting (KWS) reference application detects predefined words or phrases from a continuous audio stream. An embedded device can listen to a list of "wake words" and use it to execute commands. This implementation uses TensorFlow Lite Micro and CMSIS-NN for optimized inference on Cortex-M processors or Ethos-U processors.

How KWS works:

### How KWS Works
- Incoming audio is captured from a microphone or played back from a test sample.
- The audio stream is converted into Mel-frequency cepstral coefficients (MFCC) features.
- A neural network classifies the MFCC features to determine which keyword, if any, was spoken.
- Detection results are reported via UART or LED indicators.
- The audio stream is preprocessed and converted into Mel-frequency cepstral coefficients (MFCC) features.
- A MicroNet keyword spotting model classifies the MFCC features to determine which keyword, if any, was spoken.
- Detection results are reported via printf messages.

The template can detect up to twelve keywords. A sample audio file containing the word "down" is provided for testing.
### Audio Stream Preprocessing

![KWS_Console_Print](images/kws_print.png)
*This capture shows serial output from a hardware target, while the application detects the keyword "yes" on a microphone stream.*
The MicroNet keyword spotting model expects audio data to be preprocessed before performing an inference. This section is an overview of the feature extraction process used. First, the audio data is normalized to the range (-1, 1).

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 `Mfcc.cc` and `Mfcc.hpp`. These files are part of the software component `ML Eval Kit:Common:API`.

Next, a window of 640 audio samples (40ms) is taken from the audio input. From these 640 samples, we calculate 10
MFCC features. The whole window is shifted to the right by 320 audio samples (20ms) and 10 new MFCC features are calculated. This process of shifting and calculating is repeated. For 1 second audio input, 49 windows that each have 10 MFCC features are calculated. These extracted features are quantized and an inference is performed.

![KWS Preprocessing](images/KWS_preprocessing.png)

### MicroMet ML Model

The KWS application uses the [MicroNet Medium INT8](https://github.com/Arm-Examples/ML-zoo/tree/master/models/keyword_spotting/micronet_medium/tflite_int8) model that is trained for twelve keywords (see file `src/Labels.cpp`).

ToDo:
- how to get scripts?
- how to convert models?

A sample audio file containing the word "down" is provided for testing.

The picture below shows serial output from a hardware target, while the application detects the keyword "yes" on a microphone stream.

![KWS_Console_Print](images/kws_print.png)

### Build Types

The KWS example defines four build types that control debug information and the audio source:

| Build Type | Description |
Expand Down
14 changes: 5 additions & 9 deletions docs/templates_video.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
# MLEK Reference Application Templates
# MLEK Video Application

<!-- markdownlint-disable MD013 -->
<!-- markdownlint-disable MD036 -->

This chapter describes the MLEK reference applications for real-time video processing:

## Video Processing Templates
- **Video/Object Detection**: Object detection using camera input, bounding box data visualization
- **Video/User Algorithm**: Provides a foundation for a custom ML algorithms

These templates focus on real-time audio processing:

- **Keyword Spotting (KWS)**: Demonstrates wake word detection and voice command recognition
- **Audio User Algorithm Template**: Provides a foundation for custom audio ML processing applications

### Required API Interfaces
## Required API Interfaces

For hardware deployment, the Board-Layer should provide the following API interfaces:

Expand All @@ -30,7 +27,6 @@ found in the [CMSIS-Driver Manual](https://arm-software.github.io/CMSIS_6/latest
This example uses a neural network model that specialises in detecting human faces in images.
The input size for these images is 192x192 (monochrome) and the smallest face that can be detected is of size 20x20. The output of the application will be co-ordinates for rectangular bounding boxes for each detection.


### Build Types
The Object Detection example defines four build types that control debug information and the video source:

Expand Down
10 changes: 5 additions & 5 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
site_name: CMSIS MLEK Machine Learning Evaluation Kit (MLEK)
site_name: Machine Learning Evaluation Kit (MLEK) for CMSIS Workflows
repo_url: https://github.com/ARM-Examples/cmsis-mlek
edit_uri: ./edit/main/docs
nav:
- Home: index.md
- Overview: overview.md
- Audio Template Applications: templates_audio.md
- Video Template Applications: templates_video.md
- Target Configuration Hardware Boards: target_configuration_refapp.md
- Target Configuration Arm Virtual Hardware: target_configuration_avh.md
- MLEK - Audio Applications: templates_audio.md
- MLEK - Video Applications: templates_video.md
- Targeting Hardware Boards: target_configuration_refapp.md
- Targeting Arm Virtual Hardware: target_configuration_avh.md

plugins:
- search
Expand Down
9 changes: 5 additions & 4 deletions overview/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ The CMSIS-MLEK software pack is derived from the [Arm® ML embedded evaluation k

| ML application | Description | Neural Network Model |
|:-----------------------------------------------|:------------------------|:----------------------|
| [Keyword spotting (KWS)](https://github.com/ARM-software/cmsis-mlek/template/audio) | Recognize the presence of a key word in verbal speech | [MicroNet](https://github.com/ARM-software/ML-zoo/tree/9f506fe52b39df545f0e6c5ff9223f671bc5ae00/models/keyword_spotting/micronet_medium/tflite_int8) |
| [Object detection](https://github.com/ARM-software/cmsis-mlek/template/video) | Detects and draws face bounding box in a given image | [Yolo Fastest](https://github.com/emza-vs/ModelZoo/blob/master/object_detection/yolo-fastest_192_face_v4.tflite) |
| [Generic inference runner](https://github.com/ARM-software/cmsis-mlek/template/generic) | Code block allowing you to develop your own use case | Your custom model |
| [Keyword spotting (KWS)](https://github.com/Arm-Examples/cmsis-mlek/template/audio) | Recognize the presence of a key word in verbal speech | [MicroNet](https://github.com/ARM-software/ML-zoo/tree/9f506fe52b39df545f0e6c5ff9223f671bc5ae00/models/keyword_spotting/micronet_medium/tflite_int8) |
| [Object detection](https://github.com/Arm-Examples/cmsis-mlek/template/video) | Detects and draws face bounding box in a given image | [Yolo Fastest](https://github.com/emza-vs/ModelZoo/blob/master/object_detection/yolo-fastest_192_face_v4.tflite) |
| [Generic inference runner](https://github.com/Arm-Examples/cmsis-mlek/template/generic) | Code block allowing you to develop your own use case | Your custom model |

Each [ML reference application](https://open-cmsis-pack.github.io/cmsis-toolbox/ReferenceApplications/) is a *csolution project* which supports deployment to physical hardware or Arm Virtual Hardware (AVH-FVP) for simulation.

Expand Down Expand Up @@ -62,5 +62,6 @@ Adding a postfix to the _target name_ in the `*.csolution.yml` project file conf
## Links

- [Documentation](https://arm-examples.github.io/cmsis-mlek)
- [CMSIS-MLEK](https://github.com/ARM-examples/cmsis-mlek) GitHub repository
- [CMSIS-MLEK](https://github.com/Arm-Examples/cmsis-mlek) GitHub repository
- [TensorFlow Lite](https://www.keil.arm.com/packs/tensorflow-lite-micro-tensorflow) Software Pack
- [SDS](https://www.keil.arm.com/packs/sds-arm) Synchronous Data Stream Framework for algorithm development
7 changes: 7 additions & 0 deletions template/audio/mlek_audio.csolution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ solution:

compiler: AC6

misc:
- for-compiler: AC6
C-CPP:
- -gdwarf-5
ASM:
- -gdwarf-5

packs:
- pack: ARM::V2M_MPS3_SSE_300_BSP@^1.5.0
- pack: ARM::V2M_MPS3_SSE_310_BSP@^1.4.0
Expand Down
7 changes: 7 additions & 0 deletions template/generic/mlek_generic.csolution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ solution:

compiler: AC6

misc:
- for-compiler: AC6
C-CPP:
- -gdwarf-5
ASM:
- -gdwarf-5

packs:
- pack: ARM::V2M_MPS3_SSE_300_BSP@^1.5.0
- pack: ARM::V2M_MPS3_SSE_310_BSP@^1.4.0
Expand Down
7 changes: 7 additions & 0 deletions template/video/mlek_video.csolution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ solution:

compiler: AC6

misc:
- for-compiler: AC6
C-CPP:
- -gdwarf-5
ASM:
- -gdwarf-5

packs:
- pack: ARM::V2M_MPS3_SSE_300_BSP@^1.5.0
- pack: ARM::V2M_MPS3_SSE_310_BSP@^1.4.0
Expand Down
Loading