luka.gouvea
← projects
Research · Undergraduate thesis at UFV · 2026

Mask refiners for agricultural field delineation

Evaluation of segmentation mask refiners on 10 m/pixel Sentinel-2 imagery from PASTIS, in two experiments, one with maize only and one with all crops.

Context

Delineating agricultural fields in satellite imagery underpins applications such as crop monitoring and agricultural statistics. Segmentation models produce masks for this task, but they often misplace boundaries, merge neighboring fields and split single fields into fragments.

Model-agnostic refiners correct the mask after segmentation, without changing or retraining the segmenter. Existing ones were designed for natural images, and their use on agricultural fields has focused on high-resolution imagery. At 10 m/pixel, small fields and narrow boundaries span only a few pixels.

Data and protocol

Both experiments use the same dataset with different targets. Maize is a small, sparse class; all crops requires the refiner to separate each field from the background and from its neighbors.

Experiment 1 · maize

Target and initial masks

Maize against everything else: every other label counts as negative, and every pixel is scored. The initial masks come from three models: U-TAE and U-Net 3D, which use the full time series, and U-Net 2D, which uses only the median over dates and produces much worse masks.

Patch 30052Patch 30052 · Median RGBPatch 30052 · ReferencePatch 30052 · U-TAE · IoU 80.1%IoU 80.1%Patch 30052 · U-Net 3D · IoU 85.0%IoU 85.0%Patch 30052 · U-Net 2D · IoU 22.8%IoU 22.8%
Maize in yellow. The same patch segmented by the three models: the ones using the time series get most fields right, while U-Net 2D marks maize across much of the patch.

Refiners

To use the 10 bands in CascadePSP without losing its RGB pretraining, I added connections for the 7 extra bands to the first convolution, with weights initialized to zero. At the start of training the network behaves exactly like the original; only these connections, the PSP module and the decoder are trained, and the encoder stays frozen.

Spectral adaptation of CascadePSPConv1 · 13 → 64X · 10 bandsSentinel-2 median3 masksC · S8 · S4RGB + masks6 channels7 extra bandsnew connectionsinitial weights = 0X · 10 bandsEncoder ResNet-50+ BatchNormPSPDecoderspectral fusionRefined maskSpectral adaptation of CascadePSPConv1 · 13 → 64X · 10 bandsSentinel-2 median3 masksC · S8 · S4RGB + masks6 channels7 extra bandsnew connectionsinitial weights = 0Encoder ResNet-50+ BatchNormPSPDecoderspectral fusionX · 10 bandsRefined mask
frozen weightstrainable

Results

Change in IoU after refinement, in percentage points. Positive values are gains.

U-TAE U-Net 3D U-Net 2D
Initial mask IoU 77.6% 76.8% 54.7%
SegRefiner +0.3 ¹ +0.4 +2.0
CascadePSP RGB −1.5 ² −0.8 ² +2.2
CascadePSP 10 bands −1.4 ² −1.0 ² +2.7
PromptMoE · SAM ViT-H −15.1 −14.1 −7.5
PromptMoE · HyperFree-H −17.6 −17.0 −10.4
SAMRefiner · SAM ViT-H −24.1 −23.9 −16.1
SAMRefiner · HyperFree-H −15.3 −14.9 −8.5

¹ Three completed folds; all others have five. ² Applied by transfer, using the model tuned on U-Net 2D.

Examples

The same five test patches, all starting from the U-Net 2D mask. The first four rows are the best or worst case of some refiner, picked after evaluation; the last one was drawn at random. They show how much results vary from patch to patch, not average performance.

30355 · best case for CascadePSP RGB30355 · best case for CascadePSP RGB · Reference30355 · best case for CascadePSP RGB · Initial (U-Net 2D) · IoU 43.2%IoU 43.2%30355 · best case for CascadePSP RGB · CascadePSP RGB · IoU 86.7%IoU 86.7%30355 · best case for CascadePSP RGB · CascadePSP 10 bands · IoU 80.5%IoU 80.5%30355 · best case for CascadePSP RGB · SegRefiner · IoU 34.3%IoU 34.3%30184 · best case for CascadePSP 10 bands30184 · best case for CascadePSP 10 bands · Reference30184 · best case for CascadePSP 10 bands · Initial (U-Net 2D) · IoU 36.7%IoU 36.7%30184 · best case for CascadePSP 10 bands · CascadePSP RGB · IoU 58.4%IoU 58.4%30184 · best case for CascadePSP 10 bands · CascadePSP 10 bands · IoU 82.9%IoU 82.9%30184 · best case for CascadePSP 10 bands · SegRefiner · IoU 44.6%IoU 44.6%30117 · best case for SegRefiner30117 · best case for SegRefiner · Reference30117 · best case for SegRefiner · Initial (U-Net 2D) · IoU 51.4%IoU 51.4%30117 · best case for SegRefiner · CascadePSP RGB · IoU 0.0%IoU 0.0%30117 · best case for SegRefiner · CascadePSP 10 bands · IoU 90.3%IoU 90.3%30117 · best case for SegRefiner · SegRefiner · IoU 78.5%IoU 78.5%30363 · worst case for CascadePSP 10 bands30363 · worst case for CascadePSP 10 bands · Reference30363 · worst case for CascadePSP 10 bands · Initial (U-Net 2D) · IoU 70.3%IoU 70.3%30363 · worst case for CascadePSP 10 bands · CascadePSP RGB · IoU 82.0%IoU 82.0%30363 · worst case for CascadePSP 10 bands · CascadePSP 10 bands · IoU 0.0%IoU 0.0%30363 · worst case for CascadePSP 10 bands · SegRefiner · IoU 77.4%IoU 77.4%30052 · random30052 · random · Reference30052 · random · Initial (U-Net 2D) · IoU 22.8%IoU 22.8%30052 · random · CascadePSP RGB · IoU 24.8%IoU 24.8%30052 · random · CascadePSP 10 bands · IoU 34.2%IoU 34.2%30052 · random · SegRefiner · IoU 24.1%IoU 24.1%
Maize in yellow over the darkened median RGB. Each patch is 128 × 128 pixels at 10 m, shown without smoothing.

Experiment 2 · all crops

Target and initial masks

All agricultural fields against the background, on all 2,433 PASTIS patches. Each field’s margin counts as background, so neighboring fields are separated in the reference, and unlabeled areas are ignored. The initial masks come from HRNet and U-Net 2D, both on the 10 median bands, and from a NeuroFuser CNN that the refiner never saw during training.

Refiner

CascadePSP on the 10 bands, in two stages: pretraining on artificially degraded masks, which don’t depend on any segmentation model, then tuning on 80% real masks (HRNet and U-Net 2D in equal parts) and 20% synthetic ones, with a BCE loss plus an edge term. One model per fold. For comparison, SAMRefiner without training and SAMRefiner++, which uses LoRA to adapt the SAM ViT-B layer that estimates IoU and chooses among candidate masks.

Results

Change after refinement, in percentage points, averaged over five folds with 2,433 patches per segmentation model.

HRNet U-Net 2D NeuroFuser CNN ³
Initial mask IoU 71.5% 70.7% 71.1%
CascadePSP · IoU −0.2 +0.1 0.0
CascadePSP · Boundary IoU +0.6 +0.8 +0.9
CascadePSP · AP50 +0.8 +2.6 +3.0
CascadePSP · AR50 +1.3 +3.2 +3.9
SAMRefiner · IoU −3.4 −3.0 −3.2
SAMRefiner · AP50 −20.2 −17.4 −17.9
SAMRefiner++ (LoRA) · IoU −1.1 −0.9 −1.0
SAMRefiner++ (LoRA) · AP50 −7.7 −6.9 −7.4

³ Applied by transfer: no refiner was tuned on masks from this CNN.

Examples

One randomly drawn patch from each test fold, chosen using the reference only, before and after CascadePSP.

20214 · fold 120214 · fold 1 · Median RGB20214 · fold 1 · Reference20214 · fold 1 · HRNet · IoU 82.1%IoU 82.1%20214 · fold 1 · HRNet + CascadePSP · IoU 81.7%IoU 81.7%20214 · fold 1 · U-Net 2D · IoU 81.8%IoU 81.8%20214 · fold 1 · U-Net 2D + CascadePSP · IoU 81.5%IoU 81.5%30497 · fold 230497 · fold 2 · Median RGB30497 · fold 2 · Reference30497 · fold 2 · HRNet · IoU 79.9%IoU 79.9%30497 · fold 2 · HRNet + CascadePSP · IoU 80.6%IoU 80.6%30497 · fold 2 · U-Net 2D · IoU 79.6%IoU 79.6%30497 · fold 2 · U-Net 2D + CascadePSP · IoU 81.0%IoU 81.0%10146 · fold 310146 · fold 3 · Median RGB10146 · fold 3 · Reference10146 · fold 3 · HRNet · IoU 73.2%IoU 73.2%10146 · fold 3 · HRNet + CascadePSP · IoU 73.7%IoU 73.7%10146 · fold 3 · U-Net 2D · IoU 75.5%IoU 75.5%10146 · fold 3 · U-Net 2D + CascadePSP · IoU 75.2%IoU 75.2%20365 · fold 420365 · fold 4 · Median RGB20365 · fold 4 · Reference20365 · fold 4 · HRNet · IoU 45.7%IoU 45.7%20365 · fold 4 · HRNet + CascadePSP · IoU 44.5%IoU 44.5%20365 · fold 4 · U-Net 2D · IoU 40.9%IoU 40.9%20365 · fold 4 · U-Net 2D + CascadePSP · IoU 42.4%IoU 42.4%30442 · fold 530442 · fold 5 · Median RGB30442 · fold 5 · Reference30442 · fold 5 · HRNet · IoU 71.4%IoU 71.4%30442 · fold 5 · HRNet + CascadePSP · IoU 70.9%IoU 70.9%30442 · fold 5 · U-Net 2D · IoU 63.3%IoU 63.3%30442 · fold 5 · U-Net 2D + CascadePSP · IoU 65.3%IoU 65.3%
Green: correctly predicted field. Orange: false positive. Pink: false negative. Gray: unlabeled area, ignored. Each patch is 128 × 128 pixels at 10 m, shown without smoothing.

What both show

Next steps

Identify the conditions under which each refiner fixes or harms the delineation, for example by field size and initial mask quality, and adapt refinement to 10 m/pixel imagery.

Advisor

Prof. Hugo Neves, Department of Informatics, UFV.

Stack

Semantic segmentation · Mask refinement · Remote sensing · PyTorch · Multispectral imagery · Fine-tuning · LoRA