Flode-Labs / vid2densepose

Convert your videos to densepose and use it on MagicAnimate
MIT License
987 stars 127 forks source link

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

Open JD-2006 opened 11 months ago

JD-2006 commented 11 months ago

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 ``

tadeodonegana commented 11 months ago

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!

JD-2006 commented 11 months ago

Cheers! Will do.