google / evojax

Apache License 2.0
846 stars 87 forks source link

Minor issue with GIF at the end of the Abstract Paintings notebook 1 #35

Closed johnowhitaker closed 2 years ago

johnowhitaker commented 2 years ago

The notebook (https://github.com/google/evojax/blob/main/examples/notebooks/AbstractPainting01.ipynb) does the following to turn the saved frames into a GIF:

import glob
import IPython

frames = []
imgs = glob.glob("AbstractPainting01_canvas_record.*.png")
for file in imgs:
  new_frame = Image.open(file)
  frames.append(new_frame)
frames[0].save('AbstractPainting01_final.gif', save_all=True, append_images=frames, optimize=True, duration=200, loop=0)

The resulting GIF doesn't show the frames in order, because glob returns results in an arbitrary order (probably whatever order files appear in the filesystem).

Fix: imgs = sorted(glob.glob("AbstractPainting01_canvas_record.*.png"))

I'd submit a pull request but I don't have 8 A100s lying around so it'd take a while to re-run the example :)

alantian commented 2 years ago

@johnowhitaker thanks for pointing it out! I'll have a quick fix running on multiple GPUs :-D

alantian commented 2 years ago

fixed!