add d2s_train_image_shape for static train (#14312)

pull/14314/head
liuhongen1234567 2024-12-02 20:03:12 +08:00 committed by GitHub
parent 6a75046607
commit 6d2bc9f573
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 8 additions and 3 deletions

View File

@ -19,6 +19,7 @@ Global:
use_space_char: true
distributed: true
save_res_path: ./output/rec/predicts_ppocrv3.txt
d2s_train_image_shape: [3, 48, 320]
Optimizer:

View File

@ -19,7 +19,7 @@ Global:
use_space_char: true
distributed: true
save_res_path: ./output/rec/predicts_ppocrv3.txt
d2s_train_image_shape: [3, 48, 320]
Optimizer:
name: Adam

View File

@ -19,6 +19,7 @@ Global:
use_space_char: true
distributed: true
save_res_path: ./output/rec/predicts_repsvtr.txt
d2s_train_image_shape: [3, 48, 320]
Optimizer:
name: AdamW

View File

@ -19,7 +19,7 @@ Global:
use_space_char: true
distributed: true
save_res_path: ./output/rec/predicts_svrtv2.txt
d2s_train_image_shape: [3, 48, 320]
Optimizer:
name: AdamW

View File

@ -18,6 +18,7 @@ Global:
use_space_char: False
rec_char_dict_path: ppocr/utils/dict/latex_ocr_tokenizer.json
save_res_path: ./output/rec/predicts_latexocr.txt
d2s_train_image_shape: [1,256,256]
Optimizer:
name: AdamW

View File

@ -21,6 +21,7 @@ Global:
infer_mode: False
use_sync_bn: True
save_res_path: output/infer
d2s_train_image_shape: [3, 488, 488]
Optimizer:
name: Adam

View File

@ -355,7 +355,8 @@ class Transformer(nn.Layer):
"""
mask = paddle.zeros([sz, sz], dtype="float32")
mask_inf = paddle.triu(
paddle.full(shape=[sz, sz], dtype="float32", fill_value="-inf"), diagonal=1
paddle.full(shape=[sz, sz], dtype="float32", fill_value=float("-inf")),
diagonal=1,
)
mask = mask + mask_inf
return mask.unsqueeze([0, 1])