diff --git a/liveportrait/live_portrait_pipeline.py b/liveportrait/live_portrait_pipeline.py index 202481a..a20b0cc 100644 --- a/liveportrait/live_portrait_pipeline.py +++ b/liveportrait/live_portrait_pipeline.py @@ -54,7 +54,6 @@ class LivePortraitPipeline(object): else: total_frames = driving_images.shape[0] - disable_progress_bar = True if relative_motion_mode == "single_frame" else False diff --git a/liveportrait/utils/crop.py b/liveportrait/utils/crop.py index b617e00..f914d66 100644 --- a/liveportrait/utils/crop.py +++ b/liveportrait/utils/crop.py @@ -43,23 +43,17 @@ def _transform_img_kornia(img, M, dsize, device, flags='bilinear', borderMode='z # Convert M from numpy.ndarray to PyTorch tensor M = torch.from_numpy(M).float().to(device) + if M.shape == (3, 3): - M = M[:2, :].unsqueeze(0) # Adjust M to the expected shape Bx2x3 - elif M.shape == (2, 3): - M = M.unsqueeze(0) # Add batch dimension if not present - - # Reshape M for Kornia (1, 2, 3) and upscale to 3D affine matrix if not already + M = M[:2, :] if M.shape == (2, 3): - M = M.unsqueeze(0) # Add batch dimension + M = M.unsqueeze(0) # Convert image to floating point tensor if not already if img.dtype != torch.float32: img = img.float() - img = img.to(device) - - # Reshape img for Kornia (B, C, H, W) - img = img.permute(0, 3, 1, 2) - + img = img.permute(0, 3, 1, 2).to(device) # Reshape img for Kornia (B, C, H, W) + # Apply the affine transformation img_warped = KGT.warp_affine(img, M, _dsize, mode=flags, padding_mode=borderMode)