mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Fix multiple inputs models from Caffe.
Fixed Concat optimization.
This commit is contained in:
@@ -274,6 +274,48 @@ OCL_TEST(Layer_Test_Concat, Accuracy)
|
||||
testLayerUsingCaffeModels("layer_concat", DNN_TARGET_OPENCL);
|
||||
}
|
||||
|
||||
TEST(Layer_Test_Fused_Concat, Accuracy)
|
||||
{
|
||||
// Test case
|
||||
// input
|
||||
// |
|
||||
// v
|
||||
// some_layer
|
||||
// | |
|
||||
// v v
|
||||
// concat
|
||||
Net net;
|
||||
int interLayer;
|
||||
{
|
||||
LayerParams lp;
|
||||
lp.type = "AbsVal";
|
||||
lp.name = "someLayer";
|
||||
interLayer = net.addLayerToPrev(lp.name, lp.type, lp);
|
||||
}
|
||||
{
|
||||
LayerParams lp;
|
||||
lp.set("axis", 1);
|
||||
lp.type = "Concat";
|
||||
lp.name = "testConcat";
|
||||
int id = net.addLayer(lp.name, lp.type, lp);
|
||||
net.connect(interLayer, 0, id, 0);
|
||||
net.connect(interLayer, 0, id, 1);
|
||||
}
|
||||
int shape[] = {1, 2, 3, 4};
|
||||
Mat input(4, shape, CV_32F);
|
||||
randu(input, 0.0f, 1.0f); // [0, 1] to make AbsVal an identity transformation.
|
||||
|
||||
net.setInput(input);
|
||||
Mat out = net.forward();
|
||||
|
||||
normAssert(slice(out, Range::all(), Range(0, 2), Range::all(), Range::all()), input);
|
||||
normAssert(slice(out, Range::all(), Range(2, 4), Range::all(), Range::all()), input);
|
||||
|
||||
//
|
||||
|
||||
testLayerUsingCaffeModels("layer_concat_optim", DNN_TARGET_CPU, true, false);
|
||||
}
|
||||
|
||||
TEST(Layer_Test_Eltwise, Accuracy)
|
||||
{
|
||||
testLayerUsingCaffeModels("layer_eltwise");
|
||||
|
||||
Reference in New Issue
Block a user