# InvarOrd: Self-Supervised Ordinal Knowledge Distillation with Rank-Invariant Alignment for Label-Efficient Cross-Species Hyperspectral Fish Freshness Assessment

Kazi Nabiul Alam, Omenuko Joseph Nwebonyi, Pooneh Bagheri Zadeh, Akbar Sheikh-Akbari · arXiv · 2026-11-14

- **Problem** A freshness predictor trained on one fish species loses its ordering on another, and global domain alignment can erase that ordering.
- **Method** Pretrains a spectral encoder on unlabelled cubes, aligns the two species' embeddings with a shrinkage covariance discrepancy computed only within matched freshness ranks, then distils the aligned teacher into a compact ordinal student.
- **Results** The compressed student reached MAE 1.476 days and Acc ±1 of 56.1% with 423K parameters, 2.54× fewer than its teacher.

![Figure 1: Overview of InvarOrd, three training stages and deployment: (1) self-supervised spectral pre-training on unlabelled source-species hyperspectral cube…](https://refivu.com/papers/d5665851-f744-4a87-b3a5-325553323dcc/figures/figure-e5cd2dee25530c2196695132324b7e02.png?thumb=512)

**Fig. 1** . Overview of InvarOrd, three training stages and deployment: (1) self-supervised spectral pre-training on unlabelled source-species hyperspectral cubes (salmon or cod, depending on the transfer direction); (2) rank-structured cross-species alignment using k target anchors per class; (3) ordinal knowledge distillation of the teacher’s cumulative rank distribution into a compact student; and (4) freshness prediction on unseen target-species fillets.

[Original paper](https://arxiv.org/abs/2611.19472v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Kazi Nabiul Alam, Omenuko Joseph Nwebonyi, Pooneh Bagheri Zadeh, Akbar Sheikh-Akbari · InvarOrd: Self-Supervised Ordinal Knowledge Distillation with Rank-Invariant Alignment for Label-Efficient Cross-Species Hyperspectral Fish Freshness Assessment · Original paper figure · Extracted the figure area from page 4 of the original PDF.

## Why freshness order breaks across species

A freshness predictor fitted to one fish species usually loses the ordering of freshness when it is applied to another, so it cannot simply be reused for a new species. Fat content, pigmentation and spectral shape all differ between salmon and cod, so the spectral signature of storage time does not carry over directly. Domain alignment is the usual fix, and it matches source and target distributions globally.

Because it ignores which fillets share a freshness level, it can pull together fillets of different ages and erase the order the task depends on.

Freshness is an ordinal target, and the cost of an error grows with the distance between the predicted day and the true day, which ordinary classification loss does not reflect. Labels are also scarce: each fillet has to be followed over days and graded destructively, so a new species starts with only a small labelled set. Strong small-data accuracy usually comes from ImageNet-scale backbones, which are too costly for an inspection line, so the question is how to keep a compact model and still transfer it.

The study asks whether a compact model can be moved to a new species from a small labelled budget while keeping the freshness ordering that global alignment would destroy. The change proposed is to the alignment rule itself: alignment is restricted to matched freshness ranks, so it cannot push neighbouring ranks into each other.

## Data, labels and evaluation protocol

Each cube keeps 64 of the 462 raw bands spanning 400 to 1000 nm, and the spatial size is 32 by 32 after preprocessing.

Storage days are binned into K = 6 ordered ranks of about three days each, and the ranks are defined within each species. The source species supplies labelled cubes and an unlabelled pool, while the target supplies only a k-shot anchor set, which gives 30 labelled cubes at k = 5. No other target label is used at any stage.

Splits are pack-disjoint with 30, 10 and 10 packs. Each of the two directions is run with three seeds, giving six paired comparisons, and the k sweep covers 1, 3, 5 and 10.

MAE is the mean absolute difference in days between each test cube's true storage day and the centre of its predicted rank, and Acc ±δ is the share of cubes whose error is within δ days. QWK weights each disagreement by the squared rank distance, and a value of zero signals ordinal collapse. The embedding correlation ρ is the Spearman correlation between the true rank and the CORAL score.

Paired comparisons use the exact two-sided Wilcoxon signed-rank test, and with six pairs the smallest attainable exact p is 0.031 however large the effect.

## How the three stages fit together

InvarOrd works in three training stages, and the student alone is used for prediction after them. Figure 1 lays out the flow: pretraining on unlabelled source cubes, alignment with k target anchors per class, distillation into the compact student, and prediction on unseen target fillets.

Stage 1 learns a spectral encoder from unlabelled cubes, so the labelled budget is not spent on basic spectral features. Stage 2 trains the teacher on labelled source cubes with the ordinal loss and adds an alignment term; the target anchors enter only through that term.

Stage 3 distils the frozen teacher into the student, and the target anchors are drawn again in that stage. The alignment, invariance and distillation terms act only during training, so at inference the student evaluates its encoder and head alone.

Taken together, the stages combine self-supervised spectral pretraining, rank-invariant alignment and ordinal knowledge distillation into a compact freshness predictor for a new species.

## Encoder and ordinal head

Teacher and student share one encoder family. A 1×1 spectral stem mixes the 64 bands into w channels, four blocks follow, and global average pooling with a linear projection gives a d-dimensional embedding.

The compressed student is therefore 2.54× smaller in parameters and 2.47× smaller in MACs than the teacher.

Prediction uses a CORAL head with one shared weight vector u and K−1 biases. Each cumulative probability is p\_j = σ(o\_j), with \\(o\_j(x)=u^{\\top}g\_\\theta(x)+b\_j\\), and the predicted rank counts the thresholds whose probability exceeds one half. The ordinal loss in Eq. (6) averages binary cross-entropy over the K−1 cumulative targets.

The biases are free parameters and can cross during few-shot updates, so the hinge penalty L\_mono in Eq. (7) penalises any increase of the cumulative probabilities with j.

## Self-supervised spectral pretraining

Stage 1 draws a random band mask with masking ratio m = 0.5, broadcast across space, so the masked cube is x̃ = M ⊙ x. A light decoder then reconstructs the full cube from the encoder output.

A contrastive term is applied to two augmented views of each cube, using a temperature-scaled normalised loss over the 2N embeddings of a batch of N cubes. The Stage-1 objective adds the squared reconstruction error to λc times the contrastive loss, with λc = 0.3.

The authors argue that reconstruction pushes the encoder to model dependencies between bands, which carry the spoilage signature, while the contrastive term keeps the embedding stable under nuisance augmentation.

## Matching covariances within each rank

The shrinkage estimator is \\\[ C\_b(Z)=(1-\\alpha)\\frac{\\bar Z^{\\top}\\bar Z}{n-1}+\\alpha\\,\\frac{\\operatorname{tr}(\\bar Z^{\\top}\\bar Z)}{d(n-1)}\\,I\_d \\\] where Z̄ is the centred embedding matrix of the rank.

The CORAL discrepancy compares the two species by the squared Frobenius norm of the difference of their shrinkage covariances, scaled by 1/(4d²). \\\[ L\_{\\text{align}}(Z\_S,Z\_T)=\\frac{1}{4d^{2}}\\,\\lVert C\_b(Z\_S)-C\_b(Z\_T)\\rVert\_F^{2} \\\] A rank with one anchor, which happens at k = 1, is skipped, because the shrinkage estimator needs at least two samples.

The ordinal information lies largely in the between-rank term, which is the spread of the rank means along the freshness axis.

Proposition 1 states that the rank-matched alignment term is unchanged when each rank's embeddings in either domain are shifted by a rank-specific offset. Centring removes any common row offset, so the centred covariances, and every summand of the rank-averaged term, are unchanged. The alignment therefore has no gradient along the rank means and cannot lower its own value by contracting the between-rank term.

A global discrepancy matches the total covariance, which contains the between-rank term, so it can be lowered by shrinking the separation between ranks in one species. Proposition 1 is a statement about the alignment term alone. The ordinal terms still separate the ranks, and the invariance regulariser Linv is not covered by it. Pooling by rank alone does not give invariance, because the rank-pooled MMD still matches rank means through its kernel.

## Ordinal distillation and the student

The distillation term matches the student's cumulative probabilities to the teacher's at temperature τ, using binary cross-entropy on each of the K−1 thresholds. \\\[ L\_{\\text{kd}}=\\frac{\\tau^{2}}{K-1}\\sum\_{j=1}^{K-1}\\mathrm{BCE}\\!\\left(\\sigma(o^{s}\_j/\\tau),\\,\\sigma(o^{t}\_j/\\tau)\\right) \\\]

The gradient of this term with respect to the student embedding is a multiple of the shared direction u\_s, so distillation acts along that direction.

The student takes the teacher's weights wherever tensor shapes agree, and other tensors are initialised independently.

The domain regulariser Linv is an RBF-kernel MMD between the source embeddings and the target-anchor embeddings, estimated with the unbiased U-statistic.

The Stage-3 objective combines L\_ord, γ L\_mono, λ1 L\_kd, and the warm-up-weighted λ2 L\_inv and λa times the rank-matched alignment, with γ = 0.1, λ1 = 0.5, λ2 = 0.3 and τ = 1.

## Training settings and cost

Stage 1 runs for 40 epochs, Stage 2 for 30 epochs and Stage 3 for 200 steps.

The matched-rank term costs O(nd²) for n samples in the batch, which the authors say matches a single global CORAL evaluation. It needs no matrix inversion or eigendecomposition.

## Zero-shot gap between species

A teacher trained on salmon and applied to cod with no adaptation reaches target MAE of 1.625 days, and a teacher trained on cod and applied to salmon reaches 1.906 days. Figure 4 plots source validation MAE during training and source and zero-shot target MAE for both directions, which is the comparison in the table.

The MAE increase over the source is +0.481 days for salmon to cod and +0.806 days for cod to salmon, so the cod-to-salmon direction is the harder one. The authors read the negative target QWK as loss of the freshness ordering on the unseen species, while the source model keeps some sensitivity to spoilage. This gap is the reference that any few-shot method has to beat, and the asymmetry between directions recurs in the adapted results.

## Comparison with ImageNet backbones

Six ImageNet-pretrained backbones with a spectral adapter were adapted on the same 30 target cubes by linear probing or full fine-tuning, and twelve backbone configurations are reported beside both students. Both students give the lowest MAE, at 1.476 days for the compressed student and 1.486 days for the same-capacity student. At k = 5, averaged over directions and seeds, the compressed student reaches Acc ±1 of 56.1% and mean QWK of 0.163.

The authors read the top of the ranking as a statistical tie: the top four methods lie within 0.057 days, below the between-seed SD of 0.134 days for InvarOrd.

Figure 5 places the compressed student against the backbones on the parameter and MAC axes.

The adaptation regime matters about as much as the backbone. Mean QWK halves from 0.171 to 0.086, and three fine-tuned models have QWK at or below 0.05.

## Compression and deployment cost

The authors report that distillation into the compressed student costs nothing measurable.

The compressed student runs at 1.44 ms per cube on a single NVIDIA GPU at batch size one, excluding data loading, against 1.46 ms for the same-capacity student.

## Which alignment keeps ordinal structure

The aligners separate most clearly on ordinal measures rather than on MAE. Rank-invariant alignment reaches an embedding rank correlation of 0.183 and QWK of 0.112, the highest of the aligners compared, at MAE 1.486 days. Figure 9 plots the embedding correlation and QWK for each aligner, with the variant that removes Stage 2 shown as a dashed reference.

The authors point out that MAE alone would hide this collapse of ordinal information.

Rank-pooled MMD raises the rank correlation to 0.102 but leaves QWK at 0.000, so pooling by rank alone does not preserve the ordering.

## Effects of removing other components

The authors expect alignment to matter more at smaller k or with larger species gaps, since at k = 5 the 30 anchors already fix the order through the ordinal loss.

The authors attribute this to Linv, as a global MMD, seeing the between-rank scatter and pulling against the rank-matched term.

Target-only scratch training reaches MAE 1.773 days, 0.286 days above the full method (p = 0.031, dz = 2.63).

SSL and the full pipeline act mainly on accuracy, and replacing the adversarial alignment improves both MAE and the ordinal measures.

## Effect of the anchor budget

So k = 5 sits on that plateau rather than at a peak. Figure 12 shows the shot sweep for MAE, Acc ±1 and QWK in both directions.

## Why the alignment survives distillation

Output-level distillation carries the teacher's ordinal score along the shared direction u\_s, which lets the compressed student match the accuracy of the same-capacity student. The full within-rank geometry reaches only the same-capacity student, through its inherited encoder.

The authors attribute the balance of the five Stage-3 terms to normalisation and the cosine warm-up rather than to fine tuning.

Salmon is fatty and coloured mainly by astaxanthin, whereas cod is lean and white. Spatial pooling over each 128×128-pixel region and 3-day bins reduces sensitivity to variation inside a fillet, which the authors see as useful on a sorting line.

## Limitations

With six pairs the smallest attainable exact p is 0.031, however large the effect.

Only one species pair is evaluated, and storage-time labels serve as the freshness target.

Proposition 1 covers only the alignment term, not the ordinal terms, Linv or the training process as a whole.

Ordinal agreement in cod to salmon stays weak, with QWK of 0.015 ± 0.127 for the compressed student. Swin-T and both ViTs have higher QWK than InvarOrd, so ordinal agreement and absolute error are not interchangeable at this budget. Embedded latency has not been measured, and the 8-bit size is an estimate.

## Paper info

- **Authors**: Kazi Nabiul Alam, Omenuko Joseph Nwebonyi, Pooneh Bagheri Zadeh, Akbar Sheikh-Akbari
- **Venue**: arXiv · Preprint
- **First published**: 2026-11-14
- **Added**: 2026-11-17
- **Updated**: 2026-11-14
- **Version**: v1
- **arXiv**: 2611.19472
- **Category**: cs.CV · cs.AI
- **Original paper terms**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **What we show**: Paper info, commentary and permitted figures from the original paper

[Original paper ↗](https://arxiv.org/abs/2611.19472v1) · [PDF ↗](https://arxiv.org/pdf/2611.19472v1)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Abstract

Hyperspectral models of fish freshness rarely transfer between species, and labelling a new species is slow and destructive. Freshness is also ordinal, and standard domain alignment can erase that order. We present InvarOrd, which adapts to a new species from 30 labelled cubes (5 per rank) in three stages: self-supervised spectral pretraining on unlabelled source cubes, cross-species alignment by a shrinkage covariance discrepancy computed only within matched ranks, and ordinal distillation into a compact student. The alignment term is provably invariant to the rank means, so it gives no incentive to collapse the ordinal axis. On paired salmon and cod data (800 cubes each, 16 days), a source-trained teacher reaches 1.6 to 1.9 days mean absolute error (MAE) on the other species, with quadratic weighted kappa (QWK) below zero. The 423K-parameter student, 2.54 times smaller than its teacher, attains the lowest MAE (1.476 days) and highest within 1-day accuracy (56.1%) among 14 configurations, matching the best of six ImageNet-pretrained backbones (ConvNeXt-T, 1.503 days) at 66 times fewer parameters, 1.44ms per cube on a GPU and 5s re-adaptation. InvarOrd beats target-only training by 0.29 days (p = 0.031). Among alignment objectives, rank-invariant alignment retains the most ordinal structure (embedding rank correlation 0.183, QWK 0.112), whereas global discrepancy lowers the rank correlation to 0.049 and QWK to zero at only 0.014 days higher MAE.

## Quote from the paper

Kazi Nabiul Alam, Omenuko Joseph Nwebonyi, Pooneh Bagheri Zadeh, Akbar Sheikh-Akbari (2026). InvarOrd: Self-Supervised Ordinal Knowledge Distillation with Rank-Invariant Alignment for Label-Efficient Cross-Species Hyperspectral Fish Freshness Assessment. arXiv:2611.19472v1. https://arxiv.org/abs/2611.19472v1

**BibTeX**

```
@misc{alam2026invarord,
  title = {{InvarOrd: Self-Supervised Ordinal Knowledge Distillation with Rank-Invariant Alignment for Label-Efficient Cross-Species Hyperspectral Fish Freshness Assessment}},
  author = {Kazi Nabiul Alam and Omenuko Joseph Nwebonyi and Pooneh Bagheri Zadeh and Akbar Sheikh-Akbari},
  year = {2026},
  eprint = {2611.19472},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.19472v1}
}
```

## Other paper commentary

- [Efficient Genotype Classification from 3D MRI in ADPKD via Density-Aware Point Sampling and E(3)-invariance](https://refivu.com/en/papers/4dc57601-9b59-43d2-8406-3a9088e8e1be-efficient-genotype-classification-from-3d-mri-in-adpkd.md)
- [Maximizing Capacity Utilization of LoRA Adapters for Mitigating the Learning-Forgetting Trade-off](https://refivu.com/en/papers/911a8326-f128-4cba-a0a4-26e3e558c34d-maximizing-capacity-utilization-of-lora-adapters-for.md)
- [Robust and Communication-Efficient Federated Learning from Non-IID Data](https://refivu.com/en/papers/8cfbbb74-26ed-46b1-9bcb-908c177043d6-robust-and-communication-efficient-federated-learning-from.md)
- [Relational Knowledge Distillation](https://refivu.com/en/papers/bc94c76c-131e-4c9c-80c8-1c9bc90a7da4-relational-knowledge-distillation.md)
- [ThiNet: A Filter Level Pruning Method for Deep Neural Network Compression](https://refivu.com/en/papers/13501147-4289-4a98-981e-919e37e87fc7-thinet-a-filter-level-pruning-method-for-deep.md)
- [EAST: An Efficient and Accurate Scene Text Detector](https://refivu.com/en/papers/c3f94c0a-3560-4b29-930f-6e881b662882-east-an-efficient-and-accurate-scene-text-detector.md)
- [Joint Learning of Factual and Counterfactual Worlds for Causal Prior-data Fitted Networks](https://refivu.com/en/papers/ca05fe75-c727-4e23-8b7e-a0a51814ae5a-joint-learning-of-factual-and-counterfactual-worlds-for.md)
- [Multi-Objective Causal Bandits: Minimal Intervention Space and Policy-Level Learning](https://refivu.com/en/papers/540f68b6-056b-44ce-94f3-5d91726bf05d-multi-objective-causal-bandits-minimal-intervention-space.md)
- [ResWAM: Learning What Changes, Not What Stays, for World-Action Models](https://refivu.com/en/papers/8ff204e6-02d0-446a-b10f-79536a9345b6-reswam-learning-what-changes-not-what-stays-for.md)
- [Clustering-Based Artificial Tree Ensembles for Random Forest Approximation](https://refivu.com/en/papers/ee4dcb23-4caf-4067-a49f-678a0c4355c2-clustering-based-artificial-tree-ensembles-for-random-forest.md)
- [Isolating Perception for Multi-View Planning under Occlusion-Induced Partial Observability](https://refivu.com/en/papers/6ac42b45-0624-43a7-9143-e917da2b7cc2-isolating-perception-for-multi-view-planning-under-occlusion.md)
- [ANCHOR: A Port-Hamiltonian Model for Forecasting Team Dynamics in Human-in-the-Loop Systems](https://refivu.com/en/papers/85bcf8f5-5825-4f59-88e9-06fc575cc54f-anchor-a-port-hamiltonian-model-for-forecasting-team.md)

## Terms in this paper

- [MAE](https://refivu.com/en/terms/15fbae569b33-mae)
- [linear probing](https://refivu.com/en/terms/3f7295b25499-linear-probing)
- [Full fine-tuning](https://refivu.com/en/terms/04fec034209c-full-fine-tuning)
- [Mean Absolute Error (MAE)](https://refivu.com/en/terms/d337322efd7a-mean-absolute-error-mae)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/d5665851-f744-4a87-b3a5-325553323dcc-invarord-self-supervised-ordinal-knowledge-distillation-with)
