mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Fix TF Split layer
This commit is contained in:
@@ -61,6 +61,7 @@ public:
|
||||
{
|
||||
setParamsFrom(params);
|
||||
axis = params.get<int>("axis", 1);
|
||||
num_split = params.get<int>("num_split", 0);
|
||||
if (params.has("slice_point"))
|
||||
{
|
||||
CV_Assert(!params.has("begin") && !params.has("size") && !params.has("end"));
|
||||
@@ -141,9 +142,10 @@ public:
|
||||
else // Divide input blob on equal parts by axis.
|
||||
{
|
||||
CV_Assert(0 <= axis && axis < inpShape.size());
|
||||
CV_Assert(requiredOutputs > 0 && inpShape[axis] % requiredOutputs == 0);
|
||||
inpShape[axis] /= requiredOutputs;
|
||||
outputs.resize(requiredOutputs, inpShape);
|
||||
int splits = num_split ? num_split : requiredOutputs;
|
||||
CV_Assert(splits > 0 && inpShape[axis] % splits == 0);
|
||||
inpShape[axis] /= splits;
|
||||
outputs.resize(splits, inpShape);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1410,6 +1410,9 @@ void TFImporter::populateNet(Net dstNet)
|
||||
axis = toNCHW(axis);
|
||||
layerParams.set("axis", axis);
|
||||
|
||||
if (hasLayerAttr(layer, "num_split"))
|
||||
layerParams.set("num_split", getLayerAttr(layer, "num_split").i());
|
||||
|
||||
int id = dstNet.addLayer(name, "Slice", layerParams);
|
||||
layer_id[name] = id;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user