ultralytics 8.2.36 update Ultralytics color palette (#13808)
Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
f151c8d686
commit
c6646830ed
2 changed files with 48 additions and 21 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
||||
|
||||
__version__ = "8.2.35"
|
||||
__version__ = "8.2.36"
|
||||
|
||||
import os
|
||||
|
||||
|
|
|
|||
|
|
@ -33,26 +33,26 @@ class Colors:
|
|||
def __init__(self):
|
||||
"""Initialize colors as hex = matplotlib.colors.TABLEAU_COLORS.values()."""
|
||||
hexs = (
|
||||
"FF3838",
|
||||
"FF9D97",
|
||||
"FF701F",
|
||||
"FFB21D",
|
||||
"CFD231",
|
||||
"48F90A",
|
||||
"92CC17",
|
||||
"3DDB86",
|
||||
"1A9334",
|
||||
"00D4BB",
|
||||
"2C99A8",
|
||||
"00C2FF",
|
||||
"344593",
|
||||
"6473FF",
|
||||
"0018EC",
|
||||
"8438FF",
|
||||
"520085",
|
||||
"CB38FF",
|
||||
"FF95C8",
|
||||
"FF37C7",
|
||||
"042AFF",
|
||||
"0BDBEB",
|
||||
"F3F3F3",
|
||||
"00DFB7",
|
||||
"111F68",
|
||||
"FF6FDD",
|
||||
"FF444F",
|
||||
"CCED00",
|
||||
"00F344",
|
||||
"BD00FF",
|
||||
"00B4FF",
|
||||
"DD00BA",
|
||||
"00FFFF",
|
||||
"26C000",
|
||||
"01FFB3",
|
||||
"7D24FF",
|
||||
"7B0068",
|
||||
"FF1B6C",
|
||||
"FC6D2F",
|
||||
"A2FF0B",
|
||||
)
|
||||
self.palette = [self.hex2rgb(f"#{c}") for c in hexs]
|
||||
self.n = len(self.palette)
|
||||
|
|
@ -158,9 +158,36 @@ class Annotator:
|
|||
|
||||
self.limb_color = colors.pose_palette[[9, 9, 9, 9, 7, 7, 7, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16]]
|
||||
self.kpt_color = colors.pose_palette[[16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9]]
|
||||
self.dark_colors = {
|
||||
(235, 219, 11),
|
||||
(243, 243, 243),
|
||||
(183, 223, 0),
|
||||
(221, 111, 255),
|
||||
(0, 237, 204),
|
||||
(68, 243, 0),
|
||||
(255, 255, 0),
|
||||
(179, 255, 1),
|
||||
(11, 255, 162),
|
||||
}
|
||||
self.light_colors = {
|
||||
(255, 42, 4),
|
||||
(79, 68, 255),
|
||||
(255, 0, 189),
|
||||
(255, 180, 0),
|
||||
(186, 0, 221),
|
||||
(0, 192, 38),
|
||||
(255, 36, 125),
|
||||
(104, 0, 123),
|
||||
(108, 27, 255),
|
||||
(47, 109, 252),
|
||||
(104, 31, 17),
|
||||
}
|
||||
|
||||
def box_label(self, box, label="", color=(128, 128, 128), txt_color=(255, 255, 255), rotated=False):
|
||||
"""Add one xyxy box to image with label."""
|
||||
txt_color = (
|
||||
(104, 31, 17) if color in self.dark_colors else (255, 255, 255) if color in self.light_colors else txt_color
|
||||
)
|
||||
if isinstance(box, torch.Tensor):
|
||||
box = box.tolist()
|
||||
if self.pil or not is_ascii(label):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue