Image-Based Estimation of Blueberry Yield Incorporating External Validation and Canopy Architecture Under Field Conditions
Official repository accompanying the research publication:
Image-Based Estimation of Blueberry Yield Incorporating External Validation and Canopy Architecture Under Field Conditions
Paul Adunolaᵃ, Tyler J. Schultzᵇ, Raghav Rathiᵃ, Bruno Lemeᵃ, M. Usman Maqbool Bhuttaᵃ, Amman Mohit Minzᵃ, Luis Felipe Ventorim Ferrãoᵃ, Patricio Muñozᵃ
ᵃ Blueberry Breeding and Genomics Lab, Horticultural Sciences Department, University of Florida
ᵇ Research Computing, University of Florida
The integrated phenotyping workflow illustrates raw image capture, object detection, SAM3 canopy segmentation with manual corrections, architectural feature extraction, binary masking, and precision mask-filtered detection:
-
(a) Raw Field Input Image:
Original high-resolution RGB image of the target blueberry plant captured under natural field conditions. -
(b) Full-Scene Object Detection:
Initial multi-class detection (immature berries and mature berries) using YOLOv8x with SAHI sliced inference across the entire raw frame. -
(c) SAM3 Zero-Shot Canopy Segmentation:
Target plant segmentation generated using SAM3 to isolate the target bush from neighboring rows, weeds, and ground cover and manual correction of incomplete segmentation. -
(d) Canopy Architecture & Spatial Feature Extraction:
Derived geometrical metrics including Convex Hull polygon, minimum bounding box dimensions (Height, Width), Canopy Area (px²), Surface Area, Circularity, and principal orientation axes. -
(e) Isolated Canopy Binary Mask:
Cleaned binary foliage mask representing the leaf density and canopy silhouette used to compute canopy occlusion factors. -
(f) Mask-Filtered Precision Detections:
Final fruit detections restricted strictly within the target canopy boundary. Filtering out background fruit from adjacent rows eliminates false positives and maximizes single-plant yield phenotyping precision.
Extracting spatial canopy geometry, Euclidean distance transforms, HSV color space vegetation masks, and convex hull silhouettes to model canopy occlusion (which ranges from 51% to 95% across genotypes):
| Canopy Metrics Overlay | Distance Transform Map | HSV Vegetation Mask | Silhouette Convex Hull |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
| Canopy Area & Solidity | Euclidean Distance Map | Color-Threshold Foliage | Convex Hull & Bounding Box |
berry-vision/
├── README.md
├── requirements.txt
├── doc/
│ ├── detection code.R
│ ├── mask_filtered_err_counts.csv
│ └── validation-counts.xlsx
├── data/
│ ├── grid.png
│ └── sample_images/
├── 01_detection_training/
│ ├── download_flowerberry_dataset.py
│ ├── train.py
│ └── outputs/
├── 02_sam3_segmentation/
│ ├── generate_sam3_masks.py
│ ├── diagnostics/
│ └── sample_overlays/
└── 03_plant_architecture/
├── extract_plant_architecture.py
├── utils/
└── outputs/
doc/: Validation dataset, error logs, and R statistical analysis scripts.detection code.R: Code used to run all analysis and visualization for the validation dataset.mask_filtered_err_counts.csv: Mis-detection and false detection counts from the validation images.validation-counts.xlsx: Contains detection from trained model, ground-truth hand-harvested count, and canopy architecture features for the validation dataset.
data/: Workflow assets and sample benchmark field images (sample_01tosample_08).grid.png: Integrated 6-panel workflow diagram (Panels a–f).
01_detection_training/: Module 1 (Blueberry Detection & Model Training).download_flowerberry_dataset.py: Roboflow dataset download, SAHI image slicing, and COCO-to-YOLO format conversion.train.py: Multi-class Ultralytics YOLO training script.
02_sam3_segmentation/: Module 2 (SAM3 Zero-Shot Canopy Segmentation).generate_sam3_masks.py: SAM3 mask generation and translucent overlay builder script.
03_plant_architecture/: Module 3 (Canopy Architecture & Size Extraction).extract_plant_architecture.py: Main CLI entrypoint extracting canopy geometry, distance transforms, HSV masks, and berry bounding box size distributions.
git clone https://github.com/SFP-team/Blueberry_Detection.git
cd Blueberry_Detectionpython3 -m venv venv
source venv/bin/activatepip install -r requirements.txtpython 01_detection_training/download_flowerberry_dataset.py --roboflow_version 2python 01_detection_training/train.py \
--train_type flowerberries \
--dataset_path ./datasets/flowerberry/fb-2/data.yaml \
--model yolo11x.pt \
--epochs 500 \
--imgsz 400 \
--batch 8Generate translucent SAM3 canopy overlays over raw field images:
python 02_sam3_segmentation/generate_sam3_masks.py \
--input_dir ./data/sample_images \
--output_dir ./02_sam3_segmentation/sample_overlays \
--alpha 0.4Extract spatial canopy features (area, height, width, solidity, distance transform), HSV vegetation masks, silhouette convex hulls, and individual berry size distributions (berries_sizes.csv):
python 03_plant_architecture/extract_plant_architecture.py \
--flowerberry_model_path ./yolo11x.pt \
--input_dir ./data/sample_images \
--output_dir ./03_plant_architecture/outputs \
--berries_detection \
--berries_sizes \
--plant_structureIf you use this repository, dataset, or methodology in your research, please cite our paper:
@article{adunola2026blueberry,
title={Image-Based Estimation of Blueberry Yield Incorporating External Validation and Canopy Architecture Under Field Conditions},
author={Adunola, Paul and Schultz, Tyler J. and Rathi, Raghav and Leme, Bruno and Bhutta, M. Usman Maqbool and Minz, Amman Mohit and Ferr{\~a}o, Luis Felipe Ventorim and Mu{\~n}oz, Patricio},
journal={Horticultural Sciences Department, University of Florida},
year={2026}
}



