コード例 #1
0
ファイル: driver.py プロジェクト: vchen8761/AI-Style-Transfer
def per_step(img, e, s):
    plt.subplot(1, 3, 1)
    ImageUtils.imshow(transferer.content_image, 'Content Image')
    plt.subplot(1, 3, 2)
    ImageUtils.imshow(img, f'New Image, epoch {e}, step {s}')
    plt.subplot(1, 3, 3)
    ImageUtils.imshow(transferer.style_image, 'Style Image')
    ImageUtils.flashplot()
    fig = plt.figure(1)
    fig.clf()
    ax = fig.subplots(nrows=2, ncols=1)
コード例 #2
0
        )

        plotset2 = (  # This shows 1x3 simple layout
            ((1, 3, 1), content_image, 'Content Image'),
            ((1, 3, 2), stylized_image, 'New Image'),
            ((1, 3, 3), style_orig, 'Style Image'),
        )

        for c, i, t in plotset1:
            plt.subplot(*c)
            ImageUtils.imshow(i, t)

        # View style transfers one by one
        input('Next? : ')

        ImageUtils.flashplot()

        print("\t> Finished")

    except Exception as e:
        print(" - Failed on image", i)
        print(f"\t> Image failed on {filename}: {e}.")
        fails += 1  # This skips fails. To be fixed later

        # For testing
        if fails > 5: quit()

        # if "n" == input(f" - Image failed on {filename}: {e}.\n - Type 'n' if to stop, anything else to go: "):
        # break

input('Finish? : ')