Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add d2s_train_image_shape for static train #14312

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configs/rec/PP-OCRv4/ch_PP-OCRv4_rec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion configs/rec/PP-OCRv4/ch_PP-OCRv4_rec_hgnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions configs/rec/SVTRv2/rec_repsvtr_ch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion configs/rec/SVTRv2/rec_svtrv2_ch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions configs/rec/rec_latex_ocr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions configs/table/SLANet_ch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion ppocr/modeling/heads/rec_nrtr_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ def generate_square_subsequent_mask(self, sz):
"""
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])
Expand Down