Bloom-Counter Pipeline: Stress-Testing Yield Detection
An in-depth look at the open-source Bloom-Counter project, examining why a 99.7% accuracy score falls short under real-world lighting and occlusion challenges.

Stock photo for illustration only, not from the actual event
- Crop-counting pipelines must distinguish between open blooms and closed buds for harvest planning.
- The Bloom-Counter project previously scored 99.7% recall, but the simulator and detector were co-tuned.
- Stress-testing reveals critical failures under real-world lighting shifts and leaf occlusion.
- Preprocessing remedies like Gray-world white balance and CLAHE help but require careful gating.
Agricultural yield estimation requires more than just a single aggregate number. Growers must track two distinct metrics for operational planning: the number of currently open flowers to drive this week's harvest, and the count of unopened buds to forecast next week's yield. The true deliverable lies in this structural breakdown rather than the sum alone.
An open-source project named Bloom-Counter was designed specifically for this purpose, utilizing HSV color segmentation and contour analysis to output per-image bloom and bud counts aggregated by region and date. Its repository README boasts an impressive scorecard across 6 simulated photos containing 357 flowers with a 99.7% detection recall rate. However, this article begins with an uncomfortable assertion: that a 99.7% score proves very little, as two structural reasons are embedded directly within the codebase for anyone to inspect.
First, the simulator and the detector were co-tuned to match one another. A comment on line 23 of simulator/generate.py explicitly states that flower colors in BGR are tuned to sit directly inside the detector's HSV petal ranges. The generator paints flowers tailored to the detector's preferences, yielding a structural perfection score. Second, the simulator's placement function utilizes rejection sampling to prevent flower overlaps, and demo scoring relies purely on totals ratios without per-object matching or class breakdowns.
"The flower colors in BGR are tuned to sit inside the detector's HSV petal ranges."
simulator/generate.py (Line 23)

Stock photo for illustration only, not from the actual event
Real-world greenhouses invert these assumptions completely, as natural light fluctuates throughout the day, foliage causes inevitable occlusion, and flowers grow in dense clusters. The author took the stock ColorSegmentationDetector with untouched parameters (minimum area of 120 px², bloom area minimum of 900 px², and morphology kernel of 7) and systematically tested it against four 1280×960 images from the repository simulator, totaling 210 objects consisting of 134 blooms and 76 buds.
Conducting stress-testing of this caliber represents a gold standard in computer vision development. Models trained or validated exclusively on synthetic datasets frequently suffer from overfitting to idealized simulation parameters. Forcing pipelines to encounter realistic environmental stressors such as lighting gradients and occlusions allows developers to uncover operational boundaries before deployment in actual agricultural fields.
The evaluation revealed that under an exposure drop of -50 and shadow conditions, traditional aggregate scoring still reported zero total error. In reality, however, a quarter to a sixth of the actual blooms had vanished while dozens of phantom buds materialized. The underlying mechanism involves dimming eroding the petal mask from the edges inward, dropping values below the threshold and reclassifying larger blooms as small buds rather than letting them disappear completely. Conversely, overexposure manufactures phantom objects out of washed-out leaf fragments.
Fortunately, the system exhibited a wider robust zone than expected, successfully handling moderate brightening, darkening up to gamma 1.6, and noisy low-light scenarios. The author evaluated two remedies: Gray-world white balance followed by CLAHE on the luminance channel as preprocessing, and an area-based split estimator for oversized bloom components.
Source: Dev.to
Found something wrong in this article? Report an issue with this article
Comments
Leave a Comment