MV-STRiVE
Multi-view STRiVE for maize leaf screening. One case is 1–4 photos of the same plant (and, optionally, a short text per photo). The model returns three classes:
| index | class | meaning |
|---|---|---|
| 0 | healthy_no_clear_stress (H) |
no clear stress |
| 1 | nlb_tlb_like (B) |
northern / turcicum leaf blight-like lesions |
| 2 | faw_like (I) |
fall armyworm-like feeding injury |
Architecture: every photo goes through the same DINOv2-B/14 encoder (STRiVE's adapted blocks 8–11). A 2-layer, 12-head fusion transformer reads a case query, each photo's CLS token and the optional text tokens (frozen all-MiniLM-L6-v2). Its output enters through a zero-initialised gate:
a* = mean_v a_v + tanh(g) · P(fusion(query, a_1..a_V, text))
z = W a* + b + [0, mean over all patches of all views of U h]
p = softmax(z / T)
With one photo and no text, it is exactly STRiVE. Training starts from the STRiVE seed-41/42/43 checkpoints and uses cross entropy plus a 0.25 × CVaR tail over source × class groups. It runs for 6 epochs and keeps the epoch with the best VAL NLL.
Which checkpoint to use
Use img_s42/best.safetensors, the views-only seed 42, with T = 0.713.
- It has the lowest VAL NLL of all six runs (0.0941 calibrated at 448 px; 0.1308 at the 224 px selection resolution) and the best VAL accuracy (98.32%).
- It is also the best views-only run on TEST.
- It needs only photos. The pipeline has no per-photo text at inference.
text_s41 has the highest TEST accuracy (91.58%). However, that ranking comes from looking at TEST, and the text runs vary a lot between seeds (86.08–91.58%). The text runs also need a Codex-style description of every photo. Use it only if you have that text and accept the variance.
Plain STRiVE with mean-logit averaging over photos is still the stronger multi-photo method on this TEST split: 91.10% overall and 91.57% on the 83 multi-photo cases. Prefer it when you do not need a single fused model.
Results (calibrated, T fitted on CAL)
| run | T | VAL acc | VAL NLL | TEST acc | TEST macro-F1 | TEST missed damage | TEST false alarm | TEST NLL | TEST ECE | TEST multi-photo acc (n=83) |
|---|---|---|---|---|---|---|---|---|---|---|
| img_s41 | 0.693 | 98.15 | 0.0949 | 88.23 | 86.88 | 13.70 | 2.76 | 0.486 | 8.51 | 87.95 |
| img_s42 | 0.713 | 98.32 | 0.0941 | 89.23 | 88.27 | 12.97 | 2.89 | 0.454 | 7.74 | 86.75 |
| img_s43 | 0.693 | 98.21 | 0.0956 | 87.88 | 86.45 | 13.97 | 3.82 | 0.505 | 9.04 | 87.95 |
| text_s41 | 0.579 | 97.57 | 0.1048 | 91.58 | 90.68 | 7.90 | 4.42 | 0.267 | 4.37 | 92.77 |
| text_s42 | 0.607 | 98.06 | 0.1121 | 86.08 | 84.89 | 18.95 | 1.36 | 0.482 | 4.80 | 81.93 |
| text_s43 | 0.538 | 97.53 | 0.1144 | 87.44 | 86.15 | 13.45 | 4.29 | 0.365 | 2.45 | 81.93 |
Accuracy, F1, missed damage and false alarm are in %. Missed damage is damage called healthy; false alarm is healthy called damage. Over 3 seeds, views-only scores 88.45 ± 0.70% and views + text 88.36 ± 2.86%, against STRiVE at 90.55 ± 0.59%. TEST is held out by source, so it is much harder than VAL.
Files
Each run folder (img_s41 … text_s43) has:
best.safetensors: full model weights (encoder, fusion, head W/b, patch head U). It does not include the frozen MiniLM text encoder.config.json: the training config.evaluation.json: every metric on VAL / CAL / TEST, compared with STRiVE first-view, mean-logit and mean-probability. It also has the fitted temperatures.val_history.json: VAL metrics after each epoch.done.json: the training summary.
The optimiser state (last.pt) and the per-case predictions are not uploaded.
Loading
The model code is safemaize/mvstrive/model.py in the SafeMaize repo (github.com/saitejalekkala33/safemaize-agent).
import numpy as np, torch
from PIL import Image
from huggingface_hub import hf_hub_download
from safetensors.torch import load_file
from safemaize.mvstrive.model import MVStrive
run, T = "img_s42", 0.713
model = MVStrive(fusion_layers=2, fusion_dropout=0.1, text_encoder=None) # text runs: "sentence-transformers/all-MiniLM-L6-v2"
model.load_state_dict(load_file(hf_hub_download("saiteja33/MV-STRiVE", f"{run}/best.safetensors")), strict=False)
model.eval()
MEAN, STD = np.array([0.485, 0.456, 0.406]), np.array([0.229, 0.224, 0.225])
def pixels(path, size=448): # shorter side to 448, centre crop, ImageNet normalisation
img = Image.open(path).convert("RGB")
w, h = img.size
img = img.resize((size, int(size * h / w)) if w <= h else (int(size * w / h), size), Image.BICUBIC)
l, t = round((img.width - size) / 2), round((img.height - size) / 2)
x = (np.asarray(img.crop((l, t, l + size, t + size)), np.float32) / 255 - MEAN) / STD
return torch.from_numpy(x.transpose(2, 0, 1)).float()
views = torch.stack([pixels(p) for p in ["photo1.jpg", "photo2.jpg"]])[None] # [1, V, 3, 448, 448]
mask = torch.ones(1, views.shape[1], dtype=torch.bool)
with torch.no_grad():
probs = torch.softmax(model(views, mask)["logits"] / T, -1)[0] # H, B, I
Use at most 4 photos per case, which is what the model was trained with. For the text runs, pass one string per case as texts=["View 1: <observation> View 2: <observation>"] to model(...). This is the training format, with photos that have no text left out.