Commit 2b43d4f4 authored by Dmitry Kurtaev's avatar Dmitry Kurtaev

Fix default pooling layer type

parent cac4a7e5
...@@ -67,13 +67,14 @@ class PoolingLayerImpl : public PoolingLayer ...@@ -67,13 +67,14 @@ class PoolingLayerImpl : public PoolingLayer
public: public:
PoolingLayerImpl(const LayerParams& params) PoolingLayerImpl(const LayerParams& params)
{ {
type = MAX;
computeMaxIdx = true; computeMaxIdx = true;
globalPooling = false; globalPooling = false;
stride = Size(1, 1);
if (params.has("pool")) if (params.has("pool") || params.has("kernel_size") ||
params.has("kernel_w") || params.has("kernel_h"))
{ {
String pool = params.get<String>("pool").toLowerCase(); String pool = params.get<String>("pool", "max").toLowerCase();
if (pool == "max") if (pool == "max")
type = MAX; type = MAX;
else if (pool == "ave") else if (pool == "ave")
...@@ -90,6 +91,8 @@ public: ...@@ -90,6 +91,8 @@ public:
type = ROI; type = ROI;
computeMaxIdx = false; computeMaxIdx = false;
} }
else
CV_Error(Error::StsBadArg, "Cannot determine pooling type");
setParamsFrom(params); setParamsFrom(params);
ceilMode = params.get<bool>("ceil_mode", true); ceilMode = params.get<bool>("ceil_mode", true);
pooledSize.width = params.get<uint32_t>("pooled_w", 1); pooledSize.width = params.get<uint32_t>("pooled_w", 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment