blob: 77b1ae18190acf833462f409e1d9c4827bf777ea [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}")
35
36 download_file_from_modelzoo(${ZOO_MODEL_SUBPATH} ${DEFAULT_MODEL_PATH})
37
38 if (ETHOS_U55_ENABLED)
39 message(STATUS
40 "Ethos-U55 is enabled, but the model downloaded is not optimized by vela. "
41 "To use Ethos-U55 acceleration, optimise the downloaded model and pass it "
42 "as ${use_case}_MODEL_TFLITE_PATH to the CMake configuration.")
43 endif()
44
45else()
46 set(DEFAULT_MODEL_PATH "N/A")
47endif()
48
49USER_OPTION(${use_case}_MODEL_TFLITE_PATH "NN models file to be used in the evaluation application. Model files must be in tflite format."
50 ${DEFAULT_MODEL_PATH}
51 FILEPATH)
52
53# Generate model file
54generate_tflite_code(
55 MODEL_PATH ${${use_case}_MODEL_TFLITE_PATH}
56 DESTINATION ${SRC_GEN_DIR}
57)