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

fix pose_tracker python api will raise ValueError when result has no human #1922

Merged
merged 1 commit into from
Mar 27, 2023

Conversation

tongda
Copy link
Contributor

@tongda tongda commented Mar 27, 2023

Motivation

There is a bug in Python binding of PoseTracker. When inference result has no human body, there is possibility that a ValueError: negative dimensions are not allowed numpy exception raised. I made some digging and found that:

  1. when no human found in the image, an empty Result object is created but keypoint_count is uninitialized;
  2. when creating py::array_t in Python version Apply function, keypoint_count is used to initialize the array shape;
  3. in this case, keypoint_count is random value, when it is negative, the py::array_t would fail to create.

Modification

Add a check before reading keypoint_count.

BC-breaking (Optional)

No.

Use cases (Optional)

No.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit tests to ensure the correctness.
  3. If the modification has a dependency on downstream projects of a newer version, this PR should be tested with all supported versions of downstream projects.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@lvhan028 lvhan028 merged commit 9fa7403 into open-mmlab:dev-1.x Mar 27, 2023
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

Successfully merging this pull request may close these issues.

None yet

3 participants