Skip to content

Applied Research

Grapevine AI

What Grapevine AI Is Grapevine AI is a web application that uses computer vision to detect and count grapevine buds and berries from vineyard photographs. It takes field images as…

Where it fits

Computer Vision for Viticulture

Highlights

  • YOLOv8 Object Detection
  • Bud-to-Fruit Conversion Analysis
  • Batch Processing & PDF Reports
  • University of Naples Federico II

What Grapevine AI Is

Grapevine AI is a web application that uses computer vision to detect and count grapevine buds and berries from vineyard photographs. It takes field images as input, runs them through a trained YOLOv8 object detection model, and returns accurate counts for each class. From those counts, the system computes bud-to-fruit conversion ratios, runs regression analysis per treatment group, and generates PDF reports that an agronomy team can use for early yield prediction.

The project was built by Omer Mustafa, founder of Bornbee, as the applied research component of his Master’s thesis in Data Science at the University of Naples Federico II (Universita degli Studi di Napoli Federico II), titled “Grapevine AI: A YOLOv8-Based Web Application for Early Yield Prediction and Bud-to-Fruit Conversion Analysis.”

Grapevine AI dashboard showing dataset overview, object detection status, growth analysis, and export reports
The Grapevine AI dashboard: a single interface for uploading images, running detection, analyzing growth ratios, and exporting reports.

The Research Problem

Estimating grapevine yield before harvest is critical for vineyard management, but the traditional method is manual counting. Agronomists photograph grape clusters at two stages: pre-flowering (when buds are visible) and fruit-set (when berries have formed). They then count each bud and berry by hand, often across hundreds of images, to calculate fertility potential and fruit-set ratios.

This process is slow, error-prone, and does not scale. A single vineyard experiment can produce over 120 sample images across multiple plants, shoots, and clusters, each needing individual counts. The question our research addressed: can object detection automate the counting step reliably enough to replace manual visual estimation?

The experimental dataset came from a real vineyard study comparing irrigated and non-irrigated treatments. For every plant in the experiment, two shoots were sampled, and for each shoot, two clusters were photographed. The images captured both buds (inflorescences in pre-flowering) and berries (post fruit-set), providing the paired data needed for conversion analysis.


Detection: How the Model Was Built

Dataset and Labeling

The dataset consists of 697 vineyard images across two classes: buds and berries. All images were manually labeled using Roboflow, with bounding box annotations for every visible bud and berry. Data augmentation (flip and rotate) was applied during training to improve robustness. The dataset was exported in both YOLO format (for YOLOv8/YOLOv11 training) and COCO format (for DETR experiments).

Irrigated and non-irrigated images were treated as a single unified dataset for detection purposes, following guidance from the project’s agricultural science coordinator. The treatment split was only relevant during the original field experiment; for training the detection model, all images contributed equally.

Model Benchmarking

We trained and compared three detection architectures on the same annotated dataset to identify the best approach for our specific task of counting small, densely packed objects in natural field conditions:

ModelPrecisionRecall[email protected][email protected]:0.95Notes
YOLOv80.80570.69210.75910.3725Best overall, reliable counting
DETR (HuggingFace)—0.0110.022—Struggles with small objects
OWL-ViT (zero-shot)————Not effective without fine-tuning

YOLOv8 was the clear winner. After 100 epochs of training at image size 640 with GPU acceleration, it achieved strong results across both classes:

ClassPrecisionRecall[email protected][email protected]:0.95
Berries0.9060.8320.8980.503
Fruit buds0.7910.5870.6750.304
Overall0.8480.7090.7860.404

Berry detection performed strongly with 90.6% precision and 89.8% [email protected]. Bud detection was more challenging due to smaller object sizes and visual similarity between buds and background structures, but still achieved 79.1% precision. The model was capable of detecting up to 222 buds in a single image, a significant leap from the 3 to 5 buds identified in early training iterations.

DETR, fine-tuned via HuggingFace, underperformed on our dataset because it struggles with small-object detection at the scales present in vineyard imagery. OWL-ViT, tested in zero-shot mode with prompts like “bud” and “berry,” confirmed that generic vision-language models are not effective for this specialized agricultural domain without task-specific fine-tuning.


Yield Prediction: From Counts to Ratios

Once the detection model produces reliable bud and berry counts, the next step is yield prediction through regression analysis. The system merges YOLO detection counts with treatment metadata and computes bud-to-fruit conversion ratios, the core metric that agronomists use to assess fruit-set potential.

The regression module aggregates counts by Bunch ID, sums buds and fruits per cluster, computes conversion ratios, and produces scatter plots with regression lines per treatment group. Current linear model performance showed R-squared of approximately 0.14, MAE of around 36.6, and RMSE of approximately 43.2. These numbers reflected the limited dataset size at the time of thesis submission; a power estimate indicated that approximately 157 samples per treatment group would be needed for stable inference. Further work with expanded datasets, additional variables like nitrogen levels and weather data, and ensemble methods like Random Forest and Gradient Boosting were identified as improvement paths.


The Web Application

Grapevine AI is not just a trained model. It is a fully functional web application built to be usable by an agronomy team without any machine learning knowledge. The application was deployed at grapevine.bornbee.com and provides three core workflows:

Single Analysis

Upload one vineyard image, and the system runs YOLOv8 inference to detect and count all buds or berries visible in the photograph. The output includes detection overlays showing bounding boxes on the original image, plus numerical counts per class.

Grapevine AI single analysis showing YOLOv8 detection with bounding boxes on buds, counting 129 buds
Single Analysis: the model detected 129 buds in this vineyard photograph, with each detection marked by a bounding box overlay.

Batch Analysis

Upload a ZIP file organized into folders for flowers and berries, under irrigated and non-irrigated treatments. The application processes every image in the batch, runs detection, and returns a structured CSV or Excel file with columns for Bunch ID, Image ID, Treatment, Flowers count, and Berries count.

Grapevine AI batch analysis showing 108 processed images with Bunch ID, Treatment, Flowers, and Berries columns
Batch Analysis: 108 images processed in one run, with structured results showing flower and berry counts per bunch and treatment.

Report Generation

Upload the batch analysis CSV, and the system aggregates results by Bunch ID, sums buds and fruits, computes bud-to-fruit conversion ratios, and generates a PDF report. The report includes scatter plots and regression lines per treatment group, plus a summary CSV. This is the deliverable that replaces the manual counting and Excel-based analysis that agronomists traditionally perform.

Grapevine AI report generation showing PDF report and summary CSV download options after successful generation
Report Generation: upload a batch CSV and the system produces a downloadable PDF report with regression plots and a summary CSV.

Technical Architecture

LayerTechnology
Detection modelYOLOv8 (Ultralytics)
TrainingGoogle Colab + Kaggle (GPU)
AnnotationRoboflow (YOLO + COCO export)
Web frameworkDjango
ContainerizationDocker (local + server)
DeploymentCapRover on Bornbee infrastructure
AnalysisPython (pandas, matplotlib, scikit-learn)
Output formatsPDF reports, CSV/Excel, detection overlays
Dataset697 annotated images (2024 and 2025 field seasons)
Model weightsYOLOv8 best.pt (Oct 2025, final training)

The full project package, including datasets, model weights, Docker deployment configurations, web application source code, and all Colab notebooks, was submitted as part of the thesis handover in January 2026.


Timeline

The project spanned approximately eight months of active research and development:

PeriodWork
May 2025Thesis supervision request accepted by Prof. Flora Amato. Initial materials received from Dr. Antonello Bonfante
June 2025Dataset organization, manual labeling of 200+ bud images in Roboflow, first YOLOv8 training runs
July 2025YOLOv8 and YOLOv11 training on unified 697-image dataset. Berry precision reached 90.6%
August 2025HuggingFace experiments: DETR fine-tuning and OWL-ViT zero-shot benchmarking
September 2025Introduction to Dr. Bonfante. Regression modeling for yield prediction. Final model benchmarks
October 2025Web application development: single analysis, batch processing, report generation
November 2025Django app deployed via Docker on CapRover. Demo shared with supervisors. Thesis writing
December 2025 to January 2026Thesis finalization, full handover package submitted to Prof. Amato

Supervision and Acknowledgments

Grapevine AI would not have been possible without the guidance and support of two exceptional academic supervisors who shaped every stage of the research.

Prof. Flora Amato, thesis supervisor at the University of Naples Federico II, provided the academic direction and research framework that shaped the entire project. From her course on “Hardware and Software Architectures for Big Data” to her patient supervision of the thesis itself, Prof. Amato’s mentorship was instrumental in transforming a practical engineering idea into a rigorous academic contribution. Omer is deeply grateful for her availability, her constructive feedback on every draft, and her trust in encouraging an applied research direction that bridged computer science and agricultural science.

Dr. Antonello Bonfante, Senior Researcher in Hydropedology at the National Research Council of Italy (CNR-ISAFOM) and a member of the Regional Observatory on Precision Agriculture of the Campania Region, served as co-supervisor and project coordinator. Dr. Bonfante provided the experimental dataset, the agricultural science context, and the domain expertise that made the detection and regression work meaningful. His original field experiments on grapevine fruit-set potential, comparing irrigated and non-irrigated treatments, created the foundation on which the entire AI pipeline was built. His clear guidance on data structure, class definitions, and the concept of “potenziale di fertilita” ensured that the technical work remained scientifically grounded. Omer sincerely thanks Dr. Bonfante for his generosity in sharing his research data and for his thoughtful direction throughout the project.

Both Prof. Amato and Dr. Bonfante gave Omer Mustafa, founder of Bornbee, the rare opportunity to work on a problem with real-world impact in precision agriculture. That experience shaped the way we approach applied AI at Bornbee today.


What Comes Next

The thesis is complete and the web application is functional, but the research opens several directions for continued work:

  • Expanding the training dataset with additional field seasons and vineyard sites to improve detection recall, particularly for buds
  • Integrating environmental variables (nitrogen levels, weather data, soil moisture) into the regression model for more accurate yield prediction
  • Testing ensemble approaches (Random Forest, Gradient Boosting) alongside linear models to improve R-squared beyond the current baseline
  • Adapting the system for other fruit crops and agricultural counting tasks where the detect-count-predict pipeline is applicable
  • Exploring edge deployment for in-field use, reducing the dependency on cloud infrastructure for real-time analysis

Grapevine AI is a completed research project, but the underlying technology, YOLOv8-based object detection combined with automated statistical analysis, is a pattern we intend to apply across other domains at Bornbee.


Interested in This Kind of Work?

If you have an agricultural research problem, an object counting challenge, or a domain-specific computer vision task that could benefit from the approach we used in Grapevine AI, we would be glad to hear from you. Bornbee builds applied AI solutions grounded in real research, and we are always looking for new problems worth solving.