Stover U-Net

A U-Net that classifies every pixel of a downward-facing field photo as bare soil, green canopy, or crop residue. It is the model used by the Stover web app and Windows app (soilwater.github.io/stover). Model version 20261122, about 17.5 million parameters, ONNX opset 17.

Training data

Trained on the Stover dataset: 5,000 images of agricultural fields in Kansas at 1024 × 1024 pixels with pixel-level labels.

Input and output

  • Input input: float32, shape [batch, 3, height, width], RGB values scaled to 0–1 (pixel / 255), channels first. Height and width must be multiples of 16. The model was evaluated at 1024 × 1024.
  • Output output: float32, shape [batch, 3, height, width], one raw score (logit) per class. The class of each pixel is the index of the largest score: 0 soil, 1 plant (green canopy), 2 residue.

Take photos straight down from about 1 m above the ground, covering about 1 m × 1 m. Crop the center square of the photo and resize it to 1024 × 1024 pixels (about 1 mm per pixel).

Example (Python)

import numpy as np
import onnxruntime as ort
from PIL import Image

session = ort.InferenceSession("model.onnx")

img = Image.open("photo.jpg").convert("RGB")
side = min(img.size)
left, top = (img.width - side) // 2, (img.height - side) // 2
img = img.crop((left, top, left + side, top + side)).resize((1024, 1024), Image.LANCZOS)

x = (np.asarray(img, np.float32) / 255).transpose(2, 0, 1)[None]
classes = session.run(None, {"input": x})[0][0].argmax(0)   # 0 soil, 1 plant, 2 residue

for c, name in enumerate(["soil", "plant", "residue"]):
    print(f"{name}: {(classes == c).mean() * 100:.1f}%")

Performance

Test set of 526 images that were not used for training:

Metric Value
Pixel accuracy 0.972
Mean IoU 0.940
IoU soil / plant / residue 0.939 / 0.931 / 0.951
Per-image cover error (95% range) ±3.2% residue, ±3.2% soil, ±0.5% plant

Limitations

The training images come from fields in Kansas. Accuracy may be lower for other crops, residue types, or soils. The model cannot see residue hidden under a crop canopy.

Citation

Please cite the paper when you use the model:

Patrignani, A., Bisheh, M., & Nahitiya, D. (in press). Segmenting crop residue, canopy, and soil in field images: An open dataset and the Stover tool. Agronomy Journal.

@article{patrignani_stover,
  author  = {Patrignani, A. and Bisheh, M. and Nahitiya, D.},
  title   = {Segmenting crop residue, canopy, and soil in field images: An open dataset and the Stover tool},
  journal = {Agronomy Journal},
  note    = {In press}
}

License

Licensed under CC BY 4.0. Please cite the paper above when you use it.

Contact

Andres Patrignani, Department of Agronomy, Kansas State University (andrespatrignani@ksu.edu)

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train apatrig/stover-unet