Shumin Gao, Haofan Zhang, Zhiqing Yang, Siyuan Bai, Rongxuan Wu, Min Chen, Huawei Tao, Peng Li
Near-infrared (NIR) spectroscopy is widely used for geographical origin identification; however, limited training samples and strong spectral collinearity often restrict classification performance. In this study, a small-sample NIR classification method combining masked autoregressive flow (MAF) and the Simple, Parameter-Free Attention Module (SimAM) was developed for the geographical origin identification of Astragalus membranaceus. MAF was employed to reduce spectral redundancy and inter-variable dependence through latent-space transformation, while SimAM further enhanced discriminative latent features without introducing additional trainable parameters. A prototype-constrained loss was incorporated to improve class separability. Using 600 samples from five geographical origins, the proposed method achieved an average accuracy of 98.50% ± 0.33% on an independent hold-out test set across five independent runs, outperforming partial least squares discriminant analysis, an autoencoder (AE) combined with a multilayer perceptron, and a one-dimensional convolutional neural network. Under the few-shot setting with 20 training samples per class, MAF-SimAM achieved an accuracy of 94.00% ± 1.71%. These results indicate that the proposed framework provides accurate and stable NIR spectral classification under limited-sample conditions.