Next Article in Journal
Using a Computer Vision System for Monitoring the Exterior Characteristics of Damaged Apples
Previous Article in Journal
A Digital Twin Framework for Sensor Selection and Microclimate Monitoring in Greenhouses
Previous Article in Special Issue
Automated Physical Feature Extraction of Namdokmai Sithong Mangoes Using YOLOv8 and Image Processing Techniques
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Machine Learning in the Classification of RGB Images of Maize (Zea mays L.) Using Texture Attributes and Different Doses of Nitrogen

by
Thiago Lima da Silva
1,*,
Fernanda de Fátima da Silva Devechio
2,
Marcos Silva Tavares
1,
Jamile Raquel Regazzo
1,
Edson José de Souza Sardinha
3,
Liliane Maria Romualdo Altão
4,
Gabriel Pagin
3,
Adriano Rogério Bruno Tech
5 and
Murilo Mesquita Baesso
3
1
Department of Biosystems Engineering, “Luiz de Queiroz” College of Agriculture (ESALQ), University of São Paulo—USP, Piracicaba 13635-900, SP, Brazil
2
Department of Animal Science, Faculty of Animal Science and Food Engineering (FZEA), University of São Paulo—USP, Pirassununga 13418-900, SP, Brazil
3
Department of Biosystems Engineering, Faculty of Animal Science and Food Engineering (FZEA), University of São Paulo—USP, Pirassununga 13418-900, SP, Brazil
4
Department of Agricultural Engineering, São Francisco University (USF), Bragança Paulista 12916-900, SP, Brazil
5
Department of Basic Sciences, Faculty of Animal Science and Food Engineering (FZEA), University of São Paulo—USP, Pirassununga 13418-900, SP, Brazil
*
Author to whom correspondence should be addressed.
AgriEngineering 2025, 7(10), 317; https://doi.org/10.3390/agriengineering7100317
Submission received: 4 July 2025 / Revised: 15 September 2025 / Accepted: 18 September 2025 / Published: 23 September 2025

Abstract

Nitrogen fertilization is decisive for maize productivity, fertilizer use efficiency, and sustainability, which calls for fast and nondestructive nutritional diagnosis. This study evaluated the classification of maize plant nutritional status from red, green, and blue (RGB) leaf images using texture attributes. A greenhouse experiment was conducted under a completely randomized factorial design with four nitrogen doses, one maize hybrid Pioneer 30F35, and four replicates, at two sampling times corresponding to distinct phenological stages, totaling thirty-two experimental units. Images were processed with the gray-level cooccurrence matrix computed at three distances 1, 3, and 5 pixels and four orientations 0°, 45°, 90°, and 135°, yielding eight texture descriptors that served as inputs to five supervised classifiers: an artificial neural network, a support vector machine, k nearest neighbors, a decision tree, and Naive Bayes. The results indicated that texture descriptors discriminated nitrogen doses with good performance and moderate computational cost, and that homogeneity, dissimilarity, and contrast were the most informative attributes. The artificial neural network showed the most stable performance at both stages, followed by the support vector machine and k nearest neighbors, whereas the decision tree and Naive Bayes were less suitable. Confusion matrices and receiver operating characteristic curves indicated greater separability for omission and excess classes, with D1 standing out, and the patterns were consistent with the chemical analysis. Future work should include field validation, multiple seasons and genotypes, integration with spectral indices and multisensor data, application of model explainability techniques, and assessment of latency and scalability in operational scenarios.

1. Introduction

Maize (Zea mays L.) stands out in Brazil as one of the main agricultural commodities. According to the National Supply Company (CONAB), in the 8th survey of the 2024/2025 season, national production reached 126.9 million tons, representing an increase of 9.9% compared to the previous harvest [1]. Despite this progress, challenges remain regarding the high nutritional demand, the efficient use of nitrogen fertilizers, climate variability, and pest and disease management, which reinforces the need for studies aimed at developing efficient techniques applicable to specific areas of crop management.
Among these areas, mineral nutrition stands out because it acts directly on plant growth [2], improving productivity [3], resistance to stresses [4], and grain quality [5]. However, each nutrient must be supplied accurately, within the crop’s requirements and at the ideal time, preventing the development and reproductive phases from being affected to the point of causing losses in estimated productivity.
To this end, plant nutrition diagnostic procedures need to be introduced with greater efficiency, as conventional analyses for detecting nutritional status are generally destructive in nature, laborious, and require specific equipment and inputs. According to Cheng et al. [6], these analyses are complex and require more time, specialists, and chemical reagents. Therefore, it is of great interest to maximize the crop’s productive expression, and rapid response alternatives such as detection and classification methods in this area need to be studied and developed as they can contribute to the quality and yield of the plant [7].
It is widely accepted in the literature that nitrogen plays a fundamental role in the development of the maize crop. It is an essential macronutrient that affects growth and productivity, and its availability is essential for improving yields [8]. Inadequate amounts of nitrogen compromise chlorophyll production, which consequently results in plants with limited development and a drop in productive performance. Whether too much or too little, uncontrolled application can have a negative impact on both crops and the environment [9].
To help with these challenges, digital image processing is a powerful tool in various agricultural applications, as it can be used to analyze important parameters in crop development, such as the precise monitoring of crop nutrition [10], making use of this method of extracting characteristics a viable alternative for nutritional analysis in plants and consequently helping with decision-making and increasing efficiency in the application of nutrients in crops.
Information related to the appearance, structure, and spatial arrangement of an object within an image is represented by a parameter known as image texture [11]. Texture analysis consists of identifying patterns that assist in the discrimination of the component of interest and has been widely applied for image feature extraction. These patterns can be quantified through several attributes, such as contrast, correlation, energy, homogeneity, dissimilarity, entropy, mean, and variance, which describe the distribution and spatial relationship of gray levels, allowing for a detailed characterization of the analyzed surfaces [12].
During the processing and analysis of images, various characteristics can be extracted to help deepen the information of nutritional interest, especially when these characteristics can be associated with textural patterns. Devechio et al. [13] observed texture extraction resources in maize leaves and concluded that this information contributed to the diagnosis of nutritional deficiencies in the crop.
With the advent of precision and digital agriculture, this image information has been used as input for building machine learning (ML) models, which has been consolidated as a promising strategy, promoting robust and effective interventions in the agricultural sector. Various ML-based algorithms have been widely applied to estimating yields [14], identifying diseases [15] and weeds [16], and finally classifying plant nutritional status [17]. In addition, these algorithms contribute significantly to the sustainable management of resources such as water, fertilizers, and pesticides, which increases the operability of agricultural systems [18].
According to Karakullukcu [19], classification methods use features extracted from data as independent variables to distinguish predefined classes within a dataset. This process involves identifying and extracting relevant information to assign each predictive instance to a specific class, and the suitability of a machine learning model depends directly on the consistency of the processed data and the complexity of the task, factors that impact its performance evaluation. Among the models widely applied in agriculture are artificial neural networks (ANNs), support vector machines (SVMs), decision trees (DTs), the Random Forest (RF) algorithm, regression-based methods, Bayesian classifiers, and the K-Nearest Neighbors (KNN) algorithm, all of which have demonstrated effectiveness in different contexts [20].
Abderrahim et al. [21] used the support vector machine and the artificial neural network to improve nitrogen analysis in tomato leaves and concluded that the use of machine learning algorithms integrated with cheminformatics methods and near-infrared spectroscopy allows for rapid and nondestructive analysis of leaf nitrogen content.
Sirsat et al. [22] investigated the prediction of nutritional deficiencies in wheat plants by means of RGB images of the leaves, using texture attributes extracted from the gray- level cooccurrence matrix (GLCM) to feed different machine learning models. The algorithms evaluated included K-Nearest Neighbors (KNN), Naïve Bayes, decision tree, neural networks, and kernel-based classifiers such as SVM. The best performances were seen with neural networks, followed by KNN and Kernel classifiers. On the other hand, the worst performances were recorded in models based on decision trees and Bayesian algorithms.
In view of the above, the application of machine learning techniques in the classification of agricultural crop images has proved to be effective in analyzing relevant characteristics, contributing to the estimation of nutrient content, as well as promoting greater efficiency, optimization, and savings in production systems. Considering this scenario, the aim of this study was to compare the performance of different Machine Learning algorithms in the supervised classification of nutritional status in different nitrogen dosages in a maize hybrid, using texture descriptors extracted from RGB images as input.

2. Material and Methods

2.1. Study Site

The experiment was carried out at the University of São Paulo, on the campus of the Faculty of Animal Science and Food Engineering (Faculdade de Zootecnia e Engenharia de Alimentos—FZEA/USP), agrarian sector in Pirassununga—SP. The geographical coordinates are 21°59′45″ S, 47°25′33″ W, at an altitude of 627 m, with soil classified as Neossolo Quartzarênico [23]. The region’s climate is of the Cwa type (subtropical, with dry winters and hot summers) according to the Köppen classification, with average annual temperatures of 20.8 °C and average annual rainfall of around 1298 mm.

2.2. Characterization of the Experiment and Image Acquisition

The experiment was carried out with maize (Zea mays L.) in a greenhouse under hydroponic cultivation, using 3.6 L plastic pots filled with nutrient solution and subjected to different nitrogen (N) doses. The treatments were defined as proportions of the recommended nitrogen dose specific to this hybrid, namely D1 = 5%, D2 = 20%, D3 = 100%, and D4 = 200%, corresponding to 1.0, 3.0, 15.0, and 30.0 mM of N in the solution [24].
The experimental design was completely randomized in a factorial scheme with four nutrient doses, one maize hybrid (Pioneer 30F35®), and four replications, evaluated at two collection stages (V4 and R1), totaling 32 experimental units (4 treatments × 4 replications × 2 samplings). Since plant chemical analysis requires destructive sampling, 16 experimental units (4 treatments × 4 replications) were removed at each collection stage.
Leaves were collected for digitizing the images at two phenological stages, V4 (four fully expanded leaves) and R1 (embrowning). According to Ordóñez et al. [25], crop management practices under real conditions include applying nitrogen before the V7 stage. The R1 stage, marked by the start of flowering, is recommended for leaf sampling as it reflects the nutritional state of the plant during the reproductive phase [26].
To contextualize the analyses and standardize terminology throughout the manuscript, Table 1 compiles the phenological stages of maize with a concise description of the vegetative and reproductive phases, from emergence V0 or VE to physiological maturity R6. This systematization guides the sampling performed at V4 and R1.
After removal, the indicator leaves (IFs) were carefully cleaned with paper towels to remove any residue that could compromise the quality of the images. Next, the leaves corresponding to each treatment were placed side by side on the surface of the scanner, covered with a sheet of white sulfite paper. Finally, the images were scanned, identified, and stored for later analysis [24].
The image of the leaves was scanned using a conventional high-resolution flatbed scanner (HP scanjet 3800, Hewlett-Packard Development Company, L.P., Spring, Houston, TX, USA) with up to 9600 DPI (dots per inch). The leaves were scanned at 1200 DPI and stored on the computer in uncompressed TIFF (Tag Image File Format) for later processing.
The leaf samples were subjected to wet digestion using sulfuric acid to determine nitrogen and quantified using ammonia distillation followed by titration. The chemical analyses took place at the Agricultural Sciences Laboratory of the School of Animal Science and Food Engineering at the University of São Paulo (Laboratório de Ciências Agrárias da Faculdade de Zootecnia e Engenharia de Alimentos da Universidade de São Paulo), located on the Pirassununga campus in São Paulo.

2.3. Image Pre-Processing

Image pre-processing followed the methodology adapted from Lencioni et al. [28]. The images obtained from the experiment were cropped using Matlab R2022b software [29] to automatically extract blocks of size 224 × 224 RGB pixels in order to obtain images that would allow the ideal visualization of the nutritional state in the leaves (transitions) without interference from casualties (injuries and folds), as shown in Figure 1.

2.4. Texture Analysis

Texture descriptor extraction analyses were processed at the Laboratory of Machinery and Precision Agriculture (Laboratório de Máquinas e Agricultura de Precisão—LAMAP) of the Department of Biosystems Engineering (Departamento de Engenharia de Biossistemas-FZEA/USP).
The methodology is according to Lu et al. [30] where a gray-level cooccurrence matrix (GLCM) was generated according to Haralick & Dinstein et al. [31]. The GLMC is a matrix P (i, j) that counts the frequency with which a pixel with intensity i occurs adjacent to a pixel with intensity j, given a distance d and an angle θ. A specific script was used in Matlab R2022b software [29] to generate the GLMC using the graycomatrix function and normalized by graycoprops, thus extracting 8 texture features at 4 different angles, 0°, 45°, 90°, and 135°, with distances of 1, 3, and 5 pixels from the reference pixel.
There are several examples of applying GLCM in different studies, such as segmentation and detection of regions of interest through local maps of contrast and homogeneity [32]; estimation of orientation and anisotropy by comparing directions of 0°, 45°, 90°, and 135° [33]; screening image quality by identifying blur and low signal [34]; performing inspection and defect detection on leaves and surfaces [35]; assisting image retrieval and registration with cooccurrence-based similarity measures [36]; and selecting samples by discarding atypical patches before training, which strengthens the workflow and reduces bias [37].
The textural features extracted from the gray-level cooccurrence matrix (GLCM) were contrast, correlation, energy, homogeneity, dissimilarity, entropy, mean, and variance. For this purpose, image blocks of 224 × 224 pixels were obtained from different regions of the leaf surface, as described by Zheng et al. [38]. The calculation of these metrics was implemented in a MATLAB script, following the equations presented by several authors [31,39,40].
Contrast group:
c o n t r a s t = i , j = 0 N 1 P i , j i j 2
D i s s i m i l a r i t y = i , j = 0 N 1 P i , j | i j |
H o m o g e n e i t y = i , j = 0 N 1 P i , j 1 + ( i j ) 2
Order group:
E n e r g y = P i j 2
E n t r o p i a = i , j = 0 N 1 P i , j [ l n ( P i , j ) ]   w h e r e   0     l n ( 0 ) = 0
Descriptive statistics group:
M e a n   ( µ ) = i , j = 0 N 1 i ( P i , j )
V a r i a n c e   ( σ 2 ) = i , j = 0 N 1 P i , j i µ 2
C o r r e l a t i o n = i , j = 0 N 1 P i , j ( i µ ) ( j µ ) σ 2

2.5. Classification

The supervised classification process used the machine learning method available in MatLab 2022b software with the Classification Learner application found in the statistical and machine learning toolbox12.4 package, using the nearest neighbors (KNN), support vector machines (SVMs), artificial neural network (ANN), decision trees (DTs), and naive Bayes (NB) algorithms.
KNN is an algorithm classified as lazy, where classification is based on the Euclidean distances between the reference sample and its nearest neighbors. SVM, on the other hand, classifies using hyperplanes and the distances between the samples and their traces, while neural networks characterize regions or values by determining a network of weights, which, depending on their significance during the processing iterations, can be recalculated. Decision trees are supervised learning models that divide the data into increasingly homogeneous subsets based on decision rules, requiring pruning to avoid overfitting, while naive Bayes is a probabilistic classifier based on Bayes’ theorem, assuming that the attributes are independent of each other, performing poorly on highly correlated data, which may have been the case in this study.
Machine learning is an area of artificial intelligence that uses large numbers of data to create reliable models to solve proposed problems quickly and efficiently, for this study the algorithms for classification were provided with texture information, 8 attributes, 4 angles, and 3 reference steps in 4 classes with 1000 blocks of 224 × 244 pixels each, totaling 384,000 input datapoints for all the models.
The validation method used was k-fold cross-validation of 10, with a test set of 10% of the image bank being reserved to assess the model’s performance after adjustment and training.
Following sample preparation (preprocessing), textural features were extracted from the images and used as input for model construction. Hyperparameter selection was carried out using the Grid Search optimizer across all algorithms. Subsequently, the models were applied to supervised classification, and their performances were systematically compared, as illustrated in Figure 2.
The Grid Search optimization technique was used to determine the hyperparameter combinations, aiming for the best possible performance of the algorithms in the validation set, considering the lowest classification error during the iterations. Thus, the models were configured with the hyperparameters described in Table 2.
The performance metrics for the machine learning algorithms were accuracy, total cost, F1-score, precision, sensitivity, prediction speed, and training time.
The accuracy, precision, F1-score, and sensitivity metrics are based on statistical calculations that take into account the way in which the instances are classified—which can be true positive (VP), which represents the number of instances correctly classified as positive; true negative (VN), correctly classified as negative; false positive (FP) referring to the number of instances incorrectly classified as positive when they are negative; and false negative (FN), indicating those incorrectly classified as negative when they are positive—according to Equations (9)–(12) and their descriptions [17].
A c c u r a c y = V P + V N V P + V N + F P + F N
P r e c i s i o n = V P V P + F P
S e n s i b i l i t y = V P V P + F N
F 1   s c o r e = 2 × P r e c × R e c a l l P r e c + R e c a l l
The total cost is a metric for evaluating the algorithm’s performance that takes into account the error or loss in classification. Based on the confusion matrix, this metric includes misclassification costs, i.e., the number of times the model made a mistake in predicting the class of a given sample; it is presented in dimensionless form and is calculated according to Equation (13).
T o t a l   c o s t = 1 N i = 1 N C o s t ( y i , y ^ i )
where
N = total number of samples;
y i = True class;
y ^ i = Predicted class.
As the basis for calculating the total cost was the confusion matrix and not the cost matrix, it was assumed that
C o s t ( y i , y ^ i ) = 0 ,   i f   y i = y ^ i 1 ,   i f   y i y ^ i
Prediction speed was used to calculate the number of predictions per second for each model; this metric is important to compare the latency of the models when receiving input data and returning classification answers for real-time application.
Training time was used to verify the time each model takes to be ready. It is an empirical measure that uses the timing function during the model adjustment procedure, considering the data provided, training, validation, and testing.
Another metric used was the Area Under the Curve (AUC), which refers to the area under the ROC (receiver operating characteristic) curve, capable of measuring the algorithm’s performance in terms of distinguishing between classes [42]. ROC graphs are two-dimensional representations where the true positive rate (TP) appears on the vertical axis, while the false positive rate (FP) is shown on the horizontal axis. This type of graph illustrates the balance between the model’s hits and misses and is considered standard in the field of image classification [43].
The ReliefF algorithm was applied to identify the attributes that contributed most to building the models.
Finally, the confusion matrix was generated to evaluate the algorithm’s performance in detail, as it compares the labels predicted by the model with the actual values. Among the elements present in the matrix are true positives (VPs), true negatives (VNs), false positives (FPs), and false negatives (FNs), which help to identify the types of hits and misses made between the classes.
All work was conducted using a dedicated NVIDIA GeForce RTX 3050 6GB Graphics Processing Unit (GPU) and a 13th Gen Intel® Core™ i5-13450HX processor (16 GB CPUs), ~2.4 GHz.

3. Results

3.1. Chemical Analysis

The nitrogen concentration measured in the diagnostic (indicator) leaf (IL) at the vegetative (V4) and reproductive (R1) phenological stages is presented in Figure 3.
Marked differences in the nitrogen concentration of the diagnostic leaf at the two evaluated stages yielded sufficient separability to define distinct classes and to compare algorithm performance. At both V4 and R1, the nonomission treatments showed higher diagnostic leaf nitrogen concentrations than the lower-N treatments.

3.2. ReliefF Feature Ranking

ReliefF identified the texture features, homogeneity, dissimilarity, and contrast as the most influential contributors to constructing the classification models, as shown in Figure 4.

3.3. Algorithm Performance

Table 3 presents the performance metrics for each classifier at the V4 and R1 phenological stages.
Accuracy values for the support vector machine (SVM) and artificial neural network (ANN) at V4, and for SVM, ANN, and k-nearest neighbors (KNN) at R1, were considered good, falling in the 80–89% range. The ANN achieved accuracy above 80% at both stages (80.7% and 86.5%), indicating stable performance for the problem addressed. In Table 2, the total cost values for ANN and SVM were lower than those of the other models at both stages. Additional metrics (F1-score, precision, and sensitivity) were also computed to assess performance. In this case, F1-score, precision, and sensitivity were satisfactory for ANN, SVM, and KNN at both stages, whereas the decision tree and naive Bayes classifiers yielded lower values, indicating poorer performance for this type of experiment.
Naive Bayes (NB) and k-nearest neighbors (KNN) exhibited lower prediction speeds, whereas the support vector machine (SVM) and the artificial neural network (ANN) showed higher training times, factors that are critical when selecting acceptable latency in scenarios requiring real-time responses. Both SVM and ANN perform well on complex, nonlinear data; however, this typically comes at the cost of longer training and greater computational demand during model fitting. In contrast, compared with ANN, SVM generally entails lower computational complexity, enabling faster and more efficient model construction, particularly for datasets of moderate size.

3.4. Confusion Matrix and ROC Curves

Figure 5 and Figure 6 graphically present the confusion matrices for the V4 and R1 stages, respectively. Figure 7 and Figure 8 show the ROC curves for the naive Bayes, decision tree, k-nearest neighbors (KNN), support vector machine (SVM) and artificial neural network (ANN) models at V4 and R1, respectively.
In Figure 5, across all test confusion matrices, the classes corresponding to nitrogen omission and excess treatments (D1, D2, and D4) achieved the highest numbers of correct classifications. The ROC curves in Figure 6 corroborate the confusion matrix findings for stage V4, the class with full nitrogen omission (D1) contributed most to correct classifications. This class exhibited higher true positive rates across all algorithms and lower false positive rates for KNN, SVM, and ANN. Overall, all algorithms showed high sensitivity for detecting images with nitrogen deficiency; however, the naive Bayes (NB) and decision tree (DT) models yielded lower precision.
In Figure 7, the confusion matrices for the R1 phenological stage show increased correct predictions for classes D1, D2, and D3 compared with V4, with D1 standing out as the best-performing class across models. By contrast, the excess nitrogen class (D4) exhibited the highest misclassification rates, except for the artificial neural network (ANN), which achieved superior performance for this group. Consequently, ANN was the only model to improve D4 classification at R1, likely due to its ability to capture complex, nonlinear patterns under substantial interclass overlap and subtle within class variation.
In Figure 8, the ROC curve obtained by the SVM model exhibited behavior similar to that of the artificial neural network (ANN), but with higher true positive rates for most classes, except for the excess nitrogen class (D4). The ANN, in turn, achieved better performance for class D1 at R1, possibly due to placing greater emphasis on texture features associated with low nitrogen doses a pattern also observed for the naive Bayes, decision tree, and k-nearest neighbors (KNN) models. Overall, at the R1 phenological stage, the machine learning algorithms displayed greater stability and higher classification accuracy across the nitrogen classes. The omission classes (D1 and D2) showed greater consistency during modeling, which may be associated with the more evident expression of nitrogen-deficiency symptoms, thereby facilitating discrimination by the algorithms.

4. Discussion

Differences observed in the chemical analysis shown in Figure 3 suggest the emergence of patterns suitable for image processing, particularly by enabling the grouping of treatments into distinct classes, which supports the development of classification models based on texture features and machine learning. Texture attributes such as homogeneity, contrast, and dissimilarity extracted from the gray-level cooccurrence matrix (GLCM) are widely used to assess leaf nitrogen status [44,45]. Nitrogen deficiency can affect leaf structural development, especially the organization of primary and secondary venation, making these attributes particularly informative when evaluating maize plants across two phenological stages under insufficient doses, notably in class D1.
Image patches display regions with parallel venation typical of monocots, which may have facilitated the capture of this pattern and contributed to algorithm performance, especially for attributes from the contrast group, namely homogeneity, contrast, and dissimilarity, as confirmed by ReliefF in Figure 4. According to Perico et al. [46], leaf venation patterns begin with the differentiation of procambial initial cells arising from the ground meristem during leaf development. Those authors investigated the regulators involved in venation pattern formation in maize leaves and concluded that distinct combinations of transporters responsible for auxin flux are activated in a coordinated manner throughout leaf specification and vein differentiation.
Insufficient nitrogen can influence auxin flux, leading to changes in leaf venation patterns. Wang et al. [47] investigated an auxin transporter in maize under low nitrogen conditions and found that plants overexpressing ZmPIN1a showed a pronounced response to inhibition of auxin transport by NPA (an auxin transport inhibitor), underscoring the functional relevance of this gene in modulating adaptive responses to nitrogen supply. This supports the view that low nitrogen availability can alter venation patterns in maize leaves. In related work, Jiang et al. [48] reported that enhancing auxin synthesis promotes nitrogen metabolism and suggested that exogenous auxin application may optimize nitrogen uptake and assimilation in maize.
Among the performance metrics, accuracy showed consistent values; however, other metrics were also considered in conjunction. As noted by Thölke et al. [49], accuracy can appear high simply by favoring the majority class in scenarios of class imbalance, without reflecting the classifier’s true ability to identify the minority class. This issue did not arise in the present study, since all classes were carefully balanced with 1000 images each.
The shallow neural network used here consists of a single hidden layer between the input and output layers. The model was implemented in MATLAB using the patternnet function configured with 10 hidden neurons, with weights and biases randomly initialized during training, and employing a ReLU activation function. This configuration of fully connected layers is well suited to recognizing complex patterns, which may have contributed to the strong performance observed in this study.
Wen et al. [50] reported accuracies above 90% using artificial neural networks to recognize thermal behavior of reactions in isoperibolic semibatch reactors, and concluded that the trained artificial neural network was ideal due to low time complexity and high effectiveness, comparing it with naive Bayes, support vector machine, and k nearest neighbors, the same algorithms evaluated in this study.
Adjustments to artificial neural network hyperparameters, such as the number of hidden layers, the learning rate, and the activation function during optimization, can help reduce total cost. Moreover, neural networks are effective at capturing complex and nonlinear patterns in high-dimensional datasets [51], such as images, so they often achieve superior performance when many interrelated features are present, for example, the texture attributes used here, which is consistent with the lower total cost and with the reductions in errors and overfitting observed in this study.
Cost-sensitive approaches in machine learning can employ hyperplane shifting techniques, modifications to the sample space, or increases in spatial resolution. According to Castro and Braga [52], with the standard backpropagation algorithm, convergence speed can be impaired in studies with imbalanced classes, which requires changes to the original cost function. This issue did not arise in the present study because the classes were balanced during preprocessing.
The properties of the support vector machine and the neural network likely contributed to assigning instances to distinct nitrogen classes, due to similar patterns in texture values regardless of direction and to the filters applied to characterize these data, which together help explain the superior results obtained by these algorithms at both V4 and R1.
These results are consistent with Meza et al. [53]. In the study “Comparative Analysis of the Implementation of Support Vector Machines and Long Short Term Memory Artificial Neural Networks”, the authors report that support vector machines and artificial neural networks show a strong ability to capture complex nonlinear patterns in data. However, the artificial neural network has a more sophisticated architecture and a large number of parameters, and requires longer training time and greater computational resources.
Regarding the Receiver Operating Characteristic curve, Castro and Braga [52] state that it reflects classification errors in terms of the probability of correctly detecting the class versus the fraction of examples incorrectly classified, which is known as the sensitivity–specificity trade-off. The D1 treatment class may display more pronounced and clearer signs of nitrogen deficiency, which contributes to higher rates of correct classification, as evidenced in Figure 6 and Figure 8. This behavior agrees with recent observations by Shu et al. [54], who showed that the absence of nitrogen produces more evident foliar symptoms, facilitating detection by hyperspectral imaging combined with machine learning algorithms.
An imbalance in nitrogen supply may have induced patterns in the arrangement of foliar structures, which were captured by the gray-level cooccurrence matrix primarily through variability in pixel intensity along the leaf blade, yielding higher values for texture groups such as homogeneity, dissimilarity, and contrast, as highlighted by the ReliefF test. In addition, the higher accuracies observed for the omission classes D1 and D2 and for the excess class D4 may be related to scalar pixel intensity expressed by leaf characteristics under these conditions, such as chlorosis and a very dark green color, which after conversion to grayscale is registered in pixel tone. This behavior is consistent with recent studies; for example, Zhang et al. [44], which showed that gray level cooccurrence texture features including contrast, homogeneity, and dissimilarity, when combined with spectral indices, are strongly correlated with nitrogen content in wheat.
The unsatisfactory performance of the naive Bayes algorithm in the classification task using image-derived features can be largely attributed to its fundamental assumption of independence among input variables. This assumption is inadequate when features are correlated, as often occurs between tonalities and texture patterns obtained from the gray-level cooccurrence matrix. In this regard, Chen et al. [55] introduced a correlation factor to adapt naive Bayes to settings where features are not independent, and showed that this modification can improve classifier performance. In addition, in the present study, we used the box kernel as the smoothing hyperparameter, which means the model did not adopt a specific parametric form such as the Gaussian distribution for continuous features.
By contrast, the decision tree algorithm is prone to overfitting, especially in scenarios with noise and irrelevant features, which compromises generalization. Moreover, its sequential one-variable-at-a-time splitting mechanism tends to capture complex interactions among features, such as color and texture patterns in maize leaf images, less effectively. Recent approaches, such as that by Azad, Nehal, and Moshkov [56], mitigate these limitations by combining multiple trees through majority voting, which increases robustness and accuracy, and by integrating models into cloud platforms with real-time data, which supports performance and scalability in precision agriculture [57].
As noted by Cheng et al. [58], the relationship between leaf nitrogen content and image-derived characteristics varies with the phenological stage. Around flowering, at VT and R1, and especially at the onset of grain filling, the physiological demand for nitrogen is directed to reproductive structures, with nitrogen remobilized from leaves to ears and grains. As a result, leaves tend to show lower nitrogen contrast among treatments, in part due to chlorophyll decline, which can reduce differences in texture attributes among classes and hinder discrimination by conventional algorithms.

5. Conclusions

This study demonstrated that texture attributes extracted by the gray-level cooccurrence matrix are effective for discriminating maize leaves subjected to different nitrogen doses, enabling the construction of classification models with good performance and moderate computational cost. Feature selection indicated homogeneity, dissimilarity, and contrast as the most informative descriptors, aligning texture behavior with anatomical and physiological patterns associated with nutritional status.
Among the evaluated algorithms, the artificial neural network showed the most stable performance across the two phenological stages, followed by support vector machine and k nearest neighbors, whereas decision tree and naive Bayes were less suitable for this task. Confusion matrix and receiver operating characteristic analyses highlighted greater separability for the omission and excess nitrogen classes, with D1 standing out, while D4 was more challenging in some scenarios, except for the neural network. Differences observed in the chemical analysis corroborated class separability and supported the results obtained with computer vision.
The findings also indicate an influence of phenological stage on discriminability, especially in later phases such as R1, because the redistribution of nitrogen to reproductive structures tended to increase the power of discrimination when using texture attributes alone, enabling the models to maintain accuracy levels suitable for screening and decision support applications.
As a practical implication, the proposed approach has the potential to be integrated into precision agriculture workflows, contributing to the diagnosis of nitrogen status and supporting management decisions, including variable-rate dose recommendations. As limitations, it is important to highlight the use of leaf images under controlled conditions and the reliance on texture attributes derived from RGB images. Future studies should consider the inclusion of deep learning networks, field validations, multiple growing seasons and genotypes, integration with spectral indices, multisensor data, edge detection, and the use of UAV-acquired RGB images, as well as the assessment of latency and scalability in operational scenarios.

Author Contributions

Conceptualization, T.L.d.S., M.M.B. and F.d.F.d.S.D.; methodology, T.L.d.S., M.M.B. and A.R.B.T.; software, E.J.d.S.S.; validation, T.L.d.S., M.M.B. and A.R.B.T.; formal analysis, T.L.d.S.; investigation, T.L.d.S. and F.d.F.d.S.D.; resources, F.d.F.d.S.D., L.M.R.A. and T.L.d.S.; data curation, M.S.T., J.R.R., G.P., E.J.d.S.S. and A.R.B.T.; writing—original draft preparation, T.L.d.S., J.R.R., M.S.T. and M.M.B.; writing—review and editing, L.M.R.A., F.d.F.d.S.D., A.R.B.T. and M.M.B.; visualization, M.M.B.; supervision, A.R.B.T. and M.M.B.; project administration, M.M.B. and F.d.F.d.S.D.; funding acquisition, L.M.R.A., F.d.F.d.S.D. and M.M.B. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The original contributions presented in this study are included in the article. Further inquiries can be directed to the corresponding author(s).

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Conab–Companhia Nacional de Abastecimento. Acompanhamento da Safra Brasileira de Grãos, Brasília, DF, v. 12, Safra 2024/25, n. 8, Maio 2025. Available online: https://www.gov.br/conab/pt-br/atuacao/informacoes-agropecuarias/safras/safra-de-graos/boletim-da-safra-de-graos/8o-levantamento-safra-2024-25/boletim-da-safra-de-graos (accessed on 20 June 2025).
  2. Anas, M.; Liao, F.; Verma, K.K.; Sarwar, M.A.; Mahmood, A.; Chen, Z.-L.; Li, Q.; Zeng, X.-P.; Liu, Y.; Li, Y.-R. Fate of nitrogen in agriculture and environment: Agronomic, eco-physiological and molecular approaches to improve nitrogen use efficiency. Biol. Res. 2020, 53, 47. [Google Scholar] [CrossRef]
  3. Theerawitaya, C.; Supaibulwatana, K.; Tisarum, R.; Samphumphuang, T.; Chungloo, D.; Singh, H.P.; Cha-Um, S. Expression levels of nitrogen assimilation-related genes, physiological responses, and morphological adaptations of three indica rice (Oryza sativa L. ssp. indica) genotypes subjected to nitrogen starvation conditions. Protoplasma 2023, 260, 691–705. [Google Scholar] [CrossRef]
  4. Lv, X.; Zhang, Q.; He, J.; Yang, Y.; Xia, Z.; Gong, Y.; Liu, J.; Lu, H. Effects of exogenous melatonin on growth and photosynthesis of maize (Zea mays L.) seedlings under low nitrogen stress. Plant Physiol. Biochem. 2025, 223, 109810. [Google Scholar] [CrossRef]
  5. Jiang, N.; Zou, T.; Huang, H.; Li, C.; Xia, Y.; Yang, L. Auxin synthesis promotes N metabolism and optimizes root structure enhancing N acquirement in maize (Zea mays L.). Planta 2024, 259, 46. [Google Scholar] [CrossRef]
  6. Cheng, W.; Sun, D.-W.; Pu, H.; Wei, Q. Chemical spoilage extent traceability of two kinds of processed pork meats using one multispectral system developed by hyperspectral imaging combined with effective variable selection methods. Food Chem. 2017, 221, 1989–1996. [Google Scholar] [CrossRef]
  7. Liu, Y.; Pu, H.; Sun, D.-W. Efficient extraction of deep image features using convolutional neural network (CNN) for applications in detecting and analysing complex food matrices. Trends Food Sci. Technol. 2021, 113, 193–204. [Google Scholar] [CrossRef]
  8. Xie, K.; Ren, Y.; Chen, A.; Yang, C.; Zheng, Q.; Chen, J.; Wang, D.; Li, Y.; Hu, S.; Xu, G. Plant nitrogen nutrition: The roles of arbuscular mycorrhizal fungi. J. Plant Physiol. 2022, 269, 153591. [Google Scholar] [CrossRef] [PubMed]
  9. Yang, M.-D.; Hsu, Y.-C.; Chen, Y.-H.; Yang, C.-Y.; Li, K.-Y. Precision monitoring of rice nitrogen fertilizer levels based on machine learning and UAV multispectral imagery. Comput. Electron. Agric. 2025, 237, 110523. [Google Scholar] [CrossRef]
  10. Farhood, H.; Bakhshayeshi, I.; Pooshideh, M.; Rezvani, N.; Beheshti, A. Chapter 7-Recent adanvances of image processing techniques in agriculture. In Cognitive Data Science in Sustainable Computing, Artificial Intelligence and Data Science in Environmental Sensing; Asadnia, M., Razmjou, A., Eds.; Academic Press: London, UK, 2022; pp. 129–153. [Google Scholar] [CrossRef]
  11. Castellano, G.; Bonilha, L.; Li, L.M.; Cendes, F. Texture analysis of medical images. Clin. Radiol. 2004, 59, 1061–1069. [Google Scholar] [CrossRef]
  12. Teng, J.; Zhang, D.; Lee, D.-J.; Chou, Y. Recognition of Chinese food using convolutional neural network. Multimed. Tools Appl. 2019, 78, 11155–11172. [Google Scholar] [CrossRef]
  13. Devechio, F.D.F.D.S.; Luz, P.H.D.C.; Romualdo, L.M.; Herling, V.R. Sufficiency range and response of maize hybrids subjected to potassium doses in nutrient solution. In Proceedings of the Stepping Forward to Global Nutrient Use Efficiency, 19th International Plant Nutrition Colloquium (IPNC), Iguassu Falls, State of Paraná, Brazil, 22–27 August 2022; São Paulo State University (UNESP): São Paulo State, Brazil, 2022. ISBN 978-65-85111-01-0. [Google Scholar]
  14. Tavares, M.S.; Silva, C.A.A.C.; Regazzo, J.R.; Sardinha, E.J.d.S.; da Silva, T.L.; Fiorio, P.R.; Baesso, M.M. Performance of Machine Learning Models in Predicting Common Bean (Phaseolus vulgaris L.) Crop Nitrogen Using NIR Spectroscopy. Agronomy 2024, 14, 1634. [Google Scholar] [CrossRef]
  15. Dinesh, A.; Balakannan, S.P.; Maragatharajan, M. A novel method for predicting plant leaf disease based on machine learning and deep learning techniques. Eng. Appl. Artif. Intell. 2025, 155, 111071. [Google Scholar] [CrossRef]
  16. Patel, J.; Patel, J.; Kapdi, R.; Patel, Y. Weed Recognition in Brinjal Crop using Deep Learning. Procedia Comput. Sci. 2025, 259, 2014–2024. [Google Scholar] [CrossRef]
  17. Regazzo, J.R.; Silva, T.L.D.; Tavares, M.S.; Sardinha, E.J.D.S.; Figueiredo, C.G.; Couto, J.L.; Gomes, T.M.; Tech, A.R.B.; Baesso, M.M. Desempenho de Redes Neurais na Predição da Nutrição Nitrogenada em Plantas de Morango. AgriEngineering 2024, 6, 1760–1770. [Google Scholar] [CrossRef]
  18. Singh, K.; Yadav, M.; Barak, D.; Bansal, S.; Moreira, F. Machine-Learning-Based Frameworks for Reliable and Sustainable Crop Forecasting. Sustainability 2025, 17, 4711. [Google Scholar] [CrossRef]
  19. Karakullukcu, E. Leveraging convolutional neural networks for image-based classification of feature matrix data. Expert Syst. Appl. 2025, 281, 127625. [Google Scholar] [CrossRef]
  20. Pineda, J.M. Modelos predictivos en salud basados en aprendizaje de maquina (machine learning). Rev. Médica Clínica Las Condes 2022, 33, 583–590. [Google Scholar] [CrossRef]
  21. Abderrahim, D.; Taoufiq, S.; Bouchaib, I.; Rabie, R. Enhancing tomato leaf nitrogen analysis through portable NIR spectrometers combined with machine learning and chemometrics. Chemom. Intell. Lab. Syst. 2023, 240, 104925. [Google Scholar] [CrossRef]
  22. Sirsat, M.S.; Isla-Cernadas, D.; Cernadas, E.; Fernández-Delgado, M. Machine and deep learning for the prediction of nutrient deficiency in wheat leaf images. Knowl.-Based Syst. 2025, 317, 113400. [Google Scholar] [CrossRef]
  23. Santos, H.G.D.; Jacomine, P.K.T.; Anjos, L.H.C.D.; Oliveira, V.A.D.; Lumbreras, J.F.; Coelho, M.R.; Almeida, J.A.D.; Araujo Filho, J.C.D.; Oliveira, J.B.D.; Cunha, T.J.F. Sistema Brasileiro de Classificação de Solos. 5° ed., rev. e ampl. Brasília, DF: Embrapa, 2018. Available online: http://livimagens.sct.embrapa.br/amostras/00053080.pdf (accessed on 20 June 2025).
  24. Silva, F.F.d. Reconhecimento de Padrões de Nutrição Para Nitrogênio e Potássio em Híbridos de Milho por Análise de Imagens Digitais; Tese (Doutorado)—Faculdade de Zootecnia e Engenharia de Alimentos, Universidade de São Paulo: Pirassununga, Brazil, 2015. [Google Scholar]
  25. Ordóñez, R.A.; Olmedo-Pico, L.; Ferela, A.; Trifunovic, S.; Eudy, D.; Archontoulis, S.; Vyn, T.J. Modern maize hybrids have increased grain yield and efficiency tolerances to nitrogen-limited conditions. Eur. J. Agron. 2025, 168, 127621. [Google Scholar] [CrossRef]
  26. Song, G.; Lu, Y.; Wang, Y.; Nie, C.; Xu, M.; Wang, L.; Bai, Y. Analysis of metabolic differences in maize in different growth stages under nitrogen stress based on UPLC-QTOF-MS. Front. Plant Sci. 2023, 14, 1141232. [Google Scholar] [CrossRef]
  27. Fancelli, A.L. Plantas Alimentícias: Guia Para Aulas, Estudo e Discussão; Centro Acadêmico “Luiz de Queiroz”, ESALQ/USP: Piracicaba, Brazil, 1986; p. 131. [Google Scholar]
  28. Lencioni, G.C.; Sousa, R.V.; Sardinha, E.J.S.; Corrêa, R.R.; Zanella, A.J. Pain assessment in horses using automatic facial expression recognition through deep learning-based modeling. PLoS ONE 2021, 16, e0258672. [Google Scholar] [CrossRef]
  29. MATLAB; R2022b; MathWorks Inc.: Natick, MA, USA, 2022.
  30. Lu, J.; Eitel, J.U.H.; Engels, M.; Zhu, J.; Ma, Y.; Liao, F.; Zheng, H.; Wang, X.; Yao, X.; Cheng, T.; et al. Improving Unmanned Aerial Vehicle (UAV) remote sensing of rice plant potassium accumulation by fusing spectral and textural information. Int. J. Appl. Earth Obs. Geoinf. 2021, 104, 102592. [Google Scholar] [CrossRef]
  31. Haralick, R.M.; Shanmugam, K.; Dinstein, I. Textural features for image classification. IEEE Trans. Syst. Man Cybern. 1973, 6, 610–621. [Google Scholar] [CrossRef]
  32. Zeitoune, A.A.; Erbes, L.A.; Casco, V.H.; Adur, J.F. Improvement of co-occurrence matrix calculation and collagen fibers orientation estimation. Proceedings of SPIE 2017, 10160, 101601B. In Proceedings of the 12th International Symposium on Medical Information Processing and Analysis, Tandil, Argentina, 5–7 December 2016. [Google Scholar] [CrossRef]
  33. Barburiceanu, S.; Terebes, R.; Meza, S. 3D Texture Feature Extraction and Classification Using GLCM and LBP-Based Descriptors. Appl. Sci. 2021, 11, 2332. [Google Scholar] [CrossRef]
  34. Mukherjee, A.; Gaurav, K.; Verma, A.; Kumar, H.; Thakur, R. Content Based Image Retrieval using GLCM. Int. J. Innov. Res. Comput. Commun. Eng. 2016, 4, 20142–20149. Available online: https://teams.microsoft.com/l/message/19:565a7e33-2568-466a-a333-b8886c2dd88d_9ede494f-50c3-47a7-ba55-44fb41fae952@unq.gbl.spaces/1758679716129?context=%7B%22contextType%22%3A%22chat%22%7D (accessed on 20 June 2025).
  35. Wen, X.; Shan, J.; He, Y.; Song, K. Steel Surface Defect Recognition: A Survey. Coatings 2023, 13, 17. [Google Scholar] [CrossRef]
  36. Subramanian, M.; Lingamuthu, V.; Venkatesan, C.; Perumal, S. Content-Based Image Retrieval Using Colour, Gray, Advanced Texture, Shape Features, and Random Forest Classifier with Optimized Particle Swarm Optimization. Int. J. Biomed. Imaging 2022, 2022, 3211793. [Google Scholar] [CrossRef]
  37. Kabir, M.; Unal, F.; Akinci, T.C.; Martinez-Morales, A.A.; Ekici, S. Revealing GLCM Metric Variations across a Plant Disease Dataset: A Comprehensive Examination and Future Prospects for Enhanced Deep Learning Applications. Electronics 2024, 13, 2299. [Google Scholar] [CrossRef]
  38. Zheng, H.; Cheng, T.; Zhou, M.; Li, D.; Yao, X.; Tian, Y.; Cao, W.; Zhu, Y. Improved estimation of rice aboveground biomass combining textural and spectral analysis of UAV imagery. Precis. Agric. 2019, 20, 611–629. [Google Scholar] [CrossRef]
  39. Nyasulu, C.; Diattara, A.; Traore, A.; Ba, C.; Diedhiou, P.M.; Sy, Y.; Raki, H.; Peluffo-Ordóñez, D.H. A comparative study of Machine Learning-based classification of Tomato fungal diseases: Application of GLCM texture features. Heliyon 2023, 9, e21697. [Google Scholar] [CrossRef] [PubMed]
  40. Alexander, I. Zenodo, Version v0.5; GLCMTextures: GLCM Textures of Raster Layers; 2025. [CrossRef]
  41. Khojastehnazhand, M.; Roostaei, M. Classification of seven Iranian wheat varieties using texture features. Expert Syst. Appl. 2022, 199, 117014. [Google Scholar] [CrossRef]
  42. Fawcett, T. An introduction to ROC analysis. Pattern Recognit. Lett. 2006, 27, 861–874. [Google Scholar] [CrossRef]
  43. Nawaz, M.; Nazir, T.; Javed, A.; Amin, S.T.; Jeribi, F.; Tahir, A. CoffeeNet: A deep learning approach for coffee plant leaves diseases recognition. Expert Syst. Appl. 2024, 237, 121481. [Google Scholar] [CrossRef]
  44. Zhang, L.; Song, X.; Niu, Y.; Zhang, H.; Wang, A.; Zhu, Y.; Zhu, X.; Chen, L.; Zhu, Q. Estimation of nitrogen content in winter wheat plants by combining spectral and textural characteristics based on a low-cost RGB system with drones throughout the growing season. Agriculture 2024, 14, 456. [Google Scholar] [CrossRef]
  45. Wu, L.; Gong, Y.; Bai, X.; Wang, W.; Wang, Z. Nondestructive Determination of Leaf Nitrogen Content in Corn by Hyperspectral Imaging Using Spectral and Texture Fusion. Appl. Sci. 2023, 13, 1910. [Google Scholar] [CrossRef]
  46. Perico, C.; Zaidem, M.; Sedelnikova, O.; Bhattacharya, S.; Korfhage, C.; Langdale, J.A. Multiplexed in situ hybridization reveals distinct lineage identities for major and minor vein initiation during maize leaf development. Proc. Natl. Acad. Sci. USA 2024, 121, e2402514121. [Google Scholar] [CrossRef]
  47. Wang, Y.; Xing, J.; Wan, J.; Yao, Q.; Zhang, Y.; Mi, G.; Chen, L.; Li, Z.; Zhang, M. Auxin efflux carrier ZmPIN1a modulates auxin reallocation involved in nitrate-mediated root formation. BMC Plant Biol. 2023, 23, 74. [Google Scholar] [CrossRef]
  48. Jiang, N.; Wang, P.; Yang, Z.; Li, C.; Xia, Y.; Rong, X.; Han, Y.; Yang, L. Auxin regulates leaf senescence and nitrogen assimilation to promote grain filling in maize (Zea mays L.). Field Crops Res. 2025, 323, 109787. [Google Scholar] [CrossRef]
  49. Thölke, P.; Mantilla-Ramos, Y.-J.; Abdelhedi, H.; Maschke, C.; Dehgan, A.; Harel, Y.; Kemtur, A.; Berrada, L.M.; Sahraoui, M.; Young, T.; et al. Class imbalance should not throw you off balance: Choosing the right classifiers and performance metrics for brain decoding with imbalanced data. NeuroImage 2023, 277, 120253. [Google Scholar] [CrossRef]
  50. Wen, X.; Zhong, S.; Sun, W.; Xue, W.; Bai, W. Development of an optimal bilayered back propagation neural network (BPNN) to identify termal behaviors of reactions in isoperibolic semi-batch reactors. Process Saf. Environ. Prot. 2023, 173, 627–641. [Google Scholar] [CrossRef]
  51. Schmidhuber, J. Deep learning in neural networks: An overview. Neural Netw. 2015, 61, 85–117. [Google Scholar] [CrossRef] [PubMed]
  52. Castro, C.L.; Braga, A.P. Aprendizado supervisionado com conjunto de dados desbalanceados. Sist. Intel. Sba Controle Automação. 2011, 22, 441–466. [Google Scholar] [CrossRef]
  53. Meza, J.K.S.; Yepes, D.O.; Rodrigo-Ilarri, J.; Rodrigo-Clavero, M.-E. Análise Comparativa da Implementação de Máquinas de Vetores de Suporte e Redes Neurais Artificiais de Memória de Longo Prazo em Modelos de Gestão de Resíduos Sólidos Municipais em Megacidades. Int. J. Environ. Res. Public Health 2023, 20, 4256. [Google Scholar] [CrossRef]
  54. Shu, M.; Zhu, J.; Yang, X.; Gu, X.; Li, B.; Ma, Y. A Spectral Decomposition Method for Estimating the Leaf Nitrogen Status of Maize by UAV-Based Hyperspectral Imaging. Comput. Electron. Agric. 2023, 212, 108100. [Google Scholar] [CrossRef]
  55. Chen, J.; Dai, Z.; Duan, J.; Matzinger, H.; Popescu, I. Improved Naive Bayes with Optimal Correlation Factor for Text Classification. SN Appl. Sci. 2019, 1, 1129. [Google Scholar] [CrossRef]
  56. Azad, M.; Nehal, T.H.; Moshkov, M.A. Novel Ensemble Learning Method Using Majority Based Voting of Multiple Selective Decision Trees. Computing 2025, 107, 42. [Google Scholar] [CrossRef]
  57. Singh, G.; Sharma, S. Enhancing Precision Agriculture through Cloud Based Transformative Crop Recommendation Model. Sci. Rep. 2025, 15, 9138. [Google Scholar] [CrossRef]
  58. Cheng, K.; Yan, J.; Li, G.; Ma, W.; Guo, Z.; Wang, W.; Li, H.; Da, Q.; Li, X.; Yao, Y. Remote sensing inversion of nitrogen content in silage maize plants based on feature selection. Front. Plant Sci. 2025, 16, 1554842. [Google Scholar] [CrossRef]
Figure 1. Example of the digitized leaf image segmentation process.
Figure 1. Example of the digitized leaf image segmentation process.
Agriengineering 07 00317 g001
Figure 2. Flowchart of pre-processing, extraction, hyperparameter selection, classification and comparison of results, adapted from [41].
Figure 2. Flowchart of pre-processing, extraction, hyperparameter selection, classification and comparison of results, adapted from [41].
Agriengineering 07 00317 g002
Figure 3. Graphical representation of the chemical analysis for N (g·Kg−1) in the diagnostic leaf at stages V4 and R1 as a function of N (mMol·L−1) in the nutrient solution.
Figure 3. Graphical representation of the chemical analysis for N (g·Kg−1) in the diagnostic leaf at stages V4 and R1 as a function of N (mMol·L−1) in the nutrient solution.
Agriengineering 07 00317 g003
Figure 4. Importance scores of texture features (GLCM) estimated by the ReliefF algorithm. Blue bars show the importance of all features; red bars highlight the three most influential features—Homogeneity (0.0116), Dissimilarity (0.0111), and Contrast (0.0091). Negative values indicate an inverse contribution to prediction. The x-axis shows importance scores (×10−3); the y-axis lists the features.
Figure 4. Importance scores of texture features (GLCM) estimated by the ReliefF algorithm. Blue bars show the importance of all features; red bars highlight the three most influential features—Homogeneity (0.0116), Dissimilarity (0.0111), and Contrast (0.0091). Negative values indicate an inverse contribution to prediction. The x-axis shows importance scores (×10−3); the y-axis lists the features.
Agriengineering 07 00317 g004
Figure 5. Confusion matrix of the NB, DT, K-NN, SVM and ANN algorithms at stage V4 in a maize hybrid.
Figure 5. Confusion matrix of the NB, DT, K-NN, SVM and ANN algorithms at stage V4 in a maize hybrid.
Agriengineering 07 00317 g005
Figure 6. Confusion matrix of the NB, DT, K-NN, SVM and ANN algorithms at stage R1 in a maize hybrid.
Figure 6. Confusion matrix of the NB, DT, K-NN, SVM and ANN algorithms at stage R1 in a maize hybrid.
Agriengineering 07 00317 g006
Figure 7. ROC curve of the NB, DT, K-NN, SVM, and ANN algorithms at stage V4 in a maize hybrid.
Figure 7. ROC curve of the NB, DT, K-NN, SVM, and ANN algorithms at stage V4 in a maize hybrid.
Agriengineering 07 00317 g007
Figure 8. ROC curve of the NB, DT, K-NN, SVM, and ANN algorithms at stage R1 in a maize hybrid.
Figure 8. ROC curve of the NB, DT, K-NN, SVM, and ANN algorithms at stage R1 in a maize hybrid.
Agriengineering 07 00317 g008
Table 1. Phenological stages of maize (Zea mays L.) and brief characterization of vegetative (V) and reproductive (R) stages [27].
Table 1. Phenological stages of maize (Zea mays L.) and brief characterization of vegetative (V) and reproductive (R) stages [27].
StageStage Characterization
Vegetative phase
V0 ou VEGermination and emergence: imbibition, digestion of reserve substances in the caryopsis, cell division, and growth of seminal roots.
V2Second leaf emergence: emergence of primary and seminal roots, onset of photosynthesis with two fully expanded leaves.
V4Fourth leaf emergence: determination of yield potential.
V6Sixth leaf emergence: increase in stem diameter, acceleration of tassel development, and determination of the number of kernel rows on the ear.
V8Eighth leaf emergence: beginning of plant height and stem thickness determination.
V12Twelfth leaf emergence: onset of ear number and size determination.
V14Fourteenth leaf emergence.
Reproductive phase
VtTassel emergence and opening of male flowers.
R1Full flowering: onset of yield confirmation.
R2Milk stage.
R3Dough stage.
R4Floury stage.
R5Dent stage.
R6Physiological maturity: maximum dry matter accumulation and maximum seed vigor, appearance of the black layer at the base of the kernel.
Table 2. Names of the algorithms, vegetative stage, model hyperparameters, optimized hyperparameters, and the search interval of the hyperparameters configured for classifying images of maize leaves with different doses of nitrogen fertilization.
Table 2. Names of the algorithms, vegetative stage, model hyperparameters, optimized hyperparameters, and the search interval of the hyperparameters configured for classifying images of maize leaves with different doses of nitrogen fertilization.
AlgorithmsVegetative StageModel HyperparametersOptimized HyperparametersHyperparameter Search Range
Decision TreesV4, R1Optimizable Tree
Surrogate decision; split: Off.
Maximum number of splits: 583;
Split criterion: Maximum deviance reduction.
Maximum number of splits: 1–3599;
Split criterion: Maximum deviance reduction, Twoing rule, Gini’s diversity index.
Naive BayesV4, R1Optimizable Naive Bayes;
Support: Unbounded.
Distribution names: Kernel;
Kernel Type: Box.
Distribution names: Gaussian, Kernel;
Kernel type: Gaussian, Box, Epanechnikov, Triangle.
K-Nearest NeighborsV4Optimizable KNN.Number of neighbors: 28;
Distance metric: Mahalanobis;
Distance weight: Squared inverse;
Standardize data: No.
Number of neighbors: 1–1800;
Distance metric: Mahalanobis, City block, Chebyshev, Correlation, Cosine, Euclidean, Hamming, Jaccard, Minkowski (cubic), Spearman;
Standardize data: True, False.
K-Nearest NeighborsR1Optimizable KNN.Number of neighbors: 12;
Distance metric: Mahalanobis;
Distance weight: Squared inverse;
Standardize data: yes.
Number of neighbors: 1–1800;
Distance metric: Mahalanobis, City block, Chebyshev, Correlation, Cosine, Euclidean, Hamming, Jaccard, Minkowski (cubic), Spearman;
Standardize data: True, False.
Support Vector MachinesV4Optimizable SVM;
Kernel function: Gaussian;
Kernel scale: Automatic.
Box constraint level: 10;
Multiclass method: one-vs-one;
Standardize data: Yes.
Multiclass method: one-vs-all, one-vc-one;
Box constraint level: 0.001–1000;
Standardize data: True, False.
Support Vector MachinesR1Optimizable SVM;
Kernel function: Quadratic;
Kernel scale: Automatic.
Box constraint level: 2.1544;
Multiclass method: one-vs-all;
Standardize data: False.
Multiclass method: one-vs-all, one-vc-one;
Box constraint level: 0.001–1000;
Standardize data: True, False.
Neural NetworkV4Optimizable Neural Network;
Iteration: 1000
Number of fully connected layers: 1;
Activation: ReLU;
Regularization strength (Lambda): 3.5876 × 10−8;
Standardize data: Yes;
First layer size: 24.
Number of fully connected layers: 1–3;
Activation: ReLU, Tanh, Sigmoid, None;
Standardize data: Yes, No;
Regularization strength (Lambda): 2.7778 × 10−9–27.7778;
First layer size: 1–300;
Second layer size: 1–300;
Third layer size: 1–300.
Neural NetworkR1Optimizable Neural Network;
Iteration: 1000
Number of fully connected layers: 1;
Activation: Tanh;
Regularization strength (Lambda): 7.7293 × 10−5;
Standardize data: Yes;
First layer size: 13.
Number of fully connected layers: 1–3;
Activation: ReLU, Tanh, Sigmoid, None;
Standardize data: Yes, No;
Regularization strength (Lambda): 2.7778 × 10−9–27.7778;
First layer size: 1–300;
Second layer size: 1–300;
Third layer size: 1–300.
Table 3. Results for accuracy (%), total cost (%), F1-score (%), precision (%), sensitivity (%), prediction speed (Obs/s), and training time (s) used as metrics to evaluate the performance of machine learning classifiers for stages V4 and R1 in corn hybrids in the discrimination of N doses.
Table 3. Results for accuracy (%), total cost (%), F1-score (%), precision (%), sensitivity (%), prediction speed (Obs/s), and training time (s) used as metrics to evaluate the performance of machine learning classifiers for stages V4 and R1 in corn hybrids in the discrimination of N doses.
Accuracy
(%)
Total CostF1-Score (%)Precision
(%)
Sensitivity
(%)
Prediction Speed
(Obs/s)
Training Time
(s)
V4
Decision Trees61.515460.760.461.531,00056,524
Naive Bayes49.020443.546.749.015094.506
Support Vector Machines78.78578.678.778.712,00060,687
K-Nearest Neighbors77.78975.677.877.770017.324
Neural Network80.77780.780.780.725,00066,648
R1
Decision Trees70.711770.771.370.755,00028.527
Naive Bayes57.716957.056.757.7680112.54
Support Vector Machines87.05286.986.987.011,0004.3941 × 105
K-Nearest Neighbors79.78179.180.479.76502844.7
Neural Network86.55486.586.886.519,0004.1896 × 105
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.

Share and Cite

MDPI and ACS Style

Silva, T.L.d.; Devechio, F.d.F.d.S.; Tavares, M.S.; Regazzo, J.R.; Sardinha, E.J.d.S.; Altão, L.M.R.; Pagin, G.; Tech, A.R.B.; Baesso, M.M. Machine Learning in the Classification of RGB Images of Maize (Zea mays L.) Using Texture Attributes and Different Doses of Nitrogen. AgriEngineering 2025, 7, 317. https://doi.org/10.3390/agriengineering7100317

AMA Style

Silva TLd, Devechio FdFdS, Tavares MS, Regazzo JR, Sardinha EJdS, Altão LMR, Pagin G, Tech ARB, Baesso MM. Machine Learning in the Classification of RGB Images of Maize (Zea mays L.) Using Texture Attributes and Different Doses of Nitrogen. AgriEngineering. 2025; 7(10):317. https://doi.org/10.3390/agriengineering7100317

Chicago/Turabian Style

Silva, Thiago Lima da, Fernanda de Fátima da Silva Devechio, Marcos Silva Tavares, Jamile Raquel Regazzo, Edson José de Souza Sardinha, Liliane Maria Romualdo Altão, Gabriel Pagin, Adriano Rogério Bruno Tech, and Murilo Mesquita Baesso. 2025. "Machine Learning in the Classification of RGB Images of Maize (Zea mays L.) Using Texture Attributes and Different Doses of Nitrogen" AgriEngineering 7, no. 10: 317. https://doi.org/10.3390/agriengineering7100317

APA Style

Silva, T. L. d., Devechio, F. d. F. d. S., Tavares, M. S., Regazzo, J. R., Sardinha, E. J. d. S., Altão, L. M. R., Pagin, G., Tech, A. R. B., & Baesso, M. M. (2025). Machine Learning in the Classification of RGB Images of Maize (Zea mays L.) Using Texture Attributes and Different Doses of Nitrogen. AgriEngineering, 7(10), 317. https://doi.org/10.3390/agriengineering7100317

Article Metrics

Back to TopTop