每个类别的检测框都统一改成红色
class Colors:
"""
Ultralytics default color palette https://ultralytics.com/.
This class provides methods to work with the Ultralytics color palette, including converting hex color codes to
RGB values.
Attributes:
palette (list of tuple): List of RGB color values.
n (int): The number of colors in the palette.
pose_palette (np.ndarray): A specific color palette array with dtype np.uint8.
"""
def __init__(self):
"""Initialize colors as hex = matplotlib.colors.TABLEAU_COLORS.values()."""
# hexs = (
# "042AFF",
# "0BDBEB",
# "F3F3F3",
# "00DFB7",
# "111F68",
# "FF6FDD",
# "FF444F",
# "CCED00",
# "00F344",
# "BD00FF",
# "00B4FF",
# "DD00BA",
# "00FFFF",
# "26C000",
# "01FFB3",
# "7D24FF",
# "7B0068",
# "FF1B6C",
# "FC6D2F",
# "A2FF0B",
# )
#原本的hexs注释,改成下面的
hexs=('ff0000',
'ff0000',
'ff0000',
'ff0000',
'ff0000',
'ff0000',
'ff0000',
'ff0000',
'ff0000',
'ff0000',
'ff0000',
'ff0000',
'ff0000',
'ff0000',
'ff0000',
'ff0000',
'ff0000',
'ff0000',
'ff0000',
'ff0000',
)
self.palette = [self.hex2rgb(f"#{c}") for c in hexs]
self.n = len(self.palette)
# self.pose_palette = np.array(
# [
# [255, 128, 0],
# [255, 153, 51],
# [255, 178, 102],
# [230, 230, 0],
# [255, 153, 255],
# [153, 204, 255],
# [255, 102, 255],
# [255, 51, 255],
# [102, 178, 255],
# [51, 153, 255],
# [255, 153, 153],
# [255, 102, 102],
# [255, 51, 51],
# [153, 255, 153],
# [102, 255, 102],
# [51, 255, 51],
# [0, 255, 0],#绿色
# [0, 0, 255],
# [255, 0, 0],#红色
# [255, 255, 255],
#
# ],
# dtype=np.uint8,
# )
#把原本的注释,改成下面的
self.pose_palette = np.array(
[
[255, 0, 0],
[255, 0, 0],
[255, 0, 0],
[255, 0, 0],
[255, 0, 0],
[255, 0, 0],
[255, 0, 0],
[255, 0, 0],
[255, 0, 0],
[255, 0, 0],
[255, 0, 0],
[255, 0, 0],
[255, 0, 0],
[255, 0, 0],
[255, 0, 0],
[255, 0, 0],
[255, 0, 0],
[255, 0, 0],
[255, 0, 0],
[255, 0, 0],
],
dtype=np.uint8,
)
在ultralytics\utils\plotting.py中,找到Colors类
hexs改成ff0000
self.pose_palette改成[255,0,0]