diff --git a/supervision/detection/line_zone.py b/supervision/detection/line_zone.py index 313b0503..aaa8eec6 100644 --- a/supervision/detection/line_zone.py +++ b/supervision/detection/line_zone.py @@ -1,3 +1,4 @@ +from functools import lru_cache import math import warnings from typing import Any, Dict, Iterable, Tuple @@ -452,6 +453,7 @@ class LineZoneAnnotator: return frame @staticmethod + @lru_cache(maxsize=32) def _make_count_label_image( text: str, *, diff --git a/supervision/draw/color.py b/supervision/draw/color.py index 8e99ac6c..4422bcb8 100644 --- a/supervision/draw/color.py +++ b/supervision/draw/color.py @@ -254,6 +254,12 @@ class Color: @classproperty def ROBOFLOW(cls) -> Color: return Color.from_hex("#A351FB") + + def __hash__(self): + return hash((self.r, self.g, self.b)) + + def __eq__(self, other): + return isinstance(other, Color) and self.r == other.r and self.g == other.g and self.b == other.b @dataclass