mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
Add Java wrapper support for List<List<MatShape>>
- Added vector_MatShape and vector_vector_MatShape to gen_dict.json - Implemented MatShape_to_vector_MatShape, vector_MatShape_to_MatShape, MatShape_to_vector_vector_MatShape, and vector_vector_MatShape_to_MatShape conversion functions in dnn_converters.h/cpp and Converters.java - Added testGetLayersShapes test to verify List<List<MatShape>> conversion
This commit is contained in:
@@ -116,4 +116,36 @@ public class DnnListRegressionTest extends OpenCVTestCase {
|
||||
fail("Net getFLOPS failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void testGetLayersShapes() {
|
||||
List<MatOfInt> netInputShapes = new ArrayList();
|
||||
netInputShapes.add(new MatOfInt(1, 3, 224, 224));
|
||||
|
||||
MatOfInt layersIds = new MatOfInt();
|
||||
List<List<MatOfInt>> inLayersShapes = new ArrayList();
|
||||
List<List<MatOfInt>> outLayersShapes = new ArrayList();
|
||||
try {
|
||||
net.getLayersShapes(netInputShapes, layersIds, inLayersShapes, outLayersShapes);
|
||||
|
||||
assertEquals(layersIds.total(), inLayersShapes.size());
|
||||
assertEquals(layersIds.total(), outLayersShapes.size());
|
||||
|
||||
// Layer ID for "conv2d0_pre_relu/conv"
|
||||
int layerId = 1;
|
||||
|
||||
MatOfInt expectedInShape = new MatOfInt(1, 3, 224, 224);
|
||||
MatOfInt expectedOutShape = new MatOfInt(1, 64, 112, 112);
|
||||
|
||||
// Test inLayersShapes
|
||||
MatOfInt actualInShape = inLayersShapes.get(layerId).get(0);
|
||||
assertMatEqual(expectedInShape, actualInShape);
|
||||
|
||||
// Test outLayersShapes
|
||||
MatOfInt actualOutShape = outLayersShapes.get(layerId).get(0);
|
||||
assertMatEqual(expectedOutShape, actualOutShape);
|
||||
|
||||
} catch(Exception e) {
|
||||
fail("Net getLayersShapes failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user