From c6240dbe41b2ebe50a2c400e272c4ccee8ab3cc0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/On-Device=20Lab=28SR=29/Staff?= =?utf8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Tue, 22 Jan 2019 11:35:15 +0900 Subject: [PATCH] [enco/caffe] Average Pooling with Non Square Kernel (#2892) This commit fixes a bug in Caffe frontend which results in incorrect results when there is an average pooling layer with non squre kernel. This commit also adds a related regression test. Signed-off-by: Jonghyun Park --- contrib/enco/frontend/caffe/src/Layer/Pooling.cpp | 3 +-- contrib/enco/test/caffe/Regression_0000/INFERENCE | 0 contrib/enco/test/caffe/Regression_0000/test.prototxt | 17 +++++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 contrib/enco/test/caffe/Regression_0000/INFERENCE create mode 100644 contrib/enco/test/caffe/Regression_0000/test.prototxt diff --git a/contrib/enco/frontend/caffe/src/Layer/Pooling.cpp b/contrib/enco/frontend/caffe/src/Layer/Pooling.cpp index 7241cb0..36220d8 100644 --- a/contrib/enco/frontend/caffe/src/Layer/Pooling.cpp +++ b/contrib/enco/frontend/caffe/src/Layer/Pooling.cpp @@ -107,8 +107,7 @@ void PoolingBuilder::build(const ::caffe::LayerParameter &layer, GraphBuilderCon op->divisor(coco::AvgPool2D::Divisor::Static); op->window()->height(spec.window_height()); - // TODO FIX THIS BUG AND ADD TEST - op->window()->width(spec.window_height()); + op->window()->width(spec.window_width()); op->stride()->vertical(spec.vertical_stride()); op->stride()->horizontal(spec.horizontal_stride()); diff --git a/contrib/enco/test/caffe/Regression_0000/INFERENCE b/contrib/enco/test/caffe/Regression_0000/INFERENCE new file mode 100644 index 0000000..e69de29 diff --git a/contrib/enco/test/caffe/Regression_0000/test.prototxt b/contrib/enco/test/caffe/Regression_0000/test.prototxt new file mode 100644 index 0000000..5927d69 --- /dev/null +++ b/contrib/enco/test/caffe/Regression_0000/test.prototxt @@ -0,0 +1,17 @@ +layer { + name: "data" + type: "Input" + top: "data" + input_param { shape: { dim: 1 dim: 3 dim: 15 dim: 15 } } +} +layer { + name: "pool" + type: "Pooling" + bottom: "data" + top: "pool" + pooling_param { + pool: AVE + kernel_h: 3 + kernel_w: 1 + } +} -- 2.7.4