Mildclimate commited on
Commit
e331440
·
verified ·
1 Parent(s): 924f47e

upload media_pipe module

Browse files
media_pipe/__init__.py ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import cv2
3
+ import numpy as np
4
+
5
+ from .mp_utils import LMKExtractor
6
+ from .draw_util import FaceMeshVisualizer
7
+ from .pose_util import project_points_with_trans, matrix_to_euler_and_translation, euler_and_translation_to_matrix
8
+
9
+
10
+ class FaceMeshDetector:
11
+ """
12
+ Class for face mesh detection and landmark extraction.
13
+ """
14
+ def __init__(self) -> None:
15
+ self.lmk_extractor = LMKExtractor()
16
+ self.vis = FaceMeshVisualizer(forehead_edge=False, iris_edge=False, iris_point=True)
17
+
18
+ def __call__(self, image: np.array):
19
+ frame_bgr = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR)
20
+ try:
21
+ face_result = self.lmk_extractor(frame_bgr)
22
+ face_result['width'] = frame_bgr.shape[1]
23
+ face_result['height'] = frame_bgr.shape[0]
24
+ except:
25
+ face_result = None
26
+
27
+ if face_result is None:
28
+ return np.zeros_like(frame_bgr), None
29
+
30
+ lmks = face_result['lmks'].astype(np.float32)
31
+ motion = self.vis.draw_landmarks((frame_bgr.shape[1], frame_bgr.shape[0]), lmks, normed=True)
32
+
33
+ return motion, face_result
34
+
35
+
36
+ def smooth_pose_seq(pose_seq, window_size=5):
37
+ smoothed_pose_seq = np.zeros_like(pose_seq)
38
+
39
+ for i in range(len(pose_seq)):
40
+ start = max(0, i - window_size // 2)
41
+ end = min(len(pose_seq), i + window_size // 2 + 1)
42
+ smoothed_pose_seq[i] = np.mean(pose_seq[start:end], axis=0)
43
+
44
+ return smoothed_pose_seq
45
+
46
+
47
+ class FaceMeshAlign():
48
+
49
+ def __init__(self):
50
+ self.vis = FaceMeshVisualizer(forehead_edge=False, iris_edge=False, iris_point=True)
51
+
52
+ def _scale_iris(self, lmks, verts):
53
+ r_iris_ids = [468, 469, 470, 471, 472]
54
+ l_iris_ids = [473, 474, 475, 476, 477]
55
+ r_eye_ids = [33,7,163,144,145,153,154,155,246,161,160,159,158,157,173,133]
56
+ l_eye_ids = [249,390,373,374,380,381,382,362,466,388,387,386,385,384,398,263]
57
+
58
+ def scale_iris(iris_ids, eye_ids):
59
+ iris_lmks, eye_lmks, eye_verts = lmks[iris_ids], lmks[eye_ids], verts[eye_ids]
60
+ x0, y0, x1, y1 = np.min(eye_lmks[:, 0]), np.min(eye_lmks[:, 1]), np.max(eye_lmks[:, 0]), np.max(eye_lmks[:, 1])
61
+ iris_lmks[:, 0] = (iris_lmks[:, 0] - x0) / (x1 - x0)
62
+ iris_lmks[:, 1] = (iris_lmks[:, 1] - y0) / (y1 - y0)
63
+
64
+ iris_verts = np.zeros((5, 2))
65
+ x0, y0, x1, y1 = np.min(eye_verts[:, 0]), np.min(eye_verts[:, 1]), np.max(eye_verts[:, 0]), np.max(eye_verts[:, 1])
66
+ iris_verts[:, 0] = iris_lmks[:, 0] * (x1 - x0) + x0
67
+ iris_verts[:, 1] = iris_lmks[:, 1] * (y1 - y0) + y0
68
+
69
+ return iris_verts
70
+
71
+ r_iris_verts = scale_iris(r_iris_ids, r_eye_ids)
72
+ l_iris_verts = scale_iris(l_iris_ids, l_eye_ids)
73
+ verts = np.vstack((verts, r_iris_verts, l_iris_verts))
74
+ return verts
75
+
76
+ def __call__(self, ref_result, temp_results):
77
+ width, height = ref_result['width'], ref_result['height']
78
+ # prepare template data
79
+ trans_mat_arr = np.array([x['trans_mat'] for x in temp_results])
80
+ verts_arr = np.array([x['lmks3d'] for x in temp_results])
81
+ bs_arr = np.array([x['bs'] for x in temp_results])
82
+ min_bs_idx = np.argmin(bs_arr.sum(1))
83
+
84
+ # compute delta pose
85
+ pose_arr = np.zeros([trans_mat_arr.shape[0], 6])
86
+
87
+ for i in range(pose_arr.shape[0]):
88
+ euler_angles, translation_vector = matrix_to_euler_and_translation(trans_mat_arr[i]) # real pose of source
89
+ pose_arr[i, :3] = euler_angles
90
+ pose_arr[i, 3:6] = translation_vector
91
+
92
+ init_tran_vec = ref_result['trans_mat'][:3, 3] # init translation of tgt
93
+ pose_arr[:, 3:6] = pose_arr[:, 3:6] - pose_arr[0, 3:6] + init_tran_vec # (relative translation of source) + (init translation of tgt)
94
+
95
+ pose_arr_smooth = smooth_pose_seq(pose_arr, window_size=1)
96
+ pose_mat_smooth = [euler_and_translation_to_matrix(pose_arr_smooth[i][:3], pose_arr_smooth[i][3:6]) for i in range(pose_arr_smooth.shape[0])]
97
+ pose_mat_smooth = np.array(pose_mat_smooth)
98
+
99
+ # face retarget
100
+ verts_arr = verts_arr - verts_arr[min_bs_idx] + ref_result['lmks3d']
101
+ # project 3D mesh to 2D landmark
102
+ projected_vertices = project_points_with_trans(verts_arr, pose_mat_smooth, [height, width])
103
+
104
+ pose_list = []
105
+ for i, verts in enumerate(projected_vertices):
106
+ verts = self._scale_iris(temp_results[i]['lmks'], verts)
107
+ lmk_img = self.vis.draw_landmarks((width, height), verts, normed=False)
108
+ pose_list.append(lmk_img)
109
+ pose_list = np.array(pose_list)[1:]
110
+
111
+ return pose_list
media_pipe/draw_util.py ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import mediapipe as mp
3
+ import numpy as np
4
+ from mediapipe.framework.formats import landmark_pb2
5
+
6
+ class FaceMeshVisualizer:
7
+ def __init__(self, forehead_edge=False, iris_edge=False, iris_point=False):
8
+ self.mp_drawing = mp.solutions.drawing_utils
9
+ mp_face_mesh = mp.solutions.face_mesh
10
+ self.mp_face_mesh = mp_face_mesh
11
+ self.forehead_edge = forehead_edge
12
+
13
+ DrawingSpec = mp.solutions.drawing_styles.DrawingSpec
14
+ f_thick = 1
15
+ f_rad = 1
16
+ right_iris_draw = DrawingSpec(color=(10, 200, 250), thickness=f_thick, circle_radius=f_rad)
17
+ right_eye_draw = DrawingSpec(color=(10, 200, 180), thickness=f_thick, circle_radius=f_rad)
18
+ right_eyebrow_draw = DrawingSpec(color=(10, 220, 180), thickness=f_thick, circle_radius=f_rad)
19
+ left_iris_draw = DrawingSpec(color=(250, 200, 10), thickness=f_thick, circle_radius=f_rad)
20
+ left_eye_draw = DrawingSpec(color=(180, 200, 10), thickness=f_thick, circle_radius=f_rad)
21
+ left_eyebrow_draw = DrawingSpec(color=(180, 220, 10), thickness=f_thick, circle_radius=f_rad)
22
+ # head_draw = DrawingSpec(color=(10, 200, 10), thickness=f_thick, circle_radius=f_rad)
23
+ head_draw = DrawingSpec(color=(0, 0, 0), thickness=f_thick, circle_radius=f_rad)
24
+
25
+ mouth_draw_obl = DrawingSpec(color=(10, 180, 20), thickness=f_thick, circle_radius=f_rad)
26
+ mouth_draw_obr = DrawingSpec(color=(20, 10, 180), thickness=f_thick, circle_radius=f_rad)
27
+
28
+ mouth_draw_ibl = DrawingSpec(color=(100, 100, 30), thickness=f_thick, circle_radius=f_rad)
29
+ mouth_draw_ibr = DrawingSpec(color=(100, 150, 50), thickness=f_thick, circle_radius=f_rad)
30
+
31
+ mouth_draw_otl = DrawingSpec(color=(20, 80, 100), thickness=f_thick, circle_radius=f_rad)
32
+ mouth_draw_otr = DrawingSpec(color=(80, 100, 20), thickness=f_thick, circle_radius=f_rad)
33
+
34
+ mouth_draw_itl = DrawingSpec(color=(120, 100, 200), thickness=f_thick, circle_radius=f_rad)
35
+ mouth_draw_itr = DrawingSpec(color=(150 ,120, 100), thickness=f_thick, circle_radius=f_rad)
36
+
37
+ FACEMESH_LIPS_OUTER_BOTTOM_LEFT = [(61,146),(146,91),(91,181),(181,84),(84,17)]
38
+ FACEMESH_LIPS_OUTER_BOTTOM_RIGHT = [(17,314),(314,405),(405,321),(321,375),(375,291)]
39
+
40
+ FACEMESH_LIPS_INNER_BOTTOM_LEFT = [(78,95),(95,88),(88,178),(178,87),(87,14)]
41
+ FACEMESH_LIPS_INNER_BOTTOM_RIGHT = [(14,317),(317,402),(402,318),(318,324),(324,308)]
42
+
43
+ FACEMESH_LIPS_OUTER_TOP_LEFT = [(61,185),(185,40),(40,39),(39,37),(37,0)]
44
+ FACEMESH_LIPS_OUTER_TOP_RIGHT = [(0,267),(267,269),(269,270),(270,409),(409,291)]
45
+
46
+ FACEMESH_LIPS_INNER_TOP_LEFT = [(78,191),(191,80),(80,81),(81,82),(82,13)]
47
+ FACEMESH_LIPS_INNER_TOP_RIGHT = [(13,312),(312,311),(311,310),(310,415),(415,308)]
48
+
49
+ FACEMESH_CUSTOM_FACE_OVAL = [(176, 149), (150, 136), (356, 454), (58, 132), (152, 148), (361, 288), (251, 389), (132, 93), (389, 356), (400, 377), (136, 172), (377, 152), (323, 361), (172, 58), (454, 323), (365, 379), (379, 378), (148, 176), (93, 234), (397, 365), (149, 150), (288, 397), (234, 127), (378, 400), (127, 162), (162, 21)]
50
+
51
+ # mp_face_mesh.FACEMESH_CONTOURS has all the items we care about.
52
+ face_connection_spec = {}
53
+ if self.forehead_edge:
54
+ for edge in mp_face_mesh.FACEMESH_FACE_OVAL:
55
+ face_connection_spec[edge] = head_draw
56
+ else:
57
+ for edge in FACEMESH_CUSTOM_FACE_OVAL:
58
+ face_connection_spec[edge] = head_draw
59
+ for edge in mp_face_mesh.FACEMESH_LEFT_EYE:
60
+ face_connection_spec[edge] = left_eye_draw
61
+ for edge in mp_face_mesh.FACEMESH_LEFT_EYEBROW:
62
+ face_connection_spec[edge] = left_eyebrow_draw
63
+ for edge in mp_face_mesh.FACEMESH_RIGHT_EYE:
64
+ face_connection_spec[edge] = right_eye_draw
65
+ for edge in mp_face_mesh.FACEMESH_RIGHT_EYEBROW:
66
+ face_connection_spec[edge] = right_eyebrow_draw
67
+ if iris_edge:
68
+ for edge in mp_face_mesh.FACEMESH_LEFT_IRIS:
69
+ face_connection_spec[edge] = left_iris_draw
70
+ for edge in mp_face_mesh.FACEMESH_RIGHT_IRIS:
71
+ face_connection_spec[edge] = right_iris_draw
72
+ # for edge in mp_face_mesh.FACEMESH_LIPS:
73
+ # face_connection_spec[edge] = mouth_draw
74
+
75
+ # for edge in FACEMESH_LIPS_OUTER_BOTTOM_LEFT:
76
+ # face_connection_spec[edge] = mouth_draw_obl
77
+ # for edge in FACEMESH_LIPS_OUTER_BOTTOM_RIGHT:
78
+ # face_connection_spec[edge] = mouth_draw_obr
79
+ for edge in FACEMESH_LIPS_INNER_BOTTOM_LEFT:
80
+ face_connection_spec[edge] = mouth_draw_ibl
81
+ for edge in FACEMESH_LIPS_INNER_BOTTOM_RIGHT:
82
+ face_connection_spec[edge] = mouth_draw_ibr
83
+ # for edge in FACEMESH_LIPS_OUTER_TOP_LEFT:
84
+ # face_connection_spec[edge] = mouth_draw_otl
85
+ # for edge in FACEMESH_LIPS_OUTER_TOP_RIGHT:
86
+ # face_connection_spec[edge] = mouth_draw_otr
87
+ for edge in FACEMESH_LIPS_INNER_TOP_LEFT:
88
+ face_connection_spec[edge] = mouth_draw_itl
89
+ for edge in FACEMESH_LIPS_INNER_TOP_RIGHT:
90
+ face_connection_spec[edge] = mouth_draw_itr
91
+
92
+ self.iris_point = iris_point
93
+
94
+ self.face_connection_spec = face_connection_spec
95
+
96
+ def draw_pupils(self, image, landmark_list, drawing_spec, halfwidth: int = 2):
97
+ """We have a custom function to draw the pupils because the mp.draw_landmarks method requires a parameter for all
98
+ landmarks. Until our PR is merged into mediapipe, we need this separate method."""
99
+ if len(image.shape) != 3:
100
+ raise ValueError("Input image must be H,W,C.")
101
+ image_rows, image_cols, image_channels = image.shape
102
+ if image_channels != 3: # BGR channels
103
+ raise ValueError('Input image must contain three channel bgr data.')
104
+ for idx, landmark in enumerate(landmark_list.landmark):
105
+ if (
106
+ (landmark.HasField('visibility') and landmark.visibility < 0.9) or
107
+ (landmark.HasField('presence') and landmark.presence < 0.5)
108
+ ):
109
+ continue
110
+ if landmark.x >= 1.0 or landmark.x < 0 or landmark.y >= 1.0 or landmark.y < 0:
111
+ continue
112
+ image_x = int(image_cols*landmark.x)
113
+ image_y = int(image_rows*landmark.y)
114
+ draw_color = None
115
+ if isinstance(drawing_spec, Mapping):
116
+ if drawing_spec.get(idx) is None:
117
+ continue
118
+ else:
119
+ draw_color = drawing_spec[idx].color
120
+ elif isinstance(drawing_spec, DrawingSpec):
121
+ draw_color = drawing_spec.color
122
+ image[image_y-halfwidth:image_y+halfwidth, image_x-halfwidth:image_x+halfwidth, :] = draw_color
123
+
124
+ def draw_iris_points(self, image, point_list, halfwidth=2, normed=False):
125
+ color = (255, 0, 0)
126
+ for point in point_list:
127
+ if normed:
128
+ x, y = int(point[0] * image.shape[1]), int(point[1] * image.shape[0])
129
+ else:
130
+ x, y = int(point[0]), int(point[1])
131
+ image[y-halfwidth:y+halfwidth, x-halfwidth:x+halfwidth, :] = color
132
+ return image
133
+
134
+ def draw_landmarks(self, image_size, keypoints, normed=False):
135
+ ini_size = image_size #[512, 512]
136
+ image = np.zeros([ini_size[1], ini_size[0], 3], dtype=np.uint8)
137
+ new_landmarks = landmark_pb2.NormalizedLandmarkList()
138
+ for i in range(keypoints.shape[0]):
139
+ landmark = new_landmarks.landmark.add()
140
+ if normed:
141
+ landmark.x = keypoints[i, 0]
142
+ landmark.y = keypoints[i, 1]
143
+ else:
144
+ landmark.x = keypoints[i, 0] / image_size[0]
145
+ landmark.y = keypoints[i, 1] / image_size[1]
146
+ landmark.z = 1.0
147
+
148
+ self.mp_drawing.draw_landmarks(
149
+ image=image,
150
+ landmark_list=new_landmarks,
151
+ connections=self.face_connection_spec.keys(),
152
+ landmark_drawing_spec=None,
153
+ connection_drawing_spec=self.face_connection_spec
154
+ )
155
+
156
+ if self.iris_point:
157
+ image = self.draw_iris_points(image, [keypoints[473], keypoints[468]], halfwidth=3, normed=normed)
158
+
159
+ return image
160
+
161
+ def draw_mask(self, image_size, keypoints, normed=False):
162
+ mask = np.zeros([image_size[1], image_size[0], 3], dtype=np.uint8)
163
+ if normed:
164
+ keypoints[:, 0] *= image_size[0]
165
+ keypoints[:, 1] *= image_size[1]
166
+
167
+ head_idxs = [21, 162, 127, 234, 93, 132, 58, 172, 136, 150, 149, 176, 148, 152, 377, 400, 378, 379, 365, 397, 288, 361, 323, 454, 356, 389]
168
+ head_points = np.array(keypoints[head_idxs, :2], np.int32)
169
+
170
+ mask = cv2.fillPoly(mask, [head_points], (255, 255, 255))
171
+ mask = np.array(mask) / 255.0
172
+
173
+ return mask
media_pipe/face_landmark.py ADDED
@@ -0,0 +1,3305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2023 The MediaPipe Authors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """MediaPipe face landmarker task."""
15
+
16
+ import dataclasses
17
+ import enum
18
+ from typing import Callable, Mapping, Optional, List
19
+
20
+ import numpy as np
21
+
22
+ from mediapipe.framework.formats import classification_pb2
23
+ from mediapipe.framework.formats import landmark_pb2
24
+ from mediapipe.framework.formats import matrix_data_pb2
25
+ from mediapipe.python import packet_creator
26
+ from mediapipe.python import packet_getter
27
+ from mediapipe.python._framework_bindings import image as image_module
28
+ from mediapipe.python._framework_bindings import packet as packet_module
29
+ # pylint: disable=unused-import
30
+ from mediapipe.tasks.cc.vision.face_geometry.proto import face_geometry_pb2
31
+ # pylint: enable=unused-import
32
+ from mediapipe.tasks.cc.vision.face_landmarker.proto import face_landmarker_graph_options_pb2
33
+ from mediapipe.tasks.python.components.containers import category as category_module
34
+ from mediapipe.tasks.python.components.containers import landmark as landmark_module
35
+ from mediapipe.tasks.python.core import base_options as base_options_module
36
+ from mediapipe.tasks.python.core import task_info as task_info_module
37
+ from mediapipe.tasks.python.core.optional_dependencies import doc_controls
38
+ from mediapipe.tasks.python.vision.core import base_vision_task_api
39
+ from mediapipe.tasks.python.vision.core import image_processing_options as image_processing_options_module
40
+ from mediapipe.tasks.python.vision.core import vision_task_running_mode as running_mode_module
41
+
42
+ _BaseOptions = base_options_module.BaseOptions
43
+ _FaceLandmarkerGraphOptionsProto = (
44
+ face_landmarker_graph_options_pb2.FaceLandmarkerGraphOptions
45
+ )
46
+ _LayoutEnum = matrix_data_pb2.MatrixData.Layout
47
+ _RunningMode = running_mode_module.VisionTaskRunningMode
48
+ _ImageProcessingOptions = image_processing_options_module.ImageProcessingOptions
49
+ _TaskInfo = task_info_module.TaskInfo
50
+
51
+ _IMAGE_IN_STREAM_NAME = 'image_in'
52
+ _IMAGE_OUT_STREAM_NAME = 'image_out'
53
+ _IMAGE_TAG = 'IMAGE'
54
+ _NORM_RECT_STREAM_NAME = 'norm_rect_in'
55
+ _NORM_RECT_TAG = 'NORM_RECT'
56
+ _NORM_LANDMARKS_STREAM_NAME = 'norm_landmarks'
57
+ _NORM_LANDMARKS_TAG = 'NORM_LANDMARKS'
58
+ _BLENDSHAPES_STREAM_NAME = 'blendshapes'
59
+ _BLENDSHAPES_TAG = 'BLENDSHAPES'
60
+ _FACE_GEOMETRY_STREAM_NAME = 'face_geometry'
61
+ _FACE_GEOMETRY_TAG = 'FACE_GEOMETRY'
62
+ _TASK_GRAPH_NAME = 'mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph'
63
+ _MICRO_SECONDS_PER_MILLISECOND = 1000
64
+
65
+
66
+ class Blendshapes(enum.IntEnum):
67
+ """The 52 blendshape coefficients."""
68
+
69
+ NEUTRAL = 0
70
+ BROW_DOWN_LEFT = 1
71
+ BROW_DOWN_RIGHT = 2
72
+ BROW_INNER_UP = 3
73
+ BROW_OUTER_UP_LEFT = 4
74
+ BROW_OUTER_UP_RIGHT = 5
75
+ CHEEK_PUFF = 6
76
+ CHEEK_SQUINT_LEFT = 7
77
+ CHEEK_SQUINT_RIGHT = 8
78
+ EYE_BLINK_LEFT = 9
79
+ EYE_BLINK_RIGHT = 10
80
+ EYE_LOOK_DOWN_LEFT = 11
81
+ EYE_LOOK_DOWN_RIGHT = 12
82
+ EYE_LOOK_IN_LEFT = 13
83
+ EYE_LOOK_IN_RIGHT = 14
84
+ EYE_LOOK_OUT_LEFT = 15
85
+ EYE_LOOK_OUT_RIGHT = 16
86
+ EYE_LOOK_UP_LEFT = 17
87
+ EYE_LOOK_UP_RIGHT = 18
88
+ EYE_SQUINT_LEFT = 19
89
+ EYE_SQUINT_RIGHT = 20
90
+ EYE_WIDE_LEFT = 21
91
+ EYE_WIDE_RIGHT = 22
92
+ JAW_FORWARD = 23
93
+ JAW_LEFT = 24
94
+ JAW_OPEN = 25
95
+ JAW_RIGHT = 26
96
+ MOUTH_CLOSE = 27
97
+ MOUTH_DIMPLE_LEFT = 28
98
+ MOUTH_DIMPLE_RIGHT = 29
99
+ MOUTH_FROWN_LEFT = 30
100
+ MOUTH_FROWN_RIGHT = 31
101
+ MOUTH_FUNNEL = 32
102
+ MOUTH_LEFT = 33
103
+ MOUTH_LOWER_DOWN_LEFT = 34
104
+ MOUTH_LOWER_DOWN_RIGHT = 35
105
+ MOUTH_PRESS_LEFT = 36
106
+ MOUTH_PRESS_RIGHT = 37
107
+ MOUTH_PUCKER = 38
108
+ MOUTH_RIGHT = 39
109
+ MOUTH_ROLL_LOWER = 40
110
+ MOUTH_ROLL_UPPER = 41
111
+ MOUTH_SHRUG_LOWER = 42
112
+ MOUTH_SHRUG_UPPER = 43
113
+ MOUTH_SMILE_LEFT = 44
114
+ MOUTH_SMILE_RIGHT = 45
115
+ MOUTH_STRETCH_LEFT = 46
116
+ MOUTH_STRETCH_RIGHT = 47
117
+ MOUTH_UPPER_UP_LEFT = 48
118
+ MOUTH_UPPER_UP_RIGHT = 49
119
+ NOSE_SNEER_LEFT = 50
120
+ NOSE_SNEER_RIGHT = 51
121
+
122
+
123
+ class FaceLandmarksConnections:
124
+ """The connections between face landmarks."""
125
+
126
+ @dataclasses.dataclass
127
+ class Connection:
128
+ """The connection class for face landmarks."""
129
+
130
+ start: int
131
+ end: int
132
+
133
+ FACE_LANDMARKS_LIPS: List[Connection] = [
134
+ Connection(61, 146),
135
+ Connection(146, 91),
136
+ Connection(91, 181),
137
+ Connection(181, 84),
138
+ Connection(84, 17),
139
+ Connection(17, 314),
140
+ Connection(314, 405),
141
+ Connection(405, 321),
142
+ Connection(321, 375),
143
+ Connection(375, 291),
144
+ Connection(61, 185),
145
+ Connection(185, 40),
146
+ Connection(40, 39),
147
+ Connection(39, 37),
148
+ Connection(37, 0),
149
+ Connection(0, 267),
150
+ Connection(267, 269),
151
+ Connection(269, 270),
152
+ Connection(270, 409),
153
+ Connection(409, 291),
154
+ Connection(78, 95),
155
+ Connection(95, 88),
156
+ Connection(88, 178),
157
+ Connection(178, 87),
158
+ Connection(87, 14),
159
+ Connection(14, 317),
160
+ Connection(317, 402),
161
+ Connection(402, 318),
162
+ Connection(318, 324),
163
+ Connection(324, 308),
164
+ Connection(78, 191),
165
+ Connection(191, 80),
166
+ Connection(80, 81),
167
+ Connection(81, 82),
168
+ Connection(82, 13),
169
+ Connection(13, 312),
170
+ Connection(312, 311),
171
+ Connection(311, 310),
172
+ Connection(310, 415),
173
+ Connection(415, 308),
174
+ ]
175
+
176
+ FACE_LANDMARKS_LEFT_EYE: List[Connection] = [
177
+ Connection(263, 249),
178
+ Connection(249, 390),
179
+ Connection(390, 373),
180
+ Connection(373, 374),
181
+ Connection(374, 380),
182
+ Connection(380, 381),
183
+ Connection(381, 382),
184
+ Connection(382, 362),
185
+ Connection(263, 466),
186
+ Connection(466, 388),
187
+ Connection(388, 387),
188
+ Connection(387, 386),
189
+ Connection(386, 385),
190
+ Connection(385, 384),
191
+ Connection(384, 398),
192
+ Connection(398, 362),
193
+ ]
194
+
195
+ FACE_LANDMARKS_LEFT_EYEBROW: List[Connection] = [
196
+ Connection(276, 283),
197
+ Connection(283, 282),
198
+ Connection(282, 295),
199
+ Connection(295, 285),
200
+ Connection(300, 293),
201
+ Connection(293, 334),
202
+ Connection(334, 296),
203
+ Connection(296, 336),
204
+ ]
205
+
206
+ FACE_LANDMARKS_LEFT_IRIS: List[Connection] = [
207
+ Connection(474, 475),
208
+ Connection(475, 476),
209
+ Connection(476, 477),
210
+ Connection(477, 474),
211
+ ]
212
+
213
+ FACE_LANDMARKS_RIGHT_EYE: List[Connection] = [
214
+ Connection(33, 7),
215
+ Connection(7, 163),
216
+ Connection(163, 144),
217
+ Connection(144, 145),
218
+ Connection(145, 153),
219
+ Connection(153, 154),
220
+ Connection(154, 155),
221
+ Connection(155, 133),
222
+ Connection(33, 246),
223
+ Connection(246, 161),
224
+ Connection(161, 160),
225
+ Connection(160, 159),
226
+ Connection(159, 158),
227
+ Connection(158, 157),
228
+ Connection(157, 173),
229
+ Connection(173, 133),
230
+ ]
231
+
232
+ FACE_LANDMARKS_RIGHT_EYEBROW: List[Connection] = [
233
+ Connection(46, 53),
234
+ Connection(53, 52),
235
+ Connection(52, 65),
236
+ Connection(65, 55),
237
+ Connection(70, 63),
238
+ Connection(63, 105),
239
+ Connection(105, 66),
240
+ Connection(66, 107),
241
+ ]
242
+
243
+ FACE_LANDMARKS_RIGHT_IRIS: List[Connection] = [
244
+ Connection(469, 470),
245
+ Connection(470, 471),
246
+ Connection(471, 472),
247
+ Connection(472, 469),
248
+ ]
249
+
250
+ FACE_LANDMARKS_FACE_OVAL: List[Connection] = [
251
+ Connection(10, 338),
252
+ Connection(338, 297),
253
+ Connection(297, 332),
254
+ Connection(332, 284),
255
+ Connection(284, 251),
256
+ Connection(251, 389),
257
+ Connection(389, 356),
258
+ Connection(356, 454),
259
+ Connection(454, 323),
260
+ Connection(323, 361),
261
+ Connection(361, 288),
262
+ Connection(288, 397),
263
+ Connection(397, 365),
264
+ Connection(365, 379),
265
+ Connection(379, 378),
266
+ Connection(378, 400),
267
+ Connection(400, 377),
268
+ Connection(377, 152),
269
+ Connection(152, 148),
270
+ Connection(148, 176),
271
+ Connection(176, 149),
272
+ Connection(149, 150),
273
+ Connection(150, 136),
274
+ Connection(136, 172),
275
+ Connection(172, 58),
276
+ Connection(58, 132),
277
+ Connection(132, 93),
278
+ Connection(93, 234),
279
+ Connection(234, 127),
280
+ Connection(127, 162),
281
+ Connection(162, 21),
282
+ Connection(21, 54),
283
+ Connection(54, 103),
284
+ Connection(103, 67),
285
+ Connection(67, 109),
286
+ Connection(109, 10),
287
+ ]
288
+
289
+ FACE_LANDMARKS_CONTOURS: List[Connection] = (
290
+ FACE_LANDMARKS_LIPS
291
+ + FACE_LANDMARKS_LEFT_EYE
292
+ + FACE_LANDMARKS_LEFT_EYEBROW
293
+ + FACE_LANDMARKS_RIGHT_EYE
294
+ + FACE_LANDMARKS_RIGHT_EYEBROW
295
+ + FACE_LANDMARKS_FACE_OVAL
296
+ )
297
+
298
+ FACE_LANDMARKS_TESSELATION: List[Connection] = [
299
+ Connection(127, 34),
300
+ Connection(34, 139),
301
+ Connection(139, 127),
302
+ Connection(11, 0),
303
+ Connection(0, 37),
304
+ Connection(37, 11),
305
+ Connection(232, 231),
306
+ Connection(231, 120),
307
+ Connection(120, 232),
308
+ Connection(72, 37),
309
+ Connection(37, 39),
310
+ Connection(39, 72),
311
+ Connection(128, 121),
312
+ Connection(121, 47),
313
+ Connection(47, 128),
314
+ Connection(232, 121),
315
+ Connection(121, 128),
316
+ Connection(128, 232),
317
+ Connection(104, 69),
318
+ Connection(69, 67),
319
+ Connection(67, 104),
320
+ Connection(175, 171),
321
+ Connection(171, 148),
322
+ Connection(148, 175),
323
+ Connection(118, 50),
324
+ Connection(50, 101),
325
+ Connection(101, 118),
326
+ Connection(73, 39),
327
+ Connection(39, 40),
328
+ Connection(40, 73),
329
+ Connection(9, 151),
330
+ Connection(151, 108),
331
+ Connection(108, 9),
332
+ Connection(48, 115),
333
+ Connection(115, 131),
334
+ Connection(131, 48),
335
+ Connection(194, 204),
336
+ Connection(204, 211),
337
+ Connection(211, 194),
338
+ Connection(74, 40),
339
+ Connection(40, 185),
340
+ Connection(185, 74),
341
+ Connection(80, 42),
342
+ Connection(42, 183),
343
+ Connection(183, 80),
344
+ Connection(40, 92),
345
+ Connection(92, 186),
346
+ Connection(186, 40),
347
+ Connection(230, 229),
348
+ Connection(229, 118),
349
+ Connection(118, 230),
350
+ Connection(202, 212),
351
+ Connection(212, 214),
352
+ Connection(214, 202),
353
+ Connection(83, 18),
354
+ Connection(18, 17),
355
+ Connection(17, 83),
356
+ Connection(76, 61),
357
+ Connection(61, 146),
358
+ Connection(146, 76),
359
+ Connection(160, 29),
360
+ Connection(29, 30),
361
+ Connection(30, 160),
362
+ Connection(56, 157),
363
+ Connection(157, 173),
364
+ Connection(173, 56),
365
+ Connection(106, 204),
366
+ Connection(204, 194),
367
+ Connection(194, 106),
368
+ Connection(135, 214),
369
+ Connection(214, 192),
370
+ Connection(192, 135),
371
+ Connection(203, 165),
372
+ Connection(165, 98),
373
+ Connection(98, 203),
374
+ Connection(21, 71),
375
+ Connection(71, 68),
376
+ Connection(68, 21),
377
+ Connection(51, 45),
378
+ Connection(45, 4),
379
+ Connection(4, 51),
380
+ Connection(144, 24),
381
+ Connection(24, 23),
382
+ Connection(23, 144),
383
+ Connection(77, 146),
384
+ Connection(146, 91),
385
+ Connection(91, 77),
386
+ Connection(205, 50),
387
+ Connection(50, 187),
388
+ Connection(187, 205),
389
+ Connection(201, 200),
390
+ Connection(200, 18),
391
+ Connection(18, 201),
392
+ Connection(91, 106),
393
+ Connection(106, 182),
394
+ Connection(182, 91),
395
+ Connection(90, 91),
396
+ Connection(91, 181),
397
+ Connection(181, 90),
398
+ Connection(85, 84),
399
+ Connection(84, 17),
400
+ Connection(17, 85),
401
+ Connection(206, 203),
402
+ Connection(203, 36),
403
+ Connection(36, 206),
404
+ Connection(148, 171),
405
+ Connection(171, 140),
406
+ Connection(140, 148),
407
+ Connection(92, 40),
408
+ Connection(40, 39),
409
+ Connection(39, 92),
410
+ Connection(193, 189),
411
+ Connection(189, 244),
412
+ Connection(244, 193),
413
+ Connection(159, 158),
414
+ Connection(158, 28),
415
+ Connection(28, 159),
416
+ Connection(247, 246),
417
+ Connection(246, 161),
418
+ Connection(161, 247),
419
+ Connection(236, 3),
420
+ Connection(3, 196),
421
+ Connection(196, 236),
422
+ Connection(54, 68),
423
+ Connection(68, 104),
424
+ Connection(104, 54),
425
+ Connection(193, 168),
426
+ Connection(168, 8),
427
+ Connection(8, 193),
428
+ Connection(117, 228),
429
+ Connection(228, 31),
430
+ Connection(31, 117),
431
+ Connection(189, 193),
432
+ Connection(193, 55),
433
+ Connection(55, 189),
434
+ Connection(98, 97),
435
+ Connection(97, 99),
436
+ Connection(99, 98),
437
+ Connection(126, 47),
438
+ Connection(47, 100),
439
+ Connection(100, 126),
440
+ Connection(166, 79),
441
+ Connection(79, 218),
442
+ Connection(218, 166),
443
+ Connection(155, 154),
444
+ Connection(154, 26),
445
+ Connection(26, 155),
446
+ Connection(209, 49),
447
+ Connection(49, 131),
448
+ Connection(131, 209),
449
+ Connection(135, 136),
450
+ Connection(136, 150),
451
+ Connection(150, 135),
452
+ Connection(47, 126),
453
+ Connection(126, 217),
454
+ Connection(217, 47),
455
+ Connection(223, 52),
456
+ Connection(52, 53),
457
+ Connection(53, 223),
458
+ Connection(45, 51),
459
+ Connection(51, 134),
460
+ Connection(134, 45),
461
+ Connection(211, 170),
462
+ Connection(170, 140),
463
+ Connection(140, 211),
464
+ Connection(67, 69),
465
+ Connection(69, 108),
466
+ Connection(108, 67),
467
+ Connection(43, 106),
468
+ Connection(106, 91),
469
+ Connection(91, 43),
470
+ Connection(230, 119),
471
+ Connection(119, 120),
472
+ Connection(120, 230),
473
+ Connection(226, 130),
474
+ Connection(130, 247),
475
+ Connection(247, 226),
476
+ Connection(63, 53),
477
+ Connection(53, 52),
478
+ Connection(52, 63),
479
+ Connection(238, 20),
480
+ Connection(20, 242),
481
+ Connection(242, 238),
482
+ Connection(46, 70),
483
+ Connection(70, 156),
484
+ Connection(156, 46),
485
+ Connection(78, 62),
486
+ Connection(62, 96),
487
+ Connection(96, 78),
488
+ Connection(46, 53),
489
+ Connection(53, 63),
490
+ Connection(63, 46),
491
+ Connection(143, 34),
492
+ Connection(34, 227),
493
+ Connection(227, 143),
494
+ Connection(123, 117),
495
+ Connection(117, 111),
496
+ Connection(111, 123),
497
+ Connection(44, 125),
498
+ Connection(125, 19),
499
+ Connection(19, 44),
500
+ Connection(236, 134),
501
+ Connection(134, 51),
502
+ Connection(51, 236),
503
+ Connection(216, 206),
504
+ Connection(206, 205),
505
+ Connection(205, 216),
506
+ Connection(154, 153),
507
+ Connection(153, 22),
508
+ Connection(22, 154),
509
+ Connection(39, 37),
510
+ Connection(37, 167),
511
+ Connection(167, 39),
512
+ Connection(200, 201),
513
+ Connection(201, 208),
514
+ Connection(208, 200),
515
+ Connection(36, 142),
516
+ Connection(142, 100),
517
+ Connection(100, 36),
518
+ Connection(57, 212),
519
+ Connection(212, 202),
520
+ Connection(202, 57),
521
+ Connection(20, 60),
522
+ Connection(60, 99),
523
+ Connection(99, 20),
524
+ Connection(28, 158),
525
+ Connection(158, 157),
526
+ Connection(157, 28),
527
+ Connection(35, 226),
528
+ Connection(226, 113),
529
+ Connection(113, 35),
530
+ Connection(160, 159),
531
+ Connection(159, 27),
532
+ Connection(27, 160),
533
+ Connection(204, 202),
534
+ Connection(202, 210),
535
+ Connection(210, 204),
536
+ Connection(113, 225),
537
+ Connection(225, 46),
538
+ Connection(46, 113),
539
+ Connection(43, 202),
540
+ Connection(202, 204),
541
+ Connection(204, 43),
542
+ Connection(62, 76),
543
+ Connection(76, 77),
544
+ Connection(77, 62),
545
+ Connection(137, 123),
546
+ Connection(123, 116),
547
+ Connection(116, 137),
548
+ Connection(41, 38),
549
+ Connection(38, 72),
550
+ Connection(72, 41),
551
+ Connection(203, 129),
552
+ Connection(129, 142),
553
+ Connection(142, 203),
554
+ Connection(64, 98),
555
+ Connection(98, 240),
556
+ Connection(240, 64),
557
+ Connection(49, 102),
558
+ Connection(102, 64),
559
+ Connection(64, 49),
560
+ Connection(41, 73),
561
+ Connection(73, 74),
562
+ Connection(74, 41),
563
+ Connection(212, 216),
564
+ Connection(216, 207),
565
+ Connection(207, 212),
566
+ Connection(42, 74),
567
+ Connection(74, 184),
568
+ Connection(184, 42),
569
+ Connection(169, 170),
570
+ Connection(170, 211),
571
+ Connection(211, 169),
572
+ Connection(170, 149),
573
+ Connection(149, 176),
574
+ Connection(176, 170),
575
+ Connection(105, 66),
576
+ Connection(66, 69),
577
+ Connection(69, 105),
578
+ Connection(122, 6),
579
+ Connection(6, 168),
580
+ Connection(168, 122),
581
+ Connection(123, 147),
582
+ Connection(147, 187),
583
+ Connection(187, 123),
584
+ Connection(96, 77),
585
+ Connection(77, 90),
586
+ Connection(90, 96),
587
+ Connection(65, 55),
588
+ Connection(55, 107),
589
+ Connection(107, 65),
590
+ Connection(89, 90),
591
+ Connection(90, 180),
592
+ Connection(180, 89),
593
+ Connection(101, 100),
594
+ Connection(100, 120),
595
+ Connection(120, 101),
596
+ Connection(63, 105),
597
+ Connection(105, 104),
598
+ Connection(104, 63),
599
+ Connection(93, 137),
600
+ Connection(137, 227),
601
+ Connection(227, 93),
602
+ Connection(15, 86),
603
+ Connection(86, 85),
604
+ Connection(85, 15),
605
+ Connection(129, 102),
606
+ Connection(102, 49),
607
+ Connection(49, 129),
608
+ Connection(14, 87),
609
+ Connection(87, 86),
610
+ Connection(86, 14),
611
+ Connection(55, 8),
612
+ Connection(8, 9),
613
+ Connection(9, 55),
614
+ Connection(100, 47),
615
+ Connection(47, 121),
616
+ Connection(121, 100),
617
+ Connection(145, 23),
618
+ Connection(23, 22),
619
+ Connection(22, 145),
620
+ Connection(88, 89),
621
+ Connection(89, 179),
622
+ Connection(179, 88),
623
+ Connection(6, 122),
624
+ Connection(122, 196),
625
+ Connection(196, 6),
626
+ Connection(88, 95),
627
+ Connection(95, 96),
628
+ Connection(96, 88),
629
+ Connection(138, 172),
630
+ Connection(172, 136),
631
+ Connection(136, 138),
632
+ Connection(215, 58),
633
+ Connection(58, 172),
634
+ Connection(172, 215),
635
+ Connection(115, 48),
636
+ Connection(48, 219),
637
+ Connection(219, 115),
638
+ Connection(42, 80),
639
+ Connection(80, 81),
640
+ Connection(81, 42),
641
+ Connection(195, 3),
642
+ Connection(3, 51),
643
+ Connection(51, 195),
644
+ Connection(43, 146),
645
+ Connection(146, 61),
646
+ Connection(61, 43),
647
+ Connection(171, 175),
648
+ Connection(175, 199),
649
+ Connection(199, 171),
650
+ Connection(81, 82),
651
+ Connection(82, 38),
652
+ Connection(38, 81),
653
+ Connection(53, 46),
654
+ Connection(46, 225),
655
+ Connection(225, 53),
656
+ Connection(144, 163),
657
+ Connection(163, 110),
658
+ Connection(110, 144),
659
+ Connection(52, 65),
660
+ Connection(65, 66),
661
+ Connection(66, 52),
662
+ Connection(229, 228),
663
+ Connection(228, 117),
664
+ Connection(117, 229),
665
+ Connection(34, 127),
666
+ Connection(127, 234),
667
+ Connection(234, 34),
668
+ Connection(107, 108),
669
+ Connection(108, 69),
670
+ Connection(69, 107),
671
+ Connection(109, 108),
672
+ Connection(108, 151),
673
+ Connection(151, 109),
674
+ Connection(48, 64),
675
+ Connection(64, 235),
676
+ Connection(235, 48),
677
+ Connection(62, 78),
678
+ Connection(78, 191),
679
+ Connection(191, 62),
680
+ Connection(129, 209),
681
+ Connection(209, 126),
682
+ Connection(126, 129),
683
+ Connection(111, 35),
684
+ Connection(35, 143),
685
+ Connection(143, 111),
686
+ Connection(117, 123),
687
+ Connection(123, 50),
688
+ Connection(50, 117),
689
+ Connection(222, 65),
690
+ Connection(65, 52),
691
+ Connection(52, 222),
692
+ Connection(19, 125),
693
+ Connection(125, 141),
694
+ Connection(141, 19),
695
+ Connection(221, 55),
696
+ Connection(55, 65),
697
+ Connection(65, 221),
698
+ Connection(3, 195),
699
+ Connection(195, 197),
700
+ Connection(197, 3),
701
+ Connection(25, 7),
702
+ Connection(7, 33),
703
+ Connection(33, 25),
704
+ Connection(220, 237),
705
+ Connection(237, 44),
706
+ Connection(44, 220),
707
+ Connection(70, 71),
708
+ Connection(71, 139),
709
+ Connection(139, 70),
710
+ Connection(122, 193),
711
+ Connection(193, 245),
712
+ Connection(245, 122),
713
+ Connection(247, 130),
714
+ Connection(130, 33),
715
+ Connection(33, 247),
716
+ Connection(71, 21),
717
+ Connection(21, 162),
718
+ Connection(162, 71),
719
+ Connection(170, 169),
720
+ Connection(169, 150),
721
+ Connection(150, 170),
722
+ Connection(188, 174),
723
+ Connection(174, 196),
724
+ Connection(196, 188),
725
+ Connection(216, 186),
726
+ Connection(186, 92),
727
+ Connection(92, 216),
728
+ Connection(2, 97),
729
+ Connection(97, 167),
730
+ Connection(167, 2),
731
+ Connection(141, 125),
732
+ Connection(125, 241),
733
+ Connection(241, 141),
734
+ Connection(164, 167),
735
+ Connection(167, 37),
736
+ Connection(37, 164),
737
+ Connection(72, 38),
738
+ Connection(38, 12),
739
+ Connection(12, 72),
740
+ Connection(38, 82),
741
+ Connection(82, 13),
742
+ Connection(13, 38),
743
+ Connection(63, 68),
744
+ Connection(68, 71),
745
+ Connection(71, 63),
746
+ Connection(226, 35),
747
+ Connection(35, 111),
748
+ Connection(111, 226),
749
+ Connection(101, 50),
750
+ Connection(50, 205),
751
+ Connection(205, 101),
752
+ Connection(206, 92),
753
+ Connection(92, 165),
754
+ Connection(165, 206),
755
+ Connection(209, 198),
756
+ Connection(198, 217),
757
+ Connection(217, 209),
758
+ Connection(165, 167),
759
+ Connection(167, 97),
760
+ Connection(97, 165),
761
+ Connection(220, 115),
762
+ Connection(115, 218),
763
+ Connection(218, 220),
764
+ Connection(133, 112),
765
+ Connection(112, 243),
766
+ Connection(243, 133),
767
+ Connection(239, 238),
768
+ Connection(238, 241),
769
+ Connection(241, 239),
770
+ Connection(214, 135),
771
+ Connection(135, 169),
772
+ Connection(169, 214),
773
+ Connection(190, 173),
774
+ Connection(173, 133),
775
+ Connection(133, 190),
776
+ Connection(171, 208),
777
+ Connection(208, 32),
778
+ Connection(32, 171),
779
+ Connection(125, 44),
780
+ Connection(44, 237),
781
+ Connection(237, 125),
782
+ Connection(86, 87),
783
+ Connection(87, 178),
784
+ Connection(178, 86),
785
+ Connection(85, 86),
786
+ Connection(86, 179),
787
+ Connection(179, 85),
788
+ Connection(84, 85),
789
+ Connection(85, 180),
790
+ Connection(180, 84),
791
+ Connection(83, 84),
792
+ Connection(84, 181),
793
+ Connection(181, 83),
794
+ Connection(201, 83),
795
+ Connection(83, 182),
796
+ Connection(182, 201),
797
+ Connection(137, 93),
798
+ Connection(93, 132),
799
+ Connection(132, 137),
800
+ Connection(76, 62),
801
+ Connection(62, 183),
802
+ Connection(183, 76),
803
+ Connection(61, 76),
804
+ Connection(76, 184),
805
+ Connection(184, 61),
806
+ Connection(57, 61),
807
+ Connection(61, 185),
808
+ Connection(185, 57),
809
+ Connection(212, 57),
810
+ Connection(57, 186),
811
+ Connection(186, 212),
812
+ Connection(214, 207),
813
+ Connection(207, 187),
814
+ Connection(187, 214),
815
+ Connection(34, 143),
816
+ Connection(143, 156),
817
+ Connection(156, 34),
818
+ Connection(79, 239),
819
+ Connection(239, 237),
820
+ Connection(237, 79),
821
+ Connection(123, 137),
822
+ Connection(137, 177),
823
+ Connection(177, 123),
824
+ Connection(44, 1),
825
+ Connection(1, 4),
826
+ Connection(4, 44),
827
+ Connection(201, 194),
828
+ Connection(194, 32),
829
+ Connection(32, 201),
830
+ Connection(64, 102),
831
+ Connection(102, 129),
832
+ Connection(129, 64),
833
+ Connection(213, 215),
834
+ Connection(215, 138),
835
+ Connection(138, 213),
836
+ Connection(59, 166),
837
+ Connection(166, 219),
838
+ Connection(219, 59),
839
+ Connection(242, 99),
840
+ Connection(99, 97),
841
+ Connection(97, 242),
842
+ Connection(2, 94),
843
+ Connection(94, 141),
844
+ Connection(141, 2),
845
+ Connection(75, 59),
846
+ Connection(59, 235),
847
+ Connection(235, 75),
848
+ Connection(24, 110),
849
+ Connection(110, 228),
850
+ Connection(228, 24),
851
+ Connection(25, 130),
852
+ Connection(130, 226),
853
+ Connection(226, 25),
854
+ Connection(23, 24),
855
+ Connection(24, 229),
856
+ Connection(229, 23),
857
+ Connection(22, 23),
858
+ Connection(23, 230),
859
+ Connection(230, 22),
860
+ Connection(26, 22),
861
+ Connection(22, 231),
862
+ Connection(231, 26),
863
+ Connection(112, 26),
864
+ Connection(26, 232),
865
+ Connection(232, 112),
866
+ Connection(189, 190),
867
+ Connection(190, 243),
868
+ Connection(243, 189),
869
+ Connection(221, 56),
870
+ Connection(56, 190),
871
+ Connection(190, 221),
872
+ Connection(28, 56),
873
+ Connection(56, 221),
874
+ Connection(221, 28),
875
+ Connection(27, 28),
876
+ Connection(28, 222),
877
+ Connection(222, 27),
878
+ Connection(29, 27),
879
+ Connection(27, 223),
880
+ Connection(223, 29),
881
+ Connection(30, 29),
882
+ Connection(29, 224),
883
+ Connection(224, 30),
884
+ Connection(247, 30),
885
+ Connection(30, 225),
886
+ Connection(225, 247),
887
+ Connection(238, 79),
888
+ Connection(79, 20),
889
+ Connection(20, 238),
890
+ Connection(166, 59),
891
+ Connection(59, 75),
892
+ Connection(75, 166),
893
+ Connection(60, 75),
894
+ Connection(75, 240),
895
+ Connection(240, 60),
896
+ Connection(147, 177),
897
+ Connection(177, 215),
898
+ Connection(215, 147),
899
+ Connection(20, 79),
900
+ Connection(79, 166),
901
+ Connection(166, 20),
902
+ Connection(187, 147),
903
+ Connection(147, 213),
904
+ Connection(213, 187),
905
+ Connection(112, 233),
906
+ Connection(233, 244),
907
+ Connection(244, 112),
908
+ Connection(233, 128),
909
+ Connection(128, 245),
910
+ Connection(245, 233),
911
+ Connection(128, 114),
912
+ Connection(114, 188),
913
+ Connection(188, 128),
914
+ Connection(114, 217),
915
+ Connection(217, 174),
916
+ Connection(174, 114),
917
+ Connection(131, 115),
918
+ Connection(115, 220),
919
+ Connection(220, 131),
920
+ Connection(217, 198),
921
+ Connection(198, 236),
922
+ Connection(236, 217),
923
+ Connection(198, 131),
924
+ Connection(131, 134),
925
+ Connection(134, 198),
926
+ Connection(177, 132),
927
+ Connection(132, 58),
928
+ Connection(58, 177),
929
+ Connection(143, 35),
930
+ Connection(35, 124),
931
+ Connection(124, 143),
932
+ Connection(110, 163),
933
+ Connection(163, 7),
934
+ Connection(7, 110),
935
+ Connection(228, 110),
936
+ Connection(110, 25),
937
+ Connection(25, 228),
938
+ Connection(356, 389),
939
+ Connection(389, 368),
940
+ Connection(368, 356),
941
+ Connection(11, 302),
942
+ Connection(302, 267),
943
+ Connection(267, 11),
944
+ Connection(452, 350),
945
+ Connection(350, 349),
946
+ Connection(349, 452),
947
+ Connection(302, 303),
948
+ Connection(303, 269),
949
+ Connection(269, 302),
950
+ Connection(357, 343),
951
+ Connection(343, 277),
952
+ Connection(277, 357),
953
+ Connection(452, 453),
954
+ Connection(453, 357),
955
+ Connection(357, 452),
956
+ Connection(333, 332),
957
+ Connection(332, 297),
958
+ Connection(297, 333),
959
+ Connection(175, 152),
960
+ Connection(152, 377),
961
+ Connection(377, 175),
962
+ Connection(347, 348),
963
+ Connection(348, 330),
964
+ Connection(330, 347),
965
+ Connection(303, 304),
966
+ Connection(304, 270),
967
+ Connection(270, 303),
968
+ Connection(9, 336),
969
+ Connection(336, 337),
970
+ Connection(337, 9),
971
+ Connection(278, 279),
972
+ Connection(279, 360),
973
+ Connection(360, 278),
974
+ Connection(418, 262),
975
+ Connection(262, 431),
976
+ Connection(431, 418),
977
+ Connection(304, 408),
978
+ Connection(408, 409),
979
+ Connection(409, 304),
980
+ Connection(310, 415),
981
+ Connection(415, 407),
982
+ Connection(407, 310),
983
+ Connection(270, 409),
984
+ Connection(409, 410),
985
+ Connection(410, 270),
986
+ Connection(450, 348),
987
+ Connection(348, 347),
988
+ Connection(347, 450),
989
+ Connection(422, 430),
990
+ Connection(430, 434),
991
+ Connection(434, 422),
992
+ Connection(313, 314),
993
+ Connection(314, 17),
994
+ Connection(17, 313),
995
+ Connection(306, 307),
996
+ Connection(307, 375),
997
+ Connection(375, 306),
998
+ Connection(387, 388),
999
+ Connection(388, 260),
1000
+ Connection(260, 387),
1001
+ Connection(286, 414),
1002
+ Connection(414, 398),
1003
+ Connection(398, 286),
1004
+ Connection(335, 406),
1005
+ Connection(406, 418),
1006
+ Connection(418, 335),
1007
+ Connection(364, 367),
1008
+ Connection(367, 416),
1009
+ Connection(416, 364),
1010
+ Connection(423, 358),
1011
+ Connection(358, 327),
1012
+ Connection(327, 423),
1013
+ Connection(251, 284),
1014
+ Connection(284, 298),
1015
+ Connection(298, 251),
1016
+ Connection(281, 5),
1017
+ Connection(5, 4),
1018
+ Connection(4, 281),
1019
+ Connection(373, 374),
1020
+ Connection(374, 253),
1021
+ Connection(253, 373),
1022
+ Connection(307, 320),
1023
+ Connection(320, 321),
1024
+ Connection(321, 307),
1025
+ Connection(425, 427),
1026
+ Connection(427, 411),
1027
+ Connection(411, 425),
1028
+ Connection(421, 313),
1029
+ Connection(313, 18),
1030
+ Connection(18, 421),
1031
+ Connection(321, 405),
1032
+ Connection(405, 406),
1033
+ Connection(406, 321),
1034
+ Connection(320, 404),
1035
+ Connection(404, 405),
1036
+ Connection(405, 320),
1037
+ Connection(315, 16),
1038
+ Connection(16, 17),
1039
+ Connection(17, 315),
1040
+ Connection(426, 425),
1041
+ Connection(425, 266),
1042
+ Connection(266, 426),
1043
+ Connection(377, 400),
1044
+ Connection(400, 369),
1045
+ Connection(369, 377),
1046
+ Connection(322, 391),
1047
+ Connection(391, 269),
1048
+ Connection(269, 322),
1049
+ Connection(417, 465),
1050
+ Connection(465, 464),
1051
+ Connection(464, 417),
1052
+ Connection(386, 257),
1053
+ Connection(257, 258),
1054
+ Connection(258, 386),
1055
+ Connection(466, 260),
1056
+ Connection(260, 388),
1057
+ Connection(388, 466),
1058
+ Connection(456, 399),
1059
+ Connection(399, 419),
1060
+ Connection(419, 456),
1061
+ Connection(284, 332),
1062
+ Connection(332, 333),
1063
+ Connection(333, 284),
1064
+ Connection(417, 285),
1065
+ Connection(285, 8),
1066
+ Connection(8, 417),
1067
+ Connection(346, 340),
1068
+ Connection(340, 261),
1069
+ Connection(261, 346),
1070
+ Connection(413, 441),
1071
+ Connection(441, 285),
1072
+ Connection(285, 413),
1073
+ Connection(327, 460),
1074
+ Connection(460, 328),
1075
+ Connection(328, 327),
1076
+ Connection(355, 371),
1077
+ Connection(371, 329),
1078
+ Connection(329, 355),
1079
+ Connection(392, 439),
1080
+ Connection(439, 438),
1081
+ Connection(438, 392),
1082
+ Connection(382, 341),
1083
+ Connection(341, 256),
1084
+ Connection(256, 382),
1085
+ Connection(429, 420),
1086
+ Connection(420, 360),
1087
+ Connection(360, 429),
1088
+ Connection(364, 394),
1089
+ Connection(394, 379),
1090
+ Connection(379, 364),
1091
+ Connection(277, 343),
1092
+ Connection(343, 437),
1093
+ Connection(437, 277),
1094
+ Connection(443, 444),
1095
+ Connection(444, 283),
1096
+ Connection(283, 443),
1097
+ Connection(275, 440),
1098
+ Connection(440, 363),
1099
+ Connection(363, 275),
1100
+ Connection(431, 262),
1101
+ Connection(262, 369),
1102
+ Connection(369, 431),
1103
+ Connection(297, 338),
1104
+ Connection(338, 337),
1105
+ Connection(337, 297),
1106
+ Connection(273, 375),
1107
+ Connection(375, 321),
1108
+ Connection(321, 273),
1109
+ Connection(450, 451),
1110
+ Connection(451, 349),
1111
+ Connection(349, 450),
1112
+ Connection(446, 342),
1113
+ Connection(342, 467),
1114
+ Connection(467, 446),
1115
+ Connection(293, 334),
1116
+ Connection(334, 282),
1117
+ Connection(282, 293),
1118
+ Connection(458, 461),
1119
+ Connection(461, 462),
1120
+ Connection(462, 458),
1121
+ Connection(276, 353),
1122
+ Connection(353, 383),
1123
+ Connection(383, 276),
1124
+ Connection(308, 324),
1125
+ Connection(324, 325),
1126
+ Connection(325, 308),
1127
+ Connection(276, 300),
1128
+ Connection(300, 293),
1129
+ Connection(293, 276),
1130
+ Connection(372, 345),
1131
+ Connection(345, 447),
1132
+ Connection(447, 372),
1133
+ Connection(352, 345),
1134
+ Connection(345, 340),
1135
+ Connection(340, 352),
1136
+ Connection(274, 1),
1137
+ Connection(1, 19),
1138
+ Connection(19, 274),
1139
+ Connection(456, 248),
1140
+ Connection(248, 281),
1141
+ Connection(281, 456),
1142
+ Connection(436, 427),
1143
+ Connection(427, 425),
1144
+ Connection(425, 436),
1145
+ Connection(381, 256),
1146
+ Connection(256, 252),
1147
+ Connection(252, 381),
1148
+ Connection(269, 391),
1149
+ Connection(391, 393),
1150
+ Connection(393, 269),
1151
+ Connection(200, 199),
1152
+ Connection(199, 428),
1153
+ Connection(428, 200),
1154
+ Connection(266, 330),
1155
+ Connection(330, 329),
1156
+ Connection(329, 266),
1157
+ Connection(287, 273),
1158
+ Connection(273, 422),
1159
+ Connection(422, 287),
1160
+ Connection(250, 462),
1161
+ Connection(462, 328),
1162
+ Connection(328, 250),
1163
+ Connection(258, 286),
1164
+ Connection(286, 384),
1165
+ Connection(384, 258),
1166
+ Connection(265, 353),
1167
+ Connection(353, 342),
1168
+ Connection(342, 265),
1169
+ Connection(387, 259),
1170
+ Connection(259, 257),
1171
+ Connection(257, 387),
1172
+ Connection(424, 431),
1173
+ Connection(431, 430),
1174
+ Connection(430, 424),
1175
+ Connection(342, 353),
1176
+ Connection(353, 276),
1177
+ Connection(276, 342),
1178
+ Connection(273, 335),
1179
+ Connection(335, 424),
1180
+ Connection(424, 273),
1181
+ Connection(292, 325),
1182
+ Connection(325, 307),
1183
+ Connection(307, 292),
1184
+ Connection(366, 447),
1185
+ Connection(447, 345),
1186
+ Connection(345, 366),
1187
+ Connection(271, 303),
1188
+ Connection(303, 302),
1189
+ Connection(302, 271),
1190
+ Connection(423, 266),
1191
+ Connection(266, 371),
1192
+ Connection(371, 423),
1193
+ Connection(294, 455),
1194
+ Connection(455, 460),
1195
+ Connection(460, 294),
1196
+ Connection(279, 278),
1197
+ Connection(278, 294),
1198
+ Connection(294, 279),
1199
+ Connection(271, 272),
1200
+ Connection(272, 304),
1201
+ Connection(304, 271),
1202
+ Connection(432, 434),
1203
+ Connection(434, 427),
1204
+ Connection(427, 432),
1205
+ Connection(272, 407),
1206
+ Connection(407, 408),
1207
+ Connection(408, 272),
1208
+ Connection(394, 430),
1209
+ Connection(430, 431),
1210
+ Connection(431, 394),
1211
+ Connection(395, 369),
1212
+ Connection(369, 400),
1213
+ Connection(400, 395),
1214
+ Connection(334, 333),
1215
+ Connection(333, 299),
1216
+ Connection(299, 334),
1217
+ Connection(351, 417),
1218
+ Connection(417, 168),
1219
+ Connection(168, 351),
1220
+ Connection(352, 280),
1221
+ Connection(280, 411),
1222
+ Connection(411, 352),
1223
+ Connection(325, 319),
1224
+ Connection(319, 320),
1225
+ Connection(320, 325),
1226
+ Connection(295, 296),
1227
+ Connection(296, 336),
1228
+ Connection(336, 295),
1229
+ Connection(319, 403),
1230
+ Connection(403, 404),
1231
+ Connection(404, 319),
1232
+ Connection(330, 348),
1233
+ Connection(348, 349),
1234
+ Connection(349, 330),
1235
+ Connection(293, 298),
1236
+ Connection(298, 333),
1237
+ Connection(333, 293),
1238
+ Connection(323, 454),
1239
+ Connection(454, 447),
1240
+ Connection(447, 323),
1241
+ Connection(15, 16),
1242
+ Connection(16, 315),
1243
+ Connection(315, 15),
1244
+ Connection(358, 429),
1245
+ Connection(429, 279),
1246
+ Connection(279, 358),
1247
+ Connection(14, 15),
1248
+ Connection(15, 316),
1249
+ Connection(316, 14),
1250
+ Connection(285, 336),
1251
+ Connection(336, 9),
1252
+ Connection(9, 285),
1253
+ Connection(329, 349),
1254
+ Connection(349, 350),
1255
+ Connection(350, 329),
1256
+ Connection(374, 380),
1257
+ Connection(380, 252),
1258
+ Connection(252, 374),
1259
+ Connection(318, 402),
1260
+ Connection(402, 403),
1261
+ Connection(403, 318),
1262
+ Connection(6, 197),
1263
+ Connection(197, 419),
1264
+ Connection(419, 6),
1265
+ Connection(318, 319),
1266
+ Connection(319, 325),
1267
+ Connection(325, 318),
1268
+ Connection(367, 364),
1269
+ Connection(364, 365),
1270
+ Connection(365, 367),
1271
+ Connection(435, 367),
1272
+ Connection(367, 397),
1273
+ Connection(397, 435),
1274
+ Connection(344, 438),
1275
+ Connection(438, 439),
1276
+ Connection(439, 344),
1277
+ Connection(272, 271),
1278
+ Connection(271, 311),
1279
+ Connection(311, 272),
1280
+ Connection(195, 5),
1281
+ Connection(5, 281),
1282
+ Connection(281, 195),
1283
+ Connection(273, 287),
1284
+ Connection(287, 291),
1285
+ Connection(291, 273),
1286
+ Connection(396, 428),
1287
+ Connection(428, 199),
1288
+ Connection(199, 396),
1289
+ Connection(311, 271),
1290
+ Connection(271, 268),
1291
+ Connection(268, 311),
1292
+ Connection(283, 444),
1293
+ Connection(444, 445),
1294
+ Connection(445, 283),
1295
+ Connection(373, 254),
1296
+ Connection(254, 339),
1297
+ Connection(339, 373),
1298
+ Connection(282, 334),
1299
+ Connection(334, 296),
1300
+ Connection(296, 282),
1301
+ Connection(449, 347),
1302
+ Connection(347, 346),
1303
+ Connection(346, 449),
1304
+ Connection(264, 447),
1305
+ Connection(447, 454),
1306
+ Connection(454, 264),
1307
+ Connection(336, 296),
1308
+ Connection(296, 299),
1309
+ Connection(299, 336),
1310
+ Connection(338, 10),
1311
+ Connection(10, 151),
1312
+ Connection(151, 338),
1313
+ Connection(278, 439),
1314
+ Connection(439, 455),
1315
+ Connection(455, 278),
1316
+ Connection(292, 407),
1317
+ Connection(407, 415),
1318
+ Connection(415, 292),
1319
+ Connection(358, 371),
1320
+ Connection(371, 355),
1321
+ Connection(355, 358),
1322
+ Connection(340, 345),
1323
+ Connection(345, 372),
1324
+ Connection(372, 340),
1325
+ Connection(346, 347),
1326
+ Connection(347, 280),
1327
+ Connection(280, 346),
1328
+ Connection(442, 443),
1329
+ Connection(443, 282),
1330
+ Connection(282, 442),
1331
+ Connection(19, 94),
1332
+ Connection(94, 370),
1333
+ Connection(370, 19),
1334
+ Connection(441, 442),
1335
+ Connection(442, 295),
1336
+ Connection(295, 441),
1337
+ Connection(248, 419),
1338
+ Connection(419, 197),
1339
+ Connection(197, 248),
1340
+ Connection(263, 255),
1341
+ Connection(255, 359),
1342
+ Connection(359, 263),
1343
+ Connection(440, 275),
1344
+ Connection(275, 274),
1345
+ Connection(274, 440),
1346
+ Connection(300, 383),
1347
+ Connection(383, 368),
1348
+ Connection(368, 300),
1349
+ Connection(351, 412),
1350
+ Connection(412, 465),
1351
+ Connection(465, 351),
1352
+ Connection(263, 467),
1353
+ Connection(467, 466),
1354
+ Connection(466, 263),
1355
+ Connection(301, 368),
1356
+ Connection(368, 389),
1357
+ Connection(389, 301),
1358
+ Connection(395, 378),
1359
+ Connection(378, 379),
1360
+ Connection(379, 395),
1361
+ Connection(412, 351),
1362
+ Connection(351, 419),
1363
+ Connection(419, 412),
1364
+ Connection(436, 426),
1365
+ Connection(426, 322),
1366
+ Connection(322, 436),
1367
+ Connection(2, 164),
1368
+ Connection(164, 393),
1369
+ Connection(393, 2),
1370
+ Connection(370, 462),
1371
+ Connection(462, 461),
1372
+ Connection(461, 370),
1373
+ Connection(164, 0),
1374
+ Connection(0, 267),
1375
+ Connection(267, 164),
1376
+ Connection(302, 11),
1377
+ Connection(11, 12),
1378
+ Connection(12, 302),
1379
+ Connection(268, 12),
1380
+ Connection(12, 13),
1381
+ Connection(13, 268),
1382
+ Connection(293, 300),
1383
+ Connection(300, 301),
1384
+ Connection(301, 293),
1385
+ Connection(446, 261),
1386
+ Connection(261, 340),
1387
+ Connection(340, 446),
1388
+ Connection(330, 266),
1389
+ Connection(266, 425),
1390
+ Connection(425, 330),
1391
+ Connection(426, 423),
1392
+ Connection(423, 391),
1393
+ Connection(391, 426),
1394
+ Connection(429, 355),
1395
+ Connection(355, 437),
1396
+ Connection(437, 429),
1397
+ Connection(391, 327),
1398
+ Connection(327, 326),
1399
+ Connection(326, 391),
1400
+ Connection(440, 457),
1401
+ Connection(457, 438),
1402
+ Connection(438, 440),
1403
+ Connection(341, 382),
1404
+ Connection(382, 362),
1405
+ Connection(362, 341),
1406
+ Connection(459, 457),
1407
+ Connection(457, 461),
1408
+ Connection(461, 459),
1409
+ Connection(434, 430),
1410
+ Connection(430, 394),
1411
+ Connection(394, 434),
1412
+ Connection(414, 463),
1413
+ Connection(463, 362),
1414
+ Connection(362, 414),
1415
+ Connection(396, 369),
1416
+ Connection(369, 262),
1417
+ Connection(262, 396),
1418
+ Connection(354, 461),
1419
+ Connection(461, 457),
1420
+ Connection(457, 354),
1421
+ Connection(316, 403),
1422
+ Connection(403, 402),
1423
+ Connection(402, 316),
1424
+ Connection(315, 404),
1425
+ Connection(404, 403),
1426
+ Connection(403, 315),
1427
+ Connection(314, 405),
1428
+ Connection(405, 404),
1429
+ Connection(404, 314),
1430
+ Connection(313, 406),
1431
+ Connection(406, 405),
1432
+ Connection(405, 313),
1433
+ Connection(421, 418),
1434
+ Connection(418, 406),
1435
+ Connection(406, 421),
1436
+ Connection(366, 401),
1437
+ Connection(401, 361),
1438
+ Connection(361, 366),
1439
+ Connection(306, 408),
1440
+ Connection(408, 407),
1441
+ Connection(407, 306),
1442
+ Connection(291, 409),
1443
+ Connection(409, 408),
1444
+ Connection(408, 291),
1445
+ Connection(287, 410),
1446
+ Connection(410, 409),
1447
+ Connection(409, 287),
1448
+ Connection(432, 436),
1449
+ Connection(436, 410),
1450
+ Connection(410, 432),
1451
+ Connection(434, 416),
1452
+ Connection(416, 411),
1453
+ Connection(411, 434),
1454
+ Connection(264, 368),
1455
+ Connection(368, 383),
1456
+ Connection(383, 264),
1457
+ Connection(309, 438),
1458
+ Connection(438, 457),
1459
+ Connection(457, 309),
1460
+ Connection(352, 376),
1461
+ Connection(376, 401),
1462
+ Connection(401, 352),
1463
+ Connection(274, 275),
1464
+ Connection(275, 4),
1465
+ Connection(4, 274),
1466
+ Connection(421, 428),
1467
+ Connection(428, 262),
1468
+ Connection(262, 421),
1469
+ Connection(294, 327),
1470
+ Connection(327, 358),
1471
+ Connection(358, 294),
1472
+ Connection(433, 416),
1473
+ Connection(416, 367),
1474
+ Connection(367, 433),
1475
+ Connection(289, 455),
1476
+ Connection(455, 439),
1477
+ Connection(439, 289),
1478
+ Connection(462, 370),
1479
+ Connection(370, 326),
1480
+ Connection(326, 462),
1481
+ Connection(2, 326),
1482
+ Connection(326, 370),
1483
+ Connection(370, 2),
1484
+ Connection(305, 460),
1485
+ Connection(460, 455),
1486
+ Connection(455, 305),
1487
+ Connection(254, 449),
1488
+ Connection(449, 448),
1489
+ Connection(448, 254),
1490
+ Connection(255, 261),
1491
+ Connection(261, 446),
1492
+ Connection(446, 255),
1493
+ Connection(253, 450),
1494
+ Connection(450, 449),
1495
+ Connection(449, 253),
1496
+ Connection(252, 451),
1497
+ Connection(451, 450),
1498
+ Connection(450, 252),
1499
+ Connection(256, 452),
1500
+ Connection(452, 451),
1501
+ Connection(451, 256),
1502
+ Connection(341, 453),
1503
+ Connection(453, 452),
1504
+ Connection(452, 341),
1505
+ Connection(413, 464),
1506
+ Connection(464, 463),
1507
+ Connection(463, 413),
1508
+ Connection(441, 413),
1509
+ Connection(413, 414),
1510
+ Connection(414, 441),
1511
+ Connection(258, 442),
1512
+ Connection(442, 441),
1513
+ Connection(441, 258),
1514
+ Connection(257, 443),
1515
+ Connection(443, 442),
1516
+ Connection(442, 257),
1517
+ Connection(259, 444),
1518
+ Connection(444, 443),
1519
+ Connection(443, 259),
1520
+ Connection(260, 445),
1521
+ Connection(445, 444),
1522
+ Connection(444, 260),
1523
+ Connection(467, 342),
1524
+ Connection(342, 445),
1525
+ Connection(445, 467),
1526
+ Connection(459, 458),
1527
+ Connection(458, 250),
1528
+ Connection(250, 459),
1529
+ Connection(289, 392),
1530
+ Connection(392, 290),
1531
+ Connection(290, 289),
1532
+ Connection(290, 328),
1533
+ Connection(328, 460),
1534
+ Connection(460, 290),
1535
+ Connection(376, 433),
1536
+ Connection(433, 435),
1537
+ Connection(435, 376),
1538
+ Connection(250, 290),
1539
+ Connection(290, 392),
1540
+ Connection(392, 250),
1541
+ Connection(411, 416),
1542
+ Connection(416, 433),
1543
+ Connection(433, 411),
1544
+ Connection(341, 463),
1545
+ Connection(463, 464),
1546
+ Connection(464, 341),
1547
+ Connection(453, 464),
1548
+ Connection(464, 465),
1549
+ Connection(465, 453),
1550
+ Connection(357, 465),
1551
+ Connection(465, 412),
1552
+ Connection(412, 357),
1553
+ Connection(343, 412),
1554
+ Connection(412, 399),
1555
+ Connection(399, 343),
1556
+ Connection(360, 363),
1557
+ Connection(363, 440),
1558
+ Connection(440, 360),
1559
+ Connection(437, 399),
1560
+ Connection(399, 456),
1561
+ Connection(456, 437),
1562
+ Connection(420, 456),
1563
+ Connection(456, 363),
1564
+ Connection(363, 420),
1565
+ Connection(401, 435),
1566
+ Connection(435, 288),
1567
+ Connection(288, 401),
1568
+ Connection(372, 383),
1569
+ Connection(383, 353),
1570
+ Connection(353, 372),
1571
+ Connection(339, 255),
1572
+ Connection(255, 249),
1573
+ Connection(249, 339),
1574
+ Connection(448, 261),
1575
+ Connection(261, 255),
1576
+ Connection(255, 448),
1577
+ Connection(133, 243),
1578
+ Connection(243, 190),
1579
+ Connection(190, 133),
1580
+ Connection(133, 155),
1581
+ Connection(155, 112),
1582
+ Connection(112, 133),
1583
+ Connection(33, 246),
1584
+ Connection(246, 247),
1585
+ Connection(247, 33),
1586
+ Connection(33, 130),
1587
+ Connection(130, 25),
1588
+ Connection(25, 33),
1589
+ Connection(398, 384),
1590
+ Connection(384, 286),
1591
+ Connection(286, 398),
1592
+ Connection(362, 398),
1593
+ Connection(398, 414),
1594
+ Connection(414, 362),
1595
+ Connection(362, 463),
1596
+ Connection(463, 341),
1597
+ Connection(341, 362),
1598
+ Connection(263, 359),
1599
+ Connection(359, 467),
1600
+ Connection(467, 263),
1601
+ Connection(263, 249),
1602
+ Connection(249, 255),
1603
+ Connection(255, 263),
1604
+ Connection(466, 467),
1605
+ Connection(467, 260),
1606
+ Connection(260, 466),
1607
+ Connection(75, 60),
1608
+ Connection(60, 166),
1609
+ Connection(166, 75),
1610
+ Connection(238, 239),
1611
+ Connection(239, 79),
1612
+ Connection(79, 238),
1613
+ Connection(162, 127),
1614
+ Connection(127, 139),
1615
+ Connection(139, 162),
1616
+ Connection(72, 11),
1617
+ Connection(11, 37),
1618
+ Connection(37, 72),
1619
+ Connection(121, 232),
1620
+ Connection(232, 120),
1621
+ Connection(120, 121),
1622
+ Connection(73, 72),
1623
+ Connection(72, 39),
1624
+ Connection(39, 73),
1625
+ Connection(114, 128),
1626
+ Connection(128, 47),
1627
+ Connection(47, 114),
1628
+ Connection(233, 232),
1629
+ Connection(232, 128),
1630
+ Connection(128, 233),
1631
+ Connection(103, 104),
1632
+ Connection(104, 67),
1633
+ Connection(67, 103),
1634
+ Connection(152, 175),
1635
+ Connection(175, 148),
1636
+ Connection(148, 152),
1637
+ Connection(119, 118),
1638
+ Connection(118, 101),
1639
+ Connection(101, 119),
1640
+ Connection(74, 73),
1641
+ Connection(73, 40),
1642
+ Connection(40, 74),
1643
+ Connection(107, 9),
1644
+ Connection(9, 108),
1645
+ Connection(108, 107),
1646
+ Connection(49, 48),
1647
+ Connection(48, 131),
1648
+ Connection(131, 49),
1649
+ Connection(32, 194),
1650
+ Connection(194, 211),
1651
+ Connection(211, 32),
1652
+ Connection(184, 74),
1653
+ Connection(74, 185),
1654
+ Connection(185, 184),
1655
+ Connection(191, 80),
1656
+ Connection(80, 183),
1657
+ Connection(183, 191),
1658
+ Connection(185, 40),
1659
+ Connection(40, 186),
1660
+ Connection(186, 185),
1661
+ Connection(119, 230),
1662
+ Connection(230, 118),
1663
+ Connection(118, 119),
1664
+ Connection(210, 202),
1665
+ Connection(202, 214),
1666
+ Connection(214, 210),
1667
+ Connection(84, 83),
1668
+ Connection(83, 17),
1669
+ Connection(17, 84),
1670
+ Connection(77, 76),
1671
+ Connection(76, 146),
1672
+ Connection(146, 77),
1673
+ Connection(161, 160),
1674
+ Connection(160, 30),
1675
+ Connection(30, 161),
1676
+ Connection(190, 56),
1677
+ Connection(56, 173),
1678
+ Connection(173, 190),
1679
+ Connection(182, 106),
1680
+ Connection(106, 194),
1681
+ Connection(194, 182),
1682
+ Connection(138, 135),
1683
+ Connection(135, 192),
1684
+ Connection(192, 138),
1685
+ Connection(129, 203),
1686
+ Connection(203, 98),
1687
+ Connection(98, 129),
1688
+ Connection(54, 21),
1689
+ Connection(21, 68),
1690
+ Connection(68, 54),
1691
+ Connection(5, 51),
1692
+ Connection(51, 4),
1693
+ Connection(4, 5),
1694
+ Connection(145, 144),
1695
+ Connection(144, 23),
1696
+ Connection(23, 145),
1697
+ Connection(90, 77),
1698
+ Connection(77, 91),
1699
+ Connection(91, 90),
1700
+ Connection(207, 205),
1701
+ Connection(205, 187),
1702
+ Connection(187, 207),
1703
+ Connection(83, 201),
1704
+ Connection(201, 18),
1705
+ Connection(18, 83),
1706
+ Connection(181, 91),
1707
+ Connection(91, 182),
1708
+ Connection(182, 181),
1709
+ Connection(180, 90),
1710
+ Connection(90, 181),
1711
+ Connection(181, 180),
1712
+ Connection(16, 85),
1713
+ Connection(85, 17),
1714
+ Connection(17, 16),
1715
+ Connection(205, 206),
1716
+ Connection(206, 36),
1717
+ Connection(36, 205),
1718
+ Connection(176, 148),
1719
+ Connection(148, 140),
1720
+ Connection(140, 176),
1721
+ Connection(165, 92),
1722
+ Connection(92, 39),
1723
+ Connection(39, 165),
1724
+ Connection(245, 193),
1725
+ Connection(193, 244),
1726
+ Connection(244, 245),
1727
+ Connection(27, 159),
1728
+ Connection(159, 28),
1729
+ Connection(28, 27),
1730
+ Connection(30, 247),
1731
+ Connection(247, 161),
1732
+ Connection(161, 30),
1733
+ Connection(174, 236),
1734
+ Connection(236, 196),
1735
+ Connection(196, 174),
1736
+ Connection(103, 54),
1737
+ Connection(54, 104),
1738
+ Connection(104, 103),
1739
+ Connection(55, 193),
1740
+ Connection(193, 8),
1741
+ Connection(8, 55),
1742
+ Connection(111, 117),
1743
+ Connection(117, 31),
1744
+ Connection(31, 111),
1745
+ Connection(221, 189),
1746
+ Connection(189, 55),
1747
+ Connection(55, 221),
1748
+ Connection(240, 98),
1749
+ Connection(98, 99),
1750
+ Connection(99, 240),
1751
+ Connection(142, 126),
1752
+ Connection(126, 100),
1753
+ Connection(100, 142),
1754
+ Connection(219, 166),
1755
+ Connection(166, 218),
1756
+ Connection(218, 219),
1757
+ Connection(112, 155),
1758
+ Connection(155, 26),
1759
+ Connection(26, 112),
1760
+ Connection(198, 209),
1761
+ Connection(209, 131),
1762
+ Connection(131, 198),
1763
+ Connection(169, 135),
1764
+ Connection(135, 150),
1765
+ Connection(150, 169),
1766
+ Connection(114, 47),
1767
+ Connection(47, 217),
1768
+ Connection(217, 114),
1769
+ Connection(224, 223),
1770
+ Connection(223, 53),
1771
+ Connection(53, 224),
1772
+ Connection(220, 45),
1773
+ Connection(45, 134),
1774
+ Connection(134, 220),
1775
+ Connection(32, 211),
1776
+ Connection(211, 140),
1777
+ Connection(140, 32),
1778
+ Connection(109, 67),
1779
+ Connection(67, 108),
1780
+ Connection(108, 109),
1781
+ Connection(146, 43),
1782
+ Connection(43, 91),
1783
+ Connection(91, 146),
1784
+ Connection(231, 230),
1785
+ Connection(230, 120),
1786
+ Connection(120, 231),
1787
+ Connection(113, 226),
1788
+ Connection(226, 247),
1789
+ Connection(247, 113),
1790
+ Connection(105, 63),
1791
+ Connection(63, 52),
1792
+ Connection(52, 105),
1793
+ Connection(241, 238),
1794
+ Connection(238, 242),
1795
+ Connection(242, 241),
1796
+ Connection(124, 46),
1797
+ Connection(46, 156),
1798
+ Connection(156, 124),
1799
+ Connection(95, 78),
1800
+ Connection(78, 96),
1801
+ Connection(96, 95),
1802
+ Connection(70, 46),
1803
+ Connection(46, 63),
1804
+ Connection(63, 70),
1805
+ Connection(116, 143),
1806
+ Connection(143, 227),
1807
+ Connection(227, 116),
1808
+ Connection(116, 123),
1809
+ Connection(123, 111),
1810
+ Connection(111, 116),
1811
+ Connection(1, 44),
1812
+ Connection(44, 19),
1813
+ Connection(19, 1),
1814
+ Connection(3, 236),
1815
+ Connection(236, 51),
1816
+ Connection(51, 3),
1817
+ Connection(207, 216),
1818
+ Connection(216, 205),
1819
+ Connection(205, 207),
1820
+ Connection(26, 154),
1821
+ Connection(154, 22),
1822
+ Connection(22, 26),
1823
+ Connection(165, 39),
1824
+ Connection(39, 167),
1825
+ Connection(167, 165),
1826
+ Connection(199, 200),
1827
+ Connection(200, 208),
1828
+ Connection(208, 199),
1829
+ Connection(101, 36),
1830
+ Connection(36, 100),
1831
+ Connection(100, 101),
1832
+ Connection(43, 57),
1833
+ Connection(57, 202),
1834
+ Connection(202, 43),
1835
+ Connection(242, 20),
1836
+ Connection(20, 99),
1837
+ Connection(99, 242),
1838
+ Connection(56, 28),
1839
+ Connection(28, 157),
1840
+ Connection(157, 56),
1841
+ Connection(124, 35),
1842
+ Connection(35, 113),
1843
+ Connection(113, 124),
1844
+ Connection(29, 160),
1845
+ Connection(160, 27),
1846
+ Connection(27, 29),
1847
+ Connection(211, 204),
1848
+ Connection(204, 210),
1849
+ Connection(210, 211),
1850
+ Connection(124, 113),
1851
+ Connection(113, 46),
1852
+ Connection(46, 124),
1853
+ Connection(106, 43),
1854
+ Connection(43, 204),
1855
+ Connection(204, 106),
1856
+ Connection(96, 62),
1857
+ Connection(62, 77),
1858
+ Connection(77, 96),
1859
+ Connection(227, 137),
1860
+ Connection(137, 116),
1861
+ Connection(116, 227),
1862
+ Connection(73, 41),
1863
+ Connection(41, 72),
1864
+ Connection(72, 73),
1865
+ Connection(36, 203),
1866
+ Connection(203, 142),
1867
+ Connection(142, 36),
1868
+ Connection(235, 64),
1869
+ Connection(64, 240),
1870
+ Connection(240, 235),
1871
+ Connection(48, 49),
1872
+ Connection(49, 64),
1873
+ Connection(64, 48),
1874
+ Connection(42, 41),
1875
+ Connection(41, 74),
1876
+ Connection(74, 42),
1877
+ Connection(214, 212),
1878
+ Connection(212, 207),
1879
+ Connection(207, 214),
1880
+ Connection(183, 42),
1881
+ Connection(42, 184),
1882
+ Connection(184, 183),
1883
+ Connection(210, 169),
1884
+ Connection(169, 211),
1885
+ Connection(211, 210),
1886
+ Connection(140, 170),
1887
+ Connection(170, 176),
1888
+ Connection(176, 140),
1889
+ Connection(104, 105),
1890
+ Connection(105, 69),
1891
+ Connection(69, 104),
1892
+ Connection(193, 122),
1893
+ Connection(122, 168),
1894
+ Connection(168, 193),
1895
+ Connection(50, 123),
1896
+ Connection(123, 187),
1897
+ Connection(187, 50),
1898
+ Connection(89, 96),
1899
+ Connection(96, 90),
1900
+ Connection(90, 89),
1901
+ Connection(66, 65),
1902
+ Connection(65, 107),
1903
+ Connection(107, 66),
1904
+ Connection(179, 89),
1905
+ Connection(89, 180),
1906
+ Connection(180, 179),
1907
+ Connection(119, 101),
1908
+ Connection(101, 120),
1909
+ Connection(120, 119),
1910
+ Connection(68, 63),
1911
+ Connection(63, 104),
1912
+ Connection(104, 68),
1913
+ Connection(234, 93),
1914
+ Connection(93, 227),
1915
+ Connection(227, 234),
1916
+ Connection(16, 15),
1917
+ Connection(15, 85),
1918
+ Connection(85, 16),
1919
+ Connection(209, 129),
1920
+ Connection(129, 49),
1921
+ Connection(49, 209),
1922
+ Connection(15, 14),
1923
+ Connection(14, 86),
1924
+ Connection(86, 15),
1925
+ Connection(107, 55),
1926
+ Connection(55, 9),
1927
+ Connection(9, 107),
1928
+ Connection(120, 100),
1929
+ Connection(100, 121),
1930
+ Connection(121, 120),
1931
+ Connection(153, 145),
1932
+ Connection(145, 22),
1933
+ Connection(22, 153),
1934
+ Connection(178, 88),
1935
+ Connection(88, 179),
1936
+ Connection(179, 178),
1937
+ Connection(197, 6),
1938
+ Connection(6, 196),
1939
+ Connection(196, 197),
1940
+ Connection(89, 88),
1941
+ Connection(88, 96),
1942
+ Connection(96, 89),
1943
+ Connection(135, 138),
1944
+ Connection(138, 136),
1945
+ Connection(136, 135),
1946
+ Connection(138, 215),
1947
+ Connection(215, 172),
1948
+ Connection(172, 138),
1949
+ Connection(218, 115),
1950
+ Connection(115, 219),
1951
+ Connection(219, 218),
1952
+ Connection(41, 42),
1953
+ Connection(42, 81),
1954
+ Connection(81, 41),
1955
+ Connection(5, 195),
1956
+ Connection(195, 51),
1957
+ Connection(51, 5),
1958
+ Connection(57, 43),
1959
+ Connection(43, 61),
1960
+ Connection(61, 57),
1961
+ Connection(208, 171),
1962
+ Connection(171, 199),
1963
+ Connection(199, 208),
1964
+ Connection(41, 81),
1965
+ Connection(81, 38),
1966
+ Connection(38, 41),
1967
+ Connection(224, 53),
1968
+ Connection(53, 225),
1969
+ Connection(225, 224),
1970
+ Connection(24, 144),
1971
+ Connection(144, 110),
1972
+ Connection(110, 24),
1973
+ Connection(105, 52),
1974
+ Connection(52, 66),
1975
+ Connection(66, 105),
1976
+ Connection(118, 229),
1977
+ Connection(229, 117),
1978
+ Connection(117, 118),
1979
+ Connection(227, 34),
1980
+ Connection(34, 234),
1981
+ Connection(234, 227),
1982
+ Connection(66, 107),
1983
+ Connection(107, 69),
1984
+ Connection(69, 66),
1985
+ Connection(10, 109),
1986
+ Connection(109, 151),
1987
+ Connection(151, 10),
1988
+ Connection(219, 48),
1989
+ Connection(48, 235),
1990
+ Connection(235, 219),
1991
+ Connection(183, 62),
1992
+ Connection(62, 191),
1993
+ Connection(191, 183),
1994
+ Connection(142, 129),
1995
+ Connection(129, 126),
1996
+ Connection(126, 142),
1997
+ Connection(116, 111),
1998
+ Connection(111, 143),
1999
+ Connection(143, 116),
2000
+ Connection(118, 117),
2001
+ Connection(117, 50),
2002
+ Connection(50, 118),
2003
+ Connection(223, 222),
2004
+ Connection(222, 52),
2005
+ Connection(52, 223),
2006
+ Connection(94, 19),
2007
+ Connection(19, 141),
2008
+ Connection(141, 94),
2009
+ Connection(222, 221),
2010
+ Connection(221, 65),
2011
+ Connection(65, 222),
2012
+ Connection(196, 3),
2013
+ Connection(3, 197),
2014
+ Connection(197, 196),
2015
+ Connection(45, 220),
2016
+ Connection(220, 44),
2017
+ Connection(44, 45),
2018
+ Connection(156, 70),
2019
+ Connection(70, 139),
2020
+ Connection(139, 156),
2021
+ Connection(188, 122),
2022
+ Connection(122, 245),
2023
+ Connection(245, 188),
2024
+ Connection(139, 71),
2025
+ Connection(71, 162),
2026
+ Connection(162, 139),
2027
+ Connection(149, 170),
2028
+ Connection(170, 150),
2029
+ Connection(150, 149),
2030
+ Connection(122, 188),
2031
+ Connection(188, 196),
2032
+ Connection(196, 122),
2033
+ Connection(206, 216),
2034
+ Connection(216, 92),
2035
+ Connection(92, 206),
2036
+ Connection(164, 2),
2037
+ Connection(2, 167),
2038
+ Connection(167, 164),
2039
+ Connection(242, 141),
2040
+ Connection(141, 241),
2041
+ Connection(241, 242),
2042
+ Connection(0, 164),
2043
+ Connection(164, 37),
2044
+ Connection(37, 0),
2045
+ Connection(11, 72),
2046
+ Connection(72, 12),
2047
+ Connection(12, 11),
2048
+ Connection(12, 38),
2049
+ Connection(38, 13),
2050
+ Connection(13, 12),
2051
+ Connection(70, 63),
2052
+ Connection(63, 71),
2053
+ Connection(71, 70),
2054
+ Connection(31, 226),
2055
+ Connection(226, 111),
2056
+ Connection(111, 31),
2057
+ Connection(36, 101),
2058
+ Connection(101, 205),
2059
+ Connection(205, 36),
2060
+ Connection(203, 206),
2061
+ Connection(206, 165),
2062
+ Connection(165, 203),
2063
+ Connection(126, 209),
2064
+ Connection(209, 217),
2065
+ Connection(217, 126),
2066
+ Connection(98, 165),
2067
+ Connection(165, 97),
2068
+ Connection(97, 98),
2069
+ Connection(237, 220),
2070
+ Connection(220, 218),
2071
+ Connection(218, 237),
2072
+ Connection(237, 239),
2073
+ Connection(239, 241),
2074
+ Connection(241, 237),
2075
+ Connection(210, 214),
2076
+ Connection(214, 169),
2077
+ Connection(169, 210),
2078
+ Connection(140, 171),
2079
+ Connection(171, 32),
2080
+ Connection(32, 140),
2081
+ Connection(241, 125),
2082
+ Connection(125, 237),
2083
+ Connection(237, 241),
2084
+ Connection(179, 86),
2085
+ Connection(86, 178),
2086
+ Connection(178, 179),
2087
+ Connection(180, 85),
2088
+ Connection(85, 179),
2089
+ Connection(179, 180),
2090
+ Connection(181, 84),
2091
+ Connection(84, 180),
2092
+ Connection(180, 181),
2093
+ Connection(182, 83),
2094
+ Connection(83, 181),
2095
+ Connection(181, 182),
2096
+ Connection(194, 201),
2097
+ Connection(201, 182),
2098
+ Connection(182, 194),
2099
+ Connection(177, 137),
2100
+ Connection(137, 132),
2101
+ Connection(132, 177),
2102
+ Connection(184, 76),
2103
+ Connection(76, 183),
2104
+ Connection(183, 184),
2105
+ Connection(185, 61),
2106
+ Connection(61, 184),
2107
+ Connection(184, 185),
2108
+ Connection(186, 57),
2109
+ Connection(57, 185),
2110
+ Connection(185, 186),
2111
+ Connection(216, 212),
2112
+ Connection(212, 186),
2113
+ Connection(186, 216),
2114
+ Connection(192, 214),
2115
+ Connection(214, 187),
2116
+ Connection(187, 192),
2117
+ Connection(139, 34),
2118
+ Connection(34, 156),
2119
+ Connection(156, 139),
2120
+ Connection(218, 79),
2121
+ Connection(79, 237),
2122
+ Connection(237, 218),
2123
+ Connection(147, 123),
2124
+ Connection(123, 177),
2125
+ Connection(177, 147),
2126
+ Connection(45, 44),
2127
+ Connection(44, 4),
2128
+ Connection(4, 45),
2129
+ Connection(208, 201),
2130
+ Connection(201, 32),
2131
+ Connection(32, 208),
2132
+ Connection(98, 64),
2133
+ Connection(64, 129),
2134
+ Connection(129, 98),
2135
+ Connection(192, 213),
2136
+ Connection(213, 138),
2137
+ Connection(138, 192),
2138
+ Connection(235, 59),
2139
+ Connection(59, 219),
2140
+ Connection(219, 235),
2141
+ Connection(141, 242),
2142
+ Connection(242, 97),
2143
+ Connection(97, 141),
2144
+ Connection(97, 2),
2145
+ Connection(2, 141),
2146
+ Connection(141, 97),
2147
+ Connection(240, 75),
2148
+ Connection(75, 235),
2149
+ Connection(235, 240),
2150
+ Connection(229, 24),
2151
+ Connection(24, 228),
2152
+ Connection(228, 229),
2153
+ Connection(31, 25),
2154
+ Connection(25, 226),
2155
+ Connection(226, 31),
2156
+ Connection(230, 23),
2157
+ Connection(23, 229),
2158
+ Connection(229, 230),
2159
+ Connection(231, 22),
2160
+ Connection(22, 230),
2161
+ Connection(230, 231),
2162
+ Connection(232, 26),
2163
+ Connection(26, 231),
2164
+ Connection(231, 232),
2165
+ Connection(233, 112),
2166
+ Connection(112, 232),
2167
+ Connection(232, 233),
2168
+ Connection(244, 189),
2169
+ Connection(189, 243),
2170
+ Connection(243, 244),
2171
+ Connection(189, 221),
2172
+ Connection(221, 190),
2173
+ Connection(190, 189),
2174
+ Connection(222, 28),
2175
+ Connection(28, 221),
2176
+ Connection(221, 222),
2177
+ Connection(223, 27),
2178
+ Connection(27, 222),
2179
+ Connection(222, 223),
2180
+ Connection(224, 29),
2181
+ Connection(29, 223),
2182
+ Connection(223, 224),
2183
+ Connection(225, 30),
2184
+ Connection(30, 224),
2185
+ Connection(224, 225),
2186
+ Connection(113, 247),
2187
+ Connection(247, 225),
2188
+ Connection(225, 113),
2189
+ Connection(99, 60),
2190
+ Connection(60, 240),
2191
+ Connection(240, 99),
2192
+ Connection(213, 147),
2193
+ Connection(147, 215),
2194
+ Connection(215, 213),
2195
+ Connection(60, 20),
2196
+ Connection(20, 166),
2197
+ Connection(166, 60),
2198
+ Connection(192, 187),
2199
+ Connection(187, 213),
2200
+ Connection(213, 192),
2201
+ Connection(243, 112),
2202
+ Connection(112, 244),
2203
+ Connection(244, 243),
2204
+ Connection(244, 233),
2205
+ Connection(233, 245),
2206
+ Connection(245, 244),
2207
+ Connection(245, 128),
2208
+ Connection(128, 188),
2209
+ Connection(188, 245),
2210
+ Connection(188, 114),
2211
+ Connection(114, 174),
2212
+ Connection(174, 188),
2213
+ Connection(134, 131),
2214
+ Connection(131, 220),
2215
+ Connection(220, 134),
2216
+ Connection(174, 217),
2217
+ Connection(217, 236),
2218
+ Connection(236, 174),
2219
+ Connection(236, 198),
2220
+ Connection(198, 134),
2221
+ Connection(134, 236),
2222
+ Connection(215, 177),
2223
+ Connection(177, 58),
2224
+ Connection(58, 215),
2225
+ Connection(156, 143),
2226
+ Connection(143, 124),
2227
+ Connection(124, 156),
2228
+ Connection(25, 110),
2229
+ Connection(110, 7),
2230
+ Connection(7, 25),
2231
+ Connection(31, 228),
2232
+ Connection(228, 25),
2233
+ Connection(25, 31),
2234
+ Connection(264, 356),
2235
+ Connection(356, 368),
2236
+ Connection(368, 264),
2237
+ Connection(0, 11),
2238
+ Connection(11, 267),
2239
+ Connection(267, 0),
2240
+ Connection(451, 452),
2241
+ Connection(452, 349),
2242
+ Connection(349, 451),
2243
+ Connection(267, 302),
2244
+ Connection(302, 269),
2245
+ Connection(269, 267),
2246
+ Connection(350, 357),
2247
+ Connection(357, 277),
2248
+ Connection(277, 350),
2249
+ Connection(350, 452),
2250
+ Connection(452, 357),
2251
+ Connection(357, 350),
2252
+ Connection(299, 333),
2253
+ Connection(333, 297),
2254
+ Connection(297, 299),
2255
+ Connection(396, 175),
2256
+ Connection(175, 377),
2257
+ Connection(377, 396),
2258
+ Connection(280, 347),
2259
+ Connection(347, 330),
2260
+ Connection(330, 280),
2261
+ Connection(269, 303),
2262
+ Connection(303, 270),
2263
+ Connection(270, 269),
2264
+ Connection(151, 9),
2265
+ Connection(9, 337),
2266
+ Connection(337, 151),
2267
+ Connection(344, 278),
2268
+ Connection(278, 360),
2269
+ Connection(360, 344),
2270
+ Connection(424, 418),
2271
+ Connection(418, 431),
2272
+ Connection(431, 424),
2273
+ Connection(270, 304),
2274
+ Connection(304, 409),
2275
+ Connection(409, 270),
2276
+ Connection(272, 310),
2277
+ Connection(310, 407),
2278
+ Connection(407, 272),
2279
+ Connection(322, 270),
2280
+ Connection(270, 410),
2281
+ Connection(410, 322),
2282
+ Connection(449, 450),
2283
+ Connection(450, 347),
2284
+ Connection(347, 449),
2285
+ Connection(432, 422),
2286
+ Connection(422, 434),
2287
+ Connection(434, 432),
2288
+ Connection(18, 313),
2289
+ Connection(313, 17),
2290
+ Connection(17, 18),
2291
+ Connection(291, 306),
2292
+ Connection(306, 375),
2293
+ Connection(375, 291),
2294
+ Connection(259, 387),
2295
+ Connection(387, 260),
2296
+ Connection(260, 259),
2297
+ Connection(424, 335),
2298
+ Connection(335, 418),
2299
+ Connection(418, 424),
2300
+ Connection(434, 364),
2301
+ Connection(364, 416),
2302
+ Connection(416, 434),
2303
+ Connection(391, 423),
2304
+ Connection(423, 327),
2305
+ Connection(327, 391),
2306
+ Connection(301, 251),
2307
+ Connection(251, 298),
2308
+ Connection(298, 301),
2309
+ Connection(275, 281),
2310
+ Connection(281, 4),
2311
+ Connection(4, 275),
2312
+ Connection(254, 373),
2313
+ Connection(373, 253),
2314
+ Connection(253, 254),
2315
+ Connection(375, 307),
2316
+ Connection(307, 321),
2317
+ Connection(321, 375),
2318
+ Connection(280, 425),
2319
+ Connection(425, 411),
2320
+ Connection(411, 280),
2321
+ Connection(200, 421),
2322
+ Connection(421, 18),
2323
+ Connection(18, 200),
2324
+ Connection(335, 321),
2325
+ Connection(321, 406),
2326
+ Connection(406, 335),
2327
+ Connection(321, 320),
2328
+ Connection(320, 405),
2329
+ Connection(405, 321),
2330
+ Connection(314, 315),
2331
+ Connection(315, 17),
2332
+ Connection(17, 314),
2333
+ Connection(423, 426),
2334
+ Connection(426, 266),
2335
+ Connection(266, 423),
2336
+ Connection(396, 377),
2337
+ Connection(377, 369),
2338
+ Connection(369, 396),
2339
+ Connection(270, 322),
2340
+ Connection(322, 269),
2341
+ Connection(269, 270),
2342
+ Connection(413, 417),
2343
+ Connection(417, 464),
2344
+ Connection(464, 413),
2345
+ Connection(385, 386),
2346
+ Connection(386, 258),
2347
+ Connection(258, 385),
2348
+ Connection(248, 456),
2349
+ Connection(456, 419),
2350
+ Connection(419, 248),
2351
+ Connection(298, 284),
2352
+ Connection(284, 333),
2353
+ Connection(333, 298),
2354
+ Connection(168, 417),
2355
+ Connection(417, 8),
2356
+ Connection(8, 168),
2357
+ Connection(448, 346),
2358
+ Connection(346, 261),
2359
+ Connection(261, 448),
2360
+ Connection(417, 413),
2361
+ Connection(413, 285),
2362
+ Connection(285, 417),
2363
+ Connection(326, 327),
2364
+ Connection(327, 328),
2365
+ Connection(328, 326),
2366
+ Connection(277, 355),
2367
+ Connection(355, 329),
2368
+ Connection(329, 277),
2369
+ Connection(309, 392),
2370
+ Connection(392, 438),
2371
+ Connection(438, 309),
2372
+ Connection(381, 382),
2373
+ Connection(382, 256),
2374
+ Connection(256, 381),
2375
+ Connection(279, 429),
2376
+ Connection(429, 360),
2377
+ Connection(360, 279),
2378
+ Connection(365, 364),
2379
+ Connection(364, 379),
2380
+ Connection(379, 365),
2381
+ Connection(355, 277),
2382
+ Connection(277, 437),
2383
+ Connection(437, 355),
2384
+ Connection(282, 443),
2385
+ Connection(443, 283),
2386
+ Connection(283, 282),
2387
+ Connection(281, 275),
2388
+ Connection(275, 363),
2389
+ Connection(363, 281),
2390
+ Connection(395, 431),
2391
+ Connection(431, 369),
2392
+ Connection(369, 395),
2393
+ Connection(299, 297),
2394
+ Connection(297, 337),
2395
+ Connection(337, 299),
2396
+ Connection(335, 273),
2397
+ Connection(273, 321),
2398
+ Connection(321, 335),
2399
+ Connection(348, 450),
2400
+ Connection(450, 349),
2401
+ Connection(349, 348),
2402
+ Connection(359, 446),
2403
+ Connection(446, 467),
2404
+ Connection(467, 359),
2405
+ Connection(283, 293),
2406
+ Connection(293, 282),
2407
+ Connection(282, 283),
2408
+ Connection(250, 458),
2409
+ Connection(458, 462),
2410
+ Connection(462, 250),
2411
+ Connection(300, 276),
2412
+ Connection(276, 383),
2413
+ Connection(383, 300),
2414
+ Connection(292, 308),
2415
+ Connection(308, 325),
2416
+ Connection(325, 292),
2417
+ Connection(283, 276),
2418
+ Connection(276, 293),
2419
+ Connection(293, 283),
2420
+ Connection(264, 372),
2421
+ Connection(372, 447),
2422
+ Connection(447, 264),
2423
+ Connection(346, 352),
2424
+ Connection(352, 340),
2425
+ Connection(340, 346),
2426
+ Connection(354, 274),
2427
+ Connection(274, 19),
2428
+ Connection(19, 354),
2429
+ Connection(363, 456),
2430
+ Connection(456, 281),
2431
+ Connection(281, 363),
2432
+ Connection(426, 436),
2433
+ Connection(436, 425),
2434
+ Connection(425, 426),
2435
+ Connection(380, 381),
2436
+ Connection(381, 252),
2437
+ Connection(252, 380),
2438
+ Connection(267, 269),
2439
+ Connection(269, 393),
2440
+ Connection(393, 267),
2441
+ Connection(421, 200),
2442
+ Connection(200, 428),
2443
+ Connection(428, 421),
2444
+ Connection(371, 266),
2445
+ Connection(266, 329),
2446
+ Connection(329, 371),
2447
+ Connection(432, 287),
2448
+ Connection(287, 422),
2449
+ Connection(422, 432),
2450
+ Connection(290, 250),
2451
+ Connection(250, 328),
2452
+ Connection(328, 290),
2453
+ Connection(385, 258),
2454
+ Connection(258, 384),
2455
+ Connection(384, 385),
2456
+ Connection(446, 265),
2457
+ Connection(265, 342),
2458
+ Connection(342, 446),
2459
+ Connection(386, 387),
2460
+ Connection(387, 257),
2461
+ Connection(257, 386),
2462
+ Connection(422, 424),
2463
+ Connection(424, 430),
2464
+ Connection(430, 422),
2465
+ Connection(445, 342),
2466
+ Connection(342, 276),
2467
+ Connection(276, 445),
2468
+ Connection(422, 273),
2469
+ Connection(273, 424),
2470
+ Connection(424, 422),
2471
+ Connection(306, 292),
2472
+ Connection(292, 307),
2473
+ Connection(307, 306),
2474
+ Connection(352, 366),
2475
+ Connection(366, 345),
2476
+ Connection(345, 352),
2477
+ Connection(268, 271),
2478
+ Connection(271, 302),
2479
+ Connection(302, 268),
2480
+ Connection(358, 423),
2481
+ Connection(423, 371),
2482
+ Connection(371, 358),
2483
+ Connection(327, 294),
2484
+ Connection(294, 460),
2485
+ Connection(460, 327),
2486
+ Connection(331, 279),
2487
+ Connection(279, 294),
2488
+ Connection(294, 331),
2489
+ Connection(303, 271),
2490
+ Connection(271, 304),
2491
+ Connection(304, 303),
2492
+ Connection(436, 432),
2493
+ Connection(432, 427),
2494
+ Connection(427, 436),
2495
+ Connection(304, 272),
2496
+ Connection(272, 408),
2497
+ Connection(408, 304),
2498
+ Connection(395, 394),
2499
+ Connection(394, 431),
2500
+ Connection(431, 395),
2501
+ Connection(378, 395),
2502
+ Connection(395, 400),
2503
+ Connection(400, 378),
2504
+ Connection(296, 334),
2505
+ Connection(334, 299),
2506
+ Connection(299, 296),
2507
+ Connection(6, 351),
2508
+ Connection(351, 168),
2509
+ Connection(168, 6),
2510
+ Connection(376, 352),
2511
+ Connection(352, 411),
2512
+ Connection(411, 376),
2513
+ Connection(307, 325),
2514
+ Connection(325, 320),
2515
+ Connection(320, 307),
2516
+ Connection(285, 295),
2517
+ Connection(295, 336),
2518
+ Connection(336, 285),
2519
+ Connection(320, 319),
2520
+ Connection(319, 404),
2521
+ Connection(404, 320),
2522
+ Connection(329, 330),
2523
+ Connection(330, 349),
2524
+ Connection(349, 329),
2525
+ Connection(334, 293),
2526
+ Connection(293, 333),
2527
+ Connection(333, 334),
2528
+ Connection(366, 323),
2529
+ Connection(323, 447),
2530
+ Connection(447, 366),
2531
+ Connection(316, 15),
2532
+ Connection(15, 315),
2533
+ Connection(315, 316),
2534
+ Connection(331, 358),
2535
+ Connection(358, 279),
2536
+ Connection(279, 331),
2537
+ Connection(317, 14),
2538
+ Connection(14, 316),
2539
+ Connection(316, 317),
2540
+ Connection(8, 285),
2541
+ Connection(285, 9),
2542
+ Connection(9, 8),
2543
+ Connection(277, 329),
2544
+ Connection(329, 350),
2545
+ Connection(350, 277),
2546
+ Connection(253, 374),
2547
+ Connection(374, 252),
2548
+ Connection(252, 253),
2549
+ Connection(319, 318),
2550
+ Connection(318, 403),
2551
+ Connection(403, 319),
2552
+ Connection(351, 6),
2553
+ Connection(6, 419),
2554
+ Connection(419, 351),
2555
+ Connection(324, 318),
2556
+ Connection(318, 325),
2557
+ Connection(325, 324),
2558
+ Connection(397, 367),
2559
+ Connection(367, 365),
2560
+ Connection(365, 397),
2561
+ Connection(288, 435),
2562
+ Connection(435, 397),
2563
+ Connection(397, 288),
2564
+ Connection(278, 344),
2565
+ Connection(344, 439),
2566
+ Connection(439, 278),
2567
+ Connection(310, 272),
2568
+ Connection(272, 311),
2569
+ Connection(311, 310),
2570
+ Connection(248, 195),
2571
+ Connection(195, 281),
2572
+ Connection(281, 248),
2573
+ Connection(375, 273),
2574
+ Connection(273, 291),
2575
+ Connection(291, 375),
2576
+ Connection(175, 396),
2577
+ Connection(396, 199),
2578
+ Connection(199, 175),
2579
+ Connection(312, 311),
2580
+ Connection(311, 268),
2581
+ Connection(268, 312),
2582
+ Connection(276, 283),
2583
+ Connection(283, 445),
2584
+ Connection(445, 276),
2585
+ Connection(390, 373),
2586
+ Connection(373, 339),
2587
+ Connection(339, 390),
2588
+ Connection(295, 282),
2589
+ Connection(282, 296),
2590
+ Connection(296, 295),
2591
+ Connection(448, 449),
2592
+ Connection(449, 346),
2593
+ Connection(346, 448),
2594
+ Connection(356, 264),
2595
+ Connection(264, 454),
2596
+ Connection(454, 356),
2597
+ Connection(337, 336),
2598
+ Connection(336, 299),
2599
+ Connection(299, 337),
2600
+ Connection(337, 338),
2601
+ Connection(338, 151),
2602
+ Connection(151, 337),
2603
+ Connection(294, 278),
2604
+ Connection(278, 455),
2605
+ Connection(455, 294),
2606
+ Connection(308, 292),
2607
+ Connection(292, 415),
2608
+ Connection(415, 308),
2609
+ Connection(429, 358),
2610
+ Connection(358, 355),
2611
+ Connection(355, 429),
2612
+ Connection(265, 340),
2613
+ Connection(340, 372),
2614
+ Connection(372, 265),
2615
+ Connection(352, 346),
2616
+ Connection(346, 280),
2617
+ Connection(280, 352),
2618
+ Connection(295, 442),
2619
+ Connection(442, 282),
2620
+ Connection(282, 295),
2621
+ Connection(354, 19),
2622
+ Connection(19, 370),
2623
+ Connection(370, 354),
2624
+ Connection(285, 441),
2625
+ Connection(441, 295),
2626
+ Connection(295, 285),
2627
+ Connection(195, 248),
2628
+ Connection(248, 197),
2629
+ Connection(197, 195),
2630
+ Connection(457, 440),
2631
+ Connection(440, 274),
2632
+ Connection(274, 457),
2633
+ Connection(301, 300),
2634
+ Connection(300, 368),
2635
+ Connection(368, 301),
2636
+ Connection(417, 351),
2637
+ Connection(351, 465),
2638
+ Connection(465, 417),
2639
+ Connection(251, 301),
2640
+ Connection(301, 389),
2641
+ Connection(389, 251),
2642
+ Connection(394, 395),
2643
+ Connection(395, 379),
2644
+ Connection(379, 394),
2645
+ Connection(399, 412),
2646
+ Connection(412, 419),
2647
+ Connection(419, 399),
2648
+ Connection(410, 436),
2649
+ Connection(436, 322),
2650
+ Connection(322, 410),
2651
+ Connection(326, 2),
2652
+ Connection(2, 393),
2653
+ Connection(393, 326),
2654
+ Connection(354, 370),
2655
+ Connection(370, 461),
2656
+ Connection(461, 354),
2657
+ Connection(393, 164),
2658
+ Connection(164, 267),
2659
+ Connection(267, 393),
2660
+ Connection(268, 302),
2661
+ Connection(302, 12),
2662
+ Connection(12, 268),
2663
+ Connection(312, 268),
2664
+ Connection(268, 13),
2665
+ Connection(13, 312),
2666
+ Connection(298, 293),
2667
+ Connection(293, 301),
2668
+ Connection(301, 298),
2669
+ Connection(265, 446),
2670
+ Connection(446, 340),
2671
+ Connection(340, 265),
2672
+ Connection(280, 330),
2673
+ Connection(330, 425),
2674
+ Connection(425, 280),
2675
+ Connection(322, 426),
2676
+ Connection(426, 391),
2677
+ Connection(391, 322),
2678
+ Connection(420, 429),
2679
+ Connection(429, 437),
2680
+ Connection(437, 420),
2681
+ Connection(393, 391),
2682
+ Connection(391, 326),
2683
+ Connection(326, 393),
2684
+ Connection(344, 440),
2685
+ Connection(440, 438),
2686
+ Connection(438, 344),
2687
+ Connection(458, 459),
2688
+ Connection(459, 461),
2689
+ Connection(461, 458),
2690
+ Connection(364, 434),
2691
+ Connection(434, 394),
2692
+ Connection(394, 364),
2693
+ Connection(428, 396),
2694
+ Connection(396, 262),
2695
+ Connection(262, 428),
2696
+ Connection(274, 354),
2697
+ Connection(354, 457),
2698
+ Connection(457, 274),
2699
+ Connection(317, 316),
2700
+ Connection(316, 402),
2701
+ Connection(402, 317),
2702
+ Connection(316, 315),
2703
+ Connection(315, 403),
2704
+ Connection(403, 316),
2705
+ Connection(315, 314),
2706
+ Connection(314, 404),
2707
+ Connection(404, 315),
2708
+ Connection(314, 313),
2709
+ Connection(313, 405),
2710
+ Connection(405, 314),
2711
+ Connection(313, 421),
2712
+ Connection(421, 406),
2713
+ Connection(406, 313),
2714
+ Connection(323, 366),
2715
+ Connection(366, 361),
2716
+ Connection(361, 323),
2717
+ Connection(292, 306),
2718
+ Connection(306, 407),
2719
+ Connection(407, 292),
2720
+ Connection(306, 291),
2721
+ Connection(291, 408),
2722
+ Connection(408, 306),
2723
+ Connection(291, 287),
2724
+ Connection(287, 409),
2725
+ Connection(409, 291),
2726
+ Connection(287, 432),
2727
+ Connection(432, 410),
2728
+ Connection(410, 287),
2729
+ Connection(427, 434),
2730
+ Connection(434, 411),
2731
+ Connection(411, 427),
2732
+ Connection(372, 264),
2733
+ Connection(264, 383),
2734
+ Connection(383, 372),
2735
+ Connection(459, 309),
2736
+ Connection(309, 457),
2737
+ Connection(457, 459),
2738
+ Connection(366, 352),
2739
+ Connection(352, 401),
2740
+ Connection(401, 366),
2741
+ Connection(1, 274),
2742
+ Connection(274, 4),
2743
+ Connection(4, 1),
2744
+ Connection(418, 421),
2745
+ Connection(421, 262),
2746
+ Connection(262, 418),
2747
+ Connection(331, 294),
2748
+ Connection(294, 358),
2749
+ Connection(358, 331),
2750
+ Connection(435, 433),
2751
+ Connection(433, 367),
2752
+ Connection(367, 435),
2753
+ Connection(392, 289),
2754
+ Connection(289, 439),
2755
+ Connection(439, 392),
2756
+ Connection(328, 462),
2757
+ Connection(462, 326),
2758
+ Connection(326, 328),
2759
+ Connection(94, 2),
2760
+ Connection(2, 370),
2761
+ Connection(370, 94),
2762
+ Connection(289, 305),
2763
+ Connection(305, 455),
2764
+ Connection(455, 289),
2765
+ Connection(339, 254),
2766
+ Connection(254, 448),
2767
+ Connection(448, 339),
2768
+ Connection(359, 255),
2769
+ Connection(255, 446),
2770
+ Connection(446, 359),
2771
+ Connection(254, 253),
2772
+ Connection(253, 449),
2773
+ Connection(449, 254),
2774
+ Connection(253, 252),
2775
+ Connection(252, 450),
2776
+ Connection(450, 253),
2777
+ Connection(252, 256),
2778
+ Connection(256, 451),
2779
+ Connection(451, 252),
2780
+ Connection(256, 341),
2781
+ Connection(341, 452),
2782
+ Connection(452, 256),
2783
+ Connection(414, 413),
2784
+ Connection(413, 463),
2785
+ Connection(463, 414),
2786
+ Connection(286, 441),
2787
+ Connection(441, 414),
2788
+ Connection(414, 286),
2789
+ Connection(286, 258),
2790
+ Connection(258, 441),
2791
+ Connection(441, 286),
2792
+ Connection(258, 257),
2793
+ Connection(257, 442),
2794
+ Connection(442, 258),
2795
+ Connection(257, 259),
2796
+ Connection(259, 443),
2797
+ Connection(443, 257),
2798
+ Connection(259, 260),
2799
+ Connection(260, 444),
2800
+ Connection(444, 259),
2801
+ Connection(260, 467),
2802
+ Connection(467, 445),
2803
+ Connection(445, 260),
2804
+ Connection(309, 459),
2805
+ Connection(459, 250),
2806
+ Connection(250, 309),
2807
+ Connection(305, 289),
2808
+ Connection(289, 290),
2809
+ Connection(290, 305),
2810
+ Connection(305, 290),
2811
+ Connection(290, 460),
2812
+ Connection(460, 305),
2813
+ Connection(401, 376),
2814
+ Connection(376, 435),
2815
+ Connection(435, 401),
2816
+ Connection(309, 250),
2817
+ Connection(250, 392),
2818
+ Connection(392, 309),
2819
+ Connection(376, 411),
2820
+ Connection(411, 433),
2821
+ Connection(433, 376),
2822
+ Connection(453, 341),
2823
+ Connection(341, 464),
2824
+ Connection(464, 453),
2825
+ Connection(357, 453),
2826
+ Connection(453, 465),
2827
+ Connection(465, 357),
2828
+ Connection(343, 357),
2829
+ Connection(357, 412),
2830
+ Connection(412, 343),
2831
+ Connection(437, 343),
2832
+ Connection(343, 399),
2833
+ Connection(399, 437),
2834
+ Connection(344, 360),
2835
+ Connection(360, 440),
2836
+ Connection(440, 344),
2837
+ Connection(420, 437),
2838
+ Connection(437, 456),
2839
+ Connection(456, 420),
2840
+ Connection(360, 420),
2841
+ Connection(420, 363),
2842
+ Connection(363, 360),
2843
+ Connection(361, 401),
2844
+ Connection(401, 288),
2845
+ Connection(288, 361),
2846
+ Connection(265, 372),
2847
+ Connection(372, 353),
2848
+ Connection(353, 265),
2849
+ Connection(390, 339),
2850
+ Connection(339, 249),
2851
+ Connection(249, 390),
2852
+ Connection(339, 448),
2853
+ Connection(448, 255),
2854
+ Connection(255, 339),
2855
+ ]
2856
+
2857
+
2858
+ @dataclasses.dataclass
2859
+ class FaceLandmarkerResult:
2860
+ """The face landmarks detection result from FaceLandmarker, where each vector element represents a single face detected in the image.
2861
+
2862
+ Attributes:
2863
+ face_landmarks: Detected face landmarks in normalized image coordinates.
2864
+ face_blendshapes: Optional face blendshapes results.
2865
+ facial_transformation_matrixes: Optional facial transformation matrix.
2866
+ """
2867
+
2868
+ face_landmarks: List[List[landmark_module.NormalizedLandmark]]
2869
+ face_blendshapes: List[List[category_module.Category]]
2870
+ facial_transformation_matrixes: List[np.ndarray]
2871
+
2872
+
2873
+ def _build_landmarker_result(
2874
+ output_packets: Mapping[str, packet_module.Packet]
2875
+ ) -> FaceLandmarkerResult:
2876
+ """Constructs a `FaceLandmarkerResult` from output packets."""
2877
+ face_landmarks_proto_list = packet_getter.get_proto_list(
2878
+ output_packets[_NORM_LANDMARKS_STREAM_NAME]
2879
+ )
2880
+
2881
+ face_landmarks_results = []
2882
+ for proto in face_landmarks_proto_list:
2883
+ face_landmarks = landmark_pb2.NormalizedLandmarkList()
2884
+ face_landmarks.MergeFrom(proto)
2885
+ face_landmarks_list = []
2886
+ for face_landmark in face_landmarks.landmark:
2887
+ face_landmarks_list.append(
2888
+ landmark_module.NormalizedLandmark.create_from_pb2(face_landmark)
2889
+ )
2890
+ face_landmarks_results.append(face_landmarks_list)
2891
+
2892
+ face_blendshapes_results = []
2893
+ if _BLENDSHAPES_STREAM_NAME in output_packets:
2894
+ face_blendshapes_proto_list = packet_getter.get_proto_list(
2895
+ output_packets[_BLENDSHAPES_STREAM_NAME]
2896
+ )
2897
+ for proto in face_blendshapes_proto_list:
2898
+ face_blendshapes_categories = []
2899
+ face_blendshapes_classifications = classification_pb2.ClassificationList()
2900
+ face_blendshapes_classifications.MergeFrom(proto)
2901
+ for face_blendshapes in face_blendshapes_classifications.classification:
2902
+ face_blendshapes_categories.append(
2903
+ category_module.Category(
2904
+ index=face_blendshapes.index,
2905
+ score=face_blendshapes.score,
2906
+ display_name=face_blendshapes.display_name,
2907
+ category_name=face_blendshapes.label,
2908
+ )
2909
+ )
2910
+ face_blendshapes_results.append(face_blendshapes_categories)
2911
+
2912
+ facial_transformation_matrixes_results = []
2913
+ if _FACE_GEOMETRY_STREAM_NAME in output_packets:
2914
+ facial_transformation_matrixes_proto_list = packet_getter.get_proto_list(
2915
+ output_packets[_FACE_GEOMETRY_STREAM_NAME]
2916
+ )
2917
+ for proto in facial_transformation_matrixes_proto_list:
2918
+ if hasattr(proto, 'pose_transform_matrix'):
2919
+ matrix_data = matrix_data_pb2.MatrixData()
2920
+ matrix_data.MergeFrom(proto.pose_transform_matrix)
2921
+ matrix = np.array(matrix_data.packed_data)
2922
+ matrix = matrix.reshape((matrix_data.rows, matrix_data.cols))
2923
+ matrix = (
2924
+ matrix if matrix_data.layout == _LayoutEnum.ROW_MAJOR else matrix.T
2925
+ )
2926
+ facial_transformation_matrixes_results.append(matrix)
2927
+
2928
+ return FaceLandmarkerResult(
2929
+ face_landmarks_results,
2930
+ face_blendshapes_results,
2931
+ facial_transformation_matrixes_results,
2932
+ )
2933
+
2934
+ def _build_landmarker_result2(
2935
+ output_packets: Mapping[str, packet_module.Packet]
2936
+ ) -> FaceLandmarkerResult:
2937
+ """Constructs a `FaceLandmarkerResult` from output packets."""
2938
+ face_landmarks_proto_list = packet_getter.get_proto_list(
2939
+ output_packets[_NORM_LANDMARKS_STREAM_NAME]
2940
+ )
2941
+
2942
+ face_landmarks_results = []
2943
+ for proto in face_landmarks_proto_list:
2944
+ face_landmarks = landmark_pb2.NormalizedLandmarkList()
2945
+ face_landmarks.MergeFrom(proto)
2946
+ face_landmarks_list = []
2947
+ for face_landmark in face_landmarks.landmark:
2948
+ face_landmarks_list.append(
2949
+ landmark_module.NormalizedLandmark.create_from_pb2(face_landmark)
2950
+ )
2951
+ face_landmarks_results.append(face_landmarks_list)
2952
+
2953
+ face_blendshapes_results = []
2954
+ if _BLENDSHAPES_STREAM_NAME in output_packets:
2955
+ face_blendshapes_proto_list = packet_getter.get_proto_list(
2956
+ output_packets[_BLENDSHAPES_STREAM_NAME]
2957
+ )
2958
+ for proto in face_blendshapes_proto_list:
2959
+ face_blendshapes_categories = []
2960
+ face_blendshapes_classifications = classification_pb2.ClassificationList()
2961
+ face_blendshapes_classifications.MergeFrom(proto)
2962
+ for face_blendshapes in face_blendshapes_classifications.classification:
2963
+ face_blendshapes_categories.append(
2964
+ category_module.Category(
2965
+ index=face_blendshapes.index,
2966
+ score=face_blendshapes.score,
2967
+ display_name=face_blendshapes.display_name,
2968
+ category_name=face_blendshapes.label,
2969
+ )
2970
+ )
2971
+ face_blendshapes_results.append(face_blendshapes_categories)
2972
+
2973
+ facial_transformation_matrixes_results = []
2974
+ if _FACE_GEOMETRY_STREAM_NAME in output_packets:
2975
+ facial_transformation_matrixes_proto_list = packet_getter.get_proto_list(
2976
+ output_packets[_FACE_GEOMETRY_STREAM_NAME]
2977
+ )
2978
+ for proto in facial_transformation_matrixes_proto_list:
2979
+ if hasattr(proto, 'pose_transform_matrix'):
2980
+ matrix_data = matrix_data_pb2.MatrixData()
2981
+ matrix_data.MergeFrom(proto.pose_transform_matrix)
2982
+ matrix = np.array(matrix_data.packed_data)
2983
+ matrix = matrix.reshape((matrix_data.rows, matrix_data.cols))
2984
+ matrix = (
2985
+ matrix if matrix_data.layout == _LayoutEnum.ROW_MAJOR else matrix.T
2986
+ )
2987
+ facial_transformation_matrixes_results.append(matrix)
2988
+
2989
+ return FaceLandmarkerResult(
2990
+ face_landmarks_results,
2991
+ face_blendshapes_results,
2992
+ facial_transformation_matrixes_results,
2993
+ ), facial_transformation_matrixes_proto_list[0].mesh
2994
+
2995
+ @dataclasses.dataclass
2996
+ class FaceLandmarkerOptions:
2997
+ """Options for the face landmarker task.
2998
+
2999
+ Attributes:
3000
+ base_options: Base options for the face landmarker task.
3001
+ running_mode: The running mode of the task. Default to the image mode.
3002
+ FaceLandmarker has three running modes: 1) The image mode for detecting
3003
+ face landmarks on single image inputs. 2) The video mode for detecting
3004
+ face landmarks on the decoded frames of a video. 3) The live stream mode
3005
+ for detecting face landmarks on the live stream of input data, such as
3006
+ from camera. In this mode, the "result_callback" below must be specified
3007
+ to receive the detection results asynchronously.
3008
+ num_faces: The maximum number of faces that can be detected by the
3009
+ FaceLandmarker.
3010
+ min_face_detection_confidence: The minimum confidence score for the face
3011
+ detection to be considered successful.
3012
+ min_face_presence_confidence: The minimum confidence score of face presence
3013
+ score in the face landmark detection.
3014
+ min_tracking_confidence: The minimum confidence score for the face tracking
3015
+ to be considered successful.
3016
+ output_face_blendshapes: Whether FaceLandmarker outputs face blendshapes
3017
+ classification. Face blendshapes are used for rendering the 3D face model.
3018
+ output_facial_transformation_matrixes: Whether FaceLandmarker outputs facial
3019
+ transformation_matrix. Facial transformation matrix is used to transform
3020
+ the face landmarks in canonical face to the detected face, so that users
3021
+ can apply face effects on the detected landmarks.
3022
+ result_callback: The user-defined result callback for processing live stream
3023
+ data. The result callback should only be specified when the running mode
3024
+ is set to the live stream mode.
3025
+ """
3026
+
3027
+ base_options: _BaseOptions
3028
+ running_mode: _RunningMode = _RunningMode.IMAGE
3029
+ num_faces: int = 1
3030
+ min_face_detection_confidence: float = 0.5
3031
+ min_face_presence_confidence: float = 0.5
3032
+ min_tracking_confidence: float = 0.5
3033
+ output_face_blendshapes: bool = False
3034
+ output_facial_transformation_matrixes: bool = False
3035
+ result_callback: Optional[
3036
+ Callable[[FaceLandmarkerResult, image_module.Image, int], None]
3037
+ ] = None
3038
+
3039
+ @doc_controls.do_not_generate_docs
3040
+ def to_pb2(self) -> _FaceLandmarkerGraphOptionsProto:
3041
+ """Generates an FaceLandmarkerGraphOptions protobuf object."""
3042
+ base_options_proto = self.base_options.to_pb2()
3043
+ base_options_proto.use_stream_mode = (
3044
+ False if self.running_mode == _RunningMode.IMAGE else True
3045
+ )
3046
+
3047
+ # Initialize the face landmarker options from base options.
3048
+ face_landmarker_options_proto = _FaceLandmarkerGraphOptionsProto(
3049
+ base_options=base_options_proto
3050
+ )
3051
+
3052
+ # Configure face detector options.
3053
+ face_landmarker_options_proto.face_detector_graph_options.num_faces = (
3054
+ self.num_faces
3055
+ )
3056
+ face_landmarker_options_proto.face_detector_graph_options.min_detection_confidence = (
3057
+ self.min_face_detection_confidence
3058
+ )
3059
+
3060
+ # Configure face landmark detector options.
3061
+ face_landmarker_options_proto.min_tracking_confidence = (
3062
+ self.min_tracking_confidence
3063
+ )
3064
+ face_landmarker_options_proto.face_landmarks_detector_graph_options.min_detection_confidence = (
3065
+ self.min_face_detection_confidence
3066
+ )
3067
+ return face_landmarker_options_proto
3068
+
3069
+
3070
+ class FaceLandmarker(base_vision_task_api.BaseVisionTaskApi):
3071
+ """Class that performs face landmarks detection on images."""
3072
+
3073
+ @classmethod
3074
+ def create_from_model_path(cls, model_path: str) -> 'FaceLandmarker':
3075
+ """Creates an `FaceLandmarker` object from a TensorFlow Lite model and the default `FaceLandmarkerOptions`.
3076
+
3077
+ Note that the created `FaceLandmarker` instance is in image mode, for
3078
+ detecting face landmarks on single image inputs.
3079
+
3080
+ Args:
3081
+ model_path: Path to the model.
3082
+
3083
+ Returns:
3084
+ `FaceLandmarker` object that's created from the model file and the
3085
+ default `FaceLandmarkerOptions`.
3086
+
3087
+ Raises:
3088
+ ValueError: If failed to create `FaceLandmarker` object from the
3089
+ provided file such as invalid file path.
3090
+ RuntimeError: If other types of error occurred.
3091
+ """
3092
+ base_options = _BaseOptions(model_asset_path=model_path)
3093
+ options = FaceLandmarkerOptions(
3094
+ base_options=base_options, running_mode=_RunningMode.IMAGE
3095
+ )
3096
+ return cls.create_from_options(options)
3097
+
3098
+ @classmethod
3099
+ def create_from_options(
3100
+ cls, options: FaceLandmarkerOptions
3101
+ ) -> 'FaceLandmarker':
3102
+ """Creates the `FaceLandmarker` object from face landmarker options.
3103
+
3104
+ Args:
3105
+ options: Options for the face landmarker task.
3106
+
3107
+ Returns:
3108
+ `FaceLandmarker` object that's created from `options`.
3109
+
3110
+ Raises:
3111
+ ValueError: If failed to create `FaceLandmarker` object from
3112
+ `FaceLandmarkerOptions` such as missing the model.
3113
+ RuntimeError: If other types of error occurred.
3114
+ """
3115
+
3116
+ def packets_callback(output_packets: Mapping[str, packet_module.Packet]):
3117
+ if output_packets[_IMAGE_OUT_STREAM_NAME].is_empty():
3118
+ return
3119
+
3120
+ image = packet_getter.get_image(output_packets[_IMAGE_OUT_STREAM_NAME])
3121
+ if output_packets[_IMAGE_OUT_STREAM_NAME].is_empty():
3122
+ return
3123
+
3124
+ if output_packets[_NORM_LANDMARKS_STREAM_NAME].is_empty():
3125
+ empty_packet = output_packets[_NORM_LANDMARKS_STREAM_NAME]
3126
+ options.result_callback(
3127
+ FaceLandmarkerResult([], [], []),
3128
+ image,
3129
+ empty_packet.timestamp.value // _MICRO_SECONDS_PER_MILLISECOND,
3130
+ )
3131
+ return
3132
+
3133
+ face_landmarks_result = _build_landmarker_result(output_packets)
3134
+ timestamp = output_packets[_NORM_LANDMARKS_STREAM_NAME].timestamp
3135
+ options.result_callback(
3136
+ face_landmarks_result,
3137
+ image,
3138
+ timestamp.value // _MICRO_SECONDS_PER_MILLISECOND,
3139
+ )
3140
+
3141
+ output_streams = [
3142
+ ':'.join([_NORM_LANDMARKS_TAG, _NORM_LANDMARKS_STREAM_NAME]),
3143
+ ':'.join([_IMAGE_TAG, _IMAGE_OUT_STREAM_NAME]),
3144
+ ]
3145
+
3146
+ if options.output_face_blendshapes:
3147
+ output_streams.append(
3148
+ ':'.join([_BLENDSHAPES_TAG, _BLENDSHAPES_STREAM_NAME])
3149
+ )
3150
+ if options.output_facial_transformation_matrixes:
3151
+ output_streams.append(
3152
+ ':'.join([_FACE_GEOMETRY_TAG, _FACE_GEOMETRY_STREAM_NAME])
3153
+ )
3154
+
3155
+ task_info = _TaskInfo(
3156
+ task_graph=_TASK_GRAPH_NAME,
3157
+ input_streams=[
3158
+ ':'.join([_IMAGE_TAG, _IMAGE_IN_STREAM_NAME]),
3159
+ ':'.join([_NORM_RECT_TAG, _NORM_RECT_STREAM_NAME]),
3160
+ ],
3161
+ output_streams=output_streams,
3162
+ task_options=options,
3163
+ )
3164
+ return cls(
3165
+ task_info.generate_graph_config(
3166
+ enable_flow_limiting=options.running_mode
3167
+ == _RunningMode.LIVE_STREAM
3168
+ ),
3169
+ options.running_mode,
3170
+ packets_callback if options.result_callback else None,
3171
+ )
3172
+
3173
+ def detect(
3174
+ self,
3175
+ image: image_module.Image,
3176
+ image_processing_options: Optional[_ImageProcessingOptions] = None,
3177
+ ) -> FaceLandmarkerResult:
3178
+ """Performs face landmarks detection on the given image.
3179
+
3180
+ Only use this method when the FaceLandmarker is created with the image
3181
+ running mode.
3182
+
3183
+ The image can be of any size with format RGB or RGBA.
3184
+ TODO: Describes how the input image will be preprocessed after the yuv
3185
+ support is implemented.
3186
+
3187
+ Args:
3188
+ image: MediaPipe Image.
3189
+ image_processing_options: Options for image processing.
3190
+
3191
+ Returns:
3192
+ The face landmarks detection results.
3193
+
3194
+ Raises:
3195
+ ValueError: If any of the input arguments is invalid.
3196
+ RuntimeError: If face landmarker detection failed to run.
3197
+ """
3198
+
3199
+ normalized_rect = self.convert_to_normalized_rect(
3200
+ image_processing_options, image, roi_allowed=False
3201
+ )
3202
+ output_packets = self._process_image_data({
3203
+ _IMAGE_IN_STREAM_NAME: packet_creator.create_image(image),
3204
+ _NORM_RECT_STREAM_NAME: packet_creator.create_proto(
3205
+ normalized_rect.to_pb2()
3206
+ ),
3207
+ })
3208
+
3209
+ if output_packets[_NORM_LANDMARKS_STREAM_NAME].is_empty():
3210
+ return FaceLandmarkerResult([], [], [])
3211
+
3212
+ return _build_landmarker_result2(output_packets)
3213
+
3214
+ def detect_for_video(
3215
+ self,
3216
+ image: image_module.Image,
3217
+ timestamp_ms: int,
3218
+ image_processing_options: Optional[_ImageProcessingOptions] = None,
3219
+ ):
3220
+ """Performs face landmarks detection on the provided video frame.
3221
+
3222
+ Only use this method when the FaceLandmarker is created with the video
3223
+ running mode.
3224
+
3225
+ Only use this method when the FaceLandmarker is created with the video
3226
+ running mode. It's required to provide the video frame's timestamp (in
3227
+ milliseconds) along with the video frame. The input timestamps should be
3228
+ monotonically increasing for adjacent calls of this method.
3229
+
3230
+ Args:
3231
+ image: MediaPipe Image.
3232
+ timestamp_ms: The timestamp of the input video frame in milliseconds.
3233
+ image_processing_options: Options for image processing.
3234
+
3235
+ Returns:
3236
+ The face landmarks detection results.
3237
+
3238
+ Raises:
3239
+ ValueError: If any of the input arguments is invalid.
3240
+ RuntimeError: If face landmarker detection failed to run.
3241
+ """
3242
+ normalized_rect = self.convert_to_normalized_rect(
3243
+ image_processing_options, image, roi_allowed=False
3244
+ )
3245
+ output_packets = self._process_video_data({
3246
+ _IMAGE_IN_STREAM_NAME: packet_creator.create_image(image).at(
3247
+ timestamp_ms * _MICRO_SECONDS_PER_MILLISECOND
3248
+ ),
3249
+ _NORM_RECT_STREAM_NAME: packet_creator.create_proto(
3250
+ normalized_rect.to_pb2()
3251
+ ).at(timestamp_ms * _MICRO_SECONDS_PER_MILLISECOND),
3252
+ })
3253
+
3254
+ if output_packets[_NORM_LANDMARKS_STREAM_NAME].is_empty():
3255
+ return FaceLandmarkerResult([], [], [])
3256
+
3257
+ return _build_landmarker_result2(output_packets)
3258
+
3259
+ def detect_async(
3260
+ self,
3261
+ image: image_module.Image,
3262
+ timestamp_ms: int,
3263
+ image_processing_options: Optional[_ImageProcessingOptions] = None,
3264
+ ) -> None:
3265
+ """Sends live image data to perform face landmarks detection.
3266
+
3267
+ The results will be available via the "result_callback" provided in the
3268
+ FaceLandmarkerOptions. Only use this method when the FaceLandmarker is
3269
+ created with the live stream running mode.
3270
+
3271
+ Only use this method when the FaceLandmarker is created with the live
3272
+ stream running mode. The input timestamps should be monotonically increasing
3273
+ for adjacent calls of this method. This method will return immediately after
3274
+ the input image is accepted. The results will be available via the
3275
+ `result_callback` provided in the `FaceLandmarkerOptions`. The
3276
+ `detect_async` method is designed to process live stream data such as
3277
+ camera input. To lower the overall latency, face landmarker may drop the
3278
+ input images if needed. In other words, it's not guaranteed to have output
3279
+ per input image.
3280
+
3281
+ The `result_callback` provides:
3282
+ - The face landmarks detection results.
3283
+ - The input image that the face landmarker runs on.
3284
+ - The input timestamp in milliseconds.
3285
+
3286
+ Args:
3287
+ image: MediaPipe Image.
3288
+ timestamp_ms: The timestamp of the input image in milliseconds.
3289
+ image_processing_options: Options for image processing.
3290
+
3291
+ Raises:
3292
+ ValueError: If the current input timestamp is smaller than what the
3293
+ face landmarker has already processed.
3294
+ """
3295
+ normalized_rect = self.convert_to_normalized_rect(
3296
+ image_processing_options, image, roi_allowed=False
3297
+ )
3298
+ self._send_live_stream_data({
3299
+ _IMAGE_IN_STREAM_NAME: packet_creator.create_image(image).at(
3300
+ timestamp_ms * _MICRO_SECONDS_PER_MILLISECOND
3301
+ ),
3302
+ _NORM_RECT_STREAM_NAME: packet_creator.create_proto(
3303
+ normalized_rect.to_pb2()
3304
+ ).at(timestamp_ms * _MICRO_SECONDS_PER_MILLISECOND),
3305
+ })
media_pipe/mp_models/blaze_face_short_range.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b4578f35940bf5a1a655214a1cce5cab13eba73c1297cd78e1a04c2380b0152f
3
+ size 229746
media_pipe/mp_models/face_landmarker_v2_with_blendshapes.task ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:64184e229b263107bc2b804c6625db1341ff2bb731874b0bcc2fe6544e0bc9ff
3
+ size 3758596
media_pipe/mp_models/pose_landmarker_heavy.task ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:64437af838a65d18e5ba7a0d39b465540069bc8aae8308de3e318aad31fcbc7b
3
+ size 30664242
media_pipe/mp_utils.py ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import numpy as np
3
+ import cv2
4
+ import time
5
+ from tqdm import tqdm
6
+ import multiprocessing
7
+ import glob
8
+
9
+ import mediapipe as mp
10
+ from mediapipe import solutions
11
+ from mediapipe.framework.formats import landmark_pb2
12
+ from mediapipe.tasks import python
13
+ from mediapipe.tasks.python import vision
14
+ from . import face_landmark
15
+
16
+ CUR_DIR = os.path.dirname(__file__)
17
+
18
+
19
+ class LMKExtractor():
20
+ def __init__(self, FPS=25):
21
+ # Create an FaceLandmarker object.
22
+ self.mode = mp.tasks.vision.FaceDetectorOptions.running_mode.IMAGE
23
+ base_options = python.BaseOptions(model_asset_path=os.path.join(CUR_DIR, 'mp_models/face_landmarker_v2_with_blendshapes.task'))
24
+ base_options.delegate = mp.tasks.BaseOptions.Delegate.CPU
25
+ options = vision.FaceLandmarkerOptions(base_options=base_options,
26
+ running_mode=self.mode,
27
+ output_face_blendshapes=True,
28
+ output_facial_transformation_matrixes=True,
29
+ num_faces=1)
30
+ self.detector = face_landmark.FaceLandmarker.create_from_options(options)
31
+ self.last_ts = 0
32
+ self.frame_ms = int(1000 / FPS)
33
+
34
+ det_base_options = python.BaseOptions(model_asset_path=os.path.join(CUR_DIR, 'mp_models/blaze_face_short_range.tflite'))
35
+ det_options = vision.FaceDetectorOptions(base_options=det_base_options)
36
+ self.det_detector = vision.FaceDetector.create_from_options(det_options)
37
+
38
+
39
+ def __call__(self, img):
40
+ frame = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
41
+ image = mp.Image(image_format=mp.ImageFormat.SRGB, data=frame)
42
+ t0 = time.time()
43
+ if self.mode == mp.tasks.vision.FaceDetectorOptions.running_mode.VIDEO:
44
+ det_result = self.det_detector.detect(image)
45
+ if len(det_result.detections) != 1:
46
+ return None
47
+ self.last_ts += self.frame_ms
48
+ try:
49
+ detection_result, mesh3d = self.detector.detect_for_video(image, timestamp_ms=self.last_ts)
50
+ except:
51
+ return None
52
+ elif self.mode == mp.tasks.vision.FaceDetectorOptions.running_mode.IMAGE:
53
+ # det_result = self.det_detector.detect(image)
54
+
55
+ # if len(det_result.detections) != 1:
56
+ # return None
57
+ try:
58
+ detection_result, mesh3d = self.detector.detect(image)
59
+ except:
60
+ return None
61
+
62
+
63
+ bs_list = detection_result.face_blendshapes
64
+ if len(bs_list) == 1:
65
+ bs = bs_list[0]
66
+ bs_values = []
67
+ for index in range(len(bs)):
68
+ bs_values.append(bs[index].score)
69
+ bs_values = bs_values[1:] # remove neutral
70
+ trans_mat = detection_result.facial_transformation_matrixes[0]
71
+ face_landmarks_list = detection_result.face_landmarks
72
+ face_landmarks = face_landmarks_list[0]
73
+ lmks = []
74
+ for index in range(len(face_landmarks)):
75
+ x = face_landmarks[index].x
76
+ y = face_landmarks[index].y
77
+ z = face_landmarks[index].z
78
+ lmks.append([x, y, z])
79
+ lmks = np.array(lmks)
80
+
81
+ lmks3d = np.array(mesh3d.vertex_buffer)
82
+ lmks3d = lmks3d.reshape(-1, 5)[:, :3]
83
+ mp_tris = np.array(mesh3d.index_buffer).reshape(-1, 3) + 1
84
+
85
+ return {
86
+ "lmks": lmks,
87
+ 'lmks3d': lmks3d,
88
+ "trans_mat": trans_mat,
89
+ 'faces': mp_tris,
90
+ "bs": bs_values
91
+ }
92
+ else:
93
+ # print('multiple faces in the image: {}'.format(img_path))
94
+ return None
95
+
media_pipe/pose_util.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+
3
+ import numpy as np
4
+ from scipy.spatial.transform import Rotation as R
5
+
6
+
7
+ def create_perspective_matrix(aspect_ratio):
8
+ kDegreesToRadians = np.pi / 180.
9
+ near = 1
10
+ far = 10000
11
+ perspective_matrix = np.zeros(16, dtype=np.float32)
12
+
13
+ # Standard perspective projection matrix calculations.
14
+ f = 1.0 / np.tan(kDegreesToRadians * 63 / 2.)
15
+
16
+ denom = 1.0 / (near - far)
17
+ perspective_matrix[0] = f / aspect_ratio
18
+ perspective_matrix[5] = f
19
+ perspective_matrix[10] = (near + far) * denom
20
+ perspective_matrix[11] = -1.
21
+ perspective_matrix[14] = 1. * far * near * denom
22
+
23
+ # If the environment's origin point location is in the top left corner,
24
+ # then skip additional flip along Y-axis is required to render correctly.
25
+
26
+ perspective_matrix[5] *= -1.
27
+ return perspective_matrix
28
+
29
+
30
+ def project_points(points_3d, transformation_matrix, pose_vectors, image_shape):
31
+ P = create_perspective_matrix(image_shape[1] / image_shape[0]).reshape(4, 4).T
32
+ L, N, _ = points_3d.shape
33
+ projected_points = np.zeros((L, N, 2))
34
+ for i in range(L):
35
+ points_3d_frame = points_3d[i]
36
+ ones = np.ones((points_3d_frame.shape[0], 1))
37
+ points_3d_homogeneous = np.hstack([points_3d_frame, ones])
38
+ transformed_points = points_3d_homogeneous @ (transformation_matrix @ euler_and_translation_to_matrix(pose_vectors[i][:3], pose_vectors[i][3:])).T @ P
39
+ projected_points_frame = transformed_points[:, :2] / transformed_points[:, 3, np.newaxis] # -1 ~ 1
40
+ projected_points_frame[:, 0] = (projected_points_frame[:, 0] + 1) * 0.5 * image_shape[1]
41
+ projected_points_frame[:, 1] = (projected_points_frame[:, 1] + 1) * 0.5 * image_shape[0]
42
+ projected_points[i] = projected_points_frame
43
+ return projected_points
44
+
45
+
46
+ def project_points_with_trans(points_3d, transformation_matrix, image_shape):
47
+ P = create_perspective_matrix(image_shape[1] / image_shape[0]).reshape(4, 4).T
48
+ L, N, _ = points_3d.shape
49
+ projected_points = np.zeros((L, N, 2))
50
+ for i in range(L):
51
+ points_3d_frame = points_3d[i]
52
+ ones = np.ones((points_3d_frame.shape[0], 1))
53
+ points_3d_homogeneous = np.hstack([points_3d_frame, ones])
54
+ transformed_points = points_3d_homogeneous @ transformation_matrix[i].T @ P
55
+ projected_points_frame = transformed_points[:, :2] / transformed_points[:, 3, np.newaxis] # -1 ~ 1
56
+ projected_points_frame[:, 0] = (projected_points_frame[:, 0] + 1) * 0.5 * image_shape[1]
57
+ projected_points_frame[:, 1] = (projected_points_frame[:, 1] + 1) * 0.5 * image_shape[0]
58
+ projected_points[i] = projected_points_frame
59
+ return projected_points
60
+
61
+
62
+ def euler_and_translation_to_matrix(euler_angles, translation_vector):
63
+ rotation = R.from_euler('xyz', euler_angles, degrees=True)
64
+ rotation_matrix = rotation.as_matrix()
65
+
66
+ matrix = np.eye(4)
67
+ matrix[:3, :3] = rotation_matrix
68
+ matrix[:3, 3] = translation_vector
69
+
70
+ return matrix
71
+
72
+
73
+ def matrix_to_euler_and_translation(matrix):
74
+ rotation_matrix = matrix[:3, :3]
75
+ translation_vector = matrix[:3, 3]
76
+ rotation = R.from_matrix(rotation_matrix)
77
+ euler_angles = rotation.as_euler('xyz', degrees=True)
78
+ return euler_angles, translation_vector