forked from TreB1eN/Pytorch0.4.1_Openpose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entity.py
executable file
·163 lines (155 loc) · 4.8 KB
/
entity.py
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
from enum import IntEnum
from models.CocoPoseNet import CocoPoseNet
from models.FaceNet import FaceNet
from models.HandNet import HandNet
from pathlib import Path
class JointType(IntEnum):
"""関節の種類を表す """
Nose = 0
""" 鼻 """
Neck = 1
""" 首 """
RightShoulder = 2
""" 右肩 """
RightElbow = 3
""" 右肘 """
RightHand = 4
""" 右手 """
LeftShoulder = 5
""" 左肩 """
LeftElbow = 6
""" 左肘 """
LeftHand = 7
""" 左手 """
RightWaist = 8
""" 右腰 """
RightKnee = 9
""" 右膝 """
RightFoot = 10
""" 右足 """
LeftWaist = 11
""" 左腰 """
LeftKnee = 12
""" 左膝 """
LeftFoot = 13
""" 左足 """
RightEye = 14
""" 右目 """
LeftEye = 15
""" 左目 """
RightEar = 16
""" 右耳 """
LeftEar = 17
""" 左耳 """
params = {
'coco_dir': 'coco2017',
'archs': {
'posenet': CocoPoseNet,
'facenet': FaceNet,
'handnet': HandNet,
},
'pretrained_path' : 'models/pretrained_vgg_base.pth',
# training params
'min_keypoints': 5,
'min_area': 32 * 32,
'insize': 368,
'downscale': 8,
'paf_sigma': 8,
'heatmap_sigma': 7,
'batch_size': 10,
'lr': 1e-4,
'num_workers': 2,
'eva_num': 100,
'board_loss_interval': 100,
'eval_interval': 4,
'board_pred_image_interval': 2,
'save_interval': 2,
'log_path': 'work_space/log',
'work_space': Path('work_space'),
'min_box_size': 64,
'max_box_size': 512,
'min_scale': 0.5,
'max_scale': 2.0,
'max_rotate_degree': 40,
'center_perterb_max': 40,
# inference params
'inference_img_size': 368,
'inference_scales': [0.5, 1, 1.5, 2],
# 'inference_scales': [1.0],
'heatmap_size': 320,
'gaussian_sigma': 2.5,
'ksize': 17,
'n_integ_points': 10,
'n_integ_points_thresh': 8,
'heatmap_peak_thresh': 0.05,
'inner_product_thresh': 0.05,
'limb_length_ratio': 1.0,
'length_penalty_value': 1,
'n_subset_limbs_thresh': 3,
'subset_score_thresh': 0.2,
'limbs_point': [
[JointType.Neck, JointType.RightWaist],
[JointType.RightWaist, JointType.RightKnee],
[JointType.RightKnee, JointType.RightFoot],
[JointType.Neck, JointType.LeftWaist],
[JointType.LeftWaist, JointType.LeftKnee],
[JointType.LeftKnee, JointType.LeftFoot],
[JointType.Neck, JointType.RightShoulder],
[JointType.RightShoulder, JointType.RightElbow],
[JointType.RightElbow, JointType.RightHand],
[JointType.RightShoulder, JointType.RightEar],
[JointType.Neck, JointType.LeftShoulder],
[JointType.LeftShoulder, JointType.LeftElbow],
[JointType.LeftElbow, JointType.LeftHand],
[JointType.LeftShoulder, JointType.LeftEar],
[JointType.Neck, JointType.Nose],
[JointType.Nose, JointType.RightEye],
[JointType.Nose, JointType.LeftEye],
[JointType.RightEye, JointType.RightEar],
[JointType.LeftEye, JointType.LeftEar]
],
'coco_joint_indices': [
JointType.Nose,
JointType.LeftEye,
JointType.RightEye,
JointType.LeftEar,
JointType.RightEar,
JointType.LeftShoulder,
JointType.RightShoulder,
JointType.LeftElbow,
JointType.RightElbow,
JointType.LeftHand,
JointType.RightHand,
JointType.LeftWaist,
JointType.RightWaist,
JointType.LeftKnee,
JointType.RightKnee,
JointType.LeftFoot,
JointType.RightFoot
],
# face params
'face_inference_img_size': 368,
'face_heatmap_peak_thresh': 0.1,
'face_crop_scale': 1.5,
'face_line_indices': [
[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], # 輪郭
[17, 18], [18, 19], [19, 20], [20, 21], # 右眉
[22, 23], [23, 24], [24, 25], [25, 26], # 左眉
[27, 28], [28, 29], [29, 30], # 鼻
[31, 32], [32, 33], [33, 34], [34, 35], # 鼻下の横線
[36, 37], [37, 38], [38, 39], [39, 40], [40, 41], [41, 36], # 右目
[42, 43], [43, 44], [44, 45], [45, 46], [46, 47], [47, 42], # 左目
[48, 49], [49, 50], [50, 51], [51, 52], [52, 53], [53, 54], [54, 55], [55, 56], [56, 57], [57, 58], [58, 59], [59, 48], # 唇外輪
[60, 61], [61, 62], [62, 63], [63, 64], [64, 65], [65, 66], [66, 67], [67, 60] # 唇内輪
],
# hand params
'hand_inference_img_size': 368,
'hand_heatmap_peak_thresh': 0.1,
'fingers_indices': [
[[0, 1], [1, 2], [2, 3], [3, 4]],
[[0, 5], [5, 6], [6, 7], [7, 8]],
[[0, 9], [9, 10], [10, 11], [11, 12]],
[[0, 13], [13, 14], [14, 15], [15, 16]],
[[0, 17], [17, 18], [18, 19], [19, 20]],
],
}