MCPcopy
hub / github.com/1adrianb/face-alignment / test_predict_batch_points

Method test_predict_batch_points

test/facealignment_test.py:88–101  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

86 self.assertTrue(np.allclose(pred, reference, atol=0.07))
87
88 def test_predict_batch_points(self):
89 fa = face_alignment.FaceAlignment(face_alignment.LandmarksType.THREE_D, device='cpu')
90
91 reference_data = self.reference_data + self.reference_data
92 reference_data.append([])
93 image = get_image('test/assets/aflw-test.jpg')
94 batch = np.stack([image, image, np.zeros_like(image)])
95 batch = torch.Tensor(batch.transpose(0, 3, 1, 2))
96
97 preds = fa.get_landmarks_from_batch(batch)
98
99 self.assertEqual(len(preds), len(reference_data))
100 for pred, reference in zip(preds, reference_data):
101 self.assertTrue(np.allclose(pred, reference, atol=0.07))
102
103 def test_predict_points_from_dir(self):
104 fa = face_alignment.FaceAlignment(face_alignment.LandmarksType.THREE_D, device='cpu')

Callers

nothing calls this directly

Calls 2

get_imageFunction · 0.90

Tested by

no test coverage detected