opencv/modules
Abduragim Shtanchaev efbc9f0b66
Merge pull request #25861 from Abdurrahheem:ash/torch-attention-export-fix-4x
Merge pull request #25861 from Abdurrahheem:ash/torch-attention-export-fix-4x

Support for Unflatten operation requred by Attention layer - 4.x #25861

### Pull Request Readiness Checklist

All test data and models for PR are located [#1190](https://github.com/opencv/opencv_extra/pull/1190)

This PR fixes issue reised when importing batched  vanilla `Attention` layer from `PyTorch` via ONNX. Currently batched version of `Attention` layer in PyTorch [has unflatten operation inside](e3b3431c42/torch/nn/functional.py (L5500C17-L5500C31)). `unflatten` operation causes issue in `reshape` layer (see the Reshape_2 in the graph below) due to incorrect output of `slice` layer. This PR particularly fixes `slice` and `concat` layers to handle `unflatten` operation. 


<img width="673" alt="image" src="https://github.com/opencv/opencv/assets/44877829/5b612b31-657a-47f1-83a4-0ac35a950abd">


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
- [x] 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.
- [x] The feature is well documented and sample code can be built with the project CMake
2024-07-04 16:25:31 +03:00
..
calib3d Merge pull request #25427 from MaximSmolskiy:make-finding-corner-neighbor-symmetrical-in-ChessBoardDetector-findQuadNeighbors 2024-06-10 09:42:56 +03:00
core Merge pull request #25810 from fengyuentau:python/fix_parsing_3d_mat_in_dnn 2024-07-04 08:33:20 +03:00
dnn Merge pull request #25861 from Abdurrahheem:ash/torch-attention-export-fix-4x 2024-07-04 16:25:31 +03:00
features2d Merge pull request #25424 from mshabunin:fix-features2d-test 2024-04-17 14:19:05 +03:00
flann Prevent signed integer overflow in LshTable 2024-05-24 23:47:36 +02:00
gapi Merge pull request #25791 from ujjayant-kadian:uk/extend-gapi-onnx-params-arbitrary-session-options 2024-06-21 14:34:26 +03:00
highgui Fixed gtkglext search in cmake. 2024-07-03 19:22:06 +03:00
imgcodecs Merge pull request #25809 from zihaomu:imread_rgb_flag 2024-07-03 10:58:25 +03:00
imgproc Merge pull request #25820 from asmorkalov:as/HAL_non_strict_equalizeHist 2024-06-28 16:51:15 +03:00
java Merge pull request #25856 from alexlyulkov:al/android-optional-kotlin 2024-07-04 13:26:37 +03:00
js Merge pull request #25757 from dkurt:d.kurtaev/opencv_js_tests_old_emsdk 2024-06-17 12:46:10 +03:00
ml Partially back-port #25075 to 4.x 2024-03-05 12:15:39 +03:00
objc Merge pull request #24136 from komakai:visionos_support 2023-12-20 15:35:10 +03:00
objdetect Merge pull request #25722 from AleksandrPanov:update_testSeveralBoardsWithCustomIds 2024-06-06 20:01:33 +03:00
photo photo: doc: Fix window range for fastNlMeansDenoisingMulti 2024-06-21 21:04:22 +08:00
python Merge pull request #25810 from fengyuentau:python/fix_parsing_3d_mat_in_dnn 2024-07-04 08:33:20 +03:00
stitching Partially back-port #25075 to 4.x 2024-03-05 12:15:39 +03:00
ts test: use cv::theRNG instead of own generator 2024-06-07 13:36:11 +03:00
video Merge pull request #25771 from fengyuentau:vittrack_black_input 2024-06-18 12:48:28 +03:00
videoio Set using Orbbec SDK on MacOS OFF by default. 2024-07-02 17:23:20 +08:00
world cmake: use /INCREMENTAL:NO with MSVS 2015 2023-12-07 19:46:27 +00:00