mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
Merge branch 4.x
This commit is contained in:
@@ -95,6 +95,12 @@ public:
|
||||
Net net;
|
||||
};
|
||||
|
||||
TEST_P(DNNTestNetwork, DISABLED_YOLOv8n) {
|
||||
processNet("dnn/onnx/models/yolov8n.onnx", "", Size(640, 640), "output0");
|
||||
expectNoFallbacksFromIE(net);
|
||||
expectNoFallbacksFromCUDA(net);
|
||||
}
|
||||
|
||||
TEST_P(DNNTestNetwork, AlexNet)
|
||||
{
|
||||
applyTestTag(CV_TEST_TAG_MEMORY_1GB);
|
||||
@@ -1454,6 +1460,71 @@ INSTANTIATE_TEST_CASE_P(Layer_Test_Backends, Eltwise, testing::Combine(
|
||||
dnnBackendsAndTargets()
|
||||
));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Element-wise layers
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
using NaryEltwiseConcat = TestWithParam<tuple<std::vector<int>, tuple<Backend, Target>>>;
|
||||
TEST_P(NaryEltwiseConcat, Accuracy) {
|
||||
auto param = GetParam();
|
||||
std::vector<int> input_shape = get<0>(param);
|
||||
auto backend_id = get<0>(get<1>(param));
|
||||
auto target_id = get<1>(get<1>(param));
|
||||
|
||||
/* Build the following net:
|
||||
|
||||
<1x4x84>
|
||||
/
|
||||
[Input] -+-> Mul(B<1x84>) -> Concat(axis=1) -> [Output]
|
||||
| |
|
||||
+-> Sigmoid ----------+
|
||||
|
||||
*/
|
||||
Net net;
|
||||
|
||||
std::vector<int> mul_B_shape(input_shape.size() - 1, 1);
|
||||
mul_B_shape.back() = input_shape.back();
|
||||
Mat mul_B(mul_B_shape, CV_32FC1);
|
||||
randn(mul_B, 0.f, 1.f);
|
||||
LayerParams mul_B_lp;
|
||||
mul_B_lp.name = "mul_B";
|
||||
mul_B_lp.type = "Const";
|
||||
mul_B_lp.blobs.push_back(mul_B);
|
||||
int id_mul_B = net.addLayer(mul_B_lp.name, mul_B_lp.type, mul_B_lp);
|
||||
|
||||
LayerParams mul_lp;
|
||||
mul_lp.name = "mul";
|
||||
mul_lp.type = "NaryEltwise";
|
||||
mul_lp.set("operation", "mul");
|
||||
int id_mul = net.addLayer(mul_lp.name, mul_lp.type, mul_lp);
|
||||
net.connect(0, 0, id_mul, 0);
|
||||
net.connect(id_mul_B, 0, id_mul, 1);
|
||||
|
||||
LayerParams sigmoid_lp;
|
||||
sigmoid_lp.name = "sigmoid";
|
||||
sigmoid_lp.type = "Sigmoid";
|
||||
int id_sigmoid = net.addLayer(sigmoid_lp.name, sigmoid_lp.type, sigmoid_lp);
|
||||
net.connect(0, 0, id_sigmoid, 0);
|
||||
|
||||
LayerParams concat_lp;
|
||||
concat_lp.name = "concat";
|
||||
concat_lp.type = "Concat";
|
||||
concat_lp.set("axis", 1);
|
||||
int id_concat = net.addLayer(concat_lp.name, concat_lp.type, concat_lp);
|
||||
net.connect(id_mul, 0, id_concat, 0);
|
||||
net.connect(id_sigmoid, 0, id_concat, 1);
|
||||
|
||||
// Run test
|
||||
Mat input(input_shape, CV_32FC1);
|
||||
testLayer(input, net, backend_id, target_id, false);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Layer_Test_Backends, NaryEltwiseConcat, testing::Combine(
|
||||
testing::Values(std::vector<int>{1, 4, 84}),
|
||||
dnnBackendsAndTargets())
|
||||
);
|
||||
|
||||
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(/*nothing*/, Test_layers_backends, dnnBackendsAndTargets());
|
||||
|
||||
}} // namespace
|
||||
|
||||
Reference in New Issue
Block a user