-
(Keras) pix2pix Image data generator (augmentation) 방법IT 지식 창고 2020. 7. 27. 14:23
Example of transforming images and masks together. # we create two instances with the same arguments data_gen_args = dict(featurewise_center=True, featurewise_std_normalization=True, rotation_range=90, width_shift_range=0.1, height_shift_range=0.1, zoom_range=0.2) image_datagen = ImageDataGenerator(**data_gen_args) mask_datagen = ImageDataGenerator(**data_gen_args) # Provide the same seed and keyword arguments to the fit and flow methods seed = 1 image_datagen.fit(images, augment=True, seed=seed) mask_datagen.fit(masks, augment=True, seed=seed) image_generator = image_datagen.flow_from_directory( 'data/images', class_mode=None, seed=seed) mask_generator = mask_datagen.flow_from_directory( 'data/masks', class_mode=None, seed=seed) # combine generators into one which yields image and masks train_generator = zip(image_generator, mask_generator) model.fit_generator( train_generator, steps_per_epoch=2000, epochs=50)
'IT 지식 창고' 카테고리의 다른 글
(model) 2019년 Semantic Segmentation 요약 (0) 2020.07.27 (Python) zip file 해제 code (0) 2020.07.27 (Python) python에서 exe파일 만들기 (0) 2020.07.23 (Python) argmax와 argmin은 배열 중에 가장 크거나 작은 index를 추출 (0) 2020.07.16 (Python) 0, 1, 10, 11 ... 처럼 정렬 될 때 (2) 2020.07.14 댓글