GateDistill-NPK: A Novel Reject-Aware Distillation Framework for Rice-Leaf Macronutrient-Deficiency Diagnosis

Deficiencies of nitrogen (N), phosphorus (P), and potassium (K) constitute a leading yet largely correctable cause of rice-yield loss, but operational diagnosis remains constrained by scarce agronomic expertise and by destructive laboratory assays that do not scale to smallholder cultivation. Prevailing image classifiers entangle two decisions that ought to be separated, namely whether a leaf is a deficient paddy leaf and, conditionally, which nutrient is depleted, and they provide no mechanism for rejecting the out-of-domain imagery that field acquisition unavoidably yields. This work introduces GateDistill-NPK, a reject-aware cascade that decouples detection from differential diagnosis. A first-stage EfficientNet-B0 gate assigns each image to a deficient, healthy, or non-paddy outcome, converting out-ofdomain inputs into an explicit rejection rather than a spurious nutrient label. Only deficient images advance to a compact Scratch-Fusion MobileNetV2 student (SF-MV2), which fuses a pre-trained MobileNetV2 backbone with a from-scratch convolutional branch and is optimized by temperature-scaled distillation from a ResNet-50 teacher; a deterministic rule then maps the prediction to a fertilizer prescription. Evaluation uses a threesource corpus of 8,037 images, deliberately assembled so that each gate category originates from an independent acquisition domain. The gate attains 94.35% test accuracy with a 0.9732 micro-averaged area under the curve (AUC), while SF-MV2 delivers 87.83% accuracy, 0.9181 balanced accuracy, and a 0.9789 AUC using only 2.72 M parameters, an 8.8× compression that preserves accuracy comparable to its teacher. These results establish that reject-aware gating and cross-capacity distillation can be unified within one edge deployable pipeline for trustworthy in-field nutrient diagnosis.