@@ -63,27 +63,27 @@ class PoolingLayerImpl : public PoolingLayer
63
63
public:
64
64
PoolingLayerImpl (const LayerParams& params)
65
65
{
66
- type = PoolingLayer:: MAX;
66
+ type = MAX;
67
67
computeMaxIdx = true ;
68
68
globalPooling = false ;
69
69
70
70
if (params.has (" pool" ))
71
71
{
72
72
String pool = params.get <String>(" pool" ).toLowerCase ();
73
73
if (pool == " max" )
74
- type = PoolingLayer:: MAX;
74
+ type = MAX;
75
75
else if (pool == " ave" )
76
- type = PoolingLayer:: AVE;
76
+ type = AVE;
77
77
else if (pool == " stochastic" )
78
- type = PoolingLayer:: STOCHASTIC;
78
+ type = STOCHASTIC;
79
79
else
80
80
CV_Error (Error::StsBadArg, " Unknown pooling type \" " + pool + " \" " );
81
81
getPoolingKernelParams (params, kernel.height , kernel.width , globalPooling,
82
82
pad.height , pad.width , stride.height , stride.width , padMode);
83
83
}
84
84
else if (params.has (" pooled_w" ) || params.has (" pooled_h" ) || params.has (" spatial_scale" ))
85
85
{
86
- type = PoolingLayer:: ROI;
86
+ type = ROI;
87
87
}
88
88
setParamsFrom (params);
89
89
ceilMode = params.get <bool >(" ceil_mode" , true );
@@ -115,8 +115,7 @@ class PoolingLayerImpl : public PoolingLayer
115
115
{
116
116
return backendId == DNN_BACKEND_DEFAULT ||
117
117
backendId == DNN_BACKEND_HALIDE && haveHalide () &&
118
- (type == PoolingLayer::MAX ||
119
- type == PoolingLayer::AVE && !pad.width && !pad.height );
118
+ (type == MAX || type == AVE && !pad.width && !pad.height );
120
119
}
121
120
122
121
#ifdef HAVE_OPENCL
@@ -200,9 +199,9 @@ class PoolingLayerImpl : public PoolingLayer
200
199
201
200
virtual Ptr<BackendNode> initHalide (const std::vector<Ptr<BackendWrapper> > &inputs)
202
201
{
203
- if (type == PoolingLayer:: MAX)
202
+ if (type == MAX)
204
203
return initMaxPoolingHalide (inputs);
205
- else if (type == PoolingLayer:: AVE)
204
+ else if (type == AVE)
206
205
return initAvePoolingHalide (inputs);
207
206
else
208
207
return Ptr<BackendNode>();
@@ -221,7 +220,7 @@ class PoolingLayerImpl : public PoolingLayer
221
220
float spatialScale;
222
221
223
222
PoolingInvoker () : src(0 ), rois(0 ), dst(0 ), mask(0 ), nstripes(0 ),
224
- computeMaxIdx (0 ), poolingType(PoolingLayer:: MAX), spatialScale(0 ) {}
223
+ computeMaxIdx (0 ), poolingType(MAX), spatialScale(0 ) {}
225
224
226
225
static void run (const Mat& src, const Mat& rois, Mat& dst, Mat& mask, Size kernel,
227
226
Size stride, Size pad, int poolingType, float spatialScale,
@@ -698,7 +697,7 @@ class PoolingLayerImpl : public PoolingLayer
698
697
out.height = 1 ;
699
698
out.width = 1 ;
700
699
}
701
- else if (type == PoolingLayer:: ROI)
700
+ else if (type == ROI)
702
701
{
703
702
out.height = pooledSize.height ;
704
703
out.width = pooledSize.width ;
@@ -757,6 +756,14 @@ class PoolingLayerImpl : public PoolingLayer
757
756
}
758
757
return flops;
759
758
}
759
+ private:
760
+ enum Type
761
+ {
762
+ MAX,
763
+ AVE,
764
+ STOCHASTIC,
765
+ ROI
766
+ };
760
767
};
761
768
762
769
Ptr<PoolingLayer> PoolingLayer::create (const LayerParams& params)
0 commit comments