From 3482707fbcd9b4d760b3bcb97574a2d70f17f3f1 Mon Sep 17 00:00:00 2001 From: Zhang Jun Date: Fri, 24 May 2024 11:47:29 +0800 Subject: [PATCH] commit fix by running pre-commit run -a --- .../PaddleOCR_DBNet/data_loader/dataset.py | 6 ++--- deploy/pdserving/ocr_reader.py | 2 +- deploy/pdserving/win/ocr_reader.py | 2 +- ppocr/data/imaug/drrg_targets.py | 2 +- ppocr/data/imaug/east_process.py | 2 +- ppocr/data/imaug/fce_aug.py | 4 ++-- ppocr/data/imaug/fce_targets.py | 2 +- ppocr/data/imaug/label_ops.py | 24 +++++++++---------- ppocr/data/imaug/operators.py | 2 +- ppocr/data/imaug/pg_process.py | 2 +- ppocr/data/imaug/random_crop_data.py | 2 +- ppocr/data/imaug/rec_img_aug.py | 18 +++++++------- ppocr/data/imaug/sast_process.py | 2 +- ppocr/data/imaug/vqa/token/vqa_token_pad.py | 2 +- ppocr/losses/det_basic_loss.py | 2 +- ppocr/losses/det_db_loss.py | 2 +- ppocr/losses/det_pse_loss.py | 2 +- ppocr/losses/distillation_loss.py | 6 ++--- ppocr/losses/rec_aster_loss.py | 2 +- ppocr/losses/rec_enhanced_ctc_loss.py | 2 +- ppocr/metrics/e2e_metric.py | 2 +- ppocr/metrics/table_metric.py | 2 +- ppocr/modeling/backbones/rec_hgnet.py | 4 ++-- ppocr/modeling/backbones/rec_lcnetv3.py | 2 +- ppocr/modeling/backbones/rec_mobilenet_v3.py | 2 +- ppocr/modeling/backbones/rec_mv1_enhance.py | 2 +- ppocr/modeling/backbones/rec_svtrv2.py | 4 ++-- ppocr/modeling/backbones/rec_vit.py | 2 +- ppocr/modeling/backbones/rec_vitstr.py | 2 +- ppocr/modeling/backbones/vqa_layoutlm.py | 2 +- ppocr/modeling/heads/det_drrg_head.py | 2 +- ppocr/modeling/heads/rec_abinet_head.py | 2 +- ppocr/modeling/heads/rec_aster_head.py | 2 +- ppocr/modeling/heads/rec_cppd_head.py | 2 +- ppocr/modeling/heads/rec_ctc_head.py | 2 +- ppocr/modeling/heads/rec_multi_head.py | 4 ++-- ppocr/modeling/heads/rec_parseq_head.py | 2 +- ppocr/modeling/heads/rec_rfl_head.py | 6 ++--- .../modeling/heads/rec_robustscanner_head.py | 2 +- ppocr/modeling/heads/rec_sar_head.py | 6 ++--- ppocr/modeling/heads/rec_srn_head.py | 2 +- ppocr/modeling/heads/table_att_head.py | 4 ++-- ppocr/modeling/heads/table_master_head.py | 2 +- ppocr/modeling/necks/db_fpn.py | 2 +- ppocr/modeling/transforms/tsrn.py | 2 +- ppocr/optimizer/learning_rate.py | 16 ++++++------- ppocr/optimizer/optimizer.py | 8 +++---- ppocr/postprocess/db_postprocess.py | 4 ++-- ppocr/postprocess/fce_postprocess.py | 2 +- ppocr/postprocess/pg_postprocess.py | 2 +- .../pse_postprocess/pse_postprocess.py | 2 +- ppocr/postprocess/rec_postprocess.py | 4 ++-- ppocr/postprocess/sast_postprocess.py | 2 +- ppocr/postprocess/table_postprocess.py | 2 +- ppocr/utils/save_load.py | 2 +- .../table/table_metric/table_metric.py | 2 +- test_tipc/supplementary/optimizer.py | 4 ++-- 57 files changed, 102 insertions(+), 102 deletions(-) diff --git a/benchmark/PaddleOCR_DBNet/data_loader/dataset.py b/benchmark/PaddleOCR_DBNet/data_loader/dataset.py index b37f018399..5353ec8deb 100644 --- a/benchmark/PaddleOCR_DBNet/data_loader/dataset.py +++ b/benchmark/PaddleOCR_DBNet/data_loader/dataset.py @@ -21,7 +21,7 @@ def __init__( filter_keys, ignore_tags, transform=None, - **kwargs + **kwargs, ): super().__init__( data_path, img_mode, pre_processes, filter_keys, ignore_tags, transform @@ -75,7 +75,7 @@ def __init__( filter_keys, ignore_tags, transform=None, - **kwargs + **kwargs, ): self.load_char_annotation = kwargs["load_char_annotation"] self.expand_one_char = kwargs["expand_one_char"] @@ -138,7 +138,7 @@ def __init__( pre_processes, filter_keys, transform=None, - **kwargs + **kwargs, ): self.transform = transform self.dataRoot = pathlib.Path(data_path) diff --git a/deploy/pdserving/ocr_reader.py b/deploy/pdserving/ocr_reader.py index 81d90b755e..7c1349dc9d 100644 --- a/deploy/pdserving/ocr_reader.py +++ b/deploy/pdserving/ocr_reader.py @@ -254,7 +254,7 @@ def __init__( # character_dict_path=None, # character_type='ch', # use_space_char=False, - **kwargs + **kwargs, ): super(CTCLabelDecode, self).__init__(config) diff --git a/deploy/pdserving/win/ocr_reader.py b/deploy/pdserving/win/ocr_reader.py index 6b2a4f8078..8175211443 100644 --- a/deploy/pdserving/win/ocr_reader.py +++ b/deploy/pdserving/win/ocr_reader.py @@ -254,7 +254,7 @@ def __init__( # character_dict_path=None, # character_type='ch', # use_space_char=False, - **kwargs + **kwargs, ): super(CTCLabelDecode, self).__init__(config) diff --git a/ppocr/data/imaug/drrg_targets.py b/ppocr/data/imaug/drrg_targets.py index 5c2ba7caa9..5a89754aac 100644 --- a/ppocr/data/imaug/drrg_targets.py +++ b/ppocr/data/imaug/drrg_targets.py @@ -38,7 +38,7 @@ def __init__( min_rand_half_height=8.0, max_rand_half_height=24.0, jitter_level=0.2, - **kwargs + **kwargs, ): super().__init__() self.orientation_thr = orientation_thr diff --git a/ppocr/data/imaug/east_process.py b/ppocr/data/imaug/east_process.py index c3fbf88243..76515d5a42 100644 --- a/ppocr/data/imaug/east_process.py +++ b/ppocr/data/imaug/east_process.py @@ -32,7 +32,7 @@ def __init__( background_ratio=0.125, min_crop_side_ratio=0.1, min_text_size=10, - **kwargs + **kwargs, ): self.input_size = image_shape[1] self.random_scale = np.array([0.5, 1, 2.0, 3.0]) diff --git a/ppocr/data/imaug/fce_aug.py b/ppocr/data/imaug/fce_aug.py index 39657a0243..2697344977 100644 --- a/ppocr/data/imaug/fce_aug.py +++ b/ppocr/data/imaug/fce_aug.py @@ -359,7 +359,7 @@ def __init__( max_angle=10, pad_with_fixed_color=False, pad_value=(0, 0, 0), - **kwargs + **kwargs, ): """Randomly rotate images and polygon masks. @@ -487,7 +487,7 @@ def __init__( pad_ratio=0.6, pad_with_fixed_color=False, pad_value=(0, 0, 0), - **kwargs + **kwargs, ): """Resize or pad images to be square shape. diff --git a/ppocr/data/imaug/fce_targets.py b/ppocr/data/imaug/fce_targets.py index acceff30d6..99559804ad 100644 --- a/ppocr/data/imaug/fce_targets.py +++ b/ppocr/data/imaug/fce_targets.py @@ -53,7 +53,7 @@ def __init__( level_size_divisors=(8, 16, 32), level_proportion_range=((0, 0.25), (0.2, 0.65), (0.55, 1.0)), orientation_thr=2.0, - **kwargs + **kwargs, ): super().__init__() assert isinstance(level_size_divisors, tuple) diff --git a/ppocr/data/imaug/label_ops.py b/ppocr/data/imaug/label_ops.py index 58c6610f8c..46cabaed8c 100644 --- a/ppocr/data/imaug/label_ops.py +++ b/ppocr/data/imaug/label_ops.py @@ -589,7 +589,7 @@ def __init__( max_text_length=25, character_dict_path=None, use_space_char=False, - **kwargs + **kwargs, ): super(SRNLabelEncode, self).__init__( max_text_length, character_dict_path, use_space_char @@ -638,7 +638,7 @@ def __init__( merge_no_span_structure=False, learn_empty_box=False, loc_reg_num=4, - **kwargs + **kwargs, ): self.max_text_len = max_text_length self.lower = False @@ -786,7 +786,7 @@ def __init__( merge_no_span_structure=False, learn_empty_box=False, loc_reg_num=4, - **kwargs + **kwargs, ): super(TableMasterLabelEncode, self).__init__( max_text_length, @@ -795,7 +795,7 @@ def __init__( merge_no_span_structure, learn_empty_box, loc_reg_num, - **kwargs + **kwargs, ) self.pad_idx = self.dict[self.pad_str] self.unknown_idx = self.dict[self.unknown_str] @@ -909,7 +909,7 @@ def __init__( character_dict_path=None, use_space_char=False, lower=False, - **kwargs + **kwargs, ): super(SATRNLabelEncode, self).__init__( max_text_length, character_dict_path, use_space_char @@ -1019,7 +1019,7 @@ def __init__( order_method=None, infer_mode=False, ocr_engine=None, - **kwargs + **kwargs, ): super(VQATokenLabelEncode, self).__init__() from paddlenlp.transformers import ( @@ -1273,7 +1273,7 @@ def __init__( character_dict_path=None, use_space_char=False, gtc_encode=None, - **kwargs + **kwargs, ): super(MultiLabelEncode, self).__init__( max_text_length, character_dict_path, use_space_char @@ -1381,7 +1381,7 @@ def __init__( character_dict_path=None, use_space_char=False, ignore_index=0, - **kwargs + **kwargs, ): super(ViTSTRLabelEncode, self).__init__( max_text_length, character_dict_path, use_space_char @@ -1416,7 +1416,7 @@ def __init__( character_dict_path=None, use_space_char=False, ignore_index=100, - **kwargs + **kwargs, ): super(ABINetLabelEncode, self).__init__( max_text_length, character_dict_path, use_space_char @@ -1497,7 +1497,7 @@ def __init__( character_dict_path=None, use_space_char=False, lower=True, - **kwargs + **kwargs, ): super(SPINLabelEncode, self).__init__( max_text_length, character_dict_path, use_space_char @@ -1619,7 +1619,7 @@ def __init__( max_text_length=100, use_space_char=False, lower=True, - **kwargs + **kwargs, ): super(CANLabelEncode, self).__init__( max_text_length, character_dict_path, use_space_char, lower @@ -1654,7 +1654,7 @@ def __init__( use_space_char=False, ch=False, ignore_index=100, - **kwargs + **kwargs, ): super(CPPDLabelEncode, self).__init__( max_text_length, character_dict_path, use_space_char diff --git a/ppocr/data/imaug/operators.py b/ppocr/data/imaug/operators.py index 781e30d7ca..e1d192d09c 100644 --- a/ppocr/data/imaug/operators.py +++ b/ppocr/data/imaug/operators.py @@ -465,7 +465,7 @@ def __init__( min_ratio=1, mask=False, infer_mode=False, - **kwargs + **kwargs, ): self.imgH = imgH self.imgW = imgW diff --git a/ppocr/data/imaug/pg_process.py b/ppocr/data/imaug/pg_process.py index 08f4dad465..cdd816ccb1 100644 --- a/ppocr/data/imaug/pg_process.py +++ b/ppocr/data/imaug/pg_process.py @@ -37,7 +37,7 @@ def __init__( min_text_size=4, max_text_size=512, point_gather_mode=None, - **kwargs + **kwargs, ): self.tcl_len = tcl_len self.max_text_length = max_text_length diff --git a/ppocr/data/imaug/random_crop_data.py b/ppocr/data/imaug/random_crop_data.py index f3f2e3eeac..6625776fa1 100644 --- a/ppocr/data/imaug/random_crop_data.py +++ b/ppocr/data/imaug/random_crop_data.py @@ -133,7 +133,7 @@ def __init__( max_tries=10, min_crop_side_ratio=0.1, keep_ratio=True, - **kwargs + **kwargs, ): self.size = size self.max_tries = max_tries diff --git a/ppocr/data/imaug/rec_img_aug.py b/ppocr/data/imaug/rec_img_aug.py index a79436021e..2420e424be 100644 --- a/ppocr/data/imaug/rec_img_aug.py +++ b/ppocr/data/imaug/rec_img_aug.py @@ -41,7 +41,7 @@ def __init__( jitter_prob=0.4, blur_prob=0.4, hsv_aug_prob=0.4, - **kwargs + **kwargs, ): self.tia_prob = tia_prob self.bda = BaseDataAugmentation( @@ -74,7 +74,7 @@ def __init__( jitter_prob=0.4, blur_prob=0.4, hsv_aug_prob=0.4, - **kwargs + **kwargs, ): self.crop_prob = crop_prob self.reverse_prob = reverse_prob @@ -151,7 +151,7 @@ def __init__( image_shape=(32, 320, 3), max_text_length=25, ext_data_num=1, - **kwargs + **kwargs, ): self.ext_data_num = ext_data_num self.prob = prob @@ -199,7 +199,7 @@ def __init__( geometry_p=0.5, deterioration_p=0.25, colorjitter_p=0.25, - **kwargs + **kwargs, ): self.transforms = Compose( [ @@ -237,7 +237,7 @@ def __init__( geometry_p=0.5, deterioration_p=0.25, colorjitter_p=0.25, - **kwargs + **kwargs, ): self.transforms = Compose( [ @@ -289,7 +289,7 @@ def __init__( eval_mode=False, character_dict_path="./ppocr/utils/ppocr_keys_v1.txt", padding=True, - **kwargs + **kwargs, ): self.image_shape = image_shape self.infer_mode = infer_mode @@ -315,7 +315,7 @@ def __init__( infer_mode=False, character_dict_path="./ppocr/utils/ppocr_keys_v1.txt", padding=True, - **kwargs + **kwargs, ): self.image_shape = image_shape self.infer_mode = infer_mode @@ -437,7 +437,7 @@ def __init__( interpolation=2, mean=(127.5, 127.5, 127.5), std=(127.5, 127.5, 127.5), - **kwargs + **kwargs, ): self.image_shape = image_shape @@ -485,7 +485,7 @@ def __init__( inter_type="Image.Resampling.LANCZOS", scale=True, padding=False, - **kwargs + **kwargs, ): self.image_shape = image_shape self.resize_type = resize_type diff --git a/ppocr/data/imaug/sast_process.py b/ppocr/data/imaug/sast_process.py index 81e13930e6..91e1f9b227 100644 --- a/ppocr/data/imaug/sast_process.py +++ b/ppocr/data/imaug/sast_process.py @@ -33,7 +33,7 @@ def __init__( min_crop_side_ratio=0.3, min_text_size=10, max_text_size=512, - **kwargs + **kwargs, ): self.input_size = image_shape[1] self.min_crop_size = min_crop_size diff --git a/ppocr/data/imaug/vqa/token/vqa_token_pad.py b/ppocr/data/imaug/vqa/token/vqa_token_pad.py index 5983cb75e8..9466e37507 100644 --- a/ppocr/data/imaug/vqa/token/vqa_token_pad.py +++ b/ppocr/data/imaug/vqa/token/vqa_token_pad.py @@ -26,7 +26,7 @@ def __init__( return_overflowing_tokens=False, return_special_tokens_mask=False, infer_mode=False, - **kwargs + **kwargs, ): self.max_seq_len = max_seq_len self.pad_to_max_seq_len = max_seq_len diff --git a/ppocr/losses/det_basic_loss.py b/ppocr/losses/det_basic_loss.py index 248c3bad53..5a46e072e2 100644 --- a/ppocr/losses/det_basic_loss.py +++ b/ppocr/losses/det_basic_loss.py @@ -34,7 +34,7 @@ def __init__( negative_ratio=3, return_origin=False, eps=1e-6, - **kwargs + **kwargs, ): """ The BalanceLoss for Differentiable Binarization text detection diff --git a/ppocr/losses/det_db_loss.py b/ppocr/losses/det_db_loss.py index 67201e0462..032afe7bc8 100755 --- a/ppocr/losses/det_db_loss.py +++ b/ppocr/losses/det_db_loss.py @@ -41,7 +41,7 @@ def __init__( beta=10, ohem_ratio=3, eps=1e-6, - **kwargs + **kwargs, ): super(DBLoss, self).__init__() self.alpha = alpha diff --git a/ppocr/losses/det_pse_loss.py b/ppocr/losses/det_pse_loss.py index 8c4b2b4244..962339b84c 100644 --- a/ppocr/losses/det_pse_loss.py +++ b/ppocr/losses/det_pse_loss.py @@ -31,7 +31,7 @@ def __init__( kernel_sample_mask="pred", reduction="sum", eps=1e-6, - **kwargs + **kwargs, ): """Implement PSE Loss.""" super(PSELoss, self).__init__() diff --git a/ppocr/losses/distillation_loss.py b/ppocr/losses/distillation_loss.py index 6313f8d8ea..cd66bca89d 100644 --- a/ppocr/losses/distillation_loss.py +++ b/ppocr/losses/distillation_loss.py @@ -675,7 +675,7 @@ def __init__( multi_head=False, smoothing=True, name="loss_nrtr", - **kwargs + **kwargs, ): super().__init__(smoothing=smoothing) self.model_name_list = model_name_list @@ -713,7 +713,7 @@ def __init__( ohem_ratio=3, eps=1e-6, name="db", - **kwargs + **kwargs, ): super().__init__() self.model_name_list = model_name_list @@ -935,7 +935,7 @@ def __init__( key=None, index=None, name="loss_distance", - **kargs + **kargs, ): super().__init__(mode=mode, **kargs) assert isinstance(model_name_pairs, list) diff --git a/ppocr/losses/rec_aster_loss.py b/ppocr/losses/rec_aster_loss.py index eff53d2906..8a8faa1754 100644 --- a/ppocr/losses/rec_aster_loss.py +++ b/ppocr/losses/rec_aster_loss.py @@ -50,7 +50,7 @@ def __init__( ignore_index=-100, sequence_normalize=False, sample_normalize=True, - **kwargs + **kwargs, ): super(AsterLoss, self).__init__() self.weight = weight diff --git a/ppocr/losses/rec_enhanced_ctc_loss.py b/ppocr/losses/rec_enhanced_ctc_loss.py index ef88270392..e7e0696dfb 100644 --- a/ppocr/losses/rec_enhanced_ctc_loss.py +++ b/ppocr/losses/rec_enhanced_ctc_loss.py @@ -35,7 +35,7 @@ def __init__( feat_dim=96, init_center=False, center_file_path=None, - **kwargs + **kwargs, ): super(EnhancedCTCLoss, self).__init__() self.ctc_loss_func = CTCLoss(use_focal_loss=use_focal_loss) diff --git a/ppocr/metrics/e2e_metric.py b/ppocr/metrics/e2e_metric.py index 2cf563f13e..97796c4b43 100644 --- a/ppocr/metrics/e2e_metric.py +++ b/ppocr/metrics/e2e_metric.py @@ -29,7 +29,7 @@ def __init__( gt_mat_dir, character_dict_path, main_indicator="f_score_e2e", - **kwargs + **kwargs, ): self.mode = mode self.gt_mat_dir = gt_mat_dir diff --git a/ppocr/metrics/table_metric.py b/ppocr/metrics/table_metric.py index 3f319c8ca2..98847e1aa1 100644 --- a/ppocr/metrics/table_metric.py +++ b/ppocr/metrics/table_metric.py @@ -77,7 +77,7 @@ def __init__( compute_bbox_metric=False, box_format="xyxy", del_thead_tbody=False, - **kwargs + **kwargs, ): """ diff --git a/ppocr/modeling/backbones/rec_hgnet.py b/ppocr/modeling/backbones/rec_hgnet.py index 1d59f2501c..7a557e5a73 100644 --- a/ppocr/modeling/backbones/rec_hgnet.py +++ b/ppocr/modeling/backbones/rec_hgnet.py @@ -335,7 +335,7 @@ def PPHGNet_small(pretrained=False, use_ssld=False, det=False, **kwargs): stage_config=stage_config_det if det else stage_config_rec, layer_num=6, det=det, - **kwargs + **kwargs, ) return model @@ -363,6 +363,6 @@ def PPHGNet_base(pretrained=False, use_ssld=True, **kwargs): stage_config=stage_config, layer_num=7, dropout_prob=0.2, - **kwargs + **kwargs, ) return model diff --git a/ppocr/modeling/backbones/rec_lcnetv3.py b/ppocr/modeling/backbones/rec_lcnetv3.py index 48a43f8bb5..b54670c600 100644 --- a/ppocr/modeling/backbones/rec_lcnetv3.py +++ b/ppocr/modeling/backbones/rec_lcnetv3.py @@ -395,7 +395,7 @@ def __init__( lr_mult_list=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0], lab_lr=0.1, det=False, - **kwargs + **kwargs, ): super().__init__() self.scale = scale diff --git a/ppocr/modeling/backbones/rec_mobilenet_v3.py b/ppocr/modeling/backbones/rec_mobilenet_v3.py index 12831dcad8..00ee5a3da0 100644 --- a/ppocr/modeling/backbones/rec_mobilenet_v3.py +++ b/ppocr/modeling/backbones/rec_mobilenet_v3.py @@ -32,7 +32,7 @@ def __init__( large_stride=None, small_stride=None, disable_se=False, - **kwargs + **kwargs, ): super(MobileNetV3, self).__init__() self.disable_se = disable_se diff --git a/ppocr/modeling/backbones/rec_mv1_enhance.py b/ppocr/modeling/backbones/rec_mv1_enhance.py index 13c9de8698..f20fa4cb1d 100644 --- a/ppocr/modeling/backbones/rec_mv1_enhance.py +++ b/ppocr/modeling/backbones/rec_mv1_enhance.py @@ -118,7 +118,7 @@ def __init__( last_conv_stride=1, last_pool_type="max", last_pool_kernel_size=[3, 2], - **kwargs + **kwargs, ): super().__init__() self.scale = scale diff --git a/ppocr/modeling/backbones/rec_svtrv2.py b/ppocr/modeling/backbones/rec_svtrv2.py index 31ce55a65a..03281b30d8 100644 --- a/ppocr/modeling/backbones/rec_svtrv2.py +++ b/ppocr/modeling/backbones/rec_svtrv2.py @@ -323,7 +323,7 @@ def __init__( act=nn.GELU, eps=1e-6, downsample=None, - **kwargs + **kwargs, ): super().__init__() self.dim = dim @@ -506,7 +506,7 @@ def __init__( eps=1e-6, use_pool=False, feat2d=False, - **kwargs + **kwargs, ): super().__init__() num_stages = len(depths) diff --git a/ppocr/modeling/backbones/rec_vit.py b/ppocr/modeling/backbones/rec_vit.py index d492eea426..165b868f46 100644 --- a/ppocr/modeling/backbones/rec_vit.py +++ b/ppocr/modeling/backbones/rec_vit.py @@ -196,7 +196,7 @@ def __init__( epsilon=1e-6, act="nn.GELU", prenorm=False, - **kwargs + **kwargs, ): super().__init__() self.embed_dim = embed_dim diff --git a/ppocr/modeling/backbones/rec_vitstr.py b/ppocr/modeling/backbones/rec_vitstr.py index 564e579d26..87b5dac881 100644 --- a/ppocr/modeling/backbones/rec_vitstr.py +++ b/ppocr/modeling/backbones/rec_vitstr.py @@ -51,7 +51,7 @@ def __init__( act_layer="nn.GELU", epsilon=1e-6, out_channels=None, - **kwargs + **kwargs, ): super().__init__() self.seqlen = seqlen diff --git a/ppocr/modeling/backbones/vqa_layoutlm.py b/ppocr/modeling/backbones/vqa_layoutlm.py index cbcf804a71..c80cb14523 100644 --- a/ppocr/modeling/backbones/vqa_layoutlm.py +++ b/ppocr/modeling/backbones/vqa_layoutlm.py @@ -58,7 +58,7 @@ def __init__( type="ser", pretrained=True, checkpoints=None, - **kwargs + **kwargs, ): super(NLPBaseModel, self).__init__() if checkpoints is not None: # load the trained model diff --git a/ppocr/modeling/heads/det_drrg_head.py b/ppocr/modeling/heads/det_drrg_head.py index 24dc12fef5..4d6f875d92 100644 --- a/ppocr/modeling/heads/det_drrg_head.py +++ b/ppocr/modeling/heads/det_drrg_head.py @@ -50,7 +50,7 @@ def __init__( center_region_thr=0.2, center_region_area_thr=50, local_graph_thr=0.7, - **kwargs + **kwargs, ): super().__init__() diff --git a/ppocr/modeling/heads/rec_abinet_head.py b/ppocr/modeling/heads/rec_abinet_head.py index d666846c1c..2cc847d618 100644 --- a/ppocr/modeling/heads/rec_abinet_head.py +++ b/ppocr/modeling/heads/rec_abinet_head.py @@ -117,7 +117,7 @@ def __init__( h=8, w=32, mode="nearest", - **kwargs + **kwargs, ): super().__init__() self.max_length = max_length diff --git a/ppocr/modeling/heads/rec_aster_head.py b/ppocr/modeling/heads/rec_aster_head.py index dbef77f68b..ca4809f0c6 100644 --- a/ppocr/modeling/heads/rec_aster_head.py +++ b/ppocr/modeling/heads/rec_aster_head.py @@ -36,7 +36,7 @@ def __init__( max_len_labels, time_step=25, beam_width=5, - **kwargs + **kwargs, ): super(AsterHead, self).__init__() self.num_classes = out_channels diff --git a/ppocr/modeling/heads/rec_cppd_head.py b/ppocr/modeling/heads/rec_cppd_head.py index 87c4037798..c29946b6b4 100644 --- a/ppocr/modeling/heads/rec_cppd_head.py +++ b/ppocr/modeling/heads/rec_cppd_head.py @@ -217,7 +217,7 @@ def __init__( max_len=25, vis_seq=50, ch=False, - **kwargs + **kwargs, ): super(CPPDHead, self).__init__() diff --git a/ppocr/modeling/heads/rec_ctc_head.py b/ppocr/modeling/heads/rec_ctc_head.py index 6c008bbeda..5e19a9ab30 100755 --- a/ppocr/modeling/heads/rec_ctc_head.py +++ b/ppocr/modeling/heads/rec_ctc_head.py @@ -40,7 +40,7 @@ def __init__( fc_decay=0.0004, mid_channels=None, return_feats=False, - **kwargs + **kwargs, ): super(CTCHead, self).__init__() if mid_channels is None: diff --git a/ppocr/modeling/heads/rec_multi_head.py b/ppocr/modeling/heads/rec_multi_head.py index 50887d7c86..be4461567b 100644 --- a/ppocr/modeling/heads/rec_multi_head.py +++ b/ppocr/modeling/heads/rec_multi_head.py @@ -83,7 +83,7 @@ def __init__(self, in_channels, out_channels_list, **kwargs): self.sar_head = eval(name)( in_channels=in_channels, out_channels=out_channels_list["SARLabelDecode"], - **sar_args + **sar_args, ) elif name == "NRTRHead": gtc_args = self.head_list[idx][name] @@ -124,7 +124,7 @@ def __init__(self, in_channels, out_channels_list, **kwargs): self.ctc_head = eval(name)( in_channels=self.ctc_encoder.out_channels, out_channels=out_channels_list["CTCLabelDecode"], - **head_args + **head_args, ) else: raise NotImplementedError( diff --git a/ppocr/modeling/heads/rec_parseq_head.py b/ppocr/modeling/heads/rec_parseq_head.py index de27d1145b..6fc2dc3863 100644 --- a/ppocr/modeling/heads/rec_parseq_head.py +++ b/ppocr/modeling/heads/rec_parseq_head.py @@ -222,7 +222,7 @@ def __init__( decode_ar, refine_iters, dropout, - **kwargs + **kwargs, ): super().__init__() diff --git a/ppocr/modeling/heads/rec_rfl_head.py b/ppocr/modeling/heads/rec_rfl_head.py index 9eadfb0dad..e56d6f8fc2 100644 --- a/ppocr/modeling/heads/rec_rfl_head.py +++ b/ppocr/modeling/heads/rec_rfl_head.py @@ -58,7 +58,7 @@ def __init__( out_channels=38, use_cnt=True, use_seq=True, - **kwargs + **kwargs, ): super(RFLHead, self).__init__() assert use_cnt or use_seq @@ -69,14 +69,14 @@ def __init__( embed_size=in_channels, encode_length=batch_max_legnth + 1, out_channels=out_channels, - **kwargs + **kwargs, ) if self.use_seq: self.seq_head = AttentionLSTM( in_channels=in_channels, out_channels=out_channels, hidden_size=hidden_size, - **kwargs + **kwargs, ) self.batch_max_legnth = batch_max_legnth self.num_class = out_channels diff --git a/ppocr/modeling/heads/rec_robustscanner_head.py b/ppocr/modeling/heads/rec_robustscanner_head.py index ba8d07753a..2289f1c8d2 100644 --- a/ppocr/modeling/heads/rec_robustscanner_head.py +++ b/ppocr/modeling/heads/rec_robustscanner_head.py @@ -695,7 +695,7 @@ def __init__( mask=True, padding_idx=None, encode_value=False, - **kwargs + **kwargs, ): super(RobustScannerHead, self).__init__() diff --git a/ppocr/modeling/heads/rec_sar_head.py b/ppocr/modeling/heads/rec_sar_head.py index 906cff0d8c..928e44563c 100644 --- a/ppocr/modeling/heads/rec_sar_head.py +++ b/ppocr/modeling/heads/rec_sar_head.py @@ -47,7 +47,7 @@ def __init__( d_model=512, d_enc=512, mask=True, - **kwargs + **kwargs, ): super().__init__() assert isinstance(enc_bi_rnn, bool) @@ -167,7 +167,7 @@ def __init__( max_text_length=30, mask=True, pred_concat=True, - **kwargs + **kwargs, ): super().__init__() @@ -361,7 +361,7 @@ def __init__( d_k=512, pred_dropout=0.1, pred_concat=True, - **kwargs + **kwargs, ): super(SARHead, self).__init__() diff --git a/ppocr/modeling/heads/rec_srn_head.py b/ppocr/modeling/heads/rec_srn_head.py index a56038ddf4..b36edb8fac 100644 --- a/ppocr/modeling/heads/rec_srn_head.py +++ b/ppocr/modeling/heads/rec_srn_head.py @@ -249,7 +249,7 @@ def __init__( num_encoder_TUs, num_decoder_TUs, hidden_dims, - **kwargs + **kwargs, ): super(SRNHead, self).__init__() self.char_num = out_channels diff --git a/ppocr/modeling/heads/table_att_head.py b/ppocr/modeling/heads/table_att_head.py index 7e2dc21963..67376a0644 100644 --- a/ppocr/modeling/heads/table_att_head.py +++ b/ppocr/modeling/heads/table_att_head.py @@ -49,7 +49,7 @@ def __init__( max_text_length=800, out_channels=30, loc_reg_num=4, - **kwargs + **kwargs, ): super(TableAttentionHead, self).__init__() self.input_size = in_channels[-1] @@ -259,7 +259,7 @@ def __init__( loc_reg_num=4, fc_decay=0.0, use_attn=False, - **kwargs + **kwargs, ): """ @param in_channels: input shape diff --git a/ppocr/modeling/heads/table_master_head.py b/ppocr/modeling/heads/table_master_head.py index 2785a2b0ac..629c6f6013 100644 --- a/ppocr/modeling/heads/table_master_head.py +++ b/ppocr/modeling/heads/table_master_head.py @@ -39,7 +39,7 @@ def __init__( dropout=0, max_text_length=500, loc_reg_num=4, - **kwargs + **kwargs, ): super(TableMasterHead, self).__init__() hidden_size = in_channels[-1] diff --git a/ppocr/modeling/necks/db_fpn.py b/ppocr/modeling/necks/db_fpn.py index 4c74f36bc0..5c1674b434 100644 --- a/ppocr/modeling/necks/db_fpn.py +++ b/ppocr/modeling/necks/db_fpn.py @@ -42,7 +42,7 @@ def __init__( groups=None, if_act=True, act="relu", - **kwargs + **kwargs, ): super(DSConv, self).__init__() if groups == None: diff --git a/ppocr/modeling/transforms/tsrn.py b/ppocr/modeling/transforms/tsrn.py index 9376bc6d94..93238fa5dc 100644 --- a/ppocr/modeling/transforms/tsrn.py +++ b/ppocr/modeling/transforms/tsrn.py @@ -46,7 +46,7 @@ def __init__( mask=False, hidden_units=32, infer_mode=False, - **kwargs + **kwargs, ): super(TSRN, self).__init__() in_planes = 3 diff --git a/ppocr/optimizer/learning_rate.py b/ppocr/optimizer/learning_rate.py index f0b05ff915..687a145e85 100644 --- a/ppocr/optimizer/learning_rate.py +++ b/ppocr/optimizer/learning_rate.py @@ -41,7 +41,7 @@ def __init__( power=1.0, warmup_epoch=0, last_epoch=-1, - **kwargs + **kwargs, ): super(Linear, self).__init__() self.learning_rate = learning_rate @@ -88,7 +88,7 @@ def __init__( epochs, warmup_epoch=0, last_epoch=-1, - **kwargs + **kwargs, ): super(Cosine, self).__init__() self.learning_rate = learning_rate @@ -133,7 +133,7 @@ def __init__( gamma, warmup_epoch=0, last_epoch=-1, - **kwargs + **kwargs, ): super(Step, self).__init__() self.step_size = step_each_epoch * step_size @@ -177,7 +177,7 @@ def __init__( values, warmup_epoch=0, last_epoch=-1, - **kwargs + **kwargs, ): super(Piecewise, self).__init__() self.boundaries = [step_each_epoch * e for e in decay_epochs] @@ -219,7 +219,7 @@ def __init__( cycle, warmup_epoch=0, last_epoch=-1, - **kwargs + **kwargs, ): super(CyclicalCosine, self).__init__() self.learning_rate = learning_rate @@ -269,7 +269,7 @@ def __init__( three_phase=False, warmup_epoch=0, last_epoch=-1, - **kwargs + **kwargs, ): super(OneCycle, self).__init__() self.max_lr = max_lr @@ -382,7 +382,7 @@ def __init__( gamma, warmup_epoch=0, last_epoch=-1, - **kwargs + **kwargs, ): super(MultiStepDecay, self).__init__() self.milestones = [step_each_epoch * e for e in milestones] @@ -427,7 +427,7 @@ def __init__( epochs, warmup_epoch=0, last_epoch=-1, - **kwargs + **kwargs, ): super(TwoStepCosine, self).__init__() self.learning_rate = learning_rate diff --git a/ppocr/optimizer/optimizer.py b/ppocr/optimizer/optimizer.py index ee236ff5c2..d7f78a54de 100644 --- a/ppocr/optimizer/optimizer.py +++ b/ppocr/optimizer/optimizer.py @@ -65,7 +65,7 @@ def __init__( grad_clip=None, name=None, lazy_mode=False, - **kwargs + **kwargs, ): self.learning_rate = learning_rate self.beta1 = beta1 @@ -164,7 +164,7 @@ def __init__( epsilon=1e-6, weight_decay=None, grad_clip=None, - **args + **args, ): super(RMSProp, self).__init__() self.learning_rate = learning_rate @@ -200,7 +200,7 @@ def __init__( weight_decay=None, grad_clip=None, name=None, - **kwargs + **kwargs, ): self.learning_rate = learning_rate self.epsilon = epsilon @@ -241,7 +241,7 @@ def __init__( one_dim_param_no_weight_decay=False, name=None, lazy_mode=False, - **args + **args, ): super().__init__() self.learning_rate = learning_rate diff --git a/ppocr/postprocess/db_postprocess.py b/ppocr/postprocess/db_postprocess.py index 348be5e059..a5ac4cc25f 100755 --- a/ppocr/postprocess/db_postprocess.py +++ b/ppocr/postprocess/db_postprocess.py @@ -40,7 +40,7 @@ def __init__( use_dilation=False, score_mode="fast", box_type="quad", - **kwargs + **kwargs, ): self.thresh = thresh self.box_thresh = box_thresh @@ -268,7 +268,7 @@ def __init__( use_dilation=False, score_mode="fast", box_type="quad", - **kwargs + **kwargs, ): self.model_name = model_name self.key = key diff --git a/ppocr/postprocess/fce_postprocess.py b/ppocr/postprocess/fce_postprocess.py index ccdedc015d..bff931653e 100755 --- a/ppocr/postprocess/fce_postprocess.py +++ b/ppocr/postprocess/fce_postprocess.py @@ -76,7 +76,7 @@ def __init__( alpha=1.0, beta=1.0, box_type="poly", - **kwargs + **kwargs, ): self.scales = scales self.fourier_degree = fourier_degree diff --git a/ppocr/postprocess/pg_postprocess.py b/ppocr/postprocess/pg_postprocess.py index 4001cca680..31761fa998 100644 --- a/ppocr/postprocess/pg_postprocess.py +++ b/ppocr/postprocess/pg_postprocess.py @@ -37,7 +37,7 @@ def __init__( score_thresh, mode, point_gather_mode=None, - **kwargs + **kwargs, ): self.character_dict_path = character_dict_path self.valid_set = valid_set diff --git a/ppocr/postprocess/pse_postprocess/pse_postprocess.py b/ppocr/postprocess/pse_postprocess/pse_postprocess.py index d5cb992e17..4050dce2c2 100755 --- a/ppocr/postprocess/pse_postprocess/pse_postprocess.py +++ b/ppocr/postprocess/pse_postprocess/pse_postprocess.py @@ -40,7 +40,7 @@ def __init__( min_area=16, box_type="quad", scale=4, - **kwargs + **kwargs, ): assert box_type in ["quad", "poly"], "Only quad and poly is supported" self.thresh = thresh diff --git a/ppocr/postprocess/rec_postprocess.py b/ppocr/postprocess/rec_postprocess.py index ed04ebcedd..412a83969e 100644 --- a/ppocr/postprocess/rec_postprocess.py +++ b/ppocr/postprocess/rec_postprocess.py @@ -237,7 +237,7 @@ def __init__( model_name=["student"], key=None, multi_head=False, - **kwargs + **kwargs, ): super(DistillationCTCLabelDecode, self).__init__( character_dict_path, use_space_char @@ -836,7 +836,7 @@ def __init__( model_name=["student"], key=None, multi_head=False, - **kwargs + **kwargs, ): super(DistillationSARLabelDecode, self).__init__( character_dict_path, use_space_char diff --git a/ppocr/postprocess/sast_postprocess.py b/ppocr/postprocess/sast_postprocess.py index 18e825245e..8034cf8771 100755 --- a/ppocr/postprocess/sast_postprocess.py +++ b/ppocr/postprocess/sast_postprocess.py @@ -43,7 +43,7 @@ def __init__( shrink_ratio_of_width=0.3, expand_scale=1.0, tcl_map_thresh=0.5, - **kwargs + **kwargs, ): self.score_thresh = score_thresh self.nms_thresh = nms_thresh diff --git a/ppocr/postprocess/table_postprocess.py b/ppocr/postprocess/table_postprocess.py index a18abd872a..578e82a1a7 100644 --- a/ppocr/postprocess/table_postprocess.py +++ b/ppocr/postprocess/table_postprocess.py @@ -142,7 +142,7 @@ def __init__( character_dict_path, box_shape="ori", merge_no_span_structure=True, - **kwargs + **kwargs, ): super(TableMasterLabelDecode, self).__init__( character_dict_path, merge_no_span_structure diff --git a/ppocr/utils/save_load.py b/ppocr/utils/save_load.py index c397d5e0c6..1bac74fcb0 100644 --- a/ppocr/utils/save_load.py +++ b/ppocr/utils/save_load.py @@ -204,7 +204,7 @@ def save_model( config, is_best=False, prefix="ppocr", - **kwargs + **kwargs, ): """ save model to the target path diff --git a/ppstructure/table/table_metric/table_metric.py b/ppstructure/table/table_metric/table_metric.py index 327b87adbf..1ed4c4558e 100755 --- a/ppstructure/table/table_metric/table_metric.py +++ b/ppstructure/table/table_metric/table_metric.py @@ -145,7 +145,7 @@ def load_html_tree(self, node, parent=None): int(node.attrib.get("colspan", "1")), int(node.attrib.get("rowspan", "1")), cell, - *deque() + *deque(), ) else: new_node = TableTree(node.tag, None, None, None, *deque()) diff --git a/test_tipc/supplementary/optimizer.py b/test_tipc/supplementary/optimizer.py index 2a23161948..cb7ca3aa00 100644 --- a/test_tipc/supplementary/optimizer.py +++ b/test_tipc/supplementary/optimizer.py @@ -99,7 +99,7 @@ def __init__( decay_epochs=2.4, decay_rate=0.97, warmup_epoch=5, - **kwargs + **kwargs, ): warmup_step = warmup_epoch * step_each_epoch start_lr = 0.0 @@ -222,7 +222,7 @@ def __init__( epsilon=1e-6, parameter_list=None, regularization=None, - **args + **args, ): super(RMSProp, self).__init__() self.learning_rate = learning_rate