Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
paddle_dbnet
Commits
7408ddad
Unverified
Commit
7408ddad
authored
Dec 15, 2020
by
dyning
Committed by
GitHub
Dec 15, 2020
Browse files
Merge pull request #1444 from weisy11/dygraph
update style text doc
parents
bb31dc4b
92d507b0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
18 deletions
+13
-18
StyleText/README_ch.md
StyleText/README_ch.md
+13
-18
No files found.
StyleText/README_ch.md
View file @
7408ddad
...
...
@@ -5,6 +5,7 @@
-
[
二、环境配置
](
#环境配置
)
-
[
三、快速上手
](
#快速上手
)
-
[
四、应用案例
](
#应用案例
)
-
[
五、项目结构
](
#项目结构
)
<a
name=
"工具简介"
></a>
### 一、工具简介
...
...
@@ -53,15 +54,16 @@ fusion_generator:
<a
name=
"快速上手"
></a>
### 三、快速上手
#### 合成单张图
1.
运行tools/synth_image,生成示例图片:
-
合成单张图
运行tools/synth_image,合成单张图片:
```
python
python3
-
m
tools
.
synth_image
-
c
configs
/
config
.
yml
python3
-
m
tools
.
synth_image
-
c
configs
/
config
.
yml
--
style_image
examples
/
style_images
/
2.j
pg
--
text_corpus
PaddleOCR
--
language
en
```
2.
运行后,会生成
`fake_busion.jpg`
,即为最终结果。
例如,输入如下图片和语料"PaddleOCR":
<div
align=
"center"
>
<img
src=
"examples/style_images/1.jpg"
width=
"300"
>
</div>
得到结果fake_fusion.jpg:
<div
align=
"center"
>
<img
src=
"doc/images/4.jpg"
width=
"300"
>
</div>
...
...
@@ -69,18 +71,10 @@ python3 -m tools.synth_image -c configs/config.yml
*
`fake_bg.jpg`
:为风格参考图去掉文字后的背景;
*
`fake_text.jpg`
:是用提供的字符串,仿照风格参考图中文字的风格,生成在灰色背景上的文字图片。
3.
如果您想尝试其他风格图像和文字的效果,可以添加style_image,text_corpus和language参数:
```
python
python3
-
m
tools
.
synth_image
-
c
configs
/
config
.
yml
--
style_image
examples
/
style_images
/
2.j
pg
--
text_corpus
PaddleOCR
--
language
en
```
*
注意:语言选项和语料相对应,目前我们支持英文、简体中文和韩语。
4.
在
`tools/synth_image.py`
中,我们还提供了一个
`batch_synth_images`
方法,可以两两组合语料和图片,批量生成一批数据。
#### 批量合成
在开始合成数据前,需要准备一些素材。
-
批量合成
在实际应用场景中,经常需要批量合成图片,补充到训练集中。StyleText可以使用一批风格图片和语料,批量合成数据。合成过程如下:
首先,需要风格图片作为合成图片的参考依据,这些数据可以是用作训练OCR识别模型的数据集。本例中使用带有标注文件的数据集作为风格图片.
1.
在
`configs/dataset_config.yml`
中配置输入数据路径。
...
...
@@ -127,7 +121,8 @@ python3 -m tools.synth_image -c configs/config.yml --style_image examples/style_
| 随机背景 | 韩语 | 5631 | 1230 | 0.3012 | 100000 | 0.5057 | 20% |
### 项目结构
<a
name=
"项目结构"
></a>
### 五、项目结构
```
style_text_rec
|-- arch
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment