A hash retrieval method based on spiking neural networks and soft similarity loss
By using a hash retrieval method based on spiking neural networks and soft similarity loss, the problems of information loss and category similarity differences in spiking neural networks when processing DVS data are solved, achieving efficient and low-energy multi-class data retrieval and improving retrieval accuracy and efficiency.
Patent Information
- Application Number
- CN202510040306.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2045-01-10
AI Technical Summary
Existing spiking neural networks suffer from information loss and underutilization of membrane potential features when processing DVS data retrieval tasks. Furthermore, traditional deep hashing methods ignore potential similarity differences between categories, resulting in low retrieval efficiency.
A hash retrieval method based on spiking neural networks and soft similarity loss is adopted. By constructing a Transformer feature extraction method and combining it with a hash layer, a hash layer is constructed using spiking neurons. The hash network is optimized by combining dynamic soft loss and using membrane potential features to construct a learnable soft similarity matrix to optimize the hash code generation process.
It enables efficient retrieval of multiple data formats, reduces computational load and energy consumption, improves retrieval accuracy and efficiency, compensates for information loss, and captures more complex relationships between categories.
Smart Images

Figure BDA0005236733940000081 
Figure BDA0005236733940000082 
Figure BDA0005236733940000091
Abstract
Description
Technical Field
[0001] This invention relates to a hash retrieval method, and more particularly to a hash retrieval method based on spiking neural networks and soft similarity loss. Background Technology
[0002] In recent years, with the development of dynamic vision sensor (DVS) technology, DVS data, by converting the brightness changes of each pixel into an event stream, has achieved microsecond-level temporal resolution and efficient capture of fast-moving scenes, becoming an important research object in the field of computer vision. However, with the rapid growth of DVS data, retrieval networks based on traditional artificial neural networks face severe challenges in terms of computational cost and energy consumption when processing this massive amount of data, limiting its practical applications.
[0003] As a third-generation neural network, spiking neural networks (SNNs) use binary pulses to transmit information, demonstrating lower energy consumption and higher computational efficiency, making them an effective solution for processing DVS data. However, there are some key problems when applying SNNs to retrieval tasks: (1) When spiking neurons in SNNs convert floating-point membrane potentials into binary pulses, information loss occurs, thus limiting the performance of SNNs; therefore, although membrane potentials contain richer feature information, previous SNN methods have not fully utilized them; (2) Deep hashing is an important technique for large-scale data retrieval, with high efficiency in retrieval speed and storage. Although large-scale DVS data urgently requires efficient retrieval networks, hashing methods have not yet been proposed for SNNs; traditional deep hashing methods usually generate a binary similarity matrix using category labels as the target to construct similarity loss. If samples belong to the same category, the value in the binary similarity matrix is 1, otherwise it is 0. However, this predefined binary similarity matrix ignores the potential similarity differences between categories.
[0004] These key issues limit the performance of current spiking neural networks in DVS data retrieval tasks, and new solutions are urgently needed to improve their efficiency and performance. Summary of the Invention
[0005] The technical problem to be solved by this invention is to provide a hash retrieval method based on spiking neural networks and soft similarity loss that can reduce the computational load and energy consumption of the retrieval network and achieve efficient retrieval of multiple data formats. The hash retrieval model has high retrieval performance.
[0006] The technical solution adopted by this invention to solve the above-mentioned technical problems is: a hash retrieval method based on spiking neural networks and soft similarity loss, comprising the following steps:
[0007] Step 1: Select N data points from the original dataset as training samples, and perform data preprocessing on the training samples to obtain preprocessed training data;
[0008] Step 2: Construct the hash retrieval model to be trained, including a Transformer feature extraction layer based on a spiking neural network, a hash layer based on a spiking neural network, and a classification head. Randomly shuffle N preprocessed training data and input them into the Transformer feature extraction layer based on a spiking neural network to obtain the sample features after feature extraction.
[0009] Step 3: Input the extracted sample features into the hash layer based on the spiking neural network to obtain the membrane potential features of the training samples and the hash code corresponding to the training samples. Then, input the hash code corresponding to the training samples into the classification head, and the classification head outputs the classification result of the training samples.
[0010] Step 4: Calculate the cosine similarity between the membrane potential features of different training samples based on their membrane potential features. Accumulate and normalize the cosine similarity between the membrane potential features of different training samples to obtain the class similarity between different categories of training samples. Then, form a soft similarity matrix from the class similarity between different categories of training samples. Define the loss function of the hash retrieval model to be trained. Obtain the value of the loss function through the soft similarity matrix, the class label of the training samples, the hash code corresponding to the training samples, and the classification result of the training samples. Start the training process by iteratively updating the hash retrieval model to be trained through backpropagation. Bring the hash codes generated by similar training sample pairs closer and pull the hash codes generated by dissimilar training sample pairs further apart until the set maximum number of iterations is reached, and then end the training process to obtain the trained hash retrieval model.
[0011] Step 5: Select M data points from the target dataset as query samples to form a query set. Use the remaining data in the target dataset as retrieval samples to form a retrieval set. Preprocess the query samples to obtain preprocessed query samples. Input the preprocessed query samples into the trained hash retrieval model to obtain the hash codes corresponding to the query samples. Preprocess the retrieval samples to obtain preprocessed retrieval samples. Input the preprocessed retrieval samples into the trained hash retrieval model to obtain the hash codes corresponding to the retrieval samples. Define the set of hash codes corresponding to all retrieval samples as the hash code retrieval library.
[0012] Step 6: Find the hash code with the closest Hamming distance to the hash code corresponding to the query sample in the hash code retrieval library, and take the retrieval sample corresponding to that hash code as the retrieval result to complete the retrieval process of the query sample.
[0013] Compared with existing technologies, the advantages of this invention are as follows: First, it utilizes the binary pulse characteristics of spiking neural networks to construct a Transformer feature extraction layer and a hash layer based on spiking neural networks. This is not only applicable to static images but also efficiently processes DVS data, reducing the computational load and energy consumption of the retrieval network and achieving efficient retrieval of multiple data formats. After the sample features are extracted by the Transformer feature extraction layer based on spiking neural networks, unlike traditional deep hashing methods that use sign functions to construct quantization layers, this invention uses spiking neurons to construct hash layers. Combining the pulse features and the binary characteristics of hash codes, no additional quantization module is needed. The final hash code is obtained by making decisions at multiple time steps. When optimizing the hash retrieval network, a dynamic soft similarity loss is introduced. A learnable soft similarity matrix is constructed through the membrane potential features in spiking neurons. It is continuously updated during training to capture more complex relationships between categories, allowing effective information to be retained in feature learning at different training rounds. Compared with traditional hard similarity loss, this dynamic soft similarity loss can more accurately reflect the similarity differences between categories, compensating for the information loss caused by spiking neural networks. By jointly optimizing the dynamic soft similarity loss and classification loss, the retrieval performance of the model is improved.
[0014] Specifically, in step 1, when the original dataset is the Dynamic Vision Sensor DVS dataset, the specific process of preprocessing the training samples is as follows: the files of the Dynamic Vision Sensor DVS dataset are integrated according to the time window to obtain 8 video data, and the preprocessed training data includes video data of 8 time steps.
[0015] When the original dataset is a static image dataset, the specific process of preprocessing the training samples is as follows: copy a single image from the static image dataset four times and arrange the copied images in order to form a sequence of four time steps, which are then used as the preprocessed training data.
[0016] Specifically, the process of step 3 is as follows:
[0017] Step 3-1: The hash layer based on the spiking neural network includes a pooling layer, a linear layer, spiking neurons, and a hash transformation layer. The extracted sample features are input into the pooling layer, and the pooling layer applies global average pooling to obtain a pooled feature vector f with dimensions of 8×512×1.
[0018] Step 3-2: Input f into the linear layer, and after mapping by the linear layer, obtain floating-point feature x with the same hash code length L as the preset. The dimension of x is 8×L, where 8 is the time step length. Then input x into the spiking neuron to obtain binary features b of multiple time steps and membrane potential features m of the training samples.
[0019] Step 3-3: Input b into the hash transformation layer. The hash transformation layer performs AND operations on b at multiple time steps to obtain the binary hash code h, where h = And(SN((W T f+o))), where W represents the weight matrix of the linear layer, W T Let W represent the transpose of W, and o represent the bias of the linear layer. T f+o=x, SN(…) represents a spiking neuron, and And(…) represents the AND operation performed by the hash transformation layer;
[0020] Steps 3-4: Input h into the classification head, and the classification head outputs the classification result p.
[0021] Specifically, the process of step 4 is as follows:
[0022] Step 4-1: Define the loss function L for the hash retrieval model to be trained, L = α·L s +β·L cls , where L cls For classifying losses, C represents the total number of classes in the training samples input in the current training round, t represents the class index, 1≤t≤C, and y t The class label represents the training sample. If the training sample belongs to class t, then y t =1, otherwise y t =0, p t This represents the probability that a training sample belongs to class t in the classification results output by the classification head;
[0023] L s For soft similarity loss, Where e is the natural constant, h p h represents the hash code corresponding to the p-th training sample. q This represents the hash code corresponding to the q-th training sample. for h p The transpose of; in the first training round, t is obtained from the class labels of the training samples. p t represents the class index of the p-th training sample. q This represents the class index of the q-th training sample. If the p-th and q-th training samples belong to the same class, then... If they belong to different categories, then In the first training round, the soft similarity matrix is obtained and denoted as S. soft , S soft The initial state at the start of training is a matrix of all zeros, where s ij ′ It is located in S softAn element in the i-th row and j-th column represents the category similarity between the i-th and j-th categories, s ij ′ The acquisition process is as follows: Calculate the cosine similarity between the membrane potential features of each training sample belonging to the i-th category and the membrane potential features of each training sample belonging to the j-th category in the current training round. Then, sum the cosine similarities between the membrane potential features of all training samples belonging to the i-th and j-th categories. Finally, normalize the summed cosine similarities based on the number of training samples in the current training round to obtain s. ij ′ And at the end of the current training round, Updated to s obtained in the current training round ij ′ And as the next training round in the current training round. α and β are used to balance L s and L cls Parameters;
[0024] Step 4-2: Set the maximum number of training rounds. Based on the loss function K, use the AdamW optimization algorithm to iteratively update the hash retrieval model to be trained until the maximum number of training rounds is reached. Then, stop the iterative update process and obtain the trained hash retrieval model.
[0025] By using classification loss as a constraint, the trained hash retrieval model can effectively optimize the inter-class distance of hash codes, generating more discriminative hash codes for samples of different classes. By using soft similarity loss as a constraint, the trained hash retrieval model can make full use of the similarity differences between different classes, bringing the hash codes generated by similar sample pairs closer together and distancing the hash codes generated by dissimilar sample pairs further apart.
[0026] Specifically, in step 4-1, α = 0.001 and β = 1.
[0027] Specifically, in step 4-2, when the original dataset uses the CIFAR10 dataset, the maximum number of training epochs is set to 400; when the original dataset uses the UCF101-DVS dataset or the HMDB51-DVS dataset, the maximum number of training epochs is set to 200. Detailed Implementation
[0028] The present invention will now be described in further detail.
[0029] A hash retrieval method based on spiking neural networks and soft similarity loss includes the following steps:
[0030] Step 1: Select N data points from the original dataset as training samples, and perform data preprocessing on the training samples to obtain preprocessed training data. When the original dataset is the Dynamic Vision Sensor DVS dataset, the specific process of preprocessing the training samples is as follows: Integrate the files of the Dynamic Vision Sensor DVS dataset according to the time window to obtain 8 video data points. Then the preprocessed training data includes video data from 8 time steps.
[0031] When the original dataset is a static image dataset, the specific process of preprocessing the training samples is as follows: copy a single image from the static image dataset four times and arrange the copied images in order to form a sequence of four time steps, which are then used as the preprocessed training data.
[0032] Step 2: Construct the hash retrieval model to be trained, including a Transformer feature extraction layer based on a spiking neural network, a hash layer based on a spiking neural network, and a classification head. Randomly shuffle N preprocessed training data and input them into the Transformer feature extraction layer based on a spiking neural network to obtain the sample features after feature extraction.
[0033] Step 3: Input the extracted sample features into the hash layer based on a spiking neural network to obtain the membrane potential features of the training samples and the corresponding hash codes. Then, input the hash codes of the training samples into the classification head, which outputs the classification results of the training samples. The specific process is as follows:
[0034] Step 3-1: The hash layer based on the spiking neural network includes a pooling layer, a linear layer, spiking neurons, and a hash transformation layer. The extracted sample features are input into the pooling layer, and the pooling layer applies global average pooling to obtain a pooled feature vector f with dimensions of 8×512×1.
[0035] Step 3-2: Input f into the linear layer. After mapping by the linear layer, obtain floating-point feature x with the same hash code length L as the preset. The dimension of x is 8×L, where 8 is the time step length. Then input x into the spiking neuron to obtain binary features b of multiple time steps and membrane potential features m of the training samples.
[0036] Step 3-3: Input b into the hash transformation layer. The hash transformation layer performs AND operations on b at multiple time steps to obtain the binary hash code h, where h = And(SN((W T f+o))), where W represents the weight matrix of the linear layer, W T Let W represent the transpose of W, and o represent the bias of the linear layer. T f+o=x, SN(…) represents a spiking neuron, and And(…) represents the AND operation performed by the hash transformation layer.
[0037] Steps 3-4: Input h into the classification head, and the classification head outputs the classification result p.
[0038] After the sample features are extracted by the Transformer feature extraction layer based on spiking neural networks, a hash layer is constructed using spiking neurons. Combining the spiking features and the binary properties of the hash code, decisions are made at multiple time steps to obtain the final hash code.
[0039] Step 4: Calculate the cosine similarity between the membrane potential features of different training samples. Accumulate and normalize these cosine similarities to obtain the class similarity between different categories of training samples. Then, construct a soft similarity matrix from these class similarities. Define the loss function for the hash retrieval model to be trained. Obtain the value of the loss function using the soft similarity matrix, the class labels of the training samples, the hash codes corresponding to the training samples, and the classification results of the training samples. Iteratively update the hash retrieval model through backpropagation to begin the training process. Bring the hash codes generated from similar training sample pairs closer together and distance the hash codes generated from dissimilar training sample pairs further apart until the set maximum number of iterations is reached, at which point the training process ends, resulting in the trained hash retrieval model. The specific process is as follows:
[0040] Step 4-1: Define the loss function L for the hash retrieval model to be trained, L = α·L s +β·L cls , where L cls For classifying losses, C represents the total number of classes in the training samples input in the current training round, t represents the class index, 1≤t≤C, and y t The class label represents the training sample. If the training sample belongs to class t, then y t =1, otherwise y t =0, p t This represents the probability that a training sample belongs to class t in the classification results output by the classification head;
[0041] L s For soft similarity loss, Where e is the natural constant, h p h represents the hash code corresponding to the p-th training sample. q This represents the hash code corresponding to the q-th training sample. for h p The transpose of; in the first training round, t is obtained from the class labels of the training samples. p t represents the class index of the p-th training sample. qThis represents the class index of the q-th training sample. If the p-th and q-th training samples belong to the same class, then... If they belong to different categories, then In the first training round, the soft similarity matrix is obtained and denoted as S. soft , S soft The initial state at the start of training is a matrix of all zeros, where s ij ′ It is located in S soft An element in the i-th row and j-th column represents the category similarity between the i-th and j-th categories, s ij ′ The acquisition process is as follows: Calculate the cosine similarity between the membrane potential features of each training sample belonging to the i-th category and the membrane potential features of each training sample belonging to the j-th category in the current training round. Then, sum the cosine similarities between the membrane potential features of all training samples belonging to the i-th and j-th categories. Finally, normalize the summed cosine similarities based on the number of training samples in the current training round to obtain s. ij ′ And at the end of the current training round, Updated to s obtained in the current training round ij ′ And as the next training round in the current training round. α and β are used to balance L s and L cls The parameters are: α = 0.001, β = 1.
[0042] Step 4-2: Set the maximum number of training epochs. Based on the loss function L, use the AdamW optimization algorithm to iteratively update the hash retrieval model to be trained until the set maximum number of training epochs is reached. Then, stop the iterative update process to obtain the trained hash retrieval model. Specifically, when the original dataset is the CIFAR10 dataset, the maximum number of training epochs is set to 400; when the original dataset is the UCF101-DVS dataset or the HMDB51-DVS dataset, the maximum number of training epochs is set to 200.
[0043] By constraining the classification loss, the trained hash retrieval model can effectively optimize the inter-class distance of hash codes, generating more discriminative hash codes for samples of different categories. By constraining the soft similarity loss, the trained hash retrieval model can fully utilize the similarity differences between different categories, bringing the hash codes generated by similar sample pairs closer together and distancing the hash codes of dissimilar sample pairs further apart. When iterating and updating the hash retrieval network to be trained, a dynamic soft similarity loss is introduced. A learnable soft similarity matrix is constructed through the membrane potential features in spiking neurons, and iteratively updated during training to capture more complex relationships between categories, so that effective information can be retained in feature learning in different training rounds.
[0044] Step 5: Select M data points from the target dataset as query samples to form a query set. Use the remaining data in the target dataset as retrieval samples to form a retrieval set. Preprocess the query samples to obtain preprocessed query samples. Input the preprocessed query samples into the trained hash retrieval model to obtain the hash codes corresponding to the query samples. Preprocess the retrieval samples to obtain preprocessed retrieval samples. Input the preprocessed retrieval samples into the trained hash retrieval model to obtain the hash codes corresponding to the retrieval samples. Define the set of hash codes corresponding to all retrieval samples as the hash code retrieval library. When both the original dataset and the target dataset are CIFAR-10, the number of retrieval samples is 50,000, and the number of query samples M = 10,000; when both the original dataset and the target dataset are UCF101-DVS, divide the query set and retrieval set according to the official UCF101 classification; when both the original dataset and the target dataset are HMDB51-DVS, divide the entire dataset into retrieval set and query set in a 7:3 ratio.
[0045] Step 6: Find the hash code with the closest Hamming distance to the hash code corresponding to the query sample in the hash code retrieval library, and take the retrieval sample corresponding to that hash code as the retrieval result to complete the retrieval process of the query sample.
[0046] The effectiveness of the hash retrieval method in this embodiment will be compared through specific comparison examples below, where the hash retrieval method in this embodiment will be abbreviated as this method.
[0047] Table 1 below shows a comparison of mAP@5000 precision for different methods on the CIFAR10 dataset at different bit positions. * indicates that the result of the corresponding row was reproduced by the publicly available code.
[0048] Table 1
[0049]
[0050] As shown in Table 1, this method outperforms other models, achieving the best performance at each bit level, reaching the highest average mAP accuracy of 93.80%, exceeding the accuracy of Spikingformer-CML by 1.33%. While maintaining high accuracy, this method further compresses the number of model parameters to only 6.28M. At the same time, compared with the ANNs models in the first four rows, this method significantly reduces energy consumption.
[0051] Table 2 below shows a comparison of the mAP@30 accuracy of different methods on the UCF101-DVS dataset under different bit conditions. * indicates that the result in the corresponding row was reproduced using publicly available code.
[0052] Table 2
[0053]
[0054] As shown in Table 2, our method outperforms current models across all bit positions, achieving the highest average mAP accuracy of 71.44%, surpassing Spikingformer-CML's accuracy of 4.96%. This method not only demonstrates excellent retrieval performance but also has a lower parameter count than other models, requiring only 11.3M parameters.
[0055] Table 3 below shows a comparison of the mAP@30 accuracy of different methods on the HMDB51-DVS dataset under different bit conditions. * indicates that the result of the corresponding row was reproduced using publicly available code.
[0056] Table 3
[0057]
[0058] As shown in Table 3, our method outperforms other methods at every bit level, achieving the highest average mAP accuracy of 52.47%. Not only does it demonstrate excellent performance, but our method also requires fewer parameters than other methods. Therefore, the retrieval method using our approach significantly outperforms other methods on these three datasets.
Claims
1. A hash retrieval method based on pulse neural network and soft similarity loss, characterized in that The method comprises the following steps: Step 1: selecting N data from an original data set as training samples, and performing data preprocessing on the training samples to obtain preprocessed training data, when the original data set is a dynamic visual sensor (DVS) data set, specifically comprising: integrating the files of the dynamic visual sensor (DVS) data set according to a time window to obtain 8 video data, and then the preprocessed training data comprises 8 time step video data; when the original data set is a static image data set, specifically comprising: copying a single picture in the static image data set 4 times and arranging the copied pictures in sequence to form a 4 time step picture sequence, and taking the picture sequence as the preprocessed training data; Step 2: constructing a hash retrieval model to be trained, comprising a Transformer feature extraction layer based on a spiking neural network, a hash layer based on a spiking neural network and a classification head, inputting the N preprocessed training data into the Transformer feature extraction layer based on the spiking neural network after random shuffling to obtain sample features after feature extraction; Step 3: inputting the sample features after feature extraction into the hash layer based on the spiking neural network to obtain membrane potential features of the training samples and hash codes corresponding to the training samples, and then inputting the hash codes corresponding to the training samples into the classification head to output classification results of the training samples; Step 4: calculating the cosine similarity between the membrane potential features of different training samples according to the membrane potential features of different training samples, accumulating and normalizing the cosine similarity between the membrane potential features of different training samples to obtain the category similarity between different categories of training samples, then forming a soft similarity matrix with the category similarity between different categories of training samples, defining a loss function of the hash retrieval model to be trained, obtaining the value of the loss function through the soft similarity matrix, the category label of the training sample, the hash code corresponding to the training sample and the classification result of the training sample, updating the hash retrieval model to be trained through back propagation iteration to start the training process, and narrowing the generated hash codes of similar training samples and widening the generated hash codes of dissimilar training samples, until the maximum number of iteration updates is reached to end the training process, and obtaining the trained hash retrieval model; Step 5: selecting M data from a target data set as query samples and forming a query set, taking the remaining data in the target data set as retrieval samples and forming a retrieval set, pre-processing the query samples to obtain preprocessed query samples, inputting the preprocessed query samples into the trained hash retrieval model to obtain hash codes corresponding to the query samples; pre-processing the retrieval samples to obtain preprocessed retrieval samples, inputting the preprocessed retrieval samples into the trained hash retrieval model to obtain hash codes corresponding to the retrieval samples, and defining a set composed of the hash codes corresponding to all retrieval samples as a hash code retrieval library; Step 6: finding the hash code with the closest Hamming distance to the hash code corresponding to the query sample in the hash code retrieval library, and taking the retrieval sample corresponding to the hash code as the retrieval result to complete the retrieval process of the query sample.
2. The hash retrieval method based on pulse neural network and soft similarity loss according to claim 1, characterized in that The specific process of step 3 is as follows: Step 3-1: The hash layer based on the spiking neural network includes a pooling layer, a linear layer, a spiking neuron and a hash conversion layer, and the sample feature after feature extraction is input into the pooling layer, and a global average pooling is applied by the pooling layer to obtain a pooled feature vector f with a dimension of 8*512*1; Step 3-2: f is input into the linear layer, and a floating-point value feature x with the same length L as the preset hash code length is obtained through the mapping of the linear layer, and the dimension of x is 8*L, 8 is the time step length, then x is input into the spiking neuron to obtain a plurality of time step binary features b and a membrane potential feature m of the training sample; Step 3-3: b is input into a hash transformation layer, which performs an AND operation on b in multiple time step dimensions to obtain a binary hash code h, h = And(SN((W T f+o))) where W represents a weight matrix of the linear layer, W T T represents the transpose of W, o represents a bias of the linear layer, W T f+o = x, SN(…) represents a spiking neuron, and And(…) represents an AND operation performed by the hash transformation layer. Step 3-4: h is input into the classification head, and a classification result p is output by the classification head.
3. The hash retrieval method based on pulse neural network and soft similarity loss according to claim 1, characterized in that The specific process of step 4 is as follows: Step 4-1: define the loss function L of the hash retrieval model to be trained, L = a L s + β L cls , wherein L cls is a classification loss, C is the total number of classes of the training sample input in the current training round, t represents the class serial number, 1≤t≤C, y t represents the class label of the training sample, if the training sample belongs to the t-th class, y t = 1, otherwise y t = 0, p t represents the probability that the training sample belongs to the t-th class in the classification result output by the classification head; L s is a soft similarity loss, wherein e is a natural constant, h p represents the hash code corresponding to the pth training sample, h q represents the hash code corresponding to the qth training sample, is the transpose of h p ; in the first training round, is obtained from the class label of the training sample, t p represents the class serial number of the pth training sample, t q represents the class serial number of the qth training sample, if the pth training sample and the qth training sample belong to the same class, then if they belong to different classes, then In the first training round, the soft similarity matrix is obtained, and the soft similarity matrix is denoted as S soft , S soft The initial state at the beginning of training is a zero matrix, wherein s ij ′ is an element located in the ith row and the jth column of S soft , representing the class similarity between the ith class and the jth class, s ij ′ The acquisition process of s ij ′ is as follows: the cosine similarity between the membrane potential features of each training sample belonging to the ith class and the membrane potential features of each training sample belonging to the jth class in the current training round is calculated, then the cosine similarities between the membrane potential features of all two training samples belonging to the two classes contained in the ith class and the jth class are added, then the cosine similarity accumulation result is normalized according to the number of training samples in the current training round to obtain s ij ′ , and at the end of the current training round, s is updated to s s cls obtained in the current training round, and s s is used as s cls in the next training round of the current training round, α and β are parameters for balancing L s and L cls ; Step 4-2: Set the maximum training round, and use the AdamW optimization algorithm to iteratively update the hash retrieval model to be trained according to the loss function L until the maximum training round is reached, and the iteration update process is stopped, and the trained hash retrieval model is obtained.
4. The hash retrieval method based on pulse neural network and soft similarity loss according to claim 3, characterized in that In step 4-1, a=0.001, and β=1.
5. The hash retrieval method based on pulse neural network and soft similarity loss according to claim 3, characterized in that In step 4-2, when the original data set is CIFAR10 data set, the maximum training round is set to 400 times; when the original data set is UCF101-DVS data set or HMDB51-DVS data set, the maximum training round is set to 200 times.
Citation Information
Patent Citations
Deep hash learning method and device
CN108629414A
Multi-label image retrieval method and system based on object scale perception
CN116127119A