Fix for index error for Reduce Mean#18845
Fix for index error for Reduce Mean#18845opencv-pushbot merged 1 commit intoopencv:3.4from joegeisbauer:fix_reduce_mean_index_error
Conversation
|
@joegeisbauer Could you please share conversion instructions (with link on original model) and final .onnx file (thrugh GoogleDrive / OneDrive / DropBox), so we can reproduce the problem? |
|
@alalek The models both the state dict checkpoint and the onyx files can be found here. For directions on model conversion, you can check out this link, but I have already converted it for you in the Dropbox folder. The following code was copied from the link |
|
@joegeisbauer Can you please change the target branch from master to 3.4? |
|
This patch should go into 3.4 branch first. We will merge changes from 3.4 into master regularly (weekly/bi-weekly). 3.4 and master branches are diverged and it's not enough to change target in PR. So, please:
Note: no need to re-open PR, apply changes "inplace". |
|
@asmorkalov I took care of the rebase as well. We will see how the builds and testing complete and go from there. Thank you @asmorkalov and @sl-sergei for your patience and understanding on my first ever pull request for OpenCV. It has been a great experience, and makes me want to help by contributing even more as I can. |
Fix for index error for Reduce Mean Correct Reduce Mean indexing error
|
resolves #18898 |
resolves #18898
[ONNX] Fix Reduce Mean Layer Import Error
The onnx_importer.cpp was causing a Segmentation Fault without an error message when converting newer models like MobileNetV2 that had been converted from PyTorch torchvision using torch.onnx. This occurred with the recent update to OpenCV 4.5.0. The culprit was chased down to an indexing issue in the conversion of the ReduceMean layer. You can see the one line change I made in the code comparison of this commit. My understanding was that the intention was to delete the last two dimensions of the tensor which corresponded to the feature size in order to create the correct size tensor for output by changing the last two dimensions. If that is not the expected behavior, then this code will not fix the issue. However, we did verify that this code will fix the issue if that is the expected behavior.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.