@@ -617,7 +617,8 @@ struct TorchImporter : public ::cv::dnn::Importer
617
617
curModule->modules .push_back (cv::Ptr<Module>(new Module (nnName, " Sigmoid" )));
618
618
readObject ();
619
619
}
620
- else if (nnName == " SpatialBatchNormalization" || nnName == " InstanceNormalization" )
620
+ else if (nnName == " SpatialBatchNormalization" || nnName == " InstanceNormalization" ||
621
+ nnName == " BatchNormalization" )
621
622
{
622
623
newModule->apiType = " BatchNorm" ;
623
624
readTorchTable (scalarParams, tensorParams);
@@ -700,17 +701,24 @@ struct TorchImporter : public ::cv::dnn::Importer
700
701
701
702
curModule->modules .push_back (newModule);
702
703
}
703
- else if (nnName == " SpatialDropout" )
704
+ else if (nnName == " SpatialDropout" || nnName == " Dropout " )
704
705
{
705
706
readTorchTable (scalarParams, tensorParams);
706
707
CV_Assert (scalarParams.has (" p" ));
707
708
708
- float scale = 1 - scalarParams.get <double >(" p" );
709
+ if (scalarParams.has (" v2" ) && scalarParams.get <bool >(" v2" ))
710
+ {
711
+ newModule->apiType = " Identity" ;
712
+ }
713
+ else
714
+ {
715
+ float scale = 1 - scalarParams.get <double >(" p" );
709
716
710
- CV_Assert (scale > 0 );
717
+ CV_Assert (scale > 0 );
711
718
712
- newModule->apiType = " Power" ;
713
- layerParams.set (" scale" , scale);
719
+ newModule->apiType = " Power" ;
720
+ layerParams.set (" scale" , scale);
721
+ }
714
722
curModule->modules .push_back (newModule);
715
723
}
716
724
// TotalVariation layer is from fast-neural-style project: https://github.com/jcjohnson/fast-neural-style
0 commit comments