blob: 850e7fc4234bc4565b0ba44ece51d375c8bb5fe7 [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
20USER_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/
22 PATH_OR_FILE)
23
24USER_OPTION(${use_case}_IMAGE_SIZE "Square image size in pixels. Images will be resized to this size."
25 192
26 STRING)
Michael Levit06fcf752022-01-12 11:53:46 +020027
Isabella Gottardi3107aa22022-01-27 16:39:37 +000028USER_OPTION(${use_case}_ANCHOR_1 "First anchor array estimated during training."
29 "{38, 77, 47, 97, 61, 126}"
30 STRING)
31
32USER_OPTION(${use_case}_ANCHOR_2 "Second anchor array estimated during training."
33 "{14, 26, 19, 37, 28, 55 }"
34 STRING)
35
36USER_OPTION(${use_case}_CHANNELS_IMAGE_DISPLAYED "Channels' image displayed on the LCD. Select 1 if grayscale, 3 if RGB."
37 3
38 BOOL)
Michael Levit06fcf752022-01-12 11:53:46 +020039
40# Generate input files
41generate_images_code("${${use_case}_FILE_PATH}"
42 ${SRC_GEN_DIR}
43 ${INC_GEN_DIR}
44 "${${use_case}_IMAGE_SIZE}")
45
Michael Levit06fcf752022-01-12 11:53:46 +020046USER_OPTION(${use_case}_ACTIVATION_BUF_SZ "Activation buffer size for the chosen model"
47 0x00082000
48 STRING)
49
50if (ETHOS_U_NPU_ENABLED)
51 set(DEFAULT_MODEL_PATH ${DEFAULT_MODEL_DIR}/yolo-fastest_192_face_v4_vela_${ETHOS_U_NPU_CONFIG_ID}.tflite)
52else()
53 set(DEFAULT_MODEL_PATH ${DEFAULT_MODEL_DIR}/yolo-fastest_192_face_v4.tflite)
54endif()
55
Isabella Gottardi3107aa22022-01-27 16:39:37 +000056set(${use_case}_ORIGINAL_IMAGE_SIZE
57 ${${use_case}_IMAGE_SIZE}
58 CACHE STRING
59 "Original image size - for the post processing step to upscale the box co-ordinates.")
60
61set(EXTRA_MODEL_CODE
62 "extern const int originalImageSize = ${${use_case}_ORIGINAL_IMAGE_SIZE};"
63 "extern const int channelsImageDisplayed = ${${use_case}_CHANNELS_IMAGE_DISPLAYED};"
64 "/* NOTE: anchors are different for any given input model size, estimated during training phase */"
65 "extern const float anchor1[] = ${${use_case}_ANCHOR_1};"
66 "extern const float anchor2[] = ${${use_case}_ANCHOR_2};"
67 )
68
Michael Levit06fcf752022-01-12 11:53:46 +020069USER_OPTION(${use_case}_MODEL_TFLITE_PATH "NN models file to be used in the evaluation application. Model files must be in tflite format."
70 ${DEFAULT_MODEL_PATH}
71 FILEPATH
72 )
73
74# Generate model file
75generate_tflite_code(
76 MODEL_PATH ${${use_case}_MODEL_TFLITE_PATH}
77 DESTINATION ${SRC_GEN_DIR}
Isabella Gottardi3107aa22022-01-27 16:39:37 +000078 EXPRESSIONS ${EXTRA_MODEL_CODE}
Michael Levit06fcf752022-01-12 11:53:46 +020079 )