Commit f2070c9f authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #10255 from dkurt:dnn_roi_pooling

parents 34e414dc 17dcf0e8
......@@ -242,7 +242,8 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
{
MAX,
AVE,
STOCHASTIC
STOCHASTIC,
ROI
};
int type;
......@@ -251,6 +252,9 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
bool computeMaxIdx;
String padMode;
bool ceilMode;
// ROIPooling parameters.
Size pooledSize;
float spatialScale;
static Ptr<PoolingLayer> create(const LayerParams& params);
};
......
This diff is collapsed.
This diff is collapsed.
......@@ -552,6 +552,7 @@ message LayerParameter {
optional ReductionParameter reduction_param = 136;
optional ReLUParameter relu_param = 123;
optional ReshapeParameter reshape_param = 133;
optional ROIPoolingParameter roi_pooling_param = 8266711; // https://github.com/rbgirshick/caffe-fast-rcnn/tree/fast-rcnn
optional ScaleParameter scale_param = 142;
optional SigmoidParameter sigmoid_param = 124;
optional SoftmaxParameter softmax_param = 125;
......@@ -1605,3 +1606,15 @@ message NormalizedBBox {
optional float score = 7;
optional float size = 8;
}
// origin: https://github.com/rbgirshick/caffe-fast-rcnn/tree/fast-rcnn
// Message that stores parameters used by ROIPoolingLayer
message ROIPoolingParameter {
// Pad, kernel size, and stride are all given as a single value for equal
// dimensions in height and width or as Y, X pairs.
optional uint32 pooled_h = 1 [default = 0]; // The pooled output height
optional uint32 pooled_w = 2 [default = 0]; // The pooled output width
// Multiplicative spatial scale factor to translate ROI coords from their
// input scale to the scale used when pooling
optional float spatial_scale = 3 [default = 1];
}
......@@ -88,6 +88,7 @@ void initializeLayerFactory()
CV_DNN_REGISTER_LAYER_CLASS(Convolution, ConvolutionLayer);
CV_DNN_REGISTER_LAYER_CLASS(Deconvolution, DeconvolutionLayer);
CV_DNN_REGISTER_LAYER_CLASS(Pooling, PoolingLayer);
CV_DNN_REGISTER_LAYER_CLASS(ROIPooling, PoolingLayer);
CV_DNN_REGISTER_LAYER_CLASS(LRN, LRNLayer);
CV_DNN_REGISTER_LAYER_CLASS(InnerProduct, InnerProductLayer);
CV_DNN_REGISTER_LAYER_CLASS(Softmax, SoftmaxLayer);
......
This diff is collapsed.
......@@ -560,4 +560,20 @@ TEST(Layer_Test_Reorg, Accuracy)
testLayerUsingDarknetModels("reorg", false, false);
}
TEST(Layer_Test_ROIPooling, Accuracy)
{
Net net = readNetFromCaffe(_tf("net_roi_pooling.prototxt"));
Mat inp = blobFromNPY(_tf("net_roi_pooling.input.npy"));
Mat rois = blobFromNPY(_tf("net_roi_pooling.rois.npy"));
Mat ref = blobFromNPY(_tf("net_roi_pooling.npy"));
net.setInput(inp, "input");
net.setInput(rois, "rois");
Mat out = net.forward();
normAssert(out, ref);
}
}
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