1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Merge branch 4.x

This commit is contained in:
Alexander Smorkalov
2024-04-01 17:09:24 +03:00
289 changed files with 49794 additions and 38081 deletions
+42
View File
@@ -1764,6 +1764,48 @@ INSTANTIATE_TEST_CASE_P(/**/, Layer_Test_ShuffleChannel, Combine(
/*group*/ Values(1, 2, 3, 6), dnnBackendsAndTargets(/*with IE*/ false)
));
TEST(Layer_Test_ReduceMean, accuracy_input_0)
{
vector<int> szData = { 2, 1, 2, 1 ,2 };
std::vector<float> initData = { 0, 1, 2, 3, 4, 5, 6, 7 };
Mat inpInitA(szData, CV_32FC1, Mat(initData).data);
std::vector<float> resAxes0 = { 2, 3, 4, 5 };
std::vector<float> resAxes1 = { 0, 1, 2, 3, 4, 5, 6, 7 };
std::vector<float> resAxes2 = { 1, 2, 5, 6 };
std::vector<float> resAxes3 = { 0, 1, 2, 3, 4, 5, 6, 7 };
std::vector<float> resAxes4 = { 0.5, 2.5, 4.5, 6.5 };
std::vector < vector<float>> resReduceMean = { resAxes0, resAxes1, resAxes2, resAxes3, resAxes4 };
for (int i = 0; i < resReduceMean.size(); i++)
{
Net net;
LayerParams lp;
lp.set("keepdims", 0);
lp.type = "Reduce";
lp.set("reduce", "MEAN");
lp.name = "testReduceMean";
lp.set("axes", i);
lp.blobs.push_back(inpInitA);
net.addLayerToPrev(lp.name, lp.type, lp);
net.setInput(inpInitA);
net.setPreferableBackend(DNN_BACKEND_OPENCV);
Mat output = net.forward();
MatShape gt_shape;
for (int j = 0; j < szData.size(); j++)
{
if (i == j) continue;
gt_shape.push_back(szData[j]);
}
EXPECT_EQ(gt_shape, shape(output));
normAssert(output, Mat(gt_shape, CV_32F, resReduceMean[i].data()));
}
}
// Check if relu is not fused to convolution if we requested it's output
TEST(Layer_Test_Convolution, relu_fusion)
{