def _get_batches_of_transformed_samples(self, index_array):
    batch_x = np.zeros(((len(index_array),) + self.image_shape), dtype=K.floatx())
    grayscale = (self.color_mode == 'grayscale')
    for (i, j) in enumerate(index_array):
        fname = self.filenames[j]
        img = load_img(os.path.join(self.directory, fname), grayscale=grayscale, target_size=self.target_size, interpolation=self.interpolation)
        x = img_to_array(img, data_format=self.data_format)
        x = self.image_data_generator.random_transform(x)
        x = self.image_data_generator.standardize(x)
        batch_x[i] = x
    if self.save_to_dir:
        for (i, j) in enumerate(index_array):
            img = array_to_img(batch_x[i], self.data_format, scale=True)
            fname = '{prefix}_{index}_{hash}.{format}'.format(prefix=self.save_prefix, index=j, hash=np.random.randint(10000000.0), format=self.save_format)
            img.save(os.path.join(self.save_to_dir, fname))
    if (self.class_mode == 'input'):
        batch_y = batch_x.copy()
    elif (self.class_mode == 'sparse'):
        batch_y = self.classes[index_array]
    elif (self.class_mode == 'binary'):
        batch_y = self.classes[index_array].astype(K.floatx())
    elif (self.class_mode == 'categorical'):
        batch_y = np.zeros((len(batch_x), self.num_classes), dtype=K.floatx())
        for (i, label) in enumerate(self.classes[index_array]):
            batch_y[(i, label)] = 1.0
    else:
        return batch_x
    return (batch_x, batch_y)
def _get_batches_of_transformed_samples(self, index_array):
    batch_x = np.zeros(((len(index_array),) + self.image_shape), dtype=K.floatx())
    grayscale = (self.color_mode == 'grayscale')
    for (i, j) in enumerate(index_array):
        fname = self.filenames[j]
        img = load_img(os.path.join(self.directory, fname), grayscale=grayscale, target_size=self.target_size, interpolation=self.interpolation)
        x = img_to_array(img, data_format=self.data_format)
        x = self.image_data_generator.random_transform(x)
        x = self.image_data_generator.standardize(x)
        batch_x[i] = x
    if self.save_to_dir:
        for (i, j) in enumerate(index_array):
            img = array_to_img(batch_x[i], self.data_format, scale=True)
            fname = '{prefix}_{index}_{hash}.{format}'.format(prefix=self.save_prefix, index=j, hash=np.random.randint(10000000.0), format=self.save_format)
            img.save(os.path.join(self.save_to_dir, fname))
    if (self.class_mode == 'input'):
        batch_y = batch_x.copy()
    elif (self.class_mode == 'sparse'):
        batch_y = self.classes[index_array]
    elif (self.class_mode == 'binary'):
        batch_y = self.classes[index_array].astype(K.floatx())
    elif (self.class_mode == 'categorical'):
        batch_y = np.zeros((len(batch_x), self.num_classes), dtype=K.floatx())
        for (i, label) in enumerate(self.classes[index_array]):
            batch_y[(i, label)] = 1.0
    else:
        return batch_x
    return (batch_x, batch_y)