【字符分割】PSENet原理和代碼淺讀之代碼

目錄

1.數據增強

2.生成segment mask

3.loss計算


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 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章