1. Introduction
Hyperspectral image classification (HSIC) aims to assign pixel-wise labels to ground objects by using data captured through hundreds of consecutive spectral bands. The rich spectral-spatial information in hyperspectral imagery (HSI) [
1] enables a wide range of applications, including environmental monitoring [
2], agricultural management [
3], urban planning [
4], national defense [
5], etc. However, the high-dimensional, complex nonlinear structures and limited availability of labeled samples make HSIC a challenging task.
Recent advances in deep learning have led to remarkable progress in HSIC. Convolutional neural networks (CNNs) are capable of effectively extracting local spectral-spatial features, but are constrained by their limited receptive field and high parameter quantities. In cases where the training data is scarce, this often leads to overfitting [
6]. Vision Transformers (ViTs) capture long-range dependencies through self-attention, yet they lack inductive biases for local feature extraction and introduce prohibitive computational costs, particularly for high-dimensional HSI data [
7,
8]. Hybrid CNN-Transformer models, such as GSC-ViT [
9] and DBCTNet [
10], have shown balanced efficiency and performance, but they still fall within the domain of artificial neural networks (ANNs) and inherit the high energy consumption associated with dense floating-point operations.
Spiking neural networks (SNNs) offer a promising alternative due to their event-driven, binary spike-based computation, achieving ultra-low power inference and biological plausibility [
11,
12,
13]. Unlike ANNs that rely on energy-intensive multiplication accumulation (MAC) operations, SNNs accumulate spikes only when events occur, making them ideally suitable for deployment on resource-constrained edge devices. This inherent efficiency has spurred interest in integrating the representational capabilities of Transformers into the SNN paradigm.
In the context of HSIC, several SNN-based methods have been developed. SNN-SSEM [
12] constructed a conventional SNN with depthwise separable convolutions, but it requires a large number of time steps (e.g., T = 30) to achieve competitive accuracy. AFSA [
14] introduced a spike self-attention module with adaptive refocusing, but its attention mechanism is not entirely driven by spikes and still relies on careful tuning. Neither of these methods fully exploited the potential of Transformer-style global modeling. Meanwhile, outside the field of remote sensing, SpikingResformer [
15] recently demonstrated remarkable performance in large-scale image classification by proposing Dual Spike Self-Attention (DSSA) and a ResNet-inspired multi-stage architecture. However, applying SpikingResformer directly to HSIC reveals critical limitations. First, spatial resolution mismatch: SpikingResformer’s multi-stage strided convolutions and max-pooling progressively downsample feature maps from
to
. On small HSI patches (e.g.,
), this collapses spatial dimensions to
after only a few stages, destroying the spatial structure needed for self-attention and causing severe spatial feature loss before any global dependency can be captured. Second, architectural over-parameterization: the multi-stage design with large kernel convolutions (e.g.,
) and high-dimensional embeddings (up to 1024 channels), optimized for large-scale RGB images, becomes redundant on small HSI patches with limited samples, causing overfitting and wasted computation without accuracy gains. Third, spectral-spatial decoupling: SpikingResformer’s patch-splitting strategy treats spatial neighbors independently, ignoring the strong spectral continuity and local spatial correlations of HSI data. This exacerbates information loss on small patches, highlighting the need for a lightweight, single-stage architecture tailored to HSI’s unique spectral-spatial structure.
To address these challenges, a novel spike-driven Vision Transformer, termed ‘GS-SpikeFormer’, is proposed. It fundamentally reinterprets attention as a learnable binary gating mechanism. The core of it lies the Gated Spiking Attention (GSA) module, which replaces weighted summation with event-driven hard feature selection. By using convolution kernels to implicitly capture global spatial relationships and generating binary masks through logical AND operations, GSA achieves global context modeling in a fully spike-compatible manner. To further reduce the parameter overhead while preserving the modeling capacity, groupwise convolution is integrated into the self-attention and feedforward modules. This architecture synergistically combines GSA with a front-end Spectral Calibration (SC) module for adaptive spectral dimension processing and a Groupwise Spiking Feedforward Network (GWSFFN) for spectral-spatial feature refinement. This unified design explicitly addresses the dual challenges of high dimensions and limited training samples in HSIC.
Beyond classification, deep learning has also proven versatile in other HSI tasks [
16], including semi-supervised anomaly detection with generative adversarial networks [
17], unsupervised anomaly detection with memory networks [
18,
19], self-supervised anomaly detection with blind-spot networks [
20,
21]. These advances highlight the broad potential of deep learning in HSI analysis and motivate our exploration of SNN-based classification architectures.
To summarize, the main contributions of our work are threefold:
Gated Spiking Attention (GSA). A novel spike-compatible self-attention mechanism that treats attention as a binary gating process. By employing a learnable convolution kernel to implicitly learn global spatial relationships and applying it as a hard, event-driven filter, GSA only uses logical AND operations to perform global feature selection. This design eliminates multiplications, retains full spike-driven computations, and achieves interpretable binary attention maps.
Groupwise Convolution Integration. To overcome the typical parameter explosion problem in dense projections, groupwise convolution is simultaneously introduced into the GSA module and the feedforward network (FFN) module. This drastically reduces the number of trainable parameters (only M), while retaining the ability to jointly extract local spectral-spatial features and long-range dependencies, making the model exceptionally lightweight and suitable for resource-constrained edge deployment.
Unified Spike-Driven Framework for HSIC. GS-SpikeFormer is the first fully spike-driven ViT specifically tailored for HSIC. By harmoniously integrating GSA, SC, and GWSFFN, this model achieves state-of-the-art accuracy with minimal temporal overhead: with only 4 time steps, it attains OAs of on Indian Pines, on Pavia University, on Salinas, and on Houston2013, significantly outperforming existing methods based on SNN and Transformer. End-to-end binary spike activation ensures unparalleled energy efficiency.
The remainder of this paper is organized as follows:
Section 2 details the GS-SpikeFormer architecture as well as the key components.
Section 3 describes experimental setup and hyperparameters analysis.
Section 4 compares the proposed method with SNN-based methods.
Section 5 provides comprehensive comparisons with state-of-the-art HSIC models.
Section 6 discusses the experimental results, covering the advantages and limitations of our work, as well as the future research directions. Finally,
Section 7 concludes the paper with future directions.
2. Methodology
In this section, we present GS-SpikeFormer, a fully spike-driven Vision Transformer specifically designed for HSIC. First, an overview of the overall architecture is provided, followed by detailed descriptions of its core components: the underlying spiking neuron model, Gated Spiking Attention (GSA), groupwise convolution integration, front-end processing modules, and classification head. The focus is on explaining how GSA reinterprets attention as a binary gating process to achieve global modeling while maintaining strictly spike-driven computation.
2.1. Overall Architecture
Figure 1 illustrates the overall pipeline of GS-SpikeFormer. Given an input hyperspectral data patch
(where
H,
W, and
C denote height, width, and spectral bands), the model processes it through three sequential stages: front-end processing, a spike-driven Transformer block, and a classification head. Every layer, except max-pooling and temporal-averaging, operates entirely with binary spike activations and event-driven computations, ensuring end-to-end energy efficiency.
Front-end processing adaptively reduces spectral dimensionality and extracts local spectral-spatial features while converting the original input into spike-compatible representations. It consists of a Spectral Calibration (SC) module ( + + spiking neuron activation ()) and a Spatial Calibration (SP) module ( + + + Max-Pooling).
Spiking-driven Transformer block is the core of the model, consisting of a Gated Spiking Attention (GSA) module and a Groupwise Spiking Feedforward Network (GWSFFN). Both of these modules are fully spike-driven and leverage groupwise convolution to reduce parameters while preserving representational capacity.
Classification head aggregates global spatial information via spike-based global average pooling and maps it to class logits through a spiking linear layer. The final prediction is obtained by averaging the output spikes over T time steps for stability.
Figure 1.
Overall architecture of GS-SpikeFormer for HSIC. All intermediate representations are binary spike tensors, and all operations (except pooling and temporal averaging) are spike-driven.
Figure 1.
Overall architecture of GS-SpikeFormer for HSIC. All intermediate representations are binary spike tensors, and all operations (except pooling and temporal averaging) are spike-driven.
Table 1 details the layer-wise configurations, including tensor shapes, kernel sizes, group settings, and spike-driven compatibility.
2.2. Spiking Neuron Model
All spiking computations in GS-SpikeFormer are based on the Leaky Integrate-and-Fire (LIF) neuron, which offers a favorable balance between biological plausibility and computational efficiency. Its discrete-time dynamics are described as follows:
Here,
and
denote the membrane potential before and after charging.
is the membrane time constant controlling leakage rate, a larger
means slower leakage, allowing the neuron to remember inputs for longer.
is the input current at time
t, computed as the weighted sum of incoming spikes
from presynaptic neurons (Formula (
2)),
are synaptic weights, and
is the resting potential. As illustrated in Formula (
1), the membrane potential update of a neuron is based on the input current and its previous state. Furthermore, Formula (
3) indicates that a spike is generated if the membrane potential
exceeds a predefined firing threshold
, where
is the Heaviside step function. After firing a spike, the membrane potential is reset by using Formula (
4), which means, if the incoming spikes
, the membrane potential
is reset to
; otherwise, it retains its current value.
For brevity, we denote a spiking neuron layer as , where is the input current over T time steps for n neurons, and is the output spike tensor.
2.3. Gated Spiking Attention (GSA)
The core innovation of GS-SpikeFormer is the Gated Spiking Attention mechanism, which fundamentally reinterprets self-attention as a learnable binary gating process. Unlike standard attention that computes weighted sums via floating-point matrix multiplications and , GSA generates a binary mask that selectively gates the flow of spike features. This design is fully spike-driven, uses only logical AND and addition operations, and eliminates all multiplications.
2.3.1. Motivation and Design Principle
In conventional ViTs, attention maps are calculated as , which involves expensive matrix multiplication and normalization. All these operations are incompatible with the sparse and event-driven nature of SNNs. Moreover, the resulting attention weights are continuous and often redundant.
In a spike-based system, information can be gated through binary masks: a feature either passes (if the corresponding gate is 1) or is blocked (if the corresponding gate is 0). This binary gating aligns naturally with the all-or-nothing spike communication in SNNs. Therefore, the continuous attention weights with a learnable binary mask indicate which spatial positions should interact with each other. The mask is generated by a lightweight convolution kernel, which implicitly learns global spatial relationships and avoid explicit pairwise similarity calculations.
2.3.2. Formulation of GSA
Let
be the input spike tensor of the GSA module (after the front-end processing). The calculation is carried out in several steps, and all steps maintain the binary spike representation (as shown in
Figure 2).
Preliminary activation. The input spike tensor
first passes through a spiking neuron layer (
) to ensure binary activations:
Query and Key generation. Instead of projecting the
onto three separate matrices, a single spike-compatible convolution with a kernel size of
(here
) is applied, followed by batch normalization (
):
Then, along the channel dimension, is split into two tensors and , which have the same size as and are served as Query and Key respectively. Notably, the Value is directly taken from the input (after reshaping) to reduce parameters and preserve sparsity.
Furthermore, the Query, Key, and Value tensors can also be split into multiple heads. Specifically, the channel dimension C is divided into groups, and the dimension of each head group is . Each head independently performs spike-based attention, allowing the model to focus on different feature subspaces. The outputs of all heads are concatenated and linearly projected back to the original dimension. This multi-head design enables the model to capture diverse spatial dependencies, which is particularly beneficial for hyperspectral data that may exhibit different correlations in different spectral bands.
Binary attention map. The attention map is obtained via a spike-based matrix multiplication between the transposed
and the reshaped
. Since all the operands are binary, the multiplication becomes a logical AND operation, and the sum over the feature dimensions is simply the count of coincidence spikes. Specifically,
and
are shaped as
with
and the calculation is as follows:
Although expressed as a matrix product, Formula (
7) reduces to logical AND followed by integer addition because both
and
are binary spike tensors, effectively counting coincident spikes. This multiplication-free computation is naturally suited for event-driven hardware and produces an integer counting matrix
.
To normalize these counts to a valid range while maintaining spike compatibility, a fixed scaling factor
is applied according to the standard practice in the Transformer architecture:
Here
represents the embedding dimension for each head. This constant scaling avoids potential training instability caused by the dynamically varying firing rate. The scaled mapping
is then passed through a spiking neuron layer to obtain a binary attention map:
Each nonzero entry in indicates that the corresponding pair of spatial locations should interact.
Feature gating. The output features are computed by applying the binary attention map
to the Key (or the second part of the projection) via another spike-based matrix multiplication:
Similarly, Formula (
10) involves no floating-point multiplications. The binary attention map
serves as a gating mask, accumulating key features at 1-entries and blocking at 0-entries, implemented purely by event-driven addition without any multiply-accumulate (MAC) operations.
is then scaled by a second factor
,
where
represents the number of spatial positions. This scaling factor reflects the design in [
15] and ensures stable training across different input resolutions. The scaled results are passed through a spiking neuron layer:
Finally, is reshaped back to .
Groupwise output projection. To incorporate information across channels while maintaining spike-driven calculations, we employed a groupwise separable convolution (GSC) (refer to
Section 2.4.1 for details). To ensure divisibility, the effective number of groups is automatically set to the greatest common divisor of the channel dimension
C and the intended number of groups (e.g., 16 or 32). A residual connection adds the original input
:
In order to better understand the calculation process of GSA, we provide a pseudo-code description in Algorithm 1.
| Algorithm 1 Pseudo-code of the calculation process of GSA. |
- Require:
Spike tensor , number of heads , groups g - Ensure:
Output spike tensor
- 1:
▹ Ensure binary activation - 2:
▹ Spike-compatible convolution - 3:
Split along channels into - 4:
▹ Use original spikes as Value - 5:
Reshape to , where , - 6:
for to do - 7:
slices of for head h ▹ Shape: - 8:
▹ Logical AND and summation; shape: - 9:
- 10:
▹ Binary attention map - 11:
▹ Logical AND and summation; shape: - 12:
- 13:
▹ Gated features - 14:
end for - 15:
Concatenate to , then reshape to as - 16:
▹ GSC output projection - 17:
▹ Residual connection return
|
2.3.3. Why GSA Works as Attention
The binary attention map Aattmap generated by GSA functions analogously to standard attention weights, indicating which spatial positions may exchange information, except that the weights are binarized through a spiking nonlinearity. The map acts as a hard gate: a feature is accumulated only when both the corresponding Query and Key positions emit a spike, implementing an event-driven, multiplication-free gating mechanism.
Although Aattmap is binary, the expressive power of the attention is preserved through three complementary designs: First, learnable convolutional projections encode rich spatial context before binarization, and the spiking threshold serves as a decision boundary that retains only statistically salient spatial correlations. Second, multiple parallel heads specialize in different spatial patterns, collectively capturing diverse dependencies. Third, after gating, a groupwise separable output projection mixes information across channels, restoring representational capacity. In this way, the collective behavior across heads and channels enables GSA to approximate soft attention effectively while staying fully spike-compatible. This reformulation of attention as a learnable binary gating process, rather than a weighted sum, aligns naturally with the event-driven philosophy of SNNs.
2.4. Groupwise Convolution Integration
To achieve extreme parameter efficiency without sacrificing representational capacity, GS-SpikeFormer incorporates groupwise convolutions in two critical places: the output projection of GSA and the feedforward network.
2.4.1. Groupwise GSA Revisited
The grouping convolution strategy employed by GSA on the output projection is directly inspired by the Groupwise Separable Convolution (GSC) proposed in GSC-ViT [
9]. GSC factorizes the standard convolution into two sequential operations: Grouped Pointwise Convolution (GPWC) which combines the information within the channel groups, and then Grouped Convolution (GC) which extracts the spatial features within the same groups. This decomposition reduces the parameter count by approximately a factor equal to the number of groups, while retaining the ability to learn rich representations.
Specifically, after computing the spike-based attention output
(Formula (
12)), we apply grouped
convolution to project the features back to the original channel dimension. This grouped projection can be regarded as a form of GPWC: it independently performs cross-channel mixing within each group, significantly reducing the parameter count compared to the standard dense projection. Moreover, a
convolution is applied within the same group subsequently to extract spatial features, which can be considered as a form of GC.
The number of groups g in the output projection is a hyperparameter that balances parameter efficiency and representational capacity. For instance, when and , the grouped convolution has approximately parameters. In contrast, the dense projection has parameters, which is 16-fold reduction. This drastic savings enables GSA to maintain global modeling capabilities with extremely lightweight footprint.
2.4.2. Groupwise Spiking Feedforward Network (GWSFFN)
The GWSFFN module replaces the traditional multi-layer perceptron (MLP) with a more efficient design that leverages grouped convolutions for local feature refinement. Its structure is as follows:
Channel expansion: A
convolution expands the channel dimension by a factor of 4, followed by
and spiking neuron activation.
Local refinement: A sequence of grouped
convolutions (a group of 64 channels) with
and spiking neuron activation, plus a residual connection that adds the input of this stage.
Where , is the number of convolution kernels, .
Channel projection: A
convolution compresses the channels back to the original dimension, followed by
, spiking neuron activation, and another residual connection.
The grouped convolution in the refinement stage enables the network to capture fine spectral-spatial patterns with minimal parameters, which is crucial for hyperspectral data where local texture and spectral correlations are discriminative.
2.5. Front-End Processing and Classification Head
The front-end processing consists of two lightweight spike-compatible modules designed to handle the high dimensionality of HSI while preserving spatial details.
2.5.1. Spectral Calibration (SC)
A
convolution adjusts the original spectral dimension to 256, followed by
and spiking neuron activation. This operation compresses spectral redundancy and initiates spike-based computation.
2.5.2. Spatial Calibration (SP)
A
convolution further reduces channels from 256 to 64, extracts local spectral-spatial features, and is followed by
and spiking neuron activation. To retain fine spatial boundaries, we apply stride-1 Max-Pooling:
Unlike GSC-ViT [
9] which uses strided convolutions, our stride-1 pooling preserves spatial resolution, avoids the loss of fine object boundaries, which is critical for pixel-wise classification.
2.5.3. Classification Head
In the classification stage, global average pooling is performed over spatial dimensions using integer arithmetic:
where
is the output of the Transformer stage. Subsequently, a spiking linear layer (SLL) maps
to class logits, and the final prediction is obtained by averaging over time steps:
This temporal averaging stabilizes the output while preserving the event-driven nature.
Finally, to better illustrate the complete classification pipeline of the GS-SpikeFormer framework, we provide a pseudo-code description in Algorithm 2.
| Algorithm 2 Pseudo-code of the complete classification pipeline of the GS-SpikeFormer framework. |
Require: HSI patch , time steps T, heads , groups g Ensure: Predicted class label 1: ▹ Shape: 2:// Front-end processing 3:4:5: ▹ Shape: 6:// Transformer block 7: ▹ See Algorithm 1 8: ▹ See details below 9:// Classification head 10: ▹ Global avg pool; shape: 11:12:for to T do 13: ▹ Spiking linear layer; shape: 14: 15:end for 16:17:18:return - 1:
▹ Channel expansion - 2:
- 3:
for to do - 4:
▹ Local refinement - 5:
end for - 6:
▹ Residual after refinement - 7:
▹ Channel projection - 8:
return ▹ Residual connection
|
2.6. Summary of Advantages
GS-SpikeFormer offers several key advantages over existing spiking Transformers and hybrid models:
Full spike-driven computation: All internal operations (except pooling and temporal averaging) use only binary spikes, logical AND, addition, and integer scaling without floating-point multiplications.
Gated spiking attention: A novel reinterpretation of attention as binary gating, which is more natural for SNNs and eliminates expensive similarity computations.
Extreme parameter efficiency: Through extensive use of groupwise convolutions in attention and feedforward modules, the model achieves state-of-the-art accuracy with only M parameters.
HSIC-specific design: The front-end modules and single-stage Transformer (only one Transformer block is adopted) are tailored to the challenges of high dimensionality and limited training samples in hyperspectral data.
In the subsequent sections, the effectiveness of GS-SpikeFormer is empirically verified on four benchmark HSI datasets, demonstrating its superiorities in terms of accuracy, parameter efficiency, and energy consumption.
3. Experimental Setup and Parameter Analysis
This section describes the experimental framework used to validate the proposed GS-SpikeFormer. Firstly, the benchmark datasets, data splitting strategy, implementation details, and evaluation metrics are introduced. Then, the influence of key hyperparameters, including spatial patch size, time steps, attention heads, and group numbers, on classification performance is systematically analyzed, providing the optimal configuration for subsequent experiments. Subsequently, ablation experiments are conducted to rigorously evaluate the contributions of each key component.
3.1. Datasets and Data Splitting
Four widely-used HSI datasets are employed to evaluate the proposed method: Indian Pines (IP), University of Pavia (PU), Salinas (SA), and Houston2013 (HU).
Table 2 summarizes their key characteristics.
Given the limited labeled samples, the class-aware splitting strategy is adopted. For classes with 100 or more samples, 75 samples are used for training, 25 samples for validation, and the remaining samples for testing. For classes with fewer than 100 samples,
is used for training,
for validation, and the remaining
for testing. This ensures a proportional representation while maximizing the training data.
Table 3,
Table 4,
Table 5 and
Table 6 show the detailed class distribution.
3.2. Implementation Details
All models are implemented in PyTorch 2.5.1 with CUDA 12.1 and trained on an NVIDIA GeForce RTX 2080 Ti GPU (11GB VRAM). For spike-based computations, the LIF neuron model from SpikingJelly and default parameters are used. Training employs stochastic gradient descent with Nesterov momentum (
), an initial learning rate of
, and the ReduceLROnPlateau scheduler (with a factor of
and a patience of 3). Weight decay is set to
. The models are trained for 100 epochs with a batch size of 64. Each experiment is repeated 10 times with different random seeds; results are reported as the average ± standard deviation. It should be emphasized that the reported training time is the total clock time of the entire training process (including all epochs and validation steps), while the test time is the total inference time for the entire test set. The inference time per image (Infer time) reported in
Table 7,
Table 8,
Table 9 and
Table 10 is calculated as the total test time divided by the number of test samples. All inference time measurements are performed with a batch size of 64, consistent with the training configuration. The reported values represent the average per-image inference time under this batch setting.
It should be noted that the patch-based sampling inherently introduces spatial overlap between training and test samples due to shared neighborhoods, a recognized issue in HSIC [
22] that can slightly inflate accuracy. Since all methods, including GS-SpikeFormer and all baselines, are evaluated under the identical sampling protocol (patch size, split, and seed), the relative performance ranking remains valid and the superiority of GS-SpikeFormer is not an artifact of data leakage.
To further examine the training dynamics,
Figure 3 shows the training and validation loss and accuracy curves over 100 epochs on all four datasets. The model converges within approximately 30–40 epochs, and validation accuracy stabilizes at competitive levels (above
on IP and HU, above
on PU and SA). No notable overfitting is evident, as the gap between training and validation curves remains consistently small. This demonstrates the effectiveness of the training configuration and the model’s strong generalization across diverse hyperspectral scenes, from heterogeneous vegetation (IP) and urban areas (PU, HU) to homogeneous agricultural regions (SA).
3.3. Evaluation Metrics
Two categories of metrics are used to evaluate the proposed method: classification accuracy metrics and efficiency metrics.
3.3.1. Classification Accuracy Metrics
Three standard metrics are used to assess classification performance:
Overall Accuracy (OA): proportion of correctly classified samples.
Average Accuracy (AA): mean of per-class accuracies, providing a balanced view on imbalanced datasets.
Kappa coefficient (κ): measure of classification consistency accounting for chance agreement.
3.3.2. Efficiency Metrics
To assess the applicability of the model to resource-constrained deployments, three efficiency metrics are employed.
Parameter count: the total number of trainable parameters, indicating model complexity and memory footprint.
Synaptic operations (SOPs): the total number of synaptic activations during the inference process, which directly reflects the computational complexity of the spike-driven models. Unlike the floating-point operations (FLOPs) used in ANNs, SOPs only count the spike-triggered events, which is aligned with the event-driven nature of SNNs.
For a convolutional layer,
are calculated as:
where
T is the number of time steps,
B is the batch size,
and
are the input and output channels,
is the number of groups in groupwise convolution,
is the kernel size, and
is the output spatial dimensions.
For a linear layer,
are calculated as:
where
and
are the input and output dimensions of the linear layer, respectively.
The total
are the sum over all convolutional and linear layers:
Energy consumption: according to the convention in neuromorphic computing research [
14,
15,
23,
24], the theoretical energy consumption for inference is estimated based on SOPs. Using the standard energy model, each SOP consumes approximately
mJ [
15]. This value is derived from the estimated energy cost of addition operations in a typical 45 nanometer CMOS process and has been widely used for fair, hardware-agnostic comparisons of SNN models. Therefore, the energy calculation for each image is as follow:
It is worth noting that this is a theoretical upper-bound estimation, primarily intended for relative comparisons among different SNN architectures. The actual energy consumption of specific neuromorphic hardware may vary depending on the chip architecture, process node, and data encoding scheme. Nevertheless, this standardized estimation ensures fair and reproducible comparisons, as it has been consistently adopted in previous work [
14,
15,
23,
24].
3.4. Hyperparameter Analysis
In this section, the influence of four key hyperparameters on the classification performance is systematically assessed: spatial patch size, time steps T, the number of attention heads , and the number of groups g. When analyzing a single hyperparameter, the others are fixed at their default values: , , , and the input channel dimension of the Transformer stage is . All reported results are the average values of ten independent runs.
3.4.1. Spatial Patch Size
The spatial patch size determines the amount of context information used for classification. Patch sizes from
to
are evaluated, with the results summarized in
Table 7 and
Figure 4a.
The results reveal that the classification performance is highly sensitive to this hyperparameter. The optimal patch size varies substantially across different datasets, reflecting differences in scene structure. For the heterogeneous vegetation scene of IP, the peak performance is , yielding an OA of . Beyond this size, the performance gradually declines, indicating that larger patches will introduce redundant background information, which may confuse the classifier. The urban scene of PU dataset achieves its best OA of when the patch size is . However, the accuracy declined afterwards, possibly due to the inclusion of mixed pixels from neighboring urban objects. In contrast, the homogeneous agricultural scene of SA benefits from a broader spatial context, with the largest patch size being , resulting in the highest OA of . The complex urban scene of HU performs the best, with the smallest patch size of (OA of ), indicating that finer spatial details are more crucial for distinguishing diverse urban land cover types.
As shown in
Figure 4a, the OA curves for all datasets exhibit clear peaks, confirming that the accuracy typically increases with patch size up to a dataset-specific optimum. Beyond this value, due to redundant context or blurred boundaries, it tends to stabilize or decrease.
Table 7 also reports the computational costs (training time, testing time, and SOPs) for each patch size. As expected, larger patch sizes lead to higher computational overhead. For example, on the IP dataset, increasing the patch size from
to
increases the SOPs from
G to
G. Nevertheless, the primary criterion for selecting the optimal patch size is classification accuracy. In the subsequent experiments, these optimal sizes are adopted:
for IP,
for PU,
for SA, and
for HU.
3.4.2. Number of Time Steps
The number of time steps T governs the trade-off between temporal integration and computational cost. For time steps , the optimal patch size determined in the previous step is used for evaluation.
As shown in
Table 8 and
Figure 4b, increasing
T generally improves the OA of all datasets, although the improvement rate varies, reflecting the differences in dataset complexity and temporal dynamics. For IP, the OA increases from
at
to
at
, with a gain of
, which is the highest among all time steps. The slight decrease at
(
) and
(
) indicates that longer temporal simulations may introduce redundant spike activities, which is not conducive to the learning of distinguishing features for this heterogeneous vegetation scene. For PU, the OA continuously improves from
at
to
at
(with a total gain of
), indicating that the urban scenario of PU involves more complex temporal dynamics that benefits from a longer integration of spike information. For SA, the OA reaches
at
, only
higher than that at
(
), suggesting that for this homogeneous agricultural scenario, the benefits decrease after exceeding
. For HU, the OA saturates at
(
) with no further gain at
, suggesting that four time steps are sufficient to capture the discriminative features in this complex urban scenario.
In contrast, the computational costs of all datasets (measured in SOPs and estimated energy) increase linearly with T. On IP, the SOPs increase from G at to G at (an 8 fold increase), while OA only improves by . Therefore, to balance accuracy and computational efficiency, is selected as the default configuration for the subsequent experiments.
3.4.3. Number of Attention Heads
Multi-head attention enables the model to capture diverse feature subspaces. The number of attention heads ranges from 2 to 16, while keeping , , , and the optimal patch size.
As shown in
Table 9 and
Figure 4c, performance remains stable across different numbers of heads on all datasets (IP:
, PU:
, SA:
, HU:
), with
= 8 achieving the best or near-best OA. The OA varies only slightly among different head counts, typically within
for each dataset. Taking IP as an example, the OA ranges from
(
= 16) to
(
= 8), a difference of merely
. Computational cost also shows negligible variation, as increasing the number of heads reduces the dimensionality per head (
), keeping the total computational load approximately constant. Therefore, adopting 8 heads as the standard configuration provides a robust balance between representational diversity and computational efficiency.
3.4.4. Number of Groups
The group number g in the GSA module plays a crucial role in balancing parameter efficiency and feature extraction capability. By dividing the channels into independent groups in the self-attention projection, groupwise separable convolution substantially reduces parameters and computational costs while preserving the ability to model global dependencies. The group numbers are , with , , , and the optimal patch size.
As shown in
Table 10 and
Figure 4d, the performance differences among different
g values are marginal, typically within
of each dataset. For IP,
yields the highest OA (
), which is only
higher than
(
). For PU,
achieves the best OA (
),
lower than
. For SA, the results of
(98.89%) and
(98.97%) are comparable, with a difference of only
. For HU,
achieves the best OA (
),
lower than
. The results show that this model is robust to the choice of
g. Due to the marginal performance differences and to maintain consistency across all datasets, the default configuration of
is adopted.
3.4.5. Summary of Optimal Configuration
Based on the above analysis, all subsequent experiments adopt the following configuration. The spatial patch size is set to the optimal value for each dataset: IP is , PU is , SA is , and HU is . The remaining hyperparameters are fixed across all datasets: time steps , the number of attention heads , and the groups . This uniform configuration ensures fair comparisons while maintaining competitive performance, as the above analyses have demonstrated that the model is robust to variations in T, , and g within a reasonable range.
3.5. Ablation Study
To rigorously evaluate the contribution of each key component in the proposed GS-SpikeFormer framework, an ablation study is conducted on the IP dataset. All experiments follow the training scheme described in
Section 3.4.
3.5.1. Variant Models
Three configurations are designed to systematically analyze the contributions:
Baseline (SpikingResformer-HSI): Since the original SpikingResformer [
15] is designed for high-resolution RGB images (e.g.,
), it cannot be directly applied to small HSI patches (e.g.,
). Therefore, it is suitable for a single-stage architecture and 64-channel HSIC tasks, denoted as ‘SpikingResformer-HSI’. This baseline implements the original Dual Spike Self-Attention (DSSA) mechanism in SpikingResformer [
15], using running-average firing rate for scaling and standard (
) convolution for output projection. It employs a simple prologue consisting of a single (
) convolution, batch normalization, and max-pooling (with stride = 1). There is neither a proposed front-end module (such as Spectral Calibration or Spatial Calibration) nor any use of groupwise convolution.
Baseline+Front-end: This configuration adds the recommended Spectral Calibration (SC) and Spatial Calibration (SP) modules to the baseline. The SC module consists of convolution (256 channels), followed by BN and spiking neuron activation; the SP module consists of convolution (64 channels), followed by BN, spiking neruron activation, and stride-1 max-pooling. These modules are inserted between the input and the prologue.
Full Model: This is the complete proposed model. It further replaces DSSA with the GSA mechanism (using fixed scaling and groupwise separable convolutions in the output projection), and employs the GWSFFN. The front-end modules (SC + SP) are also included.
3.5.2. Results and Analysis
Table 11 reports the quantitative results of the three configurations across all four datasets. The progressive improvements from the
Baseline to the
Baseline+Front-end and then to the
Full Model consistently confirm the effectiveness of each proposed component.
Contribution of Front-end modules: Adding the SC+SP modules to the Baseline can improve the performance of all datasets, and the magnitude of improvement reflects the complexity of the scenarios. On IP (heterogeneous vegetation, severe class imbalance), OA increases from to (a gain of ), AA increases from to (a gain of ), and increases from to (a gain of ). The relatively larger gains indicate that the Front-end module is particularly beneficial for complex and imbalanced scenarios. On PU (urban scene), OA improves from to (a gain of ), confirming that these modules help capture discriminative features in urban environments. On SA (homogeneous agricultural scenario), OA increases from to (a gain of ), and the marginal gain is expected, as the Baseline has already achieved nearly saturated performance and there is little room for improvement. On HU (complex urban scenario), OA improves from to (a gain of ), confirming the effectiveness of these modules on challenging urban data. AA and show similar trends across all datasets. These improvements verified that Front-end module effectively reduce spectral redundancy and enhance local spatial feature representation.
Contribution of GSA and GWSFFN: Replacing DSSA with the proposed GSA and incorporating groupwise convolutions into the Feedforward network further improve the performance on most datasets. On IP, the Full Model achieves OA (an additional gain of over Baseline+Front-end), AA () and (). The substantial gains demonstrate that GSA is particularly effective in capturing global spatial dependencies in challenging heterogeneous scenarios. On PU, OA reaches (a gain of ), confirming that GSA is also beneficial for urban scene classification. On SA, the Full Model achieves an OA of , which is comparable within the standard deviation range to the Baseline+Front-end (), indicating that the Baseline architecture has well-handled the dataset. On HU, OA reaches (a gain of ), highlighting the robustness of GSA in complex urban data. These results confirm that the proposed GSA not only reduces parameters through groupwise projections but also enhances the global context modeling ability. Meanwhile, GWSFFN effectively refines the local spectral-spatial features.
To rule out random variation, paired t-tests are conducted between the Full Model and the Baseline over 10 independent runs per dataset, separately for OA, AA, and . The results show that OA improvements are statistically significant () on IP (), PU (), and HU (), while SA shows no significant improvement (), which is consistent with the near-saturated performance on this homogeneous agricultural scene. For AA and , PU and HU show significant improvements, while SA does not. On IP, thought OA and show significant improvements, AA does not (), which may be attributed to the severe class imbalance of this dataset. These results confirm that the proposed components consistently enhance performance on challenging datasets while remaining competitive on already well-solved scenarios.
In summary, the ablation studies demonstrate that each of the proposed components contributes meaningfully to the performance of GS-SpikeFormer. The Front-end modules enhance the input representation, while GSA and GWSFFN jointly achieve efficient global and local feature learning within a fully spike-driven framework.
4. Comparison with SNN-Based HSIC Methods
In this section, the proposed GS-SpikeFormer is evaluated against two representative HSIC methods based on SNN: SNN-SSEM [
12] and AFSA [
14]. SNN-SSEM [
12] is a conventional SNN built on LIF neurons with direct coding. It is trained with approximate gradient methods and employs standard convolutions alongside spiking depthwise separable convolutions for spectral-spatial feature extraction. Lacking attention mechanisms, it typically requires a large number of time steps to achieve competitive accuracy. AFSA [
14] represents a recent attempt to integrate attention-like mechanisms into SNNs for HSIC. It introduces a spike self-attention (SSA) module coupled with adaptive refocusing convolutional layers. While AFSA incorporates attention-inspired components, it remains largely within the conventional spike-driven paradigm without fully embracing the Transformer architecture, and still requires careful tuning, particularly under very low time step settings. For AFSA, the original network structure is followed with the same
training/validation split as used for all other methods (see
Section 3.1) to ensure fair comparison. While AFSA’s original paper [
14] reports higher accuracy with 100 training samples per class, the unified protocol adopted here allows a consistent evaluation across all models. In contrast, GS-SpikeFormer fully embeds Transformer principles within a SNN framework, building upon the spiking Transformer backbone of SpikingResformer [
15] while optimizing it for efficient spike-compatible global dependency modeling tailored to hyperspectral data.
All models are trained and evaluated under the identical training strategy and evaluation metrics, with dataset-specific optimal patch sizes. The results of the configurations across multiple time step are reported in
Table 12,
Table 13,
Table 14 and
Table 15, where the entries marked with ‘-’ indicate that the training process did not converge to a specific configuration.
Across all the dataset and time step configurations, GS-SpikeFormer consistently outperforms the two baselines in terms of accuracy, parameter efficiency, computational cost, and inference speed. It is noteworthy that GS-SpikeFormer achieves strong performance even in a single time step (
), demonstrating the effectiveness of attention mechanism in SNNs for HSIC under low time step settings. Represented by the IP dataset, at
, GS-SpikeFormer achieves an OA of
, which is
higher than SNN-SSEM (
) and
higher than AFSA (
). It only uses
M parameters, which is 60–
less than SNN-SSEM (
M) and AFSA (
M). In terms of computational cost, GS-SpikeFormer requires
G SOPs, which is comparable to SNN-SSEM (
G, only
higher) but
lower than AFSA (
G). Despite its slightly higher SOPs than SNN-SSEM, GS-SpikeFormer achieves
faster inference (
s vs.
s), indicating that its lightweight groupwise separable attention mechanism can make better use of the hardware. Similar trends are also observed on the HU, SA and HU datasets, as detailed in
Table 12,
Table 13,
Table 14 and
Table 15.
Overall, GS-SpikeFormer achieves a superior trade-off between accuracy and efficiency. Even in a single time step, it can deliver powerful performance, using 60– fewer parameters than the baselines while maintaining or slightly exceeding the SOPs of SNN-SSEM (with much higher accuracy), and achieving 46– faster inference. Compared to AFSA, GS-SpikeFormer reduces the computational cost by 62– and achieves 50– faster inference while maintaining superior accuracy. These results indicate that the proposed architecture is highly suitable for resource-constrained edge deployment.
5. Comparison with SOTA HSIC Methods
The proposed GS-SpikeFormer is evaluated against various state-of-the-art methods, including CNN-based (PResNet [
25] and HybridSN [
26]), Transformer-based (SSFTT [
27] and GSC-VIT [
9]), and SNN-based (SNN-SSEM [
12] and AFSA [
14]).
This comparison situates the model in a broader high-accuracy HSIC context and demonstrates its competitiveness beyond the SNN domain. All models are trained and evaluated under the same experimental protocol to ensure fair comparisons. For SNN-based methods, the original time step settings are as follows: SNN-SSEM [
12] uses 30 steps, AFSA [
14] uses 1 step, and the proposed GS-SpikeFormer uses 4 steps. The results are averaged over 10 runs and reported with standard deviations.
5.1. Results on Indian Pines (IP)
Table 16 summarize the results on the IP dataset. GS-SpikeFormer achieves an OA of
, outperforming all compared methods. It substantially surpasses CNN-based models (PResNet:
, HybridSN:
) by
and
, respectively, demonstrating the advantage of spike-driven attention over conventional convolutions in heterogeneous agricultural scenarios. Among Transformer-based methods, GS-SpikeFormer exceeds SSFTT (
) by
and GSC-Vit (
) by
, confirming the effectiveness of the proposed Gated Spiking Attention in capturing both global dependencies and local spectral-spatial features while maintaining fully spike-drive computation. Against SNN-based methods, it outperforms SNN-SSEM (
) by
and AFSA (
) by
. Notably, these gains are achieved with only
time steps, a substantial reduction from SNN-SSEM’s
steps, highlighting the model’s superior temporal efficiency.
Per-class analysis reveals consistent gains on challenging categories. For Class 2 (Corn-notill), GS-SpikeFormer reaches , compared to for SNN-SSEM and for AFSA. For Class 11 (Soybean-mintill), it attains , versus and , respectively. These gains are particularly significant given the limited training samples for these classes, underscoring the model’s ability to distinguish spectrally similar agricultural categories.
The classification map in
Figure 5 shows cleaner boundaries and fewer misclassifications, especially along field edges, corroborating the quantitative results.
To intuitively assess feature discriminability, t-SNE visualization is performed on the IP dataset (
Figure 6). Features extracted by GS-SpikeFormer form more compact and well-separated clusters than those from the competing methods, exhibiting clearer class boundaries and fewer inter-class overlaps. In contrast, CNN-based (PResNet, HybridSN) and Transformer-based (SSFTT, GSC-ViT) methods show relatively scattered distributions. Among SNN-based methods, AFSA yields moderately separated clusters, whereas GS-SpikeFormer achieves the most discriminative feature space. These results confirm that the proposed GSA mechanism and groupwise convolutions effectively learn more discriminative spectral-spatial representations than existing methods.
5.2. Results on Pavia University (PU)
On the PU dataset (
Table 17), GS-SpikeFormer achieves the highest OA of
, outperforming all compared methods. Specifically, it surpasses the CNN-based methods PResNet (
) and HybridSN (
) by
and
, respectively, demonstrating the effectiveness of spike-driven attention in capturing discriminative features in urban scenes. Among Transformer-based models, GS-SpikeFormer exceeds SSFTT (
) by
and GSC-ViT (
) by
, confirming the advantage of the proposed GSA over conventional self-attention and its grouped variants. Compared to SNN-based approaches, GS-SpikeFormer achieves gains of
over SNN-SSEM (
) and
over AFSA (
), highlighting its superior accuracy within the SNN domain.
A closer examination of per-class performance reveals both strengths and nuanced trade-offs. GS-SpikeFormer achieves outstanding results on several challenging urban categories. For instance, on Class 2 (Meadows), it attains , the highest among all methods, significantly outperforming PResNet () and HybridSN (). Similarly, on Class 7 (Bitumen), it achieves , surpassing all competitors, with the closest being SSFTT at . These results indicate the model’s strong capability in distinguishing spectrally distinct land-cover classes with sufficient training samples.
However, on Class 4 (Trees), GS-SpikeFormer yields , which is lower than SNN-SSEM () and AFSA (). This suggests that while the proposed model excels in many categories, certain classes may benefit from alternative architectural designs or different temporal integration strategies. Similarly, on Class 9 (Bare Soil), GS-SpikeFormer achieves , slightly below the best-performing method SNN-SSEM (). These observations indicate that despite achieving the highest overall accuracy, the model does not uniformly dominate all classes, and the gains in OA are driven by substantial improvements in categories with larger sample sizes (e.g., Classes 2, 5, 6, 7) rather than marginal improvements across all classes.
The classification map in
Figure 7 visually corroborates these quantitative findings. GS-SpikeFormer produces sharper boundaries and fewer misclassifications in homogeneous areas such as ‘meadows’ and ‘bitumen’, while showing minor irregularities in tree-covered regions.
5.3. Results on Salinas (SA)
For the SA dataset (
Table 18), GS-SpikeFormer achieves an OA of
, which is comparable to SNN-SSEM (
) as the difference is well within the standard deviation range. This near-saturation performance is expected given the homogeneous agricultural nature of SA and the abundance of training samples. While the absolute gains are modest, this is expected given the near-saturation performance of all methods on SA, which features homogeneous agricultural scenes with relatively abundant training samples.
Per-class analysis reveals that GS-SpikeFormer achieves near-perfect accuracy on the majority of classes, with perfect scores on Classes 1, 2, 3, 7, 9 and 16. However, on Class 8 (Grapes-untrained), it reaches , slightly below GSC-ViT () and SNN-SSEM (). On Class 5 (Broccoli-green-weeds-1), it yields , trailing SNN-SSEM () and AFSA (). These minor trade-offs suggest that while the model excels overall, further refinement may be needed for specific classes with distinct spectral signatures.
The classification map in
Figure 8 shows well-delineated agricultural regions with high regional consistency, visually confirming the model’s robustness in homogeneous scenes.
5.4. Results on Houston2013 (HU)
On the challenging HU dataset (
Table 19, GS-SpikeFormer achieves an OA of
, outperforming all comparison methods. It outperformed the CNN-based models PResNet (
) and HybridSN (
) by
and
respectively, demonstrating strong generalization ability in this complex urban scene with extremely scarce samples (only
of pixels labeled). In the Transformer-based methods, GS-SpikeFormer surpasses SSFTT (
) by
and GSC-ViT (
) by
. Against the SNN-based methods, it outperforms SNN-SSEM (
) by
and AFSA (
) by
.
Per-class analysis reveals both strengths and nuanced trade-offs. GS-SpikeFormer achieves the highest accuracy on several challenging categories, including Class 1 (Grassland: ), Class 3 (Synthetic Grass: ), and Class 7 (Water: ), and Class 10 (Residential: 99.98%). Notably, on Class 7, it substantially outperforms SSFTT () and AFSA (), underscoring the model’s ability to capture fine spectral differences with limited samples. However, on Class 8 (Commercial) and Class 9 (Road), GS-SpikeFormer achieves and , respectively, slightly trailing GSC-ViT ( and ). These minor discrepancies suggest that while the proposed model excels in overall accuracy, further architectural refinements may benefit specific urban classes with highly heterogeneous spectral signatures.
The classification map in
Figure 9 reveals sharper boundaries and fewer errors in heterogeneous urban areas, visually confirming the model’s robustness.
6. Discussion
The experimental results demonstrate that GS-SpikeFormer achieves leading classification accuracy on four benchmark hyperspectral datasets using only 4 time steps and
M parameters. This strongly supports the core hypothesis that multiply-accumulate operations in self-attention can be replaced by event-driven logical AND gating without compromising global context modeling. Compared to earlier SNN-based methods that rely on a large number of time steps (e.g., SNN-SSEM [
12] requires 30 time steps, AFSA [
14] demands careful tuning), the proposed GSA improves the OA on IP dataset by more than
at extremely low time steps while reducing parameters by 60–
, validating the effectiveness of a spiking-compatible Transformer for HSIC. Even when compared with state-of-the-art convolutional and Transformer models such as PResNet [
25], HybridSN [
26], SSFTT [
27], and GSC-VIT [
9], GS-SpikeFormer attains higher accuracy than almost all datasets, indicating that the synergy between groupwise convolutions and binary attention gates not only preserves local spectral-spatial feature extraction capabilities but also offers inherent advantages for hardware-efficient deployment.
In a broader context, the model achieves OA on HU dataset with only labeled pixels and an estimated energy consumption as low as mJ per image, making it a promising candidate for real-time or onboard processing on resource-constrained platforms. Nevertheless, several limitations exist. The optimal spatial patch size varies across datasets (from to ), indicating that some degree of dataset-specific tuning is still required. For classes with severe imbalance (e.g., Oats in IP, Trees in PU), the fixed 4 time steps encoding occasionally underperforms certain baselines, suggesting that the current temporal coding strategy may not be sufficient for all land-cover types. Moreover, the reported energy consumption is a theoretical upper bound based on 45 nm CMOS assumptions, and actual energy efficiency on physical neuromorphic hardware remains to be validated.
Potential uncertainties in the results stem primarily from the randomness of limited-sample partitioning and the higher variance of rare classes. The class-aware splitting strategy guarantees a minimum number of training samples per class, but for extremely small classes the split may yield test subsets with limited representativeness. The selection of optimal hyperparameters depends on the validation set, introducing minor partition-related biases. The theoretical energy estimation assumes that every spike triggers a synaptic operation, without accounting for actual sparse activity patterns and hardware-specific optimizations, and should therefore be regarded as an upper-bound reference.
Future work may pursue several directions: designing an adaptive time-step mechanism that dynamically adjusts T based on input complexity to further balance accuracy and efficiency; deploying and benchmarking GS-SpikeFormer on neuromorphic chips such as Loihi or TrueNorth to obtain real-world energy measurements; exploiting the interpretable binary masks generated by GSA for spectral-spatial feature attribution analysis, thereby bridging high-performance models and explainable AI in remote sensing; extending the framework to multi-source and multi-temporal HSI data, as well as downstream tasks such as target detection and change detection; and combining the proposed architecture with advanced training paradigms such as STDP-based fine-tuning or few-shot meta-learning to further push the performance boundaries under extreme label scarcity. Overall, GS-SpikeFormer provides an accuracy-efficiency co-optimized spiking Transformer baseline for edge-oriented HSIC, while its current limitations outline a clear roadmap for subsequent refinement and broader adoption.