Merge remote-tracking branch 'upstream/3.4' into merge-3.4
authorAlexander Alekhin <alexander.a.alekhin@gmail.com>
Fri, 13 Nov 2020 22:29:14 +0000 (22:29 +0000)
committerAlexander Alekhin <alexander.a.alekhin@gmail.com>
Fri, 13 Nov 2020 22:29:14 +0000 (22:29 +0000)
1  2 
modules/dnn/perf/perf_convolution3d.cpp
modules/dnn/src/layers/convolution_layer.cpp
modules/dnn/src/onnx/onnx_importer.cpp
modules/dnn/test/test_onnx_importer.cpp
modules/dnn/test/test_tf_importer.cpp
modules/java/generator/gen_java.py
modules/python/src2/hdr_parser.py

@@@ -302,15 -266,7 +307,17 @@@ public
  
      virtual bool supportBackend(int backendId) CV_OVERRIDE
      {
-             if(kernel_size.size() == 2 || kernel_size.size() == 3)
+         size_t ksize = kernel_size.size();
++#ifdef HAVE_CUDA
 +        if (backendId == DNN_BACKEND_CUDA)
 +        {
 +            /* only convolution 2d and 3d supported */
++            if (ksize == 2 || ksize == 3)
 +                return true;
 +
 +            return false;
 +        }
++#endif
  #ifdef HAVE_INF_ENGINE
          if (backendId == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 || backendId == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH)
          {
                  return false;
              return (preferableTarget != DNN_TARGET_MYRIAD || dilation.width == dilation.height);
          }
-         else
  #endif
-         {
-             if (kernel_size.size() == 3)
-                 return (preferableTarget == DNN_TARGET_CPU && backendId == DNN_BACKEND_OPENCV);
-             else if (kernel_size.size() == 2)
-                 return backendId == DNN_BACKEND_OPENCV ||
-                        (backendId == DNN_BACKEND_HALIDE && !blobs.empty()) ||
-                        (backendId == DNN_BACKEND_VKCOM && haveVulkan());
-             else
-                 return false;
-         }
+         if (backendId == DNN_BACKEND_OPENCV)
+             return ksize >= 1 && ksize <= 3;
+ #ifdef HAVE_HALIDE
+         if (backendId == DNN_BACKEND_HALIDE)
+             return ksize == 2 && !blobs.empty();
+ #endif
++#ifdef HAVE_VULKAN
++        if (backendId == DNN_BACKEND_VKCOM)
++            return ksize == 2;
++#endif
+         return false;
      }
  
      bool getMemoryShapes(const std::vector<MatShape> &inputs,
Simple merge
@@@ -1065,9 -1046,9 +1066,9 @@@ JNIEXPORT $rtype JNICALL Java_org_openc
  #                    )
  ################################################################
                      ci.j_code.write("""
-     // C++: enum {1}
+     // C++: enum {1} ({2})
      public static final int
-             {0};\n\n""".format((",\n"+" "*12).join(["%s = %s" % (c.name, c.value) for c in consts]), typeName)
 -            {0};\n\n""".format((",\n"+" "*12).join(["%s = %s" % (c.name, const_value(c.value)) for c in consts]), typeNameShort, typeName)
++            {0};\n\n""".format((",\n"+" "*12).join(["%s = %s" % (c.name, c.value) for c in consts]), typeNameShort, typeName)
                      )
                  else:
                      ci.j_code.write("""
Simple merge