Project import generated by Copybara.
GitOrigin-RevId: d4a11282d20fe4d2e137f9032cf349750030dcb9
This commit is contained in:
@@ -99,18 +99,23 @@ class PoseTest(parameterized.TestCase):
|
||||
results = holistic.process(image)
|
||||
self.assertIsNone(results.pose_landmarks)
|
||||
|
||||
@parameterized.named_parameters(('static_lite', True, 0, 3),
|
||||
('static_full', True, 1, 3),
|
||||
('static_heavy', True, 2, 3),
|
||||
('video_lite', False, 0, 3),
|
||||
('video_full', False, 1, 3),
|
||||
('video_heavy', False, 2, 3))
|
||||
def test_on_image(self, static_image_mode, model_complexity, num_frames):
|
||||
@parameterized.named_parameters(('static_lite', True, 0, False, 3),
|
||||
('static_full', True, 1, False, 3),
|
||||
('static_heavy', True, 2, False, 3),
|
||||
('video_lite', False, 0, False, 3),
|
||||
('video_full', False, 1, False, 3),
|
||||
('video_heavy', False, 2, False, 3),
|
||||
('static_full_refine_face', True, 1, True, 3),
|
||||
('video_full_refine_face', False, 1, True, 3))
|
||||
def test_on_image(self, static_image_mode, model_complexity,
|
||||
refine_face_landmarks, num_frames):
|
||||
image_path = os.path.join(os.path.dirname(__file__),
|
||||
'testdata/holistic.jpg')
|
||||
image = cv2.imread(image_path)
|
||||
with mp_holistic.Holistic(static_image_mode=static_image_mode,
|
||||
model_complexity=model_complexity) as holistic:
|
||||
with mp_holistic.Holistic(
|
||||
static_image_mode=static_image_mode,
|
||||
model_complexity=model_complexity,
|
||||
refine_face_landmarks=refine_face_landmarks) as holistic:
|
||||
for idx in range(num_frames):
|
||||
results = holistic.process(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
|
||||
self._annotate(image.copy(), results, idx)
|
||||
@@ -129,7 +134,8 @@ class PoseTest(parameterized.TestCase):
|
||||
EXPECTED_RIGHT_HAND_LANDMARKS,
|
||||
HAND_DIFF_THRESHOLD)
|
||||
# TODO: Verify the correctness of the face landmarks.
|
||||
self.assertLen(results.face_landmarks.landmark, 468)
|
||||
self.assertLen(results.face_landmarks.landmark,
|
||||
478 if refine_face_landmarks else 468)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user