train_datagen = ImageDataGenerator(rescale = 1 / 255.0, rotation_range = 30, width_shift_range = 0.2, height_shift_range = 0.2, shear_range = 0.2, zoom_range = 0.2, horizontal_flip = True)
rotation_range is a value in degrees (0–180), a range within which to randomly rotate pictures.
width_shift and height_shift are ranges (as a fraction of total width or height) within which to randomly translate pictures vertically or horizontally.
shear_range is for randomly applying shearing transformations.
zoom_range is for randomly zooming inside pictures.
horizontal_flip is for randomly flipping half of the images horizontally. This is relevant when there are no assumptions of horizontal assymmetry (e.g. real-world pictures).
위 설명들을 참조해서 ImageDataGenerator의 파라미터에 대입해 주면 이미지 데이터 증강이 된다.
'인공지능 > 텐서플로우' 카테고리의 다른 글
Transfer Learning을 하기 위한 코드와 설명 (0) | 2022.06.16 |
---|---|
파일을, training과 test 디렉토리로 나눠서 저장하는 방법 (0) | 2022.06.15 |
이미지 파일을, 학습데이터로 만드는 방법 (텐서플로우의 ImageDataGenerator) (0) | 2022.06.15 |
파이썬으로 압축파일 푸는 방법 (0) | 2022.06.15 |
구글 코랩에서, 인터넷에 있는 파일을 다운로드 하는 방법 (0) | 2022.06.15 |