Next Article in Journal
Fusing Time-Series Harmonic Phenology and Ensemble Learning for Enhanced Paddy Rice Mapping and Driving Mechanisms Analysis in Anhui, China
Previous Article in Journal
Research on the Leveling Performance of an Electromechanical Omnidirectional Leveling System for Tracked Mobile Platforms in Hilly and Mountainous Areas
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Estimating Cannabis Flower Maturity in Greenhouse Conditions Using Computer Vision

1
Faculty of Computer and Information Science, Ben-Gurion University of the Negev, Beer-Sheva 8410501, Israel
2
RCK Science-Based Cannabis Genetics, Kibbutz Ruhama, Hof Ashkelon 79152, Israel
3
Microsoft, Herzliya 4672516, Israel
*
Author to whom correspondence should be addressed.
Agriculture 2026, 16(4), 460; https://doi.org/10.3390/agriculture16040460
Submission received: 15 January 2026 / Revised: 8 February 2026 / Accepted: 9 February 2026 / Published: 16 February 2026
(This article belongs to the Section Agricultural Technology)

Abstract

The maturity of cannabis flowers at harvest critically influences cannabinoid yield and product quality. However, conventional assessment methods rely on subjective visual inspection of trichomes and stigmas, making them inherently inconsistent. This research presents an automated framework integrating computer vision and deep learning to objectively evaluate cannabis flower maturity. High-resolution macro images were acquired using low-cost smartphone-based systems under greenhouse and laboratory conditions. A two-stage pipeline was implemented: a fine-tuned Faster R-CNN model detected trichomes (Precision: 0.815; Recall: 0.802), while a YOLOv8 classifier categorized them into clear, milky, or amber classes (Accuracy: 98.6%). In parallel, a YOLOv8 segmentation model delineated stigmas (AP50: 52.2%) to compute color ratios as maturity indicators. Features were aggregated at the flower level and correlated with HPLC-measured cannabinoid concentrations. A dataset of over 14,000 images was collected across multiple imaging sessions to support training, evaluation, and correlation experiments. Results demonstrated that stigma coloration—detectable with low-end devices—provides a robust visual indicator of peak chemical maturity, with the green-to-orange transition aligning with maximum cannabinoid concentration. This work offers a scalable, cost-effective solution for real-time maturity assessment in cannabis cultivation, contributing to improved harvest timing and quality control.

Graphical Abstract

1. Introduction

The cannabis plant, with its centuries-long history of medicinal and recreational use, has experienced renewed interest in recent years due to advances in technology and evolving regulatory frameworks. Cannabis cultivation now extends beyond traditional practices to incorporate modern techniques that enhance breeding, production efficiency, and product quality. A critical component in optimizing cultivation is the accurate assessment of flower maturity, which directly influences cannabinoid content and the therapeutic properties of the final product [1,2]. Traditionally, maturity evaluation has relied on manual inspection of key morphological indicators—primarily trichomes and stigmas—using tools such as loupes. Trichomes, the small hair-like structures that envelop the cannabis flower, are known to produce cannabinoids. Their color, transitioning from clear to milky to amber, is commonly used by cultivators to assess chemical maturity and determine optimal harvest timing. In addition, the color of stigmas—typically shifting from white or green to orange or brown—serves as a secondary visual cue. Together, these traits help estimate the flower’s developmental stage and potential quality [3,4].
Typically, farmers who grow cannabis conduct visual inspection of flowers using microscopes and loupes. In such an inspection they count trichomes at various maturity phases [1]. Then, when these counts suggest that the flower is at its peak, the crop is harvested. However, the subjective nature of these visual assessments has often led to inconsistencies and sub-optimal quality. The need for an objective, reproducible method, that can rapidly inspect a larger number of flowers, and produce reliable estimates, is obvious. Figure 1 further illustrates the trichomes and stigmas, highlighting the features used during maturity assessment.
In response to these challenges, this work presents a machine learning-based framework for the automated assessment of cannabis flower maturity. Leveraging low-cost, smartphone-based macro imaging (Figure 2), the proposed approach operates in both greenhouse and laboratory environments without the need for specialized microscopy or laboratory conditions. High-resolution images are acquired using different smartphone models equipped with dedicated macro lenses, ensuring that the variability of lighting, focus, and environmental conditions is adequately captured. Each image is subsequently divided into non-overlapping patches to preserve fine morphological details while reducing computational overhead. A pre-processing stage, based on an edge-detection sharpness metric, filters out regions of low quality, thereby isolating the most informative areas for further analysis.
The core of the proposed pipeline comprises a two-stage process for analyzing trichomes and stigmas. A fine-tuned Faster R-CNN model is employed to detect and localize trichomes within the filtered patches [6], while a YOLO-based classifier, refined on a dedicated trichome dataset, categorizes each detected trichome into one of three classes: clear, milky, or amber [7]. In parallel, stigmas are segmented with a YOLO-based instance-segmentation model. Their color composition is then quantified by a 1-nearest-neighbor (1-NN) classifier, which assigns each stigma pixel to the closest reference pixel in the annotated dataset; the resulting green-to-orange ratio provides an additional maturity indicator. The outputs from these models are aggregated from the patch level to the flower level, resulting in quantitative measures such as the class distribution of trichomes, i.e., the relative proportions of clear, milky, and amber trichomes, and the coloration status of stigmas. These morphological metrics are then statistically correlated with chemical composition data obtained via HPLC [8], thus establishing a direct relationship between visual indicators and cannabinoid profiles. Our findings also suggest that stigma coloration may serve as a useful predictor for flower maturity. In many cases, the transition from green to orange-dominant stigmas coincided with peak cannabinoid levels, indicating its potential as a complementary maturity indicator alongside the trichomes. As stigmas are larger and their color is relatively easy to identify, they are better suited for low-end imaging sensors, and hence, large-scale productization of our methods. This work was carried out in collaboration with RCK Science-Based Cannabis Genetics (https://rckmc.com/ (accessed on 15 April 2025)), a cannabis breeding and propagation company.
This research builds upon related studies in the field of agricultural phenotyping, where machine learning has been applied to count and classify small objects such as trichomes in Arabidopsis thaliana, grape berries, and aphid nymphs [9,10]. By automating the assessment process and integrating it within a real-time cultivation environment, the proposed method aims to improve the precision of harvest timing and enhance breeding strategies. The dataset consists of approximately 15,000 images collected over multiple imaging sessions, with task-specific subsets annotated using a model-assisted workflow to support the detection, segmentation, and classification stages [11].

2. Related Work

We now review relevant related work on object detection and counting in images, on plant phenotyping using images, and on previous efforts for trichome detection.

2.1. Detection, Counting, and Segmentation Techniques in Complex Scenes

Detecting and counting objects of a given type in images can be widely found in many agricultural applications, leveraging popular Convolutional Neural Network (CNN) deep learning techniques.
Chen et al. [10] segment and count aphid nymphs on pakchoi leaves. Al-Saffar et al. [12] and Zabawa et al. [13] developed computer vision-based methods for automated grape recognition and counting to improve vineyard management efficiency. Another study explores the use of deep learning for the automatic detection and classification of 17 cannabis seed varieties, aiming to improve accuracy and efficiency in quality control, regulatory compliance, and genetic research [14]. Teimouri et al. [15] investigate the use of deep learning for the automatic detection and classification of weed species and their growth stages using in situ images to support precision agriculture. In fruit maturity detection, improved YOLOv5 models achieved 97.4% mAP for tomato classification and attention-enhanced YOLOv8 variants reached 98.7% mAP for apple detection [16], while Li et al. [17] reported 97.0% mAP50 for blueberry using an improved YOLOv11n model.
These projects focus mostly on larger, easier-to-segment targets in controlled settings. Our approach instead uses smartphone imaging to detect and classify tiny trichomes and stigmas in situ, directly linking them to cannabis maturity.

2.2. Cannabis-Specific Phenotyping Approaches

Several studies have investigated cannabis flower maturity, trichome development, and cannabinoid dynamics, using a range of manual and automated approaches.
Punja et al. [1] examined the effects of plant age and genotype on trichome development in two high-THC cultivars. Using stereomicroscopy, SEM, and macrophotography, they documented three trichome types and observed that stalked-capitate trichomes were most abundant on mature flowers. Trichome density increased with plant age, accompanied by color transitions and resin secretion. They also reported that post-harvest machine trimming caused significant trichome damage, highlighting the fragility of glandular heads. This detailed manual tracking provided foundational insights into trichome morphology and maturation.
Stoilkovska et al. [5] explored technological maturity by tracking trichome color changes and cannabinoid content at multiple time points before harvest. Flowers were sampled from different greenhouse locations and imaged using a stereomicroscope, classifying trichomes as translucent-milky, yellow-orange, or dark brown. Total THC was measured with HPLC. The study found that THC levels declined over time as the proportion of yellow-orange and dark brown trichomes increased. While trichome color changes followed a consistent pattern, THC levels varied across plant locations, indicating that chemical measurements alone may not reliably indicate maturity. Their reliance on manual classification limited scalability and objectivity.
Sutton et al. [4] introduced an automated deep learning pipeline for trichome segmentation and classification. Using controlled macroscopic and UV fluorescence imaging, they analyzed four commercial cannabis strains over an eight-week flowering period. Trichomes were segmented using the DO-U-Net model, while a k-NN classifier, trained on color and morphological features, categorized trichomes as clear, milky, or brown. This approach enabled the tracking of trichome maturation trends and flower development, demonstrating the potential of deep learning for automating cannabis maturity analysis.
Tran et al. [18] focused on stigma color as a rapid, non-destructive indicator of cannabinoid dynamics. Across 25 genotypes, stigmas were imaged at four maturity stages: white, partial amber, mostly amber, and fully amber. Using a PlantCV RGB/LAB pipeline, they found that cannabinoid concentration peaked at the mostly or fully amber stages for most genotypes, supporting the common heuristic used by growers. However, a few genotypes peaked earlier, emphasizing cultivar-specific differences.
Together, these studies advanced cannabis phenotyping by linking visual traits to chemical maturity. However, they remain limited by manual microscopy [1], manual scoring with chemical validation [5], controlled imaging environments [4], or reliance on stigma color alone [18]. Our work builds on these insights by providing an automated, smartphone-based solution for in situ analysis of both trichomes and stigmas, enabling scalable and objective maturity assessment directly in cultivation environments.

2.3. Trichome Detection and Quantification and Fine-Grain Plant Structure Analysis

Automated trichome detection and quantification have been explored in several crops to replace time-consuming manual phenotyping and support precision agriculture.
Garcia et al. [19] used machine learning with Ilastik and Fiji to quantify trichomes in Arabidopsis thaliana, achieving a strong correlation with manual counting ( r s = 0.982 ) and minimal error (−0.0224). Similarly, Mirnezami et al. [20] applied image processing in MATLAB to soybean leaves, reaching correlations of R 2 = 0.62–0.90 with manual counts. Building on these efforts, Luo et al. [21] evaluated deep learning models for cotton trichome detection, where YOLOv5s achieved 86.30% precision for single trichomes and 97.16% for clusters, while Mask R-CNN provided the highest segmentation accuracy (mAP@0.5 = 96.18%). In a related cotton study, Rolland et al. [22] developed HairNet, a CNN-based system for scoring leaf hairiness, achieving accuracies of up to 95% per leaf across diverse environments. Moving toward field-ready applications, Ueda and Ye [23] introduced a smartphone-based method for tomato nutrient assessment through trichome density, obtaining an AUC-PR of 0.824. Finally, Xu et al. [24] proposed TrichomeYOLO for maize, combining YOLOv5 with Transformer and BiFPN modules, outperforming several baselines with 92.1% identification accuracy and a Pearson correlation of 0.92 with manual counts. For cannabis trichome detection, Zvirin et al. [25] developed a composite method combining YOLOv4 object detection with CNN classifiers to identify non-glandular trichome hairs in microscopic images, achieving 97.6% accuracy by leveraging the characteristic bear-claw shape of cannabis trichomes.
While these studies demonstrate progress in automated trichome quantification, they often rely on microscopes, detached samples, or indirect sampling and focus on density rather than maturity. In contrast, our work analyzes intact cannabis flowers in situ using smartphone imaging, classifying trichomes by color and translucency to estimate flower maturity.

2.4. Summary of Innovations

The reviewed literature demonstrates the growing importance of computer vision in agriculture, highlighting the potential for automated and accessible phenotyping tools. However, most studies rely on specialized equipment, focus on species other than cannabis, or do not explore correlations with chemical data. Our research addresses these gaps by introducing several innovations:
  • A low-cost, smartphone-based imaging framework suitable for greenhouse conditions;
  • An integrated pipeline that combines trichome detection, classification, and stigma segmentation;
  • A direct correlation of these morphological indicators with chemical composition data from HPLC.
Together, these contributions enable scalable, objective, and field-ready maturity assessment in cannabis cultivation, advancing beyond prior cannabis phenotyping approaches.

3. Materials and Methods

3.1. Dataset

This section presents the datasets created and used in this study, each designed to support different aspects of the algorithm’s development, including trichome detection, classification, and stigma segmentation. The datasets were collected through multiple imaging sessions at different timestamps.

3.1.1. Correlation Experiment Datasets

To evaluate the relationship between visual maturity markers and chemical composition, we conducted 2 imaging experiments during 2024–2025, each aligned with a different season. Experiment 1, conducted in late spring to early summer (May–June 2024), involved longitudinal tracking of 30 flowers from 6 cannabis cultivars—611, 616, 805-12, 1416-3, 202, and 901-1—covering THC-dominant, CBD-dominant, and balanced chemotypes [26]. The characteristics of these cultivars are summarized in Table 1.
Each flower was imaged at 7 time points, measured in Days After Flowering (DAF)—the number of days since the plant transitioned from vegetative lighting regime (18:6 light:dark) to reproductive lighting regime (12:12 light:dark)—which is the standard metric for tracking cannabis maturity (DAF 51, 58, 62, 65, 69, 72, 79), in both greenhouse and laboratory settings, capturing 5–10 images per location per timepoint using an iPhone 14 Pro or iPhone 12 with Moment Macro Lens (M series; Moment Inc., Seattle, WA, USA). The resulting dataset contains 5786 images. Trichome visibility began at DAF 58; however, stigmas were detectable from DAF 51 and used accordingly.
Experiment 2 was conducted in early winter (December 2024–January 2025) and aimed to reduce spatial bias by increasing per-flower image coverage. A total of 15 flowers (5 per cultivar) from 616, 805-12, and 1416-3 were sampled at 9 DAFs (45, 49, 52, 57, 64, 71, 77, 80, and 84). Each flower was imaged only once (i.e., not tracked across DAFs), with 25–50 images acquired per location. The image distribution per cultivar for both experiments is presented in Table 2. Combined, the 2 datasets provide 13,130 high-resolution images for algorithm training and correlation analysis.

3.1.2. Trichomes Object Detection Dataset

The trichome detection model was fine-tuned using 512 × 512 pixel patch images extracted and filtered through our pre-processing pipeline. The generated segmentation masks serve as ground truth for training both instance segmentation and object detection models on the trichomes. To develop and evaluate the trichome detection algorithm, a dedicated dataset was created by annotating high-resolution patch images of cannabis flowers. A total of 503 images were annotated and split into 395 images for training and 108 images for testing. Annotations were performed using the Segments.ai framework with model-assisted labeling and stored in COCO format (including segmentation masks and bounding boxes). The dataset was subsequently converted to YOLO format to facilitate fine-tuning of the YOLO models. For details on image acquisition, see Section 3.2.1.

3.1.3. Trichome Image Classification Dataset

To create a dataset for trichome classification, a script was developed using the Faster R-CNN trichome detection model. High-quality images from the first experiment were selected, and the model was used to detect trichomes. The detected bounding boxes were extracted with an expansion of 1.25× their original size, as experimental results indicated that this adjustment led to optimal classification performance. Then, for each bounding box an image was created containing only the identified single trichome.
Following detection and extraction, trichomes were manually annotated into three classes: clear, milky, and amber: 187 amber images, 149 clear images, and 156 milky images, resulting in a total of 492 trichome images for classification.

3.1.4. Stigma Segmentation Dataset

In addition to trichome classification, a dedicated dataset was created to support the segmentation of stigmas in cannabis flowers. High-quality images containing clearly visible stigmas were selected from the first correlation experiment dataset, resulting in a total of 115 images that represent a diverse range of stigma morphologies and color changes. These images were chosen based on criteria such as clarity, contrast, and unobscured presentation of the stigmas. The Segments.ai framework was used to generate annotation masks for the stigmas. The final annotation masks were stored in a standard format (e.g., COCO) to facilitate the development and evaluation of an instance segmentation model. Furthermore, the annotations were converted to YOLO format to enable a direct comparison between Mask R-CNN- and YOLO-based instance segmentation models.
The datasets created in this study are summarized in Table 3.

3.2. Methodology

This subsection details the methodology used to detect and classify trichomes and to segment and calculate the color ratio of stigmas for assessing the maturity of cannabis. The overall approach is divided into two main parts: the experimental setup and the image-analysis process.

3.2.1. Experiment Setup

Experiments were conducted in collaboration with RCK Science-Based Cannabis Genetics, a cannabis breeding company, and the manufacturer of vegetative varieties and F1 hybrid seeds. In these experiments, diverse cannabis cultivars were cultivated to investigate the relationship between flower morphology and chemical composition. Flowers were imaged under both outdoor greenhouse conditions and controlled laboratory environments following harvest, while HPLC provided quantitative chemical profiles. Our algorithm was employed to extract temporal statistics of trichomes and stigmas, facilitating correlation analysis between morphological changes and HPLC results.
High-resolution images of cannabis flowers were captured using two smartphone devices to ensure a diverse dataset and assess the generalization of our approach. We used an iPhone 14 Pro and an iPhone 12, each equipped with a Moment [27] Macro Lens M series. The iPhone 14 Pro, with a native 3× optical zoom combined with the lens’s 10× magnification, achieved an effective zoom of approximately 30×, while the iPhone 12, with a 2× optical zoom, yielded 20×. To ensure optimal image quality, we used the CameraPixels [28] application to automatically adjust ISO, focus, and shutter exposure based on settings determined through extensive testing. In the greenhouse, imaging sessions were conducted at consistent times each day (typically morning hours) to maintain comparable natural lighting conditions. In the laboratory, an adjustable LED desk lamp was positioned to provide uniform illumination of the flower samples. The auto-exposure functionality of CameraPixels dynamically compensated for variations in ambient illumination, enabling the collection of high-quality images across diverse lighting conditions. Images were captured in both outdoor greenhouse conditions and a controlled laboratory environment after harvesting, providing varied lighting scenarios to support robust model generalization. Detailed imaging configurations and counts are further described in Section 3.1.
The trichomes and stigmas were annotated by generating segmentation masks that delineate their boundaries, serving as ground truth for training instance segmentation models. The entire annotation process was performed using the Segments.ai [11] framework with model-assisted labeling. Initially, 50 objects were manually annotated to bootstrap the process, after which the best-performing model’s latest checkpoint was used to automatically annotate new images. These model-generated annotations, which include both segmentation masks and corresponding bounding boxes formatted in the COCO standard, were then manually reviewed and corrected directly within Segments.ai. This iterative workflow of automated annotation, manual correction, and model fine-tuning ensured a faster and more cost-effective annotation process while providing ground truth for both instance segmentation and object detection models.

3.2.2. Image Analysis Process

This section outlines the image analysis pipeline that transforms high-resolution images of cannabis flowers into quantitative measures of trichome composition. Each image is first divided into non-overlapping 512 × 512 pixel patches, which preserves fine details while reducing computational complexity. A pre-processing stage then filters out low-detail or blurry patches using a sharpness detection method, with the aim of passing primarily high-quality regions to subsequent stages. Next, a fine-tuned Faster R-CNN model is applied to detect trichomes within the filtered patches. Detected trichomes are subsequently classified into one of three categories—clear, milky, or amber—using a YOLOv8 model that has been fine-tuned on a curated dataset of high-quality trichome images. Finally, the classification results are aggregated at the flower level (and further by cultivar and capture day) to compute statistical measures of the relative proportions of each trichome category. Detailed descriptions of each step are provided in the following subsections. The overall pipeline architecture is illustrated in Figure 3.

3.2.3. Filtering Image Patches

Each high-resolution image is divided into non-overlapping 512 × 512 pixel patches using the SAHI slicing algorithm [29] to preserve trichome and stigma details and reduce computational complexity. A pre-processing stage is then applied to filter out blurry or low-detail patches, with the aim of forwarding primarily high-quality regions for subsequent processing. This step is particularly crucial because the images capture very tiny objects at macro scales, making it challenging to obtain uniformly sharp images across the entire frame.
To achieve effective filtering, several sharpness detection methods—namely, gradient-based, Laplacian-based, edge-based, Tenengrad-based, FFT-based, and contrast-based approaches—were evaluated. Among these, the Canny edge-based sharpness function was selected as the most effective [30]. In this approach, the image is first converted to grayscale, and the Canny edge detector is applied with thresholds of 100 and 200 to highlight edges. The sharpness score is computed as the ratio of the sum of detected edge pixel intensities to the total number of pixels, thereby estimating the average edge intensity per pixel, with higher scores indicative of sharper, more detailed patches. By employing the edge-based method, the filtering process aims to preferentially forward patches with sufficient detail and clarity to the subsequent trichome detection stage. Figure 4 illustrates this patch cutting, filtering, and extraction pipeline.

3.2.4. Identify Trichomes in Patches

Trichomes are detected within the filtered patches using a fine-tuned Faster R-CNN model with a ResNet-50 backbone and a C4 head variant [6]. The model was fine-tuned on a dedicated annotated dataset of 512 × 512 pixel patch images. Annotations for this dataset were generated using the Segments.ai framework and stored in COCO format (including segmentation masks and bounding boxes). The training procedure employed the following hyperparameters: a batch size of 2 images per iteration, a base learning rate of 0.00025, and a maximum of 100 epochs with no learning rate decay; additionally, the ROI heads were configured with a per-image batch size of 512. Model weights were initialized from a pre-trained checkpoint obtained from the model zoo, and training was conducted using the DefaultTrainer from the detectron2 framework. After fine-tuning, the model was applied to the filtered patch images to generate bounding boxes that delineate regions containing trichomes (Figure 5), which are then used for subsequent classification. Detailed evaluation of the detection models is presented in Section 4.1.1.

3.2.5. Classify Identified Trichomes

The detected trichome images are classified into one of three categories—clear, milky, or amber—using a YOLOv8 X-Large model [7]. A dedicated trichome classification dataset was created by first extracting high-quality trichome images from the first experiment using the Faster R-CNN detection model. Detected bounding boxes were expanded by 1.25× (i.e., padded) to capture additional contextual information, and for each bounding box an image was generated containing a single trichome. These images were then manually annotated into three classes, resulting in a total of 492 images (187 amber, 149 clear, and 156 milky).
The YOLOv8 X-Large classifier was fine-tuned on this dataset using Ultralytics’ training pipeline with built-in augmentations. The training procedure employed base hyperparameters including 10 epochs, an image size of 128, and augmentation settings such as ±10° rotation, 10% translation, a scaling factor ranging from 0.5× to 1.5×, vertical and horizontal flip probabilities of 0.5, and HSV adjustments (hue 0.015, saturation 0.7, and brightness 0.4). Pre-trained weights from the Ultralytics YOLOv8 model were refined during fine-tuning to optimize the model’s ability to discriminate among the three trichome classes (Figure 6). Details of the model evaluation are provided in Section 4.1.1.

3.2.6. Computing Final Statistics

The classification results from individual patches are first aggregated by counting the detected trichomes in each category (clear, milky, and amber) from the pre-processed patches. These patch-level counts are then summed to obtain image-level totals, and all image-level counts corresponding to a single flower are aggregated to yield flower-level trichome counts. After this aggregation, the counts for each trichome class are normalized by the total trichome count to compute relative ratios. These normalized ratios are further grouped by cannabis cultivar and by day of capture (Figure 7). Finally, the resulting flower-level relative trichome ratios are used to perform correlation analysis with the HPLC results measured during the experiment days, thereby providing insights into the relationship between trichome distribution and chemical composition.

3.2.7. Segmentation of Stigmas and Color Ratio Computation

To assess stigma maturation, we implemented a two-stage pipeline that combines instance segmentation with pixel-wise color classification. First, a YOLOv8-small segmentation model was fine-tuned on 115 high-resolution stigma images using default training parameters from the Ultralytics framework. Training employed 100 epochs, an image size of 640 × 640 pixels, and standard data augmentations including rotation, scaling, translation, and HSV color shifts. After fine-tuning, the model was applied to RGB images of cannabis flowers to segment individual stigma regions. Each segmented stigma was extracted and processed independently. To quantify color maturity, we used a 1-nearest-neighbor (1-NN) classifier in RGB space, comparing each pixel to reference distributions of green (immature) and orange (mature) stigma colors derived from annotated examples. For each segmented stigma, the ratio of orange to green pixels was computed, and then aggregated across the image to provide a quantitative estimate of stigma maturity. The stigma processing pipeline is shown in Figure 8, and Figure 9 provides a detailed visualization of example outputs at each stage of the complete pipeline. Representative examples of this pixel-level classification are presented in the correlation experiment results (Section 4.2.1 and Section 4.2.3), illustrating the progressive shift from green-dominant (immature) to orange-dominant (mature) classification across cultivars and growth stages.

3.3. Evaluation Metrics

Our model performs three main tasks: detecting trichomes in cannabis flower images, classifying detected trichomes into three categories—clear, milky, and amber—and segmenting individual stigmas. To evaluate the performance of these tasks, we use a combination of metrics tailored to each task.
Detection performance is evaluated using precision and recall, where precision is the proportion of correctly detected trichomes out of all detections, and recall is the proportion of ground truth trichomes that were successfully detected. These metrics are defined as follows:
Precision d = T P d T P d + F P d ,
Recall d = T P d T P d + F N d ,
where T P d , F P d , and F N d denote the true positives, false positives, and false negatives in the detection task, respectively.
For the trichome classification task, the model categorizes each detected trichome into one of three classes: clear (c), milky ( c l ), and amber (a). For each class i { c ,   c l ,   a } , precision and recall are computed as
Precision i = T P i T P i + F P i ,
Recall i = T P i T P i + F N i ,
And overall accuracy is defined as
Accuracy = T P c + T P c l + T P a N ,
where T P i corresponds to the true positives for class i, and N is the total number of predictions.
Weighted average precision and recall are computed by weighting each class’s score by its support s i (i.e., the number of instances in class i; clear: 149, milky: 156, and amber: 187). The weighted metrics are defined as
Precision = i { c ,   c l ,   a } s i   Precision i i { c ,   c l ,   a } s i ,
Recall = i { c ,   c l ,   a } s i   Recall i i { c ,   c l ,   a } s i .
The F1-score, which provides a single metric that balances precision and recall, is computed as the harmonic mean of these two measures:
F 1 = 2 · Precision · Recall Precision + Recall .
For the stigma segmentation task, segmentation quality is quantified using AP50, the Average Precision computed at an Intersection over Union (IoU) threshold of 0.5. First, the Intersection over Union (IoU) between the predicted stigma segmentation mask and the corresponding ground truth mask is computed as
I o U p = A p A g t A p A g t ,
where A p denotes the area of the predicted mask, and A g t denotes the area of the ground truth mask. A P 50 is defined as the area under the precision–recall curve when detections are considered correct if their Intersection over Union (IoU) exceeds 0.5. Formally, we write the following:
A P 50 = 0 1 p ( r )   d r ,
where p ( r ) represents the precision at a given recall level r, computed using a fixed IoU threshold of 0.5. (In this formulation, the IoU threshold is implicit in the A P 50 notation, and the precision–recall curve is obtained by varying the model’s confidence threshold).
To quantify how accurately visual markers forecast the timing of maximum cannabinoid concentration, we report the root-mean-square error (RMSE) between the predicted peak day t ^ j for flower j and the corresponding laboratory-determined peak t j . Let
e j   =   t ^ j t j ,
so that e j > 0 indicates a late prediction, and e j < 0 indicates an early one. The RMSE over M flowers is then
RMSE   =   1 M   j = 1 M e j 2 .

4. Results

This section systematically evaluates our computer vision pipeline, examining the detection, classification, and segmentation stages using previously defined metrics. Additionally, correlations between visual maturity indicators and cannabinoid concentrations are assessed to validate the pipeline’s practical utility for predicting optimal harvest timing.
We first report the accuracy of our pipeline, compared with fine-tuned off-the-shelf object detection models. We trained a set of models to detect trichomes and classify them as clear, milky, or amber, and then we compare them to our multi-step pipeline. Table 4 shows the result of this experiment. While we experimented with dozens of models, we report results only for the best performing model of each family. As can be seen, our multi-step pipeline clearly outperforms all single-stage models in both precision and recall. This highlights the benefit of filtering blurry regions, and decoupling detection and classification. This is particularly manifested for minimizing false positives and distinguishing the subtle differences between trichome maturity classes.
To better understand the behavior of our pipeline, we now analyze the different suggested steps and discuss the sensitivity analysis.

4.1. Evaluating the Pipeline Steps

This section presents an evaluation of each component of our trichome analysis pipeline. We assess the performance of the detection, classification, and segmentation steps using the metrics defined previously.

4.1.1. Trichome Detection Results

In the first stage of our evaluation, we compared several state-of-the-art (SOTA) object detection models for locating cannabis trichomes. We evaluated the following models: RT-DETR (X-Large), YOLOv5 (X-Large), YOLOv8 (X-Large), YOLOv9 (Compact), Mask R-CNN (ResNet-50 FPN, 3× schedule), Mask R-CNN (ResNeXt-101 FPN, 3× schedule), Faster R-CNN (ResNet-50 C4, 1× schedule), and Faster R-CNN (ResNet-50 DC5, 1× schedule). Performance was measured at an IoU threshold of 0.5. Table 5 presents the overall precision and recall metrics for each model.
Table 5 summarizes the evaluation metrics for this single-class setting with an IoU threshold of 0.5. Although high recall is essential to ensure that nearly all trichomes are extracted for further processing, high precision is equally important. This is because false positive detections, i.e., objects that are not trichomes, cannot be effectively filtered out in the subsequent classification stage, where the classifier is fine-tuned only on the three actual classes (clear, milky, and amber). Building on these insights, we explored a two-stage strategy that decouples detection and classification: a detection model, fine-tuned solely on trichomes, focuses on their unique features to enhance localization, while a dedicated image classification model assigns precise labels to the extracted regions.
The table reveals that although RTDETR achieves high precision (0.875 at IoU = 0.5), its recall is comparatively lower. In contrast, the YOLO-based models demonstrate a balanced performance but are outperformed by the Faster R-CNN R50-C4 1x model, which attains a precision of 0.815 and a recall of 0.802 at an IoU threshold of 0.5. High recall is essential to ensure that nearly all trichomes are extracted, while high precision is equally important to prevent false positives—detections of non-trichome objects—which could introduce noise into the subsequent classification stage, as the classifier is fine-tuned only on the actual classes (clear, milky, and amber). Consequently, the optimal balance offered by Faster R-CNN R50-C4 1x renders it the preferred choice for further experiments.

4.1.2. Trichomes Image Classification Results

In this experiment, we evaluated the performance of multiple image classification models on the task of categorizing trichome images into three classes: clear, milky, and amber. We first established a performance baseline using classic convolutional neural network architectures (e.g., AlexNet, ResNet, DenseNet, SqueezeNet, VGG, and ResNeXt). Subsequently, we extended the comparison by assessing advanced YOLO-based models that integrate object detection with classification. These models leverage spatial context and robust feature extraction, potentially enhancing the differentiation among the subtle visual characteristics of the trichome classes.
Prior to training, all trichome images were resized to 128 pixels, and data augmentation was applied to enhance generalizability. The augmentation parameters included rotations (±10°), random translations (up to 10% of image size), rescaling (factors ranging from 0.5× to 1.5×), flips (vertical and horizontal with a probability of 0.5), and random adjustments to hue, saturation, and brightness. All models were fine-tuned for 10 epochs using a batch size of 32 and a learning rate of 1 × 10 4 . To ensure robust and generalizable findings, we used five independent random train/validation splits (75% training; 25% validation) on a dataset of 492 trichome images, with each class split independently to preserve class balance.
Table 6 presents the averaged precision, recall, and accuracy scores for both the classic and YOLO-based models. The classic models achieved accuracy values ranging from approximately 0.8537 to 0.9610, with AlexNet achieving the highest performance at around 0.960. In contrast, the YOLO-based models consistently attained higher metrics, with accuracy values exceeding 0.97 across the board. Notably, the YOLOv8 variants—especially the X-Large model—achieved the best overall performance. These improvements suggest that integrating object detection with classification enhances the capture of spatial context and subtle feature differences, thereby yielding more accurate predictions.
Overall, the superior performance of the YOLO-based models—particularly the YOLOv8 X-Large variant—demonstrates its potential as an effective solution for trichome image classification. The integration of detection and classification enhances the model’s ability to capture spatial and contextual information, leading to more accurate and reliable predictions. Table 7 presents the normalized confusion matrix for the YOLOv8 X-Large model, showing per-class classification accuracy. Consequently, YOLOv8 X-Large was selected for the subsequent experiments on trichome–cannabinoid correlations.

4.1.3. Stigmas Instance Segmentation Results

We evaluated the segmentation of cannabis stigmas by comparing two families of instance segmentation models: Mask R-CNN variants and YOLO-based segmentation models. The Mask R-CNN experiments included models with a ResNet-50 backbone and Feature Pyramid Network (FPN) (3× training schedule), a similar configuration with ResNet-101, a model with a ResNeXt-101 (32 × 8d) backbone and FPN, as well as variants using a ResNet-50 backbone with either C4 or DC5 configurations. In parallel, YOLO-based segmentation models were fine-tuned on the same dataset using 50 epochs and a batch size of eight. For the YOLO models, the hyperparameters were determined automatically using the ‘optimizer = auto’ setting, which ignored the initial values of lr0 = 0.01 and momentum = 0.937. The selected configuration employed the AdamW optimizer with a learning rate of 0.002, momentum of 0.9, and distinct weight decay settings. All models were trained and evaluated on a dataset of 115 images containing annotated stigmas, collected across multiple shooting days during the first correlation experiment. The dataset was split into training and testing sets in a 0.75:0.25 ratio, and performance was assessed using the COCOEvaluator from the detectron2 framework and the YOLO Ultralytics evaluation framework to compute AP50 (Average Precision at an IoU threshold of 0.5).
Table 8 summarizes the AP50 results for the Mask R-CNN models and the best-performing YOLO-based segmentation models. Among the YOLO-based models, the top four were YOLOv8 Small (52.12%), YOLOv8 Medium (47.47%), YOLOv11 Small (45.14%), and YOLOv8 Nano (42.44%), indicating that the smaller models tend to perform better on this task.
Figure 10 illustrates the performance characteristics of the best YOLO-based model trained for stigma segmentation. The confidence score represents the model’s predicted probability that a detection is correct; varying this threshold controls the trade-off between precision and recall. The recall–confidence curve (Figure 10b) and precision–confidence curve (Figure 10c) highlight a common trade-off: at lower confidence thresholds, the model captures more stigma instances (recall ∼0.6), albeit with reduced precision (around 0.4). This is acceptable for our application, where even blurry segments contribute meaningfully to stigma color ratio estimation.
The precision–recall curve (Figure 10a) further reflects this balance, showing moderate segmentation quality with an AP50 of 0.522. These results support the use of a relatively low confidence threshold to ensure that enough stigma segments are detected, maximizing the utility of downstream color-based analysis tasks.

4.2. Correlation Experiments Results

This section reports on 2 experiments that examined the relationships between visual maturity markers in cannabis flowers and cannabinoid concentrations measured by HPLC. All plots presented in this section were generated from images captured in greenhouse settings, reflecting natural conditions rather than highly controlled environments.

4.2.1. Experiment 1 (Late Spring–Early Summer 2024)

Figure 11, Figure 12 and Figure 13 present representative pipeline outputs across three flowering stages (DAF 51, 65, and 79) for all six cultivars. Figure 11 shows trichome detection with class-specific bounding boxes, Figure 12 shows stigma segmentation masks, and Figure 13 shows the pixel-level color classification of extracted stigmas. These visual results illustrate the progression captured by the pipeline, which is quantified in the correlation analysis below.
To quantify the trends observed in the qualitative figures above, we plotted the normalized ratios of clear, milky, and amber trichomes together with total cannabinoid levels over time for each cultivar. A regression fit was applied to visualize the trends of these variables as a function of Days After Flowering (DAF), as shown in Figure 14.
Across all cultivars, regression fits show that milky trichomes consistently peak near the maximum total cannabinoid level (purple dashed line). For example, in 805-12 and 611 (see Figure 14a,e) the milky trichome apex coincides with the cannabinoid peak, highlighting their value as a maturity marker. In contrast, in 1416-3 and 616 (see Figure 14c,f) the rise in amber trichomes begins only after cannabinoids decline, suggesting these trichomes indicate post-peak maturity. Likewise, the clear trichome ratio declines throughout flowering, reflecting early developmental stages.
Figure 15 illustrates the temporal evolution of amber trichome ratios and Total THC concentrations across six cannabis cultivars, measured over six distinct shooting days. Each subplot presents a regression fit over the data points, capturing the dynamic relationship between morphological maturation—represented by the proportion of amber trichomes—and chemical maturation as reflected by lab-measured Total THC levels.
To ensure robustness and comparability across timepoints and cultivars, we focused our analysis on the period during which trichome structures were reliably detectable.
Notably, several cultivars, such as 901-1 (Figure 15b) and 611 (Figure 15e), display a generally increasing trend in amber trichomes over time, suggesting continued trichome maturation. However, the corresponding Total THC trajectories are not consistently aligned. For example, in 616 (Figure 15f), Total THC levels peaked early and declined thereafter despite increasing amber trichome ratios. Conversely, in 202 (Figure 15d), both amber trichome ratios and THC levels exhibit a fluctuating pattern over time, indicating a more complex and less synchronized maturation process.
To further quantify the relationships between visual trichome maturity and chemical composition, we computed Pearson correlation coefficients between normalized trichome class ratios (clear, milky, and amber) and cannabinoid concentrations (Total THC, CBD, CBG, and Total Cannabinoids) for each cultivar, as shown in Figure 16.
Consistent with the trends observed in Figure 14 and Figure 15, milky and amber trichomes tend to exhibit moderate-to-positive correlations with cannabinoid variables in several cultivars. For example, in 805-12 (Figure 16a), both milky and amber trichomes correlate positively with Total THC and Total Cannabinoids (e.g., r = 0.49 and r = 0.51 , respectively), supporting the visual impression that cannabinoid content increases during trichome maturation. Similarly, 202 (Figure 16d) shows a strong positive correlation between milky trichomes and all cannabinoid measures.
In contrast, clear trichomes generally show negative correlations with cannabinoid concentrations, particularly in 805-12, 202, and 1416-3 (Figure 16c), aligning with the expectation that immature trichomes appear in earlier developmental stages before cannabinoid accumulation peaks.
However, these correlations are not consistent across all cultivars. For instance, 616 (Figure 16f) shows a weak or even inverse relationship between amber trichomes and cannabinoid levels (e.g., r = 0.41 with Total THC), highlighting variability in trichome-to-cannabinoid dynamics between genotypes.
Overall, the correlation matrix reinforces earlier observations while also underscoring the genotype-dependent nature of these relationships. Although trichome coloration can serve as a maturity proxy, its predictive value for chemical composition is not universal and may require calibration per cultivar.
We initially hypothesized that stronger and more consistent correlations would emerge between trichome class ratios and cannabinoid levels—particularly expecting milky trichomes to align closely with THC peaks. However, the results of Experiment 1 revealed only moderate and inconsistent trends across genotypes, prompting the design of a second experiment.
In addition to trichome analysis, we also examined the temporal dynamics of stigma coloration in relation to cannabinoid accumulation. Figure 13 provides qualitative examples of the 1-NN pixel-level classification for individual stigmas across all six cultivars, visually demonstrating the green-to-orange transition at early, mid, and late flowering stages. Figure 17 presents normalized green (immature) and orange (mature) stigma color ratios across Days After Flowering (DAF), together with normalized total cannabinoid levels. All trends are represented by regression fits applied to the data: green and orange stigma ratios are shown as solid lines, while total cannabinoids are indicated by a dashed purple line.
Across all six cultivars, a consistent pattern emerges: green stigma ratios steadily decline while orange stigmas increase over time. Importantly, the point at which these two curves intersect—signaling the visual transition from immature to mature stigmas—closely aligns with the peak in total cannabinoid concentrations in most cases.
This alignment is especially clear in 805-12, 1416-3, 611, and 616 (Figure 17a,c,e,f), where the crossover of stigma color ratios nearly coincides with the cannabinoid peak. In 901-1 and 202 (Figure 17b,d), a similar relationship is observed, although the curves are slightly more staggered. Overall, this supports the hypothesis that the visual transition from green to orange stigmas serves as a reliable indicator of peak chemical maturity.

4.2.2. Predicting Best Harvest Day

Our method is aimed at helping farmers make informed decisions about the optimal day to harvest a cannabis plant—i.e., the point at which maturity and cannabinoid concentration are likely to be maximized. An inspection of Figure 17 suggests that this optimal timing may correlate with the proportion of orange stigmas. More precisely, when approximately 50% of the visible stigma area appears orange, the flower tends to reach its peak in terms of chemical quality. We now provide a more formal investigation of this approach.
In general, one can construct a machine learning method for such a task. Such a method would take as input features such as the portion of orange stigmas, the proportion of amber and milky trichomes, the number of days since flowering, and other relevant indicators, and output a prediction of the number of days remaining until the flower reaches its peak chemical maturity. However, machine learning methods require a significant number of examples to construct a trustworthy model. The data at our disposal, containing 30 plants overall, is insufficient for machine learning training.
We hence opted for a simpler approach that uses a threshold over a single feature to predict harvest timing. We tested three image-derived features: the portion of orange stigmas, the portion of amber trichomes, and the portion of milky trichomes, all estimated using our methods. As a baseline for comparison, we used the average day from flowering across all experimental sampling dates. Specifically, we took the mean of all Days After Flowering (DAF) used in the experiment—51, 58, 62, 65, 69, 72, and 79—resulting in a baseline harvest prediction of 65 DAF. This value was used as the predicted harvest day for all flowers, regardless of their individual traits.
Table 9 shows the results of this experiment, reporting the distance (RMSE) between the predicted harvest day and the day where the chemical maturity was maximal.
We estimated the lab-measured peak day of (i) total cannabinoids for all cultivars, (ii) THC for the four THC-dominant cultivars (1416-3, 611, 901-1, 616), and (iii) CBD for cultivar 805-12. Table 9 reports, for each of these three targets, the optimal single feature threshold t * and the resulting RMSE (in days) of four simple estimators: predicting the overall average day and the first day where the ratio of the identified feature (orange stigmas, milky trichomes, and amber trichomes) exceeded the threshold ( t * ).
As can be seen in Table 9, the feature that best predicts the point of maximal chemical maturity is the portion of orange stigmas, which provides substantially lower error than the milky or amber trichomes. This can be attributed, in part, to the much higher difficulty in reliably identifying trichomes as opposed to stigmas, which are much larger, using the low-end imaging equipment that we suggest (smartphones). The distinction between milky and clear trichomes is also much more difficult than the distinction between green and orange stigmas.
Although the portion of orange stigmas provides a better estimator than the trichomes, still just taking the mean day from flowering (day 65) provides a better estimator. To better understand prediction performance, we examined the individual prediction errors for the orange stigma method. For every plant, we calculated the signed difference between the threshold-predicted day and the lab-determined cannabinoid peak day; negative values indicate early predictions, while positive values denote late predictions. Table 10 shows the signed errors for each flower based on the orange-stigma threshold predictor.
Looking at Table 10 reveals four pronounced outliers, defined here as | error | > 4 days. Most stemmed from either sampling imbalance with certain flowers having less focused images at critical timepoints or warm overall image tones that biased our color-ratio estimation. Excluding those four plants and recomputing yields dramatically tighter accuracy. The error (RMSE) of the orange stigma predictor dropped to 1.83 (total C), 2.41 (THC), and 1.5 (CBD), compared to 2.57, 3.84, and 1.96 (respectively) for the average day predictor.
To conclude, we believe that our orange stigma method provides a strong predictor for the best harvest day. Still, larger scale experiments are needed to verify these findings.

4.2.3. Experiment 2 (Early Winter 2024-25)

These results mark a shift from the mixed and genotype-dependent correlations seen in Experiment 1, indicating that improved image sampling and annotation protocols may yield more biologically coherent relationships between visual and chemical indicators of maturity. Figure 18 and Figure 19 present representative trichome detection and stigma segmentation results for the three Experiment 2 cultivars across early, mid, and late flowering stages.
Figure 20 shows the corresponding 1-NN pixel-level stigma color classification for Experiment 2, confirming the same green-to-orange maturation pattern observed in Experiment 1. Figure 21 presents the Pearson correlation coefficients between trichome class ratios and cannabinoid concentrations for the three cultivars. To further illustrate the relationships highlighted in the correlation matrix, Figure 22 presents the temporal progression of milky trichome ratios versus total cannabinoids (left column) and amber trichome ratios versus THC (right column), plotted across Days After Flowering (DAF) for the three cultivars analyzed in Experiment 2.
In 805-12 (Figure 22a,b), milky trichomes steadily decrease throughout the flowering period, closely paralleling the decline in total cannabinoid levels after a peak near 50–55 DAF. This aligned trajectory reinforces the notion that milky trichomes reflect the active cannabinoid biosynthesis phase. Amber trichomes, in contrast, increase in later DAF stages while THC concentrations fall, echoing the strong negative correlation seen in Figure 16a.
For 1416-3 (Figure 22c,d), milky trichomes drop sharply early in the flowering period and show fluctuations thereafter, mirroring trends in total cannabinoids. Amber trichome levels, meanwhile, increase notably past 70 DAF as THC levels decline, consistent with a post-peak maturity signal.
In 616 (Figure 22e,f), the milky trichome trajectory dips early and remains relatively stable mid-to-late cycle, while cannabinoid concentrations also show a downward trend. Amber trichomes, however, rise steeply at the end of the flowering period, once again opposing the trend in THC, reinforcing their role as a late-stage maturity indicator.
Overall, these temporal patterns reinforce the hypothesis that milky trichomes may correspond with the cannabinoid production phase, while amber trichomes reflect post-peak or senescent stages. This complementary perspective strengthens the argument for using a combined trichome profile—rather than a single class—as a visual proxy for chemical maturity.
Figure 20 presents representative examples of the 1-NN stigma color classification for the three Experiment 2 cultivars, confirming the same green-to-orange maturation pattern observed in Experiment 1. The stigma maturation trends observed in Experiment 2 mirror the general pattern seen in Experiment 1, with green stigmas gradually giving way to orange stigmas as the flowering stage progresses. However, a key distinction emerges in the timing: in this second experiment, the transition from green to orange stigmas occurred slightly earlier and was more closely aligned with the cannabinoid biosynthesis phase. As shown in Figure 23, the inflection point, where orange stigmas begin to dominate over green, appears consistently around 55–60 Days After Flowering (DAF) across all three cultivars: 805-12, 1416-3, and 616. This timing closely coincides with the peak of total cannabinoid levels (purple dashed lines), supporting the notion that stigma color transitions can serve as a visual cue for chemical maturity.
This relationship parallels the findings of Experiment 1, where the crossover point between green and orange stigmas was also observed near peak cannabinoid concentration across most cultivars. Taken together, these observations suggest that stigma color dynamics, particularly the transition zone, may reliably indicate the optimal harvest window in terms of cannabinoid content.
Harvest day estimation was not performed for Experiment 2, as flowers were not tracked longitudinally, and no per-plant peak cannabinoids measurements were available.

5. Discussion

Our empirical evaluation demonstrates that the proposed pipeline effectively processes smartphone macro lens images to assess cannabis maturity. In the detection phase, various state-of-the-art models were compared at an IoU threshold of 0.5. The Faster R-CNN R50-C4 model achieved the best balance between precision and recall, which is crucial for capturing nearly all trichomes while minimizing false positives that could introduce noise in later stages. Although some YOLO-based detectors showed promising results, their variability in recall limited their standalone utility in this context.
The classification stage further underscored the pipeline’s strength. By integrating object detection with classification, the YOLO-based models, particularly the YOLOv8 X-Large variant, delivered accuracy, precision, and recall values exceeding 0.98. This high performance confirms that the model effectively differentiates between the subtle visual characteristics of trichomes, an essential requirement given the small and closely clustered nature of these features.
For stigma segmentation, performance was measured using AP50. Despite the inherent challenges of segmenting stigmas from variable image conditions, YOLO-based segmentation models, especially YOLOv8 Small, achieved an AP50 of approximately 52.2%. While moderate, this performance was sufficient for extracting meaningful regions for subsequent analyses, such as computing color ratios indicative of stigma maturity.
Correlation experiments further validated the practical relevance of our method. In Experiment 1, the initial analysis across six cannabis cultivars revealed moderate associations between visual trichome features and cannabinoid levels measured by HPLC. Milky trichomes tended to display positive relationships with indicators of chemical maturity, while amber trichomes generally exhibited negative associations, suggestive of a post-peak maturity phase. In Experiment 2, an improved sampling protocol applied to three selected cultivars produced clearer and more consistent trends: the positive relationship between milky trichomes and total cannabinoid concentrations became more evident, and the negative correlation of amber trichomes with chemical markers was reinforced. It should be noted that the experiments were conducted during both spring and winter, and these seasonal differences may have influenced the observed trends. Overall, these trends indicate that the visual indicators captured by our pipeline can serve as effective proxies for chemical maturity.
Stigma color analysis in Experiment 1 showed a gradual transition from green (immature) to orange (mature), which in some cases coincided with peaks in milky trichome ratios and was closely aligned with the peak cannabinoid levels. Furthermore, in Experiment 2, stigma analysis revealed a consistent shift from green to orange between 50 and 57 Days After Flowering across the tested cultivars, with the crossover point of the green and orange ratios occurring near the maximum total cannabinoid concentration. This consistency reinforces the potential of combined visual indicators as proxies for chemical maturity.

Limitations and Future Directions

This study represents a proof-of-concept demonstrating the feasibility of smartphone-based cannabis maturity assessment. Our preliminary findings are encouraging, but the limited scope—six cultivars, a single greenhouse, and two smartphone models—constrains generalizability. The stigma segmentation model was trained on only 115 images, and correlations between visual features and cannabinoid levels varied across cultivars.
Analysis of detection failures (Figure 24) revealed that image quality—rather than model capacity—was the primary limiting factor. Out-of-focus frames, motion blur, and shallow depth of field accounted for most missed detections (Figure 24a–d), while imaging angle variability led to inconsistent counts from the same plant (110 vs. 4 detections; Figure 24e,f). These findings suggest that the pipeline’s accuracy can be substantially improved through better image acquisition protocols or automated quality filtering, without requiring changes to the underlying models.
Future research should validate these findings with substantially more plants per cultivar, diverse growing environments, and a wider range of imaging devices to establish robust, genotype-independent maturity prediction models. Incorporating image quality assessment as a preprocessing step—automatically rejecting blurry or out-of-focus frames—could substantially improve pipeline reliability.
In summary, the evaluation confirms that our low-cost, smartphone-based imaging system combined with advanced computer vision techniques can reliably extract visual features that correlate with cannabis maturity. Despite challenges related to the detection of small, densely clustered trichomes and variations in imaging conditions, the overall performance of the pipeline supports its potential as a practical decision support tool for optimizing harvest timing.

6. Conclusions

This study presents a cost-effective method for assessing cannabis flower maturity using smartphone macro imaging combined with computer vision. The pipeline applies patch-based preprocessing, Faster R-CNN for trichome detection, and YOLO for classification, enabling automated extraction of trichome and stigma features that correlate with cannabinoid concentrations measured by HPLC.
Across two experiments, we observed consistent trends: Milky trichomes aligned with peak cannabinoid levels, while amber trichomes indicated post-peak stages. The transition of stigmas from green to orange closely coincided with peak cannabinoid concentration, underscoring their value as a complementary maturity indicator.
Unlike prior cannabis phenotyping studies that depend on microscopy or specialized equipment, our approach demonstrates that accurate maturity assessment is feasible with readily available smartphone technology. This democratizes access to precision cultivation tools and provides growers with a rapid, non-destructive way to optimize harvest timing.
Future work should expand datasets across more cultivars and environments and test the pipeline directly in greenhouse workflows. Despite ongoing challenges in detecting small, clustered trichomes and variability across genotypes, this study represents a step toward scalable, field-ready maturity assessment in cannabis cultivation.

Author Contributions

E.L.: Algorithmic exploration and implementation, Data collection, Tagging, Writing. S.L.: Conceptualization, Domain expertise, Data collection, Writing, Funding. P.G.: Domain expertise, Data collection. G.S.: Conceptualization, Algorithmic exploration, Writing, Funding. All authors have read and agreed to the published version of the manuscript.

Funding

This research was partially funded by the Israeli Innovation Authority, under grant number 8114581.

Data Availability Statement

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

Acknowledgments

During the preparation of this work, the authors used ChatGPT (GPT-4o; OpenAI, San Francisco, CA, USA) to improve the clarity and readability of Section 1 and Section 5. After using this tool, the authors reviewed and edited the content as needed and take full responsibility for the content of the published article.

Conflicts of Interest

Author Dr. Silit Lazare and Mrs. Polina Golshmid were employed by the company RCK Science-Based Cannabis Genetics, Prof. Guy Shani was employed by the company Microsoft. The remaining author declares that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.

References

  1. Punja, Z.K.; Sutton, D.B.; Kim, T. Glandular trichome development, morphology, and maturation are influenced by plant age and genotype in high THC-containing cannabis (Cannabis sativa L.) inflorescences. J. Cannabis Res. 2023, 5, 12. [Google Scholar] [CrossRef] [PubMed]
  2. Linder, E.R.; Young, S.; Li, X.; Henriquez Inoa, S.; Suchoff, D.H. The effect of harvest date on temporal cannabinoid and biomass production in the floral hemp (Cannabis sativa L.) cultivars BaOx and cherry wine. Horticulturae 2022, 8, 959. [Google Scholar] [CrossRef]
  3. Tanney, C.A.; Backer, R.; Geitmann, A.; Smith, D.L. Cannabis glandular trichomes: A cellular metabolite factory. Front. Plant Sci. 2021, 12, 721986. [Google Scholar] [CrossRef]
  4. Sutton, D.; Punja, Z.K.; Hamarneh, G. Characterization of Trichome Phenotypes to Assess Maturation and Flower Development in Cannabis sativa L. (Cannabis) by Automatic Trichome Gland Analysis. Smart Agric. Technol. 2023, 3, 100111. [Google Scholar] [CrossRef]
  5. Stoilkovska Gjorgievska, V.; Cvetkovikj Karanfilova, I.; Trajkovska, A.; Karapandzova, M.; Bauer Petrovska, B.; Kulevanova, S.; Stefkov, G. Monitoring of Cannabis Cultivar Technological Maturity by Trichome Morphology Analysis and HPLC Phytocannabinoid Content. Pharmacogn. Res. 2023, 15, 94–100. [Google Scholar] [CrossRef]
  6. Ren, S.; He, K.; Girshick, R.; Sun, J. Faster R-CNN: Towards real-time object detection with region proposal networks. IEEE Trans. Pattern Anal. Mach. Intell. 2016, 39, 1137–1149. [Google Scholar] [CrossRef] [PubMed]
  7. Jocher, G.; Chaurasia, A.; Qiu, J. YOLO by Ultralytics. Version 8.0.0. 2023. Available online: https://github.com/ultralytics/ultralytics (accessed on 15 April 2025).
  8. Valdes-Donoso, P.; Sumner, D.A.; Goldstein, R. Costs of cannabis testing compliance: Assessing mandatory testing in the California cannabis market. PLoS ONE 2020, 15, e0232041. [Google Scholar] [CrossRef]
  9. Boominathan, L.; Kruthiventi, S.S.; Babu, R.V. Crowdnet: A deep convolutional network for dense crowd counting. In Proceedings of the 24th ACM International Conference on Multimedia; ACM Press: New York, NY, USA, 2016; pp. 640–644. [Google Scholar]
  10. Chen, J.; Fan, Y.; Wang, T.; Zhang, C.; Qiu, Z.; He, Y. Automatic segmentation and counting of aphid nymphs on leaves using convolutional neural networks. Agronomy 2018, 8, 129. [Google Scholar] [CrossRef]
  11. Segments.ai. Available online: https://segments.ai/ (accessed on 15 April 2025).
  12. Al-Saffar, B.; Arica, S.; Tangolar, S. Automatic counting of grapes from vineyard images. Pak. J. Agric. Sci. 2022, 59, 347–355. [Google Scholar] [CrossRef]
  13. Zabawa, L.; Kicherer, A.; Klingbeil, L.; Töpfer, R.; Kuhlmann, H.; Roscher, R. Counting of grapevine berries in images via semantic segmentation using convolutional neural networks. ISPRS J. Photogramm. Remote Sens. 2020, 164, 73–83. [Google Scholar] [CrossRef]
  14. Islam, T.; Sarker, T.T.; Ahmed, K.R.; Lakhssassi, N. Detection and Classification of Cannabis Seeds Using RetinaNet and Faster R-CNN. Seeds 2024, 3, 456–478. [Google Scholar] [CrossRef]
  15. Teimouri, N.; Dyrmann, M.; Nielsen, P.R.; Mathiassen, S.K.; Somerville, G.J.; Jørgensen, R.N. Weed growth stage estimator using deep convolutional neural networks. Sensors 2018, 18, 1580. [Google Scholar] [CrossRef]
  16. Ma, J.; Li, M.; Fan, W.; Liu, J. State-of-the-Art Techniques for Fruit Maturity Detection. Agronomy 2024, 14, 2783. [Google Scholar] [CrossRef]
  17. Li, X.; Shi, J.; Li, Y.; Wang, C.; Sun, W.; Zhuo, Z.; Yue, X.; Ni, J.; Tan, K. Blueberry Maturity Detection in Natural Orchard Environments Using an Improved YOLOv11n Network. Agriculture 2025, 16, 60. [Google Scholar] [CrossRef]
  18. Tran, J.; Dimech, A.M.; Vassiliadis, S.; Elkins, A.C.; Cogan, N.O.; Naim-Feil, E.; Rochfort, S.J. Determination of Optimal Harvest Time in Cannabis sativa L. Based upon Stigma Color Transition. Plants 2025, 14, 1532. [Google Scholar] [CrossRef]
  19. Garcia, A.; Talavera-Mateo, L.; Santamaria, M.E. An automatic method to quantify trichomes in Arabidopsis thaliana. Plant Sci. 2022, 323, 111391. [Google Scholar] [CrossRef]
  20. Mirnezami, S.V.; Young, T.; Assefa, T.; Prichard, S.; Nagasubramanian, K.; Sandhu, K.; Sarkar, S.; Sundararajan, S.; O’Neal, M.E.; Ganapathysubramanian, B.; et al. Automated trichome counting in soybean using advanced image-processing techniques. Appl. Plant Sci. 2020, 8, e11375. [Google Scholar] [CrossRef]
  21. Luo, K.; Jin, Y.; Wen, S.; Li, Y.; Rong, J.; Ding, M. Detection and quantification of cotton trichomes by deep learning algorithm. Comput. Electron. Agric. 2023, 210, 107936. [Google Scholar] [CrossRef]
  22. Rolland, V.; Farazi, M.R.; Conaty, W.C.; Cameron, D.; Liu, S.; Petersson, L.; Stiller, W.N. HairNet: A deep learning model to score leaf hairiness, a key phenotype for cotton fibre yield, value and insect resistance. Plant Methods 2022, 18, 8. [Google Scholar] [CrossRef]
  23. Ueda, S.; Ye, X. A Smartphone-Based Method for Assessing Tomato Nutrient Status through Trichome Density Measurement. IEEE Access 2024, 12, 171304–171327. [Google Scholar] [CrossRef]
  24. Xu, J.; Yao, J.; Zhai, H.; Li, Q.; Xu, Q.; Xiang, Y.; Liu, Y.; Liu, T.; Ma, H.; Mao, Y.; et al. TrichomeYOLO: A Neural Network for Automatic Maize Trichome Counting. Plant Phenomics 2023, 5, 0024. [Google Scholar] [CrossRef] [PubMed]
  25. Zvirin, A.; Shapira, A.; Attal, E.; Gozlan, T.; Soussan, A.; De La Vega, D.; Harush, Y.; Kimmel, R. Identification of non-glandular trichome hairs in cannabis using vision-based deep learning methods. J. Forensic Sci. 2025, 70, 1315–1328. [Google Scholar] [CrossRef]
  26. Lazare, S.; Golshmid, P.; Krassin, A.; Simhon, E.; Cohen, T.L.; Dag, A. Grafting of Cannabis–The effect of the rootstock on vegetative and reproductive indices of the scion. Plant Sci. 2024, 348, 112210. [Google Scholar] [CrossRef] [PubMed]
  27. Moment. Moment Macro Lens M Series. Available online: https://www.shopmoment.com/products/10x-macro-lens (accessed on 15 April 2025).
  28. CameraPixels. CameraPixels Application. Available online: https://camerapixels.app (accessed on 15 April 2025).
  29. Akyon, F.C.; Altinuc, S.O.; Temizel, A. Slicing aided hyper inference and fine-tuning for small object detection. In Proceedings of the 2022 IEEE International Conference on Image Processing (ICIP); IEEE: New York, NY, USA, 2022; pp. 966–970. [Google Scholar]
  30. Canny, J. A computational approach to edge detection. IEEE Trans. Pattern Anal. Mach. Intell. 1986, PAMI-8, 679–698. [Google Scholar] [CrossRef]
Figure 1. Cannabis flower maturity indicators. (a) Macro photograph with stigmas labeled. (b) Schematic diagram of stigma and trichome locations. (c) Trichome color progression: clear (immature), milky (peak potency), and amber (degradation). Images adapted from [5].
Figure 1. Cannabis flower maturity indicators. (a) Macro photograph with stigmas labeled. (b) Schematic diagram of stigma and trichome locations. (c) Trichome color progression: clear (immature), milky (peak potency), and amber (degradation). Images adapted from [5].
Agriculture 16 00460 g001
Figure 2. Imaging approaches used in this study. (Top row): (left) traditional loupe-based assessment in greenhouse, (right) smartphone-based macro imaging in greenhouse. (Bottom): controlled laboratory imaging setup for post-harvest analysis, showing the LED desk lamp illumination and smartphone with macro lens attachment.
Figure 2. Imaging approaches used in this study. (Top row): (left) traditional loupe-based assessment in greenhouse, (right) smartphone-based macro imaging in greenhouse. (Bottom): controlled laboratory imaging setup for post-harvest analysis, showing the LED desk lamp illumination and smartphone with macro lens attachment.
Agriculture 16 00460 g002
Figure 3. Schematic flowchart of the proposed dual-path pipeline. Images are processed through trichome detection/classification and stigma segmentation paths, with results aggregated at the flower level for HPLC correlation.
Figure 3. Schematic flowchart of the proposed dual-path pipeline. Images are processed through trichome detection/classification and stigma segmentation paths, with results aggregated at the flower level for HPLC correlation.
Agriculture 16 00460 g003
Figure 4. Patch cutting, filtering, and extraction pipeline. Each image is divided into non-overlapping patches, which are filtered for sharpness before extracting high-detail regions for trichome analysis.
Figure 4. Patch cutting, filtering, and extraction pipeline. Each image is divided into non-overlapping patches, which are filtered for sharpness before extracting high-detail regions for trichome analysis.
Agriculture 16 00460 g004
Figure 5. Trichome detection pipeline. High-resolution image patches are analyzed by a fine-tuned Faster R-CNN model to detect and localize trichomes.
Figure 5. Trichome detection pipeline. High-resolution image patches are analyzed by a fine-tuned Faster R-CNN model to detect and localize trichomes.
Agriculture 16 00460 g005
Figure 6. Trichome classification pipeline. Detected trichomes are classified into clear, milky, or amber classes using a fine-tuned YOLOv8 model.
Figure 6. Trichome classification pipeline. Detected trichomes are classified into clear, milky, or amber classes using a fine-tuned YOLOv8 model.
Agriculture 16 00460 g006
Figure 7. Flower-level trichome analysis pipeline. Classification results are aggregated across patches to compute the overall distribution of trichome types at the flower level.
Figure 7. Flower-level trichome analysis pipeline. Classification results are aggregated across patches to compute the overall distribution of trichome types at the flower level.
Agriculture 16 00460 g007
Figure 8. Stigma segmentation and analysis pipeline. Stigmas are segmented from the image, extracted, and classified by color using 1-NN-based pixel-level classification to compute maturity statistics.
Figure 8. Stigma segmentation and analysis pipeline. Stigmas are segmented from the image, extracted, and classified by color using 1-NN-based pixel-level classification to compute maturity statistics.
Agriculture 16 00460 g008
Figure 9. Detailed visualization of the proposed pipeline showing example outputs at each processing stage. (Upper path): trichome detection and classification into clear, milky, and amber categories. (Lower path): stigma segmentation and color ratio computation. Both paths aggregate results to produce flower-level maturity indicators.
Figure 9. Detailed visualization of the proposed pipeline showing example outputs at each processing stage. (Upper path): trichome detection and classification into clear, milky, and amber categories. (Lower path): stigma segmentation and color ratio computation. Both paths aggregate results to produce flower-level maturity indicators.
Agriculture 16 00460 g009
Figure 10. Performance curves for the best YOLO-based model on stigma segmentation. (a) Precision–recall. (b) Recall–confidence. (c) Precision–confidence.
Figure 10. Performance curves for the best YOLO-based model on stigma segmentation. (a) Precision–recall. (b) Recall–confidence. (c) Precision–confidence.
Agriculture 16 00460 g010
Figure 11. Trichome detection results across the flowering period for all six cannabis cultivars in Experiment 1. Columns represent early (DAF 51), mid (DAF 65), and late (DAF 79) flowering stages. Bounding boxes indicate detected trichomes with color-coded classification: blue (clear), orange (milky), and purple (amber).
Figure 11. Trichome detection results across the flowering period for all six cannabis cultivars in Experiment 1. Columns represent early (DAF 51), mid (DAF 65), and late (DAF 79) flowering stages. Bounding boxes indicate detected trichomes with color-coded classification: blue (clear), orange (milky), and purple (amber).
Agriculture 16 00460 g011
Figure 12. Stigma segmentation results across the flowering period for all six cannabis cultivars in Experiment 1. Columns represent early (DAF 51), mid (DAF 65), and late (DAF 79) flowering stages. Blue overlays indicate detected stigma instances (bounding boxes and segmentation masks).
Figure 12. Stigma segmentation results across the flowering period for all six cannabis cultivars in Experiment 1. Columns represent early (DAF 51), mid (DAF 65), and late (DAF 79) flowering stages. Blue overlays indicate detected stigma instances (bounding boxes and segmentation masks).
Agriculture 16 00460 g012
Figure 13. Stigma color classification using 1-NN pixel-level analysis for all six cannabis cultivars in Experiment 1. Each panel shows the original extracted stigma (left) alongside its classified color map (right), where green pixels indicate immature tissue, and orange pixels indicate mature tissue. The progressive shift from green-dominant to orange-dominant classification reflects advancing maturity across DAF 51, 65, and 79.
Figure 13. Stigma color classification using 1-NN pixel-level analysis for all six cannabis cultivars in Experiment 1. Each panel shows the original extracted stigma (left) alongside its classified color map (right), where green pixels indicate immature tissue, and orange pixels indicate mature tissue. The progressive shift from green-dominant to orange-dominant classification reflects advancing maturity across DAF 51, 65, and 79.
Agriculture 16 00460 g013
Figure 14. Normalized ratios of clear (gray), milky (green), and amber (orange) trichomes alongside total cannabinoid levels (purple dashed line) across Days After Flowering (DAF) for six cannabis cultivars. Solid lines represent regression fits; shaded regions indicate 95% confidence intervals.
Figure 14. Normalized ratios of clear (gray), milky (green), and amber (orange) trichomes alongside total cannabinoid levels (purple dashed line) across Days After Flowering (DAF) for six cannabis cultivars. Solid lines represent regression fits; shaded regions indicate 95% confidence intervals.
Agriculture 16 00460 g014
Figure 15. Changes in amber trichome ratios and Total THC concentrations across six cannabis cultivars throughout Experiment 1. Each subplot represents a single cultivar. Solid lines represent regression fits; shaded regions indicate 95% confidence intervals.
Figure 15. Changes in amber trichome ratios and Total THC concentrations across six cannabis cultivars throughout Experiment 1. Each subplot represents a single cultivar. Solid lines represent regression fits; shaded regions indicate 95% confidence intervals.
Agriculture 16 00460 g015
Figure 16. Pearson correlation coefficients between normalized trichome class ratios and cannabinoid concentrations across cannabis cultivars. Each subplot represents a distinct cultivar. Color scale ranges from blue (negative correlation) through white (zero) to red (positive correlation).
Figure 16. Pearson correlation coefficients between normalized trichome class ratios and cannabinoid concentrations across cannabis cultivars. Each subplot represents a distinct cultivar. Color scale ranges from blue (negative correlation) through white (zero) to red (positive correlation).
Agriculture 16 00460 g016
Figure 17. Normalized green (immature) and orange (mature) stigma color ratios across Days After Flowering (DAF). Solid lines represent regression fits; shaded regions indicate 95% confidence intervals. Purple dashed lines represent normalized total cannabinoid levels.
Figure 17. Normalized green (immature) and orange (mature) stigma color ratios across Days After Flowering (DAF). Solid lines represent regression fits; shaded regions indicate 95% confidence intervals. Purple dashed lines represent normalized total cannabinoid levels.
Agriculture 16 00460 g017
Figure 18. Trichome detection results for Experiment 2 (winter growing season; December–January). The extended flowering period resulted in greater amber trichome development compared to Experiment 1. Bounding boxes indicate detected trichomes: blue (clear), orange (milky), and purple (amber).
Figure 18. Trichome detection results for Experiment 2 (winter growing season; December–January). The extended flowering period resulted in greater amber trichome development compared to Experiment 1. Bounding boxes indicate detected trichomes: blue (clear), orange (milky), and purple (amber).
Agriculture 16 00460 g018
Figure 19. Stigma segmentation results for Experiment 2 (winter growing season; December–January). Columns represent early (DAF 45), mid (DAF 57), and late (DAF 84) flowering stages. Blue overlays indicate detected stigma instances (bounding boxes and segmentation masks).
Figure 19. Stigma segmentation results for Experiment 2 (winter growing season; December–January). Columns represent early (DAF 45), mid (DAF 57), and late (DAF 84) flowering stages. Blue overlays indicate detected stigma instances (bounding boxes and segmentation masks).
Agriculture 16 00460 g019
Figure 20. Stigma color classification using 1-NN pixel-level analysis for three cannabis cultivars in Experiment 2. Each panel shows the original extracted stigma (left) alongside its classified color map (right), where green pixels indicate immature tissue, and orange pixels indicate mature tissue. The progressive shift from green-dominant to orange-dominant classification reflects advancing maturity across DAF 45, 57, and 84.
Figure 20. Stigma color classification using 1-NN pixel-level analysis for three cannabis cultivars in Experiment 2. Each panel shows the original extracted stigma (left) alongside its classified color map (right), where green pixels indicate immature tissue, and orange pixels indicate mature tissue. The progressive shift from green-dominant to orange-dominant classification reflects advancing maturity across DAF 45, 57, and 84.
Agriculture 16 00460 g020
Figure 21. Correlation matrices between trichome class ratios and cannabinoid concentrations across three cultivars in Experiment 2. Each subplot represents a distinct cultivar. Color scale ranges from blue (negative correlation) through white (zero) to red (positive correlation).
Figure 21. Correlation matrices between trichome class ratios and cannabinoid concentrations across three cultivars in Experiment 2. Each subplot represents a distinct cultivar. Color scale ranges from blue (negative correlation) through white (zero) to red (positive correlation).
Agriculture 16 00460 g021
Figure 22. Temporal relationship between trichome class ratios and cannabinoid concentrations for each cultivar in Experiment 2. (Left column): milky trichomes vs. total cannabinoids. (Right column): amber trichomes vs. THC. Solid lines represent regression fits; shaded regions indicate 95% confidence intervals.
Figure 22. Temporal relationship between trichome class ratios and cannabinoid concentrations for each cultivar in Experiment 2. (Left column): milky trichomes vs. total cannabinoids. (Right column): amber trichomes vs. THC. Solid lines represent regression fits; shaded regions indicate 95% confidence intervals.
Agriculture 16 00460 g022
Figure 23. Temporal evolution of normalized stigma color ratios and total cannabinoid levels across Days After Flowering (DAF) for three cultivars in Experiment 2. Green and orange lines represent regression fits for green and orange stigma ratios, respectively, while the purple dashed line represents a regression fit for total cannabinoids. Shaded regions indicate 95% confidence intervals.
Figure 23. Temporal evolution of normalized stigma color ratios and total cannabinoid levels across Days After Flowering (DAF) for three cultivars in Experiment 2. Green and orange lines represent regression fits for green and orange stigma ratios, respectively, while the purple dashed line represents a regression fit for total cannabinoids. Shaded regions indicate 95% confidence intervals.
Agriculture 16 00460 g023
Figure 24. Detection failure modes caused primarily by image quality issues. (Top row): (a) Early flowering with immature/sparse trichomes (Cultivar 202, Exp1). (b) Out-of-focus image resulting in zero detections (Cultivar 805, Exp1). (c) Shallow depth of field limiting detections to narrow in-focus band (Cultivar 1416, Exp1). (Bottom row): (d) Motion blur causing detection failure despite late flowering stage (Cultivar 616, Exp2). (e,f) Same plant, same day showing detection variability (110 vs. 4 trichomes) due to imaging angle and focus differences (Cultivar 805, Exp1).
Figure 24. Detection failure modes caused primarily by image quality issues. (Top row): (a) Early flowering with immature/sparse trichomes (Cultivar 202, Exp1). (b) Out-of-focus image resulting in zero detections (Cultivar 805, Exp1). (c) Shallow depth of field limiting detections to narrow in-focus band (Cultivar 1416, Exp1). (Bottom row): (d) Motion blur causing detection failure despite late flowering stage (Cultivar 616, Exp2). (e,f) Same plant, same day showing detection variability (110 vs. 4 trichomes) due to imaging angle and focus differences (Cultivar 805, Exp1).
Agriculture 16 00460 g024
Table 1. Characteristics of cannabis cultivars used in the correlation experiments.
Table 1. Characteristics of cannabis cultivars used in the correlation experiments.
VarietyChemotypePhenotypeFlower Color
805-12High CBDSativaGreen
901-1Mid THCSativaPurple
1416-3High THCIndicaGreen
202BalancedIndicaGreen
611High THCIndicaGreen
616High THCSativaGreen
Table 2. Image distribution per cultivar in the correlation experiments.
Table 2. Image distribution per cultivar in the correlation experiments.
ExperimentVarietyImages
Experiment 1202941
6111007
616950
805-12966
901-1902
1416-31020
Subtotal5786
Experiment 26162327
805-122583
1416-32434
Subtotal7344
Total13,130
Table 3. Summary of datasets created in this study.
Table 3. Summary of datasets created in this study.
DatasetNumber of Images
Correlation Experiments
 Experiment 1 (Late Spring–Early Summer 2024)5786
 Experiment 2 (Early Winter 2024-25)7344
Trichome Datasets
 Detection (Training + Testing)503
 Classification (Total)492
  Amber187
  Clear149
  Milky156
Stigma segmentation115
Overall Total14,240
Table 4. Pipeline vs. best single-stage models at IoU = 0.5.
Table 4. Pipeline vs. best single-stage models at IoU = 0.5.
ModelPrecisionRecallF1
Our Approach (FRCNN + YOLOv8 X-Large)0.8030.7900.796
YOLOv9 (Compact)0.5820.6200.600
Mask R-CNN (ResNeXt-101 FPN, 3x)0.6680.6030.634
Faster R-CNN (ResNet-50 DC5, 1x)0.6230.6780.649
YOLO-NAS (Large)0.4540.5510.498
RT-DETR (X-Large)0.4800.7060.572
Bold values indicate the best-performing approach.
Table 5. Single-class fine-tuned trichome detection performance at IoU = 0.5.
Table 5. Single-class fine-tuned trichome detection performance at IoU = 0.5.
ModelPrecisionRecallF1
RT-DETR (X-Large)0.8750.5960.709
YOLOv5 (X-Large)0.7410.7590.750
YOLOv8 (X-Large)0.7270.7570.742
YOLOv9 (Compact)0.7870.7380.762
Mask R-CNN (ResNet-50 FPN, 3x)0.7930.8130.803
Mask R-CNN (ResNeXt-101 FPN, 3x)0.7570.8380.795
Faster R-CNN (ResNet-50 C4, 1x)0.8150.8020.808
Faster R-CNN (ResNet-50 DC5, 1x)0.8420.7760.808
Table 6. Single trichome maturity classification results for classic and YOLO-based models.
Table 6. Single trichome maturity classification results for classic and YOLO-based models.
ModelPrecisionRecallAccuracyF1
Classic Models
AlexNet0.96100.96000.96000.9605
ResNet340.94610.94610.94610.9461
DenseNet1690.94610.94610.94610.9461
DenseNet1210.94550.94550.94550.9455
SqueezeNet1_10.94160.94160.94160.9416
DenseNet2010.94030.94030.94030.9403
VGG16_bn0.93780.93780.93780.9378
ResNeXt101_32 × 8d0.93390.93390.93390.9339
VGG19_bn0.91660.91660.91660.9166
ResNet500.91270.91270.91270.9127
ResNeXt50_32 × 4d0.89160.89160.89160.8916
ResNet1010.88200.88200.88200.8820
ResNet1520.87880.87880.87880.8788
Wide ResNet101_20.87620.87620.87620.8762
Wide ResNet50_20.85370.85370.85370.8537
YOLO-based Models
YOLOv8 Nano0.97790.97760.97760.9778
YOLOv8 Small0.98060.98010.98010.9804
YOLOv8 Medium0.98150.98070.98070.9811
YOLOv8 Large0.98160.98140.98140.9815
YOLOv8 X-Large0.98610.98590.98590.9860
YOLOv11 Nano0.97900.97880.97880.9789
YOLOv11 Small0.98290.98270.98270.9828
YOLOv11 Medium0.97400.97370.97370.9739
YOLOv11 Large0.98490.98460.98460.9848
YOLOv11 X-Large0.98360.98330.98330.9835
Table 7. Normalized confusion matrix for YOLOv8 X-Large model. Values represent row-normalized percentages, averaged across 5 independent train/validation splits.
Table 7. Normalized confusion matrix for YOLOv8 X-Large model. Values represent row-normalized percentages, averaged across 5 independent train/validation splits.
Predicted
ClearMilkyAmber
Actualclear99.4%0.3%0.3%
milky1.0%97.4%1.6%
amber0.0%0.6%99.4%
Table 8. Stigma instance segmentation performance (AP50) for Mask R-CNN and YOLO-based models.
Table 8. Stigma instance segmentation performance (AP50) for Mask R-CNN and YOLO-based models.
ModelAP50 (%)
Mask R-CNN Models
Mask R-CNN R50-C4 3×37.94
Mask R-CNN R50-DC5 3×41.33
Mask R-CNN R50-FPN 3×40.85
Mask R-CNN R101-FPN 3×42.86
Mask R-CNN X101-32 × 8d-FPN 3×36.93
YOLO-based Models
YOLOv8 Small52.20
YOLOv8 Medium47.47
YOLOv11 Small45.14
YOLOv11 Medium44.14
Bold values indicate the best-performing model.
Table 9. Optimal thresholds ( t * ) and RMSE for single-feature harvest-day estimators, by target.
Table 9. Optimal thresholds ( t * ) and RMSE for single-feature harvest-day estimators, by target.
Total CTHCCBD
Predictor Feature t * RMSE t * RMSE t * RMSE
Average Day3.564.023.56
Orange stigmas0.404.540.404.420.363.40
Milky Trichomes0.577.760.557.940.744.24
Amber Trichomes0.048.680.057.420.0310.28
Bold values indicate the best-performing estimator for each target.
Table 10. Signed errors (days) between the stigma-based peak prediction and the laboratory-determined peak for each flower in Experiment 1.
Table 10. Signed errors (days) between the stigma-based peak prediction and the laboratory-determined peak for each flower in Experiment 1.
VarietyPlant 1Plant 2Plant 3Plant 4Plant 5
805-120−700−3
202040−314
616−300−30
611000−7−11
901-144000
1416-3−110000
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

Lorberboym, E.; Lazare, S.; Golshmid, P.; Shani, G. Estimating Cannabis Flower Maturity in Greenhouse Conditions Using Computer Vision. Agriculture 2026, 16, 460. https://doi.org/10.3390/agriculture16040460

AMA Style

Lorberboym E, Lazare S, Golshmid P, Shani G. Estimating Cannabis Flower Maturity in Greenhouse Conditions Using Computer Vision. Agriculture. 2026; 16(4):460. https://doi.org/10.3390/agriculture16040460

Chicago/Turabian Style

Lorberboym, Etay, Silit Lazare, Polina Golshmid, and Guy Shani. 2026. "Estimating Cannabis Flower Maturity in Greenhouse Conditions Using Computer Vision" Agriculture 16, no. 4: 460. https://doi.org/10.3390/agriculture16040460

APA Style

Lorberboym, E., Lazare, S., Golshmid, P., & Shani, G. (2026). Estimating Cannabis Flower Maturity in Greenhouse Conditions Using Computer Vision. Agriculture, 16(4), 460. https://doi.org/10.3390/agriculture16040460

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop