Paper deep dive
Few-Shot Ordinal Learning for Day-Wise Freshness Estimation with Hyperspectral Fish Images
Kazi Nabiul Alam, Pooneh Bagheri Zadeh, Akbar Sheikh-Akbari
Intelligence
Status: not_run | Model: - | Prompt: - | Confidence: 0%
Entities (0)
Relation Signals (0)
No relation signals yet.
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:Non-destructive food quality assessment has increasingly benefited from hyperspectral imaging (HSI), which captures spectral signatures linked to biochemical changes during storage. Estimating day-wise freshness, however, remains challenging owing to strong inter-fillet variability and scarce labelled data per product. All existing deep learning approaches for HSI-based freshness prediction operate under full supervision, requiring densely annotated training sets that are costly to obtain at the individual-product level. We introduce, to the best of our knowledge, the first few-shot learning framework for HSI-based food quality estimation. Each fillet defines a distinct episodic task, and a CORAL-style ordinal prediction head captures the ranked nature of freshness progression through cumulative threshold modelling. Biologically grounded monotonicity and embedding smoothness constraints further guide predictions toward plausible trajectories. On a 16-day salmon HSI dataset under a strict unseen-fillet protocol, our method achieves a mean absolute error of 1.58 days and 2-day accuracy of 72.3% with only three labelled days per fillet, substantially outperforming scalar regression and label-distribution baselines under an identical unseen-fillet protocol.
Tags
Links
- Source: https://arxiv.org/abs/2608.12230v1
- Canonical: https://arxiv.org/abs/2608.12230v1
Trouble viewing inline? Open PDF directly →
Full Text
22,298 characters extracted from source content.
Expand or collapse full text
Few-Shot Ordinal Learning for Day-Wise Freshness Estimation with Hyperspectral Fish Images Kazi Nabiul Alam 1, Pooneh Bagheri-Zadeh 1, Akbar Sheikh-Akbari 1⋆ Affiliation: 1School of Built Environment, Engineering and Computing, Leeds Beckett University, Leeds, United Kingdom. Correspondence: A.Sheikh-Akbari@leedsbeckett.ac.uk Abstract Non-destructive food quality assessment has increasingly benefited from hyperspectral imaging (HSI), which captures spectral signatures linked to biochemical changes during storage. Estimating day-wise freshness, however, remains challenging owing to strong inter-fillet variability and scarce labelled data per product. All existing deep learning approaches for HSI-based freshness prediction operate under full supervision, requiring densely annotated training sets that are costly to obtain at the individual-product level. We introduce, to the best of our knowledge, the first few-shot learning framework for HSI-based food quality estimation. Each fillet defines a distinct episodic task, and a CORAL-style ordinal prediction head captures the ranked nature of freshness progression through cumulative threshold modelling. Biologically grounded monotonicity and embedding smoothness constraints further guide predictions toward plausible trajectories. On a 16-day salmon HSI dataset under a strict unseen-fillet protocol, our method achieves a mean absolute error of 1.58 days and ± 2-day accuracy of 72.3% with only three labelled days per fillet, substantially outperforming scalar regression and label-distribution baselines under an identical unseen-fillet protocol. Index Terms: hyperspectral imaging, few-shot learning, ordinal regression, CORAL, fish freshness, episodic meta-learning I Introduction Ensuring that perishable food products remain fresh is vital for consumer health, waste reduction, and efficient supply chain management. Conventional approaches to freshness evaluation, including sensory panels, chemical assays, and microbiological cultures, tend to be destructive, slow, and costly, restricting their scalability in industrial settings. Hyperspectral imaging (HSI) [1, 2] offers a compelling alternative by merging spectroscopy with spatial imaging, thereby producing rich spectral–spatial signatures [3] that reflect underlying biochemical changes during storage and spoilage. Deep learning architectures, particularly convolutional neural networks (CNNs), have demonstrated considerable promise in extracting complex spectral–spatial patterns from HSI data for quality and safety inspection across a range of food products including fruits, vegetables, and meat [2, 4]. Deep architectures incorporating spectral and spatial convolutions [4] and ordinal regression heads [11] have shown promise for quality timeline prediction, while compact few-shot designs achieve competitive classification accuracy with substantially fewer parameters [5]. A recurring limitation, however, is that these fully supervised models require large annotated datasets, something rarely available when freshness labels must be assigned per individual fillet at fine temporal granularity. Beyond data scarcity, most HSI-based studies frame freshness estimation [2] as either standard regression or nominal classification, overlooking the inherent ordering among storage days. Addressing data scarcity, few-shot learning reformulates training around task distributions sampled through episodic protocols, enabling generalization from very few labelled examples [6, 7]. Well-known deep few-shot strategies, including prototypical, matching, relation, and gradient-based meta-learners, have proven effective under low-shot constraints [8, 9]. Within HSI, few-shot approaches have recently been applied to remote sensing and crop classification with limited labels [5, 10]. Standard regression and classification objectives, however, fail to preserve ordinal relationships between storage days, potentially producing temporally inconsistent estimates. Ordinal regression addresses this by explicitly modelling ordered label spaces [11, 12, 14]. Consistent Rank Logits (CORAL) [13] decompose the ordinal problem into binary tasks with weight sharing, guaranteeing rank consistency, yet combining such methods with few-shot paradigms remains unexplored. We propose a label-efficient episodic ordinal regression framework for day-wise freshness estimation from hyperspectral images. Rather than relying on support-conditioned metric comparison, it attains few-shot generalization through episodic task sampling combined with biologically grounded ordinal regularizers that keep predictions temporally consistent on fillets never seen during training. To the best of our knowledge, this is the first application of few-shot learning to HSI-based food quality or freshness prediction, where all prior deep learning solutions have operated under full supervision [1, 2, 3]. The episodic protocol is paired with CORAL-style ordinal heads and dual regularization: monotonicity on predicted days and embedding smoothness on learned representations. Experiments show this combination decisively outperforms scalar regression and distribution-based baselines under a strict unseen-fillet evaluation. Our key contributions are: • The first episodic, label-efficient framework for HSI-based fish quality estimation, performing day-wise prediction on entirely unseen fillets. • CORAL-style cumulative ordinal regression to explicitly encode the ranked structure of storage timelines. • Applying biologically motivated dual regularization (monotonicity and embedding smoothness) to enforce temporally consistent freshness trajectories. I Methodology I-A Problem Formulation and Episodic Framework Given hyperspectral cubes x∈ℝB×H×Wx ^B× H× W with freshness labels y∈1,…,Dy∈\1,…,D\, we formulate day-wise estimation as few-shot ordinal regression. Each fillet defines a task iT_i split into a k-day support set iS_i and a query set iQ_i of remaining days. Both contribute to training: minθi[12(ℒ(i,θ)+ℒ(i,θ))+λRℛ(i∪i,θ)], _θ\;E_T_i [ 12 (L(S_i;θ)+L(Q_i;θ) )+ _RR(S_i _i;θ) ], (1) where ℒL is the ordinal loss and ℛR encompasses temporal regularization. Support and query samples pass through the same shared network fθf_θ with identical weights, not separate branches; they differ only in role within the episodic objective, where support days fix the per-fillet temporal anchors over which the regularizers operate and query days provide the held-out supervision. Averaging over both sets prevents overfitting to the few support samples. Fig. 1: Overall framework of the proposed episodic ordinal regression model. Support and query days share the same encoder g and ordinal head h with identical weights, differing only in their role in the episodic objective (support days anchor the regularizers; query days provide held-out supervision). I-B Spectral-Channel CNN Backbone Our backbone treats B spectral bands as input channels to a 2D CNN rather than using 3D convolutions. Four convolutional blocks (32→ 64→ 128→ 128 channels) with batch normalization, ReLU, and 2×22×2 max pooling extract hierarchical spatial features: (l)=MaxPool(ReLU(BN(Conv2D((l−1))))).h^(l)=MaxPool (ReLU(BN(Conv2D(h^(l-1)))) ). (2) Adaptive average pooling and a fully connected layer yield the embedding: =ReLU(fc⋅AdaptiveAvgPool((4))+fc)∈ℝd,z=ReLU(W_fc·AdaptiveAvgPool(h^(4))+b_fc) ^d, (3) with d=256d=256. Cross-band correlations are learned implicitly through channel mixing. Table I presents the full architecture (441K parameters, 2.37 GFLOPs). Treating spectral bands as input channels to a 2D CNN, rather than 3D or 1D spectral convolutions, is a deliberate trade-off: with B=256B=256 bands and few labelled days per fillet, 3D convolution sharply increases parameters and overfits, whereas channel mixing in the first convolution still learns inter-band combinations jointly. TABLE I: FreshnessOrdinal Network Architecture (B=256B=256 Bands) Layer Output Shape Params HSICNN Backbone Conv2D (B→32B→32) + BN + Pool 32×64×6432× 64× 64 133,088 Conv2D (32→6432→64) + BN + Pool 64×32×3264× 32× 32 18,624 Conv2D (64→12864→128) + BN + Pool 128×16×16128× 16× 16 74,112 Conv2D (128→128128→128) + BN + Pool 128×8×8128× 8× 8 147,840 AdaptiveAvgPool + FC(128→256128→256) 256256 33,024 CORAL Ordinal Head FC(256→128256→128) + ReLU + Drop(0.3) 128128 32,896 FC(128→15128→15) 1515 1,935 Total / GFLOPs / Memory 441K / 2.37 / 47MB I-C CORAL Ordinal Head and Loss For D ordered classes, D−1D-1 binary sub-tasks determine threshold exceedance. From z, the head computes logits via a two-layer classifier with dropout: =2⋅Dropout(ReLU(1+1))+2∈ℝD−1.o=W_2·Dropout (ReLU(W_1z+b_1) )+b_2 ^D-1. (4) Cumulative exceedance probabilities P(y>k∣x)=σ(ok)P(y>k x)=σ(o_k) yield the expected day: y^=1+∑k=1D−1σ(ok). y=1+ _k=1^D-1σ(o_k). (5) Class probabilities are recoverable via P(y=k∣x)=P(y>k−1)−P(y>k)P(y=k x)=P(y>k-1)-P(y>k) with boundary conditions P(y>0)=1P(y>0)=1, P(y>D)=0P(y>D)=0. We adopt CORAL over a generic threshold-based model for two reasons: its shared-weight cumulative-logit construction guarantees rank-monotone thresholds by design, aligning with the strictly ordered storage-day labels and complementing the monotonicity regularizer of Eq. (7); and decomposing the D-way problem into D−1D-1 binary sub-tasks keeps the head lightweight and well-conditioned under few labelled days, whereas unconstrained thresholds overfit and can violate rank consistency in low-data regimes. Binary cross-entropy over all thresholds forms the ordinal loss: ℒord=1N∑n=1N∑k=1D−1BCE([yn>k],σ(ok(n))),L_ord= 1N _n=1^N _k=1^D-1BCE (I[y_n>k],\;σ(o_k^(n)) ), (6) where targets tn,k=[yn>k]t_n,k=I[y_n>k] encode the ordinal structure (e.g., y=5y=5 gives [1,1,1,1,0,…,0][1,1,1,1,0,…,0]). Per-episode loss averages over support and query: ℒepisode=12(ℒord+ℒord)L_episode= 12(L_ord^S+L_ord^Q). I-D Temporal Regularization Monotonicity. For consecutive temporal pairs P sorted by ground-truth day across the combined episode: ℒmono=1||∑(t,t+1)∈max(0,δ−(y^t+1−y^t)),L_mono= 1|P| _(t,t+1) (0,\;δ-( y_t+1- y_t) ), (7) with margin δ=0.01δ=0.01, enforcing biologically plausible ascending predictions. Embedding smoothness. Abrupt representational jumps between adjacent days are penalized on the d-dimensional embeddings: ℒsmooth=1||∑(t,t+1)∈‖t+1−t‖22.L_smooth= 1|P| _(t,t+1) \|z_t+1-z_t \|_2^2. (8) While ℒmonoL_mono constrains the output space, ℒsmoothL_smooth shapes the representation space, forming a complementary pairing. I-E Training Objective and Inference The per-episode loss combines all terms: ℒtotal=ℒepisode+λmonoℒmono+λsmoothℒsmooth,L_total=L_episode+ _monoL_mono+ _smoothL_smooth, (9) with λmono=λsmooth=0.1 _mono= _smooth=0.1. Adam optimization (lr=3×10−4lr=3×10^-4, weight decay 5×10−45×10^-4) runs for 40 epochs of 60 episodes. Network parameters are initialized randomly using the standard He scheme for convolutional and linear layers, with no transfer learning or auxiliary pre-training, so results reflect training from scratch on the target HSI data alone. Fig. 1 and Algorithm 1 describe the overall architecture of the proposed framework. Algorithm 1 Few-Shot Ordinal Meta-Training 1: Train fillets ℱtrainF_train, val episodes ℰvalE_val, support size k 2: Trained parameters θ∗θ^* 3: Initialize θ; best_mae←∞best\_mae←∞ 4: for epoch =1=1 to E do 5: for episode =1=1 to M do 6: Sample fillet f∼ℱtrainf _train (with ≥Nmin≥ N_ days) 7: Split into S (k days) and Q (remaining) 8: Compute ℒtotalL_total via Eqs. (6)–(9) 9: Update θ via Adam 10: end for 11: Evaluate on ℰvalE_val; save θ if MAE improves 12: end for 13: return θ∗θ^* I Results and Discussion I-A Dataset and Experimental Protocol We evaluate on our custom-made salmon freshness HSI dataset of 50 individually packaged fillets imaged daily over 16 days (D=16D=16; day 6 = labelled expiry). Each cube spans 462 spectral bands (386.88–1003.6 nm) at 128×128128×128 resolution; after band-wise z-score normalization and noisy edge-band removal, B=256B=256 channels are retained. HSI-to-RGB composites (Fig. 2) confirm that predictions typically fall within ± 2 days. Splitting is performed at the pack level to prevent data leakage (Table I). The 30 training fillets ensure broad inter-fillet variability for robust episodic meta-learning, while 10 validation and 10 test fillets give low-variance metric estimates without leaking pack-specific cues. Validation and test episodes use fixed seeds for reproducibility, considering only fillets with ≥6≥6 available days. Each episode randomly selects k=3k=3 support days and assigns the remainder as queries. Performance is reported as MAE, ± 1-day, and ± 2-day accuracy. Table I lists all hyperparameters. Fig. 2: Sample-level predictions on unseen test fillets with HSI→ composites. Each panel shows ground-truth day (GT), predicted day (Pred), and absolute error (|e||e|); most fall within ± 2 days. TABLE I: Pack-Level Data Split (No Leakage Across Partitions) Partition Pack IDs Packs Cubes Training 1–30 30 480 Validation 31–40 10 160 Test 41–50 10 160 Total 1–50 50 800 TABLE I: Training Hyperparameters Parameter Value Parameter Value Optimizer Adam λmono _mono 0.1 Learning rate 3×10−43×10^-4 λsmooth _smooth 0.1 Weight decay 5×10−45×10^-4 Margin δ 0.01 Epochs 40 Embedding d 256 Episodes/epoch 60 Classes D 16 Support k 3 Dropout 0.3 Min. days NminN_ 6 I-B Comparison with Regression and Distribution Methods Table IV benchmarks our approach against regression and distribution-based formulations on unseen test fillets. Scalar regression struggles with inter-fillet variability. Label distribution learning [15] captures day-label uncertainty but lacks explicit ordinal encoding [16]. Our method reduces MAE by 19% over few-shot regression and boosts ± 2-day accuracy by 15.4 percentage points. TABLE IV: Comparison with Regression and Distribution-Based Methods with our approach Method MAE ↓ ± 1 Acc. ↑ ± 2 Acc. ↑ Regression Baselines Linear Reg. (HSI feat.) 2.87 21.4% 39.2% CNN + L1 Regression 2.21 30.8% 52.3% Few-Shot CNN Reg. 1.95 34.6% 56.9% Soft-Label / Distribution Baselines Gaussian Label Smooth. 2.04 31.5% 58.5% Label Dist. Learning 1.86 33.1% 62.3% LDL + Temporal Smooth. 1.79 35.4% 64.6% Proposed 1.58 42.3% 72.3% TABLE V: Impact of Ordinal Modelling over multiple heads Head MAE ↓ ± 1 Acc. ↑ ± 2 Acc. ↑ Scalar Regression 1.95 34.6% 56.9% Ordinal (no reg.) 1.73 38.5% 66.2% Ordinal + Reg. 1.58 42.3% 72.3% I-C Effect of Ordinal Modelling and Support Size Table V isolates the benefit of ordinal learning. Switching from scalar to ordinal prediction drops MAE from 1.95 to 1.73; adding regularization further reduces it to 1.58. Table VI highlights robustness across support sizes (k): k=3k=3, and even 1-shot achieves 48.5% ± 2-day accuracy. TABLE VI: Robustness Across Few-Shot Support Sizes k MAE ↓ ± 1 Acc. ↑ ± 2 Acc. ↑ 1 2.34 26.2% 48.5% 2 1.92 34.1% 61.5% 3 (ours) 1.58 42.3% 72.3% 5 1.63 42.6% 72.1% Fig. 3: Comparison of freshness estimation methods across MAE and tolerance-based accuracy metrics on unseen test fillets. I-D Ablation Study Table VII reports component contributions under a reduced 15-epoch budget, adopted to hold optimization cost fixed across A2–A5 so per-component differences are comparable without convergence confounds. TABLE VII: Ablation Study on multiple configurations Configuration MAE ↓ ± 1 Acc. ↑ ± 2 Acc. ↑ A2: Ordinal Only 2.29 29.2% 56.6% A3: + Emb. Smooth. 2.22 28.9% 56.8% A4: + Monotonicity 2.01 31.1% 59.2% A5: + Both 2.08 29.1% 57.2% Absolute MAE is therefore higher than in Tables IV and V and only relative ordering matters here. Monotonicity (A4) yields the largest single gain (about 12% over the ordinal-only A2), matching the monotone progression of degradation, while smoothness alone (A3) helps only marginally. Under this short budget, A5 (2.08) does not improve over A4 (2.01), which we attribute to smoothness needing more episodes to stabilize the representation space; this is consistent with the full-budget Table V, where the complete regularized model attains the best MAE (1.58). The ablation should thus be read as a relative-ranking diagnostic, not the final operating point, visually mentioned in Fig.3. I-E Qualitative Analysis Fig. 4 illustrates our method’s superiority across all metrics, with the sharp upward trend in ± 2-day accuracy confirming the value of dual regularization. Mapping predictions against ground-truth days shows tight adherence to the ascending trajectory, with larger errors confined to mid-range days (5–9) where biochemical changes are subtlest. Fig. 4: Ground truth versus predicted freshness day across the test set. Predictions closely follow the ascending trajectory. IV Conclusion This paper proposes a few-shot ordinal learning paradigm for estimating day-wise freshness from hyperspectral images. The approach combines episodic training, CORAL-based ordinal regression, and temporal regularization to predict freshness across previously unseen fish fillets with only three labelled storage days per task. Experiments demonstrate consistent and significant improvements over label distribution learning and conventional regression under a rigorous unseen-fillet evaluation. A limitation is that the salmon HSI dataset is proprietary and not yet publicly available, which constrains reproducibility; the framework itself is dataset-agnostic, and we plan to validate it on public HSI food-quality benchmarks and release the code in future work. The method offers a label-efficient and configurable approach for scalable, non-destructive food quality assessment for industry. References [1] Y. Xiao et al., “Deep learning–based regression of food quality attributes using near-infrared spectroscopy and hyperspectral imaging: A review,” Food Chem., vol. 493, p. 145932, 2025. [2] C. Yang et al., “Hyperspectral imaging and deep learning for quality and safety inspection of fruits and vegetables: A review,” J. Agric. Food Chem., vol. 73, no. 17, p. 10019–10035, 2025. [3] F. Shahrzad, Z. Arabi, S. Ghafari, and A. Sheikh-Akbari, “Fish quality assessment using hyperspectral imaging and computer vision: A review,” IEEE Sensors J., vol. 25, no. 14, p. 26255–26268, 2025. [4] D. Hong et al., “SpectralGPT: Spectral remote sensing foundation model,” IEEE Trans. Pattern Anal. Mach. Intell., vol. 46, no. 8, p. 5227–5244, 2024. [5] B. Xi et al., “Few-shot learning with class-covariance metric for hyperspectral image classification,” IEEE Trans. Image Process., vol. 31, p. 5079–5092, 2022. [6] Y. Song, T. Wang, P. Cai, S. K. Mondal, and J. P. Sahoo, “A comprehensive survey of few-shot learning: Evolution, applications, challenges, and opportunities,” ACM Comput. Surv., vol. 55, no. 13s, p. 1–40, 2023. [7] W. Zeng and Z.-Y. Xiao, “Few-shot learning based on deep learning: A survey,” Math. Biosci. Eng., vol. 21, no. 1, p. 679–711, 2024. [8] Z. Li et al., “Deep cross-domain few-shot learning for hyperspectral image classification,” IEEE Trans. Geosci. Remote Sens., vol. 60, p. 5501618, 2022. [9] J. Bai et al., “Few-shot hyperspectral image classification based on adaptive subspaces and feature transformation,” IEEE Trans. Geosci. Remote Sens., vol. 60, p. 5518517, 2022. [10] J. Yang et al., “A survey of few-shot learning in smart agriculture: Developments, applications, and challenges,” Plant Methods, vol. 18, no. 1, p. 28, 2022. [11] G. Polat, I. Ergenc, H. T. Ozlu, and A. A. Alatan, “Class-distribution-aware calibration for long-tailed visual recognition via ordinal regression,” in Proc. IEEE/CVF CVPR Workshops, 2022, p. 2873–2882. [12] J. Wang et al., “Ord2Seq: Regarding ordinal regression as label sequence prediction,” in Proc. IEEE/CVF ICCV, 2023, p. 11161–11171. [13] W. Cao, V. Mirjalili, and S. Raschka, “Rank consistent ordinal regression for neural networks with application to age estimation,” Pattern Recognit. Lett., vol. 140, p. 325–331, 2020. [14] V. Vargas, P. A. Gutiérrez, and C. Hervás-Martínez, “Unimodal regularisation based on beta distribution for deep ordinal regression,” Pattern Recognit., vol. 122, p. 108310, 2022. [15] T. Wen, B. Yang, J. Wang, and G. Chen, “Label distribution learning by exploiting label distribution manifold,” IEEE Trans. Neural Netw. Learn. Syst., vol. 34, no. 2, p. 839–852, 2023. [16] J. Cheng, et al., “A neural network approach to ordinal regression,” in Proc. IEEE Int. Joint Conf. Neural Netw. (IJCNN), 2022, p. 1–8.