blob: e0b6bc87505ba20dafbbb29ed941ee9056f76ec5 [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#----------------------------------------------------------------------------
Kshitij Sisodiaaa4bcb12022-05-06 09:13:03 +010017# Append the API to use for this use case
18list(APPEND ${use_case}_API_LIST "img_class")
alexander3c798932021-03-26 21:42:19 +000019
alexander3c798932021-03-26 21:42:19 +000020USER_OPTION(${use_case}_FILE_PATH "Directory with custom image files to use, or path to a single image, in the evaluation application"
21 ${CMAKE_CURRENT_SOURCE_DIR}/resources/${use_case}/samples/
Isabella Gottardi2181d0a2021-04-07 09:27:38 +010022 PATH_OR_FILE)
alexander3c798932021-03-26 21:42:19 +000023
24USER_OPTION(${use_case}_IMAGE_SIZE "Square image size in pixels. Images will be resized to this size."
25 224
26 STRING)
27
28USER_OPTION(${use_case}_LABELS_TXT_FILE "Labels' txt file for the chosen model"
29 ${CMAKE_CURRENT_SOURCE_DIR}/resources/${use_case}/labels/labels_mobilenet_v2_1.0_224.txt
30 FILEPATH)
31
32# Generate input files
33generate_images_code("${${use_case}_FILE_PATH}"
34 ${SRC_GEN_DIR}
35 ${INC_GEN_DIR}
36 "${${use_case}_IMAGE_SIZE}")
37
38# Generate labels file
39set(${use_case}_LABELS_CPP_FILE Labels)
40generate_labels_code(
41 INPUT "${${use_case}_LABELS_TXT_FILE}"
42 DESTINATION_SRC ${SRC_GEN_DIR}
43 DESTINATION_HDR ${INC_GEN_DIR}
44 OUTPUT_FILENAME "${${use_case}_LABELS_CPP_FILE}"
45)
46
47USER_OPTION(${use_case}_ACTIVATION_BUF_SZ "Activation buffer size for the chosen model"
48 0x00200000
49 STRING)
50
Cisco Cervelleraf085fa52021-08-02 09:32:07 +010051if (ETHOS_U_NPU_ENABLED)
Kshitij Sisodia3be26232021-10-29 12:29:06 +010052 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 +000053else()
Richard Burton0d110592021-08-12 17:26:30 +010054 set(DEFAULT_MODEL_PATH ${DEFAULT_MODEL_DIR}/mobilenet_v2_1.0_224_INT8.tflite)
alexander3c798932021-03-26 21:42:19 +000055endif()
56
57USER_OPTION(${use_case}_MODEL_TFLITE_PATH "NN models file to be used in the evaluation application. Model files must be in tflite format."
58 ${DEFAULT_MODEL_PATH}
59 FILEPATH
60 )
61
62# Generate model file
63generate_tflite_code(
64 MODEL_PATH ${${use_case}_MODEL_TFLITE_PATH}
65 DESTINATION ${SRC_GEN_DIR}
Liam Barry213a5432022-05-09 17:06:19 +010066 NAMESPACE "arm" "app" "img_class")