The problem
A field experiment tested soil heating on one potato variety, Innovator: twelve plots in four blocks, each block with an unheated control and two heating treatments (one starting at emergence, one at tuber initiation). A DJI Matrice 350 RTK flew over the field once a week through the season. To see how the crop developed under each treatment, canopy cover was needed for every net plot, the two centre rows of each plot.
Colour thresholding is the usual shortcut, and it struggled where the field was hardest to read: in deep shadow and in bright sunlit patches it counted soil and overexposed areas as canopy. The method had to work across the whole season without re-tuning thresholds for every flight.
What we built
Training data came first. Random cut-outs of the orthomosaics were labelled in AnyLabeling with its Segment Anything-assisted mode: 150 images in two days, split 80/20 into training and validation images.
The classifier is a plain U-Net in PyTorch. We trained it on the CPU of a 32-core AMD Threadripper 2990WX workstation, on purpose, so the pipeline also runs on machines without a GPU. After each training run we checked the validation output and adjusted the hyperparameters.
For every flight, the pipeline then runs like this:
- Agisoft Metashape (through its Python API) stitches the RTK-referenced images into a georeferenced orthomosaic;
- in QGIS each net plot is drawn once as a polygon and cut out of every orthomosaic;
- the U-Net turns each cut-out into a binary canopy mask;
- a Python script counts the canopy pixels and gives cover as a percentage per plot and flight date.
What worked
The model separates canopy from soil in the shadowed and sunlit patches where thresholding struggled. Stitching, segmentation and pixel counting run as scripts, and the output is a time series of cover per plot, ready for the statistics.
What didn't
- Some steps stay manual: flying the drone, drawing the plot polygons (once) and checking the output.
- The classifier learns from labelled examples, so a new crop or a new camera means new labels and a retraining run.
The numbers
- A Dice score of about 0.97 on the validation images (a fifth of the 150 labelled cut-outs, from the same orthomosaics as the training images). Dice measures how well the model's mask overlaps the hand-drawn one; 1 would be a perfect match.
- 150 labelled images, which took two days with Segment Anything-assisted labelling.