During the near‐infrared spectroscopy analysis process, modeling the quantitative relationship between the collected spectral information and target components is an important procedure. Before using the traditional modeling methods, it is often necessary to select the most featured wavelengths and eliminate those uninformative wavelengths. However, the wavelength selection algorithms can not only increase the model complexity but also may contain some adjustable parameters, which need the users to have more expertise knowledge and experiences. To solve this problem, this paper proposed a novel end‐to‐end quantitative analysis modeling method for near‐infrared spectroscopy based on convolutional neural network (CNN), which directly takes the whole range of collected raw spectral information as input without wavelength selection. The public corn NIR dataset was taken as example to validate the efficiency of proposed method. The experimental results showed that, firstly, if all the whole range of raw spectral information was taken as the input of modeling, the generalized performance of CNN outperforms the traditional methods, and the difference is statistically significant; secondly, if the traditional methods were combined with wavelength selection algorithms, their generalized performances were similar to CNN model; there is no statistical difference. The results indicated that applying the deep learning methods (take CNN as representative) to establish the quantitative analysis model of near‐infrared spectroscopy is easy to use and has more potential popularize values.
Wavelength selection is an important preprocessing issue in near-infrared (NIR) spectroscopy analysis and modeling. Swarm optimization algorithms (such as genetic algorithm, bat algorithm, etc.) have been successfully applied to select the most effective wavelengths in previous studies. However, these algorithms suffer from the problem of unrobustness, which means that the selected wavelengths of each optimization are different. To solve this problem, this paper proposes a novel wavelength selection method based on the binary dragonfly algorithm (BDA), which includes three typical frameworks: single-BDA, multi-BDA, ensemble learning-based BDA settings. The experimental results for the public gasoline NIR spectroscopy dataset showed that: (1) By using the multi-BDA and ensemble learning-based BDA methods, the stability of wavelength selection can improve; (2) With respect to the generalized performance of the quantitative analysis model, the model established with the wavelengths selected by using the multi-BDA and the ensemble learning-based BDA methods outperformed the single-BDA method. The results also indicated that the proposed method is not limited to the dragonfly algorithm but can also be combined with other swarm optimization algorithms. In addition, the ensemble learning idea can be applied to other feature selection areas to obtain more robust results.