application_vnd.jupyter.stderr_output_1.png
from keras.preprocessing import image

from keras.preprocessing.image import img_to_array, load_img

import math

import numpy as np

import numpy as np # linear algebra

import os

import os

import numpy as np
import pandas as pd
import os

img_list = os.listdir('../input/all-dogs/all-dogs/')

def combine_images(generated_images):
    total = generated_images.shape[0]
    cols = int(math.sqrt(total))
    rows = math.ceil(float(total) / cols)
    width, height, ch = generated_images.shape[1:]
    output_shape = (height * rows, width * cols, ch)
    combined_image = np.zeros(output_shape)
    for index, image in enumerate(generated_images):
        i = int(index / cols)
        j = index % cols
        combined_image[width * i:width * (i + 1), height * j:height * (j + 1)] = image[:, :, :]
    return combined_image

TRAIN_IMAGE_PATH = '../input/all-dogs/all-dogs/'
GENERATED_IMAGE_PATH = '../working/images/'
GEN_GENERATED_IMAGE_PATH = '../gen_images/'

img_list = os.listdir(TRAIN_IMAGE_PATH)
X_train = []
for img in img_list:
    img = img_to_array(load_img(TRAIN_IMAGE_PATH + img, target_size=(128, 128, 3)))
    img = (img.astype(np.float32) - 127.5) / 127.5
    X_train.append(img)

len(X_train)