From a34f0e95973560d9b2fcd2b318fd6ca652cf0e6a Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Thu, 19 Sep 2024 20:30:43 +0300 Subject: [PATCH] =?UTF-8?q?refactor:=20=E2=99=BB=EF=B8=8F=20update=20Edges?= =?UTF-8?q?=20type=20from=20List=20to=20Tuple=20for=20better=20performance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Onuralp SEZER --- supervision/keypoint/skeletons.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/supervision/keypoint/skeletons.py b/supervision/keypoint/skeletons.py index e1bd613a..a5ac7b3a 100644 --- a/supervision/keypoint/skeletons.py +++ b/supervision/keypoint/skeletons.py @@ -1,11 +1,11 @@ from enum import Enum -from typing import ClassVar, Dict, List, Tuple +from typing import Dict, Tuple -Edges = List[Tuple[int, int]] +Edges = Tuple[Tuple[int, int], ...] class Skeleton(Enum): - COCO: ClassVar[List[Tuple[int, int]]] = [ + COCO: Edges = ( (1, 2), (1, 3), (2, 3), @@ -23,9 +23,9 @@ class Skeleton(Enum): (15, 13), (16, 14), (17, 15), - ] + ) - GHUM: ClassVar[List[Tuple[int, int]]] = [ + GHUM: Edges = ( (1, 2), (1, 5), (2, 3), @@ -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: Edges = ( (128, 35), (35, 140), (140, 128), @@ -2620,9 +2620,9 @@ class Skeleton(Enum): (340, 449), (449, 256), (256, 340), - ] + ) - FACEMESH_TESSELATION: ClassVar[List[Tuple[int, int]]] = [ + FACEMESH_TESSELATION: Edges = ( (474, 474), (475, 476), (476, 477), @@ -2634,7 +2634,7 @@ class Skeleton(Enum): (472, 473), (473, 470), *FACEMESH_TESSELATION_NO_IRIS, - ] + ) SKELETONS_BY_EDGE_COUNT: Dict[int, Edges] = {}