MCPcopy Create free account
hub / github.com/albertpumarola/GANimation / _morph_face

Method _morph_face

test.py:46–52  ·  view source on GitHub ↗
(self, face, expresion)

Source from the content-addressed store, hash-verified

44 return morphed_face
45
46 def _morph_face(self, face, expresion):
47 face = torch.unsqueeze(self._transform(Image.fromarray(face)), 0)
48 expresion = torch.unsqueeze(torch.from_numpy(expresion/5.0), 0)
49 test_batch = {'real_img': face, 'real_cond': expresion, 'desired_cond': expresion, 'sample_id': torch.FloatTensor(), 'real_img_path': []}
50 self._model.set_input(test_batch)
51 imgs, _ = self._model.forward(keep_data_for_visuals=False, return_estimates=True)
52 return imgs['concat']
53
54 def _save_img(self, img, filename):
55 filepath = os.path.join(self._opt.output_dir, filename)

Callers 1

_img_morphMethod · 0.95

Calls 2

set_inputMethod · 0.45
forwardMethod · 0.45

Tested by

no test coverage detected