-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Added text_color parameter for VertexLabelAnnotator #1409
Conversation
Hi, @Bhavay-2001 👋🏻 Thanks a lot for your interest in supervision. It Looks like you added external API and docstring, but it looks like changing the value of |
Hi @SkalskiP, Yess, this was little bit incomplete. The |
Hi @Bhavay-2001 👋🏻 I'd even say we should make it the same as other annotators and make both |
Alright. Then, maybe we should take the this logic from other annotators. |
If it's possible to reuse some parts of that logic, then sure. |
Before making the changes, I would like to discuss regarding this. Currently, the def preprocess_and_validate_colors(
colors: Optional[Union[Color, List[Color]]],
points_count: int,
skeletons_count: int,
) -> np.array:
if isinstance(colors, list) and len(colors) != points_count:
raise ValueError(
f"Number of colors ({len(colors)}) must match number of key points "
f"({points_count})."
)
return (
np.array(colors * skeletons_count)
if isinstance(colors, list)
else np.array([colors] * points_count * skeletons_count)
) In this, we need to change the |
@Bhavay-2001, after further consideration, let's not change the type for now. Keep |
…/roboflow-supervision into VertexLabelAnnotator
…/roboflow-supervision into VertexLabelAnnotator
Hi @SkalskiP, please check the code and the notebook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
supervision/keypoint/annotators.py
Outdated
@@ -321,12 +323,19 @@ def annotate( | |||
skeletons_count=skeletons_count, | |||
) | |||
|
|||
text_colors = self.preprocess_and_validate_text_colors( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LinasKo, Should I call the preprocess_and_validate_colors
method here too to get the list of text_colors
then?
Done |
supervision/keypoint/annotators.py
Outdated
@@ -357,7 +368,7 @@ def annotate( | |||
org=(box[0], box[3]), | |||
fontFace=font, | |||
fontScale=self.text_scale, | |||
color=self.text_color.as_rgb(), | |||
color=text_color.as_rgb(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be as_bgr
. OpenCV has a blue-green-red ordering of colors. You can find that we call other opencv functions similarly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes right. I have changed this code some place else too. Missed here sorry.
Hi @Bhavay-2001, I've now approved the pull request and will merge it in. Thank you for the contribution. However, it is also an example of a contribution we won't accept in the future. For a feature this small, the number of times we had to come back to verify, the number of mistakes we found, the number of questions we had to answer - that takes 5x time than it saves, especially for a feature this small. Looking back, this also holds true for #1387 and #1227. |
Description
Part of #1384
Type of change
Please delete options that are not relevant.
How has this change been tested, please provide a testcase or example of how you tested the change?
Any specific deployment considerations
For example, documentation changes, usability, usage/costs, secrets, etc.
Docs