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
|
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
||||||
|
|
||||||
__version__ = "8.2.35"
|
__version__ = "8.2.36"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,26 +33,26 @@ class Colors:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Initialize colors as hex = matplotlib.colors.TABLEAU_COLORS.values()."""
|
"""Initialize colors as hex = matplotlib.colors.TABLEAU_COLORS.values()."""
|
||||||
hexs = (
|
hexs = (
|
||||||
"FF3838",
|
"042AFF",
|
||||||
"FF9D97",
|
"0BDBEB",
|
||||||
"FF701F",
|
"F3F3F3",
|
||||||
"FFB21D",
|
"00DFB7",
|
||||||
"CFD231",
|
"111F68",
|
||||||
"48F90A",
|
"FF6FDD",
|
||||||
"92CC17",
|
"FF444F",
|
||||||
"3DDB86",
|
"CCED00",
|
||||||
"1A9334",
|
"00F344",
|
||||||
"00D4BB",
|
"BD00FF",
|
||||||
"2C99A8",
|
"00B4FF",
|
||||||
"00C2FF",
|
"DD00BA",
|
||||||
"344593",
|
"00FFFF",
|
||||||
"6473FF",
|
"26C000",
|
||||||
"0018EC",
|
"01FFB3",
|
||||||
"8438FF",
|
"7D24FF",
|
||||||
"520085",
|
"7B0068",
|
||||||
"CB38FF",
|
"FF1B6C",
|
||||||
"FF95C8",
|
"FC6D2F",
|
||||||
"FF37C7",
|
"A2FF0B",
|
||||||
)
|
)
|
||||||
self.palette = [self.hex2rgb(f"#{c}") for c in hexs]
|
self.palette = [self.hex2rgb(f"#{c}") for c in hexs]
|
||||||
self.n = len(self.palette)
|
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.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.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):
|
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."""
|
"""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):
|
if isinstance(box, torch.Tensor):
|
||||||
box = box.tolist()
|
box = box.tolist()
|
||||||
if self.pil or not is_ascii(label):
|
if self.pil or not is_ascii(label):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue