From 484bf2f7dcd73d708bdae4269d90f4cbd3ecf7cf Mon Sep 17 00:00:00 2001 From: smilelite Date: Thu, 14 Jul 2022 22:26:10 +0800 Subject: [PATCH] modified SPINLabelEncode SPINLabelDecode --- configs/rec/rec_r32_gaspin_bilstm_att.yml | 6 +++--- ppocr/data/imaug/label_ops.py | 4 ++-- ppocr/postprocess/__init__.py | 4 ++-- ppocr/postprocess/rec_postprocess.py | 4 ++-- .../rec_r32_gaspin_bilstm_att/rec_r32_gaspin_bilstm_att.yml | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/configs/rec/rec_r32_gaspin_bilstm_att.yml b/configs/rec/rec_r32_gaspin_bilstm_att.yml index f7c1b813..aea71388 100644 --- a/configs/rec/rec_r32_gaspin_bilstm_att.yml +++ b/configs/rec/rec_r32_gaspin_bilstm_att.yml @@ -60,7 +60,7 @@ Loss: ignore_index: 0 PostProcess: - name: SPINAttnLabelDecode + name: SPINLabelDecode use_space_char: False @@ -78,7 +78,7 @@ Train: - DecodeImage: # load image img_mode: BGR channel_first: False - - SPINAttnLabelEncode: # Class handling label + - SPINLabelEncode: # Class handling label - SPINRecResizeImg: image_shape: [100, 32] interpolation : 2 @@ -101,7 +101,7 @@ Eval: - DecodeImage: # load image img_mode: BGR channel_first: False - - SPINAttnLabelEncode: # Class handling label + - SPINLabelEncode: # Class handling label - SPINRecResizeImg: image_shape: [100, 32] interpolation : 2 diff --git a/ppocr/data/imaug/label_ops.py b/ppocr/data/imaug/label_ops.py index 775ceec8..97539faf 100644 --- a/ppocr/data/imaug/label_ops.py +++ b/ppocr/data/imaug/label_ops.py @@ -1217,7 +1217,7 @@ class ABINetLabelEncode(BaseRecLabelEncode): dict_character = [''] + dict_character return dict_character -class SPINAttnLabelEncode(AttnLabelEncode): +class SPINLabelEncode(AttnLabelEncode): """ Convert between text-label and text-index """ def __init__(self, @@ -1226,7 +1226,7 @@ class SPINAttnLabelEncode(AttnLabelEncode): use_space_char=False, lower=True, **kwargs): - super(SPINAttnLabelEncode, self).__init__( + super(SPINLabelEncode, self).__init__( max_text_length, character_dict_path, use_space_char) self.lower = lower def add_special_char(self, dict_character): diff --git a/ppocr/postprocess/__init__.py b/ppocr/postprocess/__init__.py index 204ae0bd..eeebc580 100644 --- a/ppocr/postprocess/__init__.py +++ b/ppocr/postprocess/__init__.py @@ -28,7 +28,7 @@ from .fce_postprocess import FCEPostProcess from .rec_postprocess import CTCLabelDecode, AttnLabelDecode, SRNLabelDecode, \ DistillationCTCLabelDecode, NRTRLabelDecode, SARLabelDecode, \ SEEDLabelDecode, PRENLabelDecode, ViTSTRLabelDecode, ABINetLabelDecode, \ - SPINAttnLabelDecode + SPINLabelDecode from .cls_postprocess import ClsPostProcess from .pg_postprocess import PGPostProcess from .vqa_token_ser_layoutlm_postprocess import VQASerTokenLayoutLMPostProcess @@ -45,7 +45,7 @@ def build_post_process(config, global_config=None): 'SEEDLabelDecode', 'VQASerTokenLayoutLMPostProcess', 'VQAReTokenLayoutLMPostProcess', 'PRENLabelDecode', 'DistillationSARLabelDecode', 'ViTSTRLabelDecode', 'ABINetLabelDecode', - 'TableMasterLabelDecode', 'SPINAttnLabelDecode' + 'TableMasterLabelDecode', 'SPINLabelDecode' ] if config['name'] == 'PSEPostProcess': diff --git a/ppocr/postprocess/rec_postprocess.py b/ppocr/postprocess/rec_postprocess.py index 3e7c29d8..3fe29aab 100644 --- a/ppocr/postprocess/rec_postprocess.py +++ b/ppocr/postprocess/rec_postprocess.py @@ -668,12 +668,12 @@ class ABINetLabelDecode(NRTRLabelDecode): dict_character = [''] + dict_character return dict_character -class SPINAttnLabelDecode(AttnLabelDecode): +class SPINLabelDecode(AttnLabelDecode): """ Convert between text-label and text-index """ def __init__(self, character_dict_path=None, use_space_char=False, **kwargs): - super(SPINAttnLabelDecode, self).__init__(character_dict_path, + super(SPINLabelDecode, self).__init__(character_dict_path, use_space_char) def add_special_char(self, dict_character): diff --git a/test_tipc/configs/rec_r32_gaspin_bilstm_att/rec_r32_gaspin_bilstm_att.yml b/test_tipc/configs/rec_r32_gaspin_bilstm_att/rec_r32_gaspin_bilstm_att.yml index a08efe57..d0cb2048 100644 --- a/test_tipc/configs/rec_r32_gaspin_bilstm_att/rec_r32_gaspin_bilstm_att.yml +++ b/test_tipc/configs/rec_r32_gaspin_bilstm_att/rec_r32_gaspin_bilstm_att.yml @@ -61,7 +61,7 @@ Loss: ignore_index: 0 PostProcess: - name: SPINAttnLabelDecode + name: SPINLabelDecode use_space_char: False @@ -79,7 +79,7 @@ Train: - DecodeImage: # load image img_mode: BGR channel_first: False - - SPINAttnLabelEncode: # Class handling label + - SPINLabelEncode: # Class handling label - SPINRecResizeImg: image_shape: [100, 32] interpolation : 2 @@ -102,7 +102,7 @@ Eval: - DecodeImage: # load image img_mode: BGR channel_first: False - - SPINAttnLabelEncode: # Class handling label + - SPINLabelEncode: # Class handling label - SPINRecResizeImg: image_shape: [100, 32] interpolation : 2 -- GitLab