-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Generate colors from random color palette in draw_bounding_boxes #4528
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
Comments
I can take this if that's okay. |
I'm glad that you want to take it. |
Thanks for the proposal @oke-aditya and @gessha for volunteering. That sounds good to me, we should just make sure that the same color is generated for all boxes with the same label. |
Well I'm not sure how we would ensure that same color is generated for all boxes with same label. We don't keep consistency of randomly generating same color for same label in drawing segmentation masks too. |
We can generate num_labels colors and then assign one color per label. Obviously we don't need to do that if
True but |
Great, I think it should be feasible with some refactor. As of now we plot each bbox and then the labels separately. @gessha feel free to send a PR! |
Yes, I can if no one's working on it. I guess the main change involved will be here Lines 203 to 204 in a75dc89
Just to make the variable colors be a list returned from _generate_color_palette , right?
|
Yes and use the colors the generated from the palette in draw_bounding_boxes. Map each label to a color. Since labels is a list and generated color palette is also a list. Both have the same length. Use these colors to draw boxes. |
@ABD-01 I spent some time and thought a bit more. Here is a brief pseudocode (highly untested, written on paper), this can be simplified / optimized as per needs 😃
|
🚀 The feature
The current default white color looks bad. Maybe we can generate colors from palette as we do in drawing masks?
Motivation, pitch
It should be simple tweak to
_generate_color_palette
to pass num_boxes and get a List of RGB values. Instead of List[Tensor]. The fix is simple and that can be passed to get RGB colors.Alternatives
Users can anyway use
color="white"
to get white boxes.Additional context
It's simple issue and good-first. We can probably wait for some new contributor 😃 to join.
The text was updated successfully, but these errors were encountered: