vid2densepose icon indicating copy to clipboard operation
vid2densepose copied to clipboard

[ Feature Suggestion ] Adding tqdm progress bar for more accurate completion time

Open JD-2006 opened this issue 2 years ago • 2 comments

Adding a progress bar that is more accurate and informative than the gradio one.

from tqdm import tqdm  # Import tqdm


# Process each frame with tqdm
total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
for _ in tqdm(range(total_frames), desc="Processing Frames", unit="frames"):
    ret, frame = cap.read()
    if not ret:
        break

    with torch.no_grad():
        outputs = predictor(frame)['instances']

    results = DensePoseResultExtractor()(outputs)
    cmap = cv2.COLORMAP_VIRIDIS
    arr = cv2.applyColorMap(np.zeros((height, width), dtype=np.uint8), cmap)
    out_frame = Visualizer(alpha=1, cmap=cmap).visualize(arr, results)        
    out.write(out_frame)

ProgressBar ``

JD-2006 avatar Dec 09 '23 21:12 JD-2006

Hi @JD-2006,

Thanks for the suggestion. Please feel free to open a Pull Request with this feature and we will be happy to evaluate and merge it!

tadeodonegana avatar Dec 09 '23 22:12 tadeodonegana

Cheers! Will do.

JD-2006 avatar Dec 10 '23 06:12 JD-2006