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 | #---------------------------------------------------------------------------- |
| 17 | |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 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/ |
Isabella Gottardi | 2181d0a | 2021-04-07 09:27:38 +0100 | [diff] [blame] | 20 | PATH_OR_FILE) |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 21 | |
| 22 | USER_OPTION(${use_case}_IMAGE_SIZE "Square image size in pixels. Images will be resized to this size." |
| 23 | 224 |
| 24 | STRING) |
| 25 | |
| 26 | USER_OPTION(${use_case}_LABELS_TXT_FILE "Labels' txt file for the chosen model" |
| 27 | ${CMAKE_CURRENT_SOURCE_DIR}/resources/${use_case}/labels/labels_mobilenet_v2_1.0_224.txt |
| 28 | FILEPATH) |
| 29 | |
| 30 | # Generate input files |
| 31 | generate_images_code("${${use_case}_FILE_PATH}" |
| 32 | ${SRC_GEN_DIR} |
| 33 | ${INC_GEN_DIR} |
| 34 | "${${use_case}_IMAGE_SIZE}") |
| 35 | |
| 36 | # Generate labels file |
| 37 | set(${use_case}_LABELS_CPP_FILE Labels) |
| 38 | generate_labels_code( |
| 39 | INPUT "${${use_case}_LABELS_TXT_FILE}" |
| 40 | DESTINATION_SRC ${SRC_GEN_DIR} |
| 41 | DESTINATION_HDR ${INC_GEN_DIR} |
| 42 | OUTPUT_FILENAME "${${use_case}_LABELS_CPP_FILE}" |
| 43 | ) |
| 44 | |
| 45 | USER_OPTION(${use_case}_ACTIVATION_BUF_SZ "Activation buffer size for the chosen model" |
| 46 | 0x00200000 |
| 47 | STRING) |
| 48 | |
Cisco Cervellera | f085fa5 | 2021-08-02 09:32:07 +0100 | [diff] [blame] | 49 | if (ETHOS_U_NPU_ENABLED) |
Kshitij Sisodia | 3be2623 | 2021-10-29 12:29:06 +0100 | [diff] [blame] | 50 | 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] | 51 | else() |
Richard Burton | 0d11059 | 2021-08-12 17:26:30 +0100 | [diff] [blame] | 52 | 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] | 53 | endif() |
| 54 | |
| 55 | USER_OPTION(${use_case}_MODEL_TFLITE_PATH "NN models file to be used in the evaluation application. Model files must be in tflite format." |
| 56 | ${DEFAULT_MODEL_PATH} |
| 57 | FILEPATH |
| 58 | ) |
| 59 | |
| 60 | # Generate model file |
| 61 | generate_tflite_code( |
| 62 | MODEL_PATH ${${use_case}_MODEL_TFLITE_PATH} |
| 63 | DESTINATION ${SRC_GEN_DIR} |
| 64 | ) |