6 7 import os 8 import cv2 9 import numpy as np 10 import pickle 11 from tqdm import tqdm 12 from .utils.cropper import Cropper 13
69 Return: (bs, 2k*3) 70 """ 71 bs_src = kp_source.shape[0] 72 bs_dri = kp_driving.shape[0] 73 assert bs_src == bs_dri, 'batch size must be equal' 74 75 feat = torch.cat([kp_source.view(bs_src, -1), kp_driving.view(bs_dri, -1)], dim=1) 76 return feat
5 """ 6 7 import os.path as osp 8 import numpy as np 9 import subprocess 10 import imageio 11 import cv2 12
15 from .rprint import rprint as print 16 17 18 def exec_cmd(cmd): 19 subprocess.run(cmd, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 20 21 22 def images2video(images, wfp, **kwargs):
134 def get_fps(filepath): 135 import ffmpeg 136 probe = ffmpeg.probe(filepath) 137 video_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'video'), None) 138 fps = eval(video_stream['avg_frame_rate']) 139 return fps