Instance segmentation of maize leaves and stems in field images with Ultralytics YOLOv11-seg. The project goes beyond training a model. It tests a hypothesis about what limits performance and audits the model's errors by hand to see how much of the "error" comes from the dataset itself.
Key findings
- A model with ~3× more parameters (
yolo11s-segvsyolo11n-seg) gave no improvement: all differences fell within ±0.02 mask mAP50. This points to a data ceiling, not a capacity limit. - A manual audit of 16 validation images found that 21% of false positives were real objects missing from the labels. Metrics therefore underestimate true performance.
- Label noise does not explain everything. The model also produces duplicate masks and misses thin stems (23 of 28 false negatives).
| Source | Corn – Roboflow Universe, version 2 |
| License | CC BY 4.0 |
| Task | Instance segmentation (polygon masks) |
| Classes | leaf (0), stem (1) |
| Split | 471 train / 134 validation / 67 test images (672 total) |
The images are screenshots of short social-media videos taken at ground level, looking at the plants from the side. Many include subtitles and app icons. This matters later:
- The images differ strongly from the aerial/UAV imagery typically used in crop monitoring (a domain shift).
- They were not captured with annotation in mind.
The dataset is not included in this repository. The notebook downloads it with a (free) Roboflow API key.
Hypothesis (stated after the baseline yolo11n-seg run and before training yolo11s-seg): the dataset, not model capacity, limits performance. A larger model will not improve results meaningfully. It was informed by label errors I noticed when I downloaded the dataset and by the baseline's poor precision.
Decision rule (fixed before training yolo11s-seg): a change smaller than ±0.02 mask mAP50 counts as "no change". This is a rough, practical cutoff for what would count as a meaningful difference (the value was suggested by Claude). Run-to-run variance was not measured (see Limitations).
Setup: COCO-pretrained weights (transfer learning), 50 epochs, imgsz=640, Ultralytics defaults. The optimizer was auto-selected as AdamW with learning-rate warm-up and decay. Only the model size changes between runs.
| Model | mAP50 (all) | mAP50 leaf | mAP50 stem |
|---|---|---|---|
yolo11n-seg |
0.496 | 0.535 | 0.457 |
yolo11s-seg |
0.493 | 0.523 | 0.463 |
| Difference (s − n) | −0.003 | −0.012 | +0.006 |
Hypothesis confirmed: every difference is within ±0.02.
- The normalized confusion matrices are almost the same for both models: ~0.90 of leaves and ~0.91 of stems are classified correctly. Most errors come from predictions on unlabeled regions ("background" column), not from leaf/stem confusion.
- Training curves show validation loss still decreasing at the end, so there is no overfitting. mAP plateaus over the last ~15 epochs.
- Since the larger model gives no gain, the smaller
yolo11n-segis the better choice: it is faster and lighter.
Low precision on a dataset can mean the model is wrong, or that the labels are. To tell the two apart, I compared ground truth and predictions for all 16 images of the first validation batch (val_batch0) of the yolo11n-seg model.
Rules (defined before reviewing):
- False positive (FP): a prediction with no matching label. Each FP was classified as:
- Missing label: a clear, visible leaf or stem that should have been annotated.
- Model error: a duplicate mask on the same object, or a wrong object (e.g. an ear of corn predicted as a leaf).
- Unclear: a heavily occluded object, more than half outside the frame, or impossible to judge at the available resolution.
- False negative (FN): a labeled object the model did not detect, tagged with a likely cause (thin, small, occluded, at the image border).
| False positives (38) | Count | Share |
|---|---|---|
| Missing label | 8 | 21% |
| Model error | 14 | 37% |
| Unclear | 16 | 42% |
| False negatives (28) | Count |
|---|---|
| Stems | 23 |
| Leaves | 5 |
What this shows
- The dataset has missing annotations. One in five false positives is actually a correct detection, so precision and mAP understate the model's real performance.
- The model has its own failure modes. The most common is duplicate masks on the same leaf. It also confuses classes occasionally (an ear of corn as a leaf, a stem as a leaf).
- Thin stems are the main weakness. Most missed objects are stems, which matches the stem class having the lowest mAP. A thin object loses detail when the image is resized to 640 px, and a few pixels of error change its IoU a lot.
Left: ground-truth labels. Right: yolo11n-seg predictions.
The full audit, one row per error, is in analysis/label_audit.xlsx.
- Single seed per model. Training is deterministic with Ultralytics' default
seed=0, so re-running the notebook reproduces the same numbers but says nothing about run-to-run variance. The ±0.02 rule is a practical threshold, not a statistical test. - Noisy labels. Absolute metrics are not directly comparable with results reported on cleaner datasets.
- Small audit, reduced images. The audit covers 16 images, reviewed from downsized batch mosaics. Many cases had to be marked "unclear", and the most crowded image has approximate counts.
- Domain shift. The models were trained and evaluated only on ground-level images and were not tested on aerial or UAV imagery.
- Repeat each configuration with 3 different seeds to measure variance and test the ±0.02 rule properly.
- Try a larger input size (
imgsz=1024), which may help thin stems specifically. - Automate the audit: flag high-confidence predictions with no overlapping label as candidate missing annotations.
├── README.md
├── notebook/
│ └── corn_leaf_stem_segmentation_yolo11.ipynb
├── results/
│ ├── yolo11n/ # results.png, results.csv, confusion_matrix_normalized.png
│ ├── yolo11s/ # same files for the larger model
│ └── examples/ # val_batch0_labels.jpg, val_batch0_pred.jpg
└── analysis/
└── label_audit.xlsx # manual error audit
Model weights (.pt) are not included.
- Open
notebook/corn_leaf_stem_segmentation_yolo11.ipynbin Google Colab and select a T4 GPU (Runtime → Change runtime type). - Create a free Roboflow account. Add your API key to Colab Secrets (🔑 icon) as
ROBOFLOW_API_KEY. - Run all cells in order. Each model takes roughly 10–15 minutes to train on a T4.
Training, the notebook code, the manual label audit, and the conclusions are my own work. I used Claude (Anthropic) as follows:
- Formatting the notebook and producing its charts.
- Formatting the audit spreadsheet (the entries come from my own review).
- Writing this README from my results.
- Guidance: after my first training run, Claude asked whether a larger model would help (my answer and reasoning are mine), suggested the ±0.02 threshold, and helped me name the "data ceiling" idea I had reached.
- Dataset: Corn by Aurora on Roboflow Universe (CC BY 4.0).
- Model and training framework: Ultralytics YOLO11.
Pedro Damián Reyes Alvarado, B.Eng. Artificial Intelligence student, Universidad Panamericana (Aguascalientes, Mexico) LinkedIn · GitHub
