Pulse neural network small sample target detection system
By introducing a prototype building module, a feature reweighting module, and a detection head design into the spiking neural network, and combining it with the Episode training controller, the problems of temporal characteristics, feature interaction, and computational stability in few-shot object detection of spiking neural networks are solved, achieving efficient few-shot object detection and rapid category expansion.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN INST OF ADVANCED TECH CHINESE ACAD OF SCI
- Filing Date
- 2026-03-05
- Publication Date
- 2026-05-29
AI Technical Summary
Existing spiking neural network target detectors suffer from overfitting and decreased detection accuracy in small sample scenarios. They also lack features that address the temporal characteristics of spiking sequences, feature interaction mechanisms between support sets and query sets, metric learning and spiking coding mechanisms, and computational efficiency and stability issues in episode training.
A pulse prototype building module is used to adaptively learn prototype representations through a temporal attention network. A prototype-guided feature reweighting module is introduced for dynamic modulation. A prototype matching detection head is designed to support a variable number of categories. Task-adaptive batch normalization and gradient accumulation are performed through an Episode meta-training controller to reduce computational overhead.
It achieves the maintenance of the energy efficiency advantage of spiking neural networks in small sample scenarios, improves detection performance, supports rapid category expansion and dynamic detection, and solves the overfitting problem in small sample scenarios in existing technologies.
Smart Images

Figure CN122115833A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a small-sample target detection system using a spiking neural network. Background Technology
[0002] Existing spiking neural network object detectors rely on large-scale labeled data for training, resulting in severe overfitting and a sharp drop in detection accuracy in small-sample scenarios. While mature small-sample object detection methods exist in the field of artificial neural networks (such as prototype networks, feature reweighting, and meta-learning), these methods face the following technical challenges when directly applied to spiking neural networks: the discreteness and temporal dependence of the pulse sequences make traditional continuous-range metric learning methods unsuitable; feature interactions between the support set and the query set need to be performed while maintaining the pulse form to preserve energy efficiency; and meta-learning's episode training in spiking neural networks suffers from high computational cost and unstable batch normalization statistics. Specifically: Few-Shot Object Detection (FSOD) aims to enable detection models to quickly learn and detect new object classes from a small number of labeled samples of each class. This is valuable for reducing data labeling costs and enabling rapid model deployment. Current mainstream methods include: Metric learning-based methods, such as Prototypical Networks (Snell et al., NIPS 2017), are a classic example. Their core idea is to compute the mean of the features from the support set samples for each class as a class prototype. Query samples are classified by calculating the distance between their features and each class's prototype. In object detection, the RepMet method learns multiple representative embedding vectors for each class to capture intra-class diversity. The latest Prototype-Driven Adaptation method (2024) proposes a best-of-K matching scheme and a temperature-scaling fusion strategy, effectively combining metric similarity with the detector output.
[0003] Feature reweighting-based methods: The FSRW method (Few-Shot Object Detection via FeatureReweighting, ICCV 2019) dynamically modulates the output of the feature extractor by encoding the support set samples into a globally reweighted vector, enabling the detector to focus on feature dimensions related to the support set categories. This idea has been adopted and improved by a large number of subsequent works.
[0004] Meta-learning-based methods employ an episode-based training strategy to simulate few-shot testing scenarios. In each training iteration, N classes (N-way) and K samples per class (K-shot) are randomly sampled to form the support set, and the query set is sampled for evaluation. The Meta-YOLO series of works combines the YOLO detector with a meta-learning framework, achieving improved few-shot detection capabilities in specific domains. The TaskNorm method (Bronskill et al., ICML 2020) addresses the instability of batch normalization statistics in meta-learning by proposing to maintain independent batch normalization statistics for each episode task.
[0005] Spiking neural networks (SNNs), as the third generation of artificial neural networks, process information by simulating the spiking mechanism of biological neurons, exhibiting significant energy efficiency advantages in neuromorphic hardware. In recent years, researchers have begun exploring the application of SNNs in object detection tasks. Direct training methods, employing surrogate gradient techniques, achieve end-to-end training of SNNs and have yielded some results on standard object detection datasets.
[0006] However, existing spiking neural network object detectors are all trained on large-scale datasets and lack specific design for small sample scenarios, resulting in severe performance degradation under small sample conditions.
[0007] The combination of spiking neural networks and few-shot learning is an emerging research direction. The method "Few-Shot Learning in Spiking Neural Networks by Multi-Timescale Optimization" (NeuralComputation, 2021) achieves few-shot learning on handwritten character classification tasks by optimizing parameters at different time scales, but it is limited to classification tasks. The method "Heterogeneous Ensemble-Based Spike-Driven Few-ShotOnline Learning" establishes a few-shot learning scheme within a recurrent spiking neural network architecture. The method "Self-crossFeature based Spiking Neural Networks for Efficient Few-shot Learning" (2025) proposes a self-cross feature mechanism to construct a dual representation in the spiking feature space.
[0008] However, the prototype network method is effective in the continuous value domain but does not consider the temporal characteristics of the pulse sequence; the feature reweighting method is implemented in artificial neural networks through continuous value multiplication but is difficult to adapt to the pulse domain; the few-shot learning method of spiking neural networks focuses on classification rather than detection.
[0009] In summary, the main drawbacks of existing technologies include: I. Lack of Prototype Representation Mechanism in the Pulse Domain. Prototype networks construct class prototypes by calculating the arithmetic mean of the features of the support set samples. This operation is simple and effective in continuous-valued feature spaces. However, the feature representation of spiking neural networks is a temporal pulse sequence (discrete binary or quantized integer sequence), and directly calculating the mean will lead to the loss of temporal information. Existing methods usually sum or average the pulse sequence in the time dimension. This coarse-grained temporal aggregation method ignores the fine-grained temporal patterns contained in the pulse firing moments, which will seriously affect the discriminativeness of the prototype in small sample scenarios.
[0010] Second, the support set guidance mechanism is difficult to implement in the spiking domain. Feature reweighting methods in artificial neural networks are implemented through element-wise multiplication or attention mechanisms, allowing query features to be guided by the support set. In spiking neural networks, features are passed in the form of spiking sequences, and traditional continuous value multiplication operations cannot be directly applied. Although reweighting can be performed on continuous values after spiking accumulation, this would disrupt the spiking-driven computational model, resulting in the loss of energy efficiency advantages. Existing spiking neural network architectures are mostly feedforward structures, lacking lateral feature interaction channels between the support set and the query set.
[0011] Third, metric learning is incompatible with pulse coding mechanisms. Commonly used metrics such as Euclidean distance and cosine similarity are designed for continuous value vectors. The similarity of a pulse sequence depends not only on the total number of pulses (rate dimension) but also on the relative timing of the pulses (temporal dimension). Calculating the distance directly on the continuous values after pulse accumulation results in the loss of temporal information, while calculating discrete metrics on the pulse sequence is overly sensitive to noise. Designing a metric function that adapts to pulse coding mechanisms is a key challenge.
[0012] IV. Computational Efficiency and Stability Issues of Episode Training in Spiking Neural Networks. Meta-learning episode training requires processing multiple samples in the support and query sets in each iteration, with each sample unfolded along the time step dimension, leading to a significant increase in computational cost and GPU memory usage. Batch normalization is crucial in spiking neural network training, but in the small-batch scenarios of episode training, the statistical estimates of batch normalization are inaccurate, resulting in training instability. Existing work has failed to provide an efficient implementation scheme and batch normalization stabilization technique for episode training of spiking neural networks.
[0013] V. Limited Category Expansion Capability. Traditional object detectors maintain independent classifier weights for each category. When encountering a new category, the output dimension must be expanded and retrained, which is time-consuming. In small-sample scenarios, due to the extremely limited number of samples in the new category, fine-tuning is prone to overfitting. Existing spiking neural network detectors lack a detection head architecture that supports dynamic category expansion. Summary of the Invention
[0014] In view of this, it is necessary to provide a spiking neural network few-sample target detection system, which can realize efficient target detection of spiking neural networks in few-sample scenarios, and provide a technical solution for rapid category expansion applications on edge devices and neuromorphic chips.
[0015] This invention provides a spiking neural network-based few-sample target detection system, comprising a spiking prototype construction module, a prototype-guided feature reweighting module, a prototype matching detection head, and an Episode meta-training controller, wherein: The pulse prototype construction module is used to extract class prototype representations from the pulse features of the support set samples, adaptively learn the contribution weights of each time step to prototype construction through a temporal attention network, perform temporal weighted aggregation, and obtain class prototype vectors that fuse temporal information; and introduces prototype contrast loss to optimize the discriminativeness of the prototypes. The prototype-guided feature reweighting module is used to introduce a prototype-guided signal during the feature extraction process of the query image and dynamically modulate the query pulse features; it maps the category prototype to a spatial guide tensor, performs multi-prototype fusion by calculating the similarity between the query features and the prototype, and uses a gating mechanism to realize feature reweighting in the pulse domain, so that the query features move closer to the prototype of the correct category. The prototype matching detection head includes a bounding box regression branch and a prototype matching classification branch; the prototype matching classification branch makes a classification decision by calculating the metric distance between the candidate region features and the category prototype, and outputs the category probability after temperature scaling and Softmax normalization. The Episode meta-training controller is used for sampling and training control of the Episode task. It adopts support set feature cache reuse to reduce computational overhead, introduces task adaptive batch normalization to maintain independent batch normalization statistics for each Episode to ensure training stability, and combines gradient accumulation and dynamic N-way K-shot strategy to optimize the training process.
[0016] The pulse prototype construction module includes: Extract support set pulse features; Calculate the temporal average and temporal attention weight; Time-weighted aggregation generates prototypes; Prototype regularization and stabilization.
[0017] The support set contains N categories and K samples in each category; the support set image is input into the pulse feature extraction backbone network to obtain a pulse feature map sequence.
[0018] The prototype-guided feature reweighting module includes: Generate prototype guidance signals; Calculate the similarity between the query features and the prototype; Multi-prototype fusion is performed to obtain the integrated guidance signal; Perform pulse-domain gated modulation; Perform residual connection.
[0019] The bounding box regression branch is responsible for predicting the target location and size.
[0020] The prototype matching detection head includes: Perform candidate region feature extraction; Perform prototype matching and distance calculation; Perform category probability calculations and classification decisions; Support for variable number of categories.
[0021] The Epiisode meta-training controller includes: Perform Episode task construction: Enable feature cache reuse for support sets; Task adaptive batch normalization; Perform gradient accumulation; Design the loss function.
[0022] The total loss function consists of three parts: bounding box localization loss, prototype matching classification loss, and prototype comparison loss.
[0023] The beneficial effects of this application include: I. Compared to prototype artificial neural networks, small sample detection: Advantage 1: Fully utilizes pulse temporal information to enhance prototype discriminativity. Artificial neural network prototype networks construct prototypes in continuous-value feature spaces through simple arithmetic averaging, without considering temporal information. This invention adaptively learns the contribution weights of different time steps through a temporal attention network, constructing a prototype that integrates temporal information. This adaptively emphasizes time steps with strong discriminativity and suppresses time steps with high noise, thereby obtaining a more discriminative prototype representation in small-sample scenarios.
[0024] Advantage Two: Maintaining the energy efficiency advantage of pulse-driven computation. Feature reweighting in artificial neural networks is achieved through continuous value multiplication, which consumes a lot of computational energy. The prototype-guided feature reweighting module of this invention achieves feature reweighting in the pulse domain through a gating modulation mechanism, maintaining the pulse-driven computation mode. On neuromorphic hardware, gating operations can be implemented through gated synapses, which has lower energy consumption compared to continuous value multiplication. The entire network forward propagation maintains a pulse event-driven mode, enabling asynchronous computation on neuromorphic chips, further reducing energy consumption.
[0025] Advantage 3: Supports rapid category expansion. Artificial neural network detectors require retraining or lengthy fine-tuning when adding new categories. The prototype matching detection head of this invention supports a variable number of categories. When adding a new category, only a small number of support samples are needed to calculate the new prototype and load it into the detection head for immediate detection, achieving rapid category expansion with a short expansion time (requiring only one forward propagation of the support set).
[0026] II. Compared to small sample learning in spiking neural networks for image classification Advantage 1: Extension from classification to detection tasks. Existing few-shot learning methods for spiking neural networks primarily focus on image classification. This invention is the first to systematically apply a prototype learning mechanism to object detection using spiking neural networks. Object detection is far more complex than image classification (requiring simultaneous localization and classification, processing multi-scale features, and generating candidate regions). This invention successfully extends few-shot learning capabilities from classification to detection through the collaborative design of prototype-guided feature enhancement and prototype-matching detection heads.
[0027] Advantage Two: A More Complete Technical Solution. This invention provides a complete few-shot target detection technical solution, including four closely coordinated modules: prototype construction, feature enhancement, detection head design, and training strategy. Compared to existing spiking neural network few-shot learning methods that only focus on a single aspect such as feature extraction or classifier design, the technical solution of this invention is more complete and systematic.
[0028] III. Compared to spiking neural network object detectors without small-sample optimization Advantage 1: Improved performance in small sample scenarios. Traditional spiking neural network object detectors rely on large-scale data training, resulting in severe performance degradation in small sample scenarios. This invention, by introducing prototype learning and meta-learning mechanisms, maintains good detection performance in small sample scenarios, solving the overfitting problem of existing technologies.
[0029] Advantage 2: Rapid adaptability to new categories. Traditional detectors require retraining or lengthy fine-tuning when encountering new categories. This invention supports rapid category expansion, enabling immediate detection with only a small number of new category samples, demonstrating strong adaptability.
[0030] IV. Overall Advantages: The technical solution of this invention effectively integrates classic few-shot learning techniques such as prototype learning, feature reweighting, metric learning, and meta-learning into the spiking neural network object detection framework. While maintaining the energy efficiency advantage of spiking neural networks, it achieves effective object detection in few-shot scenarios, providing a feasible technical path for rapid category expansion applications on edge devices and neuromorphic chips. Attached Figure Description
[0031] Figure 1This is a schematic diagram of the overall architecture of the spiking neural network small sample target detection system according to an embodiment of the present invention; Figure 2 This is a hardware architecture diagram of the spiking neural network small sample target detection system of the present invention; Figure 3 This is a schematic diagram illustrating the working principle of the feature reweighting module guided by the prototype in an embodiment of the present invention. Figure 4 This is a schematic diagram of pulse prototype construction and prototype matching detection in an embodiment of the present invention. Detailed Implementation
[0032] The network architecture of this invention is based on existing spiking neural network object detectors, and introduces prototype learning and feature guidance mechanisms required for few-shot learning. (Please refer to the network architecture of this invention.) Figure 1 This mainly includes: Pulse Feature Extraction Backbone Network: Employing a mature pulse convolutional neural network architecture, it includes multi-stage pulse convolutional blocks and downsampling layers, outputting multi-scale pulse feature maps. The backbone network utilizes existing techniques (such as LIF neurons, pulse convolution, etc.).
[0033] Neck network: A pulsed version of the feature pyramid network is used to achieve multi-scale feature fusion, employing existing techniques.
[0034] Pulse Prototype Building Module: Extracts category prototypes from pulse features of the support set.
[0035] Prototype-guided feature reweighting module: Introduces prototype guidance in query feature extraction.
[0036] Prototype Matching Detection Head: Includes bounding box regression and prototype matching classification.
[0037] Episode Meta-Training Controller: Responsible for Episode training control and optimization.
[0038] The innovative aspects of this invention will be described in detail below. Please refer to the relevant documentation. Figure 2 The diagram shown is a hardware architecture diagram of the spiking neural network few-sample target detection system 10 of the present invention. The system includes: a spiking prototype construction module, a prototype-guided feature reweighting module, a prototype matching detection head, and an Episode meta-training controller.
[0039] The pulse prototype construction module is used to extract class prototype representations from the pulse features of the support set samples. This module adaptively learns the contribution weights of each time step to prototype construction through a temporal attention network, performs temporal weighted aggregation, and obtains a class prototype vector incorporating temporal information. A prototype contrastive loss is introduced to optimize the discriminative power of the prototypes. Specifically: First, the pulse prototype construction module extracts pulse features from the support set. For the N-way K-shot task, the support set contains N classes and K samples per class. The support set image is input to the pulse feature extraction backbone network to obtain a sequence of pulse feature maps (time step T, usually T=4). The output of a specific layer of the backbone network (such as the last convolutional stage) is selected as the input for prototype construction. For each support sample, based on its ground truth bounding box position, the RoI Align operation is used to extract pulse features of a fixed-size (e.g., 7×7) target region, and then spatial global average pooling is used to obtain the pulse feature vector sequence of that sample. Let the feature vector of the kth sample of the nth class at time step t be denoted as . The dimension is C (number of feature channels).
[0040] Next, the pulse prototype construction module calculates the temporal average and temporal attention weights. For each time step, the average of the K support samples of the same class is calculated to obtain the average pulse feature vector of that class at each time step: the summation over k=1 to K is then divided by K to obtain... Then, a temporal attention network is introduced to calculate the contribution weights at each time step. The temporal attention network consists of two fully connected layers: the first layer compresses the input feature dimension using ReLU activation; the second layer outputs a T-dimensional vector, with Softmax activation for normalization. The input to the temporal attention network is the vector obtained by concatenating the average features from all time steps, i.e. to Concatenate along the feature dimensions. The output is a temporal weight vector. ,in Let represent the weights at time step t, satisfying that the sum of all weights is 1 and each weight is non-negative.
[0041] Then, temporal weighted aggregation is used to generate prototypes. The average features at each time step are weighted and summed using temporal weights to obtain the prototype vector of the nth class. : Equals the summation over t=1 to T Multiply The resulting prototype vectors incorporate information from all time steps and adaptively emphasize highly discriminative time steps through a temporal attention mechanism. Repeating this process for N categories yields N prototype vectors.
[0042] Finally, prototype regularization and stabilization are performed. To enhance prototype discriminativeness, a prototype contrastive loss is introduced during training. This loss encourages that support sample features of the same class have small distances to prototypes of that class (intra-class compactness) and that prototypes of different classes have large distances to each other (inter-class separability). The prototype contrastive loss is calculated as follows: for each support sample feature, calculate its distance to the prototype of its class. And the distance to the most recent outcast prototype The loss is The margin is a boundary value hyperparameter (e.g., 0.5). This loss is jointly optimized with the main detection loss. To improve prototype stability, L2 normalization is performed on the support sample features before prototype computation; during training, a moving average of the prototype (exponential moving average, momentum coefficient, e.g., 0.9) is maintained.
[0043] The technical effects include: temporal weighted aggregation enables the prototype to adaptively utilize information from different time steps, improving the discriminativeness of the prototype compared to simple temporal averaging; prototype contrastive loss ensures that the prototype forms a clear clustering structure in the feature space; and stabilization techniques reduce the variance of the prototype in small sample scenarios.
[0044] The prototype-guided feature reweighting module introduces a prototype-guided signal during the feature extraction process of the query image, dynamically modulating the query pulse features. It maps the category prototype to a spatial guiding tensor, performs multi-prototype fusion by calculating the similarity between the query features and the prototype, and utilizes a gating mechanism to reweight features in the pulse domain, causing the query features to move closer to the prototype of the correct category. Please refer to [link to relevant documentation]. Figure 3 Specifically, it includes: First, the prototype-guided feature reweighting module generates a prototype guiding signal. This module is inserted into the middle to later layers of the pulse feature extraction backbone network, taking as input the pulse feature map of the query image (size T×B×C×H'×W', where B is the batch size) and N class prototype vectors (each with dimension C). First, each prototype vector is mapped to the same channel dimension C as the query feature map through a linear transformation layer (fully connected layer or 1×1 convolutional layer). Then, through spatial broadcasting, the prototype vectors are expanded into guiding tensors (size C×H'×W') with the same spatial dimensions as the query feature map. Thus, N prototypes generate N guiding tensors. to .
[0045] Next, the prototype-guided feature reweighting module calculates the similarity between the query feature and the prototype. For each spatial location (x, y) of the query feature map, the impulse feature sequence of that location at all time steps is extracted, and the aggregated feature vector of that location is obtained by time-step weighted averaging (the weights can be learned or uniform weights can be used). Calculate the eigenvector and N prototypes. to The similarity is calculated using cosine similarity or inner product: equal and Divide the inner product of the two values by the product of their norms (cosine similarity). This yields the similarity score of that position across N categories.
[0046] Subsequently, the prototype-guided feature reweighting module performs multi-prototype fusion. The similarity scores are normalized to weight coefficients using the Softmax function. The sum of all weights is 1. Using these weights, the guiding tensors of the N prototypes are weighted and fused to obtain the comprehensive guiding signal at that location: Equivalent to summing over n=1 to N Multiply This adaptive fusion mechanism allows different regions of the query image to be guided by different class prototypes.
[0047] Then: the prototype-guided feature reweighting module performs pulse-domain gated modulation. The synthesized guiding signal... The gating coefficients are normalized to the [0,1] interval using the Sigmoid activation function. At time step t, the continuous value of the query impulse feature is obtained by integrating the membrane potential of the LIF neuron. The continuous value is obtained by multiplying it element-by-element with the gate coefficient. : equal Multiply The modulated continuous value is converted back into a pulse form through threshold comparison and pulse firing mechanism of LIF neurons. This "pulse integration-gated modulation-pulse firing" process corresponds to the gated synaptic operation of neuromorphic chips in hardware, which conforms to the pulse-driven computing mode.
[0048] Finally, the prototype-guided feature reweighting module employs residual connections. To avoid over-modulation leading to the loss of original feature information, residual connections are introduced between the input and output of the prototype-guided feature reweighting module. The modulated pulse features are added to the original pulse features (a learnable fusion coefficient λ can be introduced to control the modulation intensity) and then output. Residual connections ensure stability in the early stages of training; λ takes a small value (e.g., 0.1) in the early stages and gradually increases in the later stages.
[0049] The technical benefits include: multi-prototype fusion enables the network to adaptively process query images containing multiple targets; gated modulation achieves feature reweighting in the pulse domain while maintaining energy efficiency; and residual connections ensure training stability and the preservation of feature information.
[0050] The prototype matching detection head includes a bounding box regression branch and a prototype matching classification branch. The prototype matching classification branch makes a classification decision by calculating the metric distance (Euclidean distance or cosine similarity) between candidate region features and the prototype class, and outputs the class probability after temperature scaling and Softmax normalization. This design supports dynamic detection with a variable number of classes without needing to maintain independent parameters for each class. See also... Figure 4 Specifically: The prototype matching detection head has a dual-branch structure. It includes a bounding box regression branch and a prototype matching classification branch. The bounding box regression branch uses existing techniques (such as bounding box representation based on distributed focal loss (DFL)) to predict the target location and size, and is not considered an innovation of this invention. The prototype matching classification branch is the innovative part of this invention.
[0051] First, the prototype matching detection head extracts candidate region features. For each candidate target region in the query image (obtained via RoI Align or anchor-free method), the feature vector of that region is extracted from the enhanced query feature map. The extraction method is as follows: global average pooling is performed on the impulse features within the region in the spatial dimension, and a weighted average is performed in the temporal dimension (the weights can be learned or uniform weights are used) to obtain a feature vector of fixed dimensions. The dimension is C.
[0052] Subsequently, the prototype matching detection head performs prototype matching and distance calculation. Candidate region features are then calculated. With N category prototypes to The distance is measured using either Euclidean distance or cosine similarity. equal and The square of the L2 norm of the difference; the cosine similarity is equal and The inner product is divided by the product of the norms of the two. If Euclidean distance is used, the distance is converted into a similarity score: equal Where τ is the temperature parameter (a learnable parameter, initialized to 1.0). If cosine similarity is used, it can be directly used. As a score.
[0053] Then: the prototype matching detection head performs category probability calculation and classification decision. The similarity score is normalized using the Softmax function to obtain the probability distribution of the candidate region belonging to each category: equal Divide by summing over all categories The category with the highest probability is selected as the predicted category. The temperature parameter τ controls the sharpness of the probability distribution and is automatically optimized during training.
[0054] Finally, the prototype matching detection head supports a variable number of categories. Since classification is based on prototype matching rather than fixed-dimensional classifier weights, the detection head naturally supports a variable number of categories. During the inference phase, only the prototypes of the categories to be detected need to be loaded into the matching module for distance calculation; the number of categories can change dynamically without modifying the network structure. When adding a new category, K supporting samples for that category are provided, and the new prototype is calculated through the pulse prototype building module. The prototype vector is then loaded into the prototype list of the detection head for immediate detection, achieving rapid category expansion.
[0055] The technical benefits include: the metric-based classification mechanism has stronger generalization ability in small sample scenarios; temperature scaling improves the accuracy of classification probabilities; and the variable number of categories design supports dynamic detection and rapid category expansion, without requiring retraining of the network to add new categories.
[0056] The Episode meta-training controller is used for sampling and training control of the Episode task. It employs support set feature cache reuse to reduce computational overhead, introduces task-adaptive batch normalization (TaskNorm) to maintain independent batch normalization statistics for each Episode to ensure training stability, and combines gradient accumulation and dynamic N-way K-shot strategies to optimize the training process. Specifically: First, the Episode meta-training controller constructs the Episode task. During the training phase, N classes (N is typically 5 or 10) are randomly sampled from the training dataset containing a large number of basic classes in each training iteration. For each class, K samples are randomly selected as the support set (K is typically 1, 3, 5, or 10), and Q samples are selected as the query set (Q is typically 5-15). An Episode consists of two parts: a support set and a query set. The support set is used to build the prototype, and the query set is used for detection evaluation and gradient calculation. A dynamic N-way K-shot strategy is adopted: a larger K value (e.g., K=10) and a smaller N value (e.g., N=5) are used in the early stages of training. As training progresses, the K value is gradually decreased and the N value is increased, allowing the model to gradually adapt to more difficult small-sample tasks.
[0057] Subsequently, the Episode meta-training controller performs support set feature cache reuse. Within an Episode, support set samples are used to build a prototype, a process requiring only one forward propagation. The computed support set impulse features and prototype vectors are cached in GPU memory. The prototype vectors are reused when processing multiple samples in the query set, eliminating the need to repeatedly compute the support set forward propagation. This is achieved by keeping the support set feature tensor resident in GPU memory and accessing it via variable references during query set processing. This technique reduces computational overhead, particularly when K is large or the number of query set samples is large.
[0058] Next: Task-Adaptive Batch Normalization (TaskNorm). Batch normalization is crucial for stability in spiking neural network training. In mini-batch scenarios during episode training, independent batch normalization statistics are maintained for each episode task. Specifically, during forward propagation, batch statistics (mean and variance) are calculated using samples from the support and query sets of the current episode, rather than global statistics across episodes; the same statistics are used to calculate gradients during backpropagation. This task-adaptive batch normalization allows the network to quickly adapt to the data distribution of the current episode, avoiding training fluctuations caused by differences in statistics between different episodes. During inference, the global running statistics accumulated during training (maintained through exponential moving average, with a momentum coefficient such as 0.9) are used to ensure that the inference results are not affected by changes in batch size.
[0059] Then: Gradient accumulation. To process more episode samples with limited GPU memory, gradient accumulation is used: a large episode is split into multiple mini-batches, each performing forward propagation and gradient calculation separately. The gradients are accumulated before a weight update. This is implemented by accumulating gradients over multiple forward-backward propagation cycles. Once a set number of steps are reached, the optimizer is called to update the weights and the gradient accumulator is cleared. This is equivalent to large-batch training but with significantly reduced GPU memory usage.
[0060] Finally: Loss function design. The total loss function consists of three parts: bounding box localization loss (including CIoU loss and DFL loss, using existing techniques), prototype matching classification loss (based on cross-entropy), and prototype contrast loss (as described in the pulse prototype building module). The loss function is as follows: equal Multiply Plus Multiply Plus Multiply ,in , and Weighting coefficients (usually taken as...) =7.5、 =0.5、 =1.0 (adjusted according to the task). A cosine annealing learning rate scheduling strategy is adopted, with the initial learning rate set to 0.001 and gradually reduced during training.
[0061] The technical benefits include: supporting feature cache reuse to reduce computational overhead; task-adaptive batch normalization to solve the training instability problem in small-batch scenarios; gradient accumulation to reduce GPU memory usage; and dynamic N-way K-shot strategy to enable the model to gradually adapt to difficult tasks. The combination of these technologies improves the efficiency and stability of Episode training for spiking neural networks.
[0062] Other embodiments of the present invention: In the pulse prototype construction module: in addition to the temporal attention network, a learnable weighted pooling method can be adopted, which assigns independent weight parameters to each time step and each feature channel. This method maintains a weight matrix (of size T×C) and weights each feature channel at each time step during prototype aggregation. The weights are learned through training. Multiple sub-prototypes are learned for each category to capture intra-class diversity. Specifically: the support set sample features are clustered (e.g., K-means, K=2-5), with the center of each cluster serving as a sub-prototype; best-of-K matching is used for prototype matching, i.e., the distance between the query feature and all sub-prototypes of that class is calculated, and the minimum distance is selected as the matching score for that class; the support set samples are modeled as a graph structure, with nodes representing sample features and edge weights determined based on the similarity between samples. Information is propagated between samples and aggregated into prototypes through the message passing mechanism of the graph neural network.
[0063] In the prototype-guided feature reweighting module: besides multiplication gating, additive residuals can also be used to implement prototype guidance; specifically, the prototype guidance signal is directly added to the query feature after linear transformation, instead of multiplying through gating coefficients. The implementation formula is: equal Adding λ multiplied by a linear transformation (prototype guidance signal), where λ is a learnable fusion coefficient; prototype guidance can be performed simultaneously at multiple layers of the network. Specifically, prototype guidance modules are inserted into the early, mid, and late layers of the backbone network, using the same prototype but modulating features at different layers. Early layers enhance the discriminative power of low-level features, while late layers adjust high-level semantic representations.
[0064] In the prototype matching detection head: a learnable neural network module replaces the fixed distance metric function. Specifically, the query features and prototype are concatenated and input into a small neural network (such as two fully connected layers), which outputs a similarity score. The parameters of this network are learned through training, enabling it to learn more complex similarity assessments. For features that retain the complete pulse sequence (without aggregating the time dimension), a time-aligned distance metric can be used. Specifically, Dynamic Time Warping (DTW) or cross-correlation is used to calculate the similarity between two pulse sequences, taking into account the temporal pattern of pulse firing.
[0065] In addition to rate coding (direct coding), time-series coding or Time-to-First-Spike (TTFS) coding can also be used. Specifically, image pixel values are mapped to pulse firing times, with larger pixel values corresponding to earlier pulse firing times.
[0066] This invention provides a time-aware prototype construction in the pulse domain. By temporally aligning and weighting the pulse sequences of support set samples, a category prototype representation integrating both rate and temporal information is constructed. A prototype-guided feature reweighting module is designed to achieve dynamic modulation of query features by the support set while maintaining pulse-driven computation. A detection head architecture based on prototype matching is constructed, and classification is performed through metric learning to achieve dynamic detection with a variable number of categories and rapid category expansion. An Episode training strategy for spiking neural network optimization is proposed, including support set feature cache reuse and task-adaptive batch normalization techniques to reduce training computational overhead and ensure convergence stability. A complete technical solution for small-sample target detection using spiking neural networks is implemented, improving small-sample detection capabilities while maintaining low energy consumption.
[0067] Although the present invention has been described with reference to the present preferred embodiments, those skilled in the art should understand that the above preferred embodiments are only used to illustrate the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A spiking neural network-based small-sample target detection system, characterized in that, The system includes a pulse prototype construction module, a prototype-guided feature reweighting module, a prototype matching detection head, and an Episode meta-training controller, wherein: The pulse prototype construction module is used to extract class prototype representations from the pulse features of the support set samples, adaptively learn the contribution weights of each time step to prototype construction through a temporal attention network, perform temporal weighted aggregation, and obtain class prototype vectors that fuse temporal information; and introduces prototype contrast loss to optimize the discriminativeness of the prototypes. The prototype-guided feature reweighting module is used to introduce a prototype-guided signal during the feature extraction process of the query image and dynamically modulate the query pulse features; it maps the category prototype to a spatial guide tensor, performs multi-prototype fusion by calculating the similarity between the query features and the prototype, and uses a gating mechanism to realize feature reweighting in the pulse domain, so that the query features move closer to the prototype of the correct category. The prototype matching detection head includes a bounding box regression branch and a prototype matching classification branch; the prototype matching classification branch makes a classification decision by calculating the metric distance between the candidate region features and the category prototype, and outputs the category probability after temperature scaling and Softmax normalization. The Episode meta-training controller is used for sampling and training control of the Episode task. It adopts support set feature cache reuse to reduce computational overhead, introduces task adaptive batch normalization to maintain independent batch normalization statistics for each Episode to ensure training stability, and combines gradient accumulation and dynamic N-way K-shot strategy to optimize the training process.
2. The system as described in claim 1, characterized in that, The pulse prototype construction module includes: Extract support set pulse features; Calculate the temporal average and temporal attention weight; Time-weighted aggregation generates prototypes; Prototype regularization and stabilization.
3. The system as described in claim 2, characterized in that, The support set contains N categories and K samples in each category; the support set image is input into the pulse feature extraction backbone network to obtain a pulse feature map sequence.
4. The system as described in claim 3, characterized in that, The prototype-guided feature reweighting module includes: Generate prototype guidance signals; Calculate the similarity between the query features and the prototype; Multi-prototype fusion is performed to obtain the integrated guidance signal; Perform pulse-domain gated modulation; Perform residual connection.
5. The system as described in claim 4, characterized in that, The bounding box regression branch is responsible for predicting the target location and size.
6. The system as described in claim 5, characterized in that, The prototype matching detection head includes: Perform candidate region feature extraction; Perform prototype matching and distance calculation; Perform category probability calculations and classification decisions; Support for variable number of categories.
7. The system as described in claim 6, characterized in that, The Epiisode meta-training controller includes: Perform Episode task construction: Enable feature cache reuse for support sets; Task adaptive batch normalization; Perform gradient accumulation; Design the loss function.
8. The system as described in claim 7, characterized in that, The total loss function consists of three parts: bounding box localization loss, prototype matching classification loss, and prototype comparison loss.