Introduction
Phenotypic traits such as flower colour are critical ecological signals with direct consequences for plant fitness. They shape pollinator behaviour, reproductive success and plant–environment interactions (Albor et al. Reference Albor, Ashman, Stanley, Martel and Arceo-Gomez2022). In arid ecosystems, flower colour may also represent adaptations to abiotic stressors such as extreme heat, drought and UV exposure (Salman et al. Reference Salman, Dener, Tzin and Seifan2025). Tecomella undulata (Family: Bignoniaceae), locally known as Rohida, is an endangered keystone species of the Indian Desert. It holds high cultural and economic significance but is increasingly threatened by habitat degradation, overexploitation and poor natural regeneration (Arshad et al. Reference Arshad, Waheed, Fatima, Jarim, Iqbal, Fatmia and Umbreen2022; Mathur and Mathur Reference Mathur and Mathur2024; Thampan et al. Reference Thampan, Srivastava, Saraf and Samal2025).
A distinctive feature of T. undulata is its flower colour polymorphism, expressed in three morphs – yellow, orange (intermediate) and red – which provide valuable variation for ecological and conservation studies (Figs. 1 and 2). In Rajasthan, two primary morphotypes, yellow and red, have been identified, with orange likely representing an intermediate form (Negi et al. Reference Negi, Sharma, Sharma, Kshetrapal, Kothari and Trivedi2011). The spatial rarity of both yellow and red morphs raises conservation concerns, underscoring the need for improved regeneration strategies. These observations also highlight the importance of better understanding breeding behaviour and phenology to support effective conservation. Flower colour polymorphism in T. undulata is not only of ornamental or taxonomic value but also ecologically significant (Singh et al. Reference Singh, Barman and Tandon2014; Vaidya et al. Reference Vaidya, McDurmon, Mattoon, Keefe, Carley, Lee, Bingham and Anderson2018; Coetzee et al. Reference Coetzee, Seymour and Spottiswoode2021). Legitimate pollinators such as bulbuls (Pycnonotus spp.) and nectar robbers such as sunbirds interact differently with flowers, but together they influence reproduction. The species is predominantly open-pollinated, with high pollen viability and obligate outcrossing, as selfing fails (Daneva et al. Reference Daneva, Johar, Pathak, Rawat and Khan2024). Morphs differ in reproductive performance: yellow flowers are generally more dominant. Despite these differences, overall pollinator visitation does not vary among morphs. Nectar robbing was even found to benefit reproduction by enhancing cross-pollination, since robbing encouraged pollinators to move among more trees, thereby increasing fruit set without reducing seed set. These interactions highlight the ecological complexity of reproduction in an obligate out-crosser like T. undulata (Singh et al. Reference Singh, Dhyani, Yadav and Rajkumar2011).
Representative flower morphotypes of T. undulata. (a–c) Yellow, orange and red flower morphs photographed in the field. (d–f) Zoomed views showing petal texture and pigmentation.

Figure 1 Long description
The image A shows a tree with red flowers among green foliage. The image B shows a tree with orange flowers, with sparse foliage and a dry landscape in the background. The image C shows a tree with yellow flowers, surrounded by green foliage and a fence in the background. The image D shows a close-up view of red flowers, highlighting petal texture and pigmentation. The image E shows a close-up view of orange flowers, focusing on petal texture and pigmentation. The image F shows a close-up view of yellow flowers, emphasizing petal texture and pigmentation.
Sample images used for classifier training and validation. Images of yellow, orange and red flowers were collected under natural field conditions and used as inputs for supervised model training in Google Teachable Machine. These ‘sample images’ represent the input dataset, with replicates per morph to ensure balanced learning.

Figure 2 Long description
The image A shows a red flower with prominent stamens extending from the center. The petals are curved outward, revealing the inner structure. The image B shows an orange flower with similar stamen arrangement and the petals are slightly more open. The image C shows a yellow flower with stamens extending from the center and the petals are fully open, displaying the flower's interior.
Comparable advances in automated flower colour classification have been reported, but these largely focused on crops and ornamental species. For example, Singh et al. (Reference Singh, Dhyani, Yadav and Rajkumar2011) used high-resolution imaging and (Red, Green and Blue) RGB/HS (Hue and Saturation) statistics to classify ligule colour variation in gerbera, while Wehrens et al. (Reference Wehrens, Afonso, Fonteijn, Paula, Polder, Rijsbergen, van Hameren, Haegens, van den Helder and Zwinkels2024) compared deep learning with traditional histogram methods, both achieving ∼85% accuracy. Dave et al. (Reference Dave, Pansiniya, Patel, Trivedi and Patel2024) further contrasted a customized (Convolutional Neural Network) CNN with Google’s Teachable Machine for leaf classification, finding CNN superior in accuracy but Teachable advantageous as an accessible no-code platform. Together, these studies demonstrate feasibility and highlight trade-offs between precision, interpretability and accessibility. However, none systematically applied no-code AI tools across both flower and whole-tree scales, nor integrated supervised classification with unsupervised clustering in an ecologically threatened tree. Our study addresses this gap by combining accessible AI pipelines with ecological interpretation, thereby linking digital phenotyping directly to conservation strategies for T. undulata.
Although T. undulata holds high ecological and cultural importance, most studies have focused on morphology, phenology, reproductive biology, or molecular variation among morphs (Negi et al. Reference Negi, Sharma, Sharma, Kshetrapal, Kothari and Trivedi2011; Singh et al. Reference Singh, Dhyani, Yadav and Rajkumar2011; Chhajer et al. Reference Chhajer, Jukanti, Bhatt and Kalia2018; Daneva et al. Reference Daneva, Johar, Pathak, Rawat and Khan2024). Additional work has examined biomass production in agroforestry systems (Singh et al. Reference Singh, Bala, Mutha, Rathod and Limba2012), seed storage responses (Dalal et al. Reference Dalal, Bhuker and Kathwal2025), and species distribution modelling (Mathur and Mathur Reference Mathur and Mathur2024). However, there remains a critical knowledge gap in linking quantitative, image-based phenotyping of flower colour polymorphism with ecological and conservation contexts. Previous approaches relied heavily on qualitative scoring systems (e.g., Royal Horticultural Society Colour Chart) or limited multivariate clustering, which lack scalability and precision (Kasajima et al. Reference Kasajima2019; van der Kooi et al. Reference van der Kooi, Dyer, Kevan and Lunau2019; Post et al. Reference Post and Schlautman2020). Given the species’ threatened status and regeneration challenges, low-barrier digital phenotyping provides a valuable and timely complement to traditional ecological monitoring. Moreover, no study has systematically evaluated how accessible, no-code AI tools can be applied to classify flower morphs at both flower and whole-tree scales, nor has there been an integrated assessment combining supervised classification, unsupervised clustering and ecological interpretation. This gap has constrained our ability to monitor polymorphism systematically across landscapes, and embed morph diversity into plant genetic-resource conservation and restoration planning.
We hypothesized that flower colour morphs of T. undulata (yellow, orange and red) exhibit distinct quantitative signatures in RGB channel intensities and hue values; that supervised learning via Google’s Teachable Machine could accurately classify these morphs at both flower and whole-tree scales; and that unsupervised clustering (K-means) would independently corroborate morph separation, confirming colour polymorphism as a robust and ecologically relevant trait. To test these hypotheses, our study focused on three interlinked objectives: first, applying Teachable Machine to train and validate a no-code machine learning classifier for T. undulata flower colour morphs; second, evaluating classification performance across two imaging scales – isolated flowers and whole trees – to capture the influence of contextual complexity; and third, integrating unsupervised clustering of quantified features (RGB intensities, hue and area) to validate morph separation while linking computational outcomes to biodiversity monitoring, digital herbarium development and conservation planning.
Materials and methods
Data collection
A field survey was conducted across different arid and semi-arid districts of Rajasthan, where morphological variation in T. undulata was documented. A total of 36 sites were sampled (12 sites per floral morphotype: yellow, orange, red) (Supplementary Figure S1). From each site, digital images were collected in triplicate at both flower and whole-tree scales, yielding 108 observations (36 per morphotype) across varied land-use types.
Image processing
From each image, quantitative features were extracted, including average RGB channel intensities, hue values and flower area. RGB and hue statistics were standardized prior to analysis. For clustering, mean feature values were aggregated at the site level (n = 36).
Model training
We employed Google’s Teachable Machine, a web-based no-code deep learning platform utilizing transfer learning on pre-trained convolutional neural networks (Carney et al. Reference Carne, Luccioni, Ou and Tao2020). Flower- and tree-scale datasets were uploaded separately and labelled according to colour class (yellow, orange, red; Fig. 3). Each dataset consisted of 36 images per morphotype (n = 108 total), and models were trained using an 80:20 split for training and testing. Training was performed under the platform’s default settings, with convergence typically achieved after ∼200 epochs and a batch size of 16. Preprocessing steps included RGB channel standardization to minimize illumination bias. During training, diagnostic outputs such as loss curves, confusion matrices and performance metrics (accuracy, precision, recall and F1-score) were monitored to evaluate model stability and robustness.
Workflow of automated classification using Google Teachable Machine. The diagram outlines the pipeline: (i) image collection, (ii) labelling of flower morphs, (iii) supervised model training, (iv) performance evaluation (confusion matrix, learning curves) and (v) validation with unsupervised clustering. This figure provides a stepwise narrative of how classification was implemented.

Figure 3 Long description
The image shows multiple screenshots of the Google Teachable Machine interface. The first section displays labeled datasets for red, orange and yellow flowers with image samples. The second section shows previews of flower images with options to upload models. The third section includes training settings such as batch size, learning rate and epochs. Each flower category has its own training interface, displaying output probabilities for classification. The interface provides options for model training and advanced settings, allowing users to adjust parameters for optimal performance.
Teachable Machine was selected because it is an accessible, low-barrier tool that allows supervised image classification without coding, making it suitable for ecological applications and reproducible workflows.
Validation and clustering analysis
To examine morphotype differentiation, we applied unsupervised K-means clustering on the extracted features (RGB, hue, area). K-means was chosen due to its successful use in prior plant morphotyping studies, including fruit shape classification in strawberry (Feldmann et al. Reference Feldmann, Hardigan, Famula, Lopez, Tabb, Cole and Knapp2020), fruit colour pattern detection (Chen et al. Reference Chen2024) and petal colour-space segmentation (Perez-Udell et al. Reference Perez-Udell, Udell and Chang2023). In ecological contexts, clustering has also been applied to flower detection in rapeseed (Li et al. Reference Li, Li, Qiao, Li, Wang, Yao and Liao2024) and flower counting (Zhao et al. Reference Zhao and Shin2023), underscoring its robustness for high-variance datasets.
Clustering was carried out with k = 3 (yellow, orange, red morphotypes). Initial cluster centres were defined using Euclidean distance in colour space, and iterative reallocation continued until convergence. Cluster validity was evaluated using the within-cluster sum of squares and silhouette scores. Final clusters were interpreted ecologically by linking morphotypes to pigment pathways (anthocyanin vs. carotenoid dominance) and observed variability in T. undulata. To statistically validate cluster assignments, (Analysis of Variance) ANOVA was performed on extracted features across the three clusters. All statistical analyses, including ANOVA and clustering, were conducted using OriginPro v2022 (OriginLab Corporation, 2022).
The total variation in the data is partitioned into between-group variation (variation among morphs) and within-group variation (variation within morphs).
\begin{align*}F = {\text{ }}\frac{{M{S_{between}}}}{{M{S_{wtihin}}{\text{ }}}}{\text{ }}Where;{\text{ }}M{S_{between}} = {\text{ }}\frac{{S{S_{between}}}}{{d{f_{wtihin}}{\text{ }}}}; \\ {\text{ }}M{S_{wuhin}} = {\text{ }}\frac{{S{S_{bwithin}}}}{{d{f_{wtihin}}{\text{ }}}}{\text{ }}and\end{align*}
\begin{align*}S{S_{total}} = \sum\limits_{i = 1}^k {\sum\limits_{j = 1}^{ni} {\left( {{x_{ij}} - \mathop x\limits^ = } \right)^2;\,} } \;S{S_{between}} = \sum\limits_{i = 1}^k {{n_i}{{({{\mathop x\limits^ = }_i} - \mathop x\limits^ = )}^2}} ; \\ ;S{S_{within}} = \sum\limits_{i = 1}^k {\sum\limits_{j = 1}^{ni} {{{({x_{ij}} - {{\mathop x\limits^ = }_i})}^2}} } \end{align*}
\begin{equation*}\begin{gathered}
Where\,k = \,{\text{number of groups }}({\text{here}},{ }3{\text{ morphs}}:\\ {\text{ yellow}},{\text{ orange and red}},{ }{n_i} \\
= number\,of\,observations\,in\,group\;i;\,{x_{ij}} \\
= observation\,j\,in\,group\,i;\,{\mathop {\;x}\limits^ = _i} = mean\,of\,group\,i\,and\,\mathop {\;x}\limits^ = \\
= grand\,mean\,(mean\,of\,all\,observations \\
\end{gathered} \end{equation*}A large F-value indicates that the variation between morphs (flower or tree traits) is much greater than the variation within morphs, suggesting strong morphological divergence.
\begin{equation*}\text{Effect\ size } ({\eta}^2) \text{was\ also\ calculated\ as } {\eta ^2} = {\text{ }}\frac{{S{S_{between}}}}{{S{S_{total}}}} \end{equation*}This quantifies the proportion of variance explained by morph type, linking statistical output to ecological importance.
This analytical framework aligns with the emerging use of AI in plant trait phenotyping and biodiversity monitoring, where accessible platforms like Teachable Machine have been applied for flower classification (Wehrens et al. Reference Wehrens, Afonso, Fonteijn, Paula, Polder, Rijsbergen, van Hameren, Haegens, van den Helder and Zwinkels2024).
Results
Confusion matrix and classification accuracy
Morphometric and colourimetric traits of T. undulata flowers and trees across morphotypes (area, RGB intensity, hue values) are provided in Supplementary Tables 1 and 2. The supervised classifiers achieved strong performance across both datasets. Beyond overall accuracy, class-specific performance metrics were also calculated. At the flower scale, precision ranged from 0.90 (orange morphs) to 0.94 (yellow morphs), recall ranged from 0.88 to 0.95 and F1-scores were consistently above 0.89 (Table 1; Fig. 4a). At the tree scale, precision values were slightly lower (0.79–0.85), with corresponding recall between 0.77 and 0.83, reflecting the greater variability introduced by canopy structure and background foliage (Table 1; Fig. 4b). Misclassifications were more evenly distributed across morphs, reflecting canopy-level variance from background foliage, crown size and lighting. These results confirm that classification reliability is highest at the flower scale but remains acceptable at the tree scale, demonstrating strong transferability of morph traits into field contexts.
Confusion matrices for supervised classification. (a) Flower-scale classifier. (b) Tree-scale classifier. Rows represent true labels; columns represent predicted labels. Numbers indicate counts of correctly and incorrectly classified samples. Higher diagonal values indicate better classification reliability.

Figure 4 Long description
The image contains two confusion matrices. The first matrix, labeled 'A', represents the flower-scale classifier. It shows true labels on the rows and predicted labels on the columns for yellow, orange and red categories. The counts are: Yellow (28 correct, 2 incorrect), Orange (3 incorrect, 27 correct), Red (1 incorrect, 29 correct). The second matrix, labeled 'B', represents the tree-scale classifier. It also shows true labels on the rows and predicted labels on the columns for the same categories. The counts are: Yellow (25 correct, 5 incorrect), Orange (6 incorrect, 24 correct), Red (4 incorrect, 26 correct). Higher diagonal values indicate better classification reliability.
Quantitative performance metrics (accuracy, precision and recall) of flower and tree classification models of T. undulata using Teachable Machine

Table 1 Long description
The table presents performance metrics for flower and tree classification models of T. undulata, focusing on accuracy, precision, and recall across different morphs. Yellow morphs exhibit the highest accuracy and precision for flower classification at 96% and 0.93, respectively. In contrast, tree classification accuracy is lower, with an overall accuracy of 84.7%. Orange morphs show the lowest performance in both flower and tree classification, with accuracy rates of 88% and 79%, respectively. Red morphs perform better than orange but not as well as yellow, with flower classification accuracy at 93% and tree classification at 85%. Overall, flower classification metrics are consistently higher than tree classification across all morphs.
Model accuracy across epochs
During training, both flower- and tree-scale models showed steady convergence (Fig. 5). For flowers, training accuracy plateaued at ∼95% after 200 epochs, while validation stabilized at 92%, indicating minimal overfitting. Tree-scale models converged at lower accuracies (training ≈ 90%, validation ≈ 85%) due to higher natural variability. Most performance gains occurred within the first 100 epochs. These learning curves highlight the higher separability of morphs at the flower scale and the greater challenges posed by tree-scale conditions.
Model training curves for flower- and tree-scale classifiers. Y-axis shows classification accuracy (%) and x-axis shows training epochs (iterations of model learning). Accuracy plateaued after ∼200 epochs, indicating stable performance.

Figure 5 Long description
A line graph showing classification accuracy on the vertical axis and epochs on the horizontal axis, ranging from 0 to 200. Four curves are present: Flower - Train, Flower - Validation, Tree - Train and Tree - Validation. The Flower - Train curve starts at approximately 0.6 accuracy and plateaus near 0.95. The Flower - Validation curve begins slightly lower and stabilizes around 0.92. The Tree - Train curve starts at about 0.55 and reaches around 0.9. The Tree - Validation curve starts lower and stabilizes near 0.85. The graph indicates steady convergence for both flower and tree models over the epochs.
Flower and tree type and colour intensity
Trait averages revealed clear chromatic separation among morphs. Yellow flowers were the brightest (0.61 ± 0.03), with high Red (0.85) and Green (0.63) values but very low Blue (0.09). Orange flowers showed intermediate brightness (0.57 ± 0.04) and spectral values between yellow and red morphs, while red flowers were the darkest (0.53 ± 0.05), dominated by Red (0.76) with reduced Green (0.29) (Table 2). At the tree scale, crown size varied more broadly: orange trees were the largest (92.1 ± 15.1), followed by yellow (85.3 ± 10.3) and red (76.8 ± 12.7). Hue values also distinguished morphs (yellow = 48.6, orange = 34.5, red = 38.8), although separation was narrower at the tree level. ANOVA confirmed significant differences in both flower area (F = 11.07, P = 0.0002, η2 = 0.36) and tree area (F = 5.31, P = 0.010, η2 = 0.24) (Supplementary Table 3). The large effect size for flower area (F = 11.07, P = 0.0002, η2 = 0.36; Table 2, Fig. 6a) demonstrates strong morphological divergence among morphs. Biologically, this indicates that variation in flower size may influence pollinator attraction, handling efficiency and reproductive output. At the tree scale, the smaller but still meaningful effect size (F = 5.31, P = 0.010, η2 = 0.24; Table 2, Fig. 6b) highlights differences in crown size that could shape pollinator movement and resource use. Overall, effect sizes help link statistical significance to ecological function, underscoring how morphological divergence among morphs contributes to pollination ecology and the conservation value of T. undulata.
Scatterplots of area vs Hue with morph assignments.(a) Flower morphs: flower area (cm²) on the x-axis vs Hue (degrees) on the y-axis.(b) Tree morphs: crown area (m²) on the x-axis vs Hue (degrees) on the y-axis.Colours indicate morph identity (yellow, orange and red). These plots show how morphological and chromatic traits separate across morph types.

Figure 6 Long description
The image A shows a scatterplot with flower morphs, where the x-axis is labeled 'Area' in square centimeters and the y-axis is labeled 'Hue' in degrees. Data points are represented by circles for yellow morphs, triangles for orange morphs and crosses for red morphs. The plot displays a range of area values from 10 to 22 and Hue values from 10 to 45. The image B shows a scatterplot with tree morphs, where the x-axis is labeled 'Area' in square meters and the y-axis is labeled 'Hue' in degrees. Data points are represented similarly with circles, triangles and crosses for yellow, orange and red morphs, respectively. The plot displays area values from 60 to 110 and Hue values from 25 to 55. Both plots illustrate the separation of morphological and chromatic traits across morph types.
Morphometric and colourimetric traits of T. undulata flowers and trees, including area, intensity and hue values across colour morphs

Table 2 Long description
The table compares morphometric and colourimetric traits of T. undulata flowers and trees across yellow, orange, and red color morphs. Yellow flowers have the highest mean area (15.3) and intensity (0.61), while red flowers have the lowest mean area (12.1) and intensity (0.53). Among trees, orange trees have the largest mean area (92.1), but red trees have the lowest mean intensity (0.48). Hue values are highest for yellow trees (48.6) and lowest for red flowers (16). The data suggests that yellow morphs generally have higher intensity and hue values compared to red morphs, indicating potential differences in visual perception.
Scatterplot of area vs. Hue (cluster assignments)
Scatterplots demonstrated distinct clustering of morphs when plotted as area vs. hue. At the flower scale (Fig. 6a), separation occurred primarily along the hue axis, with yellow morphs concentrated around 40–50°, orange at 25–35° and red below 20°, while area contributed little differentiation. At the tree scale (Fig. 6b), separation occurred along both axes: yellow trees clustered around warm hues (47–53°) with moderate crown sizes, orange trees spanned 23–41° with broad crown variation, and red trees exhibited cooler or anomalous hues (including a 211° outlier; Supplementary Table 2) along with the largest crowns.
K-means cluster analysis for flower (Bi-plot)
K-means clustering of flower traits yielded three distinct clusters of 12 observations each (Fig. 7). Cluster 1 (grey) comprised the smallest flowers (mean area = 19.15 cm2) with low hue (∼15°), dominated by red-channel intensity (0.78). Cluster 2 (red) contained intermediate-sized flowers (41.21 cm2) with balanced red and green intensities and hue ≈ 38°, corresponding to yellow–orange tones. Cluster 3 (blue) included the largest flowers (76.02 cm2), with higher red and green intensities and hue ≈ 50°, representing deeper orange/yellow-orange morphs (Table 3).
Principal component analysis (PCA) of flower traits. Coloured dots represent individual flowers: yellow = yellow morphs, orange = orange morphs, red = red morphs. Axes represent the first two principal components (unitless), explaining most of the variance in colour and area traits.

Figure 7 Long description
The scatter plot illustrates principal component analysis of flower traits. The horizontal axis represents PC 1, accounting for 59.31 percent of the variance, and the vertical axis represents PC 2, accounting for 25.16 percent of the variance. The legend indicates three categories: 1, 2, and 3, represented by different colors. Category 1 is shown in grey, category 2 in red, and category 3 in blue. Clusters are visible with category 1 forming a dense group around PC 1 from negative 2 to negative 1 and PC 2 from negative 1 to 1. Category 2 forms a cluster with a confidence ellipse around PC 1 from 1 to 2 and PC 2 from 3 to 5, with radial lines indicating dispersion. Category 3 is spread along PC 1 from 1 to 2 and PC 2 from negative 1 to 0. The plot reveals separation among the categories, with category 2 positioned higher on PC 2. No clear outliers are evident. The plot aims to show the variance in flower traits across different morphs, highlighting distinct clusters and separation along the principal components.
Final cluster centre outputs from K-means analysis of flower morphotypes based on area, colour intensity and hue values

Table 3 Long description
The table presents the final cluster centers from a K-means analysis of flower morphotypes, focusing on area, color intensity, and hue values. Cluster3 exhibits the largest flower area at 76.02 cm and the highest red intensity at 0.87, corresponding to a yellow morphotype with a hue of 50°. Cluster1 has the smallest flower area at 19.15 cm and a red morphotype with a hue of 14.68°. Cluster2 shows an intermediate flower area of 41.21 cm and an orange morphotype with a hue of 38.10°. The average intensity values are similar for Cluster2 and Cluster3 at 0.52, while Cluster1 has a lower average intensity of 0.39. The data suggests a trend where larger flower areas correlate with higher red intensity and distinct morphotypes.
Quantitative image analysis confirmed that yellow, orange and red morphs exhibit distinct spectral profiles: yellow averaging ∼ 50°, orange ∼ 40° and red ∼ 15°. Inter-cluster distances highlighted the strongest separation between yellow and red (61.5 units), while orange occupied an intermediate position between the two extremes (32–35 units; Supplementary Table 4). Cluster cohesion also varied: Cluster 1 was most compact, Cluster 3 moderately cohesive and Cluster 2 most variable (Supplementary Table 5). ANOVA supported these distinctions, with highly significant differences among morphs in flower area, average intensity, green intensity and hue (all P < 0.0001; Table 4).
Results of ANOVA for flower traits of T. undulata, assessing total flower area, average intensity (RGB channels) and hue across clusters

Table 4 Long description
The table presents ANOVA results for various flower traits of T. undulata, including total flower area, average intensity in RGB channels, and hue across different clusters. The total flower area has the highest F value of 79.20, indicating a significant difference across clusters with a p-value of less than 0.0001. Average intensity also shows significant differences, particularly in the green channel with an F value of 67.24 and a p-value of less than 0.0001. The hue has an F value of 43.60, also indicating significant differences across clusters. These results suggest that there are notable variations in these traits among the clusters, with all p-values indicating strong statistical significance.
K-means cluster analysis for tree (Bi-plot)
Tree-scale clustering revealed greater variability than flowers, with three clusters identified (Fig. 8; Table 5). Cluster 1, the largest (33 observations), consisted of red-dominant trees (hue ≈ 40°) with moderate red and green intensities. Cluster 2 contained two yellow–green outliers with elevated red, green and blue intensities and very high hue (≈148°). Cluster 3, represented by a single observation, had balanced RGB intensities and intermediate hue (∼95°), corresponding to an orange morph. Final cluster centres (Table 6) confirmed clear spectral differentiation, though Cluster 1 displayed the highest internal variability (within-SS = 2108.70), while Clusters 2 and 3 were more compact (Supplementary Table 7). The biplot of tree clustering explained 98.3% of variance (PC1 = 93.6%, PC2 = 4.7%), with most trees tightly grouped in Cluster 1. Distances showed the greatest separation between Cluster 1 and Cluster 2 (108 units), with Cluster 3 intermediate (≈54 units; Supplementary Table 6).
PCA of tree-scale traits. Coloured dots represent individual trees: yellow = yellow morphs, orange = orange morphs, red = red morphs. Axes represent the first two principal components (unitless), derived from crown area and spectral attributes. Broader overlap compared to flowers reflects ecological complexity in canopy-level images.

Figure 8 Long description
The scatter plot illustrates tree clustering based on principal component analysis. The x-axis is labeled PC 1 with 93.65 percent and the y-axis is labeled PC 2 with 4.65 percent. Three membership groups are identified: group 1, group 2 and group 3. Group 1 is represented by black dots clustered closely together, group 2 by a single blue dot and group 3 by a single red dot. Lines connect the individual points to their respective group centers, highlighting the distribution and separation among the groups.
Initial cluster centre outputs from K-means analysis of tree morphotypes based on average RGB intensities and hue values

Table 5 Long description
The table presents initial cluster center outputs from a K-means analysis of tree morphotypes, focusing on average RGB intensities and hue values. Cluster2 stands out with the highest average intensities in red (1.72), green (1.59), and blue (0.94), along with a hue of 156.66, suggesting a more vibrant color profile. In contrast, Cluster1 and Cluster3 have similar RGB intensities, with Cluster1 having a hue of 23.32 and Cluster3 a hue of 94.60, indicating different color characteristics. The data highlights the variation in color profiles among the clusters, which may be significant for identifying distinct tree morphotypes.
Final cluster centre outputs from K-means analysis of tree morphotypes based on average RGB intensities and hue values

Table 6 Long description
The table presents the final cluster centers from a K-means analysis of tree morphotypes based on average RGB intensities and hue values. Cluster1 has lower average intensities across all colors with a hue of 40.17, suggesting a more muted color profile. Cluster2 exhibits the highest average intensities for red, green, and blue, with a hue of 148.48, indicating a vibrant color profile. Cluster3 has similar red and green intensities to Cluster1 but a higher blue intensity and a hue of 94.60, suggesting a more balanced color profile. The data highlights significant differences in color characteristics among the clusters, which may reflect variations in tree morphotypes.
Both scatterplots and K-means clustering confirm that T. undulata morphs are spectrally distinct and quantitatively separable at flower and tree scales. At the flower scale, clustering was compact and well defined, while tree-scale analysis captured greater heterogeneity and occasional outliers. Together, supervised (Teachable Machine CNN) and unsupervised (K-means) approaches consistently validated morph distinctions, with the highest reliability at the flower scale and acceptable transferability to tree scale. These findings underscore the potential of accessible AI platforms for biodiversity monitoring and conservation planning in morphologically variable species.
Discussion
The results from both classification and clustering confirm that flower colour polymorphism in T. undulata is spectrally distinct and ecologically meaningful. Confusion matrices diagnose which morphs are confused and why. They reveal that orange morphs occupy a transitional spectral space, which makes them harder to distinguish, especially from red morphs. Accuracy curves across epochs, by contrast, capture the overall learning trajectory of the models. At the flower scale, the early plateau reflects the strong discriminant signal provided by hue and brightness under controlled imaging. This indicates that relatively few training iterations are sufficient for robust classification. At the tree scale, however, the plateau was lower and slower. This reflects the ecological complexity of canopy-level imagery, where morph signals are weakened by leaf layering, shadow and background interference.
Yellow–orange misclassifications arise from overlapping pigment composition: both morphs share high red-channel intensity from anthocyanins, with carotenoids distinguishing yellow morphs. This spectral overlap explains their intermediate clustering and ecological ambiguity and such results are corroborated by the finding of Rausher (Reference Rausher2008 in Mimulus) and Caruso et al. (Reference Caruso, Eisen, Martin and Sletvold2010 in Ipomoea). Learning curves indicated that accuracy gains plateaued after moderate training epochs, demonstrating that robust and efficient training is sufficient for reliable field-level applications. The distinction between confusion matrices and classification accuracy across epochs underscores two complementary dimensions of model evaluation. Confusion matrices diagnose which morphs are confused and why, thereby revealing that orange morphs occupy a transitional spectral space that makes them harder to distinguish, especially from red morphs. Accuracy curves across epochs, by contrast, capture the overall learning trajectory of the models. The early plateau observed at the flower scale reflects the strong discriminant signal provided by hue and brightness under controlled imaging, indicating that relatively few training iterations are sufficient for robust classification. In contrast, the lower and slower plateau at the tree scale reflects the ecological complexity of canopy-level imagery, where morph signals are attenuated by leaf layering, shadow and background interference. These findings demonstrate that while high performance is achievable at the flower scale, scaling classification to the whole-tree level requires either additional preprocessing (e.g., improved segmentation) or more sophisticated architectures to offset background noise.
Our supervised models achieved high accuracy, yet misclassifications were most frequent between yellow and orange morphs, even at the flower scale (Fig. 4, Table 1). This reflects their spectral proximity, as orange hues occupy an intermediate position between the red – and yellow-dominated extremes. The higher rate of yellow–orange confusion can be explained by shared pigment composition and visual ecology. Both morphs exhibit elevated red-channel intensity due to anthocyanins, while carotenoids contribute more strongly to yellow morphs, resulting in overlapping hue values that reduce separability. Such intermediate spectra not only challenge automated classification but also mirror biological perception, as pollinators respond to gradients of floral reflectance rather than discrete categories (Holton and Cornish Reference Holton and Cornish1995; Davies Reference Davies2009). Thus, the observed errors are biologically meaningful, rooted in pigment pathways and ecological interactions rather than model limitations.
K-means clustering further validated morph separation. The bi-plot confirmed the greatest distance between red and yellow morphs, with orange acting as an intermediate (Fig. 7, Supplementary Tables 4–5). Silhouette values (∼0.42 for flowers; ∼0.41 for trees) exceeded the ecological threshold of 0.40, confirming meaningful clusters despite biological variability. At the tree scale, separability was influenced by both hue and canopy area, consistent with the significant negative relationship between hue and crown size (slope −0.664 cm2/°, P < 0.001). These results indicate that spectral and structural traits jointly determine morph distinction in natural settings.
Within the tree dataset, Cluster 1 encompassed most individuals (red-dominant), reflecting phenotypic plasticity influenced by the environment. Clusters 2 and 3 represented rare outliers with unusual pigment balances and intermediate hues, pointing to eco-physiological or developmental variation (Table 6; Supplementary Table 7). The presence of such distinct morphs highlights both dominant and rare forms within the population, underscoring the ecological breadth of the species.
From an ecological standpoint, the three colour morphotypes – red-dominant, yellow-green bright and orange transitional – likely reflect a mix of adaptive strategies and pigment-driven plasticity. Functionally, red morphs may confer photoprotection via anthocyanins, yellow morphs enhance photosynthetic efficiency through carotenoids, and orange morphs act as transitional forms. This functional diversity strengthens ecological resilience, with red dominating but rarer morphs contributing adaptive breadth. This diversity is ecologically significant. It buffers the species against environmental variability and maintains reproductive flexibility through pollinator attraction (Saleem et al. Reference Saleem, Potgieter and Arif2019). Comparative literature supports these findings. While platforms like Teachable Machine can achieve very high accuracies under controlled conditions (Malahina et al. Reference Malahina, Saitakela, Bulan, Lambelawa and Belutowe2024), intermediate hues remain challenging due to spectral overlap (Dave et al. Reference Dave, Pansiniya, Patel, Trivedi and Patel2024). Ecologically, polymorphism in T. undulata is unlikely driven by pollinator preference alone; visitation is not morph-specific (Singh et al. Reference Singh, Barman and Tandon2014). Instead, pigment biosynthesis, physiological stress responses and genetic mechanisms (Hasan et al. Reference Hasan, Yusuf and Alzubaidi2020) likely maintain polymorphism in arid habitats.
Together, these analyses show that T. undulata colour polymorphism is spectrally measurable, biologically meaningful and ecologically relevant. Red morphs dominate, while the less common transitional and yellow morphs add useful functional diversity. By combining RGB profiling, clustering and machine learning, this work offers a reliable approach for digital trait monitoring with clear value for biodiversity conservation, ecological studies and citizen-science monitoring in arid landscapes. These results highlight how simple AI classifiers can “support ecological interpretation and conservation planning, even under field-level variability.”
Practical and conservation implications
The findings of this study have direct implications for plant genetic resource conservation and biodiversity management in T. undulata. By demonstrating that flower colour polymorphism is spectrally distinct and reliably classified – especially at the flower scale (Fig. 4, Table 1), our results provide a practical framework to ensure that all three morphs (yellow, orange and red) are represented in ex situ collections. Preserving this phenotypic diversity in seed banks and restoration programs is critical, since morphotypes often capture underlying genetic variation, safeguarding both visible traits and potentially adaptive alleles.
The high classification accuracy at the flower scale also enables rapid, non-invasive field monitoring. Deployed through mobile or citizen-science platforms, this image-classification pipeline offers a scalable method to track morph frequencies across Rajasthan’s fragile arid landscapes. Such monitoring can serve as an early-warning system for demographic shifts, and when integrated with ecological variables (e.g., rainfall, soil fertility, temperature), it can guide site prioritization for restoration and assisted gene flow under climate change scenarios.
Another important implication is the conservation of rare morphs. Populations containing uncommon phenotypes (e.g., orange transitional morphs or bright yellow-green variants) should be prioritized for habitat protection, propagation and reinforcement. This morph-aware approach ensures that rare phenotypes – potentially linked to unique adaptive traits – are not lost from the species’ genetic pool.
In addition, RGB–hue indices provide objective, standardized metrics for provenance management in nurseries, germplasm repositories and field populations. When paired with molecular markers (e.g., ISSR, SCoT), these indices can help test whether morph variation corresponds to adaptive allelic diversity under stress, integrating digital phenotyping with molecular and ecological data into a multi-layered conservation strategy.
From an ecological perspective, preserving morph diversity enhances resilience and pollinator interactions. Red morphs often attract bird pollinators, while yellow and orange appeal to bees and other insects (Saleem et al. Reference Saleem, Potgieter and Arif2019). Although pollinator preference alone does not fully explain the persistence of polymorphism (Singh et al. Reference Singh, Barman and Tandon2014), maintaining multiple morphs buffers populations against environmental variability and sustains reproductive flexibility.
In sum, this study not only documents flower colour polymorphism in T. undulata but also establishes a scalable digital framework for monitoring and managing intraspecific diversity. By linking high flower-scale classification accuracy to conservation outcomes, it demonstrates how accessible AI platforms like Teachable Machine can advance biodiversity conservation, restoration planning and germplasm management in arid ecosystems, while also providing a practical pathway for integration into citizen-science monitoring programs. Because platforms like Teachable Machine are both accurate and accessible, they offer a practical pathway to integrate digital phenotyping into citizen-science monitoring and conservation programs.
Conclusion
This study demonstrates that flower colour polymorphism in T. undulata can be quantified and classified with high accuracy using accessible AI-based platforms. Both supervised and unsupervised approaches validated the distinctiveness of yellow, orange and red morphs, confirming their ecological and phenotypic relevance. Importantly, these morphs represent visible markers of underlying genetic variation, underscoring their conservation value. By providing an efficient, reproducible pipeline for morph classification, our work advances the capacity to document intraspecific diversity, support ex situ conservation of rare morphs, and integrate morph-aware strategies into restoration and breeding programs. For the Plant Genetic Resources community, this research illustrates how low-cost digital phenotyping tools can complement molecular and ecological methods, ensuring that visible diversity and adaptive potential are captured in germplasm repositories and field conservation practices.
Supplementary material
The supplementary material for this article can be found at https://doi.org/10.1017/S1479262125100440.
Acknowledgements
The senior author is thankful to the Director, ICAR-CAZRI, for giving him approval to attend training on R-Programming that enhances his working capacity using ENM modelling techniques. Preet Mathur (Department of Computer Science and Engineering, Thapar Institute of Engineering and Technology, Patiala, Punjab, India) is thankful to his Director for extending their academic help.
Author contributions
Manish Mathur conceived of the study’s central hypothesis and its interpretation of results from various machine learning methods. Preet Mathur performed numerous types of statistical analysis, employing a wide range of software, and transforming the results appropriately for interpretation and visualization.
Funding statement
The authors declare no specific funding for this work.
Competing interests
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.
Ethical standards
All authors have read, understood and complied as applicable with the statement on ‘Ethical responsibilities of Authors’ as found in the Instructions for Authors available at the Journal website.
Data availability
The data that support the findings of this study, specifically the geo-coordinates of the species, are available on request from the corresponding author [Manish Mathur]. The data are not publicly available to avoid the duplication of work within the same geographical area.
Clinical trial number
Not applicable.