Skip to content

Commit 2b43d4f

Browse files
committed
Fix default pooling layer type
1 parent cac4a7e commit 2b43d4f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

modules/dnn/src/layers/pooling_layer.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,14 @@ class PoolingLayerImpl : public PoolingLayer
6767
public:
6868
PoolingLayerImpl(const LayerParams& params)
6969
{
70-
type = MAX;
7170
computeMaxIdx = true;
7271
globalPooling = false;
72+
stride = Size(1, 1);
7373

74-
if (params.has("pool"))
74+
if (params.has("pool") || params.has("kernel_size") ||
75+
params.has("kernel_w") || params.has("kernel_h"))
7576
{
76-
String pool = params.get<String>("pool").toLowerCase();
77+
String pool = params.get<String>("pool", "max").toLowerCase();
7778
if (pool == "max")
7879
type = MAX;
7980
else if (pool == "ave")
@@ -90,6 +91,8 @@ class PoolingLayerImpl : public PoolingLayer
9091
type = ROI;
9192
computeMaxIdx = false;
9293
}
94+
else
95+
CV_Error(Error::StsBadArg, "Cannot determine pooling type");
9396
setParamsFrom(params);
9497
ceilMode = params.get<bool>("ceil_mode", true);
9598
pooledSize.width = params.get<uint32_t>("pooled_w", 1);

0 commit comments

Comments
 (0)