alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 1 | #---------------------------------------------------------------------------- |
| 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 Sisodia | aa4bcb1 | 2022-05-06 09:13:03 +0100 | [diff] [blame] | 17 | # Append the API to use for this use case |
| 18 | list(APPEND ${use_case}_API_LIST "img_class") |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 19 | |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 20 | USER_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 Gottardi | 2181d0a | 2021-04-07 09:27:38 +0100 | [diff] [blame] | 22 | PATH_OR_FILE) |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 23 | |
| 24 | USER_OPTION(${use_case}_IMAGE_SIZE "Square image size in pixels. Images will be resized to this size." |
| 25 | 224 |
| 26 | STRING) |
| 27 | |
| 28 | USER_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 |
| 33 | generate_images_code("${${use_case}_FILE_PATH}" |
| 34 | ${SRC_GEN_DIR} |
| 35 | ${INC_GEN_DIR} |
| 36 | "${${use_case}_IMAGE_SIZE}") |
| 37 | |
| 38 | # Generate labels file |
| 39 | set(${use_case}_LABELS_CPP_FILE Labels) |
| 40 | generate_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 | |
| 47 | USER_OPTION(${use_case}_ACTIVATION_BUF_SZ "Activation buffer size for the chosen model" |
| 48 | 0x00200000 |
| 49 | STRING) |
| 50 | |
Cisco Cervellera | f085fa5 | 2021-08-02 09:32:07 +0100 | [diff] [blame] | 51 | if (ETHOS_U_NPU_ENABLED) |
Kshitij Sisodia | 3be2623 | 2021-10-29 12:29:06 +0100 | [diff] [blame] | 52 | set(DEFAULT_MODEL_PATH ${DEFAULT_MODEL_DIR}/mobilenet_v2_1.0_224_INT8_vela_${ETHOS_U_NPU_CONFIG_ID}.tflite) |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 53 | else() |
Richard Burton | 0d11059 | 2021-08-12 17:26:30 +0100 | [diff] [blame] | 54 | set(DEFAULT_MODEL_PATH ${DEFAULT_MODEL_DIR}/mobilenet_v2_1.0_224_INT8.tflite) |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 55 | endif() |
| 56 | |
| 57 | USER_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 |
| 63 | generate_tflite_code( |
| 64 | MODEL_PATH ${${use_case}_MODEL_TFLITE_PATH} |
| 65 | DESTINATION ${SRC_GEN_DIR} |
Liam Barry | 213a543 | 2022-05-09 17:06:19 +0100 | [diff] [blame^] | 66 | NAMESPACE "arm" "app" "img_class") |