mirror of
https://github.com/opencv/opencv.git
synced 2024-12-04 00:39:11 +08:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
commit
626bfbf309
@ -5,13 +5,15 @@
|
||||
# AVX / AVX2 / AVX_512F
|
||||
# FMA3
|
||||
#
|
||||
# AVX512 details: https://en.wikipedia.org/wiki/AVX-512#CPUs_with_AVX-512
|
||||
#
|
||||
# CPU features groups:
|
||||
# AVX512_COMMON (Common instructions AVX-512F/CD for all CPUs that support AVX-512)
|
||||
# AVX512_KNL (Knights Landing with AVX-512F/CD/ER/PF)
|
||||
# AVX512_KNM (Knights Mill with AVX-512F/CD/ER/PF/4FMAPS/4VNNIW/VPOPCNTDQ)
|
||||
# AVX512_SKX (Skylake-X with AVX-512F/CD/BW/DQ/VL)
|
||||
# AVX512_CNL (Cannon Lake with AVX-512F/CD/BW/DQ/VL/IFMA/VBMI)
|
||||
# AVX512_CEL (Cascade Lake with AVX-512F/CD/BW/DQ/VL/IFMA/VBMI/VNNI)
|
||||
# AVX512_CLX (Cascade Lake with AVX-512F/CD/BW/DQ/VL/VNNI)
|
||||
# AVX512_ICL (Ice Lake with AVX-512F/CD/BW/DQ/VL/IFMA/VBMI/VNNI/VBMI2/BITALG/VPOPCNTDQ/VPCLMULQDQ*/GFNI*/VAES*)
|
||||
|
||||
# ppc64le arch:
|
||||
@ -43,7 +45,7 @@
|
||||
# CPU_{opt}_ENABLED_DEFAULT=ON/OFF - has compiler support without additional flag (CPU_BASELINE_DETECT=ON only)
|
||||
|
||||
set(CPU_ALL_OPTIMIZATIONS "SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;POPCNT;AVX;FP16;AVX2;FMA3;AVX_512F")
|
||||
list(APPEND CPU_ALL_OPTIMIZATIONS "AVX512_COMMON;AVX512_KNL;AVX512_KNM;AVX512_SKX;AVX512_CNL;AVX512_CEL;AVX512_ICL")
|
||||
list(APPEND CPU_ALL_OPTIMIZATIONS "AVX512_COMMON;AVX512_KNL;AVX512_KNM;AVX512_SKX;AVX512_CNL;AVX512_CLX;AVX512_ICL")
|
||||
list(APPEND CPU_ALL_OPTIMIZATIONS NEON VFPV3 FP16)
|
||||
list(APPEND CPU_ALL_OPTIMIZATIONS MSA)
|
||||
list(APPEND CPU_ALL_OPTIMIZATIONS VSX VSX3)
|
||||
@ -163,15 +165,15 @@ elseif(" ${CMAKE_CXX_FLAGS} " MATCHES " -march=native | -xHost | /QxHost ")
|
||||
endif()
|
||||
|
||||
if(X86 OR X86_64)
|
||||
ocv_update(CPU_KNOWN_OPTIMIZATIONS "SSE;SSE2;SSE3;SSSE3;SSE4_1;POPCNT;SSE4_2;FP16;FMA3;AVX;AVX2;AVX_512F;AVX512_COMMON;AVX512_KNL;AVX512_KNM;AVX512_SKX;AVX512_CNL;AVX512_CEL;AVX512_ICL")
|
||||
ocv_update(CPU_KNOWN_OPTIMIZATIONS "SSE;SSE2;SSE3;SSSE3;SSE4_1;POPCNT;SSE4_2;FP16;FMA3;AVX;AVX2;AVX_512F;AVX512_COMMON;AVX512_KNL;AVX512_KNM;AVX512_SKX;AVX512_CNL;AVX512_CLX;AVX512_ICL")
|
||||
|
||||
ocv_update(CPU_AVX512_COMMON_GROUP "AVX_512F;AVX_512CD")
|
||||
ocv_update(CPU_AVX512_KNL_GROUP "AVX512_COMMON;AVX512_KNL_EXTRA")
|
||||
ocv_update(CPU_AVX512_KNM_GROUP "AVX512_KNL;AVX512_KNM_EXTRA;AVX_512VPOPCNTDQ")
|
||||
ocv_update(CPU_AVX512_SKX_GROUP "AVX512_COMMON;AVX_512VL;AVX_512BW;AVX_512DQ")
|
||||
ocv_update(CPU_AVX512_CNL_GROUP "AVX512_SKX;AVX_512IFMA;AVX_512VBMI")
|
||||
ocv_update(CPU_AVX512_CEL_GROUP "AVX512_CNL;AVX_512VNNI")
|
||||
ocv_update(CPU_AVX512_ICL_GROUP "AVX512_CEL;AVX_512VBMI2;AVX_512BITALG;AVX_512VPOPCNTDQ") # ? VPCLMULQDQ, GFNI, VAES
|
||||
ocv_update(CPU_AVX512_CLX_GROUP "AVX512_SKX;AVX_512VNNI")
|
||||
ocv_update(CPU_AVX512_ICL_GROUP "AVX512_SKX;AVX_512IFMA;AVX_512VBMI;AVX_512VNNI;AVX_512VBMI2;AVX_512BITALG;AVX_512VPOPCNTDQ") # ? VPCLMULQDQ, GFNI, VAES
|
||||
|
||||
ocv_update(CPU_SSE_TEST_FILE "${OpenCV_SOURCE_DIR}/cmake/checks/cpu_sse.cpp")
|
||||
ocv_update(CPU_SSE2_TEST_FILE "${OpenCV_SOURCE_DIR}/cmake/checks/cpu_sse2.cpp")
|
||||
@ -189,12 +191,12 @@ if(X86 OR X86_64)
|
||||
ocv_update(CPU_AVX512_KNM_TEST_FILE "${OpenCV_SOURCE_DIR}/cmake/checks/cpu_avx512knm.cpp")
|
||||
ocv_update(CPU_AVX512_SKX_TEST_FILE "${OpenCV_SOURCE_DIR}/cmake/checks/cpu_avx512skx.cpp")
|
||||
ocv_update(CPU_AVX512_CNL_TEST_FILE "${OpenCV_SOURCE_DIR}/cmake/checks/cpu_avx512cnl.cpp")
|
||||
ocv_update(CPU_AVX512_CEL_TEST_FILE "${OpenCV_SOURCE_DIR}/cmake/checks/cpu_avx512cel.cpp")
|
||||
ocv_update(CPU_AVX512_CLX_TEST_FILE "${OpenCV_SOURCE_DIR}/cmake/checks/cpu_avx512clx.cpp")
|
||||
ocv_update(CPU_AVX512_ICL_TEST_FILE "${OpenCV_SOURCE_DIR}/cmake/checks/cpu_avx512icl.cpp")
|
||||
|
||||
if(NOT OPENCV_CPU_OPT_IMPLIES_IGNORE)
|
||||
ocv_update(CPU_AVX512_ICL_IMPLIES "AVX512_CEL")
|
||||
ocv_update(CPU_AVX512_CEL_IMPLIES "AVX512_CNL")
|
||||
ocv_update(CPU_AVX512_ICL_IMPLIES "AVX512_SKX")
|
||||
ocv_update(CPU_AVX512_CLX_IMPLIES "AVX512_SKX")
|
||||
ocv_update(CPU_AVX512_CNL_IMPLIES "AVX512_SKX")
|
||||
ocv_update(CPU_AVX512_SKX_IMPLIES "AVX512_COMMON")
|
||||
ocv_update(CPU_AVX512_KNM_IMPLIES "AVX512_KNL")
|
||||
@ -251,7 +253,7 @@ if(X86 OR X86_64)
|
||||
ocv_intel_compiler_optimization_option(AVX512_KNM "-xKNM" "/Qx:KNM")
|
||||
ocv_intel_compiler_optimization_option(AVX512_SKX "-xSKYLAKE-AVX512" "/Qx:SKYLAKE-AVX512")
|
||||
ocv_intel_compiler_optimization_option(AVX512_CNL "-xCANNONLAKE" "/Qx:CANNONLAKE")
|
||||
ocv_intel_compiler_optimization_option(AVX512_CEL "-xCASCADELAKE" "/Qx:CASCADELAKE")
|
||||
ocv_intel_compiler_optimization_option(AVX512_CLX "-xCASCADELAKE" "/Qx:CASCADELAKE")
|
||||
ocv_intel_compiler_optimization_option(AVX512_ICL "-xICELAKE-CLIENT" "/Qx:ICELAKE-CLIENT")
|
||||
elseif(CV_GCC OR CV_CLANG)
|
||||
ocv_update(CPU_AVX2_FLAGS_ON "-mavx2")
|
||||
|
@ -80,9 +80,9 @@ endif()
|
||||
|
||||
if(INF_ENGINE_TARGET)
|
||||
if(NOT INF_ENGINE_RELEASE)
|
||||
message(WARNING "InferenceEngine version have not been set, 2019R2 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.")
|
||||
message(WARNING "InferenceEngine version have not been set, 2019R3 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.")
|
||||
endif()
|
||||
set(INF_ENGINE_RELEASE "2019020000" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2018R2.0.2 -> 2018020002)")
|
||||
set(INF_ENGINE_RELEASE "2019030000" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2018R2.0.2 -> 2018020002)")
|
||||
set_target_properties(${INF_ENGINE_TARGET} PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS "HAVE_INF_ENGINE=1;INF_ENGINE_RELEASE=${INF_ENGINE_RELEASE}"
|
||||
)
|
||||
|
@ -3,9 +3,9 @@
|
||||
void test()
|
||||
{
|
||||
__m512i a, b, c;
|
||||
a = _mm512_dpwssd_epi32(a, b, c);
|
||||
a = _mm512_dpwssd_epi32(a, b, c); // VNNI
|
||||
}
|
||||
#else
|
||||
#error "AVX512-CEL is not supported"
|
||||
#error "AVX512-CLX is not supported"
|
||||
#endif
|
||||
int main() { return 0; }
|
||||
int main() { return 0; }
|
@ -3,9 +3,10 @@
|
||||
void test()
|
||||
{
|
||||
__m512i a, b, c;
|
||||
a = _mm512_popcnt_epi8(a);
|
||||
a = _mm512_shrdv_epi64(a, b, c);
|
||||
a = _mm512_popcnt_epi64(a);
|
||||
a = _mm512_popcnt_epi8(a); // BITALG
|
||||
a = _mm512_shrdv_epi64(a, b, c); // VBMI2
|
||||
a = _mm512_popcnt_epi64(a); // VPOPCNTDQ
|
||||
a = _mm512_dpwssd_epi32(a, b, c); // VNNI
|
||||
}
|
||||
#else
|
||||
#error "AVX512-ICL is not supported"
|
||||
|
@ -5,7 +5,7 @@ Goals
|
||||
-----
|
||||
|
||||
In this tutorial We will learn to setup OpenCV-Python in Ubuntu System.
|
||||
Below steps are tested for Ubuntu 16.04 (64-bit) and Ubuntu 14.04 (32-bit).
|
||||
Below steps are tested for Ubuntu 16.04 and 18.04 (both 64-bit).
|
||||
|
||||
OpenCV-Python can be installed in Ubuntu in two ways:
|
||||
- Install from pre-built binaries available in Ubuntu repositories
|
||||
@ -62,17 +62,36 @@ We need **CMake** to configure the installation, **GCC** for compilation, **Pyth
|
||||
|
||||
```
|
||||
sudo apt-get install cmake
|
||||
sudo apt-get install python-dev python-numpy
|
||||
sudo apt-get install gcc g++
|
||||
```
|
||||
to support python2:
|
||||
|
||||
```
|
||||
sudo apt-get install python-dev python-numpy
|
||||
```
|
||||
|
||||
to support python3:
|
||||
|
||||
```
|
||||
sudo apt-get install python3-dev python3-numpy
|
||||
```
|
||||
|
||||
Next we need **GTK** support for GUI features, Camera support (v4l), Media Support
|
||||
(ffmpeg, gstreamer) etc.
|
||||
|
||||
```
|
||||
sudo apt-get install gtk2-devel
|
||||
sudo apt-get install ffmpeg-devel
|
||||
sudo apt-get install gstreamer-plugins-base-devel
|
||||
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev
|
||||
sudo apt-get install libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
|
||||
```
|
||||
|
||||
to support gtk2:
|
||||
```
|
||||
sudo apt-get install libgtk2.0-dev
|
||||
```
|
||||
|
||||
to support gtk3:
|
||||
```
|
||||
sudo apt-get install libgtk-3-dev
|
||||
```
|
||||
|
||||
### Optional Dependencies
|
||||
@ -86,14 +105,15 @@ But it may be a little old.
|
||||
If you want to get latest libraries, you can install development files for system libraries of these formats.
|
||||
|
||||
```
|
||||
sudo apt-get install libpng-devel
|
||||
sudo apt-get install libjpeg-turbo-devel
|
||||
sudo apt-get install jasper-devel
|
||||
sudo apt-get install openexr-devel
|
||||
sudo apt-get install libtiff-devel
|
||||
sudo apt-get install libwebp-devel
|
||||
sudo apt-get install libpng-dev
|
||||
sudo apt-get install libjpeg-dev
|
||||
sudo apt-get install libopenexr-dev
|
||||
sudo apt-get install libtiff-dev
|
||||
sudo apt-get install libwebp-dev
|
||||
```
|
||||
|
||||
@note If you are using Ubuntu 16.04 you can also install ```libjasper-dev``` to add a system level support for the JPEG2000 format.
|
||||
|
||||
### Downloading OpenCV
|
||||
|
||||
To download the latest source from OpenCV's [GitHub Repository](https://github.com/opencv/opencv).
|
||||
|
@ -113,12 +113,18 @@
|
||||
# define CV_AVX_512IFMA 1
|
||||
# define CV_AVX_512VBMI 1
|
||||
#endif
|
||||
#ifdef CV_CPU_COMPILE_AVX512_CEL
|
||||
# define CV_AVX512_CEL 1
|
||||
#ifdef CV_CPU_COMPILE_AVX512_CLX
|
||||
# define CV_AVX512_CLX 1
|
||||
# define CV_AVX_512VNNI 1
|
||||
#endif
|
||||
#ifdef CV_CPU_COMPILE_AVX512_ICL
|
||||
# define CV_AVX512_ICL 1
|
||||
# undef CV_AVX_512IFMA
|
||||
# define CV_AVX_512IFMA 1
|
||||
# undef CV_AVX_512VBMI
|
||||
# define CV_AVX_512VBMI 1
|
||||
# undef CV_AVX_512VNNI
|
||||
# define CV_AVX_512VNNI 1
|
||||
# define CV_AVX_512VBMI2 1
|
||||
# define CV_AVX_512BITALG 1
|
||||
# define CV_AVX_512VPOPCNTDQ 1
|
||||
@ -311,8 +317,8 @@ struct VZeroUpperGuard {
|
||||
#ifndef CV_AVX512_CNL
|
||||
# define CV_AVX512_CNL 0
|
||||
#endif
|
||||
#ifndef CV_AVX512_CEL
|
||||
# define CV_AVX512_CEL 0
|
||||
#ifndef CV_AVX512_CLX
|
||||
# define CV_AVX512_CLX 0
|
||||
#endif
|
||||
#ifndef CV_AVX512_ICL
|
||||
# define CV_AVX512_ICL 0
|
||||
|
@ -357,26 +357,26 @@
|
||||
#endif
|
||||
#define __CV_CPU_DISPATCH_CHAIN_AVX512_CNL(fn, args, mode, ...) CV_CPU_CALL_AVX512_CNL(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
|
||||
|
||||
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_AVX512_CEL
|
||||
# define CV_TRY_AVX512_CEL 1
|
||||
# define CV_CPU_FORCE_AVX512_CEL 1
|
||||
# define CV_CPU_HAS_SUPPORT_AVX512_CEL 1
|
||||
# define CV_CPU_CALL_AVX512_CEL(fn, args) return (cpu_baseline::fn args)
|
||||
# define CV_CPU_CALL_AVX512_CEL_(fn, args) return (opt_AVX512_CEL::fn args)
|
||||
#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_AVX512_CEL
|
||||
# define CV_TRY_AVX512_CEL 1
|
||||
# define CV_CPU_FORCE_AVX512_CEL 0
|
||||
# define CV_CPU_HAS_SUPPORT_AVX512_CEL (cv::checkHardwareSupport(CV_CPU_AVX512_CEL))
|
||||
# define CV_CPU_CALL_AVX512_CEL(fn, args) if (CV_CPU_HAS_SUPPORT_AVX512_CEL) return (opt_AVX512_CEL::fn args)
|
||||
# define CV_CPU_CALL_AVX512_CEL_(fn, args) if (CV_CPU_HAS_SUPPORT_AVX512_CEL) return (opt_AVX512_CEL::fn args)
|
||||
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_AVX512_CLX
|
||||
# define CV_TRY_AVX512_CLX 1
|
||||
# define CV_CPU_FORCE_AVX512_CLX 1
|
||||
# define CV_CPU_HAS_SUPPORT_AVX512_CLX 1
|
||||
# define CV_CPU_CALL_AVX512_CLX(fn, args) return (cpu_baseline::fn args)
|
||||
# define CV_CPU_CALL_AVX512_CLX_(fn, args) return (opt_AVX512_CLX::fn args)
|
||||
#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_AVX512_CLX
|
||||
# define CV_TRY_AVX512_CLX 1
|
||||
# define CV_CPU_FORCE_AVX512_CLX 0
|
||||
# define CV_CPU_HAS_SUPPORT_AVX512_CLX (cv::checkHardwareSupport(CV_CPU_AVX512_CLX))
|
||||
# define CV_CPU_CALL_AVX512_CLX(fn, args) if (CV_CPU_HAS_SUPPORT_AVX512_CLX) return (opt_AVX512_CLX::fn args)
|
||||
# define CV_CPU_CALL_AVX512_CLX_(fn, args) if (CV_CPU_HAS_SUPPORT_AVX512_CLX) return (opt_AVX512_CLX::fn args)
|
||||
#else
|
||||
# define CV_TRY_AVX512_CEL 0
|
||||
# define CV_CPU_FORCE_AVX512_CEL 0
|
||||
# define CV_CPU_HAS_SUPPORT_AVX512_CEL 0
|
||||
# define CV_CPU_CALL_AVX512_CEL(fn, args)
|
||||
# define CV_CPU_CALL_AVX512_CEL_(fn, args)
|
||||
# define CV_TRY_AVX512_CLX 0
|
||||
# define CV_CPU_FORCE_AVX512_CLX 0
|
||||
# define CV_CPU_HAS_SUPPORT_AVX512_CLX 0
|
||||
# define CV_CPU_CALL_AVX512_CLX(fn, args)
|
||||
# define CV_CPU_CALL_AVX512_CLX_(fn, args)
|
||||
#endif
|
||||
#define __CV_CPU_DISPATCH_CHAIN_AVX512_CEL(fn, args, mode, ...) CV_CPU_CALL_AVX512_CEL(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
|
||||
#define __CV_CPU_DISPATCH_CHAIN_AVX512_CLX(fn, args, mode, ...) CV_CPU_CALL_AVX512_CLX(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
|
||||
|
||||
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_AVX512_ICL
|
||||
# define CV_TRY_AVX512_ICL 1
|
||||
|
@ -255,7 +255,7 @@ namespace cv { namespace debug_build_guard { } using namespace debug_build_guard
|
||||
#define CV_CPU_AVX512_KNL 258
|
||||
#define CV_CPU_AVX512_KNM 259
|
||||
#define CV_CPU_AVX512_CNL 260
|
||||
#define CV_CPU_AVX512_CEL 261
|
||||
#define CV_CPU_AVX512_CLX 261
|
||||
#define CV_CPU_AVX512_ICL 262
|
||||
|
||||
// when adding to this list remember to update the following enum
|
||||
@ -306,7 +306,7 @@ enum CpuFeatures {
|
||||
CPU_AVX512_KNL = 258, //!< Knights Landing with AVX-512F/CD/ER/PF
|
||||
CPU_AVX512_KNM = 259, //!< Knights Mill with AVX-512F/CD/ER/PF/4FMAPS/4VNNIW/VPOPCNTDQ
|
||||
CPU_AVX512_CNL = 260, //!< Cannon Lake with AVX-512F/CD/BW/DQ/VL/IFMA/VBMI
|
||||
CPU_AVX512_CEL = 261, //!< Cascade Lake with AVX-512F/CD/BW/DQ/VL/IFMA/VBMI/VNNI
|
||||
CPU_AVX512_CLX = 261, //!< Cascade Lake with AVX-512F/CD/BW/DQ/VL/VNNI
|
||||
CPU_AVX512_ICL = 262, //!< Ice Lake with AVX-512F/CD/BW/DQ/VL/IFMA/VBMI/VNNI/VBMI2/BITALG/VPOPCNTDQ
|
||||
|
||||
CPU_MAX_FEATURE = 512 // see CV_HARDWARE_MAX_FEATURE
|
||||
|
@ -2065,13 +2065,17 @@ static int_fast64_t f64_to_i64(float64_t a, uint_fast8_t roundingMode, bool exac
|
||||
if (exp) sig |= UINT64_C(0x0010000000000000);
|
||||
shiftDist = 0x433 - exp;
|
||||
if (shiftDist <= 0) {
|
||||
uint_fast64_t z = sig << -shiftDist;
|
||||
if ((shiftDist < -11) || (z & UINT64_C(0x8000000000000000)))
|
||||
bool isValid = shiftDist >= -11;
|
||||
if (isValid)
|
||||
{
|
||||
raiseFlags(flag_invalid);
|
||||
return sign ? i64_fromNegOverflow : i64_fromPosOverflow;
|
||||
uint_fast64_t z = sig << -shiftDist;
|
||||
if (0 == (z & UINT64_C(0x8000000000000000)))
|
||||
{
|
||||
return sign ? -(int_fast64_t)z : (int_fast64_t)z;
|
||||
}
|
||||
}
|
||||
return sign ? -(int_fast64_t)z : (int_fast64_t)z;
|
||||
raiseFlags(flag_invalid);
|
||||
return sign ? i64_fromNegOverflow : i64_fromPosOverflow;
|
||||
}
|
||||
else {
|
||||
if (shiftDist < 64)
|
||||
|
@ -370,11 +370,12 @@ struct HWFeatures
|
||||
|
||||
g_hwFeatureNames[CPU_MSA] = "CPU_MSA";
|
||||
|
||||
g_hwFeatureNames[CPU_AVX512_COMMON] = "AVX512-COMMON";
|
||||
g_hwFeatureNames[CPU_AVX512_SKX] = "AVX512-SKX";
|
||||
g_hwFeatureNames[CPU_AVX512_KNL] = "AVX512-KNL";
|
||||
g_hwFeatureNames[CPU_AVX512_KNM] = "AVX512-KNM";
|
||||
g_hwFeatureNames[CPU_AVX512_CNL] = "AVX512-CNL";
|
||||
g_hwFeatureNames[CPU_AVX512_CEL] = "AVX512-CEL";
|
||||
g_hwFeatureNames[CPU_AVX512_CLX] = "AVX512-CLX";
|
||||
g_hwFeatureNames[CPU_AVX512_ICL] = "AVX512-ICL";
|
||||
}
|
||||
|
||||
@ -485,9 +486,11 @@ struct HWFeatures
|
||||
have[CV_CPU_AVX_5124VNNIW] && have[CV_CPU_AVX_512VPOPCNTDQ];
|
||||
have[CV_CPU_AVX512_SKX] = have[CV_CPU_AVX_512BW] && have[CV_CPU_AVX_512DQ] && have[CV_CPU_AVX_512VL];
|
||||
have[CV_CPU_AVX512_CNL] = have[CV_CPU_AVX512_SKX] && have[CV_CPU_AVX_512IFMA] && have[CV_CPU_AVX_512VBMI];
|
||||
have[CV_CPU_AVX512_CEL] = have[CV_CPU_AVX512_CNL] && have[CV_CPU_AVX_512VNNI];
|
||||
have[CV_CPU_AVX512_ICL] = have[CV_CPU_AVX512_CEL] && have[CV_CPU_AVX_512VBMI2] &&
|
||||
have[CV_CPU_AVX_512BITALG] && have[CV_CPU_AVX_512VPOPCNTDQ];
|
||||
have[CV_CPU_AVX512_CLX] = have[CV_CPU_AVX512_SKX] && have[CV_CPU_AVX_512VNNI];
|
||||
have[CV_CPU_AVX512_ICL] = have[CV_CPU_AVX512_SKX] &&
|
||||
have[CV_CPU_AVX_512IFMA] && have[CV_CPU_AVX_512VBMI] &&
|
||||
have[CV_CPU_AVX_512VNNI] &&
|
||||
have[CV_CPU_AVX_512VBMI2] && have[CV_CPU_AVX_512BITALG] && have[CV_CPU_AVX_512VPOPCNTDQ];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -495,7 +498,7 @@ struct HWFeatures
|
||||
have[CV_CPU_AVX512_KNM] = false;
|
||||
have[CV_CPU_AVX512_SKX] = false;
|
||||
have[CV_CPU_AVX512_CNL] = false;
|
||||
have[CV_CPU_AVX512_CEL] = false;
|
||||
have[CV_CPU_AVX512_CLX] = false;
|
||||
have[CV_CPU_AVX512_ICL] = false;
|
||||
}
|
||||
}
|
||||
@ -572,8 +575,16 @@ struct HWFeatures
|
||||
have[CV_CPU_VSX3] = (CV_VSX3);
|
||||
#endif
|
||||
|
||||
bool skip_baseline_check = false;
|
||||
#ifndef NO_GETENV
|
||||
if (getenv("OPENCV_SKIP_CPU_BASELINE_CHECK"))
|
||||
{
|
||||
skip_baseline_check = true;
|
||||
}
|
||||
#endif
|
||||
int baseline_features[] = { CV_CPU_BASELINE_FEATURES };
|
||||
if (!checkFeatures(baseline_features, sizeof(baseline_features) / sizeof(baseline_features[0])))
|
||||
if (!checkFeatures(baseline_features, sizeof(baseline_features) / sizeof(baseline_features[0]))
|
||||
&& !skip_baseline_check)
|
||||
{
|
||||
fprintf(stderr, "\n"
|
||||
"******************************************************************\n"
|
||||
@ -600,12 +611,12 @@ struct HWFeatures
|
||||
{
|
||||
if (have[feature])
|
||||
{
|
||||
if (dump) fprintf(stderr, "%s - OK\n", getHWFeatureNameSafe(feature));
|
||||
if (dump) fprintf(stderr, " ID=%3d (%s) - OK\n", feature, getHWFeatureNameSafe(feature));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
if (dump) fprintf(stderr, "%s - NOT AVAILABLE\n", getHWFeatureNameSafe(feature));
|
||||
if (dump) fprintf(stderr, " ID=%3d (%s) - NOT AVAILABLE\n", feature, getHWFeatureNameSafe(feature));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,11 +64,19 @@ def printParams(backend, target):
|
||||
|
||||
testdata_required = bool(os.environ.get('OPENCV_DNN_TEST_REQUIRE_TESTDATA', False))
|
||||
|
||||
g_dnnBackendsAndTargets = None
|
||||
|
||||
class dnn_test(NewOpenCVTests):
|
||||
|
||||
def setUp(self):
|
||||
super(dnn_test, self).setUp()
|
||||
|
||||
global g_dnnBackendsAndTargets
|
||||
if g_dnnBackendsAndTargets is None:
|
||||
g_dnnBackendsAndTargets = self.initBackendsAndTargets()
|
||||
self.dnnBackendsAndTargets = g_dnnBackendsAndTargets
|
||||
|
||||
def initBackendsAndTargets(self):
|
||||
self.dnnBackendsAndTargets = [
|
||||
[cv.dnn.DNN_BACKEND_OPENCV, cv.dnn.DNN_TARGET_CPU],
|
||||
]
|
||||
@ -86,6 +94,7 @@ class dnn_test(NewOpenCVTests):
|
||||
self.dnnBackendsAndTargets.append([cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_TARGET_OPENCL])
|
||||
if self.checkIETarget(cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_TARGET_OPENCL_FP16):
|
||||
self.dnnBackendsAndTargets.append([cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_TARGET_OPENCL_FP16])
|
||||
return self.dnnBackendsAndTargets
|
||||
|
||||
def find_dnn_file(self, filename, required=True):
|
||||
if not required:
|
||||
|
@ -163,6 +163,8 @@ public:
|
||||
{
|
||||
if (backendId == DNN_BACKEND_INFERENCE_ENGINE)
|
||||
{
|
||||
if (computeMaxIdx)
|
||||
return false;
|
||||
#ifdef HAVE_INF_ENGINE
|
||||
if (kernel_size.size() == 3)
|
||||
return preferableTarget == DNN_TARGET_CPU;
|
||||
|
@ -22,10 +22,11 @@
|
||||
#define INF_ENGINE_RELEASE_2018R5 2018050000
|
||||
#define INF_ENGINE_RELEASE_2019R1 2019010000
|
||||
#define INF_ENGINE_RELEASE_2019R2 2019020000
|
||||
#define INF_ENGINE_RELEASE_2019R3 2019030000
|
||||
|
||||
#ifndef INF_ENGINE_RELEASE
|
||||
#warning("IE version have not been provided via command-line. Using 2019R2 by default")
|
||||
#define INF_ENGINE_RELEASE INF_ENGINE_RELEASE_2019R2
|
||||
#warning("IE version have not been provided via command-line. Using 2019R3 by default")
|
||||
#define INF_ENGINE_RELEASE INF_ENGINE_RELEASE_2019R3
|
||||
#endif
|
||||
|
||||
#define INF_ENGINE_VER_MAJOR_GT(ver) (((INF_ENGINE_RELEASE) / 10000) > ((ver) / 10000))
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define CV_TEST_TAG_DNN_SKIP_IE_2019R1 "dnn_skip_ie_2019r1"
|
||||
#define CV_TEST_TAG_DNN_SKIP_IE_2019R1_1 "dnn_skip_ie_2019r1_1"
|
||||
#define CV_TEST_TAG_DNN_SKIP_IE_2019R2 "dnn_skip_ie_2019r2"
|
||||
#define CV_TEST_TAG_DNN_SKIP_IE_2019R3 "dnn_skip_ie_2019r3"
|
||||
#define CV_TEST_TAG_DNN_SKIP_IE_OPENCL "dnn_skip_ie_ocl"
|
||||
#define CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16 "dnn_skip_ie_ocl_fp16"
|
||||
#define CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_2 "dnn_skip_ie_myriad2"
|
||||
|
@ -324,6 +324,8 @@ void initDNNTests()
|
||||
# endif
|
||||
#elif INF_ENGINE_VER_MAJOR_EQ(2019020000)
|
||||
CV_TEST_TAG_DNN_SKIP_IE_2019R2,
|
||||
#elif INF_ENGINE_VER_MAJOR_EQ(2019030000)
|
||||
CV_TEST_TAG_DNN_SKIP_IE_2019R3,
|
||||
#endif
|
||||
CV_TEST_TAG_DNN_SKIP_IE
|
||||
);
|
||||
|
@ -554,9 +554,9 @@ TEST_P(ReLU, Accuracy)
|
||||
Backend backendId = get<0>(get<1>(GetParam()));
|
||||
Target targetId = get<1>(get<1>(GetParam()));
|
||||
|
||||
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2019020000)
|
||||
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GE(2019020000)
|
||||
if (backendId == DNN_BACKEND_INFERENCE_ENGINE && targetId == DNN_TARGET_MYRIAD && negativeSlope < 0)
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE, CV_TEST_TAG_DNN_SKIP_IE_2019R2);
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_2019R3, CV_TEST_TAG_DNN_SKIP_IE_2019R2, CV_TEST_TAG_DNN_SKIP_IE);
|
||||
#endif
|
||||
|
||||
LayerParams lp;
|
||||
|
@ -86,8 +86,8 @@ TEST_P(Test_ONNX_layers, InstanceNorm)
|
||||
|
||||
TEST_P(Test_ONNX_layers, MaxPooling)
|
||||
{
|
||||
testONNXModels("maxpooling");
|
||||
testONNXModels("two_maxpooling");
|
||||
testONNXModels("maxpooling", npy, 0, 0, false, false);
|
||||
testONNXModels("two_maxpooling", npy, 0, 0, false, false);
|
||||
}
|
||||
|
||||
TEST_P(Test_ONNX_layers, Convolution)
|
||||
@ -212,7 +212,7 @@ TEST_P(Test_ONNX_layers, MaxPooling3D)
|
||||
#endif
|
||||
if (target != DNN_TARGET_CPU)
|
||||
throw SkipTestException("Only CPU is supported");
|
||||
testONNXModels("max_pool3d");
|
||||
testONNXModels("max_pool3d", npy, 0, 0, false, false);
|
||||
}
|
||||
|
||||
TEST_P(Test_ONNX_layers, AvePooling3D)
|
||||
@ -422,13 +422,22 @@ TEST_P(Test_ONNX_nets, Googlenet)
|
||||
TEST_P(Test_ONNX_nets, CaffeNet)
|
||||
{
|
||||
applyTestTag(target == DNN_TARGET_CPU ? CV_TEST_TAG_MEMORY_512MB : CV_TEST_TAG_MEMORY_1GB);
|
||||
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2019030000)
|
||||
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD
|
||||
&& getInferenceEngineVPUType() == CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X)
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X, CV_TEST_TAG_DNN_SKIP_IE_2019R3);
|
||||
#endif
|
||||
testONNXModels("caffenet", pb);
|
||||
}
|
||||
|
||||
TEST_P(Test_ONNX_nets, RCNN_ILSVRC13)
|
||||
{
|
||||
applyTestTag(target == DNN_TARGET_CPU ? CV_TEST_TAG_MEMORY_512MB : CV_TEST_TAG_MEMORY_1GB);
|
||||
|
||||
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2019030000)
|
||||
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD
|
||||
&& getInferenceEngineVPUType() == CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X)
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X, CV_TEST_TAG_DNN_SKIP_IE_2019R3);
|
||||
#endif
|
||||
// Reference output values are in range [-4.992, -1.161]
|
||||
testONNXModels("rcnn_ilsvrc13", pb, 0.0045);
|
||||
}
|
||||
|
@ -146,13 +146,13 @@ TEST_P(Test_TensorFlow_layers, padding)
|
||||
runTensorFlowNet("padding_valid");
|
||||
runTensorFlowNet("spatial_padding");
|
||||
runTensorFlowNet("mirror_pad");
|
||||
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2019020000)
|
||||
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GE(2019020000)
|
||||
if (backend == DNN_BACKEND_INFERENCE_ENGINE)
|
||||
{
|
||||
if (target == DNN_TARGET_MYRIAD)
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_2019R2);
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_2019R3, CV_TEST_TAG_DNN_SKIP_IE_2019R2);
|
||||
if (target == DNN_TARGET_OPENCL_FP16)
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, CV_TEST_TAG_DNN_SKIP_IE_2019R2);
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, CV_TEST_TAG_DNN_SKIP_IE_2019R3, CV_TEST_TAG_DNN_SKIP_IE_2019R2);
|
||||
}
|
||||
#endif
|
||||
runTensorFlowNet("keras_pad_concat");
|
||||
|
@ -337,9 +337,15 @@ TEST_P(Test_Torch_nets, ENet_accuracy)
|
||||
{
|
||||
applyTestTag(target == DNN_TARGET_CPU ? "" : CV_TEST_TAG_MEMORY_512MB);
|
||||
checkBackend();
|
||||
if (backend == DNN_BACKEND_INFERENCE_ENGINE ||
|
||||
(backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16))
|
||||
applyTestTag(target == DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16);
|
||||
if (backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16)
|
||||
throw SkipTestException("");
|
||||
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target != DNN_TARGET_CPU)
|
||||
{
|
||||
if (target == DNN_TARGET_OPENCL_FP16) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16);
|
||||
if (target == DNN_TARGET_OPENCL) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL);
|
||||
if (target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD);
|
||||
throw SkipTestException("");
|
||||
}
|
||||
|
||||
Net net;
|
||||
{
|
||||
|
@ -807,7 +807,7 @@ public class ImgprocTest extends OpenCVTestCase {
|
||||
points.put(0, 0, 0, 0, 2, 3, 3, 4, 5, 8);
|
||||
|
||||
Mat linePoints = new Mat(4, 1, CvType.CV_32FC1);
|
||||
linePoints.put(0, 0, 0.53196341, 0.84676737, 2.496531, 3.7467217);
|
||||
linePoints.put(0, 0, 0.53198653, 0.84675282, 2.5, 3.75);
|
||||
|
||||
Imgproc.fitLine(points, dst, Imgproc.CV_DIST_L12, 0, 0.01, 0.01);
|
||||
|
||||
|
@ -408,8 +408,14 @@ static void fitLine2D( const Point2f * points, int count, int dist,
|
||||
}
|
||||
/* calculate distances */
|
||||
err = calcDist2D( points, count, _line, r );
|
||||
if( err < EPS )
|
||||
break;
|
||||
|
||||
if (err < min_err)
|
||||
{
|
||||
min_err = err;
|
||||
memcpy(line, _line, 4 * sizeof(line[0]));
|
||||
if (err < EPS)
|
||||
break;
|
||||
}
|
||||
|
||||
/* calculate weights */
|
||||
if( calc_weights )
|
||||
@ -550,8 +556,13 @@ static void fitLine3D( Point3f * points, int count, int dist,
|
||||
}
|
||||
/* calculate distances */
|
||||
err = calcDist3D( points, count, _line, r );
|
||||
//if( err < FLT_EPSILON*count )
|
||||
// break;
|
||||
if (err < min_err)
|
||||
{
|
||||
min_err = err;
|
||||
memcpy(line, _line, 6 * sizeof(line[0]));
|
||||
if (err < EPS)
|
||||
break;
|
||||
}
|
||||
|
||||
/* calculate weights */
|
||||
if( calc_weights )
|
||||
|
@ -1609,6 +1609,8 @@ int CV_FitLineTest::validate_test_results( int test_case_idx )
|
||||
int k, max_k = 0;
|
||||
double vec_diff = 0, t;
|
||||
|
||||
//std::cout << dims << " " << Mat(1, dims*2, CV_32FC1, line.data()) << " " << Mat(1, dims, CV_32FC1, line0.data()) << std::endl;
|
||||
|
||||
for( k = 0; k < dims*2; k++ )
|
||||
{
|
||||
if( cvIsNaN(line[k]) || cvIsInf(line[k]) )
|
||||
@ -2038,5 +2040,38 @@ INSTANTIATE_TEST_CASE_P(Imgproc, ConvexityDefects_regression_5908,
|
||||
testing::Values(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
|
||||
));
|
||||
|
||||
TEST(Imgproc_FitLine, regression_15083)
|
||||
{
|
||||
int points2i_[] = {
|
||||
432, 654,
|
||||
370, 656,
|
||||
390, 656,
|
||||
410, 656,
|
||||
348, 658
|
||||
};
|
||||
Mat points(5, 1, CV_32SC2, points2i_);
|
||||
|
||||
Vec4f lineParam;
|
||||
fitLine(points, lineParam, DIST_L1, 0, 0.01, 0.01);
|
||||
EXPECT_GE(fabs(lineParam[0]), fabs(lineParam[1]) * 4) << lineParam;
|
||||
}
|
||||
|
||||
TEST(Imgproc_FitLine, regression_4903)
|
||||
{
|
||||
float points2f_[] = {
|
||||
1224.0, 576.0,
|
||||
1234.0, 683.0,
|
||||
1215.0, 471.0,
|
||||
1184.0, 137.0,
|
||||
1079.0, 377.0,
|
||||
1239.0, 788.0,
|
||||
};
|
||||
Mat points(6, 1, CV_32FC2, points2f_);
|
||||
|
||||
Vec4f lineParam;
|
||||
fitLine(points, lineParam, DIST_WELSCH, 0, 0.01, 0.01);
|
||||
EXPECT_GE(fabs(lineParam[1]), fabs(lineParam[0]) * 4) << lineParam;
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
/* End of file. */
|
||||
|
@ -359,22 +359,26 @@ bool QRDetect::localization()
|
||||
|
||||
bool suare_flag = false, local_points_flag = false;
|
||||
double triangle_sides[3];
|
||||
triangle_sides[0] = norm(localization_points[0] - localization_points[1]);
|
||||
triangle_sides[1] = norm(localization_points[1] - localization_points[2]);
|
||||
triangle_sides[2] = norm(localization_points[2] - localization_points[0]);
|
||||
|
||||
double triangle_perim = (triangle_sides[0] + triangle_sides[1] + triangle_sides[2]) / 2;
|
||||
|
||||
double square_area = sqrt((triangle_perim * (triangle_perim - triangle_sides[0])
|
||||
* (triangle_perim - triangle_sides[1])
|
||||
* (triangle_perim - triangle_sides[2]))) * 2;
|
||||
double img_square_area = bin_barcode.cols * bin_barcode.rows;
|
||||
|
||||
if (square_area > (img_square_area * 0.2))
|
||||
double triangle_perim, square_area, img_square_area;
|
||||
if (localization_points.size() == 3)
|
||||
{
|
||||
suare_flag = true;
|
||||
triangle_sides[0] = norm(localization_points[0] - localization_points[1]);
|
||||
triangle_sides[1] = norm(localization_points[1] - localization_points[2]);
|
||||
triangle_sides[2] = norm(localization_points[2] - localization_points[0]);
|
||||
|
||||
triangle_perim = (triangle_sides[0] + triangle_sides[1] + triangle_sides[2]) / 2;
|
||||
|
||||
square_area = sqrt((triangle_perim * (triangle_perim - triangle_sides[0])
|
||||
* (triangle_perim - triangle_sides[1])
|
||||
* (triangle_perim - triangle_sides[2]))) * 2;
|
||||
img_square_area = bin_barcode.cols * bin_barcode.rows;
|
||||
|
||||
if (square_area > (img_square_area * 0.2))
|
||||
{
|
||||
suare_flag = true;
|
||||
}
|
||||
}
|
||||
if (localization_points.size() != 3)
|
||||
else
|
||||
{
|
||||
local_points_flag = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user