Determining Moisture Content of Basil Using Handheld Near-Infrared Spectroscopy

: Accurate and rapid determination of moisture content is essential in crop production and decision-making for irrigation. Near-infrared (NIR) spectroscopy has been shown to be a promising method for determining moisture content in various agricultural products, including herbs and vegetables. This study tested the hypothesis that NIR spectroscopy is effective in accurately measuring the moisture content of Genovese basil ( Ocimum basilicum L.), with the objective of developing a respective calibration model. Spectral data were obtained from a total of 120 basil leaf samples over a period of six days. These included freshly harvested and detached leaves, as well as those left in ambient air for 1–6 days. Five spectra were taken from each leaf using a handheld NIR spectrophotometer, which covers the first and second overtones of the NIR spectral region: 950–1650 nm. After the spectral acquisition, the leaves were weighed for fresh mass and then put in an oven for 72 h at 80 ◦ C to determine the dry weight and calculate the reference moisture content. The calibration model was developed using multivariate analysis in MATLAB, including preprocessing and regression modeling. The data obtained from 75% of the samples were used for model training and 25% for validation. The final model demonstrates strong performance metrics. The root mean square error of calibration (RMSEC) is 2.9908, the root mean square error of cross-validation (RMSECV) is 3.2368, and the root mean square error of prediction (RMSEP) reaches 2.4675. The coefficients of determination for calibration (R 2 C) and cross-validation (R 2 CV) are consistent, with values of 0.829 and 0.80, respectively. The model’s predictive ability is indicated by a coefficient of determination for prediction (R 2 P) of 0.86. The range error ratio (RER) stands at 11.045—highlighting its predictive performance. Our investigation, using handheld NIR spectrophotometry, confirms NIR’s usefulness in basil moisture determination. The rapid determination offers valuable insights for irrigation and crop management.


Introduction
Accurate determination of the moisture content of leaves is a critical factor in successful crop production and efficient irrigation practices [1].Moisture content directly influences the quality and yield of agricultural products, affecting various aspects such as shelf life, texture, and nutritional value [2,3].Water plays a crucial role in regulating plant biochemical activities [4], and when plants experience water stress, it hinders transpiration and lowers the efficiency of photosynthesis.This, in turn, can result in the closure of stomata, limiting crop productivity [5][6][7].Therefore, maintaining the right moisture levels in plants is vital for optimal plant growth, as both excessive and insufficient moisture can lead to detrimental outcomes, including reduced crop yield, increased susceptibility to diseases, and poor irrigation management [8].
Near-infrared (NIR) spectroscopy has emerged as a powerful analytical technique in the field of agriculture and horticulture [9].It relies on the interaction of near-infrared light with molecular vibrations in the sample, allowing for the non-destructive and rapid analysis of various properties, including moisture content.NIR spectroscopy capitalizes on the fact that different chemical compounds absorb and reflect light at specific wavelengths, providing valuable information about the composition of the sample [10].NIR spectroscopy has great potential to become a pivotal tool in plant science due to its non-destructive, rapid analysis capabilities with minimal sample preparation.Advances in miniaturization, optics, and digitalization, alongside increased availability of computational power, are transforming NIR spectroscopy into a versatile, efficient, and widely available analytical method for real-time plant analysis and research.Extensive research has been conducted on the application of NIR spectroscopy in determining the moisture content of vegetables, specifically focusing on those characterized by high moisture content [1,3,[11][12][13].The considerable water content and, consequently, the presence of hydrogen bonds in these vegetables contribute to an increased involvement of hydroxyl (OH) groups in their water structure.This presence of OH groups enhances the capacity of free water molecules to effectively absorb NIR light [12,14,15].
On the positive side, NIR spectroscopy can significantly enhance precision agriculture practices by providing detailed insights into crop health, soil properties, and water content without destructive testing, making it a valuable tool for optimizing irrigation, fertilization, and pest management practices.Moreover, NIR technology's ability to rapidly analyze the nutrient content of soils and plants can lead to more efficient use of fertilizers, reducing environmental impacts and costs.However, the implementation of NIR technology is not without its drawbacks.The initial cost of NIR equipment and the complexity of interpreting NIR data can be significant barriers for small-to medium-sized enterprises.This complexity necessitates specialized training or hiring of skilled personnel, adding to operational costs.Additionally, NIR's effectiveness can vary significantly with environmental conditions such as lighting and humidity, potentially leading to inaccuracies in data collection.Therefore, while NIR technology presents a promising tool for enhancing crop production efficiency and sustainability, its application must be carefully managed to overcome these challenges.
Despite the promising potential of NIR spectroscopy in moisture content determination, a research gap exists in its application to basil leaves.Prior studies have predominantly focused on assessing moisture content and quality in leafy vegetables like lettuce or spinach [1,11,16,17], leaving basil, a significant and versatile herb within the indoor farming sector [18], largely unexplored in terms of such assessments.Furthermore, given basil's widespread culinary and medicinal use [19], the development of a dependable method for accurately predicting its moisture content holds considerable significance for the agricultural community.Our study aims to bridge this gap by developing a robust calibration model that utilizes NIR spectroscopy to predict the moisture content of basil leaves accurately.Other herbs from the Lamiaceae family, such as oregano, mint, sage, and thyme, as well as common horticultural crops like parsley and cilantro, share similar characteristics with basil, including growth conditions, moisture content, irrigation regimes, and farming practices [20,21].These similarities suggest that advancements in moisture content determination for basil may also benefit these crops.This model holds promise for enhancing irrigation management and crop production and contributes to advancing our understanding of how NIR spectroscopy can be harnessed for moisture analysis in specific agricultural products.
Moreover, contemporary research predominantly focuses on utilizing remote sensing and spectral imaging for assessing water and moisture content in plants [4].Despite these approaches providing reasonably accurate results for large-scale estimates, these methods fall short in detecting minor fluctuations and providing real-time information on the physiological water level of fresh foliage.Consequently, this limitation makes them less practical for applications such as indoor farming and precision agriculture settings, where a critical need exists for real-time and precise determination of biochemical parameters to facilitate the effective control of environmental conditions [4].Recognizing this limitation, the current study introduces the application of a handheld NIR sensor.This technology represents a significant advancement by enabling real-time, on-site monitoring capabilities, thereby surmounting the drawbacks associated with previously established methods.

Materials and Methods
The process of developing a model to enable non-destructive, real-time measurements of basil moisture content is summarized in Figure 1.The figure outlines the steps from spectral data acquisition using the handheld spectrometer to spectral preprocessing, variable selection, model calibration, validation, prediction, and the performance metrics used for model optimization.It serves as a visual guide to the methodology employed in the study, as elaborated on in subsequent sections.
Horticulturae 2024, 10, 336 3 of 13 agriculture settings, where a critical need exists for real-time and precise determination of biochemical parameters to facilitate the effective control of environmental conditions [4].
Recognizing this limitation, the current study introduces the application of a handheld NIR sensor.This technology represents a significant advancement by enabling real-time, on-site monitoring capabilities, thereby surmounting the drawbacks associated with previously established methods.

Materials and Methods
The process of developing a model to enable non-destructive, real-time measurements of basil moisture content is summarized in Figure 1.The figure outlines the steps from spectral data acquisition using the handheld spectrometer to spectral preprocessing, variable selection, model calibration, validation, prediction, and the performance metrics used for model optimization.It serves as a visual guide to the methodology employed in the study, as elaborated on in subsequent sections.

Sample Preparation and Spectral Data Acquisition
A total of 20 fully grown Genovese basil plants (Ocimum basilicum L.), cultivated in a hydroponic controlled environment (SweGreen, Stockholm, Sweden), were selected randomly from a batch for this study (Figure 2a).The growth conditions were maintained at an optimum temperature of 22° Celsius, a relative humidity of 65%, and a light cycle of 16 h light and 8 h dark.
For irrigation, the basil plants received a hydroponic solution prepared according to the company recipe, which contains a comprehensive mix of micro and macro elements crucial for the growth of leafy green herbs.This solution was formulated to achieve an electrical conductivity (EC) of 1.4 mS/cm, ensuring optimal levels and availability of nutrients for the plants.The nutrient solution was applied through the fertigation method, delivering essential nutrients directly to the root zone.The irrigation schedule followed a precise regimen, with the solution applied four times a day at intervals of 6 h, starting at 10 am.
The illumination in the cultivation environment was provided by LED lights with a light intensity (photosynthetic photon flux density, PPFD) of 200 µmol•s⁻ 1 •m⁻ 2 .This controlled growth environment aimed to promote healthy and uniform plant

Sample Preparation and Spectral Data Acquisition
A total of 20 fully grown Genovese basil plants (Ocimum basilicum L.), cultivated in a hydroponic controlled environment (SweGreen, Stockholm, Sweden), were selected randomly from a batch for this study (Figure 2a).The growth conditions were maintained at an optimum temperature of 22 • Celsius, a relative humidity of 65%, and a light cycle of 16 h light and 8 h dark.
For irrigation, the basil plants received a hydroponic solution prepared according to the company recipe, which contains a comprehensive mix of micro and macro elements crucial for the growth of leafy green herbs.This solution was formulated to achieve an electrical conductivity (EC) of 1.4 mS/cm, ensuring optimal levels and availability of nutrients for the plants.The nutrient solution was applied through the fertigation method, delivering essential nutrients directly to the root zone.The irrigation schedule followed a precise regimen, with the solution applied four times a day at intervals of 6 h, starting at 10 am.
The illumination in the cultivation environment was provided by LED lights with a light intensity (photosynthetic photon flux density, PPFD) of 200 µmol•s −1 •m −2 .This controlled growth environment aimed to promote healthy and uniform plant development, ensuring the reliability and consistency of the spectral data collected for subsequent analysis.
harvesting.This collection encompassed diverse scenarios, including freshly harvested detached leaves left in ambient air for durations ranging from 1 to 6 days.The criteria for choosing the leaves involved randomized selection from the whole canopy, ensuring unbiased representation from different parts of it to cover all sizes and ages of leaves.This variation in sample conditions aimed to capture a comprehensive range of moisture content levels.To acquire spectral data, a handheld near-infrared spectrophotometer MicroNIR 1700 ES with an ⌀8 mm adapter (both Viavi Solutions, Scottsdale, AZ, USA) allowing use on small leaves was employed.This portable device covers the first and second overtones of the NIR spectral region, spanning from 950 to 1650 nm, with a pixel-to-pixel interval of 6.2 nm and spectral bandwidth of <1.25% of the center wavelength.The spectral data obtained from the device comprised a total of 125 spectral variables across the entire spectral range.Despite its portability, the device is sensitive to external disturbances such as ambient light and temperature fluctuations, particularly in open-field applications, which may influence the accuracy of measurements [22].To address this sensitivity, it is recommended to collect background and dark scans frequently.In controlled laboratory settings or indoor farms, where environmental conditions can be regulated, this sensitivity can be minimized or eliminated, making it a suitable tool for precise spectral analysis.Additionally, user operation can affect measures, particularly in terms of positioning and handling of the device during data collection.To minimize these effects, standardized protocols were followed, and care was taken to maintain consistent measurement conditions across all samples.The data collection process involved acquiring five distinct spectra from different parts of each basil leaf including the central vein and the lamina, ensuring a robust and representative dataset for subsequent analysis (Figure 2b).The dataset initially consisted of 123 samples, with each sample comprising 5 readings, To ensure optimal freshness and prevent water stress, the entire basil plants, along with their substrate (rockwool cube) and roots, were carefully harvested during the vegetative growth stage, 40 days after planting.Through the collection process, a total of 123 basil leaf samples were gathered over a duration of six days, including the day of harvesting.This collection encompassed diverse scenarios, including freshly harvested detached leaves left in ambient air for durations ranging from 1 to 6 days.The criteria for choosing the leaves involved randomized selection from the whole canopy, ensuring unbiased representation from different parts of it to cover all sizes and ages of leaves.This variation in sample conditions aimed to capture a comprehensive range of moisture content levels.
To acquire spectral data, a handheld near-infrared spectrophotometer MicroNIR 1700 ES with an Ø8 mm adapter (both Viavi Solutions, Scottsdale, AZ, USA) allowing use on small leaves was employed.This portable device covers the first and second overtones of the NIR spectral region, spanning from 950 to 1650 nm, with a pixel-to-pixel interval of 6.2 nm and spectral bandwidth of <1.25% of the center wavelength.The spectral data obtained from the device comprised a total of 125 spectral variables across the entire spectral range.Despite its portability, the device is sensitive to external disturbances such as ambient light and temperature fluctuations, particularly in open-field applications, which may influence the accuracy of measurements [22].To address this sensitivity, it is recommended to collect background and dark scans frequently.In controlled laboratory settings or indoor farms, where environmental conditions can be regulated, this sensitivity can be minimized or eliminated, making it a suitable tool for precise spectral analysis.Additionally, user operation can affect measures, particularly in terms of positioning and handling of the device during data collection.To minimize these effects, standardized protocols were followed, and care was taken to maintain consistent measurement conditions across all samples.The data collection process involved acquiring five distinct spectra from different parts of each basil leaf including the central vein and the lamina, ensuring a robust and representative dataset for subsequent analysis (Figure 2b).The dataset initially consisted of 123 samples, with each sample comprising 5 readings, resulting in a total of 615 spectral readings.Following data treatments and variable selection, the final dataset comprised 64 spectral variables and 428 sample readings.

Moisture Measurement
Following spectral acquisition, each basil leaf was weighed to determine its fresh mass.Subsequently, the leaves underwent an oven-drying process at 80 • C for 72 h [23].This procedure allowed for the determination of dry mass, which served as the basis for calculating the reference moisture content of the leaves [24].
where M1 is the mass of the leaves before drying, M2 is the mass after drying, and MC is the moisture content in plant leaves as a percentage of mass.

Data Processing and Model Development
The data analysis process was performed using MATLAB software (Version R2023a, The MathWorks, Inc., Natick, MA, USA), with the PLS toolbox (Version 9.2.1, Eigenvector Research, Inc., Wenatchee, WA, USA) being employed for the development of the model.The acquired spectral and reference data were loaded into MATLAB for subsequent analysis inspired by Vitalis et al.'s [3] and Zhou et al.'s [1] studies.The dataset was divided into calibration and validation sets, with the Onion algorithm [25] employed to achieve a partition of 75% for calibration and 25% for validation.
A series of data treatment approaches were explored to optimize the quality, reliability, and interpretability of the spectral data.The initial phase involved the application of Multiplicative Scatter Correction (MSC) [26], a normalization method to correct for scatter effects in NIR spectra, which can arise due to particle size variations or differences in path length, and Standard Normal Variate (SNV) transformation [27] to eliminate the effects of multiplicative scaling in the spectra.To remove noise from spectral data while preserving the shape of spectral features, Savitzky-Golay smoothing (SG) [28] was employed.Additionally, derivatives were used to enhance spectral features and mean centering to remove the mean spectrum from each sample, focusing the analysis on spectral variations in the spectral data.Autoscaling was applied to the reference data to optimize compatibility with the spectral data and give each variable the same weight and prior importance in the analysis [29].
Each treatment technique was systematically evaluated to determine its impact on improving the predictive accuracy of the calibration model.Finally, the best combination of sample pretreatment and spectra pretreatment was decided according to the effect on the regression model.Moreover, an additional step was taken to address extreme values, where nine samples with less than 50 percent moisture content were removed, followed by the reconstruction of the model.
Two variable selection methods, Genetic Algorithm (GA) [30], and Variable Importance in Projection (VIP) [31] were compared to determine the most effective approach for selecting the relevant spectral variables in the calibration model.The criteria for evaluation included their ability to identify spectral variables with significant contributions to the model's overall predictive performance and consider computational efficiency, including the time taken to identify the variables.The GA settings were configured as double crossover, and the generations, population size, and mutation rate were set to 100, 64, and 0.005, respectively.GA, a biologically inspired technique, initiates with a random population, iteratively evolving new generations by scoring individuals based on fitness, normalizing these scores, selecting parents including elite members, and generating children through mutation or crossover.The current population is then replaced by the children, and this process continues until a stopping criterion is met.GA, resembling natural selection, iteratively refines populations to optimize solutions within defined constraints [32].On the other hand, VIP scores evaluate the importance of each variable in a Partial Least Squares (PLS) model.A variable with a VIP score close to or greater than 1 is considered important, while those with scores significantly below 1 are less crucial and may be discarded [33].

Results and Discussion
An initial PLS model was constructed using the raw data.The initial model was formulated with four latent variables.Preprocessing of the spectral data involved multiple steps to enhance the robustness of the model.These included applying MSC and mean centering (Figure 3) [29].During the development of the calibration model, it was observed that the model's performance was adversely affected by the presence of nine extreme values, particularly those with lower moisture content.These extreme values introduced bias, which compromised the accuracy of the calibration model.To address this issue, samples with less than 50 percent moisture content were excluded from the dataset, and a new model was developed.The choice of 50 percent as the threshold for excluding extreme values was influenced by both the distinctive spectral patterns observed and the significant deviation of these spectra from the majority.Additionally, this threshold aligns with the considerations in prior studies.Zhang et al. [34] highlighted that the normal range of water content in leaves can range from 98% in completely turgid leaves to roughly 30-40% in dying and highly dehydrated ones, depending on the variety and species of the plant.Considering the normal water content of leaves at initial wilting is about 60 to 70 percent, the selected threshold of 50% ensured the exclusion of samples that deviated significantly from the expected moisture content range in basil leaves.
Following the refinement of the dataset, the model development process continued with the comparison of two variable selection methods: GA and VIP.Through this comparison, VIP emerged as the superior method, displaying a better model fit and significantly reduced computational time.The computational time for VIP was 5 s, while GA required 16 min and 22 s to complete the variable selection process.Consequently, the final model was established based on VIP as the variable selection method (Figure 4).The selected areas identified by this algorithm aligned with the spectra of a leaf sample showing a big peak around 1470 nm and a minor peak at 1156 nm (Figure 3).These are ascribed to the stretching mode's -OH first overtone and water bands, respectively [35][36][37].According to Lacaze and Joffre [38], in the near-infrared and short-wave infrared regions, water exhibits four major absorption peaks at approximately 975, 1175, 1450, and 1950 nm.These wavelengths align with the approximated areas identified as significant in our VIP-selected regions and suggest a compelling association between the molecular vibrations of water and the specific spectral features deemed significant in our model.
Horticulturae 2024, 10, 336 6 of 13 greater than 1 is considered important, while those with scores significantly below 1 are less crucial and may be discarded [33].

Results and Discussion
An initial PLS model was constructed using the raw data.The initial model was formulated with four latent variables.Preprocessing of the spectral data involved multiple steps to enhance the robustness of the model.These included applying MSC and mean centering (Figure 3) [29].During the development of the calibration model, it was observed that the model's performance was adversely affected by the presence of nine extreme values, particularly those with lower moisture content.These extreme values introduced bias, which compromised the accuracy of the calibration model.To address this issue, samples with less than 50 percent moisture content were excluded from the dataset, and a new model was developed.The choice of 50 percent as the threshold for excluding extreme values was influenced by both the distinctive spectral patterns observed and the significant deviation of these spectra from the majority.Additionally, this threshold aligns with the considerations in prior studies.Zhang et al. [34] highlighted that the normal range of water content in leaves can range from 98% in completely turgid leaves to roughly 30-40% in dying and highly dehydrated ones, depending on the variety and species of the plant.Considering the normal water content of leaves at initial wilting is about 60 to 70 percent, the selected threshold of 50% ensured the exclusion of samples that deviated significantly from the expected moisture content range in basil leaves.Following the refinement of the dataset, the model development process continued with the comparison of two variable selection methods: GA and VIP.Through this comparison, VIP emerged as the superior method, displaying a better model fit and significantly reduced computational time.The computational time for VIP was 5 s, while GA required 16 min and 22 s to complete the variable selection process.Consequently, the final model was established based on VIP as the variable selection method (Figure 4).The selected areas identified by this algorithm aligned with the spectra of a leaf sample showing a big peak around 1470 nm and a minor peak at 1156 nm (Figure 3).These are ascribed to the stretching mode's -OH first overtone and water bands, respectively [35][36][37].According to Lacaze and Joffre [38], in the near-infrared and short-wave infrared regions, water exhibits four major absorption peaks at approximately 975, 1175, 1450, and 1950 nm.These wavelengths align with the approximated areas identified as significant in our VIP-selected regions and suggest a compelling association between the molecular vibrations of water and the specific spectral features deemed significant in our model.The final calibration model (Figure 5), developed with eight latent variables, exhibited promising performance metrics, including improved distribution of data along the regression line.The model achieved a root mean square error of calibration (RMSEC) of 2.9908, a root mean square error of cross-validation (RMSECV) of 3.2368, and a root mean square error of prediction (RMSEP) of 2.4675.Additionally, the coefficients of determination for calibration (R 2 C) and cross-validation (R 2 CV) were 0.829 and 0.80, respectively, indicating strong consistency.The model's predictive capability was underscored by a coefficient of determination for prediction (R 2 P) of 0.86.The range error ratio (RER) was used to evaluate the model's performance [39].Based on the American Association of Cereal Chemists [40], when RER ≥ 10, the model is acceptable for quality control, and if RER ≥ 15, the model is perfect for research quantification.The RER achieved for this model is 11.045, which indicates a high predictive performance.The final calibration model (Figure 5), developed with eight latent variables, exhibited promising performance metrics, including improved distribution of data along the regression line.The model achieved a root mean square error of calibration (RMSEC) of 2.9908, a root mean square error of cross-validation (RMSECV) of 3.2368, and a root mean square error of prediction (RMSEP) of 2.4675.Additionally, the coefficients of determination for calibration (R 2 C) and cross-validation (R 2 CV) were 0.829 and 0.80, respectively, indicating strong consistency.The model's predictive capability was underscored by a coefficient of determination for prediction (R 2 P) of 0.86.The range error ratio (RER) was used to evaluate the model's performance [39].Based on the American Association of Cereal Chemists [40], when RER ≥ 10, the model is acceptable for quality control, and if RER ≥ 15, the model is perfect for research quantification.The RER achieved for this model is 11.045, which indicates a high predictive performance.A summary of the key performance metrics has been provided in Table 1 to facilitate a clear comparison between the initial and final calibration models.A summary of the key performance metrics has been provided in Table 1 to facilitate a clear comparison between the initial and final calibration models.
The model evolved to encompass seven important latent variables, which increased to eight in the final model after the exclusion of extreme values.An increase in the number of latent variables can indicate a better representation of the underlying data structure [41].However, to avoid overfitting when adding more latent variables, it is essential to review explained variance plots to identify the point at which most of the change occurs.If the quality of the prediction decreases when the number of latent variables increases, this indicates that the model is overfitting the data [41,42].The final model after removing extreme values performed better in terms of error metrics, showing minimal disparities among RMSEC, RMSECV, and RMSEP.This affirms its robust performance both for the observations in the calibration dataset and external samples [43], indicating enhanced predictive accuracy [44].Moreover, while bias metrics measure the deviation of the model's predictions from the actual values for the respective datasets [45], both the model including all samples and the final model show reduced biases compared to the initial model with raw data, indicating a better fit to the data.Notably, no additional outlier detection was performed beyond the removal of extreme values mentioned earlier.The very low values of bias in the final models suggest that the models are well calibrated and do not exhibit any systematic errors in their predictions [46].
These findings collectively highlight the robustness and reliability of the final calibration model in accurately predicting basil moisture content using NIR spectroscopy.This study's results indicate the possibility for extending to other herbs and leafy greens commonly cultivated indoors, which have similar growth conditions and periods.Furthermore, the findings indicate the potential of generalizing to other growing conditions or stages, as similar methodologies have demonstrated success in related studies.For instance, in two parallel studies conducted by Bravo and Johnson [35] on eucalyptus and Ma et al. [47] on mulberry leaves, employing the same handheld NIR sensor, similar results were observed, further reinforcing the validity of the current approach.In addition to the progress made in this study, it is worth considering the exploration of alternative modeling approaches and machine learning such as Artificial Neural Networks (ANNs) in future analyses to enhance the accuracy and predictive capabilities of moisture content determination, which has shown promising results in other studies [3,8,12].The use of ANN, a facet of machine learning known for its ability to model complex relationships and patterns, has demonstrated promising results in various studies across different fields, especially agriculture and plant science [48][49][50][51].Incorporating ANNs into the assessment of moisture content in basil leaves could offer a deeper understanding of the data, enabling the development of models that can accurately predict moisture levels under a wider range of conditions.This approach would leverage the strengths of machine learning to identify subtle patterns and correlations that traditional analytical methods might overlook, thereby enhancing the robustness and reliability of moisture assessments.
Prior research has extensively explored the use of NIR spectroscopy for moisture content analysis in various agricultural products, emphasizing its efficacy in non-destructively gauging water content.However, the application of this technology specifically to basil (Ocimum basilicum L.) within the context of precision agriculture and indoor farming is, to the best of our knowledge, a pioneering approach.In addition, the development of a robust calibration model using a handheld NIR spectrophotometer enhances the practicality and accessibility of moisture content analysis in basil leaves.This advancement not only fills a critical gap in the existing literature, which has predominantly concentrated on leafy vegetables like lettuce or spinach, but also underscores the potential for this technology to improve irrigation management and crop production efficiency, especially in controlled environment agriculture.Real-time, on-site monitoring capabilities have the potential to overcome the limitations of existing methods, which are often not feasible for immediate or precise moisture level assessments.The use of a handheld device for such measurements represents a significant step forward in agricultural practices, offering the possibility for more adaptive and sustainable farming methods tailored to the specific needs of crops at any given time.

Conclusions
The findings of this investigation, utilizing a handheld NIR spectrophotometer, have established the practicality of NIR technology for assessing moisture content in basil leaves within a controlled environment.The non-invasive and rapid determination of moisture content provides a valuable metric for monitoring the hydration levels of basil plants, offering precise insights into irrigation management, refining irrigation strategies, and optimizing crop management in indoor farming settings.As the field of controlled environment agriculture continues to advance, ongoing research efforts will be pivotal in enhancing the accuracy, specificity, and robustness of the calibration model.By doing so, we can anticipate improved methods for tracking and maintaining optimal moisture levels in basil cultivation, contributing to the efficiency and sustainability of indoor farming practices as well as sustaining optimal plant growth and productivity.Moreover, it is worth considering the exploration of alternative modeling approaches and machine learning in future investigations, as these techniques have the potential to further enhance the accuracy and predictive capabilities of moisture content determination in leaves using NIR spectroscopy.Through these efforts, the agricultural sector, especially indoor farming, can look forward to more efficient resource use, improved crop yields, and the advancement of sustainable farming practices that are better aligned with future needs and environmental considerations.

Figure 3 .
Figure 3. (a) Raw spectra of all basil samples.(b) Spectra after applying MSC and SNV preprocessing methods and (c) after removing extreme values.Each color corresponds to individual spectrum.

Figure 3 .
Figure 3. (a) Raw spectra of all basil samples.(b) Spectra after applying MSC and SNV preprocessing methods and (c) after removing extreme values.Each color corresponds to individual spectrum.

Figure 4 .
Figure 4. Variable selection by VIP algorithm for the final model.

Figure 5 .
Figure 5. Parity plot of measured versus predicted moisture content of the validation dataset.

Figure 5 .
Figure 5. Parity plot of measured versus predicted moisture content of the validation dataset.

Table 1 .
Summary of performance metrics of all the models.

Table 1 .
Summary of performance metrics of all the models.