3 # Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
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
9 # http://www.apache.org/licenses/LICENSE-2.0
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.
19 DRIVER_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
23 echo "Convert TensorFlow lite model to circle."
24 echo "Usage: one-import-tflite"
25 echo " --version Show version information and exit"
26 echo " --input_path <path/to/tflitemodel>"
27 echo " --output_path <path/to/circle>"
33 $DRIVER_PATH/one-version one-import-tflite
37 # Parse command-line arguments
39 while [ "$#" -ne 0 ]; do
50 export INPUT_PATH="$2"
54 export OUTPUT_PATH="$2"
58 echo "Unknown parameter: ${CUR}"
64 if [ -z ${INPUT_PATH} ] || [ ! -e ${INPUT_PATH} ]; then
65 echo "Error: input model not found"
71 rm -rf "${OUTPUT_PATH}.log"
75 cat "${OUTPUT_PATH}.log"
78 trap show_err_onexit ERR
80 # convert .tflite to .circle
81 echo "${DRIVER_PATH}/tflite2circle" "${INPUT_PATH}" "${OUTPUT_PATH}" > "${OUTPUT_PATH}.log"
83 "${DRIVER_PATH}/tflite2circle" "${INPUT_PATH}" "${OUTPUT_PATH}" >> "${OUTPUT_PATH}.log" 2>&1