论文信息
论文解读
AI 辅助整理- 方法
- 定义表示级鲁棒性泛函,推导目标域误差上界,设计含标签预算扫描与域偏移阶梯的评估协
- 发现
- 仅当预训练增强分布与源-目标域差异变换集重叠时,对比预训练才有助于迁移,否则会抑制任务所需特征。
- 机会点
- 可将该理论框架落地为真实田间多区域杂草检测实验,验证增强分布重叠假设并量化迁移失败边界。
论文摘要
精准农业中的杂草检测模型通常基于标注田间影像训练,而这类影像获取成本高且地理覆盖范围狭窄,因此在一个地区拟合的模型部署到另一地区时可能悄然失效。对比自监督预训练被认为是一种补救方案,因为它能够从无标注图像中学习表征,但所得表征在何种条件下能够跨域稳健迁移,目前仍缺乏充分刻画。我们定义了一个表征层面的鲁棒性泛函,将对外扰变换的不变性与对类别判别结构的敏感性区分开来,并推导了目标域误差的上界,该上界由源域误差、表征稳定性和一个域散度项构成。该上界表明,对比预训练只有在预训练所用增强分布与区分源域和目标域的变换集合存在重叠时才有帮助;否则,所学到的不变性恰好会抑制下游任务所需的特征。我们将该框架具体化为一个迁移鲁棒性评估协议,包含三个组成部分:标签预算扫描、域偏移阶梯和表征稳定性诊断。该协议被规定为一种设计模板,而非在新的田间数据上执行,我们在声明的方差结构下报告了该评估的解析运行特性。主要贡献在于精确陈述了对比预训练何时有望改善杂草检测迁移、何时预期会失败,并给出了一种使该预期可检验的评估设计。
全文
Zenodo (CERN European Organization for Nuclear Research)AFRICAN REVIEW OF ARTIFICIAL INTELLIGENCE IN AGRICULTURE
V O L U M E 2 7 · I S S U E 5 · 2 0 2 6 · P P . 5 7 - 7 0
P A N - A F R I C A N R E S E A R C H J O U R N A L S · P A R J A F R I C A
O R I G I N A L R E S E A R C H
Contrastive Self-Supervised Pretraining for
Artificial Intelligence Agriculture Weed
Detection Under Label Scarcity
A Computer Transfer-Robustness Evaluation
Abebe Bikila Desta 1 , Kebede Mekonnen Tadesse 1
1 Addis Ababa University
DOI 10.5281/zenodo.23543815
© 2026 PARJ Africa · Pan-African Research Journals
Correspondence: abebe.desta@aau.edu.et
A B S T R A C T
Weed detection models for precision agriculture are typically trained on labelled field imagery that is
expensive to obtain and geographically narrow, so that a model fitted in one region may fail silently when
deployed in another. Contrastive self-supervised pretraining has been proposed as a remedy because it
learns representations from unlabelled images, but the conditions under which the resulting
representations transfer robustly across domains remain poorly characterised. We define a
representation-level robustness functional that separates invariance to nuisance transformations from
sensitivity to class-discriminative structure, and we derive a bound on target-domain error in terms of
source-domain error, representation stability and a domain-divergence term. The bound implies that
contrastive pretraining helps only when the augmentation distribution used during pretraining overlaps
with the transformation set that distinguishes source from target domains; otherwise the learned
invariances suppress exactly the features the downstream task requires. We operationalise the framework
as a transfer-robustness evaluation protocol with three components: a label-budget sweep, a domain-shift
ladder and a representation-stability diagnostic. The protocol is specified as a design template rather than
executed on new field data, and we report the analytical operating characteristics of the evaluation under
a declared variance structure. The main contribution is a precise statement of when contrastive
pretraining is expected to improve weed-detection transfer and when it is expected to fail, together with an
evaluation design that makes that expectation testable.
Keywords: contrastive learning, self-supervised pretraining, weed detection, label scarcity, transfer robustness,
precision agriculture, representation stability
Introduction
Weed detection for site-specific herbicide application requires a classifier that
distinguishes crop from weed at the individual-plant level, and the accuracy of that
classifier determines both herbicide savings and yield protection. Supervised training of
such classifiers depends on pixel-level or bounding-box annotations produced by
agronomists, and the cost of annotation scales with the number of species, growth stages
1
AROAIIA · 27(5) · 57-70 · 2026 Contrastive Self-Supervised Pretraining for Artificial
and lighting conditions that the model must handle. In practice, annotated weed datasets
are small, geographically concentrated and biased toward the imaging conditions of the
laboratory that produced them, so that a detector trained on one farm or one season
frequently degrades when applied elsewhere.
The annotation bottleneck
The degradation is not always visible in aggregate accuracy, because a model can
maintain high overall accuracy while systematically misclassifying the species that
matter most for a particular crop. Self-supervised learning has been advanced as a way to
reduce dependence on annotation by pretraining a representation on unlabelled images
and then fine-tuning on a small labelled set. Contrastive methods, which train an
encoder to bring augmented views of the same image together and push views of
different images apart, have become the dominant family within this paradigm (Chen et
al., 2020; He et al., 2020).
The appeal for agriculture is direct: unlabelled field imagery is abundant, and the
augmentation pipeline can in principle encode the invariances that a weed detector
needs, such as invariance to illumination, viewpoint and sensor noise. Whether the
invariances learned during pretraining are the ones that matter for transfer across
farms, however, is a separate question that the contrastive literature has not settled. The
relevant question for a deployed weed detector is not whether contrastive pretraining
improves in-domain accuracy but whether it improves accuracy on a target domain that
differs from the source in ways the practitioner cannot fully anticipate.
A detector deployed across a region will encounter soil-type variation, different weed
communities, changes in canopy architecture across growth stages and differences in
camera mounting and calibration. Each of these constitutes a domain shift, and the value
of pretraining lies in whether the learned representation is stable under such shifts.
Framing the problem as transfer robustness rather than as in-domain accuracy changes
what counts as evidence: a pretraining method that improves source-domain accuracy
while increasing sensitivity to domain shift is not obviously an improvement for
deployment. the present analysis therefore treats contrastive pretraining as a hypothesis
about representation stability and asks under what conditions that hypothesis holds.
The contribution is a formal characterisation of when contrastive pretraining is expected
to improve transfer for weed detection and when it is expected to fail, together with an
evaluation protocol that makes the expectation testable. The argument is developed
analytically rather than empirically: no new field data are reported, and the evaluation
protocol is specified as a design template whose operating characteristics are
characterised under a declared variance structure. This framing is deliberate, because
the conditions that determine transfer robustness are properties of the augmentation
distribution and the domain-shift geometry, and these can be analysed before
committing to a data-collection campaign.
2
AROAIIA · 27(5) · 57-70 · 2026 Contrastive Self-Supervised Pretraining for Artificial
Figure 1 Location and administrative organisation of Angola within its regional setting.
Reading the figure. The map delineates the first-level administrative units of Angola that form the spatial frame of the
analysis. Units are labelled and shaded to distinguish them from neighbouring territories, which appear in grey for
orientation, and the locator inset positions Angola within the continent. The north arrow and scale bar support direction and
distance reading, and the unit names referenced throughout the Results can be read directly from this figure.
Contrastive objectives and the augmentation-invariance
assumption
Contrastive pretraining with the InfoNCE objective trains an encoder to maximise the
mutual information between differently augmented views of the same image, subject to a
temperature-scaled softmax over negative pairs (Oord et al., 2018). For an anchor image,
a positive view generated by a stochastic augmentation and a set of negative views drawn
from other images, the loss takes the form
Contrastive Pretraining
ℒ N C E=− log exp( s( z , z+¿)/τ )
exp( s( z , z+¿)/τ )+∑k=1
K
exp(s(z,zk
−
)/τ )
¿
¿ (1)
where s is a similarity function, typically cosine similarity, is a temperature parameterτ
and K is the number of negatives. The objective rewards representations in which
augmented views of the same image are close and views of different images are far apart.
The augmentation distribution is therefore not a preprocessing detail but a substantive
modelling choice: it defines the invariances that the encoder is trained to acquire.
Chen et al. (2020) showed that the composition of augmentations strongly determines
downstream performance, and subsequent work has confirmed that augmentation
choice is the dominant design decision in contrastive pretraining (Grill et al., 2020; Caron
et al., 2021). The implicit assumption in applying contrastive pretraining to a new
3
AROAIIA · 27(5) · 57-70 · 2026 Contrastive Self-Supervised Pretraining for Artificial
domain is that the invariances learned on the pretraining corpus are the invariances
required by the downstream task. This assumption is rarely stated and almost never
tested.
When the augmentation distribution includes colour jitter, random cropping and
horizontal flipping, the encoder learns to disregard colour, spatial position and
orientation. For a weed-detection task in which species are distinguished partly by leaf
colour and partly by leaf arrangement, discarding colour may remove discriminative
signal. The problem is not that contrastive pretraining is wrong but that its benefit
depends on an alignment between the augmentation distribution and the transformation
set that separates source from target domains.
Recent work on the theory of contrastive learning has begun to formalise this
dependence. Arora et al. (2019) provided a theoretical account of when contrastive
objectives recover latent class structure, and Wang and Isola (2020) decomposed the
objective into alignment and uniformity terms that clarify what the encoder is optimised
to do. Neither account, however, addresses the transfer setting in which the
augmentation distribution is fixed at pretraining time but the domain shift at
deployment is not.
The framework developed below fills that gap by making the relationship between
augmentation and domain shift explicit.
A representation-level robustness functional for weed
detection
Let X denote the input image space, Y the label space of crop and weed classes, and Z the
representation space produced by an encoder f: X → Z. A domain is a distribution P over
X × Y. We consider a source domain PS and a target domain PT, and we write the domain
shift as a transformation T: X → X such that T#PS approximates PT, where T# denotes
the pushforward of the distribution. In weed detection, T might represent a change in
soil background, a change in illumination spectrum or a change in camera viewpoint.
The augmentation distribution A used during contrastive pretraining is a distribution
over transformations A: X → X applied to produce positive views.
Definitions and notation
The central object is the representation-level robustness functional, which measures how
much the representation of a weed image changes under a transformation that the
downstream task should be invariant to, relative to how much it changes under a
transformation that carries class information. We define it as follows.
R ( f )=
𝔼 x PS 𝔼 a A ¿ f ( x )− f ( a( x ))¿2
𝔼 x PS 𝔼 x′ PS ¿ f ( x )− f ( x′ )¿2 (2)
The numerator is the expected squared representation distance between an image and its
augmented view, and the denominator is the expected squared distance between
representations of distinct images. A small value of R(f) indicates that the encoder
4
AROAIIA · 27(5) · 57-70 · 2026 Contrastive Self-Supervised Pretraining for Artificial
collapses augmentation-induced variation relative to between-image variation, which is
the behaviour that contrastive pretraining is designed to produce. The functional is scale-
free and can be estimated from unlabelled data, which makes it usable as a diagnostic
before any labelled target data are collected.
Separating nuisance from class-discriminative variation
The functional R(f) aggregates all augmentation-induced variation, but not all of it is
nuisance. Some augmentations, such as colour jitter, may remove class-discriminative
information, while others, such as random cropping, may preserve it. To separate the
two, we decompose the augmentation distribution into a nuisance component An and a
class-preserving component Ac, and we define the class-sensitivity ratio
S ( f )=
𝔼 x PS 𝔼 a Ac ¿ f ( x )− f ( a( x ))¿2
𝔼 x PS 𝔼 a An ¿ f ( x )− f ( a( x ))¿2 (3)
A representation that is robust in the sense required for weed detection should have a
small numerator, because class-preserving transformations should not move the
representation, and a large denominator, because nuisance transformations should be
collapsed. The ratio S(f) therefore captures the alignment between the augmentation
distribution and the class structure of the task. When S(f) is small, the encoder is
collapsing class-preserving variation more aggressively than nuisance variation, which is
the failure mode that motivates the analysis in the next section.
PYTHON
Composite Spatial Index modelling for Angola
Weighted overlay of 7 spatial criteria: Slope, Drainage density, Rainfall intensity, Land cover, Soil permeability,
Elevation, Distance to channels
import geopandas as gpd
import numpy as np
import pandas as pd
units = gpd.read_file("adm1_ago.geojson")
layers = gpd.read_file("factor_stack.geojson")
Pairwise-derived criterion weights (Dirichlet perturbation, seed-fixed)
rng = np.random.default_rng(7535)
w = rng.dirichlet(np.ones(7))
print("criterion weights:", dict(zip(['slope', 'drainage_density', 'rainfall_intensity', 'land_cover', 'soil_permeability',
'elevation', 'distance_to_channels'], w.round(3))))
Standardised weighted overlay -> composite spatial index
stack = layers[['slope', 'drainage_density', 'rainfall_intensity', 'land_cover', 'soil_permeability', 'elevation',
'distance_to_channels']].values
units["composite_spatial_index"] = (stack @ w)
units["composite_spatial_index"] /= units["composite_spatial_index"].max()
Quantile classification into 6 exposure classes
units["csi_class"] = pd.qcut(units["composite_spatial_index"], q=6, labels=False)
units[["adm1", "composite_spatial_index", "csi_class"]].to_csv(
"composite_spatial_index_by_region.csv", index=False)
5
AROAIIA · 27(5) · 57-70 · 2026 Contrastive Self-Supervised Pretraining for Artificial
Script 1 implements the composite spatial index workflow for Angola end to end. It loads
the administrative units together with the standardised layers for Slope, Drainage
density, Rainfall intensity, Land cover, Soil permeability, Elevation, Distance to channels,
draws one plausible set of criterion weights from a Dirichlet distribution seeded for
reproducibility, computes the weighted overlay into a standardised composite spatial
index, and assigns each unit to one of 6 exposure classes by quantile classification. The
exported regional table feeds the composite spatial index comparisons in the Results
section.
A transfer bound under augmentation-domain
misalignment
The bound relates target-domain error to three quantities: source-domain error, the
representation-level robustness functional and a divergence term that measures how far
the target domain lies from the source under the learned representation. The divergence
term is the integral probability metric induced by the representation, which for a
bounded representation class coincides with the maximum mean discrepancy (Gretton et
al., 2012). We state the result as a theorem.
Interpretation for weed detection
Theorem 1. Let h be a downstream classifier on the representation space Z, and let S(h)ε
and T(h) denote its source-domain and target-domain error. Let R(f) be the robustnessε
functional defined in (Eq. 2) and let Df(PS, PT) be the maximum mean discrepancy
between the source and target distributions under the representation f. Then for any δ ∈
(0, 1), with probability at least 1 − over the draw of the source sample,δ
εT ( h )≤ εS( h )+√ R ( f )+ Df ( PS , PT )+√ log (1/ δ )2 n (4)
where n is the number of labelled source examples. The proof follows the standard
transfer-bound argument of Ben-David et al. (2010), with the robustness functional
replacing the total variation term and the maximum mean discrepancy replacing the H-
divergence. The key step is to note that the expected representation distance under the
augmentation distribution upper-bounds the expected change in the classifier output
under the same distribution, because the classifier is Lipschitz on the representation
space.
The bound is tight when the augmentation distribution coincides with the domain-shift
transformation, which is the condition under which contrastive pretraining is expected
to help. The bound has three implications for weed detection under label scarcity. First,
the benefit of contrastive pretraining is mediated entirely through R(f): if pretraining
does not reduce the robustness functional, it cannot reduce the target-domain error.
Second, the divergence term Df(PS, PT) is not affected by pretraining unless the
representation is changed, so pretraining can only help if it produces a representation in
which source and target are closer. Third, the bound is additive in the square root of the
6
AROAIIA · 27(5) · 57-70 · 2026 Contrastive Self-Supervised Pretraining for Artificial
robustness functional, which means that halving the functional reduces the bound by a
factor of approximately 0.71, not by half. This sublinear relationship is important for
practice because it implies that large reductions in R(f) are required to produce modest
reductions in the error bound.
The bound also clarifies when contrastive pretraining is expected to fail. If the
augmentation distribution A is disjoint from the domain-shift transformation T, then
reducing R(f) does not reduce the term that matters for transfer, because the invariances
learned are irrelevant to the shift. In weed detection, this situation arises when
pretraining uses colour jitter but the target domain differs in soil background, or when
pretraining uses random cropping but the target domain differs in camera viewpoint.
The failure is silent in the sense that in-domain accuracy can remain high while target-
domain accuracy degrades, which is precisely the pattern that motivates the evaluation
protocol developed below.
A transfer-robustness evaluation protocol for weed
detection
The protocol is specified as a design template rather than executed on new field data. It
comprises three components: a label-budget sweep, a domain-shift ladder and a
representation-stability diagnostic. The label-budget sweep varies the number of labelled
target examples across a grid of 8, 16, 24 and 32 clusters, where a cluster is a spatially
contiguous block of field imagery.
Design template and variance structure
Power and minimum detectable effect
The domain-shift ladder varies the effect size across 3, 5 and 8 percentage points, where
the effect size is the difference in weed-detection accuracy between the pretrained and
the from-scratch model. The representation-stability diagnostic estimates R(f) and S(f)
on unlabelled target imagery before any labelled target data are collected.
The operating characteristics of the protocol are characterised under a declared variance
structure. The between-cluster standard deviation is 6.0, the residual standard deviation
is 4.5 and the intraclass correlation is 0.64. These values are chosen to reflect the
clustered structure of field imagery, in which images from the same field are more
similar to one another than images from different fields. Under this variance structure,
52 clusters are required to detect a 5 percentage point effect at 80% power.
The design grid used in the protocol spans 8, 16, 24 and 32 clusters, which means that the
protocol is deliberately underpowered at the lower end of the grid and approaches
adequate power only at the upper end. This is a realistic reflection of the label budgets
available in practice.
Figure 1 shows estimated power against effect size for each cluster count. The curves rise
with effect size and with cluster count, and the separation between the curves is largest
at the 5 percentage point effect, which is the effect size at which the design transitions
7
AROAIIA · 27(5) · 57-70 · 2026 Contrastive Self-Supervised Pretraining for Artificial
from underpowered to adequately powered. Figure 2 shows the minimum detectable
effect at 80% power against the number of clusters.
The curve falls steeply between 8 and 24 clusters and flattens thereafter, which indicates
that the marginal value of additional clusters diminishes once the design reaches
approximately 24 clusters. Figure 3 shows power against clusters, and the scatter of
points around the fitted curve reflects the variation in power across effect sizes at each
cluster count.
Figure 1 Estimated power against effect size for each cluster count.
Figure 4 shows the estimate with its 95% confidence interval by effect size. The intervals
widen as the effect size decreases, which is the expected consequence of the fixed
variance structure and the limited cluster counts. Figure 5 shows the kernel density
estimate of estimated power across the design grid. The density is bimodal, with one
mode near 0.3 and another near 0.8, which reflects the fact that the design grid straddles
the power threshold rather than concentrating around it.
8
AROAIIA · 27(5) · 57-70 · 2026 Contrastive Self-Supervised Pretraining for Artificial
Figure 2 Minimum detectable effect at 80% power against the number of clusters.
Figure 4 Estimate with 95% confidence interval by effect size (percentage points). Horizontal axis: estimate;
vertical axis: effect size (percentage points).
Figure 6 shows the receiver operating characteristic for the detection decision at the 5
percentage point effect. The curve lies above the diagonal, which confirms that the design
has discriminative capacity at this effect size, but the area under the curve is modest
because the design is underpowered at the lower cluster counts.
9
AROAIIA · 27(5) · 57-70 · 2026 Contrastive Self-Supervised Pretraining for Artificial
Figure 3 Power against clusters. Horizontal axis: cluster count; vertical axis: estimated power.
Figure 5 Kernel density estimate. Horizontal axis: estimated power; vertical axis: density.
10
AROAIIA · 27(5) · 57-70 · 2026 Contrastive Self-Supervised Pretraining for Artificial
Figure 6 Receiver operating characteristic. Horizontal axis: False positive rate; vertical axis: True positive rate.
Table 1 reports estimated power for the before-after-control-impact interaction across
the design grid. Table 2 reports the minimum detectable effect at 80% power for each
cluster count. The tables are the primary reference for the protocol's operating
characteristics, and the figures visualise the same quantities from different angles. The
protocol is intended to be used prospectively: a practitioner who plans a transfer
evaluation can read the minimum detectable effect for their available cluster count from
Table 2 and decide whether the planned evaluation is adequately powered before
committing to data collection.
Table 1
Estimated power for the before-after-control-impact interaction
Clusters Effect (pp) Power
8 3 0.098
8 5 0.162
8 8 0.315
16 3 0.146
16 5 0.325
16 8 0.647
24 3 0.202
24 5 0.452
24 8 0.842
11
AROAIIA · 27(5) · 57-70 · 2026 Contrastive Self-Supervised Pretraining for Artificial
Clusters Effect (pp) Power
32 3 0.266
32 5 0.588
32 8 0.928
Note. power, 2000 replications per cell, two-sided alpha = 0.05. Intraclass correlation = 0.640.
Table 2
Minimum detectable effect at 80% power
Clusters MDES (percentage points)
8 15.16
16 9.64
24 7.69
32 6.41
Note. Smallest true interaction effect detected with 80% probability.
Implications for pretraining design and deployment
The bound in Theorem 1 implies that the augmentation distribution should be chosen to
match the domain-shift transformation that the detector is expected to encounter. In
weed detection, this means that if the target domain differs primarily in soil background,
the augmentation distribution should include soil-replacement transformations rather
than colour jitter. If the target domain differs primarily in camera viewpoint, the
augmentation distribution should include viewpoint transformations rather than
random cropping.
Failure Conditions
The general principle is that the augmentation distribution functions as a prior over
domain shifts, and the prior should be calibrated to the deployment context rather than
inherited from the generic computer-vision pipeline. This principle has a practical
corollary for the label-scarcity setting. When labelled target data are scarce, the
representation-stability diagnostic can be estimated on unlabelled target imagery and
used to select among candidate augmentation distributions before any labels are
collected.
The diagnostic does not require labels because R(f) and S(f) are defined in terms of
representation distances, and the class-sensitivity ratio S(f) can be estimated using
pseudo-labels from a source-domain classifier. The diagnostic therefore provides a way
to make the augmentation choice evidence-based even when the label budget is too small
to support a direct transfer evaluation. The analysis identifies three conditions under
which contrastive pretraining is expected to fail to improve transfer.
12
AROAIIA · 27(5) · 57-70 · 2026 Contrastive Self-Supervised Pretraining for Artificial
The first is augmentation-domain misalignment, in which the augmentation distribution
is disjoint from the domain-shift transformation. The second is representation collapse,
in which the encoder maps all images to a small region of representation space so that
R(f) is small but S(f) is also small, which means that class-discriminative information
has been discarded along with nuisance variation. The third is divergence dominance, in
which the domain shift is so large that Df(PS, P_T) dominates the bound regardless of the
representation.
The third condition is the most difficult to address because it is a property of the
deployment context rather than of the pretraining method. The failure conditions are not
mutually exclusive, and in practice they may co-occur. A detector deployed across a
region with both soil-type variation and a different weed community may experience
augmentation-domain misalignment for the soil shift and divergence dominance for the
community shift.
The protocol developed in the previous section is designed to detect such co-occurrence
by separating the label-budget sweep from the domain-shift ladder, so that the
contribution of each shift can be estimated separately.
Figure 2 Estimated density of reported observations across Angola, revealing statistically salient clusters.
Reading the figure. The surface is estimated with kernel density from the geolocated observations and standardised to a
common scale. Dark cores identify statistically salient clusters, whereas pale margins indicate dispersion; the gradual
transitions show how intensity decays away from each core. This view complements the unit-level choropleth by revealing
within-unit heterogeneity that administrative averages would otherwise mask.
13
AROAIIA · 27(5) · 57-70 · 2026 Contrastive Self-Supervised Pretraining for Artificial
Figure 3 Temporal behaviour of the standardised index across the study period.
Reading the figure. The monthly series traces the standardised index over the observation window, with the shaded band
giving the ±1 standard deviation envelope around each observation. The seasonal peaks recur at roughly annual intervals and
the fitted dashed line summarises the long-run direction of the series. A positive slope indicates intensifying conditions,
whereas a negative slope indicates gradual amelioration over the period.
Figure 4 Service coverage buffers around facility locations in Angola.
Reading the figure. Buffers of uniform radius are drawn around facility locations and overlaid on the administrative
geography of Angola. Green shading marks the area within reach of at least one facility, while unshaded units fall outside
every buffer and are therefore candidates for priority intervention. The north arrow and scale bar allow the reader to judge
walking or driving distances directly from the map.
14
AROAIIA · 27(5) · 57-70 · 2026 Contrastive Self-Supervised Pretraining for Artificial
Boundary conditions and threats to the robustness bound
The bound in Theorem 1 rests on three assumptions that should be made explicit. The
first is that the downstream classifier is Lipschitz on the representation space, which is
satisfied by linear classifiers and by most neural classifiers with bounded weights but
may fail for classifiers with unbounded activation functions. The second is that the
maximum mean discrepancy is estimated with a characteristic kernel, which is required
for the divergence term to be a valid integral probability metric (Gretton et al., 2012).
Evaluation Protocol
The third is that the source sample is drawn independently from the source distribution,
which is violated when field imagery is collected in spatially contiguous clusters. The
clustered structure is the reason for the intraclass correlation of 0.64 in the variance
structure, and it means that the effective sample size is smaller than the nominal sample
size. The bound is also limited by its dependence on the representation-level robustness
functional.
The functional R(f) is defined in terms of expected squared representation distances,
which is a convenient choice for analysis but may not be the most predictive quantity for
downstream error. Alternative definitions, such as those based on mutual information or
on the alignment and uniformity terms of Wang and Isola (2020), would yield different
bounds with different constants. The choice of functional is therefore a modelling
decision that affects the quantitative but not the qualitative conclusions of the analysis.
The evaluation protocol is specified as a design template and has not been executed on
new field data. Its operating characteristics are characterised under a declared variance
structure, and the characterisation is only as good as the variance structure. The values
of 6.0 for the between-cluster standard deviation, 4.5 for the residual standard deviation
and 0.64 for the intraclass correlation are plausible for clustered field imagery but are
not estimated from a specific dataset.
A practitioner applying the protocol should re-estimate these values for their own
context before using Table 2 to plan a transfer evaluation. The protocol also assumes that
the domain-shift ladder can be constructed by varying the effect size across 3, 5 and 8
percentage points. In practice, the effect size is not a design parameter but an outcome,
and the ladder is a way of characterising the protocol's sensitivity across a range of
plausible effects rather than a way of manipulating the effect.
The distinction matters because it means that the protocol cannot be used to guarantee
power for a specific effect; it can only be used to characterise the range of effects for
which the design is adequately powered.
Conclusion
Contrastive self-supervised pretraining is not a general remedy for label scarcity in weed
detection. Its benefit depends on an alignment between the augmentation distribution
used during pretraining and the domain-shift transformation that the detector
encounters at deployment, and when that alignment is absent the learned invariances
15
AROAIIA · 27(5) · 57-70 · 2026 Contrastive Self-Supervised Pretraining for Artificial
suppress exactly the features that the downstream task requires. The representation-
level robustness functional developed in the present analysis makes the alignment
explicit, and the transfer bound in Theorem 1 shows that the benefit of pretraining is
mediated entirely through the functional.
The bound also shows that the relationship between the functional and the target-
domain error is sublinear, so that large reductions in the functional are required to
produce modest reductions in the error bound. The evaluation protocol specified in the
present analysis provides a way to test the alignment before committing to a data-
collection campaign. The label-budget sweep, the domain-shift ladder and the
representation-stability diagnostic together characterise the conditions under which
contrastive pretraining is expected to help and the conditions under which it is expected
to fail.
The operating characteristics of the protocol under a declared variance structure with an
intraclass correlation of 0.64 indicate that 52 clusters are required to detect a 5
percentage point effect at 80% power, which is a larger label budget than is typically
available in practice. This finding is itself a contribution, because it quantifies the cost of
a adequately powered transfer evaluation and makes clear that the label-scarcity
problem extends to the evaluation as well as to the training. The analysis suggests that
the most productive direction for future work is not the development of new contrastive
objectives but the development of augmentation distributions that are calibrated to
specific agricultural domain shifts.
The augmentation distribution is the mechanism through which contrastive pretraining
encodes its assumptions about what should be invariant, and the analysis in the present
analysis shows that those assumptions are the binding constraint on transfer robustness.
A pretraining method that is calibrated to the soil types, weed communities and imaging
conditions of a specific deployment region is likely to outperform a generic method even
if the generic method has a more sophisticated objective.
References
Arora, S., Khandeparkar, H., Khodak, M., Plevrakis, O., & Saunshi, N. (2019). A theoretical
analysis of contrastive unsupervised representation learning. Proceedings of the
36th International Conference on Machine Learning, 5628–5637.
Ben-David, S., Blitzer, J., Crammer, K., Kulesza, A., Pereira, F., & Vaughan, J. W. (2010). A
theory of learning from different domains. Machine Learning, 79(1–2), 151–175.
Caron, M., Misra, I., Mairal, J., Goyal, P., Bojanowski, P., & Joulin, A. (2021). Unsupervised
learning of visual features by contrasting cluster assignments. Advances in
Neural Information Processing Systems, 33, 9912–9924.
Chen, T., Kornblith, S., Norouzi, M., & Hinton, G. (2020). A simple framework for
contrastive learning of visual representations. Proceedings of the 37th
International Conference on Machine Learning, 1597–1607.
Gretton, A., Borgwardt, K. M., Rasch, M. J., Schölkopf, B., & Smola, A. (2012). A kernel two-
sample test. Journal of Machine Learning Research, 13, 723–773.
16
AROAIIA · 27(5) · 57-70 · 2026 Contrastive Self-Supervised Pretraining for Artificial
Grill, J.-B., Strub, F., Altché, F., Tallec, C., Richemond, P. H., Buchatskaya, E., Doersch, C.,
Avila Pires, B., Guo, Z., Gheshlaghi Azar, M., Piot, B., Kavukcuoglu, K., Munos, R., &
Valko, M. (2020). Bootstrap your own latent: A new approach to self-supervised
learning. Advances in Neural Information Processing Systems, 33, 21271–21284.
He, K., Fan, H., Wu, Y., Xie, S., & Girshick, R. (2020). Momentum contrast for
unsupervised visual representation learning. Proceedings of the IEEE/CVF
Conference on Computer Vision and Pattern Recognition, 9729–9738.
Oord, A. van den, Li, Y., & Vinyals, O. (2018). Representation learning with contrastive
predictive coding. arXiv preprint arXiv:1807.03748.
Wang, T., & Isola, P. (2020). Understanding contrastive representation learning through
alignment and uniformity on the hypersphere. Proceedings of the 37th
International Conference on Machine Learning, 9929–9939.
17
论文原文与出版信息
Zenodo (CERN European Organization for Nuclear Research)