Swapping of stride and pad params inside layers initializers

pull/707/head
Vitaliy Lyudvichenko 8 years ago
parent 0af7f9ea29
commit d8507fef74
  1. 8
      modules/dnn/include/opencv2/dnn/all_layers.hpp
  2. 14
      modules/dnn/src/layers/convolution_layer.cpp
  3. 8
      modules/dnn/src/layers/pooling_layer.cpp
  4. 2
      modules/dnn/src/layers/pooling_layer.hpp

@ -216,16 +216,14 @@ namespace dnn
{
public:
static Ptr<BaseConvolutionLayer> create();
static Ptr<BaseConvolutionLayer> create(Size kernel = Size(3, 3), Size pad = Size(0, 0), Size stride = Size(1, 1));
static Ptr<BaseConvolutionLayer> create(Size kernel = Size(3, 3), Size stride = Size(1, 1), Size pad = Size(0, 0));
};
class CV_EXPORTS_W DeconvolutionLayer : public BaseConvolutionLayer
{
public:
static Ptr<BaseConvolutionLayer> create();
static Ptr<BaseConvolutionLayer> create(Size kernel = Size(3, 3), Size pad = Size(0, 0), Size stride = Size(1, 1));
static Ptr<BaseConvolutionLayer> create(Size kernel = Size(3, 3), Size stride = Size(1, 1), Size pad = Size(0, 0));
};
class CV_EXPORTS_W LRNLayer : public Layer
@ -259,7 +257,7 @@ namespace dnn
int type;
Size kernel, stride, pad;
static Ptr<PoolingLayer> create(int type = MAX, Size kernel = Size(2, 2), Size pad = Size(0, 0), Size stride = Size(1, 1));
static Ptr<PoolingLayer> create(int type = MAX, Size kernel = Size(2, 2), Size stride = Size(1, 1), Size pad = Size(0, 0));
};
//! @}

@ -315,12 +315,7 @@ void DeConvolutionLayerImpl::col2im(const UMat &colMat, UMat &dstImg)
//Initializers
Ptr<BaseConvolutionLayer> ConvolutionLayer::create()
{
return Ptr<BaseConvolutionLayer>(new ConvolutionLayerImpl());
}
Ptr<BaseConvolutionLayer> ConvolutionLayer::create(Size kernel, Size pad, Size stride)
Ptr<BaseConvolutionLayer> ConvolutionLayer::create(Size kernel, Size stride, Size pad)
{
ConvolutionLayerImpl *l = new ConvolutionLayerImpl();
l->kernel = kernel;
@ -329,12 +324,7 @@ Ptr<BaseConvolutionLayer> ConvolutionLayer::create(Size kernel, Size pad, Size s
return Ptr<BaseConvolutionLayer>(l);
}
Ptr<BaseConvolutionLayer> DeconvolutionLayer::create()
{
return Ptr<BaseConvolutionLayer>(new DeConvolutionLayerImpl());
}
Ptr<BaseConvolutionLayer> DeconvolutionLayer::create(Size kernel, Size pad, Size stride)
Ptr<BaseConvolutionLayer> DeconvolutionLayer::create(Size kernel, Size stride, Size pad)
{
DeConvolutionLayerImpl *l = new DeConvolutionLayerImpl();
l->kernel = kernel;

@ -60,7 +60,7 @@ PoolingLayerImpl::PoolingLayerImpl()
}
PoolingLayerImpl::PoolingLayerImpl(int type_, Size kernel_, Size pad_, Size stride_)
PoolingLayerImpl::PoolingLayerImpl(int type_, Size kernel_, Size stride_, Size pad_)
{
type = type_;
kernel = kernel_;
@ -261,9 +261,9 @@ void PoolingLayerImpl::computeOutputShape(Size inpSz)
}
}
Ptr<PoolingLayer> PoolingLayer::create(int type, Size kernel, Size pad, Size stride)
Ptr<PoolingLayer> PoolingLayer::create(int type, Size kernel, Size stride, Size pad)
{
return Ptr<PoolingLayer>(new PoolingLayerImpl(type, kernel, pad, stride));
return Ptr<PoolingLayer>(new PoolingLayerImpl(type, kernel, stride, pad));
}
Ptr<Layer> createPoolingLayerFromCaffe(LayerParams &params)
@ -290,7 +290,7 @@ Ptr<Layer> createPoolingLayerFromCaffe(LayerParams &params)
getCaffeConvParams(params, kernel, pad, stride);
return Ptr<Layer>(new PoolingLayerImpl(type, kernel, pad, stride));
return Ptr<Layer>(new PoolingLayerImpl(type, kernel, stride, pad));
}
}

@ -68,7 +68,7 @@ namespace dnn
public:
PoolingLayerImpl();
PoolingLayerImpl(int type, Size kernel, Size pad, Size stride);
PoolingLayerImpl(int type, Size kernel, Size stride, Size pad);
void allocate(const std::vector<Blob*> &inputs, std::vector<Blob> &outputs);
void forward(std::vector<Blob*> &inputs, std::vector<Blob> &outputs);

Loading…
Cancel
Save