diff --git a/modules/dnn/include/opencv2/dnn/all_layers.hpp b/modules/dnn/include/opencv2/dnn/all_layers.hpp index 49be0674f4..1093882572 100644 --- a/modules/dnn/include/opencv2/dnn/all_layers.hpp +++ b/modules/dnn/include/opencv2/dnn/all_layers.hpp @@ -258,7 +258,6 @@ CV__DNN_INLINE_NS_BEGIN static Ptr create(const LayerParams& params); bool fusedActivation = false; bool fusedAdd = false; - bool isConv2D = false; // Should be deleted after fastconv branch support Conv1D and Conv3D. bool useWinograd = false; // Flag whether to use Winograd to speed up 3x3 convolution. }; diff --git a/modules/dnn/src/layers/convolution_layer.cpp b/modules/dnn/src/layers/convolution_layer.cpp index fc0120cdb8..d224641fab 100644 --- a/modules/dnn/src/layers/convolution_layer.cpp +++ b/modules/dnn/src/layers/convolution_layer.cpp @@ -116,9 +116,6 @@ public: fusedWeights = false; fusedBias = false; - - if (kernel_size.size() == 2) - isConv2D = true; } virtual void finalize(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr) CV_OVERRIDE diff --git a/modules/dnn/src/net_impl_fuse.cpp b/modules/dnn/src/net_impl_fuse.cpp index 38aa6476cd..271f9001b0 100644 --- a/modules/dnn/src/net_impl_fuse.cpp +++ b/modules/dnn/src/net_impl_fuse.cpp @@ -170,8 +170,8 @@ void Net::Impl::fuseLayers(const std::vector& blobsToKeep_) // To avoid the order like: conv + activ + add, if we found the conv has been fused with activ, we break. Ptr convLayer = ld.layerInstance.dynamicCast(); - // Only Conv2D without fusion Activation supports this fusion, other-wise, we skip. - if (!convLayer->isConv2D || convLayer->fusedActivation) + // Only Convolution layer without fusion Activation supports this fusion, other-wise, we skip. + if (convLayer->fusedActivation) break; // For now, there are currently two layers in OpenCV that run the Add operator.