# cut the window on x
        tmp = image[begin_border_x:end_border_x]
        # cut the window on y
        for t in tmp:
            t = t[begin_border_y:end_border_y]
            # cut the pixels alpha
            col = []
            for pixel in t:
                col.append(np.array([pixel[0], pixel[1], pixel[2]]))
            window.append(col)

        # log
        print(f"Epochs: {i * y_size + j + 1}/{y_size*x_size}; window: [{begin_true_x}, {begin_true_y}] [{end_true_x}, {end_true_y}]; shape: {np.array(window).shape}")

        # predict the new window
        new_window = generator.predict(np.array([window,]))[0]

        # pass throug all pixels of the new_window
        # and push there in the new image

        # the loop
        for k in range(len(new_window)):
            for l in range(len(new_window[0])):

                # calculate the coords
                # on the new image
                x = k + (begin_border_x*4)
                y = l + (begin_border_y*4)

                # get the pixel value
                p = new_window[k][l]
Example #2
0
    if e % 10 == 0:
        generator.save_weights("./" + 'gen_model.h5')
        discriminator.save_weights("./" + 'dis_model.h5')


# setup for matplotlib
fig = plt.figure(figsize=(10, 10))
sub_plots = []
x1, y1 = get_one_image()
x2, y2 = get_one_image()
x3, y3 = get_one_image()
x4, y4 = get_one_image()

X = np.concatenate((x1, x2, x3, x4))

for i in range(8):
    sub_plots.append(plt.subplot(2, 4, i + 1))

ani = animation.FuncAnimation(fig, animate, interval=1)

plt.show()

x, y = get_one_image()
# show a upscalle image
new = generator.predict(x)
plt.imshow(x[0])
plt.show()
plt.imshow(new[0])
plt.show()
plt.imshow(y[0])
plt.show()