Mocomer-v1: attention-guided contrastive pretraining for robust handwritten mathematical expression recognition
摘要
Handwritten mathematical expression recognition continues to pose a significant challenge because of the complex 2D structure of expressions and the large variation in writing styles. Deep learning models have made great progress, but their performance is constrained by the scarcity of large annotated datasets. Self-supervised learning offers a potential solution, but traditional contrastive approaches often perform poorly due to the sparse, low-entropy nature of handwritten mathematical expression (HME) images, resulting in suboptimal representations. To address this problem, we present MoCoMER-V1, an attention-guided self-supervised framework to improve representation learning through addition of channel and spatial attention to a Momentum Contrast (MoCo) pipeline. Our model has a DenseNet backbone with a CBAM block (channel + spatial attention) and can direct the encoder to focus on semantically helpful parts, like the fraction bar and superscripts while avoiding uninformative feature channels. This attention-guided pre-training, using an image contrastive loss via InfoNCE, learns useful and discriminative features from unlabeled data. On CROHME 2014/2016/2019, MoCoMER-V1 achieves new recognition rates (63.35%, 61.46%, 64.89% respectively), and shows that our model achieves competitive performance compared to self-supervised HMER and even surpasses several fully supervised baselines, demonstrating the effectiveness of the proposed attention-guided contrastive pretraining. Our codebase is publicly available at https://github.com/DVLP-CMATERJU/MoCoMER-V1.git.