diff --git a/StyleTextRec/README.md b/StyleText/README.md similarity index 100% rename from StyleTextRec/README.md rename to StyleText/README.md diff --git a/StyleTextRec/README_ch.md b/StyleText/README_ch.md similarity index 80% rename from StyleTextRec/README_ch.md rename to StyleText/README_ch.md index b8561530..82fca455 100644 --- a/StyleTextRec/README_ch.md +++ b/StyleText/README_ch.md @@ -1,13 +1,12 @@ -## Style Text Rec +## Style Text ### 目录 -- [工具简介](#工具简介) -- [环境配置](#环境配置) -- [快速上手](#快速上手) -- [高级使用](#高级使用) -- [应用示例](#应用示例) +- [一、工具简介](# 一、工具简介) +- [二、环境配置](# 二、环境配置) +- [三、快速上手](# 三、快速上手) +- [四、应用示例](# 四、应用示例) -### 工具简介 +### 一、工具简介
@@ -23,13 +22,13 @@ Style-Text数据合成工具是基于百度自研的文本编辑算法《Editing -### 环境配置 +### 二、环境配置 1. 参考[快速安装](../doc/doc_ch/installation.md),安装PaddleOCR。 -2. 进入`style_text_rec`目录,下载模型,并解压: +2. 进入`StyleText`目录,下载模型,并解压: ```bash -cd style_text_rec +cd StyleText wget https://paddleocr.bj.bcebos.com/dygraph_v2.0/style_text/style_text_models.zip unzip style_text_models.zip ``` @@ -47,7 +46,9 @@ fusion_generator: pretrain: style_text_models/fusion_generator ``` -### 快速上手 +### 三、快速上手 + +#### 合成单张图 1. 运行tools/synth_image,生成示例图片: @@ -55,7 +56,7 @@ fusion_generator: python3 -m tools.synth_image -c configs/config.yml ``` -1. 运行后,会生成`fake_busion.jpg`,即为最终结果。 +2. 运行后,会生成`fake_busion.jpg`,即为最终结果。
@@ -63,17 +64,17 @@ python3 -m tools.synth_image -c configs/config.yml * `fake_bg.jpg`:为风格参考图去掉文字后的背景; * `fake_text.jpg`:是用提供的字符串,仿照风格参考图中文字的风格,生成在灰色背景上的文字图片。 -2. 如果您想尝试其他风格图像和文字的效果,可以添加style_image,text_corpus和language参数: +3. 如果您想尝试其他风格图像和文字的效果,可以添加style_image,text_corpus和language参数: ```python python3 -m tools.synth_image -c configs/config.yml --style_image examples/style_images/2.jpg --text_corpus PaddleOCR --language en ``` * 注意:语言选项和语料相对应,目前我们支持英文、简体中文和韩语。 -3. 在`tools/synth_image.py`中,我们还提供了一个`batch_synth_images`方法,可以两两组合语料和图片,批量生成一批数据。 +4. 在`tools/synth_image.py`中,我们还提供了一个`batch_synth_images`方法,可以两两组合语料和图片,批量生成一批数据。 -### 高级使用 +#### 批量合成 -在开始合成数据集前,需要准备一些素材。 +在开始合成数据前,需要准备一些素材。 首先,需要风格图片作为合成图片的参考依据,这些数据可以是用作训练OCR识别模型的数据集。本例中使用带有标注文件的数据集作为风格图片. @@ -88,7 +89,7 @@ python3 -m tools.synth_image -c configs/config.yml --style_image examples/style_ * `language`:语料的语种; * `corpus_file`: 语料文件路径。 - 我们提供了一批[样例图](https://paddleocr.bj.bcebos.com/dygraph_v2.0/style_text/chkoen_5w.tar)供您试用,下面给出了一些示例: + 我们提供了一批中英韩5w通用数据供您试用 ([下载地址](https://paddleocr.bj.bcebos.com/dygraph_v2.0/style_text/chkoen_5w.tar) ),下面给出了一些示例:
@@ -106,21 +107,22 @@ python3 -m tools.synth_image -c configs/config.yml --style_image examples/style_ ``` -### 应用示例 +### 四、应用示例 -在完成上述操作后,即可得到用于OCR识别的合成数据集,下面给出了一些数据集生成的示例: +在完成上述操作后,即可得到用于OCR识别的合成数据集。在实用场景中,我们经常遇到数据量不足的情况,这时可以使用已有数据作为style_input,合成数据。 +下面给出了一些数据集生成的示例:
-请您参考[OCR识别文档](https://github.com/PaddlePaddle/PaddleOCR/blob/dygraph/doc/doc_ch/recognition.md#%E5%90%AF%E5%8A%A8%E8%AE%AD%E7%BB%83),完成训练。 -下面展示了一些使用合成数据训练的效果: +在添加这些合成数据进行训练后,识别模型的效果得到了显著提升,如下表所示: | 场景 | 字符 | 原始数据 | 测试数据 | 只使用原始数据的识别准确率 | 新增合成数据 | 使用合成数据识别准确率 | 指标提升 | | -------- | ---------- | -------- | -------- | -------------------------- | ------------ | ---------------------- | -------- | | 金属表面 | 英文和数字 | 2203 | 650 | 0.5938 | 20000 | 0.7546 | 16% | | 随机背景 | 韩语 | 5631 | 1230 | 0.3012 | 100000 | 0.5057 | 20% | +识别模型的训练方法您可以参考[OCR识别文档](../doc/doc_ch/recognition.md) ### 项目结构 ``` style_text_rec diff --git a/StyleTextRec/__init__.py b/StyleText/__init__.py similarity index 100% rename from StyleTextRec/__init__.py rename to StyleText/__init__.py diff --git a/StyleTextRec/arch/__init__.py b/StyleText/arch/__init__.py similarity index 100% rename from StyleTextRec/arch/__init__.py rename to StyleText/arch/__init__.py diff --git a/StyleTextRec/arch/base_module.py b/StyleText/arch/base_module.py similarity index 100% rename from StyleTextRec/arch/base_module.py rename to StyleText/arch/base_module.py diff --git a/StyleTextRec/arch/decoder.py b/StyleText/arch/decoder.py similarity index 100% rename from StyleTextRec/arch/decoder.py rename to StyleText/arch/decoder.py diff --git a/StyleTextRec/arch/encoder.py b/StyleText/arch/encoder.py similarity index 100% rename from StyleTextRec/arch/encoder.py rename to StyleText/arch/encoder.py diff --git a/StyleTextRec/arch/spectral_norm.py b/StyleText/arch/spectral_norm.py similarity index 100% rename from StyleTextRec/arch/spectral_norm.py rename to StyleText/arch/spectral_norm.py diff --git a/StyleTextRec/arch/style_text_rec.py b/StyleText/arch/style_text_rec.py similarity index 100% rename from StyleTextRec/arch/style_text_rec.py rename to StyleText/arch/style_text_rec.py diff --git a/StyleTextRec/configs/config.yml b/StyleText/configs/config.yml similarity index 100% rename from StyleTextRec/configs/config.yml rename to StyleText/configs/config.yml diff --git a/StyleTextRec/configs/dataset_config.yml b/StyleText/configs/dataset_config.yml similarity index 100% rename from StyleTextRec/configs/dataset_config.yml rename to StyleText/configs/dataset_config.yml diff --git a/StyleTextRec/doc/images/1.png b/StyleText/doc/images/1.png similarity index 100% rename from StyleTextRec/doc/images/1.png rename to StyleText/doc/images/1.png diff --git a/StyleTextRec/doc/images/2.png b/StyleText/doc/images/2.png similarity index 100% rename from StyleTextRec/doc/images/2.png rename to StyleText/doc/images/2.png diff --git a/StyleTextRec/doc/images/3.png b/StyleText/doc/images/3.png similarity index 100% rename from StyleTextRec/doc/images/3.png rename to StyleText/doc/images/3.png diff --git a/StyleTextRec/doc/images/4.jpg b/StyleText/doc/images/4.jpg similarity index 100% rename from StyleTextRec/doc/images/4.jpg rename to StyleText/doc/images/4.jpg diff --git a/StyleTextRec/doc/images/5.png b/StyleText/doc/images/5.png similarity index 81% rename from StyleTextRec/doc/images/5.png rename to StyleText/doc/images/5.png index ea0b8903..b7d28b7a 100644 Binary files a/StyleTextRec/doc/images/5.png and b/StyleText/doc/images/5.png differ diff --git a/StyleTextRec/doc/images/6.png b/StyleText/doc/images/6.png similarity index 100% rename from StyleTextRec/doc/images/6.png rename to StyleText/doc/images/6.png diff --git a/StyleTextRec/engine/__init__.py b/StyleText/engine/__init__.py similarity index 100% rename from StyleTextRec/engine/__init__.py rename to StyleText/engine/__init__.py diff --git a/StyleTextRec/engine/corpus_generators.py b/StyleText/engine/corpus_generators.py similarity index 100% rename from StyleTextRec/engine/corpus_generators.py rename to StyleText/engine/corpus_generators.py diff --git a/StyleTextRec/engine/predictors.py b/StyleText/engine/predictors.py similarity index 100% rename from StyleTextRec/engine/predictors.py rename to StyleText/engine/predictors.py diff --git a/StyleTextRec/engine/style_samplers.py b/StyleText/engine/style_samplers.py similarity index 100% rename from StyleTextRec/engine/style_samplers.py rename to StyleText/engine/style_samplers.py diff --git a/StyleTextRec/engine/synthesisers.py b/StyleText/engine/synthesisers.py similarity index 100% rename from StyleTextRec/engine/synthesisers.py rename to StyleText/engine/synthesisers.py diff --git a/StyleTextRec/engine/text_drawers.py b/StyleText/engine/text_drawers.py similarity index 100% rename from StyleTextRec/engine/text_drawers.py rename to StyleText/engine/text_drawers.py diff --git a/StyleTextRec/engine/writers.py b/StyleText/engine/writers.py similarity index 100% rename from StyleTextRec/engine/writers.py rename to StyleText/engine/writers.py diff --git a/StyleTextRec/examples/corpus/example.txt b/StyleText/examples/corpus/example.txt similarity index 100% rename from StyleTextRec/examples/corpus/example.txt rename to StyleText/examples/corpus/example.txt diff --git a/StyleTextRec/examples/image_list.txt b/StyleText/examples/image_list.txt similarity index 100% rename from StyleTextRec/examples/image_list.txt rename to StyleText/examples/image_list.txt diff --git a/StyleTextRec/examples/style_images/1.jpg b/StyleText/examples/style_images/1.jpg similarity index 100% rename from StyleTextRec/examples/style_images/1.jpg rename to StyleText/examples/style_images/1.jpg diff --git a/StyleTextRec/examples/style_images/2.jpg b/StyleText/examples/style_images/2.jpg similarity index 100% rename from StyleTextRec/examples/style_images/2.jpg rename to StyleText/examples/style_images/2.jpg diff --git a/StyleTextRec/fonts/ch_standard.ttf b/StyleText/fonts/ch_standard.ttf similarity index 100% rename from StyleTextRec/fonts/ch_standard.ttf rename to StyleText/fonts/ch_standard.ttf diff --git a/StyleTextRec/fonts/en_standard.ttf b/StyleText/fonts/en_standard.ttf similarity index 100% rename from StyleTextRec/fonts/en_standard.ttf rename to StyleText/fonts/en_standard.ttf diff --git a/StyleTextRec/fonts/ko_standard.ttf b/StyleText/fonts/ko_standard.ttf similarity index 100% rename from StyleTextRec/fonts/ko_standard.ttf rename to StyleText/fonts/ko_standard.ttf diff --git a/StyleTextRec/tools/__init__.py b/StyleText/tools/__init__.py similarity index 100% rename from StyleTextRec/tools/__init__.py rename to StyleText/tools/__init__.py diff --git a/StyleTextRec/tools/synth_dataset.py b/StyleText/tools/synth_dataset.py similarity index 100% rename from StyleTextRec/tools/synth_dataset.py rename to StyleText/tools/synth_dataset.py diff --git a/StyleTextRec/tools/synth_image.py b/StyleText/tools/synth_image.py similarity index 100% rename from StyleTextRec/tools/synth_image.py rename to StyleText/tools/synth_image.py diff --git a/StyleTextRec/utils/__init__.py b/StyleText/utils/__init__.py similarity index 100% rename from StyleTextRec/utils/__init__.py rename to StyleText/utils/__init__.py diff --git a/StyleTextRec/utils/config.py b/StyleText/utils/config.py similarity index 100% rename from StyleTextRec/utils/config.py rename to StyleText/utils/config.py diff --git a/StyleTextRec/utils/load_params.py b/StyleText/utils/load_params.py similarity index 100% rename from StyleTextRec/utils/load_params.py rename to StyleText/utils/load_params.py diff --git a/StyleTextRec/utils/logging.py b/StyleText/utils/logging.py similarity index 100% rename from StyleTextRec/utils/logging.py rename to StyleText/utils/logging.py diff --git a/StyleTextRec/utils/math_functions.py b/StyleText/utils/math_functions.py similarity index 100% rename from StyleTextRec/utils/math_functions.py rename to StyleText/utils/math_functions.py diff --git a/StyleTextRec/utils/sys_funcs.py b/StyleText/utils/sys_funcs.py similarity index 100% rename from StyleTextRec/utils/sys_funcs.py rename to StyleText/utils/sys_funcs.py