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

OpenCV error at the end of the video #35

Open
Athuliva opened this issue Aug 21, 2024 · 8 comments
Open

OpenCV error at the end of the video #35

Athuliva opened this issue Aug 21, 2024 · 8 comments

Comments

@Athuliva
Copy link

Athuliva commented Aug 21, 2024

i get an opencv error at the end of a video.

terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.2.0) ../modules/core/src/matmul.dispatch.cpp:349: error: (-215:Assertion failed) a_size.height == len in function 'gemm'

Aborted (core dumped)
@zhouyuchong
Copy link
Owner

@Athuliva sorry I didn't meet this problem so far. make sure all landmarks are correct, especially data format.

@Athuliva Athuliva changed the title OpenCV error if alignment-pics-path is not set OpenCV error at the end of the video Aug 21, 2024
@Athuliva
Copy link
Author

i am getting the error at the of the video. It reaches Aborted (core dumb) and no EOS signal.

@zhouyuchong
Copy link
Owner

@Athuliva no clue to this. Maybe you can use gdb to debug for more information.

@Athuliva
Copy link
Author

i wasn't using the updated code for custom parser, and at some corner condition was getting wrong keypoints. with the updated custom parser everything works fine

@Athuliva Athuliva reopened this Aug 27, 2024
@Athuliva
Copy link
Author

i faced the same issue with the updated custom parser and retinaface-mobilenet. After debugging I found that the shape of dst matrix is not always (5,2)

 memcpy(dst.data, lmks, 2 * row * sizeof(float));

  //  DEBUG

   std::cout << "Matrix contents:" << dst.size()  << std::endl;
    for (int i = 0; i < dst.rows; i++) {
        for (int j = 0; j < dst.cols; j++) {
            std::cout << (int)dst.at<float>(i, j) << " ";
        }
        std::cout << std::endl;
    }

  // DEBUG END

  cv::Mat M = nvinfer->aligner.Align(dst, nvinfer->alignment_type);

i am getting the following output

Matrix contents:[2 x 5]
2 104 
18 102 
-2147483648 130 
14 152 
26 150 
0 debug-----
Matrix contents:[2 x 4]
0 104 
8 102 
-2147483648 130 
6 152 
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.2.0) ../modules/core/src/matmul.dispatch.cpp:349: error: (-215:Assertion failed) a_size.height == len in function 'gemm'

I hard coded int numNonZeroCount=10; instead of checking the number of non zero landmarks

 int numNonZeroCount=10;
  /*for (unsigned int i=0; i < ARRAYSIZE; i++) {
    if (landmarks[i]) numNonZeroCount++;
  }*/

  float lmks[numNonZeroCount/2][2];
  for (unsigned int i=0;i<numNonZeroCount;i++) {
    lmks[i/2][i%2] = landmarks[i];

@zhouyuchong but i am not sure commenting these few lines cause any side effects, can you please tell the purpose of checking the count of Non zero elements in the landmark

@zhouyuchong
Copy link
Owner

@Athuliva

For face alignment there should be 5 landmarks, which detector are you using?

to pass the landmarks from raw output of detector to obj_meta_data needs an extra step. It is ugly but I didn't find a better way so far. As you can see, the landmarks will first concat to label first, that's why they must be INT and NON-NEGATIVE. The number "-2147483648" in your output is abnormal, mostly caused by negative value. The definition here should be double/float better of course. But as I mentioned before, they will be trans into char later so INT is needed. check here do confirm they are all non-negative.

@Athuliva
Copy link
Author

i am using retinaface from https://github.com/wang-xinyu/tensorrtx/tree/master/retinaface

@zhouyuchong
Copy link
Owner

@Athuliva doesn't matter with version you use, make sure all the landmarks are passed correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants