[Api/Android] add option for tf-lite version
authorJaeyun <jy1210.jung@samsung.com>
Thu, 22 Aug 2019 12:43:21 +0000 (21:43 +0900)
committerwooksong <wook16.song@samsung.com>
Fri, 23 Aug 2019 10:43:58 +0000 (19:43 +0900)
update script to set tensorflow-lite version (1.9 and 1.13 available)

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
api/android/api/jni/Android-tensorflow-lite.mk [deleted file]
api/android/api/jni/Android.mk
api/android/build-android-lib.sh

diff --git a/api/android/api/jni/Android-tensorflow-lite.mk b/api/android/api/jni/Android-tensorflow-lite.mk
deleted file mode 100644 (file)
index 4611253..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-#------------------------------------------------------
-# tensorflow-lite
-#
-# This mk file is to build a static library from cloned tensorflow repository.
-# To utilize and build a new version, you have to define the root directory and check Makefile to build tensorflow-lite.
-# Now this file is to build tensorflow-lite from tizen tensorflow repository with version 1.9.
-#------------------------------------------------------
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := tensorflow-lite
-
-# Need to set tensorflow root dir
-ifndef TENSORFLOW_ROOT
-$(error TENSORFLOW_ROOT is not defined!)
-endif
-
-# Set tensorflow-lite dir (TODO change this with tensorflow-lite version)
-TF_LITE_DIR := $(TENSORFLOW_ROOT)/tensorflow/contrib/lite
-
-# Set files to compile (TODO check Makefile to build tensorflow-lite)
-CORE_CC_ALL_SRCS := \
-    $(wildcard $(TF_LITE_DIR)/*.cc) \
-    $(wildcard $(TF_LITE_DIR)/kernels/*.cc) \
-    $(wildcard $(TF_LITE_DIR)/kernels/internal/*.cc) \
-    $(wildcard $(TF_LITE_DIR)/kernels/internal/optimized/*.cc) \
-    $(wildcard $(TF_LITE_DIR)/kernels/internal/reference/*.cc) \
-    $(wildcard $(TF_LITE_DIR)/*.c) \
-    $(wildcard $(TF_LITE_DIR)/kernels/*.c) \
-    $(wildcard $(TF_LITE_DIR)/kernels/internal/*.c) \
-    $(wildcard $(TF_LITE_DIR)/kernels/internal/optimized/*.c) \
-    $(wildcard $(TF_LITE_DIR)/kernels/internal/reference/*.c) \
-    $(wildcard $(TF_LITE_DIR)/downloads/farmhash/src/farmhash.cc) \
-    $(wildcard $(TF_LITE_DIR)/downloads/fft2d/fftsg.c)
-
-# Remove any duplicates.
-CORE_CC_ALL_SRCS := $(sort $(CORE_CC_ALL_SRCS))
-CORE_CC_EXCLUDE_SRCS := \
-    $(wildcard $(TF_LITE_DIR)/*test.cc) \
-    $(wildcard $(TF_LITE_DIR)/*/*test.cc) \
-    $(wildcard $(TF_LITE_DIR)/*/*/*test.cc) \
-    $(wildcard $(TF_LITE_DIR)/*/*/*/*test.cc) \
-    $(wildcard $(TF_LITE_DIR)/kernels/test_util.cc) \
-    $(wildcard $(TF_LITE_DIR)/examples/minimal/minimal.cc)
-
-# Filter out all the excluded files.
-TF_LITE_CC_SRCS := $(filter-out $(CORE_CC_EXCLUDE_SRCS), $(CORE_CC_ALL_SRCS))
-TF_LITE_INCLUDES := \
-    $(ANDROID_NDK)/../ \
-    $(TENSORFLOW_ROOT) \
-    $(TF_LITE_DIR)/downloads \
-    $(TF_LITE_DIR)/downloads/eigen \
-    $(TF_LITE_DIR)/downloads/gemmlowp \
-    $(TF_LITE_DIR)/downloads/neon_2_sse \
-    $(TF_LITE_DIR)/downloads/farmhash/src \
-    $(TF_LITE_DIR)/downloads/flatbuffers/include
-
-LOCAL_SRC_FILES := $(TF_LITE_CC_SRCS)
-LOCAL_C_INCLUDES := $(TF_LITE_INCLUDES)
-
-LOCAL_CFLAGS += -O2 -DNDEBUG
-# std for toolchain in NDK
-# rtti for typecast in tensorflow-lite
-# exceptions to enable exception handling in tensorflow-lite
-LOCAL_CXXFLAGS += -std=c++11 -frtti -fexceptions -O2 -DNDEBUG
-
-include $(BUILD_STATIC_LIBRARY)
index 0d6a942..270d0ea 100644 (file)
@@ -19,7 +19,6 @@ endif
 #------------------------------------------------------
 # external libs
 #------------------------------------------------------
-#include $(LOCAL_PATH)/Android-tensorflow-lite.mk
 include $(LOCAL_PATH)/Android-tensorflow-lite-prebuilt.mk
 
 #------------------------------------------------------
index 0e46ce6..42ec851 100644 (file)
@@ -13,6 +13,9 @@
 # Set target ABI (default 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64')
 nnstreamer_target_abi="'armeabi-v7a', 'arm64-v8a'"
 
+# Set tensorflow-lite version (available: 1.9 and 1.13)
+nnstreamer_tf_lite_ver=1.13
+
 # Function to check if a package is installed
 function check_package() {
     which "$1" 2>/dev/null || {
@@ -59,11 +62,7 @@ svn --force export https://github.com/nnsuite/nnstreamer-android-resource/trunk/
 
 pushd ./build_android_lib
 
-tar xJf ./ext-files/ext-files.tar.xz -C ./api
-tar xJf ./ext-files/tensorflow-lite_arm64.tar.xz -C ./api/jni
-tar xJf ./ext-files/tensorflow-lite_armv7.tar.xz -C ./api/jni
-tar xJf ./ext-files/tensorflow-lite_x86.tar.xz -C ./api/jni
-tar xJf ./ext-files/tensorflow-lite_x86_64.tar.xz -C ./api/jni
+tar xJf ./ext-files/tensorflow-lite-$nnstreamer_tf_lite_ver.tar.xz -C ./api/jni
 
 sed -i "s|abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'|abiFilters $nnstreamer_target_abi|" api/build.gradle