diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b4ac4c351..741bc676c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -477,7 +477,7 @@ OCV_OPTION(INSTALL_TESTS "Install accuracy and performance test binar # OpenCV build options # =================================================== -OCV_OPTION(ENABLE_CCACHE "Use ccache" (UNIX AND NOT IOS AND (CMAKE_GENERATOR MATCHES "Makefile" OR CMAKE_GENERATOR MATCHES "Ninja")) ) +OCV_OPTION(ENABLE_CCACHE "Use ccache" (UNIX AND (CMAKE_GENERATOR MATCHES "Makefile" OR CMAKE_GENERATOR MATCHES "Ninja" OR CMAKE_GENERATOR MATCHES "Xcode")) ) OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" MSVC IF (MSVC OR (NOT IOS AND NOT CMAKE_CROSSCOMPILING) ) ) OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) ) OCV_OPTION(ENABLE_PROFILING "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF IF CV_GCC ) diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake index 5e3c056800..d48ff79e6d 100644 --- a/cmake/OpenCVCompilerOptions.cmake +++ b/cmake/OpenCVCompilerOptions.cmake @@ -8,13 +8,27 @@ function(access_CMAKE_COMPILER_IS_CCACHE) endif() endfunction() variable_watch(CMAKE_COMPILER_IS_CCACHE access_CMAKE_COMPILER_IS_CCACHE) -if(ENABLE_CCACHE AND NOT OPENCV_COMPILER_IS_CCACHE AND NOT CMAKE_GENERATOR MATCHES "Xcode") +if(ENABLE_CCACHE AND NOT OPENCV_COMPILER_IS_CCACHE) # This works fine with Unix Makefiles and Ninja generators find_host_program(CCACHE_PROGRAM ccache) if(CCACHE_PROGRAM) message(STATUS "Looking for ccache - found (${CCACHE_PROGRAM})") get_property(__OLD_RULE_LAUNCH_COMPILE GLOBAL PROPERTY RULE_LAUNCH_COMPILE) - if(__OLD_RULE_LAUNCH_COMPILE) + if(CMAKE_GENERATOR MATCHES "Xcode") + configure_file("${CMAKE_CURRENT_LIST_DIR}/templates/xcode-launch-c.in" "${CMAKE_BINARY_DIR}/xcode-launch-c") + configure_file("${CMAKE_CURRENT_LIST_DIR}/templates/xcode-launch-cxx.in" "${CMAKE_BINARY_DIR}/xcode-launch-cxx") + execute_process(COMMAND chmod a+rx + "${CMAKE_BINARY_DIR}/xcode-launch-c" + "${CMAKE_BINARY_DIR}/xcode-launch-cxx" + ) + # Xcode project attributes + set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_BINARY_DIR}/xcode-launch-c") + set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_BINARY_DIR}/xcode-launch-cxx") + set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_BINARY_DIR}/xcode-launch-c") + set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_BINARY_DIR}/xcode-launch-cxx") + set(OPENCV_COMPILER_IS_CCACHE 1) + message(STATUS "ccache: enable support through Xcode project properties") + elseif(__OLD_RULE_LAUNCH_COMPILE) message(STATUS "Can't replace CMake compiler launcher") else() set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}") diff --git a/cmake/templates/xcode-launch-c.in b/cmake/templates/xcode-launch-c.in new file mode 100644 index 0000000000..609dbf47b1 --- /dev/null +++ b/cmake/templates/xcode-launch-c.in @@ -0,0 +1,11 @@ +#!/bin/sh +# https://crascit.com/2016/04/09/using-ccache-with-cmake/ + +# Xcode generator doesn't include the compiler as the +# first argument, Ninja and Makefiles do. Handle both cases. +if [[ "$1" = "${CMAKE_C_COMPILER}" ]] ; then + shift +fi + +export CCACHE_CPP2=true +exec "${CCACHE_PROGRAM}" "${CMAKE_C_COMPILER}" "$@" diff --git a/cmake/templates/xcode-launch-cxx.in b/cmake/templates/xcode-launch-cxx.in new file mode 100644 index 0000000000..09233b3859 --- /dev/null +++ b/cmake/templates/xcode-launch-cxx.in @@ -0,0 +1,11 @@ +#!/bin/sh +# https://crascit.com/2016/04/09/using-ccache-with-cmake/ + +# Xcode generator doesn't include the compiler as the +# first argument, Ninja and Makefiles do. Handle both cases. +if [[ "$1" = "${CMAKE_CXX_COMPILER}" ]] ; then + shift +fi + +export CCACHE_CPP2=true +exec "${CCACHE_PROGRAM}" "${CMAKE_CXX_COMPILER}" "$@" diff --git a/modules/dnn/src/onnx/onnx_graph_simplifier.cpp b/modules/dnn/src/onnx/onnx_graph_simplifier.cpp index ad3d903d68..c0554b1a4c 100644 --- a/modules/dnn/src/onnx/onnx_graph_simplifier.cpp +++ b/modules/dnn/src/onnx/onnx_graph_simplifier.cpp @@ -314,6 +314,19 @@ public: } }; +class MishSubgraph : public Subgraph +{ +public: + MishSubgraph() + { + int input = addNodeToMatch(""); + int softplus = addNodeToMatch("Softplus", input); + int tanh = addNodeToMatch("Tanh", softplus); + addNodeToMatch("Mul", input, tanh); + setFusedNode("Mish", input); + } +}; + class MulCastSubgraph : public Subgraph { public: @@ -512,6 +525,7 @@ void simplifySubgraphs(opencv_onnx::GraphProto& net) subgraphs.push_back(makePtr()); subgraphs.push_back(makePtr()); subgraphs.push_back(makePtr()); + subgraphs.push_back(makePtr()); simplifySubgraphs(Ptr(new ONNXGraphWrapper(net)), subgraphs); } diff --git a/modules/dnn/test/test_onnx_importer.cpp b/modules/dnn/test/test_onnx_importer.cpp index 74e87b252b..dcb8678cad 100644 --- a/modules/dnn/test/test_onnx_importer.cpp +++ b/modules/dnn/test/test_onnx_importer.cpp @@ -698,6 +698,11 @@ TEST_P(Test_ONNX_layers, ResizeOpset11_Torch1_6) testONNXModels("resize_opset11_torch1.6"); } +TEST_P(Test_ONNX_layers, Mish) +{ + testONNXModels("mish"); +} + TEST_P(Test_ONNX_layers, Conv1d) { testONNXModels("conv1d"); diff --git a/modules/ts/misc/summary.py b/modules/ts/misc/summary.py index 5549b6c6dc..9da1fb60c6 100755 --- a/modules/ts/misc/summary.py +++ b/modules/ts/misc/summary.py @@ -30,7 +30,7 @@ if __name__ == "__main__": exit(0) parser = OptionParser() - parser.add_option("-o", "--output", dest="format", help="output results in text format (can be 'txt', 'html', 'markdown' or 'auto' - default)", metavar="FMT", default="auto") + parser.add_option("-o", "--output", dest="format", help="output results in text format (can be 'txt', 'html', 'markdown', 'tabs' or 'auto' - default)", metavar="FMT", default="auto") parser.add_option("-m", "--metric", dest="metric", help="output metric", metavar="NAME", default="gmean") parser.add_option("-u", "--units", dest="units", help="units for output values (s, ms (default), us, ns or ticks)", metavar="UNITS", default="ms") parser.add_option("-f", "--filter", dest="filter", help="regex to filter tests", metavar="REGEX", default=None) diff --git a/modules/ts/misc/table_formatter.py b/modules/ts/misc/table_formatter.py index d683394364..412936950f 100755 --- a/modules/ts/misc/table_formatter.py +++ b/modules/ts/misc/table_formatter.py @@ -38,6 +38,7 @@ class table(object): def __init__(self, caption = None, format=None): self.format = format self.is_markdown = self.format == 'markdown' + self.is_tabs = self.format == 'tabs' self.columns = {} self.rows = [] self.ridx = -1; @@ -253,7 +254,7 @@ class table(object): def consolePrintTable(self, out): columns = self.layoutTable() - colrizer = getColorizer(out) if not self.is_markdown else dummyColorizer(out) + colrizer = getColorizer(out) if not (self.is_markdown or self.is_tabs) else dummyColorizer(out) if self.caption: out.write("%s%s%s" % ( os.linesep, os.linesep.join(self.reformatTextValue(self.caption)), os.linesep * 2)) @@ -299,6 +300,10 @@ class table(object): text = ' '.join(self.getValue('text', c) or []) out.write(text + "|") out.write(os.linesep) + elif self.is_tabs: + cols_to_join=[' '.join(self.getValue('text', c) or []) for c in row.cells] + out.write('\t'.join(cols_to_join)) + out.write(os.linesep) else: for ln in range(row.minheight): i = 0 diff --git a/platforms/ios/cmake/Toolchains/common-ios-toolchain.cmake b/platforms/ios/cmake/Toolchains/common-ios-toolchain.cmake index 4cbe4f1729..a5ec05a821 100644 --- a/platforms/ios/cmake/Toolchains/common-ios-toolchain.cmake +++ b/platforms/ios/cmake/Toolchains/common-ios-toolchain.cmake @@ -163,10 +163,20 @@ set(CMAKE_CXX_COMPILER_ABI ELF) set(CMAKE_CXX_COMPILER_WORKS TRUE) set(CMAKE_C_COMPILER_WORKS TRUE) -# Search for programs in the build host directories -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) -# for libraries and headers in the target directories -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +endif() + +if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +endif() + +if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) +endif() + +if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +endif() toolchain_save_config(IOS_ARCH IPHONEOS_DEPLOYMENT_TARGET)