(self, retargeting_eyes, retargeting_mouth, turn_on, tracking_src_vid, animate_without_vid, command, crop_factor,
src_images=None, driving_images=None, motion_link=None)
| 724 | |
| 725 | |
| 726 | def run(self, retargeting_eyes, retargeting_mouth, turn_on, tracking_src_vid, animate_without_vid, command, crop_factor, |
| 727 | src_images=None, driving_images=None, motion_link=None): |
| 728 | if turn_on == False: return (None,None) |
| 729 | src_length = 1 |
| 730 | |
| 731 | if src_images == None: |
| 732 | if motion_link != None: |
| 733 | self.psi_list = [motion_link[0]] |
| 734 | else: return (None,None) |
| 735 | |
| 736 | if src_images != None: |
| 737 | src_length = len(src_images) |
| 738 | if id(src_images) != id(self.src_images) or self.crop_factor != crop_factor: |
| 739 | self.crop_factor = crop_factor |
| 740 | self.src_images = src_images |
| 741 | if 1 < src_length: |
| 742 | self.psi_list = g_engine.prepare_source(src_images, crop_factor, True, tracking_src_vid) |
| 743 | else: |
| 744 | self.psi_list = [g_engine.prepare_source(src_images, crop_factor)] |
| 745 | |
| 746 | |
| 747 | cmd_list, cmd_length = self.parsing_command(command, motion_link) |
| 748 | if cmd_list == None: return (None,None) |
| 749 | cmd_idx = 0 |
| 750 | |
| 751 | driving_length = 0 |
| 752 | if driving_images is not None: |
| 753 | if id(driving_images) != id(self.driving_images): |
| 754 | self.driving_images = driving_images |
| 755 | self.driving_values = g_engine.prepare_driving_video(driving_images) |
| 756 | driving_length = len(self.driving_values) |
| 757 | |
| 758 | total_length = max(driving_length, src_length) |
| 759 | |
| 760 | if animate_without_vid: |
| 761 | total_length = max(total_length, cmd_length) |
| 762 | |
| 763 | c_i_es = ExpressionSet() |
| 764 | c_o_es = ExpressionSet() |
| 765 | d_0_es = None |
| 766 | out_list = [] |
| 767 | |
| 768 | psi = None |
| 769 | pipeline = g_engine.get_pipeline() |
| 770 | for i in range(total_length): |
| 771 | |
| 772 | if i < src_length: |
| 773 | psi = self.psi_list[i] |
| 774 | s_info = psi.x_s_info |
| 775 | s_es = ExpressionSet(erst=(s_info['kp'] + s_info['exp'], torch.Tensor([0, 0, 0]), s_info['scale'], s_info['t'])) |
| 776 | |
| 777 | new_es = ExpressionSet(es = s_es) |
| 778 | |
| 779 | if i < cmd_length: |
| 780 | cmd = cmd_list[cmd_idx] |
| 781 | if 0 < cmd.change: |
| 782 | cmd.change -= 1 |
| 783 | c_i_es.add(cmd.es) |
nothing calls this directly
no test coverage detected