Hyperspectral Inversion of Apple Leaf Nitrogen Across Phenological Stages Based on an Optimized XGBoost Model
Abstract
1. Introduction
2. Materials and Methods
2.1. Study Area Overview
2.2. Data Acquisition and Processing
2.2.1. Leaf Sample Collection
2.2.2. Acquisition of Leaf Hyperspectral Reflectance Curves
2.2.3. Leaf Nitrogen Content Analysis
2.3. Spectral Data Processing and Characteristic Wavelength Extraction
2.3.1. Preprocessing of Hyperspectral Reflectance Curves
2.3.2. Characteristic Wavelength Selection for LNC
2.4. Model Construction and Evaluation
2.4.1. Machine Learning Algorithms
2.4.2. Model Evaluation Metrics
2.5. Model Hyperparameter Optimization
2.5.1. Swarm-Based Optimization Algorithms
2.5.2. Improvements to Swarm-Based Optimization Algorithms
3. Results
3.1. Description of Spectral Characteristic Curves
3.2. Characteristic Wavelength Selection Results
3.3. Performance Evaluation of Optimization Algorithms
3.3.1. Benchmarking Results for the Original Optimization Algorithms
3.3.2. Benchmarking Results for the Improved Optimization Algorithms
3.4. Model Development and Evaluation Results
3.4.1. Results for the Bloom and Fruit-Set Stage
3.4.2. Results for the Fruit-Enlargement Stage
4. Discussion
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
Abbreviations
| BKA | Back-winged kite algorithm |
| BO | Byesian optimization |
| BPNN | Back propagation neural network |
| CARS | Competitive adaptive reweighted sampling |
| CPO | Crested porcupine optimizer |
| EOBL | Elite opposition-based learning |
| GA | Genetic algorithms |
| GBDT | Gradient boosting decision tree |
| GSWOA | Global search whale optimization algorithm |
| KELM | Kernel extreme learning machine |
| LNC | Leaf nitrogen content |
| PSO | Particle swarm optimization |
| QMC | Quasi Monte Carlo |
| Coefficient of determination | |
| RF | Random forest |
| Root mean squared error | |
| SA | Simulated annealing |
| SEO | Sobol-Elite opposition-based learning |
| SPA | Successive projection algorithm |
| SVR | Support vector regression |
References
- Tarancón, P.; Fernández-Serrano, P.; Besada, C. Consumer perception of situational appropriateness for fresh, dehydrated and fresh-cut fruits. Food Res. Int. 2021, 140, 110000. [Google Scholar] [CrossRef]
- Medda, S.; Fadda, A.; Mulas, M. Influence of Climate Change on Metabolism and Biological Characteristics in Perennial Woody Fruit Crops in the Mediterranean Environment. Horticulturae 2022, 8, 273. [Google Scholar] [CrossRef]
- Wen, B.; Gong, X.; Chen, X.; Tan, Q.; Li, L.; Wu, H. Transcriptome analysis reveals candidate genes involved in nitrogen deficiency stress in apples. J. Plant Physiol. 2022, 279, 153822. [Google Scholar] [CrossRef] [PubMed]
- Cui, M.; Zeng, L.; Qin, W.; Feng, J. Measures for reducing nitrate leaching in orchards: A review. Environ. Pollut. 2020, 263, 114553. [Google Scholar] [CrossRef] [PubMed]
- Zipori, I.; Erel, R.; Yermiyahu, U.; Ben-gal, A.; Dag, A. Sustainable management of olive orchard nutrition: A review. Agriculture 2020, 10, 11. [Google Scholar] [CrossRef]
- Muñoz-Huerta, R.F.; Guevara-Gonzalez, R.G.; Contreras-Medina, L.M.; Torres-Pacheco, I.; Prado-Olivarez, J.; Ocampo-Velazquez, R.V. A review of methods for sensing the nitrogen status in plants: Advantages, disadvantages and recent advances. Sensors 2013, 13, 10823–10843. [Google Scholar] [CrossRef]
- Subi, X.; Eziz, M.; Zhong, Q.; Li, X. Estimating the chromium concentration of farmland soils in an arid zone from hyperspectral reflectance by using partial least squares regression methods. Ecol. Indic. 2024, 161, 111987. [Google Scholar] [CrossRef]
- Noda, H.M.; Muraoka, H.; Nasahara, K.N. Plant ecophysiological processes in spectral profiles: Perspective from a deciduous broadleaf forest. J. Plant Res. 2021, 134, 737–751. [Google Scholar] [CrossRef]
- Jiang, X.; Zhen, J.; Miao, J.; Zhao, D.; Shen, Z.; Jiang, J.; Gao, C.; Wu, G.; Wang, J. Newly-developed three-band hyperspectral vegetation index for estimating leaf relative chlorophyll content of mangrove under different severities of pest and disease. Ecol. Indic. 2022, 140, 108978. [Google Scholar] [CrossRef]
- Canova, L.d.S.; Vallese, F.D.; Pistonesi, M.F.; de Araújo Gomes, A. An improved successive projections algorithm version to variable selection in multiple linear regression. Anal. Chim. Acta 2023, 1274, 341560. [Google Scholar] [CrossRef]
- Moghimi, A.; Tavakoli Darestani, A.; Mostofi, N.; Fathi, M.; Amani, M. Improving forest above-ground biomass estimation using genetic-based feature selection from Sentinel-1 and Sentinel-2 data (case study of the Noor forest area in Iran). Kuwait J. Sci. 2024, 51, 100159. [Google Scholar] [CrossRef]
- Li, W.; Zhu, X.; Yu, X.; Li, M.; Tang, X.; Zhang, J.; Xue, Y.; Zhang, C.; Jiang, Y. Inversion of Nitrogen Concentration in Apple Canopy Based on UAV Hyperspectral Images. Sensors 2022, 22, 3503. [Google Scholar] [CrossRef] [PubMed]
- Zhao, X.; Zhao, Z.; Zhao, F.; Liu, J.; Li, Z.; Wang, X.; Gao, Y. An Estimation of the Leaf Nitrogen Content of Apple Tree Canopies Based on Multispectral Unmanned Aerial Vehicle Imagery and Machine Learning Methods. Agronomy 2024, 14, 552. [Google Scholar] [CrossRef]
- Guo, Y.; Fu, Y.H.; Chen, S.; Hao, F.; Zhang, X.; de Beurs, K.; He, Y. Predicting grain yield of maize using a new multispectral-based canopy volumetric vegetation index. Ecol. Indic. 2024, 166, 112295. [Google Scholar] [CrossRef]
- Luo, W.; Li, W.; Liu, S.; Li, Q.; Huang, H.; Zhang, H. Measurement of four main catechins content in green tea based on visible and near-infrared spectroscopy using optimized machine learning algorithm. J. Food Compos. Anal. 2025, 138, 106990. [Google Scholar] [CrossRef]
- Qin, Z.; Yang, H.; Shu, Q.; Yu, J.; Yang, Z.; Ma, X.; Duan, D. Estimation of Dendrocalamus giganteus leaf area index by combining multi-source remote sensing data and machine learning optimization model. Front. Plant Sci. 2024, 15, 1505414. [Google Scholar] [CrossRef]
- Khandelwal, K.; Nanda, S.; Dalai, A.K. Machine learning modeling of supercritical water gasification for predictive hydrogen production from waste biomass. Biomass Bioenergy 2025, 197, 107816. [Google Scholar] [CrossRef]
- Mirabdulbaghi, M. Leaf nutrient status of some grafted-pear rootstocks influenced by different soil types. Span. J. Agric. Res. 2020, 18, e0903. [Google Scholar] [CrossRef]
- Wan, C.; Yue, R.; Li, Z.; Fan, K.; Chen, X.; Li, F. Prediction of Kiwifruit Sweetness with Vis/NIR Spectroscopy Based on Scatter Correction and Feature Selection Techniques. Appl. Sci. 2024, 14, 4145. [Google Scholar] [CrossRef]
- Cho, G.H.; Kim, Y.J.; Jeon, K.; Joo, H.J.; Kang, K.S. Accuracy Evaluation of Visible-Near Infrared Spectroscopy for Detecting Insect Damage in Acorns of Quercus acuta. Silvae Genet. 2024, 73, 99–109. [Google Scholar] [CrossRef]
- Yang, D.; Hu, J. A detection method of oil content for maize kernels based on CARS feature selection and deep sparse autoencoder feature extraction. Ind. Crops Prod. 2024, 222, 119464. [Google Scholar] [CrossRef]
- Liu, J.; Xie, J.; Meng, T.; Dong, H. Organic matter estimation of surface soil using successive projection algorithm. Agron. J. 2022, 114, 1944–1951. [Google Scholar] [CrossRef]
- Tian, S.; Guo, H.; Xu, W.; Zhu, X.; Wang, B.; Zeng, Q.; Mai, Y.; Huang, J.J. Remote sensing retrieval of inland water quality parameters using Sentinel-2 and multiple machine learning algorithms. Environ. Sci. Pollut. Res. 2023, 30, 18617–18630. [Google Scholar] [CrossRef] [PubMed]
- Ganaie, M.A.; Tanveer, M.; Suganthan, P.N.; Snasel, V. Oblique and rotation double random forest. Neural Netw. 2022, 153, 496–517. [Google Scholar] [CrossRef] [PubMed]
- Chen, T.; Guestrin, C. XGBoost: A scalable tree boosting system. In Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, San Francisco, CA, USA, 13–17 August 2016; pp. 785–794. [Google Scholar]
- Sarkar, C.; Gupta, D.; Gupta, U.; Hazarika, B.B. Leaf disease detection using machine learning and deep learning: Review and challenges. Appl. Soft Comput. 2023, 145, 110534. [Google Scholar] [CrossRef]
- Berggren, M. Coefficients of Determination Measured on the Same Scale as the Outcome: Alternatives to R2 That Use Standard Deviations Instead of Explained Variance. Psychol. Methods 2024. [Google Scholar] [CrossRef]
- Hodson, T.O. Root-mean-square error (RMSE) or mean absolute error (MAE): When to use them or not. Geosci. Model Dev. 2022, 15, 5481–5487. [Google Scholar] [CrossRef]
- Wan, C.; Yang, J.; Zhou, L.; Wang, S.; Peng, J.; Tan, Y. Fertilization Control System Research in Orchard Based on the PSO-BP-PID Control Algorithm. Machines 2022, 10, 982. [Google Scholar] [CrossRef]
- Abdel-Basset, M.; Mohamed, R.; Abouhawwash, M. Crested Porcupine Optimizer: A new nature-inspired metaheuristic. Knowl.-Based Syst. 2024, 284, 111257. [Google Scholar] [CrossRef]
- Wang, J.; Wang, W.C.; Hu, X.X.; Qiu, L.; Zang, H.F. Black-Winged Kite Algorithm: A Nature-Inspired Meta-Heuristic for Solving Benchmark Functions and Engineering Problems; Springer: Dordrecht, The Netherlands, 2024; Volume 57. [Google Scholar]
- Joe, S.; Kuo, F.Y. Remark on Algorithm 659: Implementing Sobol’s quasirandom sequence generator. ACM Trans. Math. Softw. 2003, 29, 49–57. [Google Scholar] [CrossRef]
- Pan, W.; Li, K.; Wang, M.; Wang, J.; Jiang, B. Adaptive randomness: A new population initialization method. Math. Probl. Eng. 2014, 2014, 975916. [Google Scholar] [CrossRef]
- Du, C.; Zhang, J.; Fang, J. An innovative complex-valued encoding black-winged kite algorithm for global optimization. Sci. Rep. 2025, 15, 932. [Google Scholar] [CrossRef] [PubMed]
- Zhang, Z.; Wang, X.; Yue, Y. Heuristic Optimization Algorithm of Black-Winged Kite Fused with Osprey and Its Engineering Application. Biomimetics 2024, 9, 595. [Google Scholar] [CrossRef] [PubMed]
- Zhu, J. A Note on Multidimensional Sobol Sequences. SSRN Electron. J. 2012, 3–6. [Google Scholar] [CrossRef]
- Khanduja, N.; Bhushan, B. Chaotic state of matter search with elite opposition based learning: A new hybrid metaheuristic algorithm. Optim. Control Appl. Methods 2023, 44, 533–548. [Google Scholar] [CrossRef]
- Ye, Z.; Sheng, Z.; Liu, X.; Ma, Y.; Wang, R.; Ding, S.; Liu, M.; Li, Z.; Wang, Q. Using machine learning algorithms based on gf-6 and google earth engine to predict and map the spatial distribution of soil organic matter content. Sustainability 2021, 13, 14055. [Google Scholar] [CrossRef]
- Jin, Z.; Shang, J.; Zhu, Q.; Ling, C.; Xie, W.; Qiang, B. RFRSF: Employee Turnover Prediction Based on Random Forests and Survival Analysis. In Web Information Systems Engineering—WISE 2020; Lecture Notes in Computer Science (Including Subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics); Springer: Cham, Switzerland, 2020; Volume 12343, pp. 503–515. [Google Scholar]
- Jafarzadeh, H.; Mahdianpari, M.; Gill, E.; Mohammadimanesh, F.; Homayouni, S. Bagging and boosting ensemble classifiers for classification of multispectral, hyperspectral and polSAR data: A comparative evaluation. Remote Sens. 2021, 13, 4405. [Google Scholar] [CrossRef]
- Dong, X.; Yu, Z.; Cao, W.; Shi, Y.; Ma, Q. A survey on ensemble learning. Front. Comput. Sci. 2020, 14, 241–258. [Google Scholar] [CrossRef]
- Qin, A.; Sun, J.; Zhu, X.; Li, M.; Li, C.; Wang, L.; Yu, X.; Jiang, Y. The Yield Estimation of Apple Trees Based on the Best Combination of Hyperspectral Sensitive Wavelengths Algorithm. Sustainability 2025, 17, 518. [Google Scholar] [CrossRef]
- Xie, C.; Yang, C.; Hummel, A., Jr.; Johnson, G.A.; Izuno, F.T. Spectral reflectance response to nitrogen fertilization in field grown corn. Int. J. Agric. Biol. Eng. 2018, 11, 102–109. [Google Scholar] [CrossRef][Green Version]













| Date | Count | Range (%) | Mean (%) | StdDev (%) | CV (%) |
|---|---|---|---|---|---|
| Bloom and fruit-set stage | 560 | 2.02–3.34 | 2.79 | 0.146 | 0.052 |
| Fruit-enlargement stage | 560 | 1.62–2.68 | 2.18 | 0.125 | 0.059 |
| Model | Optimization Algorithm | Validation Set | Test Set | ||
|---|---|---|---|---|---|
| SVR | PSO | 0.810 | 0.151 | 0.766 | 0.193 |
| CPO | 0.880 | 0.121 | 0.795 | 0.180 | |
| BKA | 0.848 | 0.135 | 0.783 | 0.186 | |
| RF | PSO | 0.841 | 0.112 | 0.831 | 0.136 |
| CPO | 0.869 | 0.113 | 0.840 | 0.138 | |
| BKA | 0.866 | 0.118 | 0.852 | 0.127 | |
| XGBoost | PSO | 0.835 | 0.128 | 0.824 | 0.143 |
| CPO | 0.870 | 0.113 | 0.845 | 0.130 | |
| BKA | 0.882 | 0.112 | 0.859 | 0.128 | |
| BPNN | PSO | 0.814 | 0.138 | 0.797 | 0.144 |
| CPO | 0.833 | 0.126 | 0.829 | 0.140 | |
| BKA | 0.874 | 0.131 | 0.820 | 0.141 | |
| Model | Optimization Algorithm | Validation Set | Test Set | ||
|---|---|---|---|---|---|
| SVR | SEO-PSO | 0.882 | 0.119 | 0.787 | 0.184 |
| SEO-CPO | 0.864 | 0.128 | 0.811 | 0.174 | |
| SEO-BKA | 0.904 | 0.108 | 0.795 | 0.180 | |
| RF | SEO-PSO | 0.903 | 0.126 | 0.868 | 0.132 |
| SEO-CPO | 0.939 | 0.099 | 0.869 | 0.131 | |
| SEO-BKA | 0.933 | 0.105 | 0.877 | 0.127 | |
| XGBoost | SEO-PSO | 0.915 | 0.119 | 0.874 | 0.129 |
| SEO-CPO | 0.922 | 0.112 | 0.859 | 0.136 | |
| SEO-BKA | 0.922 | 0.113 | 0.883 | 0.124 | |
| BPNN | SEO-PSO | 0.892 | 0.133 | 0.844 | 0.143 |
| SEO-CPO | 0.902 | 0.126 | 0.869 | 0.131 | |
| SEO-BKA | 0.925 | 0.110 | 0.870 | 0.130 | |
| Mean Error | Significant | Stars | |||
|---|---|---|---|---|---|
| SEO-BKA-XGBoost | SEO-BKA-SVR | −1.44 × 10−3 | 5.20 × 10−5 | TRUE | *** |
| SEO-BKA-RF | −6.00 × 10−4 | 9.90 × 10−3 | TRUE | ** | |
| SEO-BKA-BPNN | −5.80 × 10−4 | 7.50 × 10−3 | TRUE | ** |
| Model | Optimization Algorithm | Validation Set | Test Set | ||
|---|---|---|---|---|---|
| SVR | PSO | 0.814 | 0.094 | 0.803 | 0.100 |
| CPO | 0.831 | 0.092 | 0.784 | 0.103 | |
| BKA | 0.816 | 0.086 | 0.806 | 0.101 | |
| RF | PSO | 0.921 | 0.087 | 0.853 | 0.093 |
| CPO | 0.922 | 0.077 | 0.855 | 0.090 | |
| BKA | 0.914 | 0.083 | 0.874 | 0.084 | |
| XGBoost | PSO | 0.899 | 0.089 | 0.844 | 0.095 |
| CPO | 0.902 | 0.081 | 0.869 | 0.087 | |
| BKA | 0.924 | 0.079 | 0.874 | 0.086 | |
| BPNN | PSO | 0.883 | 0.099 | 0.819 | 0.091 |
| CPO | 0.879 | 0.089 | 0.836 | 0.093 | |
| BKA | 0.895 | 0.076 | 0.833 | 0.096 | |
| Model | Optimization Algorithm | Validation Set | Test Set | ||
|---|---|---|---|---|---|
| SVR | SEO-PSO | 0.833 | 0.089 | 0.805 | 0.099 |
| SEO-CPO | 0.840 | 0.089 | 0.809 | 0.095 | |
| SEO-BKA | 0.852 | 0.084 | 0.816 | 0.097 | |
| RF | SEO-PSO | 0.864 | 0.083 | 0.858 | 0.083 |
| SEO-CPO | 0.866 | 0.081 | 0.856 | 0.084 | |
| SEO-BKA | 0.903 | 0.070 | 0.876 | 0.080 | |
| XGBoost | SEO-PSO | 0.892 | 0.072 | 0.860 | 0.083 |
| SEO-CPO | 0.902 | 0.070 | 0.889 | 0.072 | |
| SEO-BKA | 0.929 | 0.059 | 0.897 | 0.069 | |
| BPNN | SEO-PSO | 0.852 | 0.087 | 0.841 | 0.093 |
| SEO-CPO | 0.857 | 0.085 | 0.850 | 0.088 | |
| SEO-BKA | 0.898 | 0.073 | 0.847 | 0.082 | |
| Mean Error | Significant | Stars | |||
|---|---|---|---|---|---|
| SEO-BKA-XGBoost | SEO-BKA-SVR | −1.04 × 10−3 | 4.67 × 10−6 | TRUE | *** |
| SEO-BKA-RF | −8.00 × 10−4 | 7.00 × 10−3 | TRUE | ** | |
| SEO-BKA-BPNN | −3.02 × 10−3 | 1.00 × 10−3 | TRUE | ** |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Xi, R.; Gu, Y.; Ren, H.; Ren, Z. Hyperspectral Inversion of Apple Leaf Nitrogen Across Phenological Stages Based on an Optimized XGBoost Model. Horticulturae 2026, 12, 184. https://doi.org/10.3390/horticulturae12020184
Xi R, Gu Y, Ren H, Ren Z. Hyperspectral Inversion of Apple Leaf Nitrogen Across Phenological Stages Based on an Optimized XGBoost Model. Horticulturae. 2026; 12(2):184. https://doi.org/10.3390/horticulturae12020184
Chicago/Turabian StyleXi, Ruiqian, Yanxia Gu, Haoyu Ren, and Zhenhui Ren. 2026. "Hyperspectral Inversion of Apple Leaf Nitrogen Across Phenological Stages Based on an Optimized XGBoost Model" Horticulturae 12, no. 2: 184. https://doi.org/10.3390/horticulturae12020184
APA StyleXi, R., Gu, Y., Ren, H., & Ren, Z. (2026). Hyperspectral Inversion of Apple Leaf Nitrogen Across Phenological Stages Based on an Optimized XGBoost Model. Horticulturae, 12(2), 184. https://doi.org/10.3390/horticulturae12020184

