Abstract:In intelligent cattle farming, the application of facial recognition technology for cattle is crucial. However, due to the complex and variable farming environment and the non-planar characteristics of cattle faces, facial recognition technology often faces challenges such as insufficient recognition accuracy and poor robustness in practical applications. To address these issues, a FaceNet based on multi-scale fusion network (FMF) was proposed, which identified cattle through facial features. Firstly, the MSRCR method was used for color restoration preprocessing of the input cattle face images to reduce the impact of lighting on the FMF algorithm. Subsequently, a more lightweight MobileNetV3 was introduced into the main feature extraction network to reduce the model parameters and computation while ensuring high feature extraction capability. Finally, a composite dual-branch adaptive attention mechanism (M_CBAM) was proposed for multi-scale feature fusion. M_CBAM adjusted the weighting coefficients based on important features of the feature maps, adaptively weighting serial CBAM and parallel CBAM weights, then performed multi-scale feature fusion of local fine features and global features of cattle faces, improving facial recognition accuracy. To explore the effectiveness and real-time performance of the proposed algorithm, ablation experiments were conducted on a self-made cattle face dataset, and the results were compared with current mainstream recognition algorithms. Finally, the algorithm was deployed on the Jetson AGX Xavier embedded platform for application testing. The test results showed that the proposed algorithm achieved an accuracy of 93.86% and an FPS of 30.02 f/s on an open test set collected from other dairy farms. Under the condition of fast model inference speed, the recognition accuracy was significantly better than that of the original network and comparison networks.