Skip to content

Commit

Permalink
ml-eval-kit: Update to version 23.11
Browse files Browse the repository at this point in the history
* Improved tensorflow.cmake
* Model URLs file location has changed
* Some patches have been merged upstream

Signed-off-by: Gabor Abonyi <[email protected]>
  • Loading branch information
GaborAbonyi committed Feb 6, 2024
1 parent c4b2e83 commit 80e220f
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 211 deletions.
5 changes: 2 additions & 3 deletions components/ai/ml_embedded_evaluation_kit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ include(ApplyPatches)
set(PATCH_FILES_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/integration/patches")
set(PATCH_FILES
"${PATCH_FILES_DIRECTORY}/0001-resources-Replace-model-wav2letter-with-tiny_wav2let.patch"
"${PATCH_FILES_DIRECTORY}/0002-toolchain-Fix-Arm-GNU-Toolchain-13.2-Rel1-compatibil.patch"
"${PATCH_FILES_DIRECTORY}/0003-Use-CMSIS_device_header-instead-of-RTE_Components.h.patch"
"${PATCH_FILES_DIRECTORY}/0004-Fix-tensorflow.cmake-env-var-escape.patch"
"${PATCH_FILES_DIRECTORY}/0002-Use-CMSIS_device_header-instead-of-RTE_Components.h.patch"
)
iot_reference_arm_corstone3xx_apply_patches("${ml_embedded_evaluation_kit_SOURCE_DIR}" "${PATCH_FILES}")

set(TF_PATCH_FILES
"${PATCH_FILES_DIRECTORY}/0001-tensorflow-kiss_fft_wrapper-include-fix.patch"
)

iot_reference_arm_corstone3xx_apply_patches("${ml_embedded_evaluation_kit_SOURCE_DIR}/dependencies/tensorflow" "${TF_PATCH_FILES}")
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,10 @@ function(assert_defined var_name)
endif()
endfunction()

# Note: tensorflow.cmake modifies these variables. Save the current values and restore after.
set(TEMP_CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})
# Preserve the content of `ETHOS_U_NPU_ID` before including
# the `tensorflow.cmake` CMake module which overrides it.
set(TEMP_ETHOS_U_NPU_ID ${ETHOS_U_NPU_ID})
# Note: tensorflow.cmake only has support up to cortex-m55.
set(CMAKE_SYSTEM_PROCESSOR "cortex-m55")
include(${CMAKE_SCRIPTS_DIR}/tensorflow.cmake)
# Note: tensorflow.cmake variable restoration.
set(CMAKE_SYSTEM_PROCESSOR ${TEMP_CMAKE_SYSTEM_PROCESSOR})
set(ETHOS_U_NPU_ID ${TEMP_ETHOS_U_NPU_ID})

# Manually add libs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,101 +1,66 @@
From e691803e130d1aced38c21e98c41ce40bda44ffe Mon Sep 17 00:00:00 2001
From: Hugues Kamba-Mpiana <hugues.kambampiana@arm.com>
Date: Tue, 19 Dec 2023 14:09:27 +0000
Subject: [PATCH 1/4] resources: Replace model wav2letter with tiny_wav2letter
From 202176ddd60d709372bd4dd05fd5d6490fc2559e Mon Sep 17 00:00:00 2001
From: Gabor Abonyi <gabor.abonyi@arm.com>
Date: Mon, 22 Jan 2024 14:55:03 +0100
Subject: [PATCH 1/2] resources: Replace model wav2letter with tiny_wav2letter

`wav2letter` model needs singificant amount of memory (around 14Mb),
where as `tiny_wav2letter` needs around 4Mb.
Update the location of the resource where referenced for
the `asr` and `kws` use cases.
the `asr` and `kws_asr` use cases.

Signed-off-by: Hugues Kamba-Mpiana <hugues.kambampiana@arm.com>
Signed-off-by: Gabor Abonyi <gabor.abonyi@arm.com>
---
set_up_default_resources.py | 16 ++++++++--------
source/use_case/asr/usecase.cmake | 4 ++--
source/use_case/kws_asr/usecase.cmake | 4 ++--
3 files changed, 12 insertions(+), 12 deletions(-)
scripts/py/use_case_resources.json | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/set_up_default_resources.py b/set_up_default_resources.py
index b442432..2cb987d 100755
--- a/set_up_default_resources.py
+++ b/set_up_default_resources.py
@@ -51,16 +51,16 @@ json_uc_res = [
{
"use_case_name": "asr",
"url_prefix": [
- "https://github.com/ARM-software/ML-zoo/raw/1a92aa08c0de49a7304e0a7f3f59df6f4fd33ac8/models/speech_recognition/wav2letter/tflite_pruned_int8/"
+ "https://github.com/ARM-software/ML-zoo/raw/eb2170aac1317f00b128ab82bdb159cfcca36ea6/models/speech_recognition/tiny_wav2letter/tflite_pruned_int8/"
],
"resources": [
{
- "name": "wav2letter_pruned_int8.tflite",
- "url": "{url_prefix:0}wav2letter_pruned_int8.tflite",
+ "name": "tiny_wav2letter_pruned_int8.tflite",
+ "url": "{url_prefix:0}tiny_wav2letter_pruned_int8.tflite",
},
{
"name": "ifm0.npy",
- "url": "{url_prefix:0}testing_input/input_2_int8/0.npy",
+ "url": "{url_prefix:0}testing_input/input_1_int8/0.npy",
},
{
"name": "ofm0.npy",
@@ -131,18 +131,18 @@ json_uc_res = [
{
"use_case_name": "kws_asr",
"url_prefix": [
- "https://github.com/ARM-software/ML-zoo/raw/1a92aa08c0de49a7304e0a7f3f59df6f4fd33ac8/models/speech_recognition/wav2letter/tflite_pruned_int8/",
+ "https://github.com/ARM-software/ML-zoo/raw/eb2170aac1317f00b128ab82bdb159cfcca36ea6/models/speech_recognition/tiny_wav2letter/tflite_pruned_int8/",
"https://github.com/ARM-software/ML-zoo/raw/9f506fe52b39df545f0e6c5ff9223f671bc5ae00/models/keyword_spotting/micronet_medium/tflite_int8/",
],
"resources": [
{
- "name": "wav2letter_pruned_int8.tflite",
- "url": "{url_prefix:0}wav2letter_pruned_int8.tflite",
+ "name": "tiny_wav2letter_pruned_int8.tflite",
+ "url": "{url_prefix:0}tiny_wav2letter_pruned_int8.tflite",
},
{
"sub_folder": "asr",
"name": "ifm0.npy",
- "url": "{url_prefix:0}testing_input/input_2_int8/0.npy",
+ "url": "{url_prefix:0}testing_input/input_1_int8/0.npy",
},
{
"sub_folder": "asr",
diff --git a/source/use_case/asr/usecase.cmake b/source/use_case/asr/usecase.cmake
index fc3f2b5..3ce2c0a 100644
--- a/source/use_case/asr/usecase.cmake
+++ b/source/use_case/asr/usecase.cmake
@@ -75,9 +75,9 @@ USER_OPTION(${use_case}_ACTIVATION_BUF_SZ "Activation buffer size for the chosen
STRING)

if (ETHOS_U_NPU_ENABLED)
- set(DEFAULT_MODEL_PATH ${DEFAULT_MODEL_DIR}/wav2letter_pruned_int8_vela_${ETHOS_U_NPU_CONFIG_ID}.tflite)
+ set(DEFAULT_MODEL_PATH ${DEFAULT_MODEL_DIR}/tiny_wav2letter_pruned_int8_vela_${ETHOS_U_NPU_CONFIG_ID}.tflite)
else()
- set(DEFAULT_MODEL_PATH ${DEFAULT_MODEL_DIR}/wav2letter_pruned_int8.tflite)
+ set(DEFAULT_MODEL_PATH ${DEFAULT_MODEL_DIR}/tiny_wav2letter_pruned_int8.tflite)
endif()

set(EXTRA_MODEL_CODE
diff --git a/source/use_case/kws_asr/usecase.cmake b/source/use_case/kws_asr/usecase.cmake
index de84bfd..9bfbbd0 100644
--- a/source/use_case/kws_asr/usecase.cmake
+++ b/source/use_case/kws_asr/usecase.cmake
@@ -68,10 +68,10 @@ USER_OPTION(${use_case}_MODEL_SCORE_THRESHOLD_ASR "Specify the score threshold [

if (ETHOS_U_NPU_ENABLED)
set(DEFAULT_MODEL_PATH_KWS ${DEFAULT_MODEL_DIR}/kws_micronet_m_vela_${ETHOS_U_NPU_CONFIG_ID}.tflite)
- set(DEFAULT_MODEL_PATH_ASR ${DEFAULT_MODEL_DIR}/wav2letter_pruned_int8_vela_${ETHOS_U_NPU_CONFIG_ID}.tflite)
+ set(DEFAULT_MODEL_PATH_ASR ${DEFAULT_MODEL_DIR}/tiny_wav2letter_pruned_int8_vela_${ETHOS_U_NPU_CONFIG_ID}.tflite)
else()
set(DEFAULT_MODEL_PATH_KWS ${DEFAULT_MODEL_DIR}/kws_micronet_m.tflite)
- set(DEFAULT_MODEL_PATH_ASR ${DEFAULT_MODEL_DIR}/wav2letter_pruned_int8.tflite)
+ set(DEFAULT_MODEL_PATH_ASR ${DEFAULT_MODEL_DIR}/tiny_wav2letter_pruned_int8.tflite)
endif()

USER_OPTION(${use_case}_MODEL_TFLITE_PATH_KWS "NN models file to be used for KWS in the evaluation application. Model files must be in tflite format."
diff --git a/scripts/py/use_case_resources.json b/scripts/py/use_case_resources.json
index 80fa28d..9e50fb6 100644
--- a/scripts/py/use_case_resources.json
+++ b/scripts/py/use_case_resources.json
@@ -16,16 +16,16 @@
{
"name": "asr",
"url_prefix": [
- "https://github.com/ARM-software/ML-zoo/raw/1a92aa08c0de49a7304e0a7f3f59df6f4fd33ac8/models/speech_recognition/wav2letter/tflite_pruned_int8/"
+ "https://github.com/ARM-software/ML-zoo/raw/eb2170aac1317f00b128ab82bdb159cfcca36ea6/models/speech_recognition/tiny_wav2letter/tflite_pruned_int8/"
],
"resources": [
{
- "name": "wav2letter_pruned_int8.tflite",
- "url": "{url_prefix:0}wav2letter_pruned_int8.tflite"
+ "name": "tiny_wav2letter_pruned_int8.tflite",
+ "url": "{url_prefix:0}tiny_wav2letter_pruned_int8.tflite"
},
{
"name": "ifm0.npy",
- "url": "{url_prefix:0}testing_input/input_2_int8/0.npy"
+ "url": "{url_prefix:0}testing_input/input_1_int8/0.npy"
},
{
"name": "ofm0.npy",
@@ -96,18 +96,18 @@
{
"name": "kws_asr",
"url_prefix": [
- "https://github.com/ARM-software/ML-zoo/raw/1a92aa08c0de49a7304e0a7f3f59df6f4fd33ac8/models/speech_recognition/wav2letter/tflite_pruned_int8/",
+ "https://github.com/ARM-software/ML-zoo/raw/eb2170aac1317f00b128ab82bdb159cfcca36ea6/models/speech_recognition/tiny_wav2letter/tflite_pruned_int8/",
"https://github.com/ARM-software/ML-zoo/raw/9f506fe52b39df545f0e6c5ff9223f671bc5ae00/models/keyword_spotting/micronet_medium/tflite_int8/"
],
"resources": [
{
- "name": "wav2letter_pruned_int8.tflite",
- "url": "{url_prefix:0}wav2letter_pruned_int8.tflite"
+ "name": "tiny_wav2letter_pruned_int8.tflite",
+ "url": "{url_prefix:0}tiny_wav2letter_pruned_int8.tflite"
},
{
"sub_folder": "asr",
"name": "ifm0.npy",
- "url": "{url_prefix:0}testing_input/input_2_int8/0.npy"
+ "url": "{url_prefix:0}testing_input/input_1_int8/0.npy"
},
{
"sub_folder": "asr",
--
2.40.1

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 75e29cf7fd59978d06d8594efd2c883c40cd56e1 Mon Sep 17 00:00:00 2001
From ba95da37dcc0b41a14e7c8bc1ea707e0b1d99a79 Mon Sep 17 00:00:00 2001
From: Gabor Abonyi <[email protected]>
Date: Tue, 16 Jan 2024 14:48:44 +0100
Subject: [PATCH 3/4] Use CMSIS_device_header instead of RTE_Components.h
Subject: [PATCH 2/2] Use CMSIS_device_header instead of RTE_Components.h

Signed-off-by: Gabor Abonyi <[email protected]>
---
Expand Down

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion components/ai/ml_embedded_evaluation_kit/library
Submodule library updated from f1b28b to c56eed
2 changes: 1 addition & 1 deletion manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ dependencies:
path: "components/connectivity/freertos_plus_tcp/library"
- name: "ml-embedded-evaluation-kit"
license: "Apache-2.0"
version: "f1b28b861e301122b85ad7dc3d8ccb0720fcb584"
version: "23.11"
repository:
type: "git"
url: "https://review.mlplatform.org/ml/ethos-u/ml-embedded-evaluation-kit.git"
Expand Down
1 change: 1 addition & 0 deletions release_changes/202401191520.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ml-eval-kit: Update to version 23.11

0 comments on commit 80e220f

Please sign in to comment.