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

pull/15237/head
Alexander Alekhin 6 years ago
commit 174b4ce29d
  1. 2
      3rdparty/carotene/hal/tegra_hal.hpp
  2. 2
      CMakeLists.txt
  3. 10
      cmake/templates/dllmain.cpp.in
  4. 2
      doc/js_tutorials/js_setup/js_setup/js_setup.markdown
  5. 7
      modules/core/misc/java/src/java/core+Mat.java
  6. 4
      modules/core/src/glob.cpp
  7. 6
      modules/core/src/mean.dispatch.cpp
  8. 15
      modules/core/src/utils/datafile.cpp
  9. 207
      modules/dnn/misc/caffe/opencv-caffe.pb.cc
  10. 174
      modules/dnn/misc/caffe/opencv-caffe.pb.h
  11. 9
      modules/dnn/misc/face_detector_accuracy.py
  12. 4
      modules/dnn/misc/quantize_face_detector.py
  13. 4
      modules/dnn/perf/perf_net.cpp
  14. 4
      modules/dnn/src/caffe/opencv-caffe.proto
  15. 3
      modules/dnn/src/layers/detection_output_layer.cpp
  16. 2
      modules/dnn/src/layers/elementwise_layers.cpp
  17. 64
      modules/dnn/src/layers/prior_box_layer.cpp
  18. 41
      modules/dnn/src/onnx/onnx_importer.cpp
  19. 10
      modules/dnn/test/test_backends.cpp
  20. 4
      modules/dnn/test/test_caffe_importer.cpp
  21. 2
      modules/dnn/test/test_darknet_importer.cpp
  22. 23
      modules/dnn/test/test_layers.cpp
  23. 15
      modules/dnn/test/test_onnx_importer.cpp
  24. 12
      modules/dnn/test/test_tf_importer.cpp
  25. 4
      modules/imgcodecs/src/exif.cpp
  26. 5
      modules/imgcodecs/src/exif.hpp
  27. 2
      modules/imgproc/perf/perf_cvt_color.cpp
  28. 4
      modules/imgproc/src/box_filter.dispatch.cpp
  29. 10
      modules/imgproc/src/demosaicing.cpp
  30. 6
      modules/imgproc/src/filter.dispatch.cpp
  31. 4
      modules/imgproc/src/median_blur.dispatch.cpp
  32. 4
      modules/imgproc/src/smooth.dispatch.cpp
  33. 4
      modules/videoio/src/cap_v4l.cpp
  34. 4
      modules/videoio/test/test_video_io.cpp
  35. 4
      platforms/wince/arm-wince-headless-overrides.cmake
  36. 8
      platforms/wince/readme.md
  37. 1
      samples/dnn/face_detector/deploy.prototxt
  38. 10
      samples/dnn/face_detector/opencv_face_detector.pbtxt
  39. 5
      samples/dnn/face_detector/test.prototxt
  40. 4
      samples/dnn/face_detector/train.prototxt
  41. 10
      samples/dnn/tf_text_graph_ssd.py

@ -1127,6 +1127,7 @@ inline int TEGRA_FILTERINIT(cvhalFilter2D **context, uchar *kernel_data, size_t
{
std::memcpy(ctx->kernel_data + kernel_width * j, kernel_data + kernel_step * j, kernel_width * sizeof(int16_t));
}
break;
default:
delete[] ctx->kernel_data;
delete ctx;
@ -1243,6 +1244,7 @@ inline int TEGRA_SEPFILTERINIT(cvhalFilter2D **context, int src_type, int dst_ty
ctx->kernely_data[0]=((int16_t*)kernely_data)[0];
ctx->kernely_data[1]=((int16_t*)kernely_data)[1];
ctx->kernely_data[2]=((int16_t*)kernely_data)[2];
break;
default:
delete ctx;
return CV_HAL_ERROR_NOT_IMPLEMENTED;

@ -465,7 +465,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_PRECOMPILED_HEADERS "Use precompiled headers" ON IF (MSVC OR (NOT IOS AND NOT CMAKE_CROSSCOMPILING) ) )
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 )
OCV_OPTION(ENABLE_COVERAGE "Enable coverage collection with GCov" OFF IF CV_GCC )

@ -18,11 +18,17 @@ namespace cv {
extern __declspec(dllimport) bool __termination; // Details: #12750
}
#ifdef _WIN32_WCE
#define DLL_MAIN_ARG0 HANDLE
#else
#define DLL_MAIN_ARG0 HINSTANCE
#endif
extern "C"
BOOL WINAPI DllMain(HINSTANCE, DWORD fdwReason, LPVOID lpReserved);
BOOL WINAPI DllMain(DLL_MAIN_ARG0, DWORD fdwReason, LPVOID lpReserved);
extern "C"
BOOL WINAPI DllMain(HINSTANCE, DWORD fdwReason, LPVOID lpReserved)
BOOL WINAPI DllMain(DLL_MAIN_ARG0, DWORD fdwReason, LPVOID lpReserved)
{
if (fdwReason == DLL_THREAD_DETACH || fdwReason == DLL_PROCESS_DETACH)
{

@ -127,4 +127,4 @@ docker run --rm --workdir /code -v "$(get-location):/code" "trzeci/emscripten:la
@endcode
@note
The example uses latest version of [trzeci/emscripten](https://hub.docker.com/r/trzeci/emscripten) docker container. At this time, the latest version works fine and is `trzeci/emscripten:sdk-tag-1.38.32-64bit`
The example uses latest version of [trzeci/emscripten](https://hub.docker.com/r/trzeci/emscripten) docker container. At this time, the latest version works fine and is `trzeci/emscripten:sdk-tag-1.38.32-64bit`

@ -735,8 +735,11 @@ public class Mat {
// javadoc:Mat::toString()
@Override
public String toString() {
return "Mat [ " +
rows() + "*" + cols() + "*" + CvType.typeToString(type()) +
String _dims = (dims() > 0) ? "" : "-1*-1*";
for (int i=0; i<dims(); i++) {
_dims += size(i) + "*";
}
return "Mat [ " + _dims + CvType.typeToString(type()) +
", isCont=" + isContinuous() + ", isSubmat=" + isSubmatrix() +
", nativeObj=0x" + Long.toHexString(nativeObj) +
", dataAddr=0x" + Long.toHexString(dataAddr()) +

@ -139,7 +139,7 @@ const char dir_separators[] = "/";
static bool isDir(const cv::String& path, DIR* dir)
{
#if defined _WIN32 || defined WINCE
#if defined _WIN32 || defined _WIN32_WCE
DWORD attributes;
BOOL status = TRUE;
if (dir)
@ -147,7 +147,7 @@ static bool isDir(const cv::String& path, DIR* dir)
else
{
WIN32_FILE_ATTRIBUTE_DATA all_attrs;
#ifdef WINRT
#if defined WINRT || defined _WIN32_WCE
wchar_t wpath[MAX_PATH];
size_t copied = mbstowcs(wpath, path.c_str(), MAX_PATH);
CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1));

@ -17,6 +17,12 @@
#include "mean.simd.hpp"
#include "mean.simd_declarations.hpp" // defines CV_CPU_DISPATCH_MODES_ALL=AVX2,...,BASELINE based on CMakeLists.txt content
#undef HAVE_IPP
#undef CV_IPP_RUN_FAST
#define CV_IPP_RUN_FAST(f, ...)
#undef CV_IPP_RUN
#define CV_IPP_RUN(c, f, ...)
namespace cv {
#if defined HAVE_IPP

@ -115,13 +115,20 @@ static cv::String getModuleLocation(const void* addr)
#endif
if (m)
{
char path[MAX_PATH];
const size_t path_size = sizeof(path)/sizeof(*path);
size_t sz = GetModuleFileNameA(m, path, path_size); // no unicode support
TCHAR path[MAX_PATH];
const size_t path_size = sizeof(path) / sizeof(*path);
size_t sz = GetModuleFileName(m, path, path_size);
if (sz > 0 && sz < path_size)
{
path[sz] = '\0';
path[sz] = TCHAR('\0');
#ifdef _UNICODE
char char_path[MAX_PATH];
size_t copied = wcstombs(char_path, path, MAX_PATH);
CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1));
return cv::String(char_path);
#else
return cv::String(path);
#endif
}
}
#elif defined(__linux__)

@ -2092,19 +2092,19 @@ const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUT
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_caffe::PriorBoxParameter, offset_w_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_caffe::PriorBoxParameter, width_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_caffe::PriorBoxParameter, height_),
0,
1,
~0u,
8,
9,
~0u,
~0u,
6,
7,
~0u,
0,
1,
2,
3,
4,
5,
6,
7,
10,
8,
~0u,
~0u,
~0u,
@ -3528,8 +3528,8 @@ void AddDescriptorsImpl() {
"al\030\001 \001(\010:\004true\0223\n\014scale_filler\030\002 \001(\0132\035.o"
"pencv_caffe.FillerParameter\022\034\n\016channel_s"
"hared\030\003 \001(\010:\004true\022\022\n\003eps\030\004 \001(\002:\0051e-10\"\346\002"
"\n\021PriorBoxParameter\022\020\n\010min_size\030\001 \001(\002\022\020\n"
"\010max_size\030\002 \001(\002\022\024\n\014aspect_ratio\030\003 \003(\002\022\022\n"
"\n\021PriorBoxParameter\022\020\n\010min_size\030\001 \003(\002\022\020\n"
"\010max_size\030\002 \003(\002\022\024\n\014aspect_ratio\030\003 \003(\002\022\022\n"
"\004flip\030\004 \001(\010:\004true\022\022\n\004clip\030\005 \001(\010:\004true\022\020\n"
"\010variance\030\006 \003(\002\022\020\n\010img_size\030\007 \001(\r\022\r\n\005img"
"_h\030\010 \001(\r\022\r\n\005img_w\030\t \001(\r\022\014\n\004step\030\n \001(\002\022\016\n"
@ -6600,6 +6600,8 @@ PriorBoxParameter::PriorBoxParameter(const PriorBoxParameter& from)
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0),
min_size_(from.min_size_),
max_size_(from.max_size_),
aspect_ratio_(from.aspect_ratio_),
variance_(from.variance_),
offset_h_(from.offset_h_),
@ -6607,17 +6609,17 @@ PriorBoxParameter::PriorBoxParameter(const PriorBoxParameter& from)
width_(from.width_),
height_(from.height_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
::memcpy(&min_size_, &from.min_size_,
::memcpy(&img_size_, &from.img_size_,
static_cast<size_t>(reinterpret_cast<char*>(&offset_) -
reinterpret_cast<char*>(&min_size_)) + sizeof(offset_));
reinterpret_cast<char*>(&img_size_)) + sizeof(offset_));
// @@protoc_insertion_point(copy_constructor:opencv_caffe.PriorBoxParameter)
}
void PriorBoxParameter::SharedCtor() {
_cached_size_ = 0;
::memset(&min_size_, 0, static_cast<size_t>(
::memset(&img_size_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&step_w_) -
reinterpret_cast<char*>(&min_size_)) + sizeof(step_w_));
reinterpret_cast<char*>(&img_size_)) + sizeof(step_w_));
flip_ = true;
clip_ = true;
offset_ = 0.5f;
@ -6660,6 +6662,8 @@ void PriorBoxParameter::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
min_size_.Clear();
max_size_.Clear();
aspect_ratio_.Clear();
variance_.Clear();
offset_h_.Clear();
@ -6668,15 +6672,13 @@ void PriorBoxParameter::Clear() {
height_.Clear();
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 255u) {
::memset(&min_size_, 0, static_cast<size_t>(
::memset(&img_size_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&step_w_) -
reinterpret_cast<char*>(&min_size_)) + sizeof(step_w_));
}
if (cached_has_bits & 1792u) {
reinterpret_cast<char*>(&img_size_)) + sizeof(step_w_));
flip_ = true;
clip_ = true;
offset_ = 0.5f;
}
offset_ = 0.5f;
_has_bits_.Clear();
_internal_metadata_.Clear();
}
@ -6691,28 +6693,38 @@ bool PriorBoxParameter::MergePartialFromCodedStream(
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional float min_size = 1;
// repeated float min_size = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(13u /* 13 & 0xFF */)) {
set_has_min_size();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
input, &min_size_)));
1, 13u, input, this->mutable_min_size())));
} else if (
static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
input, this->mutable_min_size())));
} else {
goto handle_unusual;
}
break;
}
// optional float max_size = 2;
// repeated float max_size = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(21u /* 21 & 0xFF */)) {
set_has_max_size();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
1, 21u, input, this->mutable_max_size())));
} else if (
static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
input, &max_size_)));
input, this->mutable_max_size())));
} else {
goto handle_unusual;
}
@ -6985,15 +6997,16 @@ void PriorBoxParameter::SerializeWithCachedSizes(
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional float min_size = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormatLite::WriteFloat(1, this->min_size(), output);
// repeated float min_size = 1;
for (int i = 0, n = this->min_size_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteFloat(
1, this->min_size(i), output);
}
// optional float max_size = 2;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteFloat(2, this->max_size(), output);
// repeated float max_size = 2;
for (int i = 0, n = this->max_size_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteFloat(
2, this->max_size(i), output);
}
// repeated float aspect_ratio = 3;
@ -7002,13 +7015,14 @@ void PriorBoxParameter::SerializeWithCachedSizes(
3, this->aspect_ratio(i), output);
}
cached_has_bits = _has_bits_[0];
// optional bool flip = 4 [default = true];
if (cached_has_bits & 0x00000100u) {
if (cached_has_bits & 0x00000040u) {
::google::protobuf::internal::WireFormatLite::WriteBool(4, this->flip(), output);
}
// optional bool clip = 5 [default = true];
if (cached_has_bits & 0x00000200u) {
if (cached_has_bits & 0x00000080u) {
::google::protobuf::internal::WireFormatLite::WriteBool(5, this->clip(), output);
}
@ -7019,37 +7033,37 @@ void PriorBoxParameter::SerializeWithCachedSizes(
}
// optional uint32 img_size = 7;
if (cached_has_bits & 0x00000004u) {
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(7, this->img_size(), output);
}
// optional uint32 img_h = 8;
if (cached_has_bits & 0x00000008u) {
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(8, this->img_h(), output);
}
// optional uint32 img_w = 9;
if (cached_has_bits & 0x00000010u) {
if (cached_has_bits & 0x00000004u) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(9, this->img_w(), output);
}
// optional float step = 10;
if (cached_has_bits & 0x00000020u) {
if (cached_has_bits & 0x00000008u) {
::google::protobuf::internal::WireFormatLite::WriteFloat(10, this->step(), output);
}
// optional float step_h = 11;
if (cached_has_bits & 0x00000040u) {
if (cached_has_bits & 0x00000010u) {
::google::protobuf::internal::WireFormatLite::WriteFloat(11, this->step_h(), output);
}
// optional float step_w = 12;
if (cached_has_bits & 0x00000080u) {
if (cached_has_bits & 0x00000020u) {
::google::protobuf::internal::WireFormatLite::WriteFloat(12, this->step_w(), output);
}
// optional float offset = 13 [default = 0.5];
if (cached_has_bits & 0x00000400u) {
if (cached_has_bits & 0x00000100u) {
::google::protobuf::internal::WireFormatLite::WriteFloat(13, this->offset(), output);
}
@ -7091,28 +7105,26 @@ void PriorBoxParameter::SerializeWithCachedSizes(
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional float min_size = 1;
if (cached_has_bits & 0x00000001u) {
target = ::google::protobuf::internal::WireFormatLite::WriteFloatToArray(1, this->min_size(), target);
}
// repeated float min_size = 1;
target = ::google::protobuf::internal::WireFormatLite::
WriteFloatToArray(1, this->min_size_, target);
// optional float max_size = 2;
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::WriteFloatToArray(2, this->max_size(), target);
}
// repeated float max_size = 2;
target = ::google::protobuf::internal::WireFormatLite::
WriteFloatToArray(2, this->max_size_, target);
// repeated float aspect_ratio = 3;
target = ::google::protobuf::internal::WireFormatLite::
WriteFloatToArray(3, this->aspect_ratio_, target);
cached_has_bits = _has_bits_[0];
// optional bool flip = 4 [default = true];
if (cached_has_bits & 0x00000100u) {
if (cached_has_bits & 0x00000040u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(4, this->flip(), target);
}
// optional bool clip = 5 [default = true];
if (cached_has_bits & 0x00000200u) {
if (cached_has_bits & 0x00000080u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(5, this->clip(), target);
}
@ -7121,37 +7133,37 @@ void PriorBoxParameter::SerializeWithCachedSizes(
WriteFloatToArray(6, this->variance_, target);
// optional uint32 img_size = 7;
if (cached_has_bits & 0x00000004u) {
if (cached_has_bits & 0x00000001u) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(7, this->img_size(), target);
}
// optional uint32 img_h = 8;
if (cached_has_bits & 0x00000008u) {
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(8, this->img_h(), target);
}
// optional uint32 img_w = 9;
if (cached_has_bits & 0x00000010u) {
if (cached_has_bits & 0x00000004u) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(9, this->img_w(), target);
}
// optional float step = 10;
if (cached_has_bits & 0x00000020u) {
if (cached_has_bits & 0x00000008u) {
target = ::google::protobuf::internal::WireFormatLite::WriteFloatToArray(10, this->step(), target);
}
// optional float step_h = 11;
if (cached_has_bits & 0x00000040u) {
if (cached_has_bits & 0x00000010u) {
target = ::google::protobuf::internal::WireFormatLite::WriteFloatToArray(11, this->step_h(), target);
}
// optional float step_w = 12;
if (cached_has_bits & 0x00000080u) {
if (cached_has_bits & 0x00000020u) {
target = ::google::protobuf::internal::WireFormatLite::WriteFloatToArray(12, this->step_w(), target);
}
// optional float offset = 13 [default = 0.5];
if (cached_has_bits & 0x00000400u) {
if (cached_has_bits & 0x00000100u) {
target = ::google::protobuf::internal::WireFormatLite::WriteFloatToArray(13, this->offset(), target);
}
@ -7188,6 +7200,24 @@ size_t PriorBoxParameter::ByteSizeLong() const {
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
_internal_metadata_.unknown_fields());
}
// repeated float min_size = 1;
{
unsigned int count = static_cast<unsigned int>(this->min_size_size());
size_t data_size = 4UL * count;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->min_size_size());
total_size += data_size;
}
// repeated float max_size = 2;
{
unsigned int count = static_cast<unsigned int>(this->max_size_size());
size_t data_size = 4UL * count;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->max_size_size());
total_size += data_size;
}
// repeated float aspect_ratio = 3;
{
unsigned int count = static_cast<unsigned int>(this->aspect_ratio_size());
@ -7243,16 +7273,6 @@ size_t PriorBoxParameter::ByteSizeLong() const {
}
if (_has_bits_[0 / 32] & 255u) {
// optional float min_size = 1;
if (has_min_size()) {
total_size += 1 + 4;
}
// optional float max_size = 2;
if (has_max_size()) {
total_size += 1 + 4;
}
// optional uint32 img_size = 7;
if (has_img_size()) {
total_size += 1 +
@ -7289,8 +7309,6 @@ size_t PriorBoxParameter::ByteSizeLong() const {
total_size += 1 + 4;
}
}
if (_has_bits_[8 / 32] & 1792u) {
// optional bool flip = 4 [default = true];
if (has_flip()) {
total_size += 1 + 1;
@ -7301,12 +7319,12 @@ size_t PriorBoxParameter::ByteSizeLong() const {
total_size += 1 + 1;
}
// optional float offset = 13 [default = 0.5];
if (has_offset()) {
total_size += 1 + 4;
}
}
// optional float offset = 13 [default = 0.5];
if (has_offset()) {
total_size += 1 + 4;
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
@ -7336,6 +7354,8 @@ void PriorBoxParameter::MergeFrom(const PriorBoxParameter& from) {
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
min_size_.MergeFrom(from.min_size_);
max_size_.MergeFrom(from.max_size_);
aspect_ratio_.MergeFrom(from.aspect_ratio_);
variance_.MergeFrom(from.variance_);
offset_h_.MergeFrom(from.offset_h_);
@ -7345,43 +7365,34 @@ void PriorBoxParameter::MergeFrom(const PriorBoxParameter& from) {
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 255u) {
if (cached_has_bits & 0x00000001u) {
min_size_ = from.min_size_;
}
if (cached_has_bits & 0x00000002u) {
max_size_ = from.max_size_;
}
if (cached_has_bits & 0x00000004u) {
img_size_ = from.img_size_;
}
if (cached_has_bits & 0x00000008u) {
if (cached_has_bits & 0x00000002u) {
img_h_ = from.img_h_;
}
if (cached_has_bits & 0x00000010u) {
if (cached_has_bits & 0x00000004u) {
img_w_ = from.img_w_;
}
if (cached_has_bits & 0x00000020u) {
if (cached_has_bits & 0x00000008u) {
step_ = from.step_;
}
if (cached_has_bits & 0x00000040u) {
if (cached_has_bits & 0x00000010u) {
step_h_ = from.step_h_;
}
if (cached_has_bits & 0x00000080u) {
if (cached_has_bits & 0x00000020u) {
step_w_ = from.step_w_;
}
_has_bits_[0] |= cached_has_bits;
}
if (cached_has_bits & 1792u) {
if (cached_has_bits & 0x00000100u) {
if (cached_has_bits & 0x00000040u) {
flip_ = from.flip_;
}
if (cached_has_bits & 0x00000200u) {
if (cached_has_bits & 0x00000080u) {
clip_ = from.clip_;
}
if (cached_has_bits & 0x00000400u) {
offset_ = from.offset_;
}
_has_bits_[0] |= cached_has_bits;
}
if (cached_has_bits & 0x00000100u) {
set_offset(from.offset());
}
}
void PriorBoxParameter::CopyFrom(const ::google::protobuf::Message& from) {
@ -7408,14 +7419,14 @@ void PriorBoxParameter::Swap(PriorBoxParameter* other) {
}
void PriorBoxParameter::InternalSwap(PriorBoxParameter* other) {
using std::swap;
min_size_.InternalSwap(&other->min_size_);
max_size_.InternalSwap(&other->max_size_);
aspect_ratio_.InternalSwap(&other->aspect_ratio_);
variance_.InternalSwap(&other->variance_);
offset_h_.InternalSwap(&other->offset_h_);
offset_w_.InternalSwap(&other->offset_w_);
width_.InternalSwap(&other->width_);
height_.InternalSwap(&other->height_);
swap(min_size_, other->min_size_);
swap(max_size_, other->max_size_);
swap(img_size_, other->img_size_);
swap(img_h_, other->img_h_);
swap(img_w_, other->img_w_);

@ -1886,6 +1886,30 @@ class PriorBoxParameter : public ::google::protobuf::Message /* @@protoc_inserti
// accessors -------------------------------------------------------
// repeated float min_size = 1;
int min_size_size() const;
void clear_min_size();
static const int kMinSizeFieldNumber = 1;
float min_size(int index) const;
void set_min_size(int index, float value);
void add_min_size(float value);
const ::google::protobuf::RepeatedField< float >&
min_size() const;
::google::protobuf::RepeatedField< float >*
mutable_min_size();
// repeated float max_size = 2;
int max_size_size() const;
void clear_max_size();
static const int kMaxSizeFieldNumber = 2;
float max_size(int index) const;
void set_max_size(int index, float value);
void add_max_size(float value);
const ::google::protobuf::RepeatedField< float >&
max_size() const;
::google::protobuf::RepeatedField< float >*
mutable_max_size();
// repeated float aspect_ratio = 3;
int aspect_ratio_size() const;
void clear_aspect_ratio();
@ -1958,20 +1982,6 @@ class PriorBoxParameter : public ::google::protobuf::Message /* @@protoc_inserti
::google::protobuf::RepeatedField< float >*
mutable_height();
// optional float min_size = 1;
bool has_min_size() const;
void clear_min_size();
static const int kMinSizeFieldNumber = 1;
float min_size() const;
void set_min_size(float value);
// optional float max_size = 2;
bool has_max_size() const;
void clear_max_size();
static const int kMaxSizeFieldNumber = 2;
float max_size() const;
void set_max_size(float value);
// optional uint32 img_size = 7;
bool has_img_size() const;
void clear_img_size();
@ -2037,10 +2047,6 @@ class PriorBoxParameter : public ::google::protobuf::Message /* @@protoc_inserti
// @@protoc_insertion_point(class_scope:opencv_caffe.PriorBoxParameter)
private:
void set_has_min_size();
void clear_has_min_size();
void set_has_max_size();
void clear_has_max_size();
void set_has_flip();
void clear_has_flip();
void set_has_clip();
@ -2063,14 +2069,14 @@ class PriorBoxParameter : public ::google::protobuf::Message /* @@protoc_inserti
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::internal::HasBits<1> _has_bits_;
mutable int _cached_size_;
::google::protobuf::RepeatedField< float > min_size_;
::google::protobuf::RepeatedField< float > max_size_;
::google::protobuf::RepeatedField< float > aspect_ratio_;
::google::protobuf::RepeatedField< float > variance_;
::google::protobuf::RepeatedField< float > offset_h_;
::google::protobuf::RepeatedField< float > offset_w_;
::google::protobuf::RepeatedField< float > width_;
::google::protobuf::RepeatedField< float > height_;
float min_size_;
float max_size_;
::google::protobuf::uint32 img_size_;
::google::protobuf::uint32 img_h_;
::google::protobuf::uint32 img_w_;
@ -15271,53 +15277,65 @@ inline void NormalizeBBoxParameter::set_eps(float value) {
// PriorBoxParameter
// optional float min_size = 1;
inline bool PriorBoxParameter::has_min_size() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void PriorBoxParameter::set_has_min_size() {
_has_bits_[0] |= 0x00000001u;
}
inline void PriorBoxParameter::clear_has_min_size() {
_has_bits_[0] &= ~0x00000001u;
// repeated float min_size = 1;
inline int PriorBoxParameter::min_size_size() const {
return min_size_.size();
}
inline void PriorBoxParameter::clear_min_size() {
min_size_ = 0;
clear_has_min_size();
min_size_.Clear();
}
inline float PriorBoxParameter::min_size() const {
inline float PriorBoxParameter::min_size(int index) const {
// @@protoc_insertion_point(field_get:opencv_caffe.PriorBoxParameter.min_size)
return min_size_;
return min_size_.Get(index);
}
inline void PriorBoxParameter::set_min_size(float value) {
set_has_min_size();
min_size_ = value;
inline void PriorBoxParameter::set_min_size(int index, float value) {
min_size_.Set(index, value);
// @@protoc_insertion_point(field_set:opencv_caffe.PriorBoxParameter.min_size)
}
// optional float max_size = 2;
inline bool PriorBoxParameter::has_max_size() const {
return (_has_bits_[0] & 0x00000002u) != 0;
inline void PriorBoxParameter::add_min_size(float value) {
min_size_.Add(value);
// @@protoc_insertion_point(field_add:opencv_caffe.PriorBoxParameter.min_size)
}
inline void PriorBoxParameter::set_has_max_size() {
_has_bits_[0] |= 0x00000002u;
inline const ::google::protobuf::RepeatedField< float >&
PriorBoxParameter::min_size() const {
// @@protoc_insertion_point(field_list:opencv_caffe.PriorBoxParameter.min_size)
return min_size_;
}
inline void PriorBoxParameter::clear_has_max_size() {
_has_bits_[0] &= ~0x00000002u;
inline ::google::protobuf::RepeatedField< float >*
PriorBoxParameter::mutable_min_size() {
// @@protoc_insertion_point(field_mutable_list:opencv_caffe.PriorBoxParameter.min_size)
return &min_size_;
}
// repeated float max_size = 2;
inline int PriorBoxParameter::max_size_size() const {
return max_size_.size();
}
inline void PriorBoxParameter::clear_max_size() {
max_size_ = 0;
clear_has_max_size();
max_size_.Clear();
}
inline float PriorBoxParameter::max_size() const {
inline float PriorBoxParameter::max_size(int index) const {
// @@protoc_insertion_point(field_get:opencv_caffe.PriorBoxParameter.max_size)
return max_size_;
return max_size_.Get(index);
}
inline void PriorBoxParameter::set_max_size(float value) {
set_has_max_size();
max_size_ = value;
inline void PriorBoxParameter::set_max_size(int index, float value) {
max_size_.Set(index, value);
// @@protoc_insertion_point(field_set:opencv_caffe.PriorBoxParameter.max_size)
}
inline void PriorBoxParameter::add_max_size(float value) {
max_size_.Add(value);
// @@protoc_insertion_point(field_add:opencv_caffe.PriorBoxParameter.max_size)
}
inline const ::google::protobuf::RepeatedField< float >&
PriorBoxParameter::max_size() const {
// @@protoc_insertion_point(field_list:opencv_caffe.PriorBoxParameter.max_size)
return max_size_;
}
inline ::google::protobuf::RepeatedField< float >*
PriorBoxParameter::mutable_max_size() {
// @@protoc_insertion_point(field_mutable_list:opencv_caffe.PriorBoxParameter.max_size)
return &max_size_;
}
// repeated float aspect_ratio = 3;
inline int PriorBoxParameter::aspect_ratio_size() const {
@ -15351,13 +15369,13 @@ PriorBoxParameter::mutable_aspect_ratio() {
// optional bool flip = 4 [default = true];
inline bool PriorBoxParameter::has_flip() const {
return (_has_bits_[0] & 0x00000100u) != 0;
return (_has_bits_[0] & 0x00000040u) != 0;
}
inline void PriorBoxParameter::set_has_flip() {
_has_bits_[0] |= 0x00000100u;
_has_bits_[0] |= 0x00000040u;
}
inline void PriorBoxParameter::clear_has_flip() {
_has_bits_[0] &= ~0x00000100u;
_has_bits_[0] &= ~0x00000040u;
}
inline void PriorBoxParameter::clear_flip() {
flip_ = true;
@ -15375,13 +15393,13 @@ inline void PriorBoxParameter::set_flip(bool value) {
// optional bool clip = 5 [default = true];
inline bool PriorBoxParameter::has_clip() const {
return (_has_bits_[0] & 0x00000200u) != 0;
return (_has_bits_[0] & 0x00000080u) != 0;
}
inline void PriorBoxParameter::set_has_clip() {
_has_bits_[0] |= 0x00000200u;
_has_bits_[0] |= 0x00000080u;
}
inline void PriorBoxParameter::clear_has_clip() {
_has_bits_[0] &= ~0x00000200u;
_has_bits_[0] &= ~0x00000080u;
}
inline void PriorBoxParameter::clear_clip() {
clip_ = true;
@ -15429,13 +15447,13 @@ PriorBoxParameter::mutable_variance() {
// optional uint32 img_size = 7;
inline bool PriorBoxParameter::has_img_size() const {
return (_has_bits_[0] & 0x00000004u) != 0;
return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void PriorBoxParameter::set_has_img_size() {
_has_bits_[0] |= 0x00000004u;
_has_bits_[0] |= 0x00000001u;
}
inline void PriorBoxParameter::clear_has_img_size() {
_has_bits_[0] &= ~0x00000004u;
_has_bits_[0] &= ~0x00000001u;
}
inline void PriorBoxParameter::clear_img_size() {
img_size_ = 0u;
@ -15453,13 +15471,13 @@ inline void PriorBoxParameter::set_img_size(::google::protobuf::uint32 value) {
// optional uint32 img_h = 8;
inline bool PriorBoxParameter::has_img_h() const {
return (_has_bits_[0] & 0x00000008u) != 0;
return (_has_bits_[0] & 0x00000002u) != 0;
}
inline void PriorBoxParameter::set_has_img_h() {
_has_bits_[0] |= 0x00000008u;
_has_bits_[0] |= 0x00000002u;
}
inline void PriorBoxParameter::clear_has_img_h() {
_has_bits_[0] &= ~0x00000008u;
_has_bits_[0] &= ~0x00000002u;
}
inline void PriorBoxParameter::clear_img_h() {
img_h_ = 0u;
@ -15477,13 +15495,13 @@ inline void PriorBoxParameter::set_img_h(::google::protobuf::uint32 value) {
// optional uint32 img_w = 9;
inline bool PriorBoxParameter::has_img_w() const {
return (_has_bits_[0] & 0x00000010u) != 0;
return (_has_bits_[0] & 0x00000004u) != 0;
}
inline void PriorBoxParameter::set_has_img_w() {
_has_bits_[0] |= 0x00000010u;
_has_bits_[0] |= 0x00000004u;
}
inline void PriorBoxParameter::clear_has_img_w() {
_has_bits_[0] &= ~0x00000010u;
_has_bits_[0] &= ~0x00000004u;
}
inline void PriorBoxParameter::clear_img_w() {
img_w_ = 0u;
@ -15501,13 +15519,13 @@ inline void PriorBoxParameter::set_img_w(::google::protobuf::uint32 value) {
// optional float step = 10;
inline bool PriorBoxParameter::has_step() const {
return (_has_bits_[0] & 0x00000020u) != 0;
return (_has_bits_[0] & 0x00000008u) != 0;
}
inline void PriorBoxParameter::set_has_step() {
_has_bits_[0] |= 0x00000020u;
_has_bits_[0] |= 0x00000008u;
}
inline void PriorBoxParameter::clear_has_step() {
_has_bits_[0] &= ~0x00000020u;
_has_bits_[0] &= ~0x00000008u;
}
inline void PriorBoxParameter::clear_step() {
step_ = 0;
@ -15525,13 +15543,13 @@ inline void PriorBoxParameter::set_step(float value) {
// optional float step_h = 11;
inline bool PriorBoxParameter::has_step_h() const {
return (_has_bits_[0] & 0x00000040u) != 0;
return (_has_bits_[0] & 0x00000010u) != 0;
}
inline void PriorBoxParameter::set_has_step_h() {
_has_bits_[0] |= 0x00000040u;
_has_bits_[0] |= 0x00000010u;
}
inline void PriorBoxParameter::clear_has_step_h() {
_has_bits_[0] &= ~0x00000040u;
_has_bits_[0] &= ~0x00000010u;
}
inline void PriorBoxParameter::clear_step_h() {
step_h_ = 0;
@ -15549,13 +15567,13 @@ inline void PriorBoxParameter::set_step_h(float value) {
// optional float step_w = 12;
inline bool PriorBoxParameter::has_step_w() const {
return (_has_bits_[0] & 0x00000080u) != 0;
return (_has_bits_[0] & 0x00000020u) != 0;
}
inline void PriorBoxParameter::set_has_step_w() {
_has_bits_[0] |= 0x00000080u;
_has_bits_[0] |= 0x00000020u;
}
inline void PriorBoxParameter::clear_has_step_w() {
_has_bits_[0] &= ~0x00000080u;
_has_bits_[0] &= ~0x00000020u;
}
inline void PriorBoxParameter::clear_step_w() {
step_w_ = 0;
@ -15573,13 +15591,13 @@ inline void PriorBoxParameter::set_step_w(float value) {
// optional float offset = 13 [default = 0.5];
inline bool PriorBoxParameter::has_offset() const {
return (_has_bits_[0] & 0x00000400u) != 0;
return (_has_bits_[0] & 0x00000100u) != 0;
}
inline void PriorBoxParameter::set_has_offset() {
_has_bits_[0] |= 0x00000400u;
_has_bits_[0] |= 0x00000100u;
}
inline void PriorBoxParameter::clear_has_offset() {
_has_bits_[0] &= ~0x00000400u;
_has_bits_[0] &= ~0x00000100u;
}
inline void PriorBoxParameter::clear_offset() {
offset_ = 0.5f;

@ -154,8 +154,13 @@ if args.proto and args.model:
top = int(out[0, 0, i, 4] * img.shape[0])
right = int(out[0, 0, i, 5] * img.shape[1])
bottom = int(out[0, 0, i, 6] * img.shape[0])
addDetection(detections, imageId, left, top, width=right - left + 1,
height=bottom - top + 1, score=confidence)
x = max(0, min(left, img.shape[1] - 1))
y = max(0, min(top, img.shape[0] - 1))
w = max(0, min(right - x + 1, img.shape[1] - x))
h = max(0, min(bottom - y + 1, img.shape[0] - y))
addDetection(detections, imageId, x, y, w, h, score=confidence)
elif args.cascade:
cascade = cv.CascadeClassifier(args.cascade)

@ -173,9 +173,9 @@ conv7_2_h = tf.space_to_batch_nd(conv7_1_h, [1, 1], [[1, 1], [1, 1]], name='Pad_
conv7_2_h = conv(conv7_2_h, stride=2, pad='VALID', name='conv7_2_h', activ=tf.nn.relu)
conv8_1_h = conv(conv7_2_h, pad='SAME', name='conv8_1_h', activ=tf.nn.relu)
conv8_2_h = conv(conv8_1_h, pad='SAME', name='conv8_2_h', activ=tf.nn.relu)
conv8_2_h = conv(conv8_1_h, pad='VALID', name='conv8_2_h', activ=tf.nn.relu)
conv9_1_h = conv(conv8_2_h, 'conv9_1_h', activ=tf.nn.relu)
conv9_2_h = conv(conv9_1_h, pad='SAME', name='conv9_2_h', activ=tf.nn.relu)
conv9_2_h = conv(conv9_1_h, pad='VALID', name='conv9_2_h', activ=tf.nn.relu)
conv4_3_norm = l2norm(layer_256_1_relu1, 'conv4_3_norm')

@ -142,8 +142,6 @@ PERF_TEST_P_(DNNTestNetwork, MobileNet_SSD_v1_TensorFlow)
{
if (backend == DNN_BACKEND_HALIDE)
throw SkipTestException("");
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
throw SkipTestException("");
processNet("dnn/ssd_mobilenet_v1_coco_2017_11_17.pb", "ssd_mobilenet_v1_coco_2017_11_17.pbtxt", "",
Mat(cv::Size(300, 300), CV_32FC3));
}
@ -152,8 +150,6 @@ PERF_TEST_P_(DNNTestNetwork, MobileNet_SSD_v2_TensorFlow)
{
if (backend == DNN_BACKEND_HALIDE)
throw SkipTestException("");
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
throw SkipTestException("");
processNet("dnn/ssd_mobilenet_v2_coco_2018_03_29.pb", "ssd_mobilenet_v2_coco_2018_03_29.pbtxt", "",
Mat(cv::Size(300, 300), CV_32FC3));
}

@ -116,9 +116,9 @@ message PriorBoxParameter {
CENTER_SIZE = 2;
}
// Minimum box size (in pixels). Required!
optional float min_size = 1;
repeated float min_size = 1;
// Maximum box size (in pixels). Required!
optional float max_size = 2;
repeated float max_size = 2;
// Various of aspect ratios. Duplicate ratios will be ignored.
// If none is provided, we use default ratio 1.
repeated float aspect_ratio = 3;

@ -198,7 +198,7 @@ public:
virtual bool supportBackend(int backendId) CV_OVERRIDE
{
return backendId == DNN_BACKEND_OPENCV ||
(backendId == DNN_BACKEND_INFERENCE_ENGINE && !_locPredTransposed && _bboxesNormalized && !_clip);
(backendId == DNN_BACKEND_INFERENCE_ENGINE && !_locPredTransposed && _bboxesNormalized);
}
bool getMemoryShapes(const std::vector<MatShape> &inputs,
@ -936,6 +936,7 @@ public:
InferenceEngine::Builder::Layer l = ieLayer;
l.getParameters()["eta"] = std::string("1.0");
l.getParameters()["clip"] = _clip;
return Ptr<BackendNode>(new InfEngineBackendNode(l));
}

@ -796,7 +796,7 @@ struct AbsValFunctor
#ifdef HAVE_INF_ENGINE
InferenceEngine::Builder::Layer initInfEngineBuilderAPI()
{
return InferenceEngine::Builder::ReLULayer("").setNegativeSlope(-1);
return InferenceEngine::Builder::ReLULayer("").setNegativeSlope(-0.999999f);
}
#endif // HAVE_INF_ENGINE

@ -181,21 +181,20 @@ public:
PriorBoxLayerImpl(const LayerParams &params)
{
setParamsFrom(params);
_minSize = getParameter<float>(params, "min_size", 0, false, 0);
_flip = getParameter<bool>(params, "flip", 0, false, true);
_clip = getParameter<bool>(params, "clip", 0, false, true);
_bboxesNormalized = getParameter<bool>(params, "normalized_bbox", 0, false, true);
_aspectRatios.clear();
getParams("min_size", params, &_minSize);
getAspectRatios(params);
getVariance(params);
_maxSize = -1;
if (params.has("max_size"))
{
_maxSize = params.get("max_size").get<float>(0);
CV_Assert(_maxSize > _minSize);
getParams("max_size", params, &_maxSize);
CV_Assert(_minSize.size() == _maxSize.size());
for (int i = 0; i < _maxSize.size(); i++)
CV_Assert(_minSize[i] < _maxSize[i]);
}
std::vector<float> widths, heights;
@ -214,25 +213,28 @@ public:
}
else
{
CV_Assert(_minSize > 0);
_boxWidths.resize(1 + (_maxSize > 0 ? 1 : 0) + _aspectRatios.size());
_boxHeights.resize(_boxWidths.size());
_boxWidths[0] = _boxHeights[0] = _minSize;
int i = 1;
if (_maxSize > 0)
CV_Assert(!_minSize.empty());
for (int i = 0; i < _minSize.size(); ++i)
{
// second prior: aspect_ratio = 1, size = sqrt(min_size * max_size)
_boxWidths[i] = _boxHeights[i] = sqrt(_minSize * _maxSize);
i += 1;
}
float minSize = _minSize[i];
CV_Assert(minSize > 0);
_boxWidths.push_back(minSize);
_boxHeights.push_back(minSize);
// rest of priors
for (size_t r = 0; r < _aspectRatios.size(); ++r)
{
float arSqrt = sqrt(_aspectRatios[r]);
_boxWidths[i + r] = _minSize * arSqrt;
_boxHeights[i + r] = _minSize / arSqrt;
if (_maxSize.size() > 0)
{
float size = sqrt(minSize * _maxSize[i]);
_boxWidths.push_back(size);
_boxHeights.push_back(size);
}
// rest of priors
for (size_t r = 0; r < _aspectRatios.size(); ++r)
{
float arSqrt = sqrt(_aspectRatios[r]);
_boxWidths.push_back(minSize * arSqrt);
_boxHeights.push_back(minSize / arSqrt);
}
}
}
CV_Assert(_boxWidths.size() == _boxHeights.size());
@ -272,8 +274,9 @@ public:
virtual bool supportBackend(int backendId) CV_OVERRIDE
{
return backendId == DNN_BACKEND_OPENCV ||
(backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine()) ||
(backendId == DNN_BACKEND_VKCOM && haveVulkan());
(backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine() &&
( _explicitSizes || (_minSize.size() == 1 && _maxSize.size() <= 1)))
|| (backendId == DNN_BACKEND_VKCOM && haveVulkan());
}
bool getMemoryShapes(const std::vector<MatShape> &inputs,
@ -523,10 +526,9 @@ public:
InferenceEngine::Builder::PriorBoxLayer ieLayer(name);
CV_Assert(!_explicitSizes);
ieLayer.setMinSize(_minSize);
if (_maxSize > 0)
ieLayer.setMaxSize(_maxSize);
ieLayer.setMinSize(_minSize[0]);
if (!_maxSize.empty())
ieLayer.setMaxSize(_maxSize[0]);
CV_CheckEQ(_offsetsX.size(), (size_t)1, ""); CV_CheckEQ(_offsetsY.size(), (size_t)1, ""); CV_CheckEQ(_offsetsX[0], _offsetsY[0], "");
ieLayer.setOffset(_offsetsX[0]);
@ -573,8 +575,8 @@ public:
}
private:
float _minSize;
float _maxSize;
std::vector<float> _minSize;
std::vector<float> _maxSize;
float _stepX, _stepY;

@ -465,6 +465,20 @@ void ONNXImporter::populateNet(Net dstNet)
}
layerParams.set("begin", DictValue::arrayInt(&begin[0], begin.size()));
layerParams.set("end", DictValue::arrayInt(&end[0], end.size()));
}
else if (layer_type == "Split")
{
DictValue splits = layerParams.get("split");
const int numSplits = splits.size();
CV_Assert(numSplits > 1);
std::vector<int> slicePoints(numSplits - 1, splits.get<int>(0));
for (int i = 1; i < splits.size() - 1; ++i)
{
slicePoints[i] = slicePoints[i - 1] + splits.get<int>(i - 1);
}
layerParams.set("slice_point", DictValue::arrayInt(&slicePoints[0], slicePoints.size()));
layerParams.type = "Slice";
}
else if (layer_type == "Add" || layer_type == "Sum")
{
@ -486,6 +500,11 @@ void ONNXImporter::populateNet(Net dstNet)
layerParams.type = "Eltwise";
}
}
else if (layer_type == "Max")
{
layerParams.type = "Eltwise";
layerParams.set("operation", "max");
}
else if (layer_type == "Sub")
{
Mat blob = getBlob(node_proto, constBlobs, 1);
@ -741,6 +760,16 @@ void ONNXImporter::populateNet(Net dstNet)
{
layerParams.type = "Permute";
replaceLayerParam(layerParams, "perm", "order");
CV_Assert(node_proto.input_size() == 1);
if (constBlobs.find(node_proto.input(0)) != constBlobs.end())
{
std::vector<Mat> inputs(1, getBlob(node_proto, constBlobs, 0)), transposed;
runLayer(layerParams, inputs, transposed);
CV_Assert(transposed.size() == 1);
constBlobs.insert(std::make_pair(layerParams.name, transposed[0]));
continue;
}
}
else if (layer_type == "Unsqueeze")
{
@ -906,8 +935,10 @@ void ONNXImporter::populateNet(Net dstNet)
}
int id = dstNet.addLayer(layerParams.name, layerParams.type, layerParams);
layer_id.insert(std::make_pair(layerParams.name, LayerInfo(id, 0)));
for (int i = 0; i < node_proto.output_size(); ++i)
{
layer_id.insert(std::make_pair(node_proto.output(i), LayerInfo(id, i)));
}
std::vector<MatShape> layerInpShapes, layerOutShapes, layerInternalShapes;
for (int j = 0; j < node_proto.input_size(); j++) {
@ -924,8 +955,10 @@ void ONNXImporter::populateNet(Net dstNet)
// Compute shape of output blob for this layer.
Ptr<Layer> layer = dstNet.getLayer(id);
layer->getMemoryShapes(layerInpShapes, 0, layerOutShapes, layerInternalShapes);
CV_Assert(!layerOutShapes.empty());
outShapes[layerParams.name] = layerOutShapes[0];
for (int i = 0; i < node_proto.output_size() && i < (int)layerOutShapes.size(); ++i)
{
outShapes[node_proto.output(i)] = layerOutShapes[i];
}
}
}

@ -205,10 +205,6 @@ TEST_P(DNNTestNetwork, MobileNet_SSD_v1_TensorFlow)
applyTestTag(target == DNN_TARGET_CPU ? "" : CV_TEST_TAG_MEMORY_512MB);
if (backend == DNN_BACKEND_HALIDE)
applyTestTag(CV_TEST_TAG_DNN_SKIP_HALIDE);
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2019020000)
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE, CV_TEST_TAG_DNN_SKIP_IE_2019R2);
#endif
Mat sample = imread(findDataFile("dnn/street.png"));
Mat inp = blobFromImage(sample, 1.0f, Size(300, 300), Scalar(), false);
@ -248,10 +244,6 @@ TEST_P(DNNTestNetwork, MobileNet_SSD_v2_TensorFlow)
applyTestTag(target == DNN_TARGET_CPU ? CV_TEST_TAG_MEMORY_512MB : CV_TEST_TAG_MEMORY_1GB);
if (backend == DNN_BACKEND_HALIDE)
applyTestTag(CV_TEST_TAG_DNN_SKIP_HALIDE);
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2019020000)
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE, CV_TEST_TAG_DNN_SKIP_IE_2019R2);
#endif
Mat sample = imread(findDataFile("dnn/street.png"));
Mat inp = blobFromImage(sample, 1.0f, Size(300, 300), Scalar(), false);
@ -395,7 +387,7 @@ TEST_P(DNNTestNetwork, DenseNet_121)
float l1 = 0.0, lInf = 0.0;
if (target == DNN_TARGET_OPENCL_FP16)
{
l1 = 9e-3; lInf = 5e-2;
l1 = 2e-2; lInf = 9e-2;
}
else if (target == DNN_TARGET_MYRIAD)
{

@ -496,7 +496,11 @@ TEST_P(Test_Caffe_nets, DenseNet_121)
float l1 = default_l1, lInf = default_lInf;
if (target == DNN_TARGET_OPENCL_FP16)
{
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2019020000)
l1 = 0.04; lInf = 0.21;
#else
l1 = 0.017; lInf = 0.0795;
#endif
}
else if (target == DNN_TARGET_MYRIAD)
{

@ -360,7 +360,7 @@ TEST_P(Test_Darknet_nets, YOLOv3)
1, 2, 0.989633f, 0.450719f, 0.463353f, 0.496305f, 0.522258f, // a car
1, 2, 0.997412f, 0.647584f, 0.459939f, 0.821038f, 0.663947f); // a car
double scoreDiff = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.0047 : 8e-5;
double scoreDiff = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.006 : 8e-5;
double iouDiff = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.018 : 3e-4;
std::string config_file = "yolov3.cfg";

@ -233,9 +233,14 @@ TEST_P(Test_Caffe_layers, Dropout)
TEST_P(Test_Caffe_layers, Concat)
{
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GE(2019010000)
#if defined(INF_ENGINE_RELEASE)
#if INF_ENGINE_VER_MAJOR_GE(2019010000) && INF_ENGINE_VER_MAJOR_LT(2019020000)
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_2019R1, CV_TEST_TAG_DNN_SKIP_IE_2019R1_1);
#elif INF_ENGINE_VER_MAJOR_EQ(2019020000)
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_OPENCL)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL, CV_TEST_TAG_DNN_SKIP_IE_2019R2);
#endif
#endif
testLayerUsingCaffeModels("layer_concat");
testLayerUsingCaffeModels("layer_concat_optim", true, false);
@ -742,6 +747,22 @@ TEST_P(Test_Caffe_layers, Average_pooling_kernel_area)
normAssert(out, blobFromImage(ref));
}
TEST_P(Test_Caffe_layers, PriorBox_repeated)
{
Net net = readNet(_tf("prior_box.prototxt"));
int inp_size[] = {1, 3, 10, 10};
int shape_size[] = {1, 2, 3, 4};
Mat inp(4, inp_size, CV_32F);
randu(inp, -1.0f, 1.0f);
Mat shape(4, shape_size, CV_32F);
randu(shape, -1.0f, 1.0f);
net.setInput(inp, "data");
net.setInput(shape, "shape");
Mat out = net.forward();
Mat ref = blobFromNPY(_tf("priorbox_output.npy"));
normAssert(out, ref, "");
}
// Test PriorBoxLayer in case of no aspect ratios (just squared proposals).
TEST_P(Test_Caffe_layers, PriorBox_squares)
{

@ -348,6 +348,13 @@ TEST_P(Test_ONNX_layers, Softmax)
testONNXModels("log_softmax", npy, 0, 0, false, false);
}
TEST_P(Test_ONNX_layers, Split_EltwiseMax)
{
if (backend == DNN_BACKEND_INFERENCE_ENGINE)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE);
testONNXModels("split_max");
}
INSTANTIATE_TEST_CASE_P(/*nothing*/, Test_ONNX_layers, dnnBackendsAndTargets());
class Test_ONNX_nets : public Test_ONNX_layers
@ -426,14 +433,6 @@ TEST_P(Test_ONNX_nets, RCNN_ILSVRC13)
testONNXModels("rcnn_ilsvrc13", pb, 0.0045);
}
TEST_P(Test_ONNX_nets, VGG16)
{
applyTestTag(CV_TEST_TAG_MEMORY_6GB); // > 2.3Gb
// output range: [-69; 72], after Softmax [0; 0.96]
testONNXModels("vgg16", pb, default_l1, default_lInf, true);
}
TEST_P(Test_ONNX_nets, VGG16_bn)
{
applyTestTag(CV_TEST_TAG_MEMORY_6GB); // > 2.3Gb

@ -436,11 +436,6 @@ TEST_P(Test_TensorFlow_nets, Inception_v2_SSD)
TEST_P(Test_TensorFlow_nets, MobileNet_v1_SSD)
{
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2019020000)
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE, CV_TEST_TAG_DNN_SKIP_IE_2019R2);
#endif
checkBackend();
std::string proto = findDataFile("dnn/ssd_mobilenet_v1_coco_2017_11_17.pbtxt");
std::string model = findDataFile("dnn/ssd_mobilenet_v1_coco_2017_11_17.pb", false);
@ -456,7 +451,7 @@ TEST_P(Test_TensorFlow_nets, MobileNet_v1_SSD)
Mat out = net.forward();
Mat ref = blobFromNPY(findDataFile("dnn/tensorflow/ssd_mobilenet_v1_coco_2017_11_17.detection_out.npy"));
float scoreDiff = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 7e-3 : 1.5e-5;
float scoreDiff = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.011 : 1.5e-5;
float iouDiff = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.012 : 1e-3;
float detectionConfThresh = (target == DNN_TARGET_MYRIAD) ? 0.35 : 0.3;
@ -515,11 +510,6 @@ TEST_P(Test_TensorFlow_nets, MobileNet_v1_SSD_PPN)
if (backend == DNN_BACKEND_INFERENCE_ENGINE && (target == DNN_TARGET_OPENCL || 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);
#endif
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2019020000)
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE, CV_TEST_TAG_DNN_SKIP_IE_2019R2);
#endif
checkBackend();
std::string proto = findDataFile("dnn/ssd_mobilenet_v1_ppn_coco.pbtxt");
std::string model = findDataFile("dnn/ssd_mobilenet_v1_ppn_coco.pb", false);

@ -229,7 +229,7 @@ void ExifReader::parseExif()
uint32_t offset = getStartOffset();
size_t numEntry = getNumDirEntry();
size_t numEntry = getNumDirEntry( offset );
offset += 2; //go to start of tag fields
@ -303,7 +303,7 @@ uint32_t ExifReader::getStartOffset() const
*
* @return The number of directory entries
*/
size_t ExifReader::getNumDirEntry() const
size_t ExifReader::getNumDirEntry(const size_t offsetNumDir) const
{
return getU16( offsetNumDir );
}

@ -199,7 +199,7 @@ private:
bool checkTagMark() const;
size_t getFieldSize ();
size_t getNumDirEntry() const;
size_t getNumDirEntry( const size_t offsetNumDir ) const;
uint32_t getStartOffset() const;
uint16_t getExifTag( const size_t offset ) const;
uint16_t getU16( const size_t offset ) const;
@ -225,9 +225,6 @@ private:
private:
static const uint16_t tagMarkRequired = 0x2A;
//offset to the _number-of-directory-entry_ field
static const size_t offsetNumDir = 8;
//max size of data in tag.
//'DDDDDDDD' contains the value of that Tag. If its size is over 4bytes,
//'DDDDDDDD' contains the offset to data stored address.

@ -417,7 +417,7 @@ PERF_TEST_P(Size_CvtMode_Bayer, cvtColorBayer8u,
TEST_CYCLE() cvtColor(src, dst, mode, ch.dcn);
SANITY_CHECK(dst, 1);
SANITY_CHECK_NOTHING();
}
typedef tuple<Size, CvtMode2> Size_CvtMode2_t;

@ -389,7 +389,7 @@ Ptr<FilterEngine> createBoxFilter(int srcType, int dstType, Size ksize,
}
#endif
#if defined(HAVE_IPP)
#if 0 //defined(HAVE_IPP)
static bool ipp_boxfilter(Mat &src, Mat &dst, Size ksize, Point anchor, bool normalize, int borderType)
{
#ifdef HAVE_IPP_IW
@ -476,7 +476,7 @@ void boxFilter(InputArray _src, OutputArray _dst, int ddepth,
CV_OVX_RUN(true,
openvx_boxfilter(src, dst, ddepth, ksize, anchor, normalize, borderType))
CV_IPP_RUN_FAST(ipp_boxfilter(src, dst, ksize, anchor, normalize, borderType));
//CV_IPP_RUN_FAST(ipp_boxfilter(src, dst, ksize, anchor, normalize, borderType));
borderType = (borderType&~BORDER_ISOLATED);

@ -1153,14 +1153,14 @@ static void Bayer2RGB_VNG_8u( const Mat& srcmat, Mat& dstmat, int code )
{
Rs += srow[-bstep*2-2] + srow[0];
Gs += brow0[N6-1];
Bs += srow[-bstep+1]*2;
Bs += srow[-bstep-1]*2;
ng++;
}
if( gradSE < T )
{
Rs += srow[bstep*2+2] + srow[0];
Gs += brow2[N6+1];
Bs += srow[-bstep+1]*2;
Bs += srow[bstep+1]*2;
ng++;
}
R = srow[0];
@ -1394,8 +1394,8 @@ static void Bayer2RGB_VNG_8u( const Mat& srcmat, Mat& dstmat, int code )
RGs = _mm_adds_epi16(RGs, _mm_and_si128(_mm_merge_epi16(t1, t0), mask));
// GRs += {brow2[N6+1]; (srow[1]+srow[bstep*2+1])} * (T>gradSE)
GRs = _mm_adds_epi16(GRs, _mm_and_si128(_mm_merge_epi16(_mm_loadu_si128((__m128i*)(brow2+N6+1)), _mm_adds_epi16(x7,x10)), mask));
// Bs += {srow[-bstep+1]*2; (srow[bstep+2]+srow[bstep])} * (T>gradSE)
Bs = _mm_adds_epi16(Bs, _mm_and_si128(_mm_merge_epi16(_mm_slli_epi16(x5, 1), _mm_adds_epi16(x8,x11)), mask));
// Bs += {srow[bstep+1]*2; (srow[bstep+2]+srow[bstep])} * (T>gradSE)
Bs = _mm_adds_epi16(Bs, _mm_and_si128(_mm_merge_epi16(_mm_slli_epi16(x9, 1), _mm_adds_epi16(x8,x11)), mask));
// gradS ***********************************************
mask = _mm_cmpgt_epi16(T, gradS); // mask = T>gradS
@ -1451,7 +1451,7 @@ static void Bayer2RGB_VNG_8u( const Mat& srcmat, Mat& dstmat, int code )
// GRs += {brow0[N6-1]; (srow[-bstep*2-1]+srow[-1])} * (T>gradNW)
GRs = _mm_adds_epi16(GRs, _mm_and_si128(_mm_merge_epi16(_mm_loadu_si128((__m128i*)(brow0+N6-1)), _mm_adds_epi16(x2,x15)), mask));
// Bs += {srow[-bstep-1]*2; (srow[-bstep]+srow[-bstep-2])} * (T>gradNW)
Bs = _mm_adds_epi16(Bs, _mm_and_si128(_mm_merge_epi16(_mm_slli_epi16(x5, 1),_mm_adds_epi16(x3,x16)), mask));
Bs = _mm_adds_epi16(Bs, _mm_and_si128(_mm_merge_epi16(_mm_slli_epi16(x1, 1),_mm_adds_epi16(x3,x16)), mask));
__m128 ngf0 = _mm_div_ps(_0_5, _mm_cvtloepi16_ps(ng));
__m128 ngf1 = _mm_div_ps(_0_5, _mm_cvthiepi16_ps(ng));

@ -1022,7 +1022,7 @@ static bool replacementFilter2D(int stype, int dtype, int kernel_type,
return success;
}
#ifdef HAVE_IPP
#if 0 //defined HAVE_IPP
static bool ippFilter2D(int stype, int dtype, int kernel_type,
uchar * src_data, size_t src_step,
uchar * dst_data, size_t dst_step,
@ -1286,7 +1286,7 @@ void filter2D(int stype, int dtype, int kernel_type,
if (res)
return;
CV_IPP_RUN_FAST(ippFilter2D(stype, dtype, kernel_type,
/*CV_IPP_RUN_FAST(ippFilter2D(stype, dtype, kernel_type,
src_data, src_step,
dst_data, dst_step,
width, height,
@ -1295,7 +1295,7 @@ void filter2D(int stype, int dtype, int kernel_type,
kernel_data, kernel_step,
kernel_width, kernel_height,
anchor_x, anchor_y,
delta, borderType, isSubmatrix))
delta, borderType, isSubmatrix))*/
res = dftFilter2D(stype, dtype, kernel_type,
src_data, src_step,

@ -203,7 +203,7 @@ static bool openvx_medianFilter(InputArray _src, OutputArray _dst, int ksize)
}
#endif
#ifdef HAVE_IPP
#if 0 //defined HAVE_IPP
static bool ipp_medianFilter(Mat &src0, Mat &dst, int ksize)
{
CV_INSTRUMENT_REGION_IPP();
@ -301,7 +301,7 @@ void medianBlur( InputArray _src0, OutputArray _dst, int ksize )
CV_OVX_RUN(true,
openvx_medianFilter(_src0, _dst, ksize))
CV_IPP_RUN_FAST(ipp_medianFilter(src0, dst, ksize));
//CV_IPP_RUN_FAST(ipp_medianFilter(src0, dst, ksize));
#ifdef HAVE_TEGRA_OPTIMIZATION
if (tegra::useTegra() && tegra::medianBlur(src0, dst, ksize))

@ -363,7 +363,7 @@ static bool openvx_gaussianBlur(InputArray _src, OutputArray _dst, Size ksize,
#endif
#ifdef HAVE_IPP
#if 0 //defined HAVE_IPP
// IW 2017u2 has bug which doesn't allow use of partial inMem with tiling
#if IPP_DISABLE_GAUSSIANBLUR_PARALLEL
#define IPP_GAUSSIANBLUR_PARALLEL 0
@ -533,7 +533,7 @@ void GaussianBlur(InputArray _src, OutputArray _dst, Size ksize,
CV_OVX_RUN(true,
openvx_gaussianBlur(src, dst, ksize, sigma1, sigma2, borderType))
CV_IPP_RUN_FAST(ipp_GaussianBlur(src, dst, ksize, sigma1, sigma2, borderType));
//CV_IPP_RUN_FAST(ipp_GaussianBlur(src, dst, ksize, sigma1, sigma2, borderType));
if(sdepth == CV_8U && ((borderType & BORDER_ISOLATED) || !_src.getMat().isSubmatrix()))
{

@ -262,6 +262,10 @@ typedef uint32_t __u32;
#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17)
#endif
#ifndef V4L2_PIX_FMT_Y10
#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ')
#endif
/* Defaults - If your board can do better, set it here. Set for the most common type inputs. */
#define DEFAULT_V4L_WIDTH 640
#define DEFAULT_V4L_HEIGHT 480

@ -84,6 +84,8 @@ public:
{
if (!videoio_registry::hasBackend(apiPref))
throw SkipTestException(cv::String("Backend is not available/disabled: ") + cv::videoio_registry::getBackendName(apiPref));
if (cvtest::skipUnstableTests && apiPref == CAP_MSMF && (ext == "h264" || ext == "h265"))
throw SkipTestException("Unstable MSMF test");
writeVideo();
VideoCapture cap;
ASSERT_NO_THROW(cap.open(video_file, apiPref));
@ -170,6 +172,8 @@ public:
{
if (!videoio_registry::hasBackend(apiPref))
throw SkipTestException(cv::String("Backend is not available/disabled: ") + cv::videoio_registry::getBackendName(apiPref));
if (cvtest::skipUnstableTests && apiPref == CAP_MSMF && (ext == "h264" || ext == "h265"))
throw SkipTestException("Unstable MSMF test");
VideoCapture cap;
EXPECT_NO_THROW(cap.open(video_file, apiPref));
if (!cap.isOpened())

@ -3,10 +3,10 @@ if(WINCE)
# Try_Compile succeed and therefore also C/C++ ABI Detetection work
# https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/Platform/Windows-
# MSVC.cmake
set(CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib")
set(CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib oldnames.lib")
set(CMAKE_CXX_STANDARD_LIBRARIES_INIT ${CMAKE_C_STANDARD_LIBRARIES_INIT})
foreach(ID EXE SHARED MODULE)
string(APPEND CMAKE_${ID}_LINKER_FLAGS_INIT
" /NODEFAULTLIB:libc.lib /NODEFAULTLIB:oldnames.lib")
" /NODEFAULTLIB:libc.lib")
endforeach()
endif()

@ -57,6 +57,14 @@ For headless WEC2013, this configuration may not be limited to but is known to w
-DWITH_TIFF=OFF `
```
## Configuring to build as shared
Building OpenCV as shared libraries is as easy as appending
```
-DBUILD_SHARED_LIBS=ON `
-DBUILD_ZLIB=ON
```
to the build configuration.
## Building
You are required to build using Unicode:
`cmake --build . -- /p:CharacterSet=Unicode`

@ -1785,5 +1785,6 @@ layer {
code_type: CENTER_SIZE
keep_top_k: 200
confidence_threshold: 0.01
clip: 1
}
}

@ -1221,7 +1221,7 @@ node {
attr {
key: "padding"
value {
s: "SAME"
s: "VALID"
}
}
attr {
@ -1311,7 +1311,7 @@ node {
attr {
key: "padding"
value {
s: "SAME"
s: "VALID"
}
}
attr {
@ -2337,6 +2337,12 @@ node {
i: 400
}
}
attr {
key: "clip"
value {
b: true
}
}
}
node {
name: "reshape_before_softmax"

@ -917,7 +917,7 @@ layer {
}
convolution_param {
num_output: 128
pad: 1
pad: 0
kernel_size: 3
stride: 1
weight_filler {
@ -983,7 +983,7 @@ layer {
}
convolution_param {
num_output: 128
pad: 1
pad: 0
kernel_size: 3
stride: 1
weight_filler {
@ -1810,6 +1810,7 @@ layer {
code_type: CENTER_SIZE
keep_top_k: 200
confidence_threshold: 0.01
clip: 1
}
}
layer {

@ -1086,7 +1086,7 @@ layer {
}
convolution_param {
num_output: 128
pad: 1
pad: 0
kernel_size: 3
stride: 1
weight_filler {
@ -1600,7 +1600,7 @@ layer {
}
convolution_param {
num_output: 16
pad: 1
pad: 0
kernel_size: 3
stride: 1
weight_filler {

@ -67,7 +67,7 @@ def createSSDGraph(modelPath, configPath, outputPath):
'Sub', 'ResizeNearestNeighbor', 'Pad']
# Node with which prefixes should be removed
prefixesToRemove = ('MultipleGridAnchorGenerator/', 'Postprocessor/', 'Preprocessor/map')
prefixesToRemove = ('MultipleGridAnchorGenerator/', 'Concatenate/', 'Postprocessor/', 'Preprocessor/map')
# Load a config file.
config = readTextMessage(configPath)
@ -312,12 +312,16 @@ def createSSDGraph(modelPath, configPath, outputPath):
addConcatNode('PriorBox/concat', priorBoxes, 'concat/axis_flatten')
# Sigmoid for classes predictions and DetectionOutput layer
addReshape('ClassPredictor/concat', 'ClassPredictor/concat3d', [0, -1, num_classes + 1], graph_def)
sigmoid = NodeDef()
sigmoid.name = 'ClassPredictor/concat/sigmoid'
sigmoid.op = 'Sigmoid'
sigmoid.input.append('ClassPredictor/concat')
sigmoid.input.append('ClassPredictor/concat3d')
graph_def.node.extend([sigmoid])
addFlatten(sigmoid.name, sigmoid.name + '/Flatten', graph_def)
detectionOut = NodeDef()
detectionOut.name = 'detection_out'
detectionOut.op = 'DetectionOutput'
@ -326,7 +330,7 @@ def createSSDGraph(modelPath, configPath, outputPath):
detectionOut.input.append('BoxEncodingPredictor/concat')
else:
detectionOut.input.append('BoxPredictor/concat')
detectionOut.input.append(sigmoid.name)
detectionOut.input.append(sigmoid.name + '/Flatten')
detectionOut.input.append('PriorBox/concat')
detectionOut.addAttr('num_classes', num_classes + 1)

Loading…
Cancel
Save