|
|
|
@ -617,7 +617,8 @@ struct TorchImporter : public ::cv::dnn::Importer |
|
|
|
|
curModule->modules.push_back(cv::Ptr<Module>(new Module(nnName, "Sigmoid"))); |
|
|
|
|
readObject(); |
|
|
|
|
} |
|
|
|
|
else if (nnName == "SpatialBatchNormalization" || nnName == "InstanceNormalization") |
|
|
|
|
else if (nnName == "SpatialBatchNormalization" || nnName == "InstanceNormalization" || |
|
|
|
|
nnName == "BatchNormalization") |
|
|
|
|
{ |
|
|
|
|
newModule->apiType = "BatchNorm"; |
|
|
|
|
readTorchTable(scalarParams, tensorParams); |
|
|
|
@ -700,17 +701,24 @@ struct TorchImporter : public ::cv::dnn::Importer |
|
|
|
|
|
|
|
|
|
curModule->modules.push_back(newModule); |
|
|
|
|
} |
|
|
|
|
else if (nnName == "SpatialDropout") |
|
|
|
|
else if (nnName == "SpatialDropout" || nnName == "Dropout") |
|
|
|
|
{ |
|
|
|
|
readTorchTable(scalarParams, tensorParams); |
|
|
|
|
CV_Assert(scalarParams.has("p")); |
|
|
|
|
|
|
|
|
|
float scale = 1 - scalarParams.get<double>("p"); |
|
|
|
|
if (scalarParams.has("v2") && scalarParams.get<bool>("v2")) |
|
|
|
|
{ |
|
|
|
|
newModule->apiType = "Identity"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
float scale = 1 - scalarParams.get<double>("p"); |
|
|
|
|
|
|
|
|
|
CV_Assert(scale > 0); |
|
|
|
|
CV_Assert(scale > 0); |
|
|
|
|
|
|
|
|
|
newModule->apiType = "Power"; |
|
|
|
|
layerParams.set("scale", scale); |
|
|
|
|
newModule->apiType = "Power"; |
|
|
|
|
layerParams.set("scale", scale); |
|
|
|
|
} |
|
|
|
|
curModule->modules.push_back(newModule); |
|
|
|
|
} |
|
|
|
|
// TotalVariation layer is from fast-neural-style project: https://github.com/jcjohnson/fast-neural-style
|
|
|
|
|