(self, face, expresion)
| 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) |
no test coverage detected