File size: 2,026 Bytes
2680bd5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import numpy as np
import pathlib

GEMINI_API_KEY = 'YOUR_GEMINI_API_KEY'
DEEPSEEK_API_KEY = "YOUR_DEEPSEEK_API_KEY"
OPENAI_API_KEY = "YOUR_OPENAI_API_KEY"

JOINT_NAME_INDEX_MAP = {
    'wrist': 0,
    'thumb_cmc': 13, 'thumb_mcp': 14, 'thumb_ip': 15, 'thumb_tip': 16,
    'index_mcp': 1, 'index_pip': 2, 'index_dip': 3, 'index_tip': 17,
    'middle_mcp': 4, 'middle_pip': 5, 'middle_dip': 6, 'middle_tip': 18,
    'ring_mcp': 10, 'ring_pip': 11, 'ring_dip': 12, 'ring_tip': 19,
    'pinky_mcp': 7, 'pinky_pip': 8, 'pinky_dip': 9, 'pinky_tip': 20,
}
JOINT_INDEX_NAME_MAP = {v: k for k, v in JOINT_NAME_INDEX_MAP.items() }
SKELETON_CHAIN = np.array([
    [0, 13, 14, 15, 16],
    [0, 1, 2, 3, 17],
    [0, 4, 5, 6, 18],
    [0, 10, 11, 12, 19],
    [0, 7, 8, 9, 20]
])
SKELETON_CHAIN_NAME = ['thumb', 'index', 'middle', 'ring', 'pinky']

MANO_MODEL_DIR = pathlib.Path(__file__).parent.parent / "body_models" / "mano"

TEXT_MODEL_DIMS = {
    't5-small': 512,
    "t5-base": 768,
    "t5-large": 1024,
    "openai/clip-vit-base-patch32": 512
}

gesture_list = [
    "Pinch-Fingers",
    "Freestyle",
    "Palm-Touch",
    "Object-Interact",
    "Flip-Hands",
    "Two-Hand-Interact",
    "Phone-Interact",
    "Almost-Pinch-25mm",
    "Grab-Drag",
    "Almost-Pinch-10mm",
    "G-Pinch",
    "Hyperextension",
    "Bend-Palm",
    "Pinch-Index",
    "Write-Text",
    "Index-Slider",
    "Permanent-Pinch",
    "C-Pinch",
    "Hoverbeats",
    "Palm-Bend",
    "Flip-Hands-Fingers",
    "Almost-Pinch-Fingers",
    "Open-Hands",
    "Pinch-Drag",
    "Permanent-Almost-Pinch",
    "Almost-Palm-Touch",
    "Hoverbeat",
    "Close-Up",
    "Counting",
    "Object-Interact-Tag",
    "Pointing",
    "Pointing-Index",
    "Almost-Pinch-20mm",
    "Almost-Pinch-Index",
    "Fist",
    "Permanent-Almost-Pinch-Index",
    "Rub-Fingers",
    "Rubbing-Fingers",
    "Wanding",
    "Grasp-Drag",
    "Hyperextention",
    "Open-Hand",
]

INTRA_TIP_CONTACT_THRESH = 0.02
TIP_PALM_CONTACT_THRESH = 0.025
PALM_PALM_CONTACT_THRESH = 0.025