blob: dafdbbfaa9bc2f9e39c9dc9c802e83905a18804e [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
alexander3c798932021-03-26 21:42:19 +000018USER_OPTION(${use_case}_FILE_PATH "Directory with custom image files to use, or path to a single image, in the evaluation application"
19 ${CMAKE_CURRENT_SOURCE_DIR}/resources/${use_case}/samples/
Isabella Gottardi2181d0a2021-04-07 09:27:38 +010020 PATH_OR_FILE)
alexander3c798932021-03-26 21:42:19 +000021
22USER_OPTION(${use_case}_IMAGE_SIZE "Square image size in pixels. Images will be resized to this size."
23 224
24 STRING)
25
26USER_OPTION(${use_case}_LABELS_TXT_FILE "Labels' txt file for the chosen model"
27 ${CMAKE_CURRENT_SOURCE_DIR}/resources/${use_case}/labels/labels_mobilenet_v2_1.0_224.txt
28 FILEPATH)
29
30# Generate input files
31generate_images_code("${${use_case}_FILE_PATH}"
32 ${SRC_GEN_DIR}
33 ${INC_GEN_DIR}
34 "${${use_case}_IMAGE_SIZE}")
35
36# Generate labels file
37set(${use_case}_LABELS_CPP_FILE Labels)
38generate_labels_code(
39 INPUT "${${use_case}_LABELS_TXT_FILE}"
40 DESTINATION_SRC ${SRC_GEN_DIR}
41 DESTINATION_HDR ${INC_GEN_DIR}
42 OUTPUT_FILENAME "${${use_case}_LABELS_CPP_FILE}"
43)
44
45USER_OPTION(${use_case}_ACTIVATION_BUF_SZ "Activation buffer size for the chosen model"
46 0x00200000
47 STRING)
48
Cisco Cervelleraf085fa52021-08-02 09:32:07 +010049if (ETHOS_U_NPU_ENABLED)
Kshitij Sisodia3be26232021-10-29 12:29:06 +010050 set(DEFAULT_MODEL_PATH ${DEFAULT_MODEL_DIR}/mobilenet_v2_1.0_224_INT8_vela_${ETHOS_U_NPU_CONFIG_ID}.tflite)
alexander3c798932021-03-26 21:42:19 +000051else()
Richard Burton0d110592021-08-12 17:26:30 +010052 set(DEFAULT_MODEL_PATH ${DEFAULT_MODEL_DIR}/mobilenet_v2_1.0_224_INT8.tflite)
alexander3c798932021-03-26 21:42:19 +000053endif()
54
55USER_OPTION(${use_case}_MODEL_TFLITE_PATH "NN models file to be used in the evaluation application. Model files must be in tflite format."
56 ${DEFAULT_MODEL_PATH}
57 FILEPATH
58 )
59
60# Generate model file
61generate_tflite_code(
62 MODEL_PATH ${${use_case}_MODEL_TFLITE_PATH}
63 DESTINATION ${SRC_GEN_DIR}
64 )