Air pollution and the presence of toxic gases in daily life pose a significant health concern, leading people to wear masks for protection. However, wearing masks obscures important facial features, consequently diminishing the performance of existing recognition methods. To tackle this issue, this study introduces a dual-branch attention-based method for recognizing masked faces. The method incorporates ECSA(Efficient Channel Spatial Attention) and N-UPA(New Upper Part Attention) modules and employs a dual-branch training structure. Each convolution block incorporates ECSA modules to improve the network’s ability to extract overall facial features. Additionally, a branch network comprising the N-UPA module is introduced to focus on extracting features from the eye area, thereby enhancing the accuracy of mask face recognition. The effectiveness of the proposed method has been validated using a real dataset. Experimental results showcase its exceptional generalization capability. Moreover, in comparison to advanced methods, the proposed approach markedly improves the performance of recognizing faces under mask occlusion.