Skip to content

Commit 28c0cd8

Browse files
committed
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
2 parents 63bb2ab + eea4397 commit 28c0cd8

9 files changed

+80
-10
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ OCV_OPTION(INSTALL_TESTS "Install accuracy and performance test binar
477477

478478
# OpenCV build options
479479
# ===================================================
480-
OCV_OPTION(ENABLE_CCACHE "Use ccache" (UNIX AND NOT IOS AND (CMAKE_GENERATOR MATCHES "Makefile" OR CMAKE_GENERATOR MATCHES "Ninja")) )
480+
OCV_OPTION(ENABLE_CCACHE "Use ccache" (UNIX AND (CMAKE_GENERATOR MATCHES "Makefile" OR CMAKE_GENERATOR MATCHES "Ninja" OR CMAKE_GENERATOR MATCHES "Xcode")) )
481481
OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" MSVC IF (MSVC OR (NOT IOS AND NOT CMAKE_CROSSCOMPILING) ) )
482482
OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) )
483483
OCV_OPTION(ENABLE_PROFILING "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF IF CV_GCC )

cmake/OpenCVCompilerOptions.cmake

+16-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,27 @@ function(access_CMAKE_COMPILER_IS_CCACHE)
88
endif()
99
endfunction()
1010
variable_watch(CMAKE_COMPILER_IS_CCACHE access_CMAKE_COMPILER_IS_CCACHE)
11-
if(ENABLE_CCACHE AND NOT OPENCV_COMPILER_IS_CCACHE AND NOT CMAKE_GENERATOR MATCHES "Xcode")
11+
if(ENABLE_CCACHE AND NOT OPENCV_COMPILER_IS_CCACHE)
1212
# This works fine with Unix Makefiles and Ninja generators
1313
find_host_program(CCACHE_PROGRAM ccache)
1414
if(CCACHE_PROGRAM)
1515
message(STATUS "Looking for ccache - found (${CCACHE_PROGRAM})")
1616
get_property(__OLD_RULE_LAUNCH_COMPILE GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
17-
if(__OLD_RULE_LAUNCH_COMPILE)
17+
if(CMAKE_GENERATOR MATCHES "Xcode")
18+
configure_file("${CMAKE_CURRENT_LIST_DIR}/templates/xcode-launch-c.in" "${CMAKE_BINARY_DIR}/xcode-launch-c")
19+
configure_file("${CMAKE_CURRENT_LIST_DIR}/templates/xcode-launch-cxx.in" "${CMAKE_BINARY_DIR}/xcode-launch-cxx")
20+
execute_process(COMMAND chmod a+rx
21+
"${CMAKE_BINARY_DIR}/xcode-launch-c"
22+
"${CMAKE_BINARY_DIR}/xcode-launch-cxx"
23+
)
24+
# Xcode project attributes
25+
set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_BINARY_DIR}/xcode-launch-c")
26+
set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_BINARY_DIR}/xcode-launch-cxx")
27+
set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_BINARY_DIR}/xcode-launch-c")
28+
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_BINARY_DIR}/xcode-launch-cxx")
29+
set(OPENCV_COMPILER_IS_CCACHE 1)
30+
message(STATUS "ccache: enable support through Xcode project properties")
31+
elseif(__OLD_RULE_LAUNCH_COMPILE)
1832
message(STATUS "Can't replace CMake compiler launcher")
1933
else()
2034
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")

cmake/templates/xcode-launch-c.in

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
# https://crascit.com/2016/04/09/using-ccache-with-cmake/
3+
4+
# Xcode generator doesn't include the compiler as the
5+
# first argument, Ninja and Makefiles do. Handle both cases.
6+
if [[ "$1" = "${CMAKE_C_COMPILER}" ]] ; then
7+
shift
8+
fi
9+
10+
export CCACHE_CPP2=true
11+
exec "${CCACHE_PROGRAM}" "${CMAKE_C_COMPILER}" "$@"

cmake/templates/xcode-launch-cxx.in

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
# https://crascit.com/2016/04/09/using-ccache-with-cmake/
3+
4+
# Xcode generator doesn't include the compiler as the
5+
# first argument, Ninja and Makefiles do. Handle both cases.
6+
if [[ "$1" = "${CMAKE_CXX_COMPILER}" ]] ; then
7+
shift
8+
fi
9+
10+
export CCACHE_CPP2=true
11+
exec "${CCACHE_PROGRAM}" "${CMAKE_CXX_COMPILER}" "$@"

modules/dnn/src/onnx/onnx_graph_simplifier.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,19 @@ class ExpandSubgraph : public Subgraph
314314
}
315315
};
316316

317+
class MishSubgraph : public Subgraph
318+
{
319+
public:
320+
MishSubgraph()
321+
{
322+
int input = addNodeToMatch("");
323+
int softplus = addNodeToMatch("Softplus", input);
324+
int tanh = addNodeToMatch("Tanh", softplus);
325+
addNodeToMatch("Mul", input, tanh);
326+
setFusedNode("Mish", input);
327+
}
328+
};
329+
317330
class MulCastSubgraph : public Subgraph
318331
{
319332
public:
@@ -512,6 +525,7 @@ void simplifySubgraphs(opencv_onnx::GraphProto& net)
512525
subgraphs.push_back(makePtr<BatchNormalizationSubgraph1>());
513526
subgraphs.push_back(makePtr<BatchNormalizationSubgraph2>());
514527
subgraphs.push_back(makePtr<ExpandSubgraph>());
528+
subgraphs.push_back(makePtr<MishSubgraph>());
515529

516530
simplifySubgraphs(Ptr<ImportGraphWrapper>(new ONNXGraphWrapper(net)), subgraphs);
517531
}

modules/dnn/test/test_onnx_importer.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,11 @@ TEST_P(Test_ONNX_layers, ResizeOpset11_Torch1_6)
698698
testONNXModels("resize_opset11_torch1.6");
699699
}
700700

701+
TEST_P(Test_ONNX_layers, Mish)
702+
{
703+
testONNXModels("mish");
704+
}
705+
701706
TEST_P(Test_ONNX_layers, Conv1d)
702707
{
703708
testONNXModels("conv1d");

modules/ts/misc/summary.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def getSetName(tset, idx, columns, short = True):
3030
exit(0)
3131

3232
parser = OptionParser()
33-
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")
33+
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")
3434
parser.add_option("-m", "--metric", dest="metric", help="output metric", metavar="NAME", default="gmean")
3535
parser.add_option("-u", "--units", dest="units", help="units for output values (s, ms (default), us, ns or ticks)", metavar="UNITS", default="ms")
3636
parser.add_option("-f", "--filter", dest="filter", help="regex to filter tests", metavar="REGEX", default=None)

modules/ts/misc/table_formatter.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class table(object):
3838
def __init__(self, caption = None, format=None):
3939
self.format = format
4040
self.is_markdown = self.format == 'markdown'
41+
self.is_tabs = self.format == 'tabs'
4142
self.columns = {}
4243
self.rows = []
4344
self.ridx = -1;
@@ -253,7 +254,7 @@ def getValue(self, name, *elements):
253254

254255
def consolePrintTable(self, out):
255256
columns = self.layoutTable()
256-
colrizer = getColorizer(out) if not self.is_markdown else dummyColorizer(out)
257+
colrizer = getColorizer(out) if not (self.is_markdown or self.is_tabs) else dummyColorizer(out)
257258

258259
if self.caption:
259260
out.write("%s%s%s" % ( os.linesep, os.linesep.join(self.reformatTextValue(self.caption)), os.linesep * 2))
@@ -299,6 +300,10 @@ def consolePrintRow2(self, out, r, columns):
299300
text = ' '.join(self.getValue('text', c) or [])
300301
out.write(text + "|")
301302
out.write(os.linesep)
303+
elif self.is_tabs:
304+
cols_to_join=[' '.join(self.getValue('text', c) or []) for c in row.cells]
305+
out.write('\t'.join(cols_to_join))
306+
out.write(os.linesep)
302307
else:
303308
for ln in range(row.minheight):
304309
i = 0

platforms/ios/cmake/Toolchains/common-ios-toolchain.cmake

+15-5
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,20 @@ set(CMAKE_CXX_COMPILER_ABI ELF)
163163
set(CMAKE_CXX_COMPILER_WORKS TRUE)
164164
set(CMAKE_C_COMPILER_WORKS TRUE)
165165

166-
# Search for programs in the build host directories
167-
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
168-
# for libraries and headers in the target directories
169-
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
170-
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
166+
if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
167+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
168+
endif()
169+
170+
if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
171+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
172+
endif()
173+
174+
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
175+
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
176+
endif()
177+
178+
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
179+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
180+
endif()
171181

172182
toolchain_save_config(IOS_ARCH IPHONEOS_DEPLOYMENT_TARGET)

0 commit comments

Comments
 (0)