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.”

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:
| Model | Precision | Recall | [email protected] | [email protected]:0.95 | Notes |
|---|---|---|---|---|---|
| YOLOv8 | 0.8057 | 0.6921 | 0.7591 | 0.3725 | Best overall, reliable counting |
| DETR (HuggingFace) | — | 0.011 | 0.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:
| Class | Precision | Recall | [email protected] | [email protected]:0.95 |
|---|---|---|---|---|
| Berries | 0.906 | 0.832 | 0.898 | 0.503 |
| Fruit buds | 0.791 | 0.587 | 0.675 | 0.304 |
| Overall | 0.848 | 0.709 | 0.786 | 0.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.

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.

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.

Technical Architecture
| Layer | Technology |
|---|---|
| Detection model | YOLOv8 (Ultralytics) |
| Training | Google Colab + Kaggle (GPU) |
| Annotation | Roboflow (YOLO + COCO export) |
| Web framework | Django |
| Containerization | Docker (local + server) |
| Deployment | CapRover on Bornbee infrastructure |
| Analysis | Python (pandas, matplotlib, scikit-learn) |
| Output formats | PDF reports, CSV/Excel, detection overlays |
| Dataset | 697 annotated images (2024 and 2025 field seasons) |
| Model weights | YOLOv8 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:
| Period | Work |
|---|---|
| May 2025 | Thesis supervision request accepted by Prof. Flora Amato. Initial materials received from Dr. Antonello Bonfante |
| June 2025 | Dataset organization, manual labeling of 200+ bud images in Roboflow, first YOLOv8 training runs |
| July 2025 | YOLOv8 and YOLOv11 training on unified 697-image dataset. Berry precision reached 90.6% |
| August 2025 | HuggingFace experiments: DETR fine-tuning and OWL-ViT zero-shot benchmarking |
| September 2025 | Introduction to Dr. Bonfante. Regression modeling for yield prediction. Final model benchmarks |
| October 2025 | Web application development: single analysis, batch processing, report generation |
| November 2025 | Django app deployed via Docker on CapRover. Demo shared with supervisors. Thesis writing |
| December 2025 to January 2026 | Thesis 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.