Masked Field Context for Image-Based Genomic Prediction

Plant breeders now photograph entire field trials from drones and turn the images into measurements for each plot (for example canopy cover, greenness distributions, or lodging) that feed genomic prediction, the practice of predicting a plant line's value from its DNA markers. Two engineering habits from computer vision quietly corrupt these measurements. First, the large field image is cut into a fixed grid of tiles that are processed separately. Each tile is normalized and processed in isolation, so brightness and confidence jump at tile seams, and those seams fall at regular positions across a regularly laid-out trial. Second, the usual cure for missing context is to give the network a wider view through attention, letting each location look at distant locations. In a breeding trial, though, a plot's neighbors are different genotypes. A model that looks across plot borders mixes neighbors' genetics and the shared soil into what should be one line's phenotype. More visual context, which is almost always good for image accuracy, can therefore reduce the genetic signal a breeder cares about.

This note proposes to send long-range context somewhere else. A low-resolution encoder looks at the whole field around a plot, with the plot itself masked out, and summarizes the local environment. That summary enters the statistical model as an environment term, not as part of the phenotype. Meanwhile the phenotype itself is extracted at full resolution from tiles cut along plot borders, so no seam passes through a plot. The bet is that global context helps genomic prediction when it explains environment and hurts when it leaks into the trait. Keeping the two apart should beat both plot-averaged phenotypes with coordinate-based spatial correction and end-to-end whole-field vision models.

Core Claim

The closest existing work handles each half separately. Mao et al. (2020) model field microenvironment as a Gaussian random field: a smooth random surface over plot coordinates, added to a marker-based genetic kernel. Spatial correction raised prediction accuracy from 0.2091 to 0.7575 on irrigated wheat and from 0.1930 to 0.4904 on maize compared with a compressed mixed linear model. Their spatial term, however, is an autoregressive process on a regular lattice of plot indices. It never sees the field, and it cannot connect disconnected trial sites. DeSalvio et al. (2025) show the image side matters: replacing a plot's median vegetation index with 100 quantiles of its pixel distribution improved maize yield prediction by 12.7% to 21.6% and revealed heritable traits. They extract those quantiles inside pre-cut plot shapes and ignore field-wide spatial structure.

We claim three things. First, an environment kernel learned from masked field imagery can replace or augment the coordinate lattice kernel. It works in irregular layouts and across sites, because two plots in different fields can share an environment embedding even though they share no lattice neighbors. Second, tile-grid artifacts and cross-plot leakage are measurable confounds that inflate apparent environmental variance or deflate heritability, and plot-aligned extraction removes them at no extra compute. Third, the gain comes from where the context is routed, not from how much context is used.

The model for an image-derived plot trait $y_i$ is

$$y_i = \mu + g_i + e_i + s_i + \varepsilon_i,\qquad g \sim N(0,\sigma_g^2 K_G),\; e \sim N(0,\sigma_e^2 K_Z),$$

The terms are defined as follows. $\mu$ is the trial mean. $K_G$ is the marker relationship kernel between lines. $K_Z$ is a radial basis kernel on environment embeddings $z_i$, which the masked context encoder produces from the field surrounding plot $i$. $s$ is an optional residual lattice term as in Mao et al. $\varepsilon$ is plot noise. Variance components are estimated by restricted maximum likelihood, as in standard breeding practice.

Research Program

The phenotype extractor tokenizes each plot at full ground resolution, using tiles defined by the trial's plot shapefile rather than a fixed grid. Attention runs freely within a plot and never across plot borders. Its output is a distributional summary in the style of DeSalvio et al., or a task head such as lodging. This replaces the grid tiling plus margin discarding used in MaskCount and the overlapping tiles plus box merging of Unel et al. (2019). Both of those methods were designed for object counting, where the unit of interest has no fixed geometry. In a breeding trial the plot boundary is known, so the seam problem largely goes away once tiles follow it.

The environment encoder borrows its structure from LFPNet, which feeds a downsampled wide-context patch into a high-resolution local decoder. Our encoder reads a downsampled window roughly four times the plot footprint, with the target plot's pixels blanked. Global self-attention over this coarse grid is affordable. The quadratic cost highlighted by the Spatial Planning Transformer only bites at fine resolution. The encoder's training signal is the critical design decision. It is trained to predict the phenotype of repeated check plots, the same standard variety planted throughout the trial, from their masked surroundings. Because check genotype is constant, check variation is environmental by construction, and the encoder cannot learn genetic shortcuts. Where checks are scarce, we use within-genotype deviations across replicates instead. The learned embedding $z_i$ then defines $K_Z$ for every plot.

The analysis side has two parts. The first is a seam diagnostic: re-run grid-tiled extraction with the grid shifted by half a tile, and estimate how much variance is assigned to a tile-identity random effect. A biologically real trait should be invariant to the shift. The second is a leakage diagnostic: let the phenotype extractor see across plot borders, and measure how heritability and the correlation of each plot's trait with its neighbors' genetic values change.

Baselines

The naive reference point is the plot median vegetation index fed to a genomic mixed model with no spatial term, the practice DeSalvio et al. improved upon. The tabular spatial baseline is Mao et al.'s marker kernel plus lattice autoregressive kernel, fit to the same plot phenotypes. On their own tabular wheat and maize data they report accuracies of 0.7575 and 0.4904, but those numbers are not on our imagery and serve only as context. The strongest existing image-side competitor is DeSalvio-style 100-quantile plot features combined with the Mao spatial kernel. Lacuna reports no result for that combination, and no reported genomic-prediction accuracy is found on Lacuna for DeSalvio's panels; their reported figure is the 12.7–21.6% yield gain over medians. For multiple sites we add the Bayesian multi-environment Gaussian kernel model from Weighted Kernels Improve Multi-Environment Genomic Prediction, which reports up to 31% gains over single-environment models on winter wheat. The end-to-end alternative is a whole-field transformer with unrestricted cross-plot attention that regresses the trait directly.

All methods share identical plots, marker data, cross-validation folds, and the same restricted maximum likelihood fitting. Deep components receive equal GPU-hour and hyperparameter-search budgets. Two ablations isolate the key ingredient: the environment encoder trained without plot masking, and an unmasked encoder whose output is added to the phenotype rather than routed to $K_Z$. Beating the strongest competitor means higher genomic prediction correlation on held-out lines, averaged over at least five fold splits, with non-overlapping bootstrap intervals. It also means no loss of heritability for the image traits.

Why not just…?

Why not just use plot quantiles with a standard spatial mixed model? This is the real threat. Coordinate-based spatial correction already captures smooth soil gradients, and DeSalvio-style features already capture within-plot detail. Our method should only win where the environment is not smooth in coordinates: waterlogged patches, field edges, irregular layouts, and especially across sites, where lattice kernels cannot operate, as Mao et al. acknowledge. If the image-derived $K_Z$ adds nothing over the lattice term within single regular fields, we will report that. The contribution would then narrow to the cross-site setting, which the leave-one-site-out experiment tests directly.

Why not just use overlapping tiles and keep the centers? MaskCount's edge-aware cropping cut counting error from 6.36 to 3.63 MAE, so overlap does fix seams. It costs two to five times the forward passes, and it still lets a tile's context cross plot borders. Plot-aligned tiling should match its seam robustness at one pass. The shifted-grid diagnostic will show whether either approach leaves residual tile-identity variance.

Why not just run a whole-field transformer end-to-end on yield? Downsampling to fit memory destroys small features. SelvaBox ties crown detection to centimeter ground resolution (SelvaBox). More fundamentally, unrestricted context lets a plot's prediction borrow neighbors' genotypes. The leakage diagnostic predicts that such a model scores well on random-plot splits and drops on held-out-line splits. That gap is the decisive comparison.

Why not just use row-column or moving-average adjustment? These are special cases of the lattice term and are included inside the Mao baseline. They share its inability to span sites.

Proposed Experiments

The primary data are temporal multispectral drone panels of the kind used by DeSalvio et al. for maize and cotton, together with the Saskatoon wheat and canola breeding orthomosaics from LodgedNet. The canola trial spans seven orthomosaics, which enables leave-one-orthomosaic-out evaluation. Access to genotype data and check-plot layouts is the main project risk; trials lacking either fall back to the replicate-deviation signal.

Three checks decide the claim. First, on held-out lines within a field, the full method must beat quantiles plus the lattice kernel; otherwise the image environment kernel is redundant. Second, in leave-one-site-out prediction, $K_Z$ must improve over the multi-environment Gaussian kernel baseline, which tests the cross-domain promise. Third, the two ablations must show that unmasked or phenotype-routed context lowers held-out-line accuracy or heritability relative to masked, environment-routed context. If unmasked context performs as well, the leakage hypothesis is wrong and the proposal reduces to "add an image environment covariate."

The shifted-grid test is run on all grid-tiled baselines and reports the tile-identity variance fraction. A semi-synthetic control complements it: simulated genetic values are painted onto real orthomosaic plots as known canopy shifts. With the true genetic variance known, we can check that the method recovers it rather than merely scoring well.