目錄
PSE代碼分析,實現模型性能優化;
1.數據增強
對文本樣本數據進行數據增強:
def augmentation(im: np.ndarray, text_polys: np.ndarray, scales: np.ndarray, degrees: int, input_size: int) -> tuple:
# the images are rescaled with ratio {0.5, 1.0, 2.0, 3.0} randomly
im, text_polys = data_aug.random_scale(im, text_polys, scales) #從scales中隨機選擇一個尺度,對圖片和文本框進行縮放
# the images are horizontally fliped and rotated in range [−10◦, 10◦] randomly
if