From 1060c0f439cbb8de44ff258d2ad3ab9c6b429331 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Thu, 15 Mar 2018 16:16:56 +0300 Subject: [PATCH] dnn: apply CV_OVERRIDE/CV_FINAL --- .../dnn/include/opencv2/dnn/all_layers.hpp | 4 +- modules/dnn/src/caffe/caffe_io.hpp | 8 +++ modules/dnn/src/dnn.cpp | 14 ++--- modules/dnn/src/layers/batch_norm_layer.cpp | 20 +++---- modules/dnn/src/layers/blank_layer.cpp | 8 +-- modules/dnn/src/layers/concat_layer.cpp | 16 +++--- modules/dnn/src/layers/convolution_layer.cpp | 50 ++++++++--------- modules/dnn/src/layers/crop_layer.cpp | 10 ++-- .../dnn/src/layers/detection_output_layer.cpp | 12 ++--- modules/dnn/src/layers/elementwise_layers.cpp | 20 +++---- modules/dnn/src/layers/eltwise_layer.cpp | 20 +++---- modules/dnn/src/layers/flatten_layer.cpp | 12 ++--- .../dnn/src/layers/fully_connected_layer.cpp | 22 ++++---- modules/dnn/src/layers/lrn_layer.cpp | 20 +++---- .../dnn/src/layers/max_unpooling_layer.cpp | 12 ++--- modules/dnn/src/layers/mvn_layer.cpp | 12 ++--- .../dnn/src/layers/normalize_bbox_layer.cpp | 8 +-- modules/dnn/src/layers/padding_layer.cpp | 14 ++--- modules/dnn/src/layers/permute_layer.cpp | 16 +++--- modules/dnn/src/layers/pooling_layer.cpp | 22 ++++---- modules/dnn/src/layers/prior_box_layer.cpp | 14 ++--- modules/dnn/src/layers/proposal_layer.cpp | 10 ++-- modules/dnn/src/layers/recurrent_layers.cpp | 30 +++++------ modules/dnn/src/layers/region_layer.cpp | 12 ++--- modules/dnn/src/layers/reorg_layer.cpp | 12 ++--- modules/dnn/src/layers/reshape_layer.cpp | 12 ++--- .../layers/resize_nearest_neighbor_layer.cpp | 8 +-- modules/dnn/src/layers/scale_layer.cpp | 20 +++---- modules/dnn/src/layers/shift_layer.cpp | 18 +++---- modules/dnn/src/layers/slice_layer.cpp | 10 ++-- modules/dnn/src/layers/softmax_layer.cpp | 18 +++---- modules/dnn/src/layers/split_layer.cpp | 8 +-- modules/dnn/src/op_halide.hpp | 13 +++-- modules/dnn/src/op_inf_engine.cpp | 4 ++ modules/dnn/src/op_inf_engine.hpp | 53 +++++++++++-------- .../src/tensorflow/tf_graph_simplifier.cpp | 8 +-- modules/dnn/src/tensorflow/tf_importer.cpp | 6 +-- modules/dnn/src/tensorflow/tf_io.cpp | 2 +- modules/dnn/src/tensorflow/tf_io.hpp | 12 +++++ 39 files changed, 313 insertions(+), 277 deletions(-) diff --git a/modules/dnn/include/opencv2/dnn/all_layers.hpp b/modules/dnn/include/opencv2/dnn/all_layers.hpp index e6c8e9f297..2cdf70086c 100644 --- a/modules/dnn/include/opencv2/dnn/all_layers.hpp +++ b/modules/dnn/include/opencv2/dnn/all_layers.hpp @@ -152,8 +152,8 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN * (i.e. @f$ x_{t}^{stream} @f$ is stored inside @p input[0][stream, ...]). */ - int inputNameToIndex(String inputName); - int outputNameToIndex(const String& outputName); + int inputNameToIndex(String inputName) CV_OVERRIDE; + int outputNameToIndex(const String& outputName) CV_OVERRIDE; }; /** @brief Classical recurrent layer diff --git a/modules/dnn/src/caffe/caffe_io.hpp b/modules/dnn/src/caffe/caffe_io.hpp index b8a1b257c2..544db1c3ed 100644 --- a/modules/dnn/src/caffe/caffe_io.hpp +++ b/modules/dnn/src/caffe/caffe_io.hpp @@ -91,7 +91,15 @@ #define __OPENCV_DNN_CAFFE_IO_HPP__ #ifdef HAVE_PROTOBUF +#if defined(__GNUC__) && __GNUC__ >= 5 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsuggest-override" +#endif #include "opencv-caffe.pb.h" +#if defined(__GNUC__) && __GNUC__ >= 5 +#pragma GCC diagnostic pop +#endif + namespace caffe { using namespace opencv_caffe; } // avoid massive renames from caffe proto package namespace cv { diff --git a/modules/dnn/src/dnn.cpp b/modules/dnn/src/dnn.cpp index d5ceeba3b9..611e35e386 100644 --- a/modules/dnn/src/dnn.cpp +++ b/modules/dnn/src/dnn.cpp @@ -283,12 +283,12 @@ public: ~OpenCLBackendWrapper() {} // Copies data from device to a host memory. - virtual void copyToHost() + virtual void copyToHost() CV_OVERRIDE { umat.copyTo(*host); } - virtual void setHostDirty() + virtual void setHostDirty() CV_OVERRIDE { hostDirty = true; }; @@ -395,11 +395,11 @@ struct LayerData //fake layer containing network input blobs struct DataLayer : public Layer { - void finalize(const std::vector&, std::vector&) {} - void forward(std::vector&, std::vector&, std::vector &) {} - void forward(InputArrayOfArrays inputs, OutputArrayOfArrays outputs, OutputArrayOfArrays internals) {} + void finalize(const std::vector&, std::vector&) CV_OVERRIDE {} + void forward(std::vector&, std::vector&, std::vector &) CV_OVERRIDE {} + void forward(InputArrayOfArrays inputs, OutputArrayOfArrays outputs, OutputArrayOfArrays internals) CV_OVERRIDE {} - int outputNameToIndex(const String& tgtName) + int outputNameToIndex(const String& tgtName) CV_OVERRIDE { int idx = (int)(std::find(outNames.begin(), outNames.end(), tgtName) - outNames.begin()); return (idx < (int)outNames.size()) ? idx : -1; @@ -413,7 +413,7 @@ struct DataLayer : public Layer bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(inputs.size() == requiredOutputs); outputs.assign(inputs.begin(), inputs.end()); diff --git a/modules/dnn/src/layers/batch_norm_layer.cpp b/modules/dnn/src/layers/batch_norm_layer.cpp index fb79d1f806..df4e553309 100644 --- a/modules/dnn/src/layers/batch_norm_layer.cpp +++ b/modules/dnn/src/layers/batch_norm_layer.cpp @@ -23,7 +23,7 @@ namespace cv namespace dnn { -class BatchNormLayerImpl : public BatchNormLayer +class BatchNormLayerImpl CV_FINAL : public BatchNormLayer { public: Mat weights_, bias_; @@ -90,7 +90,7 @@ public: } } - void getScaleShift(Mat& scale, Mat& shift) const + void getScaleShift(Mat& scale, Mat& shift) const CV_OVERRIDE { scale = weights_; shift = bias_; @@ -99,7 +99,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { if (!useGlobalStats && inputs[0][0] != 1) CV_Error(Error::StsNotImplemented, "Batch normalization in training mode with batch size > 1"); @@ -107,7 +107,7 @@ public: return true; } - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT || backendId == DNN_BACKEND_HALIDE && haveHalide() || @@ -176,7 +176,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -188,7 +188,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -219,7 +219,7 @@ public: } } - virtual Ptr tryAttach(const Ptr& node) + virtual Ptr tryAttach(const Ptr& node) CV_OVERRIDE { switch (node->backendId) { @@ -251,7 +251,7 @@ public: return Ptr(); } - virtual Ptr initHalide(const std::vector > &inputs) + virtual Ptr initHalide(const std::vector > &inputs) CV_OVERRIDE { #ifdef HAVE_HALIDE Halide::Buffer input = halideBuffer(inputs[0]); @@ -278,7 +278,7 @@ public: } #endif // HAVE_HALIDE - virtual Ptr initInfEngine(const std::vector >&) + virtual Ptr initInfEngine(const std::vector >&) CV_OVERRIDE { #ifdef HAVE_INF_ENGINE InferenceEngine::LayerParams lp; @@ -296,7 +296,7 @@ public: } virtual int64 getFLOPS(const std::vector &inputs, - const std::vector &outputs) const + const std::vector &outputs) const CV_OVERRIDE { (void)outputs; // suppress unused variable warning diff --git a/modules/dnn/src/layers/blank_layer.cpp b/modules/dnn/src/layers/blank_layer.cpp index c5568b0d58..1ed17bb357 100644 --- a/modules/dnn/src/layers/blank_layer.cpp +++ b/modules/dnn/src/layers/blank_layer.cpp @@ -45,7 +45,7 @@ namespace cv { namespace dnn { -class BlankLayerImpl : public BlankLayer +class BlankLayerImpl CV_FINAL : public BlankLayer { public: BlankLayerImpl(const LayerParams& params) @@ -56,7 +56,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { Layer::getMemoryShapes(inputs, requiredOutputs, outputs, internals); return true; @@ -83,7 +83,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -95,7 +95,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); diff --git a/modules/dnn/src/layers/concat_layer.cpp b/modules/dnn/src/layers/concat_layer.cpp index fd55e7c24a..172d0a076c 100644 --- a/modules/dnn/src/layers/concat_layer.cpp +++ b/modules/dnn/src/layers/concat_layer.cpp @@ -54,7 +54,7 @@ namespace cv namespace dnn { -class ConcatLayerImpl : public ConcatLayer +class ConcatLayerImpl CV_FINAL : public ConcatLayer { public: ConcatLayerImpl(const LayerParams& params) @@ -67,7 +67,7 @@ public: virtual bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(inputs.size() > 0); outputs.resize(1, inputs[0]); @@ -101,7 +101,7 @@ public: return false; } - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT || backendId == DNN_BACKEND_HALIDE && haveHalide() && axis == 1 && !padding || // By channels @@ -157,7 +157,7 @@ public: ChannelConcatInvoker() : inputs(0), output(0), nstripes(0) {} - void operator()(const Range& r) const + void operator()(const Range& r) const CV_OVERRIDE { size_t planeSize = (size_t)output->size[2]*output->size[3]; size_t nch = chptrs.size(); @@ -230,7 +230,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -242,7 +242,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -278,7 +278,7 @@ public: } } - virtual Ptr initHalide(const std::vector > &input) + virtual Ptr initHalide(const std::vector > &input) CV_OVERRIDE { #ifdef HAVE_HALIDE std::vector > inputBuffers = halideBuffers(input); @@ -301,7 +301,7 @@ public: return Ptr(); } - virtual Ptr initInfEngine(const std::vector >& inputs) + virtual Ptr initInfEngine(const std::vector >& inputs) CV_OVERRIDE { #ifdef HAVE_INF_ENGINE InferenceEngine::DataPtr input = infEngineDataNode(inputs[0]); diff --git a/modules/dnn/src/layers/convolution_layer.cpp b/modules/dnn/src/layers/convolution_layer.cpp index 84841bf43f..6da843809e 100644 --- a/modules/dnn/src/layers/convolution_layer.cpp +++ b/modules/dnn/src/layers/convolution_layer.cpp @@ -79,14 +79,14 @@ public: adjustPad.height < stride.height); } - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT || backendId == DNN_BACKEND_HALIDE && haveHalide() || backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine(); } - void finalize(const std::vector &inputs, std::vector &outputs) + void finalize(const std::vector &inputs, std::vector &outputs) CV_OVERRIDE { CV_Assert(inputs.size() > 0); @@ -123,7 +123,7 @@ public: virtual void applyHalideScheduler(Ptr& node, const std::vector &inputs, const std::vector &outputs, - int targetId) const + int targetId) const CV_OVERRIDE { #ifdef HAVE_HALIDE if (targetId != DNN_TARGET_CPU) @@ -165,7 +165,7 @@ public: #define IS_POWER_LAYER(layer) \ (!layer.empty() && !layer->type.compare("Power")) //TODO: simultaneously convolution and bias addition for cache optimization -class ConvolutionLayerImpl : public BaseConvolutionLayerImpl +class ConvolutionLayerImpl CV_FINAL : public BaseConvolutionLayerImpl { public: enum { VEC_ALIGN = 8, DFT_TYPE = CV_32F }; @@ -194,7 +194,7 @@ public: #endif } - MatShape computeColRowShape(const MatShape &inpShape, const MatShape &outShape) const + MatShape computeColRowShape(const MatShape &inpShape, const MatShape &outShape) const CV_OVERRIDE { Size out(outShape[3], outShape[2]); int inpGroupCn = blobs[0].size[1]; @@ -205,7 +205,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(blobs.size() != 0); CV_Assert(!hasBias() || blobs[1].total() == (size_t)blobs[0].size[0]); @@ -239,7 +239,7 @@ public: return false; } - virtual void finalize(const std::vector &inputs, std::vector &outputs) + virtual void finalize(const std::vector &inputs, std::vector &outputs) CV_OVERRIDE { BaseConvolutionLayerImpl::finalize(inputs, outputs); @@ -278,7 +278,7 @@ public: #endif } - bool setActivation(const Ptr& layer) + bool setActivation(const Ptr& layer) CV_OVERRIDE { activ = layer; if (activ.empty()) @@ -312,7 +312,7 @@ public: return !activ.empty(); } - virtual bool tryFuse(Ptr& top) + virtual bool tryFuse(Ptr& top) CV_OVERRIDE { Mat w, b; top->getScaleShift(w, b); @@ -357,7 +357,7 @@ public: biasvec[outCn] = biasvec[outCn+1] = biasvec[outCn-1]; } - virtual Ptr initHalide(const std::vector > &inputs) + virtual Ptr initHalide(const std::vector > &inputs) CV_OVERRIDE { #ifdef HAVE_HALIDE Halide::Buffer inputBuffer = halideBuffer(inputs[0]); @@ -405,7 +405,7 @@ public: return Ptr(); } - virtual Ptr initInfEngine(const std::vector > &inputs) + virtual Ptr initInfEngine(const std::vector > &inputs) CV_OVERRIDE { #ifdef HAVE_INF_ENGINE InferenceEngine::DataPtr input = infEngineDataNode(inputs[0]); @@ -517,7 +517,7 @@ public: parallel_for_(Range(0, nstripes), p, nstripes); } - virtual void operator ()(const Range &r0) const + virtual void operator ()(const Range &r0) const CV_OVERRIDE { const int valign = ConvolutionLayerImpl::VEC_ALIGN; int ngroups = ngroups_, batchSize = input_->size[0]*ngroups; @@ -937,7 +937,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -949,7 +949,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -993,7 +993,7 @@ public: } virtual int64 getFLOPS(const std::vector &inputs, - const std::vector &outputs) const + const std::vector &outputs) const CV_OVERRIDE { CV_Assert(inputs.size() == outputs.size()); @@ -1007,7 +1007,7 @@ public: } }; -class DeConvolutionLayerImpl : public BaseConvolutionLayerImpl +class DeConvolutionLayerImpl CV_FINAL : public BaseConvolutionLayerImpl { public: Mat weightsMat, biasesMat; @@ -1016,7 +1016,7 @@ public: DeConvolutionLayerImpl(const LayerParams& params) : BaseConvolutionLayerImpl(params) {} - MatShape computeColRowShape(const MatShape &inpShape, const MatShape &outShape) const + MatShape computeColRowShape(const MatShape &inpShape, const MatShape &outShape) const CV_OVERRIDE { int inpCn = inpShape[1]; int inpH = inpShape[2]; @@ -1031,7 +1031,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(!hasBias() || blobs[1].total() == (size_t)numOutput); CV_Assert(inputs.size() != 0); @@ -1080,7 +1080,7 @@ public: return false; } - void finalize(const std::vector &inputs, std::vector &outputs) + void finalize(const std::vector &inputs, std::vector &outputs) CV_OVERRIDE { BaseConvolutionLayerImpl::finalize(inputs, outputs); getConvPoolPaddings(Size(outputs[0].size[3], outputs[0].size[2]), @@ -1102,7 +1102,7 @@ public: useAVX512 = CV_CPU_HAS_SUPPORT_AVX512_SKX; } - void operator()(const Range& range_) const + void operator()(const Range& range_) const CV_OVERRIDE { int stripeSize = (int)alignSize((b_->cols + nstripes_ - 1)/nstripes_, 16); Range range(range_.start*stripeSize, std::min(range_.end*stripeSize, b_->cols)); @@ -1277,7 +1277,7 @@ public: parallel_for_(Range(0, nstripes), t, nstripes); } - virtual void operator ()(const Range &r) const + virtual void operator ()(const Range &r) const CV_OVERRIDE { const float* data_col_ = data_col; float* data_im_ = data_im; @@ -1423,7 +1423,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -1435,7 +1435,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -1489,7 +1489,7 @@ public: } } - virtual Ptr initHalide(const std::vector > &inputs) + virtual Ptr initHalide(const std::vector > &inputs) CV_OVERRIDE { #ifdef HAVE_HALIDE Halide::Buffer inputBuffer = halideBuffer(inputs[0]); @@ -1543,7 +1543,7 @@ public: } virtual int64 getFLOPS(const std::vector &inputs, - const std::vector &outputs) const + const std::vector &outputs) const CV_OVERRIDE { CV_Assert(inputs.size() == outputs.size()); diff --git a/modules/dnn/src/layers/crop_layer.cpp b/modules/dnn/src/layers/crop_layer.cpp index 0d43487376..8b56f6f439 100644 --- a/modules/dnn/src/layers/crop_layer.cpp +++ b/modules/dnn/src/layers/crop_layer.cpp @@ -48,7 +48,7 @@ namespace cv namespace dnn { -class CropLayerImpl : public CropLayer +class CropLayerImpl CV_FINAL : public CropLayer { public: CropLayerImpl(const LayerParams& params) @@ -67,7 +67,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(inputs.size() == 2); @@ -83,7 +83,7 @@ public: return false; } - void finalize(const std::vector &inputs, std::vector &outputs) + void finalize(const std::vector &inputs, std::vector &outputs) CV_OVERRIDE { CV_Assert(2 == inputs.size()); @@ -119,7 +119,7 @@ public: } } - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -127,7 +127,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); diff --git a/modules/dnn/src/layers/detection_output_layer.cpp b/modules/dnn/src/layers/detection_output_layer.cpp index dcce8422ba..c6b711f841 100644 --- a/modules/dnn/src/layers/detection_output_layer.cpp +++ b/modules/dnn/src/layers/detection_output_layer.cpp @@ -93,7 +93,7 @@ static inline float caffe_norm_box_overlap(const util::NormalizedBBox& a, const } // namespace -class DetectionOutputLayerImpl : public DetectionOutputLayer +class DetectionOutputLayerImpl CV_FINAL : public DetectionOutputLayer { public: unsigned _numClasses; @@ -193,7 +193,7 @@ public: setParamsFrom(params); } - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT || backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine() && !_locPredTransposed; @@ -202,7 +202,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(inputs.size() >= 3); CV_Assert(inputs[0][0] == inputs[1][0]); @@ -367,7 +367,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -379,7 +379,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -862,7 +862,7 @@ public: } } - virtual Ptr initInfEngine(const std::vector >&) + virtual Ptr initInfEngine(const std::vector >&) CV_OVERRIDE { #ifdef HAVE_INF_ENGINE InferenceEngine::LayerParams lp; diff --git a/modules/dnn/src/layers/elementwise_layers.cpp b/modules/dnn/src/layers/elementwise_layers.cpp index 44c8567acf..1b8b2c7935 100644 --- a/modules/dnn/src/layers/elementwise_layers.cpp +++ b/modules/dnn/src/layers/elementwise_layers.cpp @@ -82,7 +82,7 @@ public: nstripes_ = nstripes; } - void operator()(const Range &r) const + void operator()(const Range &r) const CV_OVERRIDE { int nstripes = nstripes_, nsamples = 1, outCn = 1; size_t planeSize = 1; @@ -113,14 +113,14 @@ public: ElementWiseLayer(const Func &f=Func()) : run_parallel(false) { func = f; } - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT || backendId == DNN_BACKEND_HALIDE && haveHalide() || backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine() && this->type != "Sigmoid"; } - virtual Ptr tryAttach(const Ptr& node) + virtual Ptr tryAttach(const Ptr& node) CV_OVERRIDE { switch (node->backendId) { @@ -140,7 +140,7 @@ public: return Ptr(); } - virtual Ptr initHalide(const std::vector > &inputs) + virtual Ptr initHalide(const std::vector > &inputs) CV_OVERRIDE { #ifdef HAVE_HALIDE Halide::Buffer input = halideBuffer(inputs[0]); @@ -152,7 +152,7 @@ public: return Ptr(); } - virtual Ptr initInfEngine(const std::vector >&) + virtual Ptr initInfEngine(const std::vector >&) CV_OVERRIDE { #ifdef HAVE_INF_ENGINE InferenceEngine::LayerParams lp; @@ -166,13 +166,13 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { Layer::getMemoryShapes(inputs, requiredOutputs, outputs, internals); return true; } - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); @@ -183,7 +183,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); @@ -200,13 +200,13 @@ public: } } - void forwardSlice(const float* src, float* dst, int len, size_t planeSize, int cn0, int cn1) const + void forwardSlice(const float* src, float* dst, int len, size_t planeSize, int cn0, int cn1) const CV_OVERRIDE { func.apply(src, dst, len, planeSize, cn0, cn1); } virtual int64 getFLOPS(const std::vector &inputs, - const std::vector &outputs) const + const std::vector &outputs) const CV_OVERRIDE { long flops = 0; for (int i = 0; i < outputs.size(); i++) diff --git a/modules/dnn/src/layers/eltwise_layer.cpp b/modules/dnn/src/layers/eltwise_layer.cpp index 01c1f2f4be..58a651e628 100644 --- a/modules/dnn/src/layers/eltwise_layer.cpp +++ b/modules/dnn/src/layers/eltwise_layer.cpp @@ -54,7 +54,7 @@ namespace cv namespace dnn { -class EltwiseLayerImpl : public EltwiseLayer +class EltwiseLayerImpl CV_FINAL : public EltwiseLayer { public: enum EltwiseOp @@ -94,7 +94,7 @@ public: } } - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT || backendId == DNN_BACKEND_HALIDE && haveHalide() || @@ -104,7 +104,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(inputs.size() >= 2); CV_Assert(coeffs.size() == 0 || coeffs.size() == inputs.size()); @@ -178,7 +178,7 @@ public: parallel_for_(Range(0, nstripes), p, nstripes); } - void operator()(const Range& r) const + void operator()(const Range& r) const CV_OVERRIDE { size_t total = dst->size[0]*planeSize; size_t stripeSize = (total + nstripes - 1)/nstripes; @@ -338,7 +338,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -350,7 +350,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -361,7 +361,7 @@ public: coeffs, op, activ.get(), nstripes); } - virtual Ptr initHalide(const std::vector > &input) + virtual Ptr initHalide(const std::vector > &input) CV_OVERRIDE { #ifdef HAVE_HALIDE Halide::Var x("x"), y("y"), c("c"), n("n"); @@ -407,7 +407,7 @@ public: return Ptr(); } - virtual Ptr initInfEngine(const std::vector >&) + virtual Ptr initInfEngine(const std::vector >&) CV_OVERRIDE { #ifdef HAVE_INF_ENGINE InferenceEngine::LayerParams lp; @@ -429,7 +429,7 @@ public: } virtual int64 getFLOPS(const std::vector &inputs, - const std::vector &outputs) const + const std::vector &outputs) const CV_OVERRIDE { (void)outputs; // suppress unused variable warning CV_Assert(inputs.size()); @@ -439,7 +439,7 @@ public: return flops; } - bool setActivation(const Ptr& layer) + bool setActivation(const Ptr& layer) CV_OVERRIDE { activ = layer; return !activ.empty(); diff --git a/modules/dnn/src/layers/flatten_layer.cpp b/modules/dnn/src/layers/flatten_layer.cpp index dd46b86e69..1df1681a46 100644 --- a/modules/dnn/src/layers/flatten_layer.cpp +++ b/modules/dnn/src/layers/flatten_layer.cpp @@ -52,7 +52,7 @@ namespace cv namespace dnn { -class FlattenLayerImpl : public FlattenLayer +class FlattenLayerImpl CV_FINAL : public FlattenLayer { public: FlattenLayerImpl(const LayerParams ¶ms) @@ -62,7 +62,7 @@ public: setParamsFrom(params); } - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT || backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine(); @@ -71,7 +71,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(inputs.size() > 0); for (size_t i = 1; i < inputs.size(); i++) @@ -135,7 +135,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -148,7 +148,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -160,7 +160,7 @@ public: } } - virtual Ptr initInfEngine(const std::vector >&) + virtual Ptr initInfEngine(const std::vector >&) CV_OVERRIDE { #ifdef HAVE_INF_ENGINE InferenceEngine::LayerParams lp; diff --git a/modules/dnn/src/layers/fully_connected_layer.cpp b/modules/dnn/src/layers/fully_connected_layer.cpp index f00d9cfae8..68ca1b4f5f 100644 --- a/modules/dnn/src/layers/fully_connected_layer.cpp +++ b/modules/dnn/src/layers/fully_connected_layer.cpp @@ -56,7 +56,7 @@ namespace cv namespace dnn { -class FullyConnectedLayerImpl : public InnerProductLayer +class FullyConnectedLayerImpl CV_FINAL : public InnerProductLayer { public: enum { VEC_ALIGN = 8 }; @@ -106,7 +106,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &) const + std::vector &) const CV_OVERRIDE { CV_Assert(inputs.size() == 1); CV_Assert(1 <= blobs.size() && blobs.size() <= 2); @@ -125,14 +125,14 @@ public: return false; } - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT || backendId == DNN_BACKEND_HALIDE && haveHalide() && axis == 1 || backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine() && axis == 1; } - virtual bool setActivation(const Ptr& layer) + virtual bool setActivation(const Ptr& layer) CV_OVERRIDE { activ = layer; return !activ.empty(); @@ -168,7 +168,7 @@ public: parallel_for_(Range(0, nstripes), p, nstripes); } - void operator()(const Range& r) const + void operator()(const Range& r) const CV_OVERRIDE { int valign = FullyConnectedLayerImpl::VEC_ALIGN; int nsamples = srcMat->rows; @@ -267,7 +267,7 @@ public: }; #ifdef HAVE_OPENCL - void finalize(const std::vector &inputs, std::vector &outputs) + void finalize(const std::vector &inputs, std::vector &outputs) CV_OVERRIDE { innerProductOp.release(); } @@ -348,7 +348,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -360,7 +360,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &input, std::vector &output, std::vector &) + void forward(std::vector &input, std::vector &output, std::vector &) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -378,7 +378,7 @@ public: } } - virtual Ptr initHalide(const std::vector > &inputs) + virtual Ptr initHalide(const std::vector > &inputs) CV_OVERRIDE { #ifdef HAVE_HALIDE int inW, inH, inC, inN, outC = blobs[0].size[0]; @@ -402,7 +402,7 @@ public: return Ptr(); } - virtual Ptr initInfEngine(const std::vector >&) + virtual Ptr initInfEngine(const std::vector >&) CV_OVERRIDE { #ifdef HAVE_INF_ENGINE InferenceEngine::LayerParams lp; @@ -421,7 +421,7 @@ public: } virtual int64 getFLOPS(const std::vector &inputs, - const std::vector &outputs) const + const std::vector &outputs) const CV_OVERRIDE { (void)inputs; // suppress unused variable warning long flops = 0; diff --git a/modules/dnn/src/layers/lrn_layer.cpp b/modules/dnn/src/layers/lrn_layer.cpp index 34b022fbb4..25eb1540b1 100644 --- a/modules/dnn/src/layers/lrn_layer.cpp +++ b/modules/dnn/src/layers/lrn_layer.cpp @@ -59,7 +59,7 @@ namespace cv namespace dnn { -class LRNLayerImpl : public LRNLayer +class LRNLayerImpl CV_FINAL : public LRNLayer { public: LRNLayerImpl(const LayerParams& params) @@ -88,7 +88,7 @@ public: Ptr > lrnOp; #endif - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT || backendId == DNN_BACKEND_HALIDE && haveHalide() || @@ -96,7 +96,7 @@ public: } #ifdef HAVE_OPENCL - void finalize(const std::vector &inputs, std::vector &outputs) + void finalize(const std::vector &inputs, std::vector &outputs) CV_OVERRIDE { lrnOp.release(); } @@ -139,7 +139,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -153,7 +153,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -196,7 +196,7 @@ public: planeSize_ = planeSize; nsamples_ = nsamples; nstripes_ = nstripes; } - void operator()(const Range& r) const + void operator()(const Range& r) const CV_OVERRIDE { int nsamples = nsamples_, nstripes = nstripes_; size_t planeSize = planeSize_, planeSize_n = planeSize * nsamples; @@ -303,7 +303,7 @@ public: } } - virtual Ptr initHalide(const std::vector > &inputs) + virtual Ptr initHalide(const std::vector > &inputs) CV_OVERRIDE { #ifdef HAVE_HALIDE float alphaSize = alpha; @@ -347,7 +347,7 @@ public: virtual void applyHalideScheduler(Ptr& node, const std::vector &inputs, const std::vector &outputs, - int targetId) const + int targetId) const CV_OVERRIDE { #ifdef HAVE_HALIDE if (targetId != DNN_TARGET_CPU) @@ -376,7 +376,7 @@ public: #endif // HAVE_HALIDE } - virtual Ptr initInfEngine(const std::vector >&) + virtual Ptr initInfEngine(const std::vector >&) CV_OVERRIDE { #ifdef HAVE_INF_ENGINE InferenceEngine::LayerParams lp; @@ -396,7 +396,7 @@ public: } virtual int64 getFLOPS(const std::vector &inputs, - const std::vector &outputs) const + const std::vector &outputs) const CV_OVERRIDE { (void)outputs; // suppress unused variable warning CV_Assert(inputs.size() > 0); diff --git a/modules/dnn/src/layers/max_unpooling_layer.cpp b/modules/dnn/src/layers/max_unpooling_layer.cpp index 8b7c96f2fc..09509dfb4f 100644 --- a/modules/dnn/src/layers/max_unpooling_layer.cpp +++ b/modules/dnn/src/layers/max_unpooling_layer.cpp @@ -21,7 +21,7 @@ namespace cv namespace dnn { -class MaxUnpoolLayerImpl : public MaxUnpoolLayer +class MaxUnpoolLayerImpl CV_FINAL : public MaxUnpoolLayer { public: MaxUnpoolLayerImpl(const LayerParams& params) @@ -32,7 +32,7 @@ public: poolStride = Size(params.get("pool_stride_w"), params.get("pool_stride_h")); } - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT || backendId == DNN_BACKEND_HALIDE && haveHalide() && @@ -42,7 +42,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(inputs.size() == 2); CV_Assert(total(inputs[0]) == total(inputs[1])); @@ -57,7 +57,7 @@ public: return false; } - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -65,7 +65,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -117,7 +117,7 @@ public: } } - virtual Ptr initHalide(const std::vector > &input) + virtual Ptr initHalide(const std::vector > &input) CV_OVERRIDE { #ifdef HAVE_HALIDE // Meaningless operation if false because if kernel > stride diff --git a/modules/dnn/src/layers/mvn_layer.cpp b/modules/dnn/src/layers/mvn_layer.cpp index 09993a3c04..f948c718c2 100644 --- a/modules/dnn/src/layers/mvn_layer.cpp +++ b/modules/dnn/src/layers/mvn_layer.cpp @@ -54,7 +54,7 @@ namespace cv namespace dnn { -class MVNLayerImpl : public MVNLayer +class MVNLayerImpl CV_FINAL : public MVNLayer { public: MVNLayerImpl(const LayerParams& params) @@ -71,7 +71,7 @@ public: Mat scale, shift; bool fuse_batch_norm; - virtual bool tryFuse(Ptr& top) + virtual bool tryFuse(Ptr& top) CV_OVERRIDE { if (preferableTarget == DNN_TARGET_OPENCL && !fuse_batch_norm) { @@ -85,7 +85,7 @@ public: Ptr activ_relu; float relu_slope; bool fuse_relu; - bool setActivation(const Ptr& layer) + bool setActivation(const Ptr& layer) CV_OVERRIDE { if (!layer.empty() && preferableTarget == DNN_TARGET_OPENCL) { @@ -244,7 +244,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -256,7 +256,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -295,7 +295,7 @@ public: } virtual int64 getFLOPS(const std::vector &inputs, - const std::vector &outputs) const + const std::vector &outputs) const CV_OVERRIDE { (void)outputs; // suppress unused variable warning long flops = 0; diff --git a/modules/dnn/src/layers/normalize_bbox_layer.cpp b/modules/dnn/src/layers/normalize_bbox_layer.cpp index 54b8c145c5..5772aad91c 100644 --- a/modules/dnn/src/layers/normalize_bbox_layer.cpp +++ b/modules/dnn/src/layers/normalize_bbox_layer.cpp @@ -45,7 +45,7 @@ namespace cv { namespace dnn { -class NormalizeBBoxLayerImpl : public NormalizeBBoxLayer +class NormalizeBBoxLayerImpl CV_FINAL : public NormalizeBBoxLayer { public: NormalizeBBoxLayerImpl(const LayerParams& params) @@ -60,7 +60,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(inputs.size() == 1); Layer::getMemoryShapes(inputs, requiredOutputs, outputs, internals); @@ -140,7 +140,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -152,7 +152,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); diff --git a/modules/dnn/src/layers/padding_layer.cpp b/modules/dnn/src/layers/padding_layer.cpp index 4934524909..7c2cb0cbd0 100644 --- a/modules/dnn/src/layers/padding_layer.cpp +++ b/modules/dnn/src/layers/padding_layer.cpp @@ -19,7 +19,7 @@ namespace cv namespace dnn { -class PaddingLayerImpl : public PaddingLayer +class PaddingLayerImpl CV_FINAL : public PaddingLayer { public: PaddingLayerImpl(const LayerParams ¶ms) @@ -45,7 +45,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(inputs.size() == 1); const MatShape& inpShape = inputs[0]; @@ -61,7 +61,7 @@ public: return false; } - void finalize(const std::vector &inputs, std::vector &outputs) + void finalize(const std::vector &inputs, std::vector &outputs) CV_OVERRIDE { // Compute dstRanges. const MatSize& inpShape = inputs[0]->size; @@ -85,13 +85,13 @@ public: dstRanges.push_back(Range::all()); } - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT || backendId == DNN_BACKEND_HALIDE && haveHalide() && dstRanges.size() == 4; } - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -99,7 +99,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -145,7 +145,7 @@ public: CV_Error(Error::StsNotImplemented, "Unknown padding type: " + paddingType); } - virtual Ptr initHalide(const std::vector > &inputs) + virtual Ptr initHalide(const std::vector > &inputs) CV_OVERRIDE { #ifdef HAVE_HALIDE int inW, inH, inC, inN; diff --git a/modules/dnn/src/layers/permute_layer.cpp b/modules/dnn/src/layers/permute_layer.cpp index 2bf73f2524..85ce8837bc 100644 --- a/modules/dnn/src/layers/permute_layer.cpp +++ b/modules/dnn/src/layers/permute_layer.cpp @@ -54,7 +54,7 @@ namespace cv { namespace dnn { -class PermuteLayerImpl : public PermuteLayer +class PermuteLayerImpl CV_FINAL : public PermuteLayer { public: void checkCurrentOrder(int currentOrder) @@ -116,7 +116,7 @@ public: checkNeedForPermutation(); } - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT || backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine(); @@ -125,7 +125,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { if(!_needsPermute) { @@ -172,7 +172,7 @@ public: _count = _oldStride[0] * shapeBefore[0]; } - void finalize(const std::vector &inputs, std::vector &outputs) + void finalize(const std::vector &inputs, std::vector &outputs) CV_OVERRIDE { if(!_needsPermute) { @@ -230,7 +230,7 @@ public: PermuteInvoker() : inp(0), out(0), order(0), nstripes(0) {} - void operator()(const Range& r) const + void operator()(const Range& r) const CV_OVERRIDE { int n0 = out->size[0], n1 = out->size[1], n2 = out->size[2], n3 = out->size[3]; @@ -308,7 +308,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -320,7 +320,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -380,7 +380,7 @@ public: } } - virtual Ptr initInfEngine(const std::vector >&) + virtual Ptr initInfEngine(const std::vector >&) CV_OVERRIDE { #ifdef HAVE_INF_ENGINE InferenceEngine::LayerParams lp; diff --git a/modules/dnn/src/layers/pooling_layer.cpp b/modules/dnn/src/layers/pooling_layer.cpp index 8e6215eef8..0cb4e65943 100644 --- a/modules/dnn/src/layers/pooling_layer.cpp +++ b/modules/dnn/src/layers/pooling_layer.cpp @@ -64,7 +64,7 @@ static inline int roundRoiSize(float v) return (int)(v + (v >= 0.f ? 0.5f : -0.5f)); } -class PoolingLayerImpl : public PoolingLayer +class PoolingLayerImpl CV_FINAL : public PoolingLayer { public: PoolingLayerImpl(const LayerParams& params) @@ -114,7 +114,7 @@ public: Ptr > poolOp; #endif - void finalize(const std::vector &inputs, std::vector &outputs) + void finalize(const std::vector &inputs, std::vector &outputs) CV_OVERRIDE { CV_Assert(!inputs.empty()); @@ -133,7 +133,7 @@ public: #endif } - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT || backendId == DNN_BACKEND_HALIDE && haveHalide() && @@ -184,7 +184,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -196,7 +196,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -221,7 +221,7 @@ public: } } - virtual Ptr initHalide(const std::vector > &inputs) + virtual Ptr initHalide(const std::vector > &inputs) CV_OVERRIDE { if (type == MAX) return initMaxPoolingHalide(inputs); @@ -231,7 +231,7 @@ public: return Ptr(); } - virtual Ptr initInfEngine(const std::vector >&) + virtual Ptr initInfEngine(const std::vector >&) CV_OVERRIDE { #ifdef HAVE_INF_ENGINE InferenceEngine::LayerParams lp; @@ -313,7 +313,7 @@ public: parallel_for_(Range(0, nstripes), p, nstripes); } - void operator()(const Range& r) const + void operator()(const Range& r) const CV_OVERRIDE { int channels = dst->size[1], width = dst->size[3], height = dst->size[2]; int inp_width = src->size[3], inp_height = src->size[2]; @@ -752,7 +752,7 @@ public: virtual void applyHalideScheduler(Ptr& node, const std::vector &inputs, const std::vector &outputs, - int targetId) const + int targetId) const CV_OVERRIDE { #ifdef HAVE_HALIDE if (targetId != DNN_TARGET_CPU) @@ -801,7 +801,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(inputs.size() != 0); Size in(inputs[0][3], inputs[0][2]), out; @@ -858,7 +858,7 @@ public: } virtual int64 getFLOPS(const std::vector &inputs, - const std::vector &outputs) const + const std::vector &outputs) const CV_OVERRIDE { (void)inputs; // suppress unused variable warning long flops = 0; diff --git a/modules/dnn/src/layers/prior_box_layer.cpp b/modules/dnn/src/layers/prior_box_layer.cpp index 73a4afbaf7..eaa029eafa 100644 --- a/modules/dnn/src/layers/prior_box_layer.cpp +++ b/modules/dnn/src/layers/prior_box_layer.cpp @@ -56,7 +56,7 @@ namespace cv namespace dnn { -class PriorBoxLayerImpl : public PriorBoxLayer +class PriorBoxLayerImpl CV_FINAL : public PriorBoxLayer { public: static bool getParameterDict(const LayerParams ¶ms, @@ -266,7 +266,7 @@ public: } } - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT || backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine() && !_explicitSizes; @@ -275,7 +275,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(!inputs.empty()); @@ -385,7 +385,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -397,7 +397,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -476,7 +476,7 @@ public: } } - virtual Ptr initInfEngine(const std::vector >&) + virtual Ptr initInfEngine(const std::vector >&) CV_OVERRIDE { #ifdef HAVE_INF_ENGINE InferenceEngine::LayerParams lp; @@ -516,7 +516,7 @@ public: } virtual int64 getFLOPS(const std::vector &inputs, - const std::vector &outputs) const + const std::vector &outputs) const CV_OVERRIDE { (void)outputs; // suppress unused variable warning long flops = 0; diff --git a/modules/dnn/src/layers/proposal_layer.cpp b/modules/dnn/src/layers/proposal_layer.cpp index 8fee7fa727..a4c0ecf342 100644 --- a/modules/dnn/src/layers/proposal_layer.cpp +++ b/modules/dnn/src/layers/proposal_layer.cpp @@ -9,7 +9,7 @@ namespace cv { namespace dnn { -class ProposalLayerImpl : public ProposalLayer +class ProposalLayerImpl CV_FINAL : public ProposalLayer { public: ProposalLayerImpl(const LayerParams& params) @@ -85,7 +85,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { // We need to allocate the following blobs: // - output priors from PriorBoxLayer @@ -127,7 +127,7 @@ public: return false; } - void finalize(const std::vector &inputs, std::vector &outputs) + void finalize(const std::vector &inputs, std::vector &outputs) CV_OVERRIDE { std::vector layerInputs; std::vector layerOutputs; @@ -222,7 +222,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -234,7 +234,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); diff --git a/modules/dnn/src/layers/recurrent_layers.cpp b/modules/dnn/src/layers/recurrent_layers.cpp index cfccc191b8..71e36914de 100644 --- a/modules/dnn/src/layers/recurrent_layers.cpp +++ b/modules/dnn/src/layers/recurrent_layers.cpp @@ -80,7 +80,7 @@ static void sigmoid(const Mat &src, Mat &dst) cv::pow(1 + dst, -1, dst); } -class LSTMLayerImpl : public LSTMLayer +class LSTMLayerImpl CV_FINAL : public LSTMLayer { int numTimeStamps, numSamples; bool allocated; @@ -137,25 +137,25 @@ public: outTailShape.clear(); } - void setUseTimstampsDim(bool use) + void setUseTimstampsDim(bool use) CV_OVERRIDE { CV_Assert(!allocated); useTimestampDim = use; } - void setProduceCellOutput(bool produce) + void setProduceCellOutput(bool produce) CV_OVERRIDE { CV_Assert(!allocated); produceCellOutput = produce; } - void setOutShape(const MatShape &outTailShape_) + void setOutShape(const MatShape &outTailShape_) CV_OVERRIDE { CV_Assert(!allocated || total(outTailShape) == total(outTailShape_)); outTailShape = outTailShape_; } - void setWeights(const Mat &Wh, const Mat &Wx, const Mat &bias) + void setWeights(const Mat &Wh, const Mat &Wx, const Mat &bias) CV_OVERRIDE { CV_Assert(Wh.dims == 2 && Wx.dims == 2); CV_Assert(Wh.rows == Wx.rows); @@ -172,7 +172,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(!usePeephole && blobs.size() == 3 || usePeephole && blobs.size() == 6); CV_Assert(inputs.size() == 1); @@ -217,7 +217,7 @@ public: return false; } - void finalize(const std::vector &input, std::vector &output) + void finalize(const std::vector &input, std::vector &output) CV_OVERRIDE { CV_Assert(!usePeephole && blobs.size() == 3 || usePeephole && blobs.size() == 6); CV_Assert(input.size() == 1); @@ -252,7 +252,7 @@ public: allocated = true; } - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -260,7 +260,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &input, std::vector &output, std::vector &internals) + void forward(std::vector &input, std::vector &output, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -384,12 +384,12 @@ public: produceH = false; } - void setProduceHiddenOutput(bool produce = false) + void setProduceHiddenOutput(bool produce = false) CV_OVERRIDE { produceH = produce; } - void setWeights(const Mat &W_xh, const Mat &b_h, const Mat &W_hh, const Mat &W_ho, const Mat &b_o) + void setWeights(const Mat &W_xh, const Mat &b_h, const Mat &W_hh, const Mat &W_ho, const Mat &b_o) CV_OVERRIDE { CV_Assert(W_hh.dims == 2 && W_xh.dims == 2); CV_Assert(W_hh.size[0] == W_xh.size[0] && W_hh.size[0] == W_hh.size[1] && (int)b_h.total() == W_xh.size[0]); @@ -407,7 +407,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(inputs.size() >= 1 && inputs.size() <= 2); @@ -433,7 +433,7 @@ public: return false; } - void finalize(const std::vector &input, std::vector &output) + void finalize(const std::vector &input, std::vector &output) CV_OVERRIDE { CV_Assert(input.size() >= 1 && input.size() <= 2); @@ -473,7 +473,7 @@ public: } } - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -481,7 +481,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &input, std::vector &output, std::vector &internals) + void forward(std::vector &input, std::vector &output, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); diff --git a/modules/dnn/src/layers/region_layer.cpp b/modules/dnn/src/layers/region_layer.cpp index 181d8fd9bb..0e4635ecbe 100644 --- a/modules/dnn/src/layers/region_layer.cpp +++ b/modules/dnn/src/layers/region_layer.cpp @@ -54,7 +54,7 @@ namespace cv namespace dnn { -class RegionLayerImpl : public RegionLayer +class RegionLayerImpl CV_FINAL : public RegionLayer { public: int coords, classes, anchors, classfix; @@ -85,7 +85,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(inputs.size() > 0); CV_Assert(inputs[0][3] == (1 + coords + classes)*anchors); @@ -93,7 +93,7 @@ public: return false; } - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT; } @@ -185,7 +185,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -197,7 +197,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -312,7 +312,7 @@ public: } virtual int64 getFLOPS(const std::vector &inputs, - const std::vector &outputs) const + const std::vector &outputs) const CV_OVERRIDE { (void)outputs; // suppress unused variable warning diff --git a/modules/dnn/src/layers/reorg_layer.cpp b/modules/dnn/src/layers/reorg_layer.cpp index b5e1149497..a34264f931 100644 --- a/modules/dnn/src/layers/reorg_layer.cpp +++ b/modules/dnn/src/layers/reorg_layer.cpp @@ -54,7 +54,7 @@ namespace cv namespace dnn { -class ReorgLayerImpl : public ReorgLayer +class ReorgLayerImpl CV_FINAL : public ReorgLayer { int reorgStride; public: @@ -70,7 +70,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(inputs.size() > 0); outputs = std::vector(inputs.size(), shape( @@ -85,7 +85,7 @@ public: return false; } - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT; } @@ -129,7 +129,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -141,7 +141,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -174,7 +174,7 @@ public: } virtual int64 getFLOPS(const std::vector &inputs, - const std::vector &outputs) const + const std::vector &outputs) const CV_OVERRIDE { (void)outputs; // suppress unused variable warning diff --git a/modules/dnn/src/layers/reshape_layer.cpp b/modules/dnn/src/layers/reshape_layer.cpp index 906e340411..f33ed423de 100644 --- a/modules/dnn/src/layers/reshape_layer.cpp +++ b/modules/dnn/src/layers/reshape_layer.cpp @@ -144,7 +144,7 @@ static void computeShapeByReshapeMask(const MatShape &srcShape, } -class ReshapeLayerImpl : public ReshapeLayer +class ReshapeLayerImpl CV_FINAL : public ReshapeLayer { public: ReshapeLayerImpl(const LayerParams& params) @@ -166,7 +166,7 @@ public: } } - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT || backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine(); @@ -175,7 +175,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { outputs.clear(); @@ -214,7 +214,7 @@ public: return true; } - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -226,7 +226,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -239,7 +239,7 @@ public: } } - virtual Ptr initInfEngine(const std::vector >&) + virtual Ptr initInfEngine(const std::vector >&) CV_OVERRIDE { #ifdef HAVE_INF_ENGINE InferenceEngine::LayerParams lp; diff --git a/modules/dnn/src/layers/resize_nearest_neighbor_layer.cpp b/modules/dnn/src/layers/resize_nearest_neighbor_layer.cpp index 2ad5ba3b3a..4b871bff67 100644 --- a/modules/dnn/src/layers/resize_nearest_neighbor_layer.cpp +++ b/modules/dnn/src/layers/resize_nearest_neighbor_layer.cpp @@ -10,7 +10,7 @@ namespace cv { namespace dnn { -class ResizeNearestNeighborLayerImpl : public ResizeNearestNeighborLayer +class ResizeNearestNeighborLayerImpl CV_FINAL : public ResizeNearestNeighborLayer { public: ResizeNearestNeighborLayerImpl(const LayerParams& params) @@ -27,7 +27,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(inputs.size() == 1, inputs[0].size() == 4); outputs.resize(1, inputs[0]); @@ -37,7 +37,7 @@ public: return (outputs[0][2] == inputs[0][2]) && (outputs[0][3] == inputs[0][3]); } - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -45,7 +45,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); diff --git a/modules/dnn/src/layers/scale_layer.cpp b/modules/dnn/src/layers/scale_layer.cpp index d32ab56d07..464e3850a8 100644 --- a/modules/dnn/src/layers/scale_layer.cpp +++ b/modules/dnn/src/layers/scale_layer.cpp @@ -20,7 +20,7 @@ namespace cv namespace dnn { -class ScaleLayerImpl : public ScaleLayer +class ScaleLayerImpl CV_FINAL : public ScaleLayer { public: ScaleLayerImpl(const LayerParams& params) @@ -33,21 +33,21 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(inputs.size() == 2 && blobs.empty() || blobs.size() == 1 + hasBias); outputs.assign(1, inputs[0]); return true; } - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT || backendId == DNN_BACKEND_HALIDE && haveHalide() || backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine(); } - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -55,7 +55,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -117,7 +117,7 @@ public: } } - virtual Ptr tryAttach(const Ptr& node) + virtual Ptr tryAttach(const Ptr& node) CV_OVERRIDE { switch (node->backendId) { @@ -150,7 +150,7 @@ public: return Ptr(); } - virtual Ptr initHalide(const std::vector > &inputs) + virtual Ptr initHalide(const std::vector > &inputs) CV_OVERRIDE { #ifdef HAVE_HALIDE Halide::Buffer input = halideBuffer(inputs[0]); @@ -183,7 +183,7 @@ public: } #endif // HAVE_HALIDE - virtual Ptr initInfEngine(const std::vector >&) + virtual Ptr initInfEngine(const std::vector >&) CV_OVERRIDE { #ifdef HAVE_INF_ENGINE InferenceEngine::LayerParams lp; @@ -201,14 +201,14 @@ public: return Ptr(); } - void getScaleShift(Mat& scale, Mat& shift) const + void getScaleShift(Mat& scale, Mat& shift) const CV_OVERRIDE { scale = !blobs.empty() ? blobs[0] : Mat(); shift = hasBias ? blobs[1] : Mat(); } virtual int64 getFLOPS(const std::vector &inputs, - const std::vector &outputs) const + const std::vector &outputs) const CV_OVERRIDE { (void)outputs; // suppress unused variable warning long flops = 0; diff --git a/modules/dnn/src/layers/shift_layer.cpp b/modules/dnn/src/layers/shift_layer.cpp index e0bea5ff90..fbbdcb1ea9 100644 --- a/modules/dnn/src/layers/shift_layer.cpp +++ b/modules/dnn/src/layers/shift_layer.cpp @@ -18,7 +18,7 @@ namespace cv namespace dnn { -class ShiftLayerImpl : public ShiftLayer +class ShiftLayerImpl CV_FINAL : public ShiftLayer { public: ShiftLayerImpl(const LayerParams ¶ms) @@ -27,7 +27,7 @@ public: CV_Assert(blobs.size() == 1); } - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT || backendId == DNN_BACKEND_INFERENCE_ENGINE && haveInfEngine(); @@ -36,14 +36,14 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { Layer::getMemoryShapes(inputs, requiredOutputs, outputs, internals); internals.assign(1, shape(1, total(inputs[0], 2))); return true; } - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -51,7 +51,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - virtual void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + virtual void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -90,7 +90,7 @@ public: } } - virtual Ptr tryAttach(const Ptr& node) + virtual Ptr tryAttach(const Ptr& node) CV_OVERRIDE { switch (node->backendId) { @@ -111,7 +111,7 @@ public: return Ptr(); } - virtual Ptr initInfEngine(const std::vector >&) + virtual Ptr initInfEngine(const std::vector >&) CV_OVERRIDE { #ifdef HAVE_INF_ENGINE // Inference Engine has no layer just for biases. Create a linear @@ -136,14 +136,14 @@ public: return Ptr(); } - void getScaleShift(Mat& scale, Mat& shift) const + void getScaleShift(Mat& scale, Mat& shift) const CV_OVERRIDE { scale = Mat(); shift = blobs[0]; } virtual int64 getFLOPS(const std::vector &inputs, - const std::vector &outputs) const + const std::vector &outputs) const CV_OVERRIDE { (void)outputs; // suppress unused variable warning long flops = 0; diff --git a/modules/dnn/src/layers/slice_layer.cpp b/modules/dnn/src/layers/slice_layer.cpp index 728d571dce..222ebf6be8 100644 --- a/modules/dnn/src/layers/slice_layer.cpp +++ b/modules/dnn/src/layers/slice_layer.cpp @@ -53,7 +53,7 @@ namespace cv namespace dnn { -class SliceLayerImpl : public SliceLayer +class SliceLayerImpl CV_FINAL : public SliceLayer { public: SliceLayerImpl(const LayerParams& params) @@ -110,7 +110,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(inputs.size() == 1); MatShape inpShape = inputs[0]; @@ -137,7 +137,7 @@ public: return false; } - void finalize(const std::vector &inputs, std::vector &outputs) + void finalize(const std::vector &inputs, std::vector &outputs) CV_OVERRIDE { CV_Assert(inputs.size() == 1); const MatSize& inpShape = inputs[0]->size; @@ -217,7 +217,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -229,7 +229,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); diff --git a/modules/dnn/src/layers/softmax_layer.cpp b/modules/dnn/src/layers/softmax_layer.cpp index 944173f7b1..171215341b 100644 --- a/modules/dnn/src/layers/softmax_layer.cpp +++ b/modules/dnn/src/layers/softmax_layer.cpp @@ -58,7 +58,7 @@ namespace cv namespace dnn { -class SoftMaxLayerImpl : public SoftmaxLayer +class SoftMaxLayerImpl CV_FINAL : public SoftmaxLayer { public: @@ -76,7 +76,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { bool inplace = Layer::getMemoryShapes(inputs, requiredOutputs, outputs, internals); MatShape shape = inputs[0]; @@ -86,7 +86,7 @@ public: return inplace; } - virtual bool supportBackend(int backendId) + virtual bool supportBackend(int backendId) CV_OVERRIDE { return backendId == DNN_BACKEND_DEFAULT || backendId == DNN_BACKEND_HALIDE && haveHalide() && axisRaw == 1 || @@ -94,7 +94,7 @@ public: } #ifdef HAVE_OPENCL - virtual void finalize(const std::vector &inputs, std::vector &outputs) + virtual void finalize(const std::vector &inputs, std::vector &outputs) CV_OVERRIDE { softmaxOp.release(); } @@ -190,7 +190,7 @@ public: } #endif - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -202,7 +202,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -290,7 +290,7 @@ public: } } - virtual Ptr initHalide(const std::vector > &inputs) + virtual Ptr initHalide(const std::vector > &inputs) CV_OVERRIDE { #ifdef HAVE_HALIDE Halide::Buffer inputBuffer = halideBuffer(inputs[0]); @@ -315,7 +315,7 @@ public: return Ptr(); } - virtual Ptr initInfEngine(const std::vector >&) + virtual Ptr initInfEngine(const std::vector >&) CV_OVERRIDE { #ifdef HAVE_INF_ENGINE InferenceEngine::LayerParams lp; @@ -330,7 +330,7 @@ public: } int64 getFLOPS(const std::vector &inputs, - const std::vector &outputs) const + const std::vector &outputs) const CV_OVERRIDE { (void)outputs; // suppress unused variable warning int64 flops = 0; diff --git a/modules/dnn/src/layers/split_layer.cpp b/modules/dnn/src/layers/split_layer.cpp index 3da4cb27e7..f3ba67450b 100644 --- a/modules/dnn/src/layers/split_layer.cpp +++ b/modules/dnn/src/layers/split_layer.cpp @@ -48,7 +48,7 @@ namespace cv namespace dnn { -class SplitLayerImpl : public SplitLayer +class SplitLayerImpl CV_FINAL : public SplitLayer { public: SplitLayerImpl(const LayerParams ¶ms) @@ -69,7 +69,7 @@ public: bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const + std::vector &internals) const CV_OVERRIDE { CV_Assert(inputs.size() == 1); @@ -78,7 +78,7 @@ public: return false; } - void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) + void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); @@ -86,7 +86,7 @@ public: Layer::forward_fallback(inputs_arr, outputs_arr, internals_arr); } - void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) + void forward(std::vector &inputs, std::vector &outputs, std::vector &internals) CV_OVERRIDE { CV_TRACE_FUNCTION(); CV_TRACE_ARG_VALUE(name, "name", name.c_str()); diff --git a/modules/dnn/src/op_halide.hpp b/modules/dnn/src/op_halide.hpp index 07983ff41a..2f5313abf7 100644 --- a/modules/dnn/src/op_halide.hpp +++ b/modules/dnn/src/op_halide.hpp @@ -9,7 +9,14 @@ #define __OPENCV_DNN_OP_HALIDE_HPP__ #ifdef HAVE_HALIDE +#if defined(__GNUC__) && __GNUC__ >= 5 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsuggest-override" +#endif #include +#if defined(__GNUC__) && __GNUC__ >= 5 +#pragma GCC diagnostic pop +#endif #endif // HAVE_HALIDE namespace cv @@ -55,11 +62,11 @@ namespace dnn HalideBackendWrapper(const Ptr& base, const MatShape& shape); - ~HalideBackendWrapper(); + ~HalideBackendWrapper() CV_OVERRIDE; - virtual void copyToHost(); + virtual void copyToHost() CV_OVERRIDE; - virtual void setHostDirty(); + virtual void setHostDirty() CV_OVERRIDE; Halide::Buffer buffer; diff --git a/modules/dnn/src/op_inf_engine.cpp b/modules/dnn/src/op_inf_engine.cpp index c43b2b3596..b180ec1b55 100644 --- a/modules/dnn/src/op_inf_engine.cpp +++ b/modules/dnn/src/op_inf_engine.cpp @@ -131,6 +131,10 @@ void InfEngineBackendNet::getOutputsInfo(InferenceEngine::OutputsDataMap &output { outputs_ = outputs; } +void InfEngineBackendNet::getOutputsInfo(InferenceEngine::OutputsDataMap &outputs_) const noexcept +{ + outputs_ = outputs; +} // Returns input references that aren't connected to internal outputs. void InfEngineBackendNet::getInputsInfo(InferenceEngine::InputsDataMap &inputs_) noexcept diff --git a/modules/dnn/src/op_inf_engine.hpp b/modules/dnn/src/op_inf_engine.hpp index ead02c370e..438463586c 100644 --- a/modules/dnn/src/op_inf_engine.hpp +++ b/modules/dnn/src/op_inf_engine.hpp @@ -9,7 +9,14 @@ #define __OPENCV_DNN_OP_INF_ENGINE_HPP__ #ifdef HAVE_INF_ENGINE +#if defined(__GNUC__) && __GNUC__ >= 5 +//#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsuggest-override" +#endif #include +#if defined(__GNUC__) && __GNUC__ >= 5 +//#pragma GCC diagnostic pop +#endif #endif // HAVE_INF_ENGINE namespace cv { namespace dnn { @@ -23,41 +30,43 @@ public: InfEngineBackendNet(InferenceEngine::CNNNetwork& net); - virtual void Release() noexcept; + virtual void Release() noexcept CV_OVERRIDE; - virtual InferenceEngine::Precision getPrecision() noexcept; + virtual InferenceEngine::Precision getPrecision() noexcept CV_OVERRIDE; - virtual void getOutputsInfo(InferenceEngine::OutputsDataMap &out) noexcept; + virtual void getOutputsInfo(InferenceEngine::OutputsDataMap &out) noexcept /*CV_OVERRIDE*/; - virtual void getInputsInfo(InferenceEngine::InputsDataMap &inputs) noexcept; + virtual void getOutputsInfo(InferenceEngine::OutputsDataMap &out) const noexcept /*CV_OVERRIDE*/; - virtual void getInputsInfo(InferenceEngine::InputsDataMap &inputs) const noexcept; + virtual void getInputsInfo(InferenceEngine::InputsDataMap &inputs) noexcept /*CV_OVERRIDE*/; - virtual InferenceEngine::InputInfo::Ptr getInput(const std::string &inputName) noexcept; + virtual void getInputsInfo(InferenceEngine::InputsDataMap &inputs) const noexcept /*CV_OVERRIDE*/; - virtual void getName(char *pName, size_t len) noexcept; + virtual InferenceEngine::InputInfo::Ptr getInput(const std::string &inputName) noexcept CV_OVERRIDE; - virtual size_t layerCount() noexcept; + virtual void getName(char *pName, size_t len) noexcept CV_OVERRIDE; - virtual InferenceEngine::DataPtr& getData(const char *dname) noexcept; + virtual size_t layerCount() noexcept CV_OVERRIDE; - virtual void addLayer(const InferenceEngine::CNNLayerPtr &layer) noexcept; + virtual InferenceEngine::DataPtr& getData(const char *dname) noexcept CV_OVERRIDE; + + virtual void addLayer(const InferenceEngine::CNNLayerPtr &layer) noexcept CV_OVERRIDE; virtual InferenceEngine::StatusCode addOutput(const std::string &layerName, size_t outputIndex = 0, - InferenceEngine::ResponseDesc *resp = nullptr) noexcept; + InferenceEngine::ResponseDesc *resp = nullptr) noexcept CV_OVERRIDE; virtual InferenceEngine::StatusCode getLayerByName(const char *layerName, InferenceEngine::CNNLayerPtr &out, - InferenceEngine::ResponseDesc *resp) noexcept; + InferenceEngine::ResponseDesc *resp) noexcept CV_OVERRIDE; - virtual void setTargetDevice(InferenceEngine::TargetDevice device) noexcept; + virtual void setTargetDevice(InferenceEngine::TargetDevice device) noexcept CV_OVERRIDE; - virtual InferenceEngine::TargetDevice getTargetDevice() noexcept; + virtual InferenceEngine::TargetDevice getTargetDevice() noexcept CV_OVERRIDE; - virtual InferenceEngine::StatusCode setBatchSize(const size_t size) noexcept; + virtual InferenceEngine::StatusCode setBatchSize(const size_t size) noexcept CV_OVERRIDE; - virtual size_t getBatchSize() const noexcept; + virtual size_t getBatchSize() const noexcept CV_OVERRIDE; void init(); @@ -99,9 +108,9 @@ public: ~InfEngineBackendWrapper(); - virtual void copyToHost(); + virtual void copyToHost() CV_OVERRIDE; - virtual void setHostDirty(); + virtual void setHostDirty() CV_OVERRIDE; InferenceEngine::DataPtr dataPtr; InferenceEngine::TBlob::Ptr blob; @@ -128,15 +137,15 @@ public: virtual bool getMemoryShapes(const std::vector &inputs, const int requiredOutputs, std::vector &outputs, - std::vector &internals) const; + std::vector &internals) const CV_OVERRIDE; virtual void forward(std::vector &input, std::vector &output, - std::vector &internals); + std::vector &internals) CV_OVERRIDE; virtual void forward(InputArrayOfArrays inputs, OutputArrayOfArrays outputs, - OutputArrayOfArrays internals); + OutputArrayOfArrays internals) CV_OVERRIDE; - virtual bool supportBackend(int backendId); + virtual bool supportBackend(int backendId) CV_OVERRIDE; private: InferenceEngine::DataPtr output; diff --git a/modules/dnn/src/tensorflow/tf_graph_simplifier.cpp b/modules/dnn/src/tensorflow/tf_graph_simplifier.cpp index 4d571df8b5..bcb806a7dd 100644 --- a/modules/dnn/src/tensorflow/tf_graph_simplifier.cpp +++ b/modules/dnn/src/tensorflow/tf_graph_simplifier.cpp @@ -214,7 +214,7 @@ public: } virtual void finalize(tensorflow::GraphDef&, tensorflow::NodeDef* fusedNode, - std::vector& inputNodes) + std::vector& inputNodes) CV_OVERRIDE { Mat epsMat = getTensorContent(inputNodes.back()->attr().at("value").tensor()); CV_Assert(epsMat.total() == 1, epsMat.type() == CV_32FC1); @@ -249,7 +249,7 @@ public: } virtual void finalize(tensorflow::GraphDef& net, tensorflow::NodeDef* fusedNode, - std::vector& inputNodes) + std::vector& inputNodes) CV_OVERRIDE { Mat epsMat = getTensorContent(inputNodes.back()->attr().at("value").tensor()); CV_Assert(epsMat.total() == 1, epsMat.type() == CV_32FC1); @@ -343,7 +343,7 @@ public: setFusedNode("Relu6", input); } - virtual bool match(const tensorflow::GraphDef& net, int nodeId, std::vector& matchedNodesIds) + virtual bool match(const tensorflow::GraphDef& net, int nodeId, std::vector& matchedNodesIds) CV_OVERRIDE { if (!Subgraph::match(net, nodeId, matchedNodesIds)) return false; @@ -378,7 +378,7 @@ public: } virtual void finalize(tensorflow::GraphDef&, tensorflow::NodeDef* fusedNode, - std::vector& inputNodes) + std::vector& inputNodes) CV_OVERRIDE { std::vector shape(numOutDims + 1); // batch size in Keras is implicit. shape[0] = -1; diff --git a/modules/dnn/src/tensorflow/tf_importer.cpp b/modules/dnn/src/tensorflow/tf_importer.cpp index 4f7e6f4839..6ea9e96a47 100644 --- a/modules/dnn/src/tensorflow/tf_importer.cpp +++ b/modules/dnn/src/tensorflow/tf_importer.cpp @@ -12,16 +12,12 @@ Implementation of Tensorflow models parser #include "../precomp.hpp" #ifdef HAVE_PROTOBUF -#include "graph.pb.h" +#include "tf_io.hpp" #include #include #include #include -#include -#include -#include -#include "tf_io.hpp" #include "tf_graph_simplifier.hpp" #endif diff --git a/modules/dnn/src/tensorflow/tf_io.cpp b/modules/dnn/src/tensorflow/tf_io.cpp index ef26b30f44..41fb1a68b2 100644 --- a/modules/dnn/src/tensorflow/tf_io.cpp +++ b/modules/dnn/src/tensorflow/tf_io.cpp @@ -23,8 +23,8 @@ Implementation of various functions which are related to Tensorflow models readi #include #include -#include "graph.pb.h" #include "tf_io.hpp" + #include "../caffe/caffe_io.hpp" #include "../caffe/glog_emulator.hpp" diff --git a/modules/dnn/src/tensorflow/tf_io.hpp b/modules/dnn/src/tensorflow/tf_io.hpp index 9466ba96a7..aeb22a6c27 100644 --- a/modules/dnn/src/tensorflow/tf_io.hpp +++ b/modules/dnn/src/tensorflow/tf_io.hpp @@ -13,8 +13,20 @@ Declaration of various functions which are related to Tensorflow models reading. #define __OPENCV_DNN_TF_IO_HPP__ #ifdef HAVE_PROTOBUF +#if defined(__GNUC__) && __GNUC__ >= 5 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsuggest-override" +#endif #include "graph.pb.h" +#include +#include +#include +#if defined(__GNUC__) && __GNUC__ >= 5 +#pragma GCC diagnostic pop +#endif + + namespace cv { namespace dnn {