From 5e3b755b27b0eb21b989ddc27f0f7c42975cf87f Mon Sep 17 00:00:00 2001 From: ComplexRobot Date: Sun, 16 Mar 2025 22:10:08 -0700 Subject: [PATCH] Add progress bar. --- nodes.py | 11 ++++++++--- pyproject.toml | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/nodes.py b/nodes.py index a27b567..f2b52c0 100644 --- a/nodes.py +++ b/nodes.py @@ -1,9 +1,11 @@ import torch import torch.nn.functional as functional +from tqdm import tqdm from nodes import ImageScale import comfy.model_management as model_management from comfy_extras.nodes_post_processing import Blur, Sharpen +from comfy.utils import ProgressBar class Simple_Frame_Interpolation: @@ -44,8 +46,9 @@ class Simple_Frame_Interpolation: images = images.reshape(H * W, B, 1, C) # scale images on the time axis (increase or reduce frame count) + progress_bar = ProgressBar(H * W * (2 if blur_enabled else 1)) scaled_list = [] - for current_image in images.split(scale_batch_size): + for current_image in tqdm(images.split(scale_batch_size), f"{scale_method.capitalize()} VFI"): current_image = current_image.contiguous().to(device) # for lanczos and bislerp, it is faster to pass as a single unbatched image if scale_method == "lanczos" or scale_method == "bislerp": @@ -57,14 +60,15 @@ class Simple_Frame_Interpolation: else: current_image, = ImageScale.upscale(self, current_image, scale_method, 1, new_frame_count, crop="disabled") scaled_list += current_image.cpu().split(1) + progress_bar.update(current_image.size(0)) model_management.throw_exception_if_processing_interrupted() images = torch.stack(scaled_list).squeeze(1).cpu() if blur_enabled: B2, H2, W2, C2 = images.shape - + blurred_list = [] - for current_image in images.split(batch_size): + for current_image in tqdm(images.split(batch_size), f"{"Gaussian blur" if blur_sigma > 0 else "Sharpen"} VFI"): # add padding so the reflect padding added by blur/sharpen will succeed (inefficient!) current_image = current_image.permute(0, 3, 1, 2).contiguous().to(device) current_image = functional.interpolate(current_image, size=(H2, 2 * blur_radius + 1), mode='nearest-exact') @@ -76,6 +80,7 @@ class Simple_Frame_Interpolation: current_image, = Sharpen.sharpen(self, current_image, blur_radius, -blur_sigma, sharpen_alpha) blurred_list += current_image[:, :, blur_radius:-blur_radius, :].cpu().split(1) + progress_bar.update(current_image.size(0)) model_management.throw_exception_if_processing_interrupted() images = torch.stack(blurred_list).squeeze(1).cpu() diff --git a/pyproject.toml b/pyproject.toml index ae565fd..3864a15 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "ComfyUI-Simple-VFI" description = "Nodes for simple frame interpolation without the use of AI. Uses standard image operations to blend frames together." -version = "1.0.2" +version = "1.0.3" license = "LICENSE" dependencies = ["open-clip-torch"]