Skip to content

Instantly share code, notes, and snippets.

@robertsdionne
Created August 17, 2016 03:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertsdionne/d37ab1524a7d5e373ee5a2a0176ebd22 to your computer and use it in GitHub Desktop.
Save robertsdionne/d37ab1524a7d5e373ee5a2a0176ebd22 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/python3
import glob
import h5py
import matplotlib.animation as animation
import matplotlib.pyplot as plot
import numpy as np
import tensorflow as tf
def main():
datafiles = glob.glob('data/*.h5')
for datafile in datafiles:
with h5py.File(datafile) as data:
figure = plot.figure()
imageplot = plot.imshow(np.zeros((227, 227, 3), dtype=np.uint8))
def next_frame(i):
image = 255 - data['images'][i].transpose(1, 2, 0)[:, :, ::-1]
imageplot.set_array(image)
return imageplot,
animate = animation.FuncAnimation(figure, next_frame, frames=range(len(data['images'])), interval=252, blit=False)
plot.show()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment