Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

result rendering #18

Open
farhad-abdi opened this issue Nov 23, 2022 · 1 comment
Open

result rendering #18

farhad-abdi opened this issue Nov 23, 2022 · 1 comment

Comments

@farhad-abdi
Copy link

Hi, my issue was not really significant to open a thread. I just want to know how to display final sampled_videos using matplotlib, i'm permuting (channels, frames, height, width) using imgs = sampled_videos[0].permute(1,2,3,0) but it's showing noise only!

@SamuelSchmidgall
Copy link

You can try the following:

import imageio
import numpy as np

sampled_videos = diffusion.sample(batch_size=1)
sampled_videos = sampled_videos.squeeze(0).permute(1, 2, 3, 0).detach().cpu().numpy()
sampled_videos = ((sampled_videos - sampled_videos.min()) / (sampled_videos.max() - sampled_videos.min()) * 255).astype(np.uint8)
imageio.mimsave('output_video.gif', sampled_videos, fps=5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants