Michael Levit | 06fcf75 | 2022-01-12 11:53:46 +0200 | [diff] [blame^] | 1 | #---------------------------------------------------------------------------- |
| 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 | #---------------------------------------------------------------------------- |
| 17 | |
| 18 | USER_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/ |
| 20 | PATH_OR_FILE) |
| 21 | |
| 22 | USER_OPTION(${use_case}_IMAGE_SIZE "Square image size in pixels. Images will be resized to this size." |
| 23 | 192 |
| 24 | STRING) |
| 25 | |
| 26 | add_compile_definitions(DISPLAY_RGB_IMAGE=1) |
| 27 | add_compile_definitions(INPUT_IMAGE_WIDTH=${${use_case}_IMAGE_SIZE}) |
| 28 | add_compile_definitions(INPUT_IMAGE_HEIGHT=${${use_case}_IMAGE_SIZE}) |
| 29 | add_compile_definitions(ORIGINAL_IMAGE_WIDTH=${${use_case}_IMAGE_SIZE}) |
| 30 | add_compile_definitions(ORIGINAL_IMAGE_HEIGHT=${${use_case}_IMAGE_SIZE}) |
| 31 | |
| 32 | |
| 33 | # Generate input files |
| 34 | generate_images_code("${${use_case}_FILE_PATH}" |
| 35 | ${SRC_GEN_DIR} |
| 36 | ${INC_GEN_DIR} |
| 37 | "${${use_case}_IMAGE_SIZE}") |
| 38 | |
| 39 | |
| 40 | USER_OPTION(${use_case}_ACTIVATION_BUF_SZ "Activation buffer size for the chosen model" |
| 41 | 0x00082000 |
| 42 | STRING) |
| 43 | |
| 44 | if (ETHOS_U_NPU_ENABLED) |
| 45 | set(DEFAULT_MODEL_PATH ${DEFAULT_MODEL_DIR}/yolo-fastest_192_face_v4_vela_${ETHOS_U_NPU_CONFIG_ID}.tflite) |
| 46 | else() |
| 47 | set(DEFAULT_MODEL_PATH ${DEFAULT_MODEL_DIR}/yolo-fastest_192_face_v4.tflite) |
| 48 | endif() |
| 49 | |
| 50 | USER_OPTION(${use_case}_MODEL_TFLITE_PATH "NN models file to be used in the evaluation application. Model files must be in tflite format." |
| 51 | ${DEFAULT_MODEL_PATH} |
| 52 | FILEPATH |
| 53 | ) |
| 54 | |
| 55 | # Generate model file |
| 56 | generate_tflite_code( |
| 57 | MODEL_PATH ${${use_case}_MODEL_TFLITE_PATH} |
| 58 | DESTINATION ${SRC_GEN_DIR} |
| 59 | ) |