add a flag 'DISABLE_MODEL_DOWNLOAD' and block it at gbs build. It will be improved as rpm packaging for the model files rather than download them.
Signed-off-by: HyoungjooAhn <hello.ahnn@gmail.com>
PROJECT(nnstreamer C CXX)
OPTION(TIZEN "Enable Tizen build mode" OFF)
-OPTION(DISABLE_TENSORFLOW_LITE "Disable tensorflow-lite support" OFF)
-OPTION(DISABLE_TENSORFLOW "Disable tensorflow support" ON)
+OPTION(ENABLE_TENSORFLOW_LITE "Enable tensorflow-lite support" ON)
+OPTION(ENABLE_TENSORFLOW "Enable tensorflow support" OFF)
+OPTION(ENABLE_MODEL_DOWNLOAD "Enable download the model files" ON)
OPTION(INSTALL_EXAMPLE_APP "Install example applications" OFF)
OPTION(SINGLE_BINARY "Generate a single binary for all nnstreamer elements" ON)
IF(SINGLE_BINARY)
SET(FILTER_LIB dl)
SET(FILTER_DEP)
-IF(NOT DISABLE_TENSORFLOW_LITE)
+IF(ENABLE_TENSORFLOW_LITE)
LIST(APPEND FILTER_LIB tensor_filter_tflitecore)
LIST(APPEND FILTER_DEP tensor_filter_tflitecore)
-ENDIF(NOT DISABLE_TENSORFLOW_LITE)
-IF(NOT DISABLE_TENSORFLOW)
+ENDIF(ENABLE_TENSORFLOW_LITE)
+IF(ENABLE_TENSORFLOW)
LIST(APPEND FILTER_LIB tensor_filter_tfcore)
LIST(APPEND FILTER_DEP tensor_filter_tfcore)
-ENDIF(NOT DISABLE_TENSORFLOW)
+ENDIF(ENABLE_TENSORFLOW)
LIST(LENGTH FILTER_DEP FILTER_DEP_LEN)
IF (SINGLE_BINARY)
# check whether TENSORFLOW_LITE is available.
-# DISABLE_TENSORFLOW_LITE is defined at /debian/rules according to the build environment
+# ENABLE_TENSORFLOW_LITE is defined at /debian/rules according to the build environment
set(FILTER_SOURCE tensor_filter.c tensor_filter_custom.c)
set(FILTER_TARGET)
-IF(DISABLE_TENSORFLOW_LITE) # NOT AVAILABLE
- ADD_DEFINITIONS(-DDISABLE_TENSORFLOW_LITE)
-ENDIF(DISABLE_TENSORFLOW_LITE)
+IF(ENABLE_TENSORFLOW_LITE) # AVAILABLE
+ ADD_DEFINITIONS(-DENABLE_TENSORFLOW_LITE)
+ENDIF(ENABLE_TENSORFLOW_LITE)
-IF(DISABLE_TENSORFLOW) # NOT AVAILABLE
- ADD_DEFINITIONS(-DDISABLE_TENSORFLOW)
-ENDIF(DISABLE_TENSORFLOW)
+IF(ENABLE_TENSORFLOW) # AVAILABLE
+ ADD_DEFINITIONS(-DENABLE_TENSORFLOW)
+ENDIF(ENABLE_TENSORFLOW)
-IF(NOT DISABLE_TENSORFLOW_LITE)
+IF(ENABLE_TENSORFLOW_LITE)
list(APPEND FILTER_SOURCE tensor_filter_tensorflow_lite.c)
list(APPEND FILTER_TARGET tensor_filter_tflitecore)
list(APPEND FILTER_TARGET tensor_filter_tflitecoreStatic)
TARGET_LINK_LIBRARIES(tensor_filter_tflitecoreStatic ${pkgs_LIBRARIES} tensorflow-lite)
TARGET_INCLUDE_DIRECTORIES(tensor_filter_tflitecoreStatic PUBLIC ${pkgs_INCLUDE_DIRS} ${TENSORFLOW_LITE_INCLUDE_DIRS})
TARGET_COMPILE_OPTIONS(tensor_filter_tflitecoreStatic PUBLIC ${pkgs_CFLAGS_OTHER})
-ENDIF(NOT DISABLE_TENSORFLOW_LITE)
+ENDIF(ENABLE_TENSORFLOW_LITE)
-IF(NOT DISABLE_TENSORFLOW)
+IF(ENABLE_TENSORFLOW)
list(APPEND FILTER_SOURCE tensor_filter_tensorflow.c)
list(APPEND FILTER_TARGET tensor_filter_tfcore)
list(APPEND FILTER_TARGET tensor_filter_tfcoreStatic)
TARGET_LINK_LIBRARIES(tensor_filter_tfcoreStatic ${pkgs_LIBRARIES} ${TENSORFLOW_LIBRARIES})
TARGET_INCLUDE_DIRECTORIES(tensor_filter_tfcoreStatic PUBLIC ${pkgs_INCLUDE_DIRS} ${TENSORFLOW_INCLUDE_DIRS})
TARGET_COMPILE_OPTIONS(tensor_filter_tfcoreStatic PUBLIC ${pkgs_CFLAGS_OTHER})
-ENDIF(NOT DISABLE_TENSORFLOW)
+ENDIF(ENABLE_TENSORFLOW)
MESSAGE(filterOBJ ${FILTER_SOURCE})
ADD_LIBRARY(tensor_filterOBJ OBJECT ${FILTER_SOURCE})
[_T_F_CUSTOM] = &NNS_support_custom,
-#ifdef DISABLE_TENSORFLOW_LITE
- [_T_F_TENSORFLOW_LITE] = NULL,
-#else
+#ifdef ENABLE_TENSORFLOW_LITE
[_T_F_TENSORFLOW_LITE] = &NNS_support_tensorflow_lite,
-#endif
-#ifdef DISABLE_TENSORFLOW
- [_T_F_TENSORFLOW] = NULL,
#else
+ [_T_F_TENSORFLOW_LITE] = NULL,
+#endif
+#ifdef ENABLE_TENSORFLOW
[_T_F_TENSORFLOW] = &NNS_support_tensorflow,
+#else
+ [_T_F_TENSORFLOW] = NULL,
#endif
[_T_F_CAFFE2] = NULL,
# demo app
pkg_check_modules(cairo_pkg REQUIRED cairo)
-if(NOT EXISTS "${CMAKE_BINARY_DIR}/tflite_model_ssd/ssd_mobilenet_v2_coco.tflite")
- file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/tflite_model_ssd)
-
- message("-- [START TO DOWNLOAD REQUIRED RESOURCES: Model]")
- file(DOWNLOAD
- "https://github.com/nnsuite/testcases/raw/master/DeepLearningModels/tensorflow-lite/ssd_mobilenet_v2_coco/ssd_mobilenet_v2_coco.tflite"
- "${CMAKE_BINARY_DIR}/tflite_model_ssd/ssd_mobilenet_v2_coco.tflite"
- SHOW_PROGRESS
- )
-endif()
-
-if(NOT EXISTS "${CMAKE_BINARY_DIR}/tflite_model_ssd/coco_labels_list.txt")
- message("-- [START TO DOWNLOAD REQUIRED RESOURCES: Label]")
- file(DOWNLOAD
- "https://github.com/nnsuite/testcases/raw/master/DeepLearningModels/tensorflow-lite/ssd_mobilenet_v2_coco/coco_labels_list.txt"
- "${CMAKE_BINARY_DIR}/tflite_model_ssd/coco_labels_list.txt"
- SHOW_PROGRESS
- )
-endif()
-
-
-if(NOT EXISTS "${CMAKE_BINARY_DIR}/tflite_model_ssd/box_priors.txt")
- message("-- [START TO DOWNLOAD REQUIRED RESOURCES: Box_prior]")
- file(DOWNLOAD
- "https://github.com/nnsuite/testcases/raw/master/DeepLearningModels/tensorflow-lite/ssd_mobilenet_v2_coco/box_priors.txt"
- "${CMAKE_BINARY_DIR}/tflite_model_ssd/box_priors.txt"
- SHOW_PROGRESS
- )
-endif()
+if(ENABLE_MODEL_DOWNLOAD)
+ if(NOT EXISTS "${CMAKE_BINARY_DIR}/tflite_model_ssd/ssd_mobilenet_v2_coco.tflite")
+ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/tflite_model_ssd)
+
+ message("-- [START TO DOWNLOAD REQUIRED RESOURCES: Model]")
+ file(DOWNLOAD
+ "https://github.com/nnsuite/testcases/raw/master/DeepLearningModels/tensorflow-lite/ssd_mobilenet_v2_coco/ssd_mobilenet_v2_coco.tflite"
+ "${CMAKE_BINARY_DIR}/tflite_model_ssd/ssd_mobilenet_v2_coco.tflite"
+ SHOW_PROGRESS
+ )
+ endif()
+
+ if(NOT EXISTS "${CMAKE_BINARY_DIR}/tflite_model_ssd/coco_labels_list.txt")
+ message("-- [START TO DOWNLOAD REQUIRED RESOURCES: Label]")
+ file(DOWNLOAD
+ "https://github.com/nnsuite/testcases/raw/master/DeepLearningModels/tensorflow-lite/ssd_mobilenet_v2_coco/coco_labels_list.txt"
+ "${CMAKE_BINARY_DIR}/tflite_model_ssd/coco_labels_list.txt"
+ SHOW_PROGRESS
+ )
+ endif()
+
+
+ if(NOT EXISTS "${CMAKE_BINARY_DIR}/tflite_model_ssd/box_priors.txt")
+ message("-- [START TO DOWNLOAD REQUIRED RESOURCES: Box_prior]")
+ file(DOWNLOAD
+ "https://github.com/nnsuite/testcases/raw/master/DeepLearningModels/tensorflow-lite/ssd_mobilenet_v2_coco/box_priors.txt"
+ "${CMAKE_BINARY_DIR}/tflite_model_ssd/box_priors.txt"
+ SHOW_PROGRESS
+ )
+ endif()
+else()
+ message("-- [MODEL DOWNLOAD IS BLOCKED]")
+endif(ENABLE_MODEL_DOWNLOAD)
ADD_EXECUTABLE(nnstreamer_example_object_detection nnstreamer_example_object_detection.cc)
mkdir -p build
pushd build
-%cmake .. -DTIZEN=ON -DGST_INSTALL_DIR=%{gstlibdir}
+%cmake .. -DTIZEN=ON -DGST_INSTALL_DIR=%{gstlibdir} -DENABLE_MODEL_DOWNLOAD=OFF
make %{?_smp_mflags}
popd