Need some help
I am working with "moving_mnist" dataset. Loading this data using tfds.load("moving_mnist") and then convert it in arrays using tfds.as_numpy() which will return image sequence arrays of shape (20,64,64,1) where 20 is number of frames. Now what I want, to show these arrays as GIF in my jupyter notebook please see below code which I tried but it will generate simple image for last frame.
import tensorflow_datasets as tfds
ds, ds_info = tfds.load("moving_mnist", with_info = True,split="test")
num_examples = 3
examples = list(dataset_utils.as_numpy(ds.take(num_examples)))
fig = plt.figure(figsize=(3*3, 3*3))
fig.subplots_adjust(hspace=1/3, wspace=1/3)
for i, ex in enumerate(examples):
video = ex["image-sequence"]
frame,height, width, c = video.shape
if c == 1:
video = video.reshape(video.shape[:3])
for i in range(0,frame):
ax.imshow(video[i,:,:], animated=True)
Here is result I got but want it as GIF