本文整理汇总了C++中LayerParams::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ LayerParams::erase方法的具体用法?C++ LayerParams::erase怎么用?C++ LayerParams::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayerParams
的用法示例。
在下文中一共展示了LayerParams::erase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: populateNet
//.........这里部分代码省略.........
else {
layerParams.type = "Scale";
layerParams.set("has_bias", true);
layerParams.blobs.push_back(-1.0f * blob.reshape(1, 1));
}
}
else if (layer_type == "Div")
{
Mat blob = getBlob(node_proto, constBlobs, 1);
CV_Assert_N(blob.type() == CV_32F, blob.total());
if (blob.total() == 1)
{
layerParams.set("scale", 1.0f / blob.at<float>(0));
layerParams.type = "Power";
}
else
{
layerParams.type = "Scale";
divide(1.0, blob, blob);
layerParams.blobs.push_back(blob);
layerParams.set("bias_term", false);
}
}
else if (layer_type == "Constant")
{
CV_Assert(node_proto.input_size() == 0);
CV_Assert(layerParams.blobs.size() == 1);
constBlobs.insert(std::make_pair(layerParams.name, layerParams.blobs[0]));
continue;
}
else if (layer_type == "ImageScaler")
{
const float scale = layerParams.has("scale") ? layerParams.get<float>("scale") : 1.0f;
layerParams.erase("scale");
if (layerParams.has("bias"))
{
layerParams.type = "Scale";
layerParams.blobs.push_back(
Mat(Size(1, layerParams.get("bias").size()), CV_32FC1, scale));
layerParams.set("bias_term", true);
Mat bias(1, layerParams.get("bias").size(), CV_32FC1);
for (int j = 0; j < bias.total(); j++) {
bias.at<float>(0, j) = layerParams.get("bias").getRealValue(j);
}
layerParams.blobs.push_back(bias);
layerParams.erase("bias");
}
else {
layerParams.set("scale", scale);
layerParams.type = "Power";
}
}
else if (layer_type == "LeakyRelu")
{
layerParams.type = "ReLU";
replaceLayerParam(layerParams, "alpha", "negative_slope");
}
else if (layer_type == "LRN")
{
replaceLayerParam(layerParams, "size", "local_size");
}
else if (layer_type == "BatchNormalization")
{
if (node_proto.input_size() != 5)