mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Merge pull request #29134 from svigh:gapi_u8_nd_mats_onnx_layout_fix
Merge pull request #29134 from svigh/gapi_u8_nd_mats_onnx_layout_fix Gapi u8 N-D mats onnx layout workaround #29134 ### 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. - [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
@@ -330,7 +330,8 @@ inline void preprocess(const cv::Mat& src,
|
||||
cv::Mat& dst) {
|
||||
// CNN input type
|
||||
const auto type = toCV(ti.type);
|
||||
if (src.depth() != CV_8U) {
|
||||
|
||||
if (src.depth() != CV_8U || src.dims > 2) {
|
||||
// Just pass the tensor as-is.
|
||||
// No layout or dimension transformations done here!
|
||||
// TODO: This needs to be aligned across all NN backends.
|
||||
@@ -338,10 +339,10 @@ inline void preprocess(const cv::Mat& src,
|
||||
if (tensor_dims.size() == ti.dims.size()) {
|
||||
for (size_t i = 0; i < ti.dims.size(); ++i) {
|
||||
GAPI_Assert((ti.dims[i] == -1 || ti.dims[i] == tensor_dims[i]) &&
|
||||
"Non-U8 tensor dimensions should match with all non-dynamic NN input dimensions");
|
||||
"Tensor dimensions should match with all non-dynamic NN input dimensions");
|
||||
}
|
||||
} else {
|
||||
GAPI_Error("Non-U8 tensor size should match with NN input");
|
||||
GAPI_Error("Tensor size should match with NN input");
|
||||
}
|
||||
|
||||
dst = src;
|
||||
|
||||
Reference in New Issue
Block a user