Skip to content

Better handling of wrong data types of mask for sv.PolygonZone() #106

Description

@GeorgePearse

Search before asking

  • I have searched the Supervision issues and found no similar feature requests.

Description

image

OpenCV errors out with an uninformative error when the dtype of the mask is wrong.

Would be good to add catch if dtype != np.int32 and raise an Exception.

Use case

I was trying to create a mask in CVAT, the exported segmentation had decimal places, np.array(coords) did not convert to np.int32, and I was confused by the bad error message.

This is likely to happen to other users too .

Additional

Happy to submit PR

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

Activity

  1. github-actions commented on May 19, 2023

    @github-actions
    Contributor

    Hello there, thank you for opening an Issue ! 🙏🏻 The team was notified and they will get back to you asap.

  2. SkalskiP commented on May 19, 2023

    @SkalskiP
    Collaborator

    Hi, @GeorgePearse 👋🏻! I think it would be even better if we tried to cast dtype to int. If the only thing that was wrong was the type we will fix it for you. What do you think about it?

  3. self-assigned this
    on May 19, 2023
  4. GeorgePearse commented on May 19, 2023

    @GeorgePearse
    Author

    Yep, better idea

  5. SkalskiP commented on May 22, 2023

    @SkalskiP
    Collaborator

    I'll try to make it happen with next release :)

  6. pinned this issue on Jun 2, 2023
  7. added a commit that references this issue on Jun 7, 2023
    1870670
  8. added a commit that references this issue on Jun 7, 2023
    7c8f16b
  9. unpinned this issue on Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestversion: 0.9.0Feature to be added in `0.9.0` release

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions