diff --git a/benchmark/PaddleOCR_DBNet/data_loader/dataset.py b/benchmark/PaddleOCR_DBNet/data_loader/dataset.py index b37f01839..5353ec8de 100644 --- a/benchmark/PaddleOCR_DBNet/data_loader/dataset.py +++ b/benchmark/PaddleOCR_DBNet/data_loader/dataset.py @@ -21,7 +21,7 @@ class ICDAR2015Dataset(BaseDataSet): 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 @@ class DetDataset(BaseDataSet): 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 @@ class SynthTextDataset(BaseDataSet): 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 81d90b755..7c1349dc9 100644 --- a/deploy/pdserving/ocr_reader.py +++ b/deploy/pdserving/ocr_reader.py @@ -254,7 +254,7 @@ class CTCLabelDecode(BaseRecLabelDecode): # 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 6b2a4f807..817521144 100644 --- a/deploy/pdserving/win/ocr_reader.py +++ b/deploy/pdserving/win/ocr_reader.py @@ -254,7 +254,7 @@ class CTCLabelDecode(BaseRecLabelDecode): # 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 5c2ba7caa..5a89754aa 100644 --- a/ppocr/data/imaug/drrg_targets.py +++ b/ppocr/data/imaug/drrg_targets.py @@ -38,7 +38,7 @@ class DRRGTargets(object): 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 c3fbf8824..76515d5a4 100644 --- a/ppocr/data/imaug/east_process.py +++ b/ppocr/data/imaug/east_process.py @@ -32,7 +32,7 @@ class EASTProcessTrain(object): 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 39657a024..269734497 100644 --- a/ppocr/data/imaug/fce_aug.py +++ b/ppocr/data/imaug/fce_aug.py @@ -359,7 +359,7 @@ class RandomRotatePolyInstances: 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 @@ class SquareResizePad: 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 acceff30d..99559804a 100644 --- a/ppocr/data/imaug/fce_targets.py +++ b/ppocr/data/imaug/fce_targets.py @@ -53,7 +53,7 @@ class FCENetTargets: 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 58c6610f8..46cabaed8 100644 --- a/ppocr/data/imaug/label_ops.py +++ b/ppocr/data/imaug/label_ops.py @@ -589,7 +589,7 @@ class SRNLabelEncode(BaseRecLabelEncode): 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 @@ class TableLabelEncode(AttnLabelEncode): 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 @@ class TableMasterLabelEncode(TableLabelEncode): 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 @@ class TableMasterLabelEncode(TableLabelEncode): 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 @@ class SATRNLabelEncode(BaseRecLabelEncode): 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 @@ class VQATokenLabelEncode(object): order_method=None, infer_mode=False, ocr_engine=None, - **kwargs + **kwargs, ): super(VQATokenLabelEncode, self).__init__() from paddlenlp.transformers import ( @@ -1273,7 +1273,7 @@ class MultiLabelEncode(BaseRecLabelEncode): 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 @@ class ViTSTRLabelEncode(BaseRecLabelEncode): 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 @@ class ABINetLabelEncode(BaseRecLabelEncode): 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 @@ class SPINLabelEncode(AttnLabelEncode): 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 @@ class CANLabelEncode(BaseRecLabelEncode): 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 @@ class CPPDLabelEncode(BaseRecLabelEncode): 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 781e30d7c..e1d192d09 100644 --- a/ppocr/data/imaug/operators.py +++ b/ppocr/data/imaug/operators.py @@ -465,7 +465,7 @@ class SRResize(object): 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 08f4dad46..cdd816ccb 100644 --- a/ppocr/data/imaug/pg_process.py +++ b/ppocr/data/imaug/pg_process.py @@ -37,7 +37,7 @@ class PGProcessTrain(object): 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 f3f2e3eea..6625776fa 100644 --- a/ppocr/data/imaug/random_crop_data.py +++ b/ppocr/data/imaug/random_crop_data.py @@ -133,7 +133,7 @@ class EastRandomCropData(object): 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 a79436021..2420e424b 100644 --- a/ppocr/data/imaug/rec_img_aug.py +++ b/ppocr/data/imaug/rec_img_aug.py @@ -41,7 +41,7 @@ class RecAug(object): 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 @@ class BaseDataAugmentation(object): 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 @@ class RecConAug(object): 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 @@ class SVTRRecAug(object): geometry_p=0.5, deterioration_p=0.25, colorjitter_p=0.25, - **kwargs + **kwargs, ): self.transforms = Compose( [ @@ -237,7 +237,7 @@ class ParseQRecAug(object): geometry_p=0.5, deterioration_p=0.25, colorjitter_p=0.25, - **kwargs + **kwargs, ): self.transforms = Compose( [ @@ -289,7 +289,7 @@ class RecResizeImg(object): 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 @@ class VLRecResizeImg(object): 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 @@ class SPINRecResizeImg(object): 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 @@ class GrayRecResizeImg(object): 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 81e13930e..91e1f9b22 100644 --- a/ppocr/data/imaug/sast_process.py +++ b/ppocr/data/imaug/sast_process.py @@ -33,7 +33,7 @@ class SASTProcessTrain(object): 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 5983cb75e..9466e3750 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 @@ class VQATokenPad(object): 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 248c3bad5..5a46e072e 100644 --- a/ppocr/losses/det_basic_loss.py +++ b/ppocr/losses/det_basic_loss.py @@ -34,7 +34,7 @@ class BalanceLoss(nn.Layer): 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 67201e046..032afe7bc 100755 --- a/ppocr/losses/det_db_loss.py +++ b/ppocr/losses/det_db_loss.py @@ -41,7 +41,7 @@ class DBLoss(nn.Layer): 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 8c4b2b424..962339b84 100644 --- a/ppocr/losses/det_pse_loss.py +++ b/ppocr/losses/det_pse_loss.py @@ -31,7 +31,7 @@ class PSELoss(nn.Layer): 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 6313f8d8e..cd66bca89 100644 --- a/ppocr/losses/distillation_loss.py +++ b/ppocr/losses/distillation_loss.py @@ -675,7 +675,7 @@ class DistillationNRTRLoss(CELoss): 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 @@ class DistillationDBLoss(DBLoss): ohem_ratio=3, eps=1e-6, name="db", - **kwargs + **kwargs, ): super().__init__() self.model_name_list = model_name_list @@ -935,7 +935,7 @@ class DistillationVQADistanceLoss(DistanceLoss): 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 eff53d290..8a8faa175 100644 --- a/ppocr/losses/rec_aster_loss.py +++ b/ppocr/losses/rec_aster_loss.py @@ -50,7 +50,7 @@ class AsterLoss(nn.Layer): 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 ef8827039..e7e0696df 100644 --- a/ppocr/losses/rec_enhanced_ctc_loss.py +++ b/ppocr/losses/rec_enhanced_ctc_loss.py @@ -35,7 +35,7 @@ class EnhancedCTCLoss(nn.Layer): 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 2cf563f13..97796c4b4 100644 --- a/ppocr/metrics/e2e_metric.py +++ b/ppocr/metrics/e2e_metric.py @@ -29,7 +29,7 @@ class E2EMetric(object): 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 3f319c8ca..98847e1aa 100644 --- a/ppocr/metrics/table_metric.py +++ b/ppocr/metrics/table_metric.py @@ -77,7 +77,7 @@ class TableMetric(object): 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 1d59f2501..7a557e5a7 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 48a43f8bb..b54670c60 100644 --- a/ppocr/modeling/backbones/rec_lcnetv3.py +++ b/ppocr/modeling/backbones/rec_lcnetv3.py @@ -395,7 +395,7 @@ class PPLCNetV3(nn.Layer): 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 12831dcad..00ee5a3da 100644 --- a/ppocr/modeling/backbones/rec_mobilenet_v3.py +++ b/ppocr/modeling/backbones/rec_mobilenet_v3.py @@ -32,7 +32,7 @@ class MobileNetV3(nn.Layer): 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 13c9de869..f20fa4cb1 100644 --- a/ppocr/modeling/backbones/rec_mv1_enhance.py +++ b/ppocr/modeling/backbones/rec_mv1_enhance.py @@ -118,7 +118,7 @@ class MobileNetV1Enhance(nn.Layer): 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 31ce55a65..03281b30d 100644 --- a/ppocr/modeling/backbones/rec_svtrv2.py +++ b/ppocr/modeling/backbones/rec_svtrv2.py @@ -323,7 +323,7 @@ class SVTRStage(nn.Layer): act=nn.GELU, eps=1e-6, downsample=None, - **kwargs + **kwargs, ): super().__init__() self.dim = dim @@ -506,7 +506,7 @@ class SVTRv2(nn.Layer): 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 d492eea42..165b868f4 100644 --- a/ppocr/modeling/backbones/rec_vit.py +++ b/ppocr/modeling/backbones/rec_vit.py @@ -196,7 +196,7 @@ class ViT(nn.Layer): 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 564e579d2..87b5dac88 100644 --- a/ppocr/modeling/backbones/rec_vitstr.py +++ b/ppocr/modeling/backbones/rec_vitstr.py @@ -51,7 +51,7 @@ class ViTSTR(nn.Layer): 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 cbcf804a7..c80cb1452 100644 --- a/ppocr/modeling/backbones/vqa_layoutlm.py +++ b/ppocr/modeling/backbones/vqa_layoutlm.py @@ -58,7 +58,7 @@ class NLPBaseModel(nn.Layer): 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 24dc12fef..4d6f875d9 100644 --- a/ppocr/modeling/heads/det_drrg_head.py +++ b/ppocr/modeling/heads/det_drrg_head.py @@ -50,7 +50,7 @@ class DRRGHead(nn.Layer): 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 d666846c1..2cc847d61 100644 --- a/ppocr/modeling/heads/rec_abinet_head.py +++ b/ppocr/modeling/heads/rec_abinet_head.py @@ -117,7 +117,7 @@ class PositionAttention(nn.Layer): 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 dbef77f68..ca4809f0c 100644 --- a/ppocr/modeling/heads/rec_aster_head.py +++ b/ppocr/modeling/heads/rec_aster_head.py @@ -36,7 +36,7 @@ class AsterHead(nn.Layer): 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 87c403779..c29946b6b 100644 --- a/ppocr/modeling/heads/rec_cppd_head.py +++ b/ppocr/modeling/heads/rec_cppd_head.py @@ -217,7 +217,7 @@ class CPPDHead(nn.Layer): 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 6c008bbed..5e19a9ab3 100755 --- a/ppocr/modeling/heads/rec_ctc_head.py +++ b/ppocr/modeling/heads/rec_ctc_head.py @@ -40,7 +40,7 @@ class CTCHead(nn.Layer): 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 50887d7c8..be4461567 100644 --- a/ppocr/modeling/heads/rec_multi_head.py +++ b/ppocr/modeling/heads/rec_multi_head.py @@ -83,7 +83,7 @@ class MultiHead(nn.Layer): 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 @@ class MultiHead(nn.Layer): 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 de27d1145..6fc2dc386 100644 --- a/ppocr/modeling/heads/rec_parseq_head.py +++ b/ppocr/modeling/heads/rec_parseq_head.py @@ -222,7 +222,7 @@ class ParseQHead(nn.Layer): 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 9eadfb0da..e56d6f8fc 100644 --- a/ppocr/modeling/heads/rec_rfl_head.py +++ b/ppocr/modeling/heads/rec_rfl_head.py @@ -58,7 +58,7 @@ class RFLHead(nn.Layer): 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 @@ class RFLHead(nn.Layer): 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 ba8d07753..2289f1c8d 100644 --- a/ppocr/modeling/heads/rec_robustscanner_head.py +++ b/ppocr/modeling/heads/rec_robustscanner_head.py @@ -695,7 +695,7 @@ class RobustScannerHead(nn.Layer): 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 906cff0d8..928e44563 100644 --- a/ppocr/modeling/heads/rec_sar_head.py +++ b/ppocr/modeling/heads/rec_sar_head.py @@ -47,7 +47,7 @@ class SAREncoder(nn.Layer): d_model=512, d_enc=512, mask=True, - **kwargs + **kwargs, ): super().__init__() assert isinstance(enc_bi_rnn, bool) @@ -167,7 +167,7 @@ class ParallelSARDecoder(BaseDecoder): max_text_length=30, mask=True, pred_concat=True, - **kwargs + **kwargs, ): super().__init__() @@ -361,7 +361,7 @@ class SARHead(nn.Layer): 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 a56038ddf..b36edb8fa 100644 --- a/ppocr/modeling/heads/rec_srn_head.py +++ b/ppocr/modeling/heads/rec_srn_head.py @@ -249,7 +249,7 @@ class SRNHead(nn.Layer): 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 7e2dc2196..67376a064 100644 --- a/ppocr/modeling/heads/table_att_head.py +++ b/ppocr/modeling/heads/table_att_head.py @@ -49,7 +49,7 @@ class TableAttentionHead(nn.Layer): 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 @@ class SLAHead(nn.Layer): 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 2785a2b0a..629c6f601 100644 --- a/ppocr/modeling/heads/table_master_head.py +++ b/ppocr/modeling/heads/table_master_head.py @@ -39,7 +39,7 @@ class TableMasterHead(nn.Layer): 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 4c74f36bc..5c1674b43 100644 --- a/ppocr/modeling/necks/db_fpn.py +++ b/ppocr/modeling/necks/db_fpn.py @@ -42,7 +42,7 @@ class DSConv(nn.Layer): 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 9376bc6d9..93238fa5d 100644 --- a/ppocr/modeling/transforms/tsrn.py +++ b/ppocr/modeling/transforms/tsrn.py @@ -46,7 +46,7 @@ class TSRN(nn.Layer): 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 f0b05ff91..687a145e8 100644 --- a/ppocr/optimizer/learning_rate.py +++ b/ppocr/optimizer/learning_rate.py @@ -41,7 +41,7 @@ class Linear(object): power=1.0, warmup_epoch=0, last_epoch=-1, - **kwargs + **kwargs, ): super(Linear, self).__init__() self.learning_rate = learning_rate @@ -88,7 +88,7 @@ class Cosine(object): epochs, warmup_epoch=0, last_epoch=-1, - **kwargs + **kwargs, ): super(Cosine, self).__init__() self.learning_rate = learning_rate @@ -133,7 +133,7 @@ class Step(object): 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 @@ class Piecewise(object): 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 @@ class CyclicalCosine(object): cycle, warmup_epoch=0, last_epoch=-1, - **kwargs + **kwargs, ): super(CyclicalCosine, self).__init__() self.learning_rate = learning_rate @@ -269,7 +269,7 @@ class OneCycle(object): three_phase=False, warmup_epoch=0, last_epoch=-1, - **kwargs + **kwargs, ): super(OneCycle, self).__init__() self.max_lr = max_lr @@ -382,7 +382,7 @@ class MultiStepDecay(object): 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 @@ class TwoStepCosine(object): 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 ee236ff5c..d7f78a54d 100644 --- a/ppocr/optimizer/optimizer.py +++ b/ppocr/optimizer/optimizer.py @@ -65,7 +65,7 @@ class Adam(object): grad_clip=None, name=None, lazy_mode=False, - **kwargs + **kwargs, ): self.learning_rate = learning_rate self.beta1 = beta1 @@ -164,7 +164,7 @@ class RMSProp(object): epsilon=1e-6, weight_decay=None, grad_clip=None, - **args + **args, ): super(RMSProp, self).__init__() self.learning_rate = learning_rate @@ -200,7 +200,7 @@ class Adadelta(object): weight_decay=None, grad_clip=None, name=None, - **kwargs + **kwargs, ): self.learning_rate = learning_rate self.epsilon = epsilon @@ -241,7 +241,7 @@ class AdamW(object): 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 348be5e05..a5ac4cc25 100755 --- a/ppocr/postprocess/db_postprocess.py +++ b/ppocr/postprocess/db_postprocess.py @@ -40,7 +40,7 @@ class DBPostProcess(object): use_dilation=False, score_mode="fast", box_type="quad", - **kwargs + **kwargs, ): self.thresh = thresh self.box_thresh = box_thresh @@ -268,7 +268,7 @@ class DistillationDBPostProcess(object): 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 ccdedc015..bff931653 100755 --- a/ppocr/postprocess/fce_postprocess.py +++ b/ppocr/postprocess/fce_postprocess.py @@ -76,7 +76,7 @@ class FCEPostProcess(object): 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 4001cca68..31761fa99 100644 --- a/ppocr/postprocess/pg_postprocess.py +++ b/ppocr/postprocess/pg_postprocess.py @@ -37,7 +37,7 @@ class PGPostProcess(object): 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 d5cb992e1..4050dce2c 100755 --- a/ppocr/postprocess/pse_postprocess/pse_postprocess.py +++ b/ppocr/postprocess/pse_postprocess/pse_postprocess.py @@ -40,7 +40,7 @@ class PSEPostProcess(object): 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 ed04ebced..412a83969 100644 --- a/ppocr/postprocess/rec_postprocess.py +++ b/ppocr/postprocess/rec_postprocess.py @@ -237,7 +237,7 @@ class DistillationCTCLabelDecode(CTCLabelDecode): model_name=["student"], key=None, multi_head=False, - **kwargs + **kwargs, ): super(DistillationCTCLabelDecode, self).__init__( character_dict_path, use_space_char @@ -836,7 +836,7 @@ class DistillationSARLabelDecode(SARLabelDecode): 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 18e825245..8034cf877 100755 --- a/ppocr/postprocess/sast_postprocess.py +++ b/ppocr/postprocess/sast_postprocess.py @@ -43,7 +43,7 @@ class SASTPostProcess(object): 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 a18abd872..578e82a1a 100644 --- a/ppocr/postprocess/table_postprocess.py +++ b/ppocr/postprocess/table_postprocess.py @@ -142,7 +142,7 @@ class TableMasterLabelDecode(TableLabelDecode): 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 c397d5e0c..1bac74fcb 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 327b87adb..1ed4c4558 100755 --- a/ppstructure/table/table_metric/table_metric.py +++ b/ppstructure/table/table_metric/table_metric.py @@ -145,7 +145,7 @@ class TEDS(object): 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 2a2316194..cb7ca3aa0 100644 --- a/test_tipc/supplementary/optimizer.py +++ b/test_tipc/supplementary/optimizer.py @@ -99,7 +99,7 @@ class ExponentialWarmup(LinearWarmup): 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 @@ class RMSProp(object): epsilon=1e-6, parameter_list=None, regularization=None, - **args + **args, ): super(RMSProp, self).__init__() self.learning_rate = learning_rate