Merge pull request #14833 from l-bat:ocv_eltwise3d

* Support Eltwise3d

* Refactoring

* Fix test
This commit is contained in:
Lubov Batanina 2019-06-22 10:13:28 +03:00 committed by Alexander Alekhin
parent 4b205680df
commit 16294437d5
2 changed files with 14 additions and 4 deletions

View File

@ -140,7 +140,7 @@ public:
const std::vector<float>& coeffs, EltwiseOp op, const std::vector<float>& coeffs, EltwiseOp op,
const ActivationLayer* activ, int nstripes) const ActivationLayer* activ, int nstripes)
{ {
CV_Check(dst.dims, 1 < dst.dims && dst.dims <= 4, ""); CV_CheckTypeEQ(dst.type(), CV_32FC1, ""); CV_Assert(dst.isContinuous()); CV_Check(dst.dims, 1 < dst.dims && dst.dims <= 5, ""); CV_CheckTypeEQ(dst.type(), CV_32FC1, ""); CV_Assert(dst.isContinuous());
CV_Assert(coeffs.empty() || coeffs.size() == (size_t)nsrcs); CV_Assert(coeffs.empty() || coeffs.size() == (size_t)nsrcs);
for( int i = 0; i < nsrcs; i++ ) for( int i = 0; i < nsrcs; i++ )
@ -156,9 +156,9 @@ public:
p.dst = &dst; p.dst = &dst;
p.op = op; p.op = op;
p.nstripes = nstripes; p.nstripes = nstripes;
p.channels = (dst.dims == 4 ? dst.size[1] : 1); p.channels = (dst.dims >= 4 ? dst.size[1] : 1);
p.planeSize = (dst.dims >= 3 ? dst.size[dst.dims - 1] * dst.size[dst.dims - 2] :
dst.size[dst.dims - 1]); p.planeSize = dst.total(dst.dims >= 4 ? 2 : 1);
CV_Assert(dst.total() == dst.size[0] * p.channels * p.planeSize); CV_Assert(dst.total() == dst.size[0] * p.channels * p.planeSize);
bool simpleCoeffs = true; bool simpleCoeffs = true;

View File

@ -146,6 +146,16 @@ TEST_P(Test_ONNX_layers, Concatenation)
testONNXModels("concatenation"); testONNXModels("concatenation");
} }
TEST_P(Test_ONNX_layers, Eltwise3D)
{
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_LT(2019010000)
throw SkipTestException("Test is enabled starts from 2019R1");
#endif
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target != DNN_TARGET_CPU)
throw SkipTestException("Only CPU on DLIE backend is supported");
testONNXModels("eltwise3d");
}
TEST_P(Test_ONNX_layers, AveragePooling) TEST_P(Test_ONNX_layers, AveragePooling)
{ {
testONNXModels("average_pooling"); testONNXModels("average_pooling");