Skip to content

Update textrenderer/renderer.py #21

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,12 @@ libs/gpu/build/
output/
.caches

data/chars/eng.txt
*.txt
data/chars/chn.txt
data/fonts/chn/msyh.ttc
data/fonts/chn/msyh.ttc
data/chars/eng.txt
*.jpg
*.png
*.npy
412 changes: 412 additions & 0 deletions .ipynb_checkpoints/perspective-checkpoint.ipynb

Large diffs are not rendered by default.

37 changes: 27 additions & 10 deletions configs/default.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Small font_size will make text looks like blured/prydown
font_size:
min: 14
min: 16
max: 23

# By default, text is drawed by Pillow with (https://stackoverflow.com/questions/43828955/measuring-width-of-text-python-pil)
Expand All @@ -20,6 +20,19 @@ curve:
min: 1 # sin 函数的幅值范围
max: 5

#水平方向拉伸
stretch:
enable: true
fraction: 1.0
min: 0.8
max: 1.2

#扭曲
rdistort:
enable: true
fraction: 0.1


# random crop text height
crop:
enable: false
Expand All @@ -36,7 +49,7 @@ crop:
# Use image in bg_dir as background for text
img_bg:
enable: true
fraction: 0.5
fraction: 0.95

# Not work when random_space applied
text_border:
Expand Down Expand Up @@ -68,13 +81,17 @@ perspective_transform:

blur:
enable: true
fraction: 0.03
fraction: 0.3

# If an image is applied blur, it will not be applied prydown
prydown:
enable: false
fraction: 0.1
max_scale: 1.5

pryup:
enable: true
fraction: 0.03
max_scale: 1.5 # Image will first resize to 1.5x, and than resize to 1x
fraction: 0.05

noise:
enable: true
Expand All @@ -97,20 +114,20 @@ noise:
fraction: 0.25

line:
enable: false
enable: true
fraction: 0.05

under_line:
enable: false
fraction: 0.2
enable: true
fraction: 1.0

table_line:
enable: false
fraction: 0.3
fraction: 0.0

middle_line:
enable: false
fraction: 0.5
fraction: 0.0

# These operates are applied on the final output image,
# so actually it can also be applied in training process as an data augmentation method.
Expand Down
Binary file removed data/bg/背景.png
Binary file not shown.
Loading