SpectralFormer
A transformer backbone that classifies hyperspectral image pixels from groups of neighboring spectral bands.
Image classification · 162 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Task
- Image classification
- Parameters
- 355.6K
- Operations
- 162
- Framework
- PyTorch
- Recurrent
- No
- Published
- IEEE Transactions on Geoscience and Remote Sensing (2021)
- Cited by
- 36 (as of 25 October 2026)
- Authors
- Danfeng Hong, Zhu Han, Jing Yao and others
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m20548
- Graph hash
- bcb8c23d5adf8244cfade59d13df3d94308df45e3cffac26cd3a53ed537e1008
- Skeleton hash
- 1ae02fb81e85c0318bb6a5732a9015432a8d45d82646755bf92d64fdca136e5a
- Architecture hash
- a2dbbbd0e25e127b96472fac96286ba983e6faabf04c988e3fecfd76fd505d58
- Diagram SHA-256
- f0b9fea8e3739c94de6ff8d670dfa663718c9d58b3a048e168d459f0b8e8b655
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
SpectralFormer is a transformer backbone for hyperspectral image classification that treats the spectrum at a pixel as a sequence. The paper's argument is that convolutional networks do not represent the sequence attributes of spectral signatures well.
It adds two modules to a transformer built only from encoders, following ViT. Group-wise spectral embedding (GSE) builds each embedding from a group of neighboring bands instead of a single band. Cross-layer adaptive fusion (CAF) is a skip connection that carries information from shallow to deep layers by learning how to fuse it across layers. Each such connection skips only one encoder.
In the paper's setup, a 64-unit embedded spectrum passes through 5 transformer encoder blocks. The backbone accepts both pixel-wise and patch-wise inputs. On the Indian Pines, Pavia University and University of Houston datasets, the paper reports an increase of approximately 10% in overall accuracy over classic transformers.
Key idea. SpectralFormer adapts the transformer to hyperspectral image classification with group-wise spectral embeddings from neighboring bands and a cross-layer skip connection that adaptively fuses features across layers.
- spectralformer
- hyperspectral image classification
- hyperspectral transformer
- remote sensing
- group-wise spectral embedding
- cross-layer adaptive fusion
- gse
- caf
- spectral signature
- indian pines
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{hong2021spectralformerrethinkinghyperspectralimage,
title={SpectralFormer: Rethinking Hyperspectral Image Classification with Transformers},
author={Danfeng Hong and Zhu Han and Jing Yao and Lianru Gao and Bing Zhang and Antonio Plaza and Jocelyn Chanussot},
year={2021},
eprint={2107.02988},
archivePrefix={arXiv},
primaryClass={cs.CV},
doi={https://doi.org/10.1109/TGRS.2021.3130716},
url={https://arxiv.org/abs/2107.02988},
}