Skip to content
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

New Ultralytics Colors() Palette #3046

Merged
merged 3 commits into from
May 12, 2021
Merged

New Ultralytics Colors() Palette #3046

merged 3 commits into from
May 12, 2021

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented May 5, 2021

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Optimization of the color palette used in YOLOv5 visualizations.

πŸ“Š Key Changes

  • Switched from using matplotlib's pre-defined TABLEAU_COLORS to a custom Ultralytics color palette.
  • The custom color set is hard-coded directly into the Colors class initialization.

🎯 Purpose & Impact

  • 🏞️ Ensures a more consistent and distinctive Ultralytics branding across visual outputs.
  • 🎨 Provides a wider variety of colors, potentially improving the clarity and aesthetic of plotted data.
  • ℹ️ Users will see visualizations that feature these new, predefined colors, which could enhance readability and user experience.

@glenn-jocher
Copy link
Member Author

/rebase

@glenn-jocher glenn-jocher self-assigned this May 9, 2021
@glenn-jocher glenn-jocher added the enhancement New feature or request label May 9, 2021
@glenn-jocher glenn-jocher merged commit 52c0570 into master May 12, 2021
@glenn-jocher glenn-jocher deleted the Colors branch May 12, 2021 15:41
@glenn-jocher
Copy link
Member Author

glenn-jocher commented May 12, 2021

@SergioSanchezMontesUAM @kalenmike @SkalskiP we have our new official Ultralytics Color Palette by Alex now ⭐!! You can start implementing this palette in our website and app. There are 20 colors (for classes 0-19) which are restarted once they are cycled through, i.e. classes 0, 20, 40 use the same color, as do classes 5, 65, 305, etc.

Screenshot 2021-05-12 at 17 38 29

class Colors:
    # Ultralytics color palette https://ultralytics.com/
    def __init__(self):
        self.palette = [self.hex2rgb(c) for c in matplotlib.colors.TABLEAU_COLORS.values()]
        # hex = matplotlib.colors.TABLEAU_COLORS.values()
        hex = ('FF3838', 'FF9D97', 'FF701F', 'FFB21D', 'CFD231', '48F90A', '92CC17', '3DDB86', '1A9334', '00D4BB',
               '2C99A8', '00C2FF', '344593', '6473FF', '0018EC', '8438FF', '520085', 'CB38FF', 'FF95C8', 'FF37C7')
        self.palette = [self.hex2rgb('#' + c) for c in hex]
        self.n = len(self.palette)

    def __call__(self, i, bgr=False):

The full list in RGB is here:

colors.palette
Out[2]: 
[(255, 56, 56),
 (255, 157, 151),
 (255, 112, 31),
 (255, 178, 29),
 (207, 210, 49),
 (72, 249, 10),
 (146, 204, 23),
 (61, 219, 134),
 (26, 147, 52),
 (0, 212, 187),
 (44, 153, 168),
 (0, 194, 255),
 (52, 69, 147),
 (100, 115, 255),
 (0, 24, 236),
 (132, 56, 255),
 (82, 0, 133),
 (203, 56, 255),
 (255, 149, 200),
 (255, 55, 199)]

@glenn-jocher glenn-jocher changed the title Update Colors() New Ultralytics Colors() Palette May 12, 2021
Lechtr pushed a commit to Lechtr/yolov5 that referenced this pull request Jul 20, 2021
* Update Colors()

* update colors

* update colors

(cherry picked from commit 52c0570)
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
* Update Colors()

* update colors

* update colors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant