From 14de8ac9515971cfd9cc5ac4dca860c9698bca33 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Mon, 26 Jun 2017 14:36:40 +0300 Subject: [PATCH] dnn: move samples --- samples/CMakeLists.txt | 2 + .../samples => samples/data/dnn}/.gitignore | 0 ...GG_VOC0712_SSD_300x300_iter_60000.prototxt | 0 .../data/dnn}/bvlc_googlenet.prototxt | 0 .../data/dnn}/enet-classes.txt | 0 .../data/dnn}/fcn32s-heavy-pascal.prototxt | 0 .../data/dnn}/fcn8s-heavy-pascal.prototxt | 0 .../data/dnn}/pascal-classes.txt | 0 .../dnn/samples => samples/data/dnn}/rgb.jpg | Bin .../data/dnn}/space_shuttle.jpg | Bin .../data/dnn}/synset_words.txt | 0 samples/dnn/CMakeLists.txt | 55 ++++++++++++++++++ .../dnn}/caffe_googlenet.cpp | 0 .../samples => samples/dnn}/fcn_semsegm.cpp | 0 .../dnn}/googlenet_python.py | 0 .../dnn}/squeezenet_halide.cpp | 0 .../dnn}/ssd_object_detection.cpp | 0 .../samples => samples/dnn}/tf_inception.cpp | 0 .../samples => samples/dnn}/torch_enet.cpp | 0 19 files changed, 57 insertions(+) rename {modules/dnn/samples => samples/data/dnn}/.gitignore (100%) rename {modules/dnn/samples => samples/data/dnn}/VGG_VOC0712_SSD_300x300_iter_60000.prototxt (100%) rename {modules/dnn/samples => samples/data/dnn}/bvlc_googlenet.prototxt (100%) rename {modules/dnn/samples => samples/data/dnn}/enet-classes.txt (100%) rename {modules/dnn/samples => samples/data/dnn}/fcn32s-heavy-pascal.prototxt (100%) rename {modules/dnn/samples => samples/data/dnn}/fcn8s-heavy-pascal.prototxt (100%) rename {modules/dnn/samples => samples/data/dnn}/pascal-classes.txt (100%) rename {modules/dnn/samples => samples/data/dnn}/rgb.jpg (100%) rename {modules/dnn/samples => samples/data/dnn}/space_shuttle.jpg (100%) rename {modules/dnn/samples => samples/data/dnn}/synset_words.txt (100%) create mode 100644 samples/dnn/CMakeLists.txt rename {modules/dnn/samples => samples/dnn}/caffe_googlenet.cpp (100%) rename {modules/dnn/samples => samples/dnn}/fcn_semsegm.cpp (100%) rename {modules/dnn/samples => samples/dnn}/googlenet_python.py (100%) rename {modules/dnn/samples => samples/dnn}/squeezenet_halide.cpp (100%) rename {modules/dnn/samples => samples/dnn}/ssd_object_detection.cpp (100%) rename {modules/dnn/samples => samples/dnn}/tf_inception.cpp (100%) rename {modules/dnn/samples => samples/dnn}/torch_enet.cpp (100%) diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 152d502395..cc2a41bd2c 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -11,6 +11,7 @@ if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_LIST_DIR) # ---------------------------------------------------------------------------- add_subdirectory(cpp) +add_subdirectory(dnn) add_subdirectory(gpu) add_subdirectory(tapi) @@ -78,6 +79,7 @@ if(MSVC) endif() add_subdirectory(cpp) +add_subdirectory(dnn) # FIXIT: can't use cvconfig.h in samples: add_subdirectory(gpu) add_subdirectory(opencl) diff --git a/modules/dnn/samples/.gitignore b/samples/data/dnn/.gitignore similarity index 100% rename from modules/dnn/samples/.gitignore rename to samples/data/dnn/.gitignore diff --git a/modules/dnn/samples/VGG_VOC0712_SSD_300x300_iter_60000.prototxt b/samples/data/dnn/VGG_VOC0712_SSD_300x300_iter_60000.prototxt similarity index 100% rename from modules/dnn/samples/VGG_VOC0712_SSD_300x300_iter_60000.prototxt rename to samples/data/dnn/VGG_VOC0712_SSD_300x300_iter_60000.prototxt diff --git a/modules/dnn/samples/bvlc_googlenet.prototxt b/samples/data/dnn/bvlc_googlenet.prototxt similarity index 100% rename from modules/dnn/samples/bvlc_googlenet.prototxt rename to samples/data/dnn/bvlc_googlenet.prototxt diff --git a/modules/dnn/samples/enet-classes.txt b/samples/data/dnn/enet-classes.txt similarity index 100% rename from modules/dnn/samples/enet-classes.txt rename to samples/data/dnn/enet-classes.txt diff --git a/modules/dnn/samples/fcn32s-heavy-pascal.prototxt b/samples/data/dnn/fcn32s-heavy-pascal.prototxt similarity index 100% rename from modules/dnn/samples/fcn32s-heavy-pascal.prototxt rename to samples/data/dnn/fcn32s-heavy-pascal.prototxt diff --git a/modules/dnn/samples/fcn8s-heavy-pascal.prototxt b/samples/data/dnn/fcn8s-heavy-pascal.prototxt similarity index 100% rename from modules/dnn/samples/fcn8s-heavy-pascal.prototxt rename to samples/data/dnn/fcn8s-heavy-pascal.prototxt diff --git a/modules/dnn/samples/pascal-classes.txt b/samples/data/dnn/pascal-classes.txt similarity index 100% rename from modules/dnn/samples/pascal-classes.txt rename to samples/data/dnn/pascal-classes.txt diff --git a/modules/dnn/samples/rgb.jpg b/samples/data/dnn/rgb.jpg similarity index 100% rename from modules/dnn/samples/rgb.jpg rename to samples/data/dnn/rgb.jpg diff --git a/modules/dnn/samples/space_shuttle.jpg b/samples/data/dnn/space_shuttle.jpg similarity index 100% rename from modules/dnn/samples/space_shuttle.jpg rename to samples/data/dnn/space_shuttle.jpg diff --git a/modules/dnn/samples/synset_words.txt b/samples/data/dnn/synset_words.txt similarity index 100% rename from modules/dnn/samples/synset_words.txt rename to samples/data/dnn/synset_words.txt diff --git a/samples/dnn/CMakeLists.txt b/samples/dnn/CMakeLists.txt new file mode 100644 index 0000000000..83ac3cd3dc --- /dev/null +++ b/samples/dnn/CMakeLists.txt @@ -0,0 +1,55 @@ +SET(OPENCV_DNN_SAMPLES_REQUIRED_DEPS opencv_core opencv_imgproc opencv_dnn + opencv_imgcodecs opencv_videoio opencv_highgui + ${OpenCV_LIB_COMPONENTS}) + +ocv_check_dependencies(${OPENCV_DNN_SAMPLES_REQUIRED_DEPS}) + + +if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) + project(dnn_samples) + + ocv_include_directories("${OpenCV_SOURCE_DIR}/include") + ocv_include_modules_recurse(${OPENCV_DNN_SAMPLES_REQUIRED_DEPS}) + + # --------------------------------------------- + # Define executable targets + # --------------------------------------------- + MACRO(OPENCV_DEFINE_DNN_EXAMPLE name srcs) + set(sample_kind example_dnn) + set(sample_subfolder "dnn") + + set(the_target "${sample_kind}_${name}") + add_executable(${the_target} ${srcs}) + ocv_target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${OPENCV_DNN_SAMPLES_REQUIRED_DEPS}) + + set_target_properties(${the_target} PROPERTIES + OUTPUT_NAME "${sample_kind}-${name}" + PROJECT_LABEL "(${sample_KIND}) ${name}") + + if(ENABLE_SOLUTION_FOLDERS) + set_target_properties(${the_target} PROPERTIES FOLDER "samples/${sample_subfolder}") + endif() + + if(WIN32) + if (MSVC AND NOT BUILD_SHARED_LIBS) + set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG") + endif() + install(TARGETS ${the_target} + RUNTIME DESTINATION "${OPENCV_SAMPLES_BIN_INSTALL_PATH}/${sample_subfolder}" COMPONENT samples) + endif() + ENDMACRO() + + file(GLOB_RECURSE dnn_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) + + foreach(sample_filename ${dnn_samples}) + get_filename_component(sample ${sample_filename} NAME_WE) + OPENCV_DEFINE_DNN_EXAMPLE(${sample} ${sample_filename}) + endforeach() +endif() + +if(INSTALL_C_EXAMPLES AND NOT WIN32) + file(GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd ) + install(FILES ${C_SAMPLES} + DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/dnn + PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples) +endif() diff --git a/modules/dnn/samples/caffe_googlenet.cpp b/samples/dnn/caffe_googlenet.cpp similarity index 100% rename from modules/dnn/samples/caffe_googlenet.cpp rename to samples/dnn/caffe_googlenet.cpp diff --git a/modules/dnn/samples/fcn_semsegm.cpp b/samples/dnn/fcn_semsegm.cpp similarity index 100% rename from modules/dnn/samples/fcn_semsegm.cpp rename to samples/dnn/fcn_semsegm.cpp diff --git a/modules/dnn/samples/googlenet_python.py b/samples/dnn/googlenet_python.py similarity index 100% rename from modules/dnn/samples/googlenet_python.py rename to samples/dnn/googlenet_python.py diff --git a/modules/dnn/samples/squeezenet_halide.cpp b/samples/dnn/squeezenet_halide.cpp similarity index 100% rename from modules/dnn/samples/squeezenet_halide.cpp rename to samples/dnn/squeezenet_halide.cpp diff --git a/modules/dnn/samples/ssd_object_detection.cpp b/samples/dnn/ssd_object_detection.cpp similarity index 100% rename from modules/dnn/samples/ssd_object_detection.cpp rename to samples/dnn/ssd_object_detection.cpp diff --git a/modules/dnn/samples/tf_inception.cpp b/samples/dnn/tf_inception.cpp similarity index 100% rename from modules/dnn/samples/tf_inception.cpp rename to samples/dnn/tf_inception.cpp diff --git a/modules/dnn/samples/torch_enet.cpp b/samples/dnn/torch_enet.cpp similarity index 100% rename from modules/dnn/samples/torch_enet.cpp rename to samples/dnn/torch_enet.cpp