Commit 28d4157e authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #11331 from dkurt:fix_11318

parents b8b7ca73 66ce8cd7
...@@ -120,7 +120,7 @@ static inline Mat getPlane(const Mat &m, int n, int cn) ...@@ -120,7 +120,7 @@ static inline Mat getPlane(const Mat &m, int n, int cn)
return Mat(m.dims - 2, sz, m.type(), (void*)m.ptr<float>(n, cn)); return Mat(m.dims - 2, sz, m.type(), (void*)m.ptr<float>(n, cn));
} }
static inline MatShape shape(const int* dims, const int n = 4) static inline MatShape shape(const int* dims, const int n)
{ {
MatShape shape; MatShape shape;
shape.assign(dims, dims + n); shape.assign(dims, dims + n);
...@@ -132,6 +132,11 @@ static inline MatShape shape(const Mat& mat) ...@@ -132,6 +132,11 @@ static inline MatShape shape(const Mat& mat)
return shape(mat.size.p, mat.dims); return shape(mat.size.p, mat.dims);
} }
static inline MatShape shape(const MatSize& sz)
{
return shape(sz.p, sz[-1]);
}
static inline MatShape shape(const UMat& mat) static inline MatShape shape(const UMat& mat)
{ {
return shape(mat.size.p, mat.dims); return shape(mat.size.p, mat.dims);
...@@ -142,7 +147,7 @@ namespace {inline bool is_neg(int i) { return i < 0; }} ...@@ -142,7 +147,7 @@ namespace {inline bool is_neg(int i) { return i < 0; }}
static inline MatShape shape(int a0, int a1=-1, int a2=-1, int a3=-1) static inline MatShape shape(int a0, int a1=-1, int a2=-1, int a3=-1)
{ {
int dims[] = {a0, a1, a2, a3}; int dims[] = {a0, a1, a2, a3};
MatShape s = shape(dims); MatShape s = shape(dims, 4);
s.erase(std::remove_if(s.begin(), s.end(), is_neg), s.end()); s.erase(std::remove_if(s.begin(), s.end(), is_neg), s.end());
return s; return s;
} }
......
...@@ -234,7 +234,7 @@ public: ...@@ -234,7 +234,7 @@ public:
CV_Assert(ngroups > 0 && inpCn % ngroups == 0 && outCn % ngroups == 0); CV_Assert(ngroups > 0 && inpCn % ngroups == 0 && outCn % ngroups == 0);
int dims[] = {inputs[0][0], outCn, out.height, out.width}; int dims[] = {inputs[0][0], outCn, out.height, out.width};
outputs.resize(inputs.size(), shape(dims)); outputs.resize(inputs.size(), shape(dims, 4));
return false; return false;
} }
...@@ -1088,7 +1088,7 @@ public: ...@@ -1088,7 +1088,7 @@ public:
CV_Assert(blobs[0].size[0] == inpCn); CV_Assert(blobs[0].size[0] == inpCn);
int dims[] = {inputs[0][0], outCn, outH, outW}; int dims[] = {inputs[0][0], outCn, outH, outW};
outputs.resize(inputs.size(), shape(dims)); outputs.resize(inputs.size(), shape(dims, 4));
internals.push_back(MatShape()); internals.push_back(MatShape());
if (!is1x1()) if (!is1x1())
......
...@@ -853,7 +853,7 @@ public: ...@@ -853,7 +853,7 @@ public:
dims[0] = inputs[1][0]; // Number of proposals; dims[0] = inputs[1][0]; // Number of proposals;
dims[1] = psRoiOutChannels; dims[1] = psRoiOutChannels;
} }
outputs.assign(type == MAX ? 2 : 1, shape(dims)); outputs.assign(type == MAX ? 2 : 1, shape(dims, 4));
return false; return false;
} }
......
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