# CFormerFaceNet: Efficient Lightweight Network Merging a CNN and Transformer for Face Recognition
###### Abstract
In order to address the limitations of large-scale deep neural networks, including their large parameter size and computational complexity, several methods have been used to compress or accelerate deep neural networks through techniques such as pruning [1; 2], knowledge distillation [3], low-rank approximation [4], and quantization [5; 6]. In recent years, the development of lightweight deep neural networks has emerged as one of the most promising solutions to achieve a better balance between speed and accuracy. Among the widely used methods in visual recognition tasks are SqueezeNet [7], MobileNets [8; 9; 10], ShuffleNets [11; 12], EfficientNet [13], and GhostNet [14], which have demonstrated impressive results. However, only a few works have proposed precise lightweight architectures that have been specifically designed for face recognition [15; 16; 17; 18; 19], indicating the need for further exploration in this area. From a fundamental perspective, face recognition belongs to the category of image-matching tasks. However, it is not a simple pixel-level matching process, as numerous factors can impact face recognition performance, such as pose, age, lighting, occlusion, or variations in quality. These factors can hinder the ability of Convolutional Neural Networks (CNNs) to extract local features, as changes in a pose can cause part of the face to disappear, blurry facial images can lead to indistinct facial regions, and variations in lighting can result in the loss of detailed facial information. Furthermore, different facial regions contribute differently to the final recognition outcome. Therefore, when utilizing a CNN to extract facial features, regions that have a higher contribution to face recognition should be given more weight. Similarly, feature channels with higher discrimination ability should also be given greater weight. Besides the extraction of efficient local features, the fusion of local facial features and global abstract facial features also plays an important role in face recognition performance. The convolution operation possesses inherent local perceptual characteristics but may disregard the overall correlation between different regions in facial images, leading to limitations in comprehending global semantic information. For instance, two individuals can possess very similar eyes, making it difficult to distinguish between them. However, discerning whether they belong to the same person can be accomplished by evaluating factors such as interocular distance or the overall arrangement of their facial features. Nonetheless, CNNs struggle to learn global facial information. The self-attention mechanism architecture of the Transformer effectively compensates for CNN's limitations in global modeling by enabling long-distance modeling at shallow levels of the model. The literature has shown the feasibility of incorporating Transformer models into face recognition and promising experimental outcomes have been reported. Based on the aforementioned analysis, this paper presents a novel, efficient, and lightweight model known as CFormerFaceNet for face recognition, which integrates a CNN and Transformer. By fully utilizing the CNN's ability to extract local facial features and Transformer's capability to model global facial features, these two techniques are seamlessly combined to become CFormerFaceNet. In addition, lightweight modifications are implemented to significantly reduce the parameters and computations required, without significantly compromising performance. Therefore, CFormerFaceNet can greatly reduce the requirements for edge-device processors in face recognition tasks, thereby enhancing real-time performance.