Mughees Ul Haq

Work 16 / 18

Counting 23,005 pea seedlings without a neural network

A client needed every pea seedling in a 182-megapixel drone map located and counted. I measured the imagery before choosing a method, and a vegetation index did the job in 14 seconds on a CPU.

For
An agriculture client
When
August 2026
My part
Method, implementation, QA tooling, delivery
Status
Delivered as GIS and annotation files
Plants located
23,005
One georeferenced point each
Run time
14 s
CPU, whole field
Map size
182 megapixels
2.5 mm per pixel
Training data
none
A vegetation index and a watershed split

Why no model

At 2.5 mm per pixel the plants are pure green on bare soil. A calibrated excess-green index separates them cleanly, so I thresholded it, cleaned the mask, and split blobs larger than 1.8 times the median plant with a watershed. In my click-to-detect benchmarks, this method beat a trained CNN on the same field.

A public photo of seedlings with the pixels above the excess-green threshold marked and each connected blob counted.
A public photo of seedlings with the pixels above the excess-green threshold marked and each connected blob counted.
A public photo of seedlings with the pixels above the excess-green threshold marked and each connected blob counted.
A public photo of seedlings with the pixels above the excess-green threshold marked and each connected blob counted.
The same idea, running in your browser on a small copy of public photos: an excess-green index, a threshold, and a count of connected blobs. Move the threshold and watch the count change. It leaves out the watershed split and the size filter of the delivered pipeline, so touching plants count as one.

Photos: FARMERS GOV - Huerta del Valle - Community G… by USDAgov, Public domain; Bismarck Plant Materials Center - North Dako… by USDAgov, Public domain; Bismarck Plant Materials Center - North Dako… by USDAgov, Public domain; FARMERS GOV - Huerta del Valle - Community G… by USDAgov, Public domain. What I changed.

What was delivered

23,005 plant points for the whole 10,579 × 17,166 pixel map, georeferenced for QGIS; a CSV with each plant’s size; COCO keypoints over 1024-pixel tiles so a person can correct them in CVAT; overlays; and a browser page for reviewing the result. The median plant is 514 pixels, about 6.6 cm across.

Limits

Two plants touching in a row can merge into one point. Any green weed is counted as a pea. Seedlings smaller than about 3 cm across are dropped. The report I delivered gives no accuracy figure against a hand count, so I don’t quote one here.

From the run log

sc.01Vegetation index and watershed23,005 plants in 14.0 sShipped

Setup: Excess-green index threshold 0.09, morphology, connected components, watershed split above 1.8× the median area

No training. The whole 10,579 × 17,166 pixel map ran in 14.0 seconds on a CPU. The delivered report has no accuracy figure against a hand count.

Open this project in the full log

Tools

OpenCV, NumPy, QGIS, CVAT.

The full write-up

There is a longer write-up of this project. It has client details in it, so email me if you’d like a redacted copy.