Skip to content

Commit 2008d5e

Browse files
authored
Merge pull request #101 from kshitij-sisodia-arm/feature/mleco-3548
MLECO-3603, MLECO-3548: Minor improvements
2 parents 5bc0b8e + b90e477 commit 2008d5e

File tree

4 files changed

+130
-70
lines changed

4 files changed

+130
-70
lines changed

cmsis-pack-examples/README.md

Lines changed: 119 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,79 @@
1-
- [ML examples](#ml-examples)
2-
- [Trademarks](#trademarks)
3-
- [Licenses](#licenses)
1+
# CMSIS-Pack based Machine Learning Examples
2+
3+
- [Introduction](#introduction)
4+
- [Overview](#overview)
5+
- [Object detection](#object-detection)
6+
- [Keyword spotting](#keyword-spotting)
7+
- [Building the examples](#building-the-examples)
48
- [Prerequisites](#prerequisites)
59
- [Tools](#tools)
610
- [Packs](#packs)
711
- [Download Software Packs](#download-software-packs)
8-
- [Generate Project](#generate-project)
9-
# ML examples
12+
- [Generate and build the project](#generate-and-build-the-project)
13+
- [Application output](#application-output)
14+
- [Trademarks](#trademarks)
15+
- [Licenses](#licenses)
1016

11-
A collection of ML examples using the CMSIS pack from [ml-embedded-eval-kit](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit/+/refs/heads/main). Currently, a couple of examples are supported:
17+
## Introduction
1218

13-
- Object detection
14-
- Keyword spotting
19+
This repository has a collection of Machine Learning (ML) examples using the CMSIS-Pack from
20+
[ML Embedded Evaluation Kit](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit/+/refs/heads/main).
21+
Currently, a couple of examples are supported:
1522

16-
## Trademarks
23+
- Object detection - detects objects in the input image.
24+
- Keyword spotting - detects specific keywords in the input audio stream.
1725

18-
- Arm® and Cortex® are registered trademarks of Arm® Limited (or its subsidiaries) in the US and/or elsewhere.
19-
- Arm® and Ethos™ are registered trademarks or trademarks of Arm® Limited (or its subsidiaries) in the US and/or
20-
elsewhere.
21-
- Arm® and Corstone™ are registered trademarks or trademarks of Arm® Limited (or its subsidiaries) in the US and/or
22-
elsewhere.
23-
- Arm®, Keil® and µVision® are registered trademarks of Arm Limited (or its subsidiaries) in the US and/or elsewhere.
24-
- TensorFlow™, the TensorFlow logo, and any related marks are trademarks of Google Inc.
26+
Use this import button to open the solution in Keil Studio Cloud: [![Open in Keil Studio](https://img.shields.io/badge/Keil%20Studio-Import-blue?logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNS40LjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCA0NyAxNCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNDcgMTQ7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+DQoJLnN0MHtmaWxsOiNGRkZGRkY7fQ0KPC9zdHlsZT4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik00LjcsN2MwLDIuMiwxLjQsNC4xLDMuNSw0LjFjMS44LDAsMy42LTEuNCwzLjYtNC4xYzAtMi44LTEuNy00LjItMy42LTQuMkM2LjIsMi45LDQuNyw0LjcsNC43LDcgTTExLjYsMC41DQoJaDIuOXYxM2gtMi45di0xLjNjLTAuOSwxLjEtMi4zLDEuNy0zLjcsMS43QzQsMTMuOSwxLjgsMTAuNiwxLjgsN2MwLTQuMywyLjctNi45LDYuMS02LjljMS41LDAsMi44LDAuNywzLjcsMS45VjAuNXoiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xOCwwLjVIMjF2MS4yYzAuMy0wLjQsMC43LTAuOCwxLjItMS4xYzAuNS0wLjMsMS4yLTAuNCwxLjctMC40YzAuOCwwLDEuNiwwLjIsMi4zLDAuNmwtMS4yLDIuOA0KCWMtMC40LTAuMy0xLTAuNC0xLjUtMC40Yy0wLjctMC4xLTEuMywwLjItMS44LDAuN0MyMSw0LjYsMjEsNS45LDIxLDYuOHY2LjdIMThWMC41eiIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI4LjIsMC41aDIuOXYxLjJjMC43LTAuOSwxLjktMS42LDMuMS0xLjZjMS4zLDAsMi42LDAuNywzLjIsMS45YzAuOS0xLjIsMi4yLTEuOSwzLjctMS45DQoJQzQyLjcsMCw0NCwwLjksNDQuNywyLjJjMC4yLDAuNCwwLjcsMS40LDAuNywzLjN2OC4xaC0yLjlWNi4zYzAtMS41LTAuMi0yLjEtMC4yLTIuM2MtMC4yLTAuNy0wLjktMS4yLTEuNy0xLjENCgljLTAuNywwLTEuMywwLjMtMS43LDAuOWMtMC41LDAuOC0wLjYsMS45LTAuNiwyLjl2Ni43aC0yLjlWNi4zYzAtMS41LTAuMi0yLjEtMC4yLTIuM2MtMC4yLTAuNy0wLjktMS4yLTEuNy0xLjENCgljLTAuNywwLTEuMywwLjMtMS43LDAuOWMtMC41LDAuOC0wLjYsMS45LTAuNiwyLjl2Ni43aC0yLjlMMjguMiwwLjV6Ii8+DQo8L3N2Zz4NCg==&logoWidth=47)](https://studio.keil.arm.com/?import=https://github.com/Arm-Examples/mlek-corstone-300-examples.git)
2527

26-
## Licenses
28+
## Overview
2729

28-
The application samples are provided under the Apache 2.0 license, see [License](./LICENSE).
30+
The examples presented in this repository showcase how to build and deploy end-to-end Machine
31+
Learning applications using existing code from various CMSIS-packs. These examples are built
32+
using Google's [TensorFlow Lite Micro framework](https://www.tensorflow.org/lite/microcontrollers)
33+
and Arm's [ML Embedded Evaluation Kit](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit/+/refs/heads/main/Readme.md)
34+
API's. The embedded evaluation kit API pack has ready-to-use machine learning API's for several
35+
use cases covering typical `voice`, `vibration` and `vision` applications.
2936

30-
Application input data sample files (audio or image files) and the neural network model files have
31-
been converted into C/C++ type arrays and are distributed under Apache 2.0 license. The models have
32-
been processed by the [Vela compiler](https://pypi.org/project/ethos-u-vela/) and then converted
33-
into C/C++ arrays to be baked into the example applications.
37+
Although the target platform here is Arm® Corstone™-300, the examples can be easily ported to new
38+
targets, potentially using physical (or virtual) peripherals for live data being fed into the
39+
neural network model. Corstone™-300 platform gives us the choice of executing the ML workload on
40+
Arm® Cortex®-M55 CPU or running it more efficiently on Arm® Ethos™-U55 NPU. The examples are set
41+
up to use the NPU by default with unsupported operators falling back on the CPU.
3442

35-
| Example | Licence | Provenance |
36-
|---------------|---------|---------|
37-
| Keyword Spotting | Apache 2.0 | [micronet_medium](https://github.com/ARM-software/ML-zoo/raw/9f506fe52b39df545f0e6c5ff9223f671bc5ae00/models/keyword_spotting/micronet_medium/tflite_int8/) |
38-
| Object Detection | Apache 2.0 | [object_detection](https://github.com/emza-vs/ModelZoo/blob/v1.0/object_detection/) |
43+
### Object detection
44+
45+
This example uses a neural network model that specialises in detecting human faces in images.
46+
The input size for these images is 192x192 (monochrome) and the smallest face that can be
47+
detected is of size 20x20. The output of the application will be co-ordinates for rectangular
48+
bounding boxes for each detection.
49+
50+
### Keyword spotting
3951

40-
## Prerequisites
52+
This example can detect up to twelve keywords in the input audio stream. The audio file used
53+
contains the keyword "down" being spoken.
54+
55+
More details about the input for this example can be found [here](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit/+/refs/heads/main/docs/use_cases/kws.md#preprocessing-and-feature-extraction).
56+
57+
## Building the examples
58+
59+
We recommend using [Keil Studio Cloud](https://studio.keil.arm.com/?import=https://github.com/Arm-Examples/mlek-corstone-300-examples.git) for building these examples.
60+
This is by far the easiest way to get started. However, it is possible to build these projects locally too and the following sections cover the requirements for such a
61+
set up.
62+
63+
### Prerequisites
4164

4265
For developing on a local host machine, we recommend a Linux based system as we test
4366
the flow of the instructions in that environment, but a Windows based machine should
4467
also work.
45-
### Tools
4668

47-
The following tools are required if building on a local machine (and not using the project via Keil Studio Cloud):
69+
#### Tools
70+
71+
The following tools are required if building on a local machine (and not using the project via
72+
Keil Studio Cloud):
4873

4974
- [CMSIS-Toolbox 1.0.0](https://github.com/Open-CMSIS-Pack/devtools/releases) or higher.
50-
- Arm Compiler 6.18 (part of Keil MDK or Arm Development Studio, evaluation version sufficient for compilation).
75+
- Arm Compiler 6.18 (part of Keil MDK or Arm Development Studio, evaluation version sufficient
76+
for compilation).
5177
- Arm Virtual Hardware for Corstone-300 v11.18.1 or a local installation of Fixed Virtual Platform
5278

5379
> **NOTE**: For Linux, we recommend using the script installer as this sets up the
@@ -69,14 +95,16 @@ The following tools are required if building on a local machine (and not using t
6995
> $ source /home/user/cmsis-toolbox-linux64/etc/setup
7096
> ```
7197
72-
### Packs
98+
#### Packs
7399
74-
Access to the Internet to download the required packs are listed in the file
75-
[`mlek.csolution.yml`](./mlek.csolution.yml).
100+
CMSIS-Pack defines a standardized way to deliver software components, device parameters and board
101+
support information and code. A list of available CMSIS-Packs can be found
102+
[here](https://developer.arm.com/tools-and-software/embedded/cmsis/cmsis-packs).
76103
77-
## Download Software Packs
104+
### Download Software Packs
78105
79-
The `csolution.yml` file lists the software packs used in all projects. These can be downloaded using the following command:
106+
The [mlek.csolution.yml](./mlek.csolution.yml) file lists the software packs used in all projects. These can be
107+
downloaded using the following command:
80108
81109
```
82110
> csolution list packs -s mlek.csolution.yml -m > packlist.txt
@@ -90,7 +118,7 @@ The `csolution.yml` file lists the software packs used in all projects. These ca
90118
> $ source /home/user/cmsis-toolbox-linux64/etc/setup
91119
> ```
92120
93-
## Generate Project
121+
### Generate and build the project
94122
95123
1. Use the `csolution` command to create `.cprj` project files:
96124
```
@@ -119,22 +147,69 @@ The `csolution.yml` file lists the software packs used in all projects. These ca
119147
> 1. During the build process required packs may be downloaded.
120148
> 2. The generator specified depends on CMake and the host platform OS.
121149
122-
## Execute Project
150+
### Execute project
123151

124-
The project is configured for execution on Arm Virtual Hardware which removes the requirement for a physical hardware board.
152+
The project is configured for execution on Arm Virtual Hardware which removes the requirement for
153+
a physical hardware board.
125154

126155
- When using a Fixed Virtual Platform installed locally:
127156
```
128157
> <path_to_installed_FVP> -a ./out/kws/AVH-U55/Debug/kws.Debug+AVH-U55.axf -C ethosu.num_macs=256
129158
```
130-
> **NOTE**: The FVP defaults to running 128 MAC configuration for Arm Ethos-U55 NPU.
159+
> **NOTE**: The FVP defaults to running 128 MAC configuration for Arm® Ethos-U55 NPU.
131160
> However, our default neural network model for the NPU is for 256 MAC configuration.
132161
133-
- [Keil Studio Cloud](https://studio.keil.arm.com/) integrates also the Arm Virtual Hardware VHT_Corstone_SSE-300_Ethos-U55 model. The steps to use the example are:
134-
- Start [Keil Studio Cloud](https://studio.keil.arm.com/) and login to the system using your account.
135-
- Drag and drop this directory (cmsis-pack-examples) into the project pane.
136-
- Select the *Active Project* from the drop down - it should show all projects referenced in the `csolution` file.
162+
- [Keil Studio Cloud](https://studio.keil.arm.com/) integrates also the Arm Virtual Hardware
163+
VHT_Corstone_SSE-300_Ethos-U55 model. The steps to use the example are:
164+
- Start [Keil Studio Cloud](https://studio.keil.arm.com/) and login to the system using your
165+
account.
166+
- Drag and drop this directory (cmsis-pack-examples) into the project pane, or use the import
167+
button provided above, under [ML-examples](#ml-examples).
168+
- Select the *Active Project* from the drop-down - it should show all projects referenced in
169+
the `csolution` file.
137170
- Select *Target hardware* from the drop-down: **SSE-300 MPS3**
138-
- Click **Run project** which executes the project build step and then starts running on Arm Virtual Hardware.
171+
- Click **Run project** which executes the project build step and then starts running on Arm
172+
Virtual Hardware.
139173

140174
> **Note:** Arm Virtual Hardware models are also available on AWS Marketplace.
175+
176+
### Application output
177+
178+
Once the project can be built successfully, the execution on target hardware will show output of
179+
the application in `Output` window in Keil Studio Cloud. Currently, this includes the following:
180+
- Arm® Ethos™-U55 NPU version information
181+
- Information about model's memory allocation
182+
- Running inference on specified input
183+
- Output of inference
184+
- Simulation information such as simulated time, user time, system time, etc
185+
186+
The output is different for the two example applications:
187+
- object detection application will detect two objects on the sample input image and will
188+
present the detected bounding boxes for objects in the image.
189+
- keyword spotting application will detect a keyword in the sample audio file and will present
190+
the highest confidence score and the associated keyword label. Threshold, applied for a label
191+
to be deemed valid, is also shown
192+
193+
## Trademarks
194+
195+
- Arm® and Cortex® are registered trademarks of Arm® Limited (or its subsidiaries) in the US and/or elsewhere.
196+
- Arm® and Ethos™ are registered trademarks or trademarks of Arm® Limited (or its subsidiaries) in the US and/or
197+
elsewhere.
198+
- Arm® and Corstone™ are registered trademarks or trademarks of Arm® Limited (or its subsidiaries) in the US and/or
199+
elsewhere.
200+
- Arm®, Keil® and µVision® are registered trademarks of Arm Limited (or its subsidiaries) in the US and/or elsewhere.
201+
- TensorFlow™, the TensorFlow logo, and any related marks are trademarks of Google Inc.
202+
203+
## Licenses
204+
205+
The application samples are provided under the Apache 2.0 license, see [License](./LICENSE).
206+
207+
Application input data sample files (audio or image files) and the neural network model files have
208+
been converted into C/C++ type arrays and are distributed under Apache 2.0 license. The models have
209+
been processed by the [Vela compiler](https://pypi.org/project/ethos-u-vela/) and then converted
210+
into C/C++ arrays to be baked into the example applications.
211+
212+
| Example | Licence | Provenance |
213+
|---------------|---------|---------|
214+
| Keyword Spotting | Apache 2.0 | [micronet_medium](https://github.com/ARM-software/ML-zoo/raw/9f506fe52b39df545f0e6c5ff9223f671bc5ae00/models/keyword_spotting/micronet_medium/tflite_int8/) |
215+
| Object Detection | Apache 2.0 | [object_detection](https://github.com/emza-vs/ModelZoo/blob/v1.0/object_detection/) |

cmsis-pack-examples/kws/kws.cproject.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,11 @@ project:
3333
- +AVH-U65
3434
- file: src/main.cpp
3535

36-
misc:
37-
- Link:
38-
- --scatter=./mps3-sse-300.sct
36+
- group: Device Files
37+
files:
38+
- file: mps3-sse-300.sct
3939

40-
# Note: Should be changed to "define" later.
41-
# "For a transition period defines: is also accepted. However this will be deprecated."
42-
defines:
40+
define:
4341
- "ACTIVATION_BUF_SZ=0x00100000"
4442

4543
layers:

cmsis-pack-examples/mlek.csolution.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,13 @@ solution:
4545
- pack: tensorflow::[email protected]
4646

4747
build-types: # defines toolchain options for 'debug' and 'release'
48-
# ---------------------------------------------------------------------------------------------
49-
# Debug builds do not work with AVH deployment yet with debug flag as the size of the binary
50-
# is limited to 10MB. The additional C-CPP flag can be uncommented once this file limit has
51-
# been increased to support files sizes of up to 32MB.
52-
# ---------------------------------------------------------------------------------------------
5348
- type: Debug
5449
compiler: AC6
5550
debug: on
5651
misc:
5752
- C*:
5853
- -O0
59-
#- g
54+
- -g
6055

6156
- type: Release
6257
compiler: AC6
@@ -68,20 +63,14 @@ solution:
6863
target-types:
6964
- type: AVH-U55
7065
device: ARM::SSE-300-MPS3
71-
72-
# Note: Should be changed to "define" later.
73-
# "For a transition period defines: is also accepted. However this will be deprecated."
74-
defines:
66+
define:
7567
- "ETHOSU55"
7668

7769
# Currently Keil Studio doesn't allow to switch between targets. Uncomment when this is
7870
# fixed.
7971
# - type: AVH-U65
8072
# device: ARM::SSE-300-MPS3
81-
82-
# # Note: Should be changed to "define" later.
83-
# # "For a transition period defines: is also accepted. However this will be deprecated."
84-
# defines:
73+
# define:
8574
# - "ETHOSU65"
8675

8776
projects:

cmsis-pack-examples/object-detection/object-detection.cproject.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@ project:
3131
- +AVH-U65
3232
- file: src/main.cpp
3333

34-
misc:
35-
- Link:
36-
- --scatter=./mps3-sse-300.sct
34+
- group: Device Files
35+
files:
36+
- file: mps3-sse-300.sct
3737

38-
# Note: Should be changed to "define" later.
39-
# "For a transition period defines: is also accepted. However this will be deprecated."
40-
defines:
38+
define:
4139
- "ACTIVATION_BUF_SZ=0x00082000"
4240

4341
layers:

0 commit comments

Comments
 (0)