mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge pull request #29217 from MBSaravanaBalaji:feat/onnx-lppool
dnn: implement LpPool ONNX operator #29217 ## Summary Implements the `LpPool` ONNX operator (opset 1–18), which was previously unregistered and caused a parse failure. `LpPool` computes the Lp-norm pooling: `(sum(|x|^p))^(1/p)` over a sliding window. ## Changes - New `LpPoolLayer` in `modules/dnn/src/layers/lppool_layer.cpp` - Supports `kernel_shape`, `strides`, `dilations`, `pads`, `auto_pad` (NOTSET/SAME_UPPER), `ceil_mode`, and `p` (default 2) - SIMD fast paths for p=1 (abs + accumulate) and p=2 (square + accumulate + sqrt); scalar fallback for other values of p - Registered `LpPool` dispatch entry in both `onnx_importer.cpp` (classic engine) and `onnx_importer2.cpp` (new graph engine) - Added `LpPoolLayer` declaration to `modules/dnn/include/opencv2/dnn/all_layers.hpp` - Registered layer class in `modules/dnn/src/init.cpp` - Re-enabled 8 lppool conformance tests in `test_onnx_conformance.cpp` (previously in parser denylist) - `test_lppool_2d_same_lower` added to the global conformance denylist — same known SAME_LOWER padding bug that affects `averagepool` and `maxpool` ## Testing All applicable ONNX conformance tests pass: | Test | Result | |------|--------| | test_lppool_1d_default | PASSED | | test_lppool_2d_default | PASSED | | test_lppool_2d_dilations | PASSED | | test_lppool_2d_pads | PASSED | | test_lppool_2d_same_lower | SKIPPED (known SAME_LOWER padding bug, consistent with avgpool/maxpool) | | test_lppool_2d_same_upper | PASSED | | test_lppool_2d_strides | PASSED | | test_lppool_3d_default | PASSED | Tested on: macOS (x86_64/SSE4, Rosetta 2) and Linux x86_64 (AVX2/AVX-512, GCC 13.3.0), Release build OpenCV version: 5.0.0-pre ## Related Issues None --- ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
committed by
GitHub
parent
d36133b325
commit
e2f0876777
@@ -577,6 +577,17 @@ CV__DNN_INLINE_NS_BEGIN
|
||||
static Ptr<MaxPoolLayer> create(const LayerParams& params);
|
||||
};
|
||||
|
||||
class CV_EXPORTS LpPoolLayer : public Layer
|
||||
{
|
||||
public:
|
||||
std::vector<int> kernel_shape, strides, dilations, pads;
|
||||
AutoPadding auto_pad;
|
||||
bool ceil_mode;
|
||||
int p;
|
||||
|
||||
static Ptr<LpPoolLayer> create(const LayerParams& params);
|
||||
};
|
||||
|
||||
class CV_EXPORTS GlobalAveragePoolLayer : public Layer
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user