Skip to content

Commit

Permalink
refactor: ♻️ update Edges type from List to Tuple for better performance
Browse files Browse the repository at this point in the history
Signed-off-by: Onuralp SEZER <[email protected]>
  • Loading branch information
onuralpszr committed Sep 19, 2024
1 parent 1f0c278 commit 9c4a07c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions supervision/keypoint/skeletons.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from enum import Enum
from typing import ClassVar, Dict, List, Tuple
from typing import ClassVar, Dict, Tuple

Edges = List[Tuple[int, int]]
Edges = Tuple[Tuple[int, int], ...]


class Skeleton(Enum):
COCO: ClassVar[List[Tuple[int, int]]] = [
COCO: ClassVar[Edges] = (
(1, 2),
(1, 3),
(2, 3),
Expand All @@ -23,9 +23,9 @@ class Skeleton(Enum):
(15, 13),
(16, 14),
(17, 15),
]
)

GHUM: ClassVar[List[Tuple[int, int]]] = [
GHUM: ClassVar[Edges] = (
(1, 2),
(1, 5),
(2, 3),
Expand Down Expand Up @@ -61,9 +61,9 @@ class Skeleton(Enum):
(29, 33),
(30, 32),
(31, 33),
]
)

FACEMESH_TESSELATION_NO_IRIS: ClassVar[List[Tuple[int, int]]] = [
FACEMESH_TESSELATION_NO_IRIS: ClassVar[Edges] = (
(128, 35),
(35, 140),
(140, 128),
Expand Down Expand Up @@ -2620,9 +2620,9 @@ class Skeleton(Enum):
(340, 449),
(449, 256),
(256, 340),
]
)

FACEMESH_TESSELATION: ClassVar[List[Tuple[int, int]]] = [
FACEMESH_TESSELATION: ClassVar[Edges] = (
(474, 474),
(475, 476),
(476, 477),
Expand All @@ -2634,7 +2634,7 @@ class Skeleton(Enum):
(472, 473),
(473, 470),
*FACEMESH_TESSELATION_NO_IRIS,
]
)


SKELETONS_BY_EDGE_COUNT: Dict[int, Edges] = {}
Expand Down

0 comments on commit 9c4a07c

Please sign in to comment.