blob: c228142a2efd96a5c013795effcd04b621b332e0 [file] [log] [blame]
Michael Levit06fcf752022-01-12 11:53:46 +02001#----------------------------------------------------------------------------
2# Copyright (c) 2022 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 "object_detection")
Michael Levit06fcf752022-01-12 11:53:46 +020019
Eanna O Cathain4c0ac912022-09-22 15:18:34 +010020set_input_file_path_user_option(".bmp" ${use_case})
Michael Levit06fcf752022-01-12 11:53:46 +020021
22USER_OPTION(${use_case}_IMAGE_SIZE "Square image size in pixels. Images will be resized to this size."
23 192
24 STRING)
Michael Levit06fcf752022-01-12 11:53:46 +020025
Isabella Gottardi3107aa22022-01-27 16:39:37 +000026USER_OPTION(${use_case}_ANCHOR_1 "First anchor array estimated during training."
27 "{38, 77, 47, 97, 61, 126}"
28 STRING)
29
30USER_OPTION(${use_case}_ANCHOR_2 "Second anchor array estimated during training."
31 "{14, 26, 19, 37, 28, 55 }"
32 STRING)
33
34USER_OPTION(${use_case}_CHANNELS_IMAGE_DISPLAYED "Channels' image displayed on the LCD. Select 1 if grayscale, 3 if RGB."
35 3
36 BOOL)
Michael Levit06fcf752022-01-12 11:53:46 +020037
38# Generate input files
39generate_images_code("${${use_case}_FILE_PATH}"
40 ${SRC_GEN_DIR}
41 ${INC_GEN_DIR}
42 "${${use_case}_IMAGE_SIZE}")
43
Michael Levit06fcf752022-01-12 11:53:46 +020044USER_OPTION(${use_case}_ACTIVATION_BUF_SZ "Activation buffer size for the chosen model"
45 0x00082000
46 STRING)
47
48if (ETHOS_U_NPU_ENABLED)
49 set(DEFAULT_MODEL_PATH ${DEFAULT_MODEL_DIR}/yolo-fastest_192_face_v4_vela_${ETHOS_U_NPU_CONFIG_ID}.tflite)
50else()
51 set(DEFAULT_MODEL_PATH ${DEFAULT_MODEL_DIR}/yolo-fastest_192_face_v4.tflite)
52endif()
53
Isabella Gottardi3107aa22022-01-27 16:39:37 +000054set(${use_case}_ORIGINAL_IMAGE_SIZE
55 ${${use_case}_IMAGE_SIZE}
56 CACHE STRING
57 "Original image size - for the post processing step to upscale the box co-ordinates.")
58
59set(EXTRA_MODEL_CODE
60 "extern const int originalImageSize = ${${use_case}_ORIGINAL_IMAGE_SIZE};"
61 "extern const int channelsImageDisplayed = ${${use_case}_CHANNELS_IMAGE_DISPLAYED};"
62 "/* NOTE: anchors are different for any given input model size, estimated during training phase */"
63 "extern const float anchor1[] = ${${use_case}_ANCHOR_1};"
64 "extern const float anchor2[] = ${${use_case}_ANCHOR_2};"
65 )
66
Michael Levit06fcf752022-01-12 11:53:46 +020067USER_OPTION(${use_case}_MODEL_TFLITE_PATH "NN models file to be used in the evaluation application. Model files must be in tflite format."
68 ${DEFAULT_MODEL_PATH}
69 FILEPATH
70 )
71
72# Generate model file
73generate_tflite_code(
74 MODEL_PATH ${${use_case}_MODEL_TFLITE_PATH}
75 DESTINATION ${SRC_GEN_DIR}
Isabella Gottardi3107aa22022-01-27 16:39:37 +000076 EXPRESSIONS ${EXTRA_MODEL_CODE}
Liam Barry213a5432022-05-09 17:06:19 +010077 NAMESPACE "arm" "app" "object_detection")