Created
June 15, 2019 06:30
-
-
Save MLWhiz/65010c7e494adaf84602709f8884f1b9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # create a list of 20 PNGs to show | |
| generated_images = [img_save_dir+str(x).zfill(4)+"fixed_image.png" for x in range(0,num_steps,1500)] | |
| print("Displaying generated images") | |
| # You might need to change grid size and figure size here according to num images. | |
| plt.figure(figsize=(16,20)) | |
| gs1 = gridspec.GridSpec(5, 4) | |
| gs1.update(wspace=0, hspace=0) | |
| for i,image in enumerate(generated_images): | |
| ax1 = plt.subplot(gs1[i]) | |
| ax1.set_aspect('equal') | |
| step = image.split("fixed")[0] | |
| image = Image.open(image) | |
| fig = plt.imshow(image) | |
| # you might need to change some params here | |
| fig = plt.text(20,47,"Step: "+step,bbox=dict(facecolor='red', alpha=0.5),fontsize=12) | |
| plt.axis('off') | |
| fig.axes.get_xaxis().set_visible(False) | |
| fig.axes.get_yaxis().set_visible(False) | |
| plt.tight_layout() | |
| plt.savefig("GENERATEDimage.png",bbox_inches='tight',pad_inches=0) | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment