mirror of
https://github.com/opencv/opencv.git
synced 2026-07-21 19:33:03 +04:00
Merge pull request #28888 from omrope79:ssd-lpnorm-fix
Add LpNormalization Layer support
This commit is contained in:
@@ -62,9 +62,19 @@ public:
|
||||
pnorm = params.get<float>("p", 2);
|
||||
epsilon = params.get<float>("eps", 1e-10f);
|
||||
acrossSpatial = params.get<bool>("across_spatial", true);
|
||||
startAxis = params.get<int>("start_axis", 1);
|
||||
CV_Assert(!params.has("across_spatial") || !params.has("end_axis"));
|
||||
endAxis = params.get<int>("end_axis", acrossSpatial ? -1 : startAxis);
|
||||
|
||||
if (!params.has("start_axis") && !params.has("across_spatial"))
|
||||
{
|
||||
int axis = params.get<int>("axis", -1);
|
||||
startAxis = axis;
|
||||
endAxis = axis;
|
||||
}
|
||||
else
|
||||
{
|
||||
startAxis = params.get<int>("start_axis", 1);
|
||||
CV_Assert(!params.has("across_spatial") || !params.has("end_axis"));
|
||||
endAxis = params.get<int>("end_axis", acrossSpatial ? -1 : startAxis);
|
||||
}
|
||||
CV_Assert(pnorm > 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -204,6 +204,7 @@ protected:
|
||||
void parseInstanceNormalization(LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto);
|
||||
void parseLayerNorm (LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto);
|
||||
void parseLeakyRelu (LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto);
|
||||
void parseLpNormalization (LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto);
|
||||
void parseLRN (LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto);
|
||||
void parseLSTM (LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto);
|
||||
void parseMatMul (LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto);
|
||||
@@ -1311,6 +1312,12 @@ void ONNXImporter2::parsePRelu(LayerParams& layerParams, const opencv_onnx::Node
|
||||
addLayer(layerParams, node_proto, 1);
|
||||
}
|
||||
|
||||
void ONNXImporter2::parseLpNormalization(LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto)
|
||||
{
|
||||
layerParams.type = "NormalizeBBox";
|
||||
addLayer(layerParams, node_proto);
|
||||
}
|
||||
|
||||
void ONNXImporter2::parseLRN(LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto)
|
||||
{
|
||||
replaceLayerParam(layerParams, "size", "local_size");
|
||||
@@ -2722,6 +2729,7 @@ void ONNXImporter2::buildDispatchMap_ONNX_AI()
|
||||
dispatch["Abs"] = &ONNXImporter2::parseAbs;
|
||||
dispatch["PRelu"] = &ONNXImporter2::parsePRelu;
|
||||
dispatch["NonZero"] = &ONNXImporter2::parseNonZero;
|
||||
dispatch["LpNormalization"] = &ONNXImporter2::parseLpNormalization;
|
||||
dispatch["LRN"] = &ONNXImporter2::parseLRN;
|
||||
dispatch["InstanceNormalization"] = &ONNXImporter2::parseInstanceNormalization;
|
||||
dispatch["BatchNormalization"] = &ONNXImporter2::parseBatchNormalization;
|
||||
|
||||
@@ -1314,6 +1314,8 @@ CASE(test_layer_normalization_default_axis_expanded)
|
||||
SKIP;
|
||||
CASE(test_layer_normalization_default_axis_expanded_ver18)
|
||||
SKIP;
|
||||
CASE(test_lpnormalization_default)
|
||||
SKIP;
|
||||
CASE(test_leakyrelu)
|
||||
// no filter
|
||||
CASE(test_leakyrelu_default)
|
||||
|
||||
@@ -252,6 +252,7 @@
|
||||
"test_less_uint32",
|
||||
"test_less_uint64",
|
||||
"test_less_uint8",
|
||||
"test_lpnormalization_default",
|
||||
"test_resize_upsample_scales_nearest_axes_2_3",
|
||||
"test_resize_upsample_sizes_nearest_axes_2_3",
|
||||
"test_split_equal_parts_2d_opset13",
|
||||
|
||||
@@ -330,7 +330,6 @@
|
||||
"test_l2normalization_axis_1",
|
||||
"test_loop13_seq", // Loop with tensor sequences output, not yet supported in OpenCV
|
||||
"test_loop16_seq_none", // Loop with optional tensor sequences, not yet supported in OpenCV
|
||||
"test_lpnormalization_default",
|
||||
"test_lppool_1d_default",
|
||||
"test_lppool_2d_default",
|
||||
"test_lppool_2d_dilations",
|
||||
|
||||
Reference in New Issue
Block a user