[G-API] Pipeline modeling tool - Fix generating FP16 Mat#21566
Conversation
| cv::randu(out, 0.f, 1.f); | ||
| break; | ||
| case CV_16F: { | ||
| cv::Mat fp32_mat(out.size(), CV_MAKETYPE(CV_32F, out.channels())); |
There was a problem hiding this comment.
If out is ND (honestly it's always ND, since we create cv::Mat's from std::vector) calling size method cause exception
| // create cv::Mat the same way in order to achieve meta matching. | ||
| // Change this line when it's fixed to: | ||
| // mat.create(dims, CV_MAKETYPE(depth, dims.size())); | ||
| mat.create(dims, depth); |
There was a problem hiding this comment.
@mshabunin @alalek Could you help us with understanding?
Which line is correct to create ND cv::Mat?
There was a problem hiding this comment.
mat.create(dims, CV_MAKETYPE(depth, dims.size()));
This doesn't look valid as dims.size() should NOT be used as number of channels.
mat.create(dims, depth);
This code is equal to mat.create(dims, CV_MAKETYPE(depth, 1));
There was a problem hiding this comment.
And what's the correct way to create ND Mat with dims and let's say CV_32F depth?
mat.create(dims, CV_32f)
There was a problem hiding this comment.
CV_32F is allowed (CN=1 is assumed).
CV_32FC1 is accurate.
2667616 to
d440af5
Compare
…tool_fix_handling_fp16_precision [G-API] Pipeline modeling tool - Fix generating FP16 Mat * Fix handling fp16 precision * Disable preproc in case FP16 input inside IE backend * Fix isApplicableForResize function
…tool_fix_handling_fp16_precision [G-API] Pipeline modeling tool - Fix generating FP16 Mat * Fix handling fp16 precision * Disable preproc in case FP16 input inside IE backend * Fix isApplicableForResize function
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.
Build configuration