Abstract:Adulteration of Wuchang Daoxiang rice in commercial markets has emerged as a serious issue. To efficiently and accurately identify adulterated rice, this study used Northeast Changxiang rice, which exhibits a high degree of visual similarity to adulterated samples. Concurrently, 2 100 images of ordinary rice were collected against hand-held and black backgrounds. Furthermore, a multiple structural unified transformer (UniFormer-MS) visual model is proposed that combines Transformer architectures with convolutional neural networks (CNNs). The UniFormer-MS model integrates the self-attention mechanism of the Transformer with CNN-based local feature extraction to construct an end-to-end deep learning framework. Specifically, the Transformer enhances recognition ability via global feature modeling and fusion employing an improved multi-head self-attention mechanism that improves the accuracy of rice authenticity classification. The squeeze-and-excitation (SE) module performs weighted optimization on channel features to further improve the accuracy and robustness of the model. Experimental results demonstrated the excellent performance of the model in identifying adulterated rice, achieving an accuracy of 87.00%, precision of 87.30%, recall of 86.67%, and F1 score of 86.52%. Compared with traditional UniFormer models, UniFormer-MS improved the recognition accuracy of rice surface features by 6.92%, precision by 5.76%, recall by 5.96%, and F1 score by 5.89%, thereby enabling efficient and accurate identification of adulterated rice. This study provides reliable technical support for food quality monitoring, intelligent agriculture, and production line automation, which significantly enhances the efficiency and accuracy of food safety testing.