Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed paste_pic.py #911

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def main(args):

pic_path = args.source_image
audio_path = args.driven_audio
save_dir = os.path.join(args.result_dir, strftime("%Y_%m_%d_%H.%M.%S"))
save_dir = os.path.join(args.result_dir, args.result_name)
os.makedirs(save_dir, exist_ok=True)
pose_style = args.pose_style
device = args.device
Expand Down Expand Up @@ -103,6 +103,7 @@ def main(args):
parser.add_argument("--ref_pose", default=None, help="path to reference video providing pose")
parser.add_argument("--checkpoint_dir", default='./checkpoints', help="path to output")
parser.add_argument("--result_dir", default='./results', help="path to output")
parser.add_argument("--result_name", default='out', help="file name to output")
parser.add_argument("--pose_style", type=int, default=0, help="input pose style from [0, 46)")
parser.add_argument("--batch_size", type=int, default=2, help="the batch size of facerender")
parser.add_argument("--size", type=int, default=256, help="the image size of the facerender")
Expand Down
2 changes: 1 addition & 1 deletion src/utils/paste_pic.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def paste_pic(video_path, pic_path, crop_info, new_audio_path, full_video_path,
oy1, oy2, ox1, ox2 = cly+ly, cly+ry, clx+lx, clx+rx

tmp_path = str(uuid.uuid4())+'.mp4'
out_tmp = cv2.VideoWriter(tmp_path, cv2.VideoWriter_fourcc(*'MP4V'), fps, (frame_w, frame_h))
out_tmp = cv2.VideoWriter(tmp_path, cv2.VideoWriter_fourcc(*'mp4v'), fps, (frame_w, frame_h))
for crop_frame in tqdm(crop_frames, 'seamlessClone:'):
p = cv2.resize(crop_frame.astype(np.uint8), (ox2-ox1, oy2 - oy1))

Expand Down