summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEanna O Cathain <eanna.ocathain@arm.com>2022-09-22 15:18:34 +0100
committerEanna O Cathain <eanna.ocathain@arm.com>2022-09-26 10:16:25 +0100
commit4c0ac91ef2b052eb57328b85edcb0071cb7558b2 (patch)
treebe057efcc32bd329ccce8f446a7213d923ee6761
parent27c5e3091ab3d5f6efd6407f0a44531e717ccd69 (diff)
downloadml-embedded-evaluation-kit-4c0ac91ef2b052eb57328b85edcb0071cb7558b2.tar.gz
MLECO-3254 Default to using only one file per UC
Signed-off-by: Eanna O Cathain <eanna.ocathain@arm.com> Change-Id: I4a1cd2b5746cb479ae0d81ed973961cec2f3046e
-rw-r--r--docs/sections/building.md11
-rw-r--r--scripts/cmake/common_user_options.cmake4
-rw-r--r--scripts/cmake/util_functions.cmake14
-rw-r--r--source/use_case/ad/usecase.cmake4
-rw-r--r--source/use_case/asr/usecase.cmake4
-rw-r--r--source/use_case/img_class/usecase.cmake4
-rw-r--r--source/use_case/kws/usecase.cmake4
-rw-r--r--source/use_case/kws_asr/usecase.cmake4
-rw-r--r--source/use_case/noise_reduction/usecase.cmake4
-rw-r--r--source/use_case/object_detection/usecase.cmake4
-rw-r--r--source/use_case/vww/usecase.cmake4
11 files changed, 37 insertions, 24 deletions
diff --git a/docs/sections/building.md b/docs/sections/building.md
index de78dce..bd6ae43 100644
--- a/docs/sections/building.md
+++ b/docs/sections/building.md
@@ -268,6 +268,9 @@ The build parameters are:
- `TENSORFLOW_LITE_MICRO_CLEAN_DOWNLOADS`: Optional parameter to enable wiping out `TPIP` downloads from TensorFlow
source tree prior to each build. Disabled by default.
+- `USE_SINGLE_INPUT`: Sets whether each use case will use a single default input file, or if a user menu is
+provided for the user to select which input file to use via a telnet window. Disabled by default.
+
For details on the specific use-case build options, follow the instructions in the use-case specific documentation.
Also, when setting any of the CMake configuration parameters that expect a directory, or file, path, **use absolute
@@ -457,6 +460,14 @@ cmake .. \
-DCMAKE_BUILD_TYPE=Debug
```
+#### Configuring to use default input data
+
+To configure the project to use default input data for each use case, you can use the following CMake option `USE_SINGLE_INPUT`.
+This will be set to `false` if not specified. Specifying it as `true` will result in each use case automatically running with predefined input data, thus removing the need for the user to use a telnet terminal to specify the input data. For Example:
+
+```commandline
+cmake ../ -DCMAKE_TOOLCHAIN_FILE=scripts/cmake/toolchains/bare-metal-armclang.cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_SINGLE_INPUT=True
+```
#### Generating project for Arm Development Studio
To import the project into Arm Development Studio, add the Eclipse project generator and `CMAKE_ECLIPSE_VERSION` in the
diff --git a/scripts/cmake/common_user_options.cmake b/scripts/cmake/common_user_options.cmake
index 36426a8..7a0b068 100644
--- a/scripts/cmake/common_user_options.cmake
+++ b/scripts/cmake/common_user_options.cmake
@@ -77,6 +77,10 @@ USER_OPTION(TENSORFLOW_LITE_MICRO_CLEAN_BUILD "Select if clean target should be
ON
BOOL)
+USER_OPTION(USE_SINGLE_INPUT "Select if a use case should execute using a default known input file"
+ OFF
+ BOOL)
+
if (NOT TARGET_PLATFORM STREQUAL native)
USER_OPTION(CMSIS_SRC_PATH
diff --git a/scripts/cmake/util_functions.cmake b/scripts/cmake/util_functions.cmake
index 25f9731..9aa19b9 100644
--- a/scripts/cmake/util_functions.cmake
+++ b/scripts/cmake/util_functions.cmake
@@ -212,3 +212,17 @@ function(check_update_public_resources resource_downloaded_dir)
endif ()
endfunction()
+
+function(set_input_file_path_user_option file_extension use_case)
+ if(NOT USE_SINGLE_INPUT)
+ USER_OPTION(${use_case}_FILE_PATH "Directory with custom input files, or path to a single input file, to use in the evaluation application."
+ ${CMAKE_CURRENT_SOURCE_DIR}/resources/${use_case}/samples/
+ PATH_OR_FILE)
+ else()
+ file(GLOB_RECURSE INPUTS ${CMAKE_CURRENT_SOURCE_DIR}/resources/${use_case}/samples/*${file_extension})
+ list (GET INPUTS 0 FIRST_INPUT_FILE)
+ USER_OPTION(${use_case}_FILE_PATH "Directory with custom input files, or path to a single input file, to use in the evaluation application."
+ ${FIRST_INPUT_FILE}
+ PATH_OR_FILE)
+ endif()
+endfunction() \ No newline at end of file
diff --git a/source/use_case/ad/usecase.cmake b/source/use_case/ad/usecase.cmake
index d19820d..525b2f4 100644
--- a/source/use_case/ad/usecase.cmake
+++ b/source/use_case/ad/usecase.cmake
@@ -18,9 +18,7 @@
# Append the API to use for this use case
list(APPEND ${use_case}_API_LIST "ad")
-USER_OPTION(${use_case}_FILE_PATH "Directory with custom WAV input files, or path to a single input WAV file, to use in the evaluation application."
- ${CMAKE_CURRENT_SOURCE_DIR}/resources/${use_case}/samples/
- PATH_OR_FILE)
+set_input_file_path_user_option(".wav" ${use_case})
USER_OPTION(${use_case}_AUDIO_RATE "Specify the target sampling rate. Default is 16000."
16000
diff --git a/source/use_case/asr/usecase.cmake b/source/use_case/asr/usecase.cmake
index 2a2178b..e0baca3 100644
--- a/source/use_case/asr/usecase.cmake
+++ b/source/use_case/asr/usecase.cmake
@@ -17,9 +17,7 @@
# Append the API to use for this use case
list(APPEND ${use_case}_API_LIST "asr")
-USER_OPTION(${use_case}_FILE_PATH "Directory with custom WAV input files, or path to a single WAV file, to use in the evaluation application."
- ${CMAKE_CURRENT_SOURCE_DIR}/resources/${use_case}/samples/
- PATH_OR_FILE)
+set_input_file_path_user_option(".wav" ${use_case})
USER_OPTION(${use_case}_LABELS_TXT_FILE "Labels' txt file for the chosen model."
${CMAKE_CURRENT_SOURCE_DIR}/resources/${use_case}/labels/labels_wav2letter.txt
diff --git a/source/use_case/img_class/usecase.cmake b/source/use_case/img_class/usecase.cmake
index e0b6bc8..fc807d2 100644
--- a/source/use_case/img_class/usecase.cmake
+++ b/source/use_case/img_class/usecase.cmake
@@ -17,9 +17,7 @@
# Append the API to use for this use case
list(APPEND ${use_case}_API_LIST "img_class")
-USER_OPTION(${use_case}_FILE_PATH "Directory with custom image files to use, or path to a single image, in the evaluation application"
- ${CMAKE_CURRENT_SOURCE_DIR}/resources/${use_case}/samples/
- PATH_OR_FILE)
+set_input_file_path_user_option(".bmp" ${use_case})
USER_OPTION(${use_case}_IMAGE_SIZE "Square image size in pixels. Images will be resized to this size."
224
diff --git a/source/use_case/kws/usecase.cmake b/source/use_case/kws/usecase.cmake
index d9985c7..7bac230 100644
--- a/source/use_case/kws/usecase.cmake
+++ b/source/use_case/kws/usecase.cmake
@@ -17,9 +17,7 @@
# Append the API to use for this use case
list(APPEND ${use_case}_API_LIST "kws")
-USER_OPTION(${use_case}_FILE_PATH "Directory with custom WAV input files, or path to a single WAV file, to use in the evaluation application."
- ${CMAKE_CURRENT_SOURCE_DIR}/resources/${use_case}/samples/
- PATH_OR_FILE)
+set_input_file_path_user_option(".wav" ${use_case})
USER_OPTION(${use_case}_LABELS_TXT_FILE "Labels' txt file for the chosen model."
${CMAKE_CURRENT_SOURCE_DIR}/resources/${use_case}/labels/micronet_kws_labels.txt
diff --git a/source/use_case/kws_asr/usecase.cmake b/source/use_case/kws_asr/usecase.cmake
index 59ef450..204962b 100644
--- a/source/use_case/kws_asr/usecase.cmake
+++ b/source/use_case/kws_asr/usecase.cmake
@@ -17,9 +17,7 @@
# Append the APIs to use for this use case
list(APPEND ${use_case}_API_LIST "kws" "asr")
-USER_OPTION(${use_case}_FILE_PATH "Directory with WAV files, or path to a single WAV file, to use in the evaluation application."
- ${CMAKE_CURRENT_SOURCE_DIR}/resources/${use_case}/samples/
- PATH_OR_FILE)
+set_input_file_path_user_option(".wav" ${use_case})
USER_OPTION(${use_case}_AUDIO_RATE "Specify the target sampling rate. Default is 16000."
16000
diff --git a/source/use_case/noise_reduction/usecase.cmake b/source/use_case/noise_reduction/usecase.cmake
index 199f8e1..a3f7930 100644
--- a/source/use_case/noise_reduction/usecase.cmake
+++ b/source/use_case/noise_reduction/usecase.cmake
@@ -31,9 +31,7 @@ USER_OPTION(${use_case}_MODEL_TFLITE_PATH "NN models file to be used in the eval
${DEFAULT_MODEL_PATH}
FILEPATH)
-USER_OPTION(${use_case}_FILE_PATH "Directory with custom WAV input files, or path to a single WAV file, to use in the evaluation application."
- ${CMAKE_CURRENT_SOURCE_DIR}/resources/${use_case}/samples/
- PATH_OR_FILE)
+set_input_file_path_user_option(".wav" ${use_case})
USER_OPTION(${use_case}_AUDIO_RATE "Specify the target sampling rate. Default is 48000."
48000
diff --git a/source/use_case/object_detection/usecase.cmake b/source/use_case/object_detection/usecase.cmake
index b0a07d5..c228142 100644
--- a/source/use_case/object_detection/usecase.cmake
+++ b/source/use_case/object_detection/usecase.cmake
@@ -17,9 +17,7 @@
# Append the API to use for this use case
list(APPEND ${use_case}_API_LIST "object_detection")
-USER_OPTION(${use_case}_FILE_PATH "Directory with custom image files to use, or path to a single image, in the evaluation application"
- ${CMAKE_CURRENT_SOURCE_DIR}/resources/${use_case}/samples/
- PATH_OR_FILE)
+set_input_file_path_user_option(".bmp" ${use_case})
USER_OPTION(${use_case}_IMAGE_SIZE "Square image size in pixels. Images will be resized to this size."
192
diff --git a/source/use_case/vww/usecase.cmake b/source/use_case/vww/usecase.cmake
index 7ef4596..dd7852a 100644
--- a/source/use_case/vww/usecase.cmake
+++ b/source/use_case/vww/usecase.cmake
@@ -18,9 +18,7 @@
# Append the API to use for this use case
list(APPEND ${use_case}_API_LIST "vww")
-USER_OPTION(${use_case}_FILE_PATH "Directory with custom image files, or path to a single image file, to use in the evaluation application"
- ${CMAKE_CURRENT_SOURCE_DIR}/resources/${use_case}/samples/
- PATH_OR_FILE)
+set_input_file_path_user_option(".png" ${use_case})
USER_OPTION(${use_case}_IMAGE_SIZE "Square image size in pixels. Images will be resized to this size."
128