Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cv::resize to copyFromOV to fix gaze_estimation_demo with API2.0 #24791

Draft
wants to merge 1 commit into
base: 4.x
Choose a base branch
from

Conversation

DariaMityagina
Copy link
Contributor

@DariaMityagina DariaMityagina commented Dec 28, 2023

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • 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
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • 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

Related PRs:

openvinotoolkit/open_model_zoo#3887

gaze_estimation_demo_gapi
OK: Works with a single image and with a video input.
FAIL: But still has issues in case folder with images is provided (in CI) - WIP
Failed to copy data from cv::Mat to ov::Tensor. Data type or number of elements mismatch. ov::Tensor: u8 [1,490,1183,3] and cv::Mat: 8UC3 1180x490
It seems to fail if the input folder contains images of different sizes. It works fine with the first image from the folder and does not work with the second (if it has a different size).

if (tensor.get_size() != total) {
GAPI_LOG_WARNING(NULL, "copyToOV :: tensor.get_size() != total, resizing cv::Mat");
auto W = ov::layout::width_idx("NHWC");
auto H = ov::layout::height_idx("NHWC");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: It might be worth checking the layout here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is just copy. A dedicated preprocessing routine must be somewhere near (and resize should be already a part of it). @TolyaTalamanov for your consideration

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the real question is... Why the tensor is 1183x490 and the mat is 1180x490? They both are 3-channel.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I keep looking for other option. This is just one of them.
Thanks a lot!

@asmorkalov asmorkalov requested review from dmatveev and TolyaTalamanov and removed request for dmatveev December 29, 2023 11:37
@dmatveev dmatveev self-assigned this Dec 29, 2023
@dmatveev dmatveev added this to the 4.10.0 milestone Dec 29, 2023
@asmorkalov
Copy link
Contributor

@dmatveev @TolyaTalamanov Friendly reminder.

@asmorkalov asmorkalov modified the milestones: 4.10.0, 4.11.0 May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants