text_renderer icon indicating copy to clipboard operation
text_renderer copied to clipboard

请教一下,这种样本应该如何生成

Open ares89 opened this issue 6 years ago • 3 comments

请教一下,这种样本应该如何生成 。谢谢! 用您的程序 我配置不出这样的字体。 前两张的特点是:字符的骨架都是单像素的 后一张的特点是:字符是黏在一起的

24_ 23_1532 23_782868

ares89 avatar Jun 25 '18 06:06 ares89

第一种:多收集一些像素字体,或者细一点的字体? 第二种:如果是使用 CRNN 的话,识别问题应该不大,当然最好是训练集中也包括这种字符黏连的情况。目前代码里字符的间距是 Pillow 的默认间距,还没有参数可以配置。

下面是我用 CRNN 识别的结果,训练用的字体没包括像素字体:

input:   价价差               length: 3
predict: 的价差               length: 3
edit distance:  0.3333333432674408
------------------------------
input:   1532              length: 4
predict: 1532              length: 4
edit distance:  0.0
------------------------------
input:   782868            length: 6
predict: 782068            length: 6
edit distance:  0.1666666716337204
------------------------------
Accuracy: 0.333 (1/3), Average edit distance: 0.250

Sanster avatar Jun 26 '18 02:06 Sanster

好的 我先试试像素字体

ares89 avatar Jun 26 '18 07:06 ares89

@ares89 添加了字符间距配置:

# By default, text is drawed by Pillow with (https://stackoverflow.com/questions/43828955/measuring-width-of-text-python-pil)
# If this is enabled, some text will be drawed char by char with a random space
random_space:
  enable: true
  fraction: 0.5
  min: -0.1 # -0.1 will make chars very close or even overlapped
  max: 0.1

样例:

00000009

Sanster avatar Jul 06 '18 07:07 Sanster