Merge remote-tracking branch 'upstream/3.4' into merge-3.4

pull/14932/head
Alexander Alekhin 5 years ago
commit 6fdce865b8
  1. 13
      cmake/OpenCVDetectCXXCompiler.cmake
  2. 6
      modules/core/include/opencv2/core/private.hpp
  3. 8
      modules/dnn/src/op_inf_engine.cpp
  4. 15
      modules/dnn/src/op_inf_engine.hpp
  5. 9
      samples/dnn/js_face_recognition.html

@ -83,6 +83,7 @@ if(WIN32 AND CV_GCC)
endif() endif()
endif() endif()
message(STATUS "Detected processor: ${CMAKE_SYSTEM_PROCESSOR}")
if(MSVC64 OR MINGW64) if(MSVC64 OR MINGW64)
set(X86_64 1) set(X86_64 1)
elseif(MINGW OR (MSVC AND NOT CMAKE_CROSSCOMPILING)) elseif(MINGW OR (MSVC AND NOT CMAKE_CROSSCOMPILING))
@ -101,12 +102,18 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
set(PPC64 1) set(PPC64 1)
endif() endif()
# Workaround for 32-bit operating systems on 64-bit x86_64 processor # Workaround for 32-bit operating systems on x86_64/aarch64 processor
if(X86_64 AND CMAKE_SIZEOF_VOID_P EQUAL 4 AND NOT FORCE_X86_64) if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND NOT FORCE_X86_64)
message(STATUS "sizeof(void) = 4 on x86 / x86_64 processor. Assume 32-bit compilation mode (X86=1)") message(STATUS "sizeof(void) = 4 on 64 bit processor. Assume 32-bit compilation mode")
if (X86_64)
unset(X86_64) unset(X86_64)
set(X86 1) set(X86 1)
endif() endif()
if (AARCH64)
unset(AARCH64)
set(ARM 1)
endif()
endif()
# Similar code exists in OpenCVConfig.cmake # Similar code exists in OpenCVConfig.cmake
if(NOT DEFINED OpenCV_STATIC) if(NOT DEFINED OpenCV_STATIC)

@ -709,10 +709,10 @@ CV_EXPORTS InstrNode* getCurrentNode();
#endif #endif
// Instrument region // Instrument region
#define CV_INSTRUMENT_REGION_META(NAME, ALWAYS_EXPAND, TYPE, IMPL) ::cv::instr::IntrumentationRegion __instr_region__(NAME, __FILE__, __LINE__, CV_INSTRUMENT_GET_RETURN_ADDRESS, ALWAYS_EXPAND, TYPE, IMPL); #define CV_INSTRUMENT_REGION_META(NAME, ALWAYS_EXPAND, TYPE, IMPL) ::cv::instr::IntrumentationRegion CVAUX_CONCAT(__instr_region__, __LINE__) (NAME, __FILE__, __LINE__, CV_INSTRUMENT_GET_RETURN_ADDRESS, ALWAYS_EXPAND, TYPE, IMPL);
#define CV_INSTRUMENT_REGION_CUSTOM_META(NAME, ALWAYS_EXPAND, TYPE, IMPL)\ #define CV_INSTRUMENT_REGION_CUSTOM_META(NAME, ALWAYS_EXPAND, TYPE, IMPL)\
void *__curr_address__ = [&]() {return CV_INSTRUMENT_GET_RETURN_ADDRESS;}();\ void *CVAUX_CONCAT(__curr_address__, __LINE__) = [&]() {return CV_INSTRUMENT_GET_RETURN_ADDRESS;}();\
::cv::instr::IntrumentationRegion __instr_region__(NAME, __FILE__, __LINE__, __curr_address__, false, ::cv::instr::TYPE_GENERAL, ::cv::instr::IMPL_PLAIN); ::cv::instr::IntrumentationRegion CVAUX_CONCAT(__instr_region__, __LINE__) (NAME, __FILE__, __LINE__, CVAUX_CONCAT(__curr_address__, __LINE__), false, ::cv::instr::TYPE_GENERAL, ::cv::instr::IMPL_PLAIN);
// Instrument functions with non-void return type // Instrument functions with non-void return type
#define CV_INSTRUMENT_FUN_RT_META(TYPE, IMPL, ERROR_COND, FUN, ...) ([&]()\ #define CV_INSTRUMENT_FUN_RT_META(TYPE, IMPL, ERROR_COND, FUN, ...) ([&]()\
{\ {\

@ -461,6 +461,12 @@ void InfEngineBackendNet::initPlugin(InferenceEngine::ICNNNetwork& net)
CV_LOG_WARNING(NULL, "DNN-IE: Can't load extension plugin (extra layers for some networks). Specify path via OPENCV_DNN_IE_EXTRA_PLUGIN_PATH parameter"); CV_LOG_WARNING(NULL, "DNN-IE: Can't load extension plugin (extra layers for some networks). Specify path via OPENCV_DNN_IE_EXTRA_PLUGIN_PATH parameter");
} }
// Some of networks can work without a library of extra layers. // Some of networks can work without a library of extra layers.
#ifndef _WIN32
// Limit the number of CPU threads.
enginePtr->SetConfig({{
InferenceEngine::PluginConfigParams::KEY_CPU_THREADS_NUM, format("%d", getNumThreads()),
}}, 0);
#endif
} }
plugin = InferenceEngine::InferencePlugin(enginePtr); plugin = InferenceEngine::InferencePlugin(enginePtr);
@ -477,7 +483,7 @@ bool InfEngineBackendNet::isInitialized()
return (bool)enginePtr; return (bool)enginePtr;
} }
void InfEngineBackendNet::addBlobs(const std::vector<Ptr<BackendWrapper> >& ptrs) void InfEngineBackendNet::addBlobs(const std::vector<cv::Ptr<BackendWrapper> >& ptrs)
{ {
auto wrappers = infEngineWrappers(ptrs); auto wrappers = infEngineWrappers(ptrs);
for (const auto& wrapper : wrappers) for (const auto& wrapper : wrappers)

@ -38,7 +38,16 @@
#pragma GCC diagnostic ignored "-Wsuggest-override" #pragma GCC diagnostic ignored "-Wsuggest-override"
#endif #endif
#if defined(__GNUC__) && INF_ENGINE_VER_MAJOR_LE(INF_ENGINE_RELEASE_2019R1) //#define INFERENCE_ENGINE_DEPRECATED // turn off deprecation warnings from IE
//there is no way to suppress warnigns from IE only at this moment, so we are forced to suppress warnings globally
#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#ifdef _MSC_VER
#pragma warning(disable: 4996) // was declared deprecated
#endif
#if defined(__GNUC__)
#pragma GCC visibility push(default) #pragma GCC visibility push(default)
#endif #endif
@ -46,7 +55,7 @@
#include <ie_builders.hpp> #include <ie_builders.hpp>
#if defined(__GNUC__) && INF_ENGINE_VER_MAJOR_LE(INF_ENGINE_RELEASE_2019R1) #if defined(__GNUC__)
#pragma GCC visibility pop #pragma GCC visibility pop
#endif #endif
@ -84,7 +93,7 @@ public:
void initPlugin(InferenceEngine::ICNNNetwork& net); void initPlugin(InferenceEngine::ICNNNetwork& net);
void addBlobs(const std::vector<Ptr<BackendWrapper> >& ptrs); void addBlobs(const std::vector<cv::Ptr<BackendWrapper> >& ptrs);
private: private:
InferenceEngine::Builder::Network netBuilder; InferenceEngine::Builder::Network netBuilder;

@ -12,7 +12,7 @@ var persons = {};
//! [Run face detection model] //! [Run face detection model]
function detectFaces(img) { function detectFaces(img) {
var blob = cv.blobFromImage(img, 1, {width: 128, height: 96}, [104, 177, 123, 0], false, false); var blob = cv.blobFromImage(img, 1, {width: 192, height: 144}, [104, 117, 123, 0], false, false);
netDet.setInput(blob); netDet.setInput(blob);
var out = netDet.forward(); var out = netDet.forward();
@ -186,16 +186,11 @@ function main() {
document.getElementById('startStopButton').disabled = false; document.getElementById('startStopButton').disabled = false;
}; };
// Load opencv.js
cv['onRuntimeInitialized']=()=>{
main();
};
</script> </script>
</head> </head>
<body> <body onload="cv['onRuntimeInitialized']=()=>{ main() }">
<button id="startStopButton" type="button" disabled="true">Start</button> <button id="startStopButton" type="button" disabled="true">Start</button>
<div id="status"></div> <div id="status"></div>
<canvas id="output" width=640 height=480 style="max-width: 100%"></canvas> <canvas id="output" width=640 height=480 style="max-width: 100%"></canvas>

Loading…
Cancel
Save