This file tracks all experiments, model runs, and benchmark evaluations in chronological order.
Experiment #001 β Pretrained Backbone Verification on Hardware (Phase 2)
Date: 2026-09-28
Objective: Verify that PyTorch with CUDA 12.8 can load the official FoMo4Wheat_base.pth checkpoint and run inference on the NVIDIA RTX 5070 GPU (Blackwell sm_120) without errors.
The original repository had two compatibility hurdles with modern tooling:
torch.load default switched to weights_only=True in PyTorch 2.6+, requiring explicit handling of the saved DinoVisionTransformer object.
The authors used from dinov2.layers import ... internally despite renaming the repo folder to FoMo4Wheat. Solved via dinov2 -> FoMo4Wheat symlink.
The RTX 5070 handles the ViT-B/14 forward pass smoothly in fp16 with minimal memory footprint (< 400 MB reserved).
The foundation model is fully operational and ready for downstream probing.
Experiment #002 β Downstream 6-Class Linear Probe Classifier on WGSP Benchmark (Phase 5)
Date: 2026-10-16
Objective: Train and evaluate a downstream linear classification head on top of frozen FoMo4Wheat ViT-B/14 representations across the 6 official WGSP growth stages (Tillering, Jointing, Booting, Anthesis, Grain Filling, Maturity).
Misclassifications occur almost exclusively between temporally contiguous stages:
1_jointing vs 2_booting (39 + 53 = 92 samples)
2_booting vs 3_anthesis (90 + 35 = 125 samples)
0_tillering vs 1_jointing (46 + 50 = 96 samples)
There is virtually zero confusion between early vegetative and late reproductive stages (e.g. Booting vs Maturity is $0$). This reflects continuous biological transitions in wheat phenology rather than random classification errors.
Exceptional Late-Stage Performance:
Grain Filling ($98.73%$ F1) and Maturity ($98.94%$ F1) are classified with near-perfect accuracy due to distinct color, canopy structure, and senescent visual cues.
Training & Inference Efficiency:
Feature caching extracted all 21,347 1536-D embeddings in ~5 minutes on RTX 5070.
Training the linear probe head took under 4 seconds.
Single-image inference runs in ~18 ms on GPU, making it ideal for edge deployment, backend REST APIs, and mobile integration.
Experiment #003 β Root Cause Resolution & Linear Probe Retraining with Aligned SwiGLU ViT Backbone (Phase 5 Refinement)
Date: 2026-10-18
Objective: Diagnose and eliminate the live inference failure where the model returned a constant stage across all images; synchronize frozen backbone representations and retrain downstream linear classifier head.
Root Cause Identified:
Older evaluation scripts instantiated the backbone with ffn_layer="mlp" and block_chunks=0 (strict=False), silently dropping weights from the checkpoint.
The saved checkpoint was pickled with SwiGLUFFNFused from an older xFormers version; modern instantiations generated feature spaces that had near-zero cosine similarity ($\approx -0.05$) with stale cached features.
Multiprocessing resource sharing (num_workers=4 with pin_memory=True) saturated /dev/shm causing BrokenPipeError during extraction.
Verified across raw RGB test images through the live FastAPI endpoint (POST /api/v1/ai/growth-stage/predict).
All 6 stages identified accurately with high confidence (78.6%β100.0%) and average latency of ~15β28 ms on RTX 5070.
Experiment #004 β Realistic & Out-of-Distribution Field Evaluation (Phase 6)
Date: 2026-11-04
Objective: Assess domain generalization, camera angle robustness, and out-of-distribution weed interference for the trained linear probe classifier (weight/nextgenyeild_wgsp_head_v1.pth atop frozen FoMo4Wheat_base.pth) on:
Handheld mobile photography (WGSP-Smartphone-Data) across all 6 WGSP growth stages.
Real Pakistani field conditions (Kaggle Peshawar Dataset) evaluating natural soil backgrounds, early vegetative wheat phenology, and weed diagnostic interference.
WGSP-Smartphone-Data:9,978 balanced images (1,663 images per class across 0_tillering, 1_jointing, 2_booting, 3_anthesis, 4_grain_filling, 5_maturity). Captured via various handheld smartphones with realistic motion blur, camera tilts, variable depths, and lighting.
Peshawar Pakistani Wheat:159 high-resolution images (3072Γ4080, 12 MP) from Khyber Pakhtunkhwa, Pakistan, capturing early vegetative wheat stages under local field soil conditions.
Peshawar Pakistani Weeds:159 high-resolution images (10 prominent local weed species, e.g. Phalaris minor, Chenopodium album, Rumex dentatus) tested as out-of-distribution canopy noise.
3. Pakistani Field Conditions & Weed Interference Analysis:
A. Field Wheat Phenology (Peshawar):
Predictions:1_jointing (81.8%), 0_tillering (13.8%), 2_booting (1.9%), 5_maturity (2.5%, average confidence only 45.0%), 3_anthesis (0.0%), 4_grain_filling (0.0%).
Validation: Over 95.6% of real Pakistani field wheat images were accurately identified as early vegetative stages (tillering and jointing), consistent with Weeks 1 and 2 field records.
Zero Contradiction: Zero false predictions into flowering or grain-filling, confirming that the foundation model's frozen representations generalize naturally to local Pakistani soil without retraining.
B. Weed Interference Diagnostics (Out-of-Distribution Noise):
Confidence Deterioration: Overall mean confidence drops by 5.06% ($85.23% \to 80.17%$). Low-confidence predictions ($<60%$) surge from $12.6%$ to $20.1%$ (nearly doubled).
Spurious Class Bleed: Dense weed clusters cause spurious predictions in reproductive stages: 2_booting (8.2%), 5_maturity (6.9%), 4_grain_filling (1.3%), and 3_anthesis (0.6%).
Architectural Justification: This conclusively demonstrates the necessity of the Image Quality & Canopy Gatekeeper (Phase 11). Weed-infested or non-canopy inputs must be caught by pre-inference edge filtering to prevent erroneous agronomic advice.
4. Scientific Conclusions & Actionable Insights for Phase 7:
Strict Temporal Contiguity Preserved:
Despite camera shake, variable focal distances, and smartphone angle shifts, errors are strictly confined to biologically adjacent stages (e.g. Grain Filling $\leftrightarrow$ Maturity, Booting $\leftrightarrow$ Anthesis). Zero tillering crops were misidentified as mature, and zero mature crops were misidentified as tillering or jointing.
The Perspective Shift Failure Mode:
The single largest point of degradation is 0_tillering misclassified as 1_jointing (75.9% of tillering samples).
Root Cause: Handheld smartphone photographers naturally tilt phones obliquely ($30^\circ - 60^\circ$) and step closer to individual plants. From this perspective, young leafy tillers appear elongated like vertical stem nodes (1_jointing). In contrast, top-down canopy rigs (WGSP-CN) see tillering as flat ground cover.
Decisive Verdict for Phase 7 ("Determine Fine-Tuning Need"):
A frozen linear head trained exclusively on tripod-mounted top-down canopy rigs drops from 99.06% down to 66.74% on handheld smartphone photos.
Verdict: While late reproductive stages remain robust (Grain Filling $81.79%$ F1, Maturity $87.06%$ F1), parameter-efficient adaptation (LoRA) or linear probe adaptation on smartphone perspectives is strongly justified and necessary to achieve $>85%$ target accuracy in a mobile farmer companion app.
In addition, the In-Camera Viewfinder HUD (Phase 11 / 14) with an IMU tilt reticle ($45^\circ - 85^\circ$ downward) will mechanically prevent shallow-angle photos before they reach the model.