Generate colors from random color palette in draw_bounding_boxes
See original GitHub issue🚀 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.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (9 by maintainers)
Top Results From Across the Web
How can I give bounding box color according to ... - GitHub
Look at « colors » In detect.py, its randomly generated using numpy. You can define it there as a list of rgb values...
Read more >How to create random color bounding boxes with cv2.rectangle()
To generate random BGR values you can use np.random() then insert it into cv2.rectangle() color = list(np.random.random(size=3) * 256) ...
Read more >Random Color Generator 🎨 - Pick a Color at Random
A virtual color wheel to randomly pick a color. ➤ Random color generator which outputs hex code, RGB and HSL. Supports 16.8 million...
Read more >How to create random color bounding boxes with cv2.rectangle()
The following line works: COLORS = (np.random.randint(0,255), np.random.randint(0,255), np.random.randint(0,255)) and then pass this to the cv2.rectangle ...
Read more >How to make random colors in Python - Turtle? - GeeksforGeeks
The random module is used to generate random numbers. ... It ends to fill the circle with color. penup(): It will stop drawing...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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 😃
Yes and use the colors the generated from the palette in draw_bounding_boxes. Create colors upto num_labels.
Map each label to a color.
Since labels is a list and generated color palette is also a list. Both have the same length. (As we generated colors equal to num_labels)
Use these colors to draw boxes.