AI in precision agriculture is mostly supervised machine learning: a model learns from labelled examples. The practical question is rarely "which is the newest model" but "how much labelled data and computing do I have".
Key concepts
Train and test split
Always evaluate on images the model has never seen; otherwise accuracy is overstated.
Classical machine learning
SVM, random forest, gradient boosting and KNN work on feature vectors. In our weed study random forest led with fewer than 40 images per class and gradient boosting with more.
Deep learning and YOLO
CNN-based detectors such as YOLO find and locate objects directly in images. They need annotated data, but augmentation can multiply a small annotated set, as in our 800-tile thistle model.
Learning curves
Plot performance against the number of training images to see where more data stops paying off.
Code examples
Learning curve: how many training images per class are enough?
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import recall_score
rng = np.random.default_rng(0)
def split_per_class(y, n):
train = np.concatenate([rng.choice(np.where(y == c)[0], n, replace=False) for c in np.unique(y)])
return train, np.setdiff1d(np.arange(len(y)), train)
# X: feature matrix (one row per plant image), y: class labels
for n in (5, 10, 20, 40, 80, 160):
tr, te = split_per_class(y, n)
clf = RandomForestClassifier(n_estimators=300, random_state=0).fit(X[tr], y[tr])
print(n, "images/class -> recall", round(recall_score(y[te], clf.predict(X[te]), average="macro"), 3))
Case study
Case studies from my work: a 94.56 % recall weed classifier from 160 images per class, and a YOLO thistle detector.
References from my work
2024Q2
Weed Detection and Classification with Computer Vision Using a Limited Image Dataset
L. Moldvai, P. Á. Mesterházi, G. Teschner, A. Nyéki
Applied Sciences 2024, 14(11), 4839
Abstract
How few training images are enough? Traditional feature-based computer vision (shape, distance-transform, colour-histogram and texture features) with six classifiers was tested on 5–160 images per weed type in a four-class problem. With 160 images per class a 94.56 % recall was reached, close to deep-learning accuracy with a tenth of the data.
UAV-Based Detection and Precision Management of Cirsium arvense: An End-to-End Workflow from Deep Learning to Variable-Rate Spraying
L. Moldvai, P. Á. Mesterházi, G. Teschner, A. Nyéki
Proceedings of the 17th International Conference on Precision Agriculture (ICPA) and 11th Brazilian Congress on Precision and Digital Agriculture, Porto Alegre, Brazil, 13–15 July 2026
Abstract
An end-to-end workflow for detecting creeping thistle (Cirsium arvense) in UAV imagery and turning the detections into sprayer-compatible management zones. A single-class YOLO model trained on 800 annotated tiles (augmented to 13,280 images) reached [email protected] = 78.97 % and F1 = 77.2 %. Herbicide was needed on only 32.43 % of the field, a 67.57 % reduction compared with full-area spraying.