Skip to content

Commit

Permalink
commit fix by running pre-commit run -a (#12165)
Browse files Browse the repository at this point in the history
  • Loading branch information
jzhang533 authored May 24, 2024
1 parent 3a66efc commit a2ad212
Show file tree
Hide file tree
Showing 57 changed files with 102 additions and 102 deletions.
6 changes: 3 additions & 3 deletions benchmark/PaddleOCR_DBNet/data_loader/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -138,7 +138,7 @@ def __init__(
pre_processes,
filter_keys,
transform=None,
**kwargs
**kwargs,
):
self.transform = transform
self.dataRoot = pathlib.Path(data_path)
Expand Down
2 changes: 1 addition & 1 deletion deploy/pdserving/ocr_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def __init__(
# character_dict_path=None,
# character_type='ch',
# use_space_char=False,
**kwargs
**kwargs,
):
super(CTCLabelDecode, self).__init__(config)

Expand Down
2 changes: 1 addition & 1 deletion deploy/pdserving/win/ocr_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def __init__(
# character_dict_path=None,
# character_type='ch',
# use_space_char=False,
**kwargs
**kwargs,
):
super(CTCLabelDecode, self).__init__(config)

Expand Down
2 changes: 1 addition & 1 deletion ppocr/data/imaug/drrg_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ppocr/data/imaug/east_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
4 changes: 2 additions & 2 deletions ppocr/data/imaug/fce_aug.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion ppocr/data/imaug/fce_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
24 changes: 12 additions & 12 deletions ppocr/data/imaug/label_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ppocr/data/imaug/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def __init__(
min_ratio=1,
mask=False,
infer_mode=False,
**kwargs
**kwargs,
):
self.imgH = imgH
self.imgW = imgW
Expand Down
2 changes: 1 addition & 1 deletion ppocr/data/imaug/pg_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ppocr/data/imaug/random_crop_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions ppocr/data/imaug/rec_img_aug.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -199,7 +199,7 @@ def __init__(
geometry_p=0.5,
deterioration_p=0.25,
colorjitter_p=0.25,
**kwargs
**kwargs,
):
self.transforms = Compose(
[
Expand Down Expand Up @@ -237,7 +237,7 @@ def __init__(
geometry_p=0.5,
deterioration_p=0.25,
colorjitter_p=0.25,
**kwargs
**kwargs,
):
self.transforms = Compose(
[
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ppocr/data/imaug/sast_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ppocr/data/imaug/vqa/token/vqa_token_pad.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ppocr/losses/det_basic_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(
negative_ratio=3,
return_origin=False,
eps=1e-6,
**kwargs
**kwargs,
):
"""
The BalanceLoss for Differentiable Binarization text detection
Expand Down
2 changes: 1 addition & 1 deletion ppocr/losses/det_db_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(
beta=10,
ohem_ratio=3,
eps=1e-6,
**kwargs
**kwargs,
):
super(DBLoss, self).__init__()
self.alpha = alpha
Expand Down
2 changes: 1 addition & 1 deletion ppocr/losses/det_pse_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(
kernel_sample_mask="pred",
reduction="sum",
eps=1e-6,
**kwargs
**kwargs,
):
"""Implement PSE Loss."""
super(PSELoss, self).__init__()
Expand Down
6 changes: 3 additions & 3 deletions ppocr/losses/distillation_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ppocr/losses/rec_aster_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(
ignore_index=-100,
sequence_normalize=False,
sample_normalize=True,
**kwargs
**kwargs,
):
super(AsterLoss, self).__init__()
self.weight = weight
Expand Down
2 changes: 1 addition & 1 deletion ppocr/losses/rec_enhanced_ctc_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading

0 comments on commit a2ad212

Please sign in to comment.