기존 이미지를 변형시켜 이미지 데이터의 양을 늘리는 작업이다.
rotation_range : 이미지회전값
zoom_range : 이미지일부확대
shear_range : 이미지기울기
width_shift_range : 좌우이동
height_shift_range : 상하이동
horizontal_flip : 이미지가로뒤집기
vertical_filp : 이미지세로뒤집기

위 이미지를 보강한다면
from keras.preprocessing.image import ImageDataGenerator
img_genera
te = ImageDataGenerator(
rotation_range=30,
zoom_range=0.5,
shear_range=0.5,
width_shift_range=0.3,
height_shift_range=0.3,
horizontal_flip=True
)
augment_size=100
x_augment = img_generate.flow(np.tile(x_train[0].reshape(28*28), augment_size).reshape(-1, 28, 28, 1),\
np.zeros(augment_size), batch_size=augment_size, shuffle=False).next()[0]
print(x_augment.shape)
plt.figure(figsize=(10,10))
for c in range(100):
plt.subplot(10, 10, c+1)
plt.axis('off')
plt.imshow(x_augment[c].reshape(28,28), cmap='gray')
plt.show()
