Skip to content

Commit f8e0860

Browse files
committed
doc: Update Edge Impulse documentation with Axon deployment
Jira: NCSDK-37145 Signed-off-by: Bartosz Meus <bartosz.meus@nordicsemi.no>
1 parent e868ee0 commit f8e0860

9 files changed

Lines changed: 179 additions & 76 deletions

File tree

doc/integrations/edge_impulse.rst

Lines changed: 159 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,39 @@ Preparing the machine learning model
7272

7373
.. group-tab:: Using |EIS| web interface
7474

75-
a. Go to the :guilabel:`Deployment` tab and select :guilabel:`Zephyr library`.
76-
This will generate a :file:`zip` file that contains source files defining the |EI| ML model.
75+
.. tabs::
7776

78-
.. figure:: ./images/ei_deploy.png
79-
:scale: 50 %
80-
:alt: Model deployment in |EIS| dashboard
77+
.. group-tab:: Model executed on CPU
8178

82-
Model deployment in |EIS| dashboard
79+
a. Go to the :guilabel:`Deployment` tab and select :guilabel:`Zephyr library`.
80+
This will generate a :file:`zip` file that contains source files defining the |EI| ML model for execution on CPU.
8381

84-
.. note::
85-
Edge Impulse supports multiple deployment formats, some of which are compatible with |NCS| applications.
86-
However, this instruction focuses on the Zephyr library deployment format.
82+
.. figure:: ./images/ei_deploy_cpu.png
83+
:scale: 50 %
84+
:alt: CPU model deployment in |EIS| dashboard
85+
86+
CPU model deployment in |EIS| dashboard
87+
88+
.. group-tab:: Model executed on Axon NPU
89+
90+
a. Go to the :guilabel:`Deployment` tab and select :guilabel:`Nordic Axon NPU Library`.
91+
This will generate a :file:`zip` file that contains source files defining the |EI| ML model for Axon NPU.
92+
93+
.. figure:: ./images/ei_deploy_axon.png
94+
:scale: 50 %
95+
:alt: Axon NPU model deployment in |EIS| dashboard
96+
97+
Axon NPU model deployment in |EIS| dashboard
98+
99+
.. note::
100+
|EI| supports multiple deployment formats, some of which are compatible with |NCS| applications.
101+
However, this instruction focuses on the `Zephyr library` and `Nordic Axon NPU Library` deployment formats.
87102

88103
.. group-tab:: Using |EI| west extensions
89104

105+
.. note::
106+
This method currently does not allow deploying Axon NPU models.
107+
90108
|EI| provides west command extensions that let you build and deploy the machine learning model from |EIS| using the command line instead of the web interface.
91109
The commands are already configured in the |EAI| west manifest and are ready to use.
92110

@@ -126,57 +144,158 @@ Preparing the machine learning model
126144

127145
.. _ug_edge_impulse_adding_building:
128146

129-
.. rst-class:: numbered-step
130-
131147
Building an application with machine learning model
132148
===================================================
133149

134150
You have to complete the following configuration steps to be able to build your application including the deployed |EI| machine learning model:
135151

136-
1. Make sure that the following Kconfig options are enabled:
152+
.. tabs::
153+
154+
.. group-tab:: Model executed on CPU
155+
156+
1. Make sure that the following Kconfig options are enabled:
157+
158+
* ``CONFIG_CPP``
159+
* ``CONFIG_STD_CPP11``
160+
* ``CONFIG_REQUIRES_FULL_LIBCPP``
161+
* ``CONFIG_EDGE_IMPULSE_SDK``
162+
163+
.. note::
164+
The ``CONFIG_FPU`` Kconfig option is implied by default if floating point unit (FPU) is supported by the hardware.
165+
Using FPU speeds up calculations.
166+
167+
#. Make sure that the ``CONFIG_FP16`` Kconfig option is disabled.
168+
The |EI| library is not compatible with half-precision floating point support introduced in Zephyr.
169+
170+
#. If you want to call |EI| API directly from C code, you must define the following macros in your application's :file:`CMakeLists.txt` file:
171+
172+
.. code-block:: cmake
173+
174+
zephyr_compile_definitions(
175+
EI_C_LINKAGE=1
176+
EIDSP_SIGNAL_C_FN_POINTER=1
177+
)
178+
179+
Check `Using the library from C`_ for more information.
180+
181+
#. Unpack the :file:`zip` archive with the deployed machine learning model and add the following to your application's :file:`CMakeLists.txt` file:
182+
183+
.. code-block:: cmake
184+
185+
add_subdirectory(ei_model)
186+
187+
Alternatively, you can automate the unpacking as part of the build process using CMake's ``FetchContent`` module.
188+
This approach automatically extracts the archive during configuration:
189+
190+
.. code-block:: cmake
191+
192+
include(FetchContent)
193+
194+
FetchContent_Declare(
195+
ei_model
196+
URL ${CMAKE_CURRENT_SOURCE_DIR}/ei_model.zip
197+
)
198+
199+
FetchContent_MakeAvailable(ei_model)
200+
201+
.. group-tab:: Model executed on Axon NPU
202+
203+
1. Make sure that the following Kconfig options are enabled:
204+
205+
* ``CONFIG_CPP``
206+
* ``CONFIG_STD_CPP11``
207+
* ``CONFIG_REQUIRES_FULL_LIBCPP``
208+
* ``CONFIG_EDGE_IMPULSE_SDK``
209+
* ``CONFIG_NRF_AXON``
210+
211+
#. Make sure that the ``CONFIG_FP16`` Kconfig option is disabled.
212+
The |EI| library is not compatible with half-precision floating point support introduced in Zephyr.
213+
214+
#. If you want to call |EI| API directly from C code, you must define the following macros in your application's :file:`CMakeLists.txt` file:
215+
216+
.. code-block:: cmake
217+
218+
zephyr_compile_definitions(
219+
EI_C_LINKAGE=1
220+
EIDSP_SIGNAL_C_FN_POINTER=1
221+
)
222+
223+
Check `Using the library from C`_ for more information.
224+
225+
#. Unpack the :file:`zip` archive with the deployed machine learning model and add the following to your application's :file:`CMakeLists.txt` file:
226+
227+
.. code-block:: cmake
228+
229+
add_subdirectory(ei_model)
230+
231+
Alternatively, you can automate the unpacking as part of the build process using CMake's ``FetchContent`` module.
232+
This approach automatically extracts the archive during configuration:
233+
234+
.. code-block:: cmake
235+
236+
include(FetchContent)
237+
238+
FetchContent_Declare(
239+
ei_model
240+
URL ${CMAKE_CURRENT_SOURCE_DIR}/ei_model.zip
241+
)
242+
243+
FetchContent_MakeAvailable(ei_model)
244+
245+
#. Set ``CONFIG_NRF_AXON_MODEL_NAME`` Kconfig option to the name of your model.
246+
You can find it for example in:
247+
248+
* :file:`conf_overlay.conf` file included in the :file:`zip` archive with the deployed model, for example:
249+
250+
.. code-block:: console
251+
252+
cat ei_model/conf_overlay.conf
253+
CONFIG_NRF_AXON_MODEL_NAME="ei_model_nrf_accel_sim_54"
254+
255+
* the names of the Axon model header files included in the archive.
256+
For example:
137257

138-
* ``CONFIG_CPP``
139-
* ``CONFIG_STD_CPP11``
140-
* ``CONFIG_REQUIRES_FULL_LIBCPP``
141-
* ``CONFIG_EDGE_IMPULSE_SDK``
258+
.. code-block:: console
142259
143-
.. note::
144-
The ``CONFIG_FPU`` Kconfig option is implied by default if floating point unit (FPU) is supported by the hardware.
145-
Using FPU speeds up calculations.
260+
ls nordic-axon-model/nrf_axon_model_*.h
261+
nordic-axon-model/nrf_axon_model_ei_model_nrf_accel_sim_54_.h
262+
nordic-axon-model/nrf_axon_model_ei_model_nrf_accel_sim_54_layers_.h
263+
nordic-axon-model/nrf_axon_model_ei_model_nrf_accel_sim_54_test_vectors_.h
146264
147-
#. Make sure that the ``CONFIG_FP16`` Kconfig option is disabled.
148-
The |EI| library is not compatible with half-precision floating point support introduced in Zephyr.
265+
means that the model name is ``ei_model_nrf_accel_sim_54``.
149266

150-
#. If you want to call |EI| API directly from C code, you must define the following macros in your application's :file:`CMakeLists.txt` file:
267+
#. Set ``CONFIG_NRF_AXON_INTERLAYER_BUFFER_SIZE`` and ``CONFIG_NRF_AXON_PSUM_BUFFER_SIZE`` appropriately, to fit your model's requirements.
268+
If the buffers are too small, the inference will fail with an error indicating insufficient buffer size and the required size, for example:
151269

152-
.. code-block:: cmake
270+
.. code-block:: console
153271
154-
zephyr_compile_definitions(
155-
EI_C_LINKAGE=1
156-
EIDSP_SIGNAL_C_FN_POINTER=1
157-
)
272+
init model ei_model_nrf_accel_sim_54 failed! interlayer buffer too small! Allocated 0, need 36
273+
ERR: nrf_axon_nn_model_validate failed!
274+
E: Classification failed with error code: -36
158275
159-
Check `Using the library from C`_ for more information.
276+
You can also find the required buffer sizes:
160277

161-
#. Unpack the :file:`zip` archive with the deployed machine learning model and add the following to your application's :file:`CMakeLists.txt` file:
278+
* in the console output from testing model in |EIS|, when deploying the model:
162279

163-
.. code-block:: cmake
280+
.. code-block:: console
164281
165-
add_subdirectory(ei_model)
282+
-------------------------------------------------------------------------------
283+
Model EI_MODEL_NRF_ACCEL_SIM_54 results (variant : ei_model_nrf_accel_sim_54)
284+
-------------------------------------------------------------------------------
166285
167-
Alternatively, you can automate the unpacking as part of the build process using CMake's ``FetchContent`` module.
168-
This approach automatically extracts the archive during configuration:
286+
Memory Usage (in bytes)
169287
170-
.. code-block:: cmake
288+
model_const_buffer_size: 1024
289+
interlayer_buffer_size: 36
290+
psum_buffer_size: 0
291+
cmd_buffer_size: 736
171292
172-
include(FetchContent)
293+
* in the :file:`zip` archive with the deployed model, in the :file:`nrf_axon_model_<model_name>_.h` file, for example:
173294

174-
FetchContent_Declare(
175-
ei_model
176-
URL ${CMAKE_CURRENT_SOURCE_DIR}/ei_model.zip
177-
)
295+
.. code-block:: c
178296
179-
FetchContent_MakeAvailable(ei_model)
297+
#define NRF_AXON_MODEL_EI_MODEL_NRF_ACCEL_SIM_54_MAX_IL_BUFFER_USED 36
298+
#define NRF_AXON_MODEL_EI_MODEL_NRF_ACCEL_SIM_54_MAX_PSUM_BUFFER_USED 0
180299
181300
.. _ug_edge_impulse_building:
182301

-248 KB
Binary file not shown.
243 KB
Loading
255 KB
Loading

doc/quick_start.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ These workflows rely on integrated toolchains and APIs to reduce setup effort:
2727
Use it for easy setup, standardized workflow, and the best Nordic Semiconductor device compatibility.
2828
* :ref:`quick_start_edge_impulse` - Use the Edge Impulse platform for an end-to-end machine learning solution.
2929
It includes visual development tools, extensive documentation, and community support.
30+
Models run on CPU or on the Axon NPU depending on the target device you select.
3031
Use this option if you already work with Edge Impulse or require its tooling ecosystem.
3132

3233
.. toctree::
@@ -45,13 +46,9 @@ These workflows require more manual configuration but allow finer control over p
4546
* :ref:`quick_start_axon_driver` - Work directly with the Axon NPU driver API for maximum control, performance and low energy consumption.
4647
Compile TensorFlow Lite models and implement custom inference pipelines.
4748
Use this option for advanced optimization and direct NPU control.
48-
* :ref:`quick_start_axon_edge_impulse` - Combine Edge Impulse's user-friendly platform with Axon NPU hardware acceleration.
49-
Use Edge Impulse SDK while benefiting from NPU performance on compatible devices.
50-
Use this option if you want to keep the Edge Impulse workflow while targeting Axon hardware.
5149

5250
.. toctree::
5351
:maxdepth: 1
5452
:hidden:
5553

56-
quick_start/axon_driver
57-
quick_start/axon_edge_impulse
54+
quick_start/axon_driver

doc/quick_start/axon_driver.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Compared to higher‑level frameworks such as |EAILib|, using the driver API req
1515

1616
After completing this guide, you will have compiled a TensorFlow Lite model for the Axon NPU and deployed a custom application that performs inference using the Axon driver API.
1717

18+
.. _quick_start_axon_driver_model_compilation:
19+
1820
Model compilation
1921
*****************
2022

@@ -49,6 +51,8 @@ Test your compiled model to ensure it works correctly before integrating it into
4951
Run :ref:`test_nn_inference` to confirm your compiled model produces correct results.
5052
This validation step checks for compilation issues early in the development process.
5153

54+
.. _quick_start_axon_driver_app_development:
55+
5256
Application development
5357
***********************
5458

doc/quick_start/axon_edge_impulse.rst

Lines changed: 0 additions & 26 deletions
This file was deleted.

doc/quick_start/edge_impulse.rst

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ Edge Impulse
1010
The following guide explains how to develop and deploy machine learning applications on Nordic Semiconductor devices using |EI|.
1111
It is ideal if you want an end‑to‑end workflow for data collection, model training, and deployment on embedded targets.
1212

13+
|EI| models can run on CPU or on the `Axon NPU`_, depending on the target device you select during the deployment process.
14+
On devices equipped with the Axon NPU, |EI| automatically leverages hardware acceleration for supported operations, resulting in faster inference and lower power consumption.
15+
On devices without the NPU, the same model runs in software on the CPU.
16+
1317
To follow this guide, you should be familiar with basic embedded systems development.
1418
The guide covers the steps required to collect data, train a model using Edge Impulse tools, and deploy the resulting model to a Nordic device.
1519

@@ -55,7 +59,7 @@ Choose the method that works best for your project:
5559
* For image data, aim for 50-100 images per class as a starting point, with good variety in lighting, angles, and backgrounds.
5660
* For all data types, prioritize dataset diversity and balance the number of samples across classes to improve model performance.
5761

58-
For more details on data collection strategies, follow the `Edge Impulse data acquisition` guide.
62+
For more details on data collection strategies, follow the `Edge Impulse data acquisition`_ guide.
5963

6064
.. rst-class:: numbered-step
6165

@@ -72,6 +76,11 @@ Train and deploy your model using `Edge Impulse studio`_:
7276

7377
Your model is now trained and ready for deployment on Nordic devices.
7478

79+
Next steps
80+
==========
81+
82+
* If you use Axon and need lower‑level access to the NPU beyond what |EI| provides, see :ref:`quick_start_axon_driver_model_compilation` to learn how to compile custom TensorFlow Lite models for Axon.
83+
7584
Application development
7685
***********************
7786

@@ -109,7 +118,7 @@ The |EI| SDK makes it easy to load your model, feed it sensor data, and get pred
109118
* Read the `Edge Impulse C++ SDK`_ documentation for comprehensive API reference and advanced features.
110119

111120
.. tip::
112-
Start with one of the sample applications and modify it incrementally.
121+
Start with one of the sample applications and modify it incrementally.
113122
This will help you understand the API structure before building your custom application from scratch.
114123

115124
.. rst-class:: numbered-step
@@ -128,5 +137,5 @@ Next steps
128137

129138
To work on advanced solutions, see further documentation:
130139

131-
* Accelerate with Axon NPU - If you have a device with `Axon NPU`_, see :ref:`quick_start_axon_edge_impulse` to learn how to combine |EI| with Axon hardware acceleration for significantly faster inference times.
132140
* Explore advanced features - Dive deeper into the `Edge Impulse C++ SDK`_ documentation to discover advanced capabilities like anomaly detection, continuous learning, and custom processing blocks.
141+
* Direct Axon NPU control - If you use Axon and need lower‑level access to the NPU beyond what |EI| provides, see :ref:`quick_start_axon_driver_app_development` to learn how to implement custom inference pipelines with the Axon driver API.

doc/release_notes_and_migration/release_notes_latest.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ This release is based on the |NCS| release v3.2.0.
2020
* Added:
2121

2222
* :ref:`Hello Axon sample application <sample_hello_axon>`, along with documentation, demonstrating how to run neural model inference on the Axon NPU using the Axon NPU driver.
23-
* :ref:`Hello Edge Impulse sample application <hello_ei_sample>` demonstrating neural network inference using an |EI| machine learning model on the CPU.
23+
* :ref:`Hello Edge Impulse sample application <hello_ei_sample>` demonstrating neural network inference using an |EI| machine learning model on the CPU and the Axon NPU.
2424
* :ref:`Data forwarder sample application <ei_data_forwarder_sample>` demonstrating how to forward sensor data to |EIS|.
2525
* :ref:`Documentation for the Edge Impulse integration <edge_impulse_integration>`, with instructions for preparing and deploying |EI| machine learning models and using them in |EAI| applications.
26-
* Edge Impulse SDK v1.82.3 integrated into the |EAI| west manifest.
26+
* Edge Impulse SDK v1.88.1 integrated into the |EAI| west manifest.
2727
* :ref:`Documentation for setting up the environment <setting_up_environment>`, depending on |EAI| use case.

0 commit comments

Comments
 (0)