blob: 0fd159f3c9682c3f5705baf90a9805c1e45ab817 [file] [log] [blame]
alexander3c798932021-03-26 21:42:19 +00001#----------------------------------------------------------------------------
2# Copyright (c) 2021 Arm Limited. All rights reserved.
3# SPDX-License-Identifier: Apache-2.0
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#----------------------------------------------------------------------------
17
18USER_OPTION(${use_case}_ACTIVATION_BUF_SZ "Activation buffer size for the chosen model"
19 0x00200000
20 STRING)
21
22generate_default_input_code(${INC_GEN_DIR})
23
24# If there is no tflite file pointed to
25if (NOT DEFINED ${use_case}_MODEL_TFLITE_PATH)
26
27 set(MODEL_RESOURCES_DIR ${DOWNLOAD_DEP_DIR}/${use_case})
28 file(MAKE_DIRECTORY ${MODEL_RESOURCES_DIR})
29 set(MODEL_FILENAME dnn_s_quantized.tflite)
30 set(DEFAULT_MODEL_PATH ${MODEL_RESOURCES_DIR}/${MODEL_FILENAME})
31
32 # Download the default model
33 set(ZOO_COMMON_SUBPATH "models/keyword_spotting/dnn_small/tflite_int8/")
34 set(ZOO_MODEL_SUBPATH "${ZOO_COMMON_SUBPATH}/${MODEL_FILENAME}")
Isabella Gottardib88705d2021-04-21 13:09:51 +010035 set(ZOO_MODEL_VERSION "68b5fbc77ed28e67b2efc915997ea4477c1d9d5b")
alexander3c798932021-03-26 21:42:19 +000036
Isabella Gottardib88705d2021-04-21 13:09:51 +010037 download_file_from_modelzoo(${ZOO_MODEL_VERSION} ${ZOO_MODEL_SUBPATH} ${DEFAULT_MODEL_PATH})
alexander3c798932021-03-26 21:42:19 +000038
39 if (ETHOS_U55_ENABLED)
40 message(STATUS
41 "Ethos-U55 is enabled, but the model downloaded is not optimized by vela. "
42 "To use Ethos-U55 acceleration, optimise the downloaded model and pass it "
43 "as ${use_case}_MODEL_TFLITE_PATH to the CMake configuration.")
44 endif()
45
46else()
47 set(DEFAULT_MODEL_PATH "N/A")
48endif()
49
50USER_OPTION(${use_case}_MODEL_TFLITE_PATH "NN models file to be used in the evaluation application. Model files must be in tflite format."
51 ${DEFAULT_MODEL_PATH}
52 FILEPATH)
53
54# Generate model file
55generate_tflite_code(
56 MODEL_PATH ${${use_case}_MODEL_TFLITE_PATH}
57 DESTINATION ${SRC_GEN_DIR}
58)