论文阅读和分析:A Tree-Structured Decoder for Image-to-Markup Generation

HMER论文系列
1、论文阅读和分析:When Counting Meets HMER Counting-Aware Network for HMER_KPer_Yang的博客-CSDN博客
2、论文阅读和分析:Syntax-Aware Network for Handwritten Mathematical Expression Recognition_KPer_Yang的博客-CSDN博客
3、论文阅读和分析:A Tree-Structured Decoder for Image-to-Markup Generation_KPer_Yang的博客-CSDN博客
4、 论文阅读和分析:Watch, attend and parse An end-to-end neural network based approach to HMER_KPer_Yang的博客-CSDN博客
5、 论文阅读和分析:Multi-Scale Attention with Dense Encoder for Handwritten Mathematical Expression Recognition_KPer_Yang的博客-CSDN博客
6、 论文阅读和分析:Mathematical formula recognition using graph grammar_KPer_Yang的博客-CSDN博客
7、 论文阅读和分析:Hybrid Mathematical Symbol Recognition using Support Vector Machines_KPer_Yang的博客-CSDN博客
8、论文阅读和分析:HMM-BASED HANDWRITTEN SYMBOL RECOGNITION USING ON-LINE AND OFF-LINE FEATURES_KPer_Yang的博客-CSDN博客

1.主要内容:

(1、提出创新的树结构解码器来表示树、输出树、优化基于注意力的编解码框架;

(2、设计一个问题说明特别是在复杂结构时字符解码失败的背后原因,图示解释为什么树结构在解码过程中使得更优的解码能力;

(3、证明在化学式识别和数学公式识别上,树解码器的有效性;

2.树解码器

在这里插入图片描述

Figure 5. Illustration of tree decoder, including parent decoder part, child decoder part, memory attention part and an optional relation prediction part. “Pred” is short for “prediction”

树解码器使用GRU和注意力机制生成一系列的子树结构:
( o 1 c , o 1 p ) , ( o 2 c , o 2 p ) , … , ( o T c , o T p ) . (o_{1}^{\mathrm{c}},o_{1}^{\mathrm{p}}),(o_{2}^{\mathrm{c}},o_{2}^{\mathrm{p}}),\ldots,(o_{T}^{\mathrm{c}},o_{T}^{\mathrm{p}}). (o1c,o1p),(o2c,o2p),,(oTc,oTp).
需要添加一些规则,限制:

(1、每个孩子节点必须有一个父节点,因此不存在孤立节点;

(2、父节点必须是一个现存的节点;

2.1、parent解码器和child解码器
使用循环神经网络、注意力机制:


2.2、基于记忆的注意力

生成中间父亲节点序列和为训练父亲解码器的目标函数
d t j m e m = tanh ⁡ ( W m e m s t p + U m e m b e r s s j m e m ) \mathbf{d}_{tj}^{\mathrm{m}em}=\tanh(\mathbf{W}_{\mathrm{mem}}\mathbf{s}_t^{\mathrm{p}}+\mathbf{U}_{\mathrm{members}}\mathbf{s}_{j}^{\mathrm{mem}}) dtjmem=tanh(Wmemstp+Umemberssjmem)
G t j m e m = σ ( ν m e m T d t j m e m ) G^{\mathrm{m}em}_{tj}=\sigma(\mathbf{\nu}^{\mathrm{T}}_{\mathrm{mem}}\mathbf{d}^{\mathrm{mem}}_{tj}) Gtjmem=σ(νmemTdtjmem)

s t p \mathbf{s}_t^p stp:父亲解码器状态;

s j m e m \mathbf{s}_j^{mem} sjmem:孩子解码器状态 s t c \mathbf{s}_t^c stc存储,作为key;

父亲节点二分类训练损失:
L p = − ∑ t ∑ j [ G ˉ t j m e m log ⁡ ( G t j m e m ) + ( 1 − G ˉ t j m e m ) log ⁡ ( 1 − G t j mem ) ] \begin{aligned}\mathcal{L}_\mathrm{p}=-\sum_t\sum_j[\bar{G}_{tj}^\mathrm{mem}\log(G_{tj}^{\mathrm{mem}})\\ +(1-\bar{G}_{t j}^\mathrm{mem})\log(1-G_{tj}^\text{mem})]\end{aligned} Lp=tj[Gˉtjmemlog(Gtjmem)+(1Gˉtjmem)log(1Gtjmem)]
G ˉ t j m e m \bar{G}_{tj}^\mathrm{mem} Gˉtjmem:父亲节点的ground-truth;如果 j − t h j-th jth孩子节点被存储在内存中是step t t t的父亲节点则是1,否则是0;

在测试阶段,选择作为父亲节点;
o j ^ c , j ^ = argmax ⁡ ( G t j mem ) o^c_{\hat{j}},\hat{j}=\operatorname{argmax}(\mathbf{G}_{tj}^{\text{mem}}) oj^c,j^=argmax(Gtjmem)
2.4、关系预测

正如父亲上下文向量和孩子上下文向量包含空间信息,加上父亲节点和孩子节点的内容信息,可以计算关系:
p r e ( o t r e ) = s o f t m a x ( W o u t r e ( c t p , c c ) ) p^{\mathrm{re}}(o_t^{\mathrm{re}})=\mathrm{softmax}\left(\mathbf{W}^{\mathrm{re}}_{\mathrm{out}}(\mathbf{c}_t^{\mathrm{p}},\mathbf{c}^{\mathrm{c}})\right) pre(otre)=softmax(Woutre(ctp,cc))
损失函数:
L r e = − ∑ t log ⁡ p r e ( v t ) \mathcal{L}_{\mathrm{re}}=-\sum_t\log p^{\mathrm{re}}(v_t) Lre=tlogpre(vt)
2.5、实现在父亲注意力和孩子注意力的正则化

在不同时间步中的孩子节点,可能有相同的父亲节点,这时不同时间步的孩子节点的父亲节点的注意力概率是相似的。
L r e g = − ∑ t α ^ t p log ⁡ α ^ t p α t P \mathcal{L}_{\mathrm{reg}}=-\sum_t\hat{\alpha}_t^{\mathrm{p}}\log\dfrac{\hat{\alpha}_t^\mathrm{p}}{\alpha_t^\mathrm{P}}\quad Lreg=tα^tplogαtPα^tp

3、损失函数

O = λ 1 L c + λ 2 L p + λ 3 L r e + λ 4 L r e g O=\lambda_1\mathcal{L_c}+\lambda_2\mathcal{L_p}+\lambda_3\mathcal{L_\mathfrak{re}}+\lambda_4\mathcal{L_{\mathfrak{reg}}} O=λ1Lc+λ2Lp+λ3Lre+λ4Lreg

实验经验上: λ 1 = λ 2 = 1 ; λ 4 = 0.1 ; \lambda_1=\lambda_2=1;\lambda_4=0.1; λ1=λ2=1;λ4=0.1;如果是数学公式识别 λ 3 = 1 \lambda_3=1 λ3=1,如果是化学式识别 λ 3 = 0 \lambda_3=0 λ3=0;

4、结论:

在这里插入图片描述

Table 1. Evaluation of math formula recognition systems on CROHME 2014, CROHME 2016 and CROHME 2019 test sets (in %). “ExpRate”, “≤ 1 s.error” and “≤ 1 s.error” means expression recognition rate when 0 to 2 symbol or structural level errors can be tolerated, “StruRate” means structure recognition rate.

在这里插入图片描述

Figure 8. Split the SMILES test set into four sub-sets (“Easy”, “Normal”, “Hard”, “Massive”) based on the length of testing SMILES strings.

在这里插入图片描述

Table 3. Recognition rate comparison (in %) between string decoder and tree decoder on SMILES dataset. “Easy”, “Normal”, “Hard”, “Massive” denote the four sub-sets of test set with different length of SMILES string, “All” means the overall recognition rate on the whole test set (in %). “SD” and “TD” refer to string decoder and tree decoder based approaches, respectively.

参考:

A Tree-Structured Decoder for Image-to-Markup Generation (ustc.edu.cn)

猜你喜欢

转载自blog.csdn.net/KPer_Yang/article/details/129461513