## 4 Conclusions  
This study demonstrated the feasibility of the NIR HSI technique for the quantitative detection and contamination visualization analysis of peanut and walnut powders in whole wheat flour. At first, different preprocessing methods were examined to promote the signal-to-noise ratio of the original spectra. After comparison, the preprocessed spectra by SNV combined with 1 st Der were adopted to develop the PLSR model based on full spectra. UVE selected more feature wavelengths and had more accurate prediction models than SPA. SPA had the advantage of streamlining the wavelength variables based on a minimum of collinearity, but resulted in a decrease in the accuracy of the model. The general multispectral model for predicting a contaminant concentration of both peanut-contaminated flour and walnut-contaminated flour performed worse than the individual identification model for either peanut or walnut contaminant, but the performance was still promising with \(\text{R}_{\text{c}}\)2 of 0.988, RMSEC of 0.345%, \(\text{R}_{\text{cv}}\)2 of 0.987, RMSECV of 0.360%, \(\text{R}_{\text{p}}\)2 of 0.987, and RMSEP of 0.373%. For the individual identification models for peanut and walnut powders in flour, the samples of prediction set with concentrations above 0.5% could be predicted correctly as contaminated flour, while for the general model for combined samples of the two, the limit of detection was 1%. In particular, for all of the models, the walnut contaminant was detected more accurately than the peanut contaminant. Although for some unintentional contamination situations the results of the models were not good enough, the models had practical application significance in the situations of nut powder as a food ingredient deliberately added in commercial wheat products.  
Visual maps based on different multispectral PLSR models indicated the ability to display the concentration variation of peanut or walnut contamination in spatial terms, which is impossible for the naked eye and common industrial cameras. The study confirmed that the NIR HSI technique has the potential to inspect peanut and walnut powders in whole wheat flour for rapid quality control, and demonstrated the prospect of practical application. The methodology proposed in this study could also be used to detect other foreign contamination or adulteration in whole wheat flour. In the current study, taking into account similar trends of spectral curves among pure samples, the small particle size of samples (less than 0.180 mm), and the insufficient image resolution (0.32 mm/pixel), the identification of the location of peanut and walnut particles seemed impossible. Further research can focus on the feasibility of employing NIR HSI to identify the location of contaminant particles in the sample surface under situations of different image resolutions and particle sizes of samples.  
[PERSON] arranged the experiments; [PERSON] and [PERSON] conducted the experiments; [PERSON], [PERSON] and [PERSON] analyzed the data; [PERSON], [PERSON], [PERSON], and [PERSON] prepared the manuscript. All authors cooperated in the expression of the results and the organization of the manuscript.  
The study is financially supported by the National Natural Science Foundation of China (No. 31772062).  
The authors thank the Quantum Design China Co., Ltd. (Beijing, China) for the support of the hyperspectral system.  
The authors declare no conflict of interest.