數據擴增
tflearn.data_augmentation.DataAugmentation (self)
基本類別是以套用常見即時數據擴增。
此類別須用作 input_data
的參數。訓練模型時,定義的擴增方法只會在訓練時間套用。請注意 DataPreprocessing 類似於 DataAugmentation,但會在訓練時間與測試時間套用。
參數
- 無
影像擴增
tflearn.data_augmentation.ImageAugmentation (self)
基本類別是以套用影像相關的即時擴增。
此類別須用作 input_data
的參數。訓練模型時,定義的擴增方法只會在訓練時間套用。請注意 ImagePreprocessing 類似於 ImageAugmentation,但會在訓練時間與測試時間套用。
參數
- 無。
方法
add_random_90degrees_rotation (rotations=[0, 1, 2, 3])
隨機執行 90 度旋轉。
參數
- rotations:
清單
。允許的 90 度旋轉。
add_random_blur (sigma_max=5.0)
套用標準差為任意的 (0., sigma_max) 高斯濾波器,隨機模糊影像。
參數
- sigma:
浮點數
或浮點數
清單。高斯核心的標準差。高斯濾波器的標準差會提供給各座標軸作為順序,或當成單一數字,這樣對所有座標軸都一樣。
傳回值
無。
add_random_crop (crop_shape, padding=None)
根據「crop_shape」,隨機裁剪圖片。可選用「padding」指定參數,以 0 填充圖片(保留原始影像形狀)。
範例
# Example: pictures of 32x32
imgaug = tflearn.ImageAugmentation()
# Random crop of 24x24 into a 32x32 picture => output 24x24
imgaug.add_random_crop((24, 24))
# Random crop of 32x32 with image padding of 6 (to conserve original image shape) => output 32x32
imgaug.add_random_crop((32, 32), 6)
參數
- crop_shape:
int 的
tuple
。裁剪形狀(高度、寬度)。 - padding:
int
。如果沒有 None,影像會以『padding』個 0 來填充。
傳回值
無。
add_random_flip_leftright(self)
隨意翻轉影像(從左至右)。
傳回值
無。
add_random_flip_updown(self)
隨意翻轉影像(上下顛倒)。
傳回值
無。
add_random_rotation(max_angle=20.0)
隨意旋轉影像,旋轉角度為隨機角度(-max_angle,max_angle)。
參數
- max_angle:
float
。最大旋轉角度。
傳回值
無。