Make color hashable, use cache for label images
This commit is contained in:
1 parent
60c5292781
commit
6fbabeefff
2 files changed
+8
No files matched your search
@@ -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,
|
||||
*,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user