@@ -934,20 +934,18 @@ struct TorchImporter : public ::cv::dnn::Importer
934
934
}
935
935
else if (module ->thName == " Concat" )
936
936
{
937
- int newId, splitId, mergeId;
938
- LayerParams mergeParams, splitParams ;
937
+ int newId, mergeId;
938
+ LayerParams mergeParams;
939
939
mergeParams.set (" axis" , module ->params .get <int >(" dimension" ) - 1 );
940
940
941
- splitId = net.addLayer (generateLayerName (" torchSplit" ), " Split" , splitParams);
942
- net.connect (prevLayerId, prevOutNum, splitId, 0 );
943
-
944
941
std::vector<int > branchIds;
945
942
for (int i = 0 ; i < (int )module ->modules .size (); i++)
946
943
{
947
- newId = fill (module ->modules [i], addedModules, splitId, i );
944
+ newId = fill (module ->modules [i], addedModules, prevLayerId, prevOutNum );
948
945
branchIds.push_back (newId);
949
946
}
950
947
948
+ moduleCounter += 1 ; // Skip split layer creation. See https://github.com/opencv/opencv/pull/9384.
951
949
mergeId = net.addLayer (generateLayerName (" torchMerge" ), " Concat" , mergeParams);
952
950
953
951
for (int i = 0 ; i < branchIds.size (); i++)
@@ -1015,19 +1013,12 @@ struct TorchImporter : public ::cv::dnn::Importer
1015
1013
return mergeId;
1016
1014
}
1017
1015
else if (module ->thName == " ConcatTable" ) {
1018
- int newId = -1 , splitId;
1019
- LayerParams splitParams;
1020
-
1021
- splitId = net.addLayer (generateLayerName (" torchSplit" ), " Split" , splitParams);
1022
- net.connect (prevLayerId, prevOutNum, splitId, 0 );
1023
-
1024
- addedModules.push_back (std::make_pair (splitId, module ));
1025
-
1016
+ int newId = -1 ;
1017
+ moduleCounter += 1 ; // Skip split layer creation. See https://github.com/opencv/opencv/pull/9384.
1026
1018
for (int i = 0 ; i < (int )module ->modules .size (); i++)
1027
1019
{
1028
- newId = fill (module ->modules [i], addedModules, splitId, i );
1020
+ newId = fill (module ->modules [i], addedModules, prevLayerId, prevOutNum );
1029
1021
}
1030
-
1031
1022
return newId;
1032
1023
}
1033
1024
else if (module ->thName == " JoinTable" ) {
0 commit comments