Method for data classification based on few-shot learning model and related device

By using a few-shot learning method, a Wi-Fi action recognition model is trained using a similarity matrix and a cross-entropy loss function. This solves the problems of high cost and low accuracy in large-scale sample training and achieves efficient and accurate action recognition.

CN118690232BActive Publication Date: 2026-07-03SHENZHEN RES INST OF BIG DATA

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN RES INST OF BIG DATA
Filing Date
2024-06-26
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing action recognition methods based on Wi-Fi technology require a large amount of labeled sample data for training, which is costly and has poor classification and generalization performance, especially in terms of low accuracy when recognizing different domains.

Method used

By employing a few-shot learning approach, a model is trained using a similarity matrix and a cross-entropy loss function after acquiring a pre-defined target model and multiple feature templates. This determines the similarity between the feature templates and the data to be classified, thereby achieving efficient and accurate data classification.

Benefits of technology

It reduces training costs, improves the accuracy and generalization ability of data classification, and can accurately identify actions even with few samples.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118690232B_ABST
    Figure CN118690232B_ABST
Patent Text Reader

Abstract

This application provides a method and related apparatus for data classification based on a few-shot learning model. The method includes: acquiring data to be classified; acquiring a preset target model and multiple first feature templates; wherein the target model is obtained by a first comparison training performed on a first similarity matrix obtained from the sample feature relationship between multiple first sample data and preset first sample labels, and a second comparison training performed on the first sample data and the first feature templates; inputting the data to be classified and the multiple first feature templates into the target model to obtain multiple feature similarities; determining the first feature template with the highest feature similarity to the data to be classified as the target feature template based on the feature similarity, and determining the target category corresponding to the target feature template; and determining the target category as the classification result of the data to be classified. This reduces the training cost of the model while improving the accuracy of data classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data classification technology, and in particular to a method and related equipment for data classification based on a few-shot learning model. Background Technology

[0002] Currently, motion recognition technology has broad application prospects in many fields. For example, in industries such as automotive, healthcare, and education, motion recognition technology can help users operate equipment more effectively, improving work efficiency and security. Furthermore, due to the wide coverage, penetration, and strong privacy characteristics of Wi-Fi signals, which can effectively address recognition issues such as insufficient light, privacy protection, and line-of-sight obstruction, Wi-Fi technology is widely used in motion recognition scenarios.

[0003] In related technologies, most Wi-Fi-based action recognition methods involve collecting a large amount of action sample data and labeling it with corresponding action tags. A classifier is then trained using this large amount of labeled sample data to classify and recognize different actions. However, this approach requires a large amount of labeled sample data to train the recognition model, and the collection and labeling of labeled sample data is costly. Furthermore, the classification and generalization performance of a single classifier is poor, resulting in low classification accuracy when recognizing actions from different domains (such as different locations or different people). Summary of the Invention

[0004] The main objective of this application is to propose a method and related equipment for data classification based on a few-shot learning model, which can improve the accuracy of data classification while reducing the training cost of the model.

[0005] To achieve the above objectives, a first aspect of this application proposes a method for data classification based on a few-shot learning model, the method comprising:

[0006] Obtain the data to be classified;

[0007] A preset target model and multiple first feature templates of the target model are obtained; wherein, the target model is obtained by a first similarity matrix obtained by the preset model based on the sample feature relationship between multiple first sample data, a first comparison training with preset first sample labels, and a second comparison training based on the first sample data and the first feature templates; the first feature templates are obtained by performing feature weighting calculation on multiple first sample data under each first sample label according to the first similarity matrix corresponding to the multiple first sample data.

[0008] The data to be classified and the plurality of first feature templates are input into the target model to obtain multiple feature similarities between the data to be classified and the plurality of first feature templates respectively;

[0009] Based on the multiple feature similarities, the first feature template with the highest feature similarity to the data to be classified is determined as the target feature template, and the target category corresponding to the target feature template is determined.

[0010] The target category is determined as the classification result of the data to be classified.

[0011] Accordingly, a second aspect of this application proposes an apparatus for classifying data based on a few-shot learning model, the apparatus comprising:

[0012] The first acquisition module is used to acquire the data to be classified.

[0013] The second acquisition module is used to acquire a preset target model and multiple first feature templates of the target model; wherein, the target model is obtained by the preset model through a first similarity matrix obtained based on the sample feature relationship between multiple first sample data, a first comparison training performed with preset first sample labels, and a second comparison training performed based on the first sample data and the first feature templates; the first feature templates are obtained by performing feature weighting calculation on multiple first sample data under each first sample label according to the first similarity matrix corresponding to the multiple first sample data;

[0014] The input module is used to input the data to be classified and the plurality of first feature templates into the target model to obtain multiple feature similarities between the data to be classified and the plurality of first feature templates respectively;

[0015] The first determining module is used to determine the first feature template with the highest feature similarity to the data to be classified as the target feature template based on the plurality of feature similarities, and to determine the target category corresponding to the target feature template;

[0016] The second determining module is used to determine the target category as the classification result of the data to be classified.

[0017] In some embodiments, the apparatus for classifying data using a few-shot-learned model further includes a training module for:

[0018] Obtain a sample training set, and perform a first comparative training and a second comparative training on the preset model based on the sample training set to obtain a first target model;

[0019] When there is no sample support set for training the first target model, the first target model is used as the target model;

[0020] When a sample support set exists for training the first target model, the first target model is subjected to a third and a fourth comparative training based on the sample support set to obtain the target model; wherein the sample training set and the sample support set have no intersection; and the category of the data to be classified is the same as at least one sample label contained in the sample support set.

[0021] In some implementations, the training module is further configured to:

[0022] The first similarity matrix is ​​obtained by inputting multiple first sample data from the training set into a preset model; wherein, the first similarity matrix is ​​used to characterize the similarity between any two first sample data.

[0023] Obtain the first sample label for each of the first sample data, and determine the first cross-entropy loss of the preset model based on the similarity between any two first sample data and the first sample label;

[0024] The parameters of the preset model are adjusted according to the first cross-entropy loss to obtain the first preset model after the first comparative training of the preset model;

[0025] Obtain multiple first feature templates corresponding to the sample training set, and calculate the second cross-entropy loss of the first preset model based on the similarity between any two first sample data and the corresponding first feature templates;

[0026] The parameters of the first preset model are adjusted according to the second cross-entropy loss to obtain the first target model after the first preset model has undergone a second comparative training.

[0027] In some implementations, the training module is further configured to:

[0028] Based on the first similarity matrix, determine the sample quality score of each of the first sample data;

[0029] For each first sample label in the sample training set, determine the product of each first sample data in the first sample label and the corresponding sample quality score, and sum the multiple products corresponding to the multiple first sample data under the first sample label to obtain the sum of the first products corresponding to the first sample label;

[0030] Obtain the sum of multiple sample quality scores of multiple first sample data under the first sample label, and use the ratio of the first product sum to the sum of the multiple sample quality scores as the first feature template corresponding to the first sample label.

[0031] In some implementations, the training module is further configured to:

[0032] Obtain the first similarity matrix corresponding to multiple first sample data;

[0033] The first similarity matrix is ​​input into the convolutional layer of the first preset model to obtain multiple sample quality scores corresponding to the multiple first sample data.

[0034] The sample quality score is determined by the convolutional layer for each first sample data by determining multiple similarities between each first sample data and other multiple first sample data from the first similarity matrix, and based on the differences between the multiple similarities.

[0035] In some implementations, the training module is further configured to:

[0036] When a sample support set exists for training the first target model, multiple second sample data from the sample support set are input into the first target model to obtain a second similarity matrix corresponding to the multiple second sample data; wherein, the second similarity matrix is ​​used to characterize the similarity between any two second sample data.

[0037] Obtain the second sample labels of the two second sample data, and determine the third cross-entropy loss of the preset model based on the similarity between any two second sample data and the second sample labels;

[0038] The parameters of the first target model are adjusted according to the third cross-entropy loss to obtain a second preset model after the first target model has undergone third contrast training.

[0039] Obtain multiple second feature templates corresponding to the sample support set, and calculate the fourth cross-entropy loss of the second preset model based on the similarity between any two second sample data and the corresponding second feature template;

[0040] The parameters of the second preset model are adjusted according to the fourth cross-entropy loss to obtain the target model after comparative training of the second preset model.

[0041] In some embodiments, the second acquisition module is further configured to:

[0042] Multiple copies of the first sample data are made to obtain sample copy data;

[0043] The first sample data is used as the first input and input into the preset model, and the sample copy data is used as the second input and input into the preset model to obtain multiple feature similarities calculated by the preset model based on the sample feature relationship of any sample between the first sample data and the sample copy data.

[0044] Based on the multiple feature similarities, a first similarity matrix corresponding to multiple first sample data is obtained.

[0045] To achieve the above objectives, a third aspect of the present application provides a computer device, the computer device including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method for data classification based on a few-shot learning model as described in any one of the embodiments of the first aspect of the present application.

[0046] To achieve the above objectives, a fourth aspect of the present application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the data classification method based on a few-shot learning model as described in any one of the embodiments of the first aspect of the present application.

[0047] This application embodiment acquires data to be classified; acquires a preset target model and multiple first feature templates of the target model; wherein, the target model is obtained by the preset model based on a first similarity matrix obtained from the sample feature relationship between multiple first sample data, a first comparison training with preset first sample labels, and a second comparison training based on the first sample data and the first feature templates; the first feature templates are obtained by performing feature weighting calculation on multiple first sample data under each first sample label according to the first similarity matrix corresponding to the multiple first sample data; the data to be classified and the multiple first feature templates are input into the target model to obtain multiple feature similarities between the data to be classified and the multiple first feature templates respectively; based on the multiple feature similarities, the first feature template with the largest feature similarity to the data to be classified is determined as the target feature template, and the target category corresponding to the target feature template is determined; the target category is determined as the classification result of the data to be classified. In this way, the category features can be represented by the first feature template, realizing efficient learning and accurate classification of a small number of samples, reducing the dependence on traditional large-scale sample training, thereby reducing training costs. At the same time, since the first feature template can accurately reflect the essential features of similar data, the classification result can be determined more accurately by matching the similarity between the data to be classified and the first feature template. In summary, this application can improve the accuracy of data classification while reducing the training cost of the model. Attached Figure Description

[0048] Figure 1This is a schematic diagram of the system architecture for data classification based on a few-shot learning model provided in an embodiment of this application;

[0049] Figure 2 This is a flowchart of a data classification method based on a few-shot learning model provided in an embodiment of this application;

[0050] Figure 3 This is a diagram of the CSi-Net network structure provided in the embodiments of this application;

[0051] Figure 4 This is a flowchart illustrating the steps for training a preset model as provided in an embodiment of this application.

[0052] Figure 5 This is a structural diagram of the Weight-Net network provided in the embodiments of this application;

[0053] Figure 6 This is an overall flowchart of the data classification method based on a few-shot learning model provided in the embodiments of this application;

[0054] Figure 7 This is a schematic diagram of the functional modules of the device for classifying data based on a few-shot learning model provided in an embodiment of this application;

[0055] Figure 8 This is a schematic diagram of the hardware structure of the computer device provided in the embodiments of this application. Detailed Implementation

[0056] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0057] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0059] Currently, motion recognition technology has broad application prospects in many fields. For example, in industries such as automotive, healthcare, and education, motion recognition technology can help users operate equipment more effectively, improving work efficiency and security. Furthermore, due to the wide coverage, penetration, and strong privacy characteristics of Wi-Fi signals, which can effectively address recognition issues such as insufficient light, privacy protection, and line-of-sight obstruction, Wi-Fi technology is widely used in motion recognition scenarios.

[0060] In related technologies, most Wi-Fi-based action recognition methods involve collecting a large amount of action sample data and labeling it with corresponding action tags. A classifier is then trained using this large amount of labeled sample data to classify and recognize different actions. However, this approach requires a large amount of labeled sample data to train the recognition model, and the collection and labeling of labeled sample data is costly. Furthermore, the classification and generalization performance of a single classifier is poor, resulting in low classification accuracy when recognizing actions from different domains (such as different locations or different people).

[0061] Based on this, embodiments of this application provide a method and related equipment for data classification based on a few-shot learning model, which can improve the accuracy of data classification while reducing the training cost of the model.

[0062] The method and related equipment for data classification based on a few-shot learning model provided in this application are specifically described through the following embodiments. First, the system for data classification based on a few-shot learning model in this application embodiment is described.

[0063] Please refer to Figure 1 In some implementations, embodiments of this application provide a system for classifying data based on a few-shot learning model, including a terminal 11 and a server 12, wherein the terminal 11 can work in collaboration with the server 12.

[0064] Specifically, terminal 11 is a front-end device of a system that classifies data using a few-shot learning model. It can be a user's computer, mobile phone, or any other data input device. For example, terminal 11 can acquire the data to be classified and send it to server 12 for processing. The data to be classified can come from user input, sensor data, file uploads, etc. Terminal 11 can also receive the classification results processed by server 12 and display the results to the user.

[0065] Furthermore, server 12 can be the core processing unit of a system that classifies data based on a few-shot learning model, responsible for receiving data from terminal 11 and performing complex model training and data classification tasks. For example, server 12 can perform functions such as model training, data classification, model maintenance, and data processing.

[0066] By having the terminal 11 and server 12 of a data classification system based on a few-shot learning model work together, data classification can be automated, accurate, and efficient.

[0067] The data classification method based on a few-shot learning model in this application can be illustrated by the following embodiments.

[0068] It should be noted that in all specific embodiments of this application, when processing data related to user identity or characteristics, such as user information, user behavior data, user historical data, and user location information, user permission or consent will be obtained first. Furthermore, the collection, use, and processing of this data will comply with relevant laws, regulations, and standards. In addition, when embodiments of this application require access to sensitive personal information of users, separate permission or consent from the user will be obtained through pop-ups or redirects to confirmation pages. Only after obtaining the user's separate permission or consent will the necessary user-related data for the normal operation of the embodiments of this application be obtained.

[0069] In this application embodiment, the device for classifying data using a few-shot learning model will be described from the perspective of its specific integration into a computer device. See also Figure 2 , Figure 2 This application provides a flowchart of the steps for a data classification method based on a few-shot learning model, as illustrated in this embodiment. Taking the integration of the device for data classification based on a few-shot learning model into a device such as a terminal or server as an example, the specific process when the processor on the terminal or server executes the program instructions corresponding to the data classification method based on a few-shot learning model is as follows:

[0070] Step 101: Obtain the data to be classified.

[0071] In some implementations, in order to perform a classification task, the data to be classified is divided into predefined categories. This can be done by acquiring the data to be classified and processing it to facilitate the subsequent completion of the classification task.

[0072] The data to be classified can be data items that have not yet been labeled or classified. For example, the data to be classified can be obtained from public datasets, user-generated content, internal enterprise data, crowdsourced labeling services, and self-built datasets, and the data to be classified can be determined by a specific classification task. Furthermore, the data to be classified can be Channel State Information (CSI) collected when the person being monitored performs a specific gesture.

[0073] The above methods can be used to obtain data to be classified, so as to facilitate the subsequent rapid processing of the classification task.

[0074] In some implementations, due to potential sensor malfunctions, network transmission problems, environmental interference, etc., during data acquisition, some data points may be lost. Therefore, to improve data integrity, eliminate biases and defects in the data source, and ensure the normal operation of the target model, it is necessary to complete the missing data points to improve the performance of data classification, such as improving the performance of human gesture and posture recognition. For example, step 101 also includes:

[0075] (101.1) Obtain the data to be classified, and perform detection on each data point in the data to be classified to obtain the detection results;

[0076] (101.2) When the detection result indicates that the difference between a data point and its neighboring data points exceeds the missing threshold, the corresponding data point is identified as a missing data point;

[0077] (101.3) Based on the distribution of multiple data points, determine the target interpolation method for interpolating missing data points;

[0078] (101.4) Calculate the interpolation value of the missing data point based on at least two adjacent data points using the target interpolation method;

[0079] (101.5) Fill the missing data points with the interpolated values ​​to obtain the supplemented data to be classified.

[0080] The detection results can be information obtained by analyzing data through specific algorithms or methods, used to identify outliers or missing data points in the dataset.

[0081] The missing data threshold can be a preset critical value used to determine whether the differences between data points are too large, thus deciding whether a data point is considered missing. The missing data threshold can be set based on the specific characteristics of the data, the expected normal fluctuation range, and the actual application scenario.

[0082] Missing data points can refer to values ​​that are missing or not recorded in the dataset. Missing data points can be caused by sensor malfunctions, network interruptions, equipment errors, or other problems.

[0083] The target interpolation method can be a mathematical method or strategy chosen to fill in missing data points. The target interpolation method depends on the distribution of the data points, such as the continuity, trend, and volatility of the data point distribution.

[0084] The interpolated value can be the actual value used to fill in missing data points, calculated using the target interpolation method.

[0085] For example, in the data preprocessing stage, outlier detection algorithms, such as the Z-score algorithm or the interquartile range method, can be used to identify outliers in the dataset that may be caused by sensor malfunctions or network transmission problems. The Z-score algorithm or the interquartile range method can determine whether a data point deviates from the normal range by calculating the distance between the data point and the mean or median.

[0086] Furthermore, during the data cleaning phase, it's possible to check for significant differences or abrupt changes between adjacent data points. If the difference exceeds a preset missing threshold (e.g., more than three times the standard deviation of the mean), it can be identified as a missing data point. The missing threshold can be set according to the data distribution and the actual application scenario.

[0087] Furthermore, based on the continuity and trend of the data, the corresponding target interpolation method can be selected. For example, in scenarios where data points change continuously, linear interpolation can be selected as the completion strategy; when the data fluctuates greatly, more complex interpolation methods, such as nearest neighbor interpolation or spline interpolation, can be selected.

[0088] Taking linear interpolation as an example, we can select the preceding and following complete data points of the missing data points to calculate the estimated value of the missing data points, which is the interpolated value.

[0089] Specifically, the interpolated value = the value of the previous data point + (the value of the next data point - the value of the previous data point) / (the next time point - the previous time point) × (the time of the missing data point - the previous time point).

[0090] Furthermore, the calculated interpolated values ​​can be filled back into the missing data points in the original dataset to obtain supplemented data to be classified. This ensures the integrity of the data and improves its continuity and consistency, providing a high-quality data foundation for CSI-based human gesture recognition or human posture recognition, thereby improving the accuracy and robustness of the recognition.

[0091] Step 102: Obtain a preset target model and multiple first feature templates of the target model; wherein, the target model is obtained by the preset model based on the first similarity matrix obtained by the sample feature relationship between multiple first sample data, the first comparison training with the preset first sample label, and the second comparison training based on the first sample data and the first feature template; the first feature template is obtained by performing feature weighting calculation on multiple first sample data under each first sample label according to the first similarity matrix corresponding to the multiple first sample data.

[0092] In some implementations, since the first feature template can accurately reflect the essential characteristics of data of the same type, in order to quickly and accurately determine the classification result of the data to be classified, multiple first feature templates corresponding to the target model can be obtained to calculate the similarity between the data to be classified and multiple first feature templates, thereby achieving efficient classification of the data to be classified.

[0093] The target model can be an algorithm or model used to predict or classify data. The target model can be obtained by adjusting the model parameters of a pre-defined model through training on the first sample data. Specifically, the target model can be the CSi-Net network proposed in this application, or other classification networks.

[0094] The first feature template can be calculated based on the first sample data and its first similarity matrix, and is used to characterize the essential features of data of a specific category. The first feature template can be generated based on the statistical information of the sample data or through machine learning algorithms, and is an abstract representation used to describe the data.

[0095] The pre-built model can be a model that has been built before the data classification task begins. The pre-built model can be based on existing knowledge bases, literature, or prior experience, and serves as the starting point for subsequent training. Specifically, the pre-built model can be the CSi-Net network proposed in this application, or other classification networks.

[0096] The first sample data can be the basic data unit used to train and validate a preset model. For example, in an action classification scenario, the first sample data can be the channel state information collected when the person being detected performs a specific gesture. Multiple channel state information can be combined to form multiple first sample data sets for training the preset model.

[0097] The first similarity matrix can be a matrix used to represent the similarity or distance between the first sample data, and each element in the first similarity matrix represents the degree of similarity between two first sample data.

[0098] The first sample label can be a marker used to indicate a class of first sample data; that is, the first sample label can be used to indicate the category or attribute of a class of first sample data.

[0099] The first feature template can be obtained by training a preset model on a set of first sample data. For example, each first sample data under a first sample label can correspond to a first feature template.

[0100] Please refer to Figure 3 , Figure 3The network shown is the CSi-Net network structure diagram proposed in this application. When the first sample data is CSI data, the CSi-Net network can use a multi-head attention structure to determine the similarity between the first sample data, instead of a simple Gaussian distance. During training of the preset model, two sets of first sample data can be extracted from the training set each time and used as CSI input 1 and CSI input 2 of the CSi-Net network, respectively. For example, 64 first sample data can be randomly extracted from the training set. The CSi-Net network can obtain the first similarity matrix between the two sets of first sample data based on the feature relationships between the samples. In some implementations, the two sets of first sample data have the same dimension, and the two sets of first sample data can be the same or different.

[0101] Furthermore, a learning target Y can be defined based on each first sample label. The size of Y is the same as that of the first similarity matrix S (e.g., both are 64*64). The value of Y can be determined based on the first sample label. That is, the first sample data with the same first sample label have high similarity, and the first sample data with different first sample labels have low similarity.

[0102] Furthermore, cross-entropy can be used as the loss function to calculate the difference between the first similarity matrix S and the learning target Y. The preset model can then be optimized using the gradient descent algorithm to minimize the loss function, making the difference between the first similarity matrix S and the learning target Y as small as possible, thereby enabling the preset model to better learn the feature relationships between samples.

[0103] Furthermore, after performing the first comparative training on the preset model, a second comparative training can be performed to effectively use the first feature template to represent the total feature expression of multiple first sample data under each first sample label, so that the trained target model can make full use of the sample features of each first sample data even in the case of few samples.

[0104] Specifically, the sample quality score of multiple first sample data under each first sample label can be determined through the first similarity matrix. The proportion of each first sample data in the first feature template corresponding to the first sample label can then be determined based on the sample quality score, thereby determining the first feature template. Specifically, when determining the sample quality score through the first similarity matrix, if a first sample data has a high or low similarity to all other first samples, it indicates that the first sample data may contain significant noise, resulting in a low sample quality score. Conversely, if a first sample data has extremely high similarity to some first sample data but extremely low similarity to other first sample data, it indicates that the sample quality score of the first sample data may be high. It is understood that since the sample quality score lacks sample labels and cannot be directly trained, this application indirectly trains the convolutional layer in the preset model used to output the sample quality score through first and second comparative training.

[0105] For example, after constructing a first feature template using a weighted method based on each first sample data and its sample quality score, and adjusting the weight of each first sample data in the first feature template corresponding to its first sample label, the first sample data can be used as the first input of the target model, and the first feature template can be used as the second input of the target model to obtain a third similarity matrix. The cross-entropy between S and Y is calculated, and then the preset model and the convolutional layer used to calculate the sample quality score are trained simultaneously through gradient descent. In this way, a first feature template for summarizing the general features of each first sample data under each first sample label can be obtained, so that the trained target model can still make accurate judgments when faced with data that has not appeared before.

[0106] Furthermore, since the data distributions of the source and target domains may differ in cross-domain learning, when a sample support set of the data to be classified exists, the preset model is further trained using the sample support set through third and fourth contrastive training to obtain the target model. This allows the target model to learn to better adapt to the data distribution of the target domain, thereby improving its performance in the target domain. It is understandable that the third contrastive training process is similar to the first contrastive training process described above, and the fourth contrastive training process is similar to the second contrastive training process described above, except that the dataset used to train the model is different. The specific process can be found above and will not be repeated here.

[0107] In other words, when there is no sample support set, the first feature template can be obtained by performing the first and second contrastive training on the preset model and using it as the feature template of the data to be classified. When there is a sample support set, in addition to performing the first and second contrastive training on the preset model to obtain the first feature template of the source domain, the third and fourth contrastive training should also be performed on the sample support set to obtain the first feature template of the target domain and use it as the feature template of the data to be classified.

[0108] Understandably, since the first feature template can accurately reflect the essential characteristics of data of the same type, the target model can quickly and accurately determine the classification result of the data to be classified, even in the case of few samples or cross-domain learning. Therefore, a preset target model and multiple first feature templates of the target model can be obtained. In the absence of a sample support set, the first feature template is the feature template obtained by performing the first and second comparative training on the preset model. In the presence of a sample support set, the first feature template is the feature template obtained by performing the first and second comparative training on the preset model based on multiple first sample data, and the third and fourth comparative training on the preset model based on the sample support set.

[0109] By using the CSi-Net network with a multi-head attention structure to determine the similarity between the first sample data, the target model can more accurately capture the relationships between sample features, thereby improving classification accuracy. Furthermore, by representing the key features of each category using the first feature template, the target model can maintain high recognition accuracy even when faced with unseen new data. Thus, even with a limited number of samples, by utilizing the first feature template, the target model can still fully leverage the features of each sample data, improving its classification performance while also optimizing its generalization ability and training efficiency.

[0110] In some implementations, simply using metrics such as Gaussian distance and cosine similarity to determine the distance between samples does not fully utilize the relationships between samples. Therefore, this application introduces a multi-head attention mechanism and applies it to measure the feature similarity between first sample data. By inputting the features of different first sample data as queries and keys into the attention module, the similarity between the first sample data is calculated. This helps the model better capture the relationships between the first sample data. For example, the first similarity matrix is ​​obtained from a preset model through the following steps:

[0111] (A.1) Copy multiple first sample data to obtain sample copy data;

[0112] (A.2) The first sample data is used as the first input and input into the preset model, and the sample copy data is used as the second input and input into the preset model to obtain multiple feature similarities calculated by the preset model based on the sample feature relationship of any sample between the first sample data and the sample copy data;

[0113] (A.3) Based on multiple feature similarities, the first similarity matrix corresponding to multiple first sample data is obtained.

[0114] The sample copy data can be data copied from the first sample data, or it can be data extracted from the training set that is the same as the first sample data, or it can be data extracted from the training set where the first sample data is located that is different from the first sample data.

[0115] Feature similarity can be an indicator that measures the degree of similarity between features of the first sample data. Calculating feature similarity helps the preset model to identify and utilize the correlation between the first sample data, thereby improving the learning effect.

[0116] For example, multiple first sample data can be extracted from a pre-defined training set, such as extracting 64 first sample data.

[0117] For example, multiple copies of the first sample data can be made to obtain sample copy data. Then, the first sample data and its copies are input into a preset model, which can be CSi-Net. Next, the first sample data is used as the first input, and the sample copy data is used as the second input, both simultaneously input into the preset model. This allows the preset model to calculate the feature similarity between samples using a multi-head attention mechanism. Based on these multiple feature similarities, a first similarity matrix corresponding to the multiple first sample data is obtained. Each element in the first similarity matrix represents the feature similarity between each first sample data and any sample copy data. This improves the accuracy of feature similarity calculation and enhances the expressive power and learning efficiency of the preset model.

[0118] For example, two sets of samples can be extracted from the training set, each set including m first sample data. Then, these two sets of samples are used as the first and second inputs, respectively, and input into a preset model to obtain a first similarity matrix S of size m*m. For example, when m is 3, the first input is: sample A1, sample A2, sample A3, and the second input is: sample B1, sample B2, sample B3. The first similarity matrix S obtained through the preset model is:

[0119]

[0120] By combining multi-head attention mechanisms, the accuracy of feature similarity calculation and the learning efficiency of the preset model can be effectively improved, thereby enabling the preset model to achieve better performance in various application scenarios.

[0121] Please refer to Figure 4 In some implementations, to enable the preset model to learn sufficient discriminative features from a limited set of first data samples, facilitating subsequent generalization to unseen data, the preset model can be trained to ensure that first sample data with the same first sample label have high feature similarity, while first sample data with different first sample labels have low feature similarity. Furthermore, training the preset model allows it to learn common features from multiple first sample data with the same first sample label, enabling the trained target model to efficiently and accurately classify the data to be classified. For example, the "target model" in step 102 can be trained in the following way:

[0122] Step 201: Obtain a sample training set, and perform a first comparative training and a second comparative training on the preset model based on the sample training set to obtain the first target model;

[0123] Step 202: When there is no sample support set for training the first target model, the first target model is used as the target model.

[0124] Step 203: When there is a sample support set for training the first target model, perform third and fourth contrastive training on the first target model based on the sample support set to obtain the target model; wherein, the sample training set and the sample support set have no intersection; the category of the data to be classified is the same as at least one sample label contained in the sample support set.

[0125] The training set can be a training set containing multiple first sample data, which are used to train a predefined model. The training set may include the first sample data (e.g., images, text, or channel state information) and the corresponding first sample labels (e.g., specific action categories, image categories, etc.). The training set can be used for first contrastive training and second contrastive training.

[0126] The first contrastive training can involve randomly selecting two sets of first sample data from the training set and simultaneously inputting them into a pre-defined model to obtain a first similarity matrix S. Based on the first sample labels, the learning target Y of the pre-defined model is determined. Then, the cross-entropy loss of the pre-defined model is calculated based on S and Y, and the model is adjusted according to the cross-entropy loss. Through this first contrastive training, the pre-defined model can learn the feature similarity between the first sample data and improve its ability to distinguish between different categories of first sample data.

[0127] The second contrastive training can be a process where a pre-defined model generates a first feature template based on the common features of multiple first sample data under each first sample label. Specifically, the pre-defined model can output the sample quality score of each first sample data through a convolutional layer, and calculate the first feature template corresponding to each first sample label by weighting the sample quality scores. Then, the first sample data is used as the first input, and the first feature template is used as the second input, both input into the pre-defined model to obtain a similarity matrix. Based on the first sample label, the learning target Y of the first pre-defined model is determined, and the cross-entropy loss of the pre-defined model is calculated based on the similarity matrix and Y, so as to adjust the first pre-defined model according to the cross-entropy loss. Thus, the trained first target model can learn the common features of the first sample data under each first sample label based on the first feature template.

[0128] The first target model can be a model obtained after performing a first comparative training and a second comparative training on a preset model. The first target model is a model with good generalization ability generated by the preset model after training on the source domain.

[0129] The support set can be a small dataset used to provide classification decisions for scenarios with few samples during the testing phase. The labels of the second samples in the support set can be the same as or different from the labels of the first samples in the training set, and the category of each second sample in the support set is the same as the category of the data to be classified. Training the pre-defined model using the training set enables it to possess good classification capabilities. Training the model using the support set allows it to quickly adapt to new environments, achieving efficient learning and accurate data classification even with a small number of samples.

[0130] The third contrastive training can be performed on the first target model based on the sample support set. This third contrastive training can involve randomly selecting two sets of second sample data from the sample support set and simultaneously inputting them into the first target model to obtain a second similarity matrix S. Based on the second sample labels, the learning target Y of the first target model is determined. Then, the cross-entropy loss of the first target model is calculated based on S and Y, and the first target model is adjusted according to the cross-entropy loss. Through this third contrastive training, the first target model can learn the feature similarity between the second sample data and improve its ability to distinguish between different categories of first sample data.

[0131] The fourth contrastive training can be a process where the second pre-defined model generates a second feature template based on the common features of multiple second sample data under each second sample label. Specifically, the second pre-defined model can output the sample quality score of each second sample data through a convolutional layer, and calculate the second feature template corresponding to each second sample label by weighting the sample quality scores. Then, the second sample data is used as the third input, and the second feature template is used as the fourth input, both simultaneously input into the second pre-defined model to obtain a similarity matrix. Based on the second feature template and the second sample label, a learning objective is determined, and the cross-entropy loss of the second pre-defined model is calculated based on the similarity matrix and the learning objective to adjust the second pre-defined model. Thus, the trained target model can learn the common features of the second sample data under each second sample label based on the second feature template.

[0132] For example, for the sample training set, in the first comparative training, the preset model can learn the mapping from features to labels of the first sample data, and by continuously adjusting the weights in the network, the preset model can more accurately identify the category of the first sample data. Through the second comparative training, the preset model can learn the common features of all first sample data under each first sample label as the first feature template, which facilitates the subsequent direct calculation of the feature similarity between the data to be classified and the first feature template, thereby achieving fast and accurate classification of the data to be classified.

[0133] Understandably, in practical applications, new categories or situations may arise that are not present in the training set. The support set can be used to fine-tune the pre-defined model, enabling it to better handle these new situations. It is also understandable that the second sample data in the support set belongs to the same category as the data to be classified.

[0134] For example, for the sample support set, in the third contrastive training, the preset model can learn the mapping from features to second sample labels in the second sample data, and by continuously adjusting the weights in the network, the preset model can more accurately identify the category of the second sample data. Through the fourth contrastive training, the preset model can learn the common features of all second sample data under each second sample label as the second feature template, which facilitates the subsequent direct calculation of the feature similarity between the data to be classified and the first feature template, thus achieving fast and accurate classification of the data to be classified.

[0135] In some implementations, the first preset model, the first target model, and the second preset model may also be referred to as preset models under certain circumstances.

[0136] Specifically, if there is no sample support set for training the first target model, then the first target model is already the best model trained on the available data (i.e., the sample training set). In this case, there is no additional data to further improve or fine-tune the model, so the first target model is regarded as the final target model for subsequent classification tasks.

[0137] If a support set exists, it means there is additional data that does not overlap with the training set that can be used to further train and optimize the model. The support set may contain a data distribution more similar to the data to be classified, or it may contain new categories or situations that have not appeared in the training set. In this case, using the support set to perform additional training on the first target model can improve the performance of the target model.

[0138] By combining different datasets and training strategies, we can improve the generalization ability, adaptability, and classification performance of the target model, enabling it to perform classification tasks more accurately and reliably in various scenarios.

[0139] In some implementations, to improve the accuracy of the target model in classifying the data to be classified, a first comparative training can be performed on the preset model. This allows the preset model to learn the mapping from features to labels of the first sample data, and by continuously adjusting the weights in the network, the preset model can more accurately identify the category of the first sample data. Through a second comparative training, the preset model can learn the common features of all first sample data under each first sample label as a first feature template. This facilitates the subsequent direct calculation of the feature similarity between the data to be classified and the first feature template, achieving fast and accurate classification of the data to be classified. For example, step 201 may include:

[0140] (201.1) Input multiple first sample data from the sample training set into the preset model to obtain the first similarity matrix corresponding to the multiple first sample data; wherein, the first similarity matrix is ​​used to characterize the similarity between any two first sample data;

[0141] (201.2) Obtain the first sample label of each first sample data, and determine the first cross-entropy loss of the preset model based on the similarity between any two first sample data and the first sample label;

[0142] (201.3) Adjust the parameters of the preset model according to the first cross-entropy loss to obtain the first preset model after the first comparative training of the preset model;

[0143] (201.4) Obtain multiple first feature templates corresponding to the sample training set, and calculate the second cross-entropy loss of the first preset model based on the similarity between any two first sample data and the corresponding first feature templates;

[0144] (201.5) Adjust the parameters of the first preset model according to the second cross-entropy loss to obtain the first target model after the second comparative training of the first preset model.

[0145] The first cross-entropy loss measures the difference between the first similarity matrix predicted by the pre-defined model and the learning objective. During training, the first cross-entropy loss can be calculated based on the first similarity matrix output by the pre-defined model and the actual first sample labels to ensure that the pre-defined model learns the similarity relationship between the first sample data better during training. Specifically, the learning objective can be that when the categories (first sample labels) of the i-th and j-th first sample data are different, the corresponding element is 0; when the categories of the i-th and j-th first sample data are the same, the corresponding element is 1.

[0146] The first preset model can be a model obtained after performing a first comparative training on a preset model. The first preset model has a good ability to distinguish the categories of different sample data.

[0147] The second cross-entropy loss can be used to measure the difference between the similarity matrix predicted by the first preset model based on the first sample data and the first feature template, and the learning objective. Specifically, the learning objective can be that when the categories (first sample labels) of the i-th first sample data and the j-th first feature template are different, the element at the corresponding position is 0; when the categories of the i-th first sample data and the j-th first feature template are the same, the element at the corresponding position is 1.

[0148] For example, the CSi-Net model proposed in this application is used as the preset model. Taking a gesture recognition scenario as an example (the actual application is not limited to this scenario), during the first comparison training, 64 first sample data can be randomly extracted from the sample training set, and these 64 first sample data are input into the CSi-Net model. The CSi-Net model outputs a 64x64 first similarity matrix S. Each matrix element S[i][j] in S represents the feature similarity between the i-th first sample data and the j-th first sample data predicted by the CSi-Net model as belonging to the same category.

[0149] Furthermore, a 64x64 learning target matrix Y can be constructed based on the true category (i.e., the first sample label) of each first sample data. If the i-th first sample data and the j-th first sample data belong to the same first sample label, then Y[i][j] is 1; if the i-th first sample data and the j-th first sample data belong to different first sample labels, then Y[i][j] is 0.

[0150] Furthermore, the first cross-entropy loss can be calculated based on the first similarity matrix S and the learning target matrix Y. The difference between the first similarity matrix S and the ideal learning target Y can be determined through the first cross-entropy loss.

[0151] Furthermore, based on the first cross-entropy loss, the parameters of the CSi-Net model can be optimized using gradient descent to reduce the loss value. The above training steps are repeated, updating the model parameters in each iteration, until the model converges or reaches the preset number of training iterations, resulting in the first preset model.

[0152] By performing a first comparative training on the preset model, the first preset model can accurately distinguish the first sample data of different categories and continuously improve its performance during the training process.

[0153] In some implementations, during the second contrastive training, if there are 6 first sample labels, 3 first sample data points can be extracted from the training set for each first sample label, for a total of 18 first sample data points. These first sample data points are then input into the Weight-Net network of the first preset model to obtain a sample quality score W for each first sample data point from the convolutional layers. Then, based on the quality score W, the first sample data points for each category are weighted to obtain a first feature template T for each category. T represents the common features of all first sample data points under each first sample label.

[0154] Furthermore, the first sample data can be used as the first input to the first preset model, and the first feature template can be used as the second input to the first preset model. Both inputs are then fed into the first preset model to obtain the feature similarity matrix S.

[0155] Furthermore, a learning objective Y for the second contrastive training is defined. The learning objective Y is a matrix, which is constructed based on the first feature template of the first sample data. For each element Y[i][j] in Y, if the i-th first sample data and the j-th first sample data belong to the same first feature template, then Y[i][j] is 1; if the i-th first sample data and the j-th first sample data belong to different first feature templates, then Y[i][j] is 0.

[0156] Furthermore, a second cross-entropy loss can be calculated based on the feature similarity matrix S and the learning target matrix Y. The difference between the feature similarity matrix S and the ideal learning target Y can be determined through the second cross-entropy loss.

[0157] Furthermore, the calculated second cross-entropy loss can be used to iteratively update the parameters of the CSi-Net and Weight-Net networks using gradient descent to minimize the second cross-entropy loss. In each iteration, the model parameters are updated in the opposite direction of the second cross-entropy loss gradient, gradually improving the predictive ability of the first preset model. Once the first preset model converges or reaches the preset number of training iterations, the first target model can be obtained.

[0158] By conducting first and second comparative training on the preset model, the similarity between samples can be focused on in the first comparative training stage, enhancing the preset model's ability to distinguish samples of different categories. In the second comparative training stage, the utilization rate of high-quality samples by the preset model can be improved by evaluating the sample quality score, enabling the preset model to learn the common features of different first feature templates even in scenarios with few samples, so as to facilitate efficient and accurate classification in the future.

[0159] In some implementations, in general sample scenarios, especially in scenarios with few samples, by learning the first feature template, a representative first feature template can be created using limited first sample data. This allows the first feature template to adapt to data from different domains, which is beneficial for improving the generalization ability of the target model and the accuracy of classifying the data to be classified. For example, "obtaining multiple first feature templates corresponding to the sample training set" in (201.4) may include:

[0160] (201.4.1) Based on the first similarity matrix, determine the sample quality score of each first sample data;

[0161] (201.4.2) For each first sample label in the sample training set, determine the product of each first sample data in the first sample label and the corresponding sample quality score, and sum the multiple products corresponding to multiple first sample data under the first sample label to obtain the sum of the first products corresponding to the first sample label;

[0162] (201.4.3) Obtain the sum of the quality scores of multiple samples of multiple first sample data under the first sample label, and use the ratio of the first product sum to the sum of the multiple sample quality scores as the first feature template corresponding to the first sample label.

[0163] The sample quality score can be a metric used to evaluate the quality or reliability of a single first sample data point within its corresponding first sample label.

[0164] Specifically, the products corresponding to multiple first sample data under the first sample label can be summed to obtain the first product sum corresponding to the first sample label, and the ratio of the first product sum to the sum of the quality scores of multiple samples can be used as the first feature template.

[0165] For example, if the sample quality score is represented by W, then by weighting all the first sample data under each first sample label according to the sample quality score, the first feature template under that first sample label can be obtained. Specifically, for each first sample label, if it includes n first sample data, the formula for calculating the first feature template is as follows:

[0166]

[0167] Among them, T i X represents the first feature template of the i-th class (first sample label). i,j W represents the j-th first sample data of the i-th class. i,j This represents the corresponding sample quality score.

[0168] By weighting the sample quality scores, a first feature template is obtained that integrates the common features of all first sample data under a first sample label. The preset model can better understand and distinguish samples of different quality, improve the preset model's ability to transfer between different categories and tasks, and help the preset model achieve efficient and accurate data classification and processing in various complex environments.

[0169] In some implementations, since different first sample data contribute differently to the training of the preset model, a sample quality score can be calculated for each first sample data, enabling the preset model to focus on learning high-quality samples, thereby improving the overall performance of the preset model. Furthermore, a first similarity matrix can be used as the basis for determining the sample quality score to improve the accuracy of the sample quality score calculation. For example, (201.4.1) may include:

[0170] (201.4.1.1) Obtain the first similarity matrix corresponding to multiple first sample data;

[0171] (201.4.1.2) Input the first similarity matrix into the convolutional layer of the first preset model to obtain multiple sample quality scores corresponding to multiple first sample data; wherein, the sample quality score is determined by the convolutional layer for each first sample data, from the first similarity matrix, multiple similarities between each first sample data and other multiple first sample data, and based on the differences between the multiple similarities.

[0172] The convolutional layer can be a network used to output sample quality scores. In this application, the convolutional layer of the Weight-Net network can be used to output sample quality scores. The specific network can be determined according to the actual situation. This application does not impose too many restrictions on this.

[0173] Understandably, since the sample quality scores lack corresponding labels and cannot be directly trained, the Weight-Net network can be indirectly trained through the first contrastive training on the sample training set, thereby enabling the pre-defined model to output more accurate sample quality scores. Similarly, the Weight-Net network can also be indirectly trained through the third contrastive training on the sample support set.

[0174] Specifically, taking the training set as an example, if the first sample data has a high or low feature similarity with all other first sample data, it indicates that the first sample data may contain a lot of noise and the sample quality score is low; while if the first sample data has a very high feature similarity with a small number of first sample data, but a very low feature similarity with other first sample data, it indicates that the sample quality score of the first sample data is high.

[0175] For example, suppose there are 10 first sample data points. For sample 1, the feature similarity with the remaining 9 first samples is as follows: Sample 2: 0.9, Sample 3: 0.88, Sample 4: 0.86, Sample 5: 0.8, Sample 6: 0.92, Sample 7: 0.78, Sample 8: 0.85, Sample 9: 0.91, Sample 10: 0.95. Then sample 1 may contain noisy data or other interference factors, making it difficult to distinguish from other samples, and the sample quality score is low, for example, 0.2. On the other hand, for sample 6, the feature similarity with the remaining 9 first samples is as follows: Sample 1: 0.92, Sample 2: 0.23, Sample 3: 0.26, Sample 4: 0.2, Sample 5: 0.15, Sample 7: 0.88, Sample 8: 0.3, Sample 9: 0.4, Sample 10: 0.1. This indicates that sample 6 has a feature with clear boundaries and can represent an important feature or pattern, and the sample quality score is high.

[0176] For example, please refer to Figure 5 , Figure 5 This is a structural diagram of the Weight-Net network provided in the embodiments of this application. By inputting duplicate data of CSI (first sample data) or different CSI data into CSi-Net, the corresponding first similarity matrix can be obtained. Then, by inputting the first similarity matrix into the convolutional layer, the sample quality score of each CSI can be obtained.

[0177] By using the above methods, we can identify sample data with high sample quality scores, and then weight the sample data with different sample quality scores so that the preset model can better understand and distinguish samples of different quality.

[0178] In some implementations, to enable the target model to better adapt to different tasks, a sample support set can be introduced to train the first target model, allowing the trained target model to transfer and generalize across different categories and tasks. For the sample support set, in the third contrastive training, the preset model can learn the mapping from features to second sample labels in the second sample data, and by continuously adjusting the weights in the network, the preset model can more accurately identify the category of the second sample data. Through the fourth contrastive training, the preset model can learn the common features of all second sample data under each second sample label as a second feature template, thereby facilitating the subsequent direct calculation of the feature similarity between the data to be classified and the first feature template, achieving fast and accurate classification of the data to be classified. For example, step 203 may include:

[0179] (203.1) When there is a sample support set for training the first target model, multiple second sample data from the sample support set are input into the first target model to obtain a second similarity matrix corresponding to multiple second sample data; wherein, the second similarity matrix is ​​used to characterize the similarity between any two second sample data.

[0180] (203.2) Obtain the second sample labels of two second sample data, and determine the third cross-entropy loss of the preset model based on the similarity between any two second sample data and the second sample labels;

[0181] (203.3) Adjust the parameters of the first target model according to the third cross-entropy loss to obtain the second preset model after the first target model is trained by the third comparison;

[0182] (203.4) Obtain multiple second feature templates corresponding to the sample support set, and calculate the fourth cross-entropy loss of the second preset model based on the similarity between any two second sample data and the corresponding second feature templates;

[0183] (203.5) Adjust the parameters of the second preset model according to the fourth cross-entropy loss to obtain the target model after comparative training of the second preset model.

[0184] The second sample data can be the basic data unit used to train and validate the first target model. For example, in an action classification scenario, the second sample data can be the channel state information collected when the person being detected performs a specific gesture. Multiple channel state information can be combined to form multiple second sample data sets, which are used to train the first target model.

[0185] The second similarity matrix can be a matrix used to represent the similarity or distance between the second sample data, and each element in the second similarity matrix represents the degree of similarity between two second sample data.

[0186] The second sample label can be a marker used to indicate a type of second sample data; that is, the second sample label can be used to indicate the category or attribute of a type of second sample data.

[0187] The third cross-entropy loss measures the difference between the second similarity matrix predicted by the first target model and the learning objective. During training, the third cross-entropy loss can be calculated based on the second similarity matrix output by the first target model and the actual second sample labels to ensure that the first target model learns the similarity relationship between the second sample data better during training. Specifically, the learning objective can be that when the categories (second sample labels) of the i-th and j-th second sample data are different, the corresponding element is 0; when the categories of the i-th and j-th second sample data are the same, the corresponding element is 1.

[0188] The second preset model can be a model obtained after the first target model is trained by a third comparison. The second preset model has a good ability to distinguish the categories of different second sample data.

[0189] The fourth cross-entropy loss can be used to measure the difference between the similarity matrix predicted by the second preset model based on the second sample data and the second feature template, and the learning objective. Specifically, the learning objective can be that when the categories (second sample labels) of the i-th second sample data and the j-th second feature template are different, the element at the corresponding position is 0; when the categories of the i-th second sample data and the j-th second feature template are the same, the element at the corresponding position is 1.

[0190] For example, the CSi-Net model proposed in this application is used as the first target model. Taking a gesture recognition scenario as an example (the actual application is not limited to this scenario), during the third contrast training, 24 second sample data can be randomly extracted from the sample support set, and these 24 second sample data are input into the CSi-Net model. The CSi-Net model outputs a 24x24 second similarity matrix S. Each matrix element S[i][j] in S represents the feature similarity between the i-th and j-th second sample data predicted by the CSi-Net model as belonging to the same category.

[0191] Furthermore, a 24x24 learning target matrix Y can be constructed based on the true category (i.e., the second sample label) of each second sample data. If the i-th second sample data and the j-th second sample data belong to the same second sample label, then Y[i][j] is 1; if the i-th second sample data and the j-th second sample data belong to different second sample labels, then Y[i][j] is 0.

[0192] Furthermore, a third cross-entropy loss can be calculated based on the second similarity matrix S and the learning target matrix Y. The difference between the second similarity matrix S and the ideal learning target Y can be determined through the third cross-entropy loss.

[0193] Furthermore, the parameters of the CSi-Net model can be optimized using gradient descent based on the third cross-entropy loss to reduce the loss value. The above training steps are repeated, updating the model parameters in each iteration, until the model converges or reaches the preset number of training iterations, resulting in the second preset model.

[0194] By performing a third comparative training on the first target model, the second preset model can accurately distinguish between different categories of second sample data and continuously improve its performance during the training process.

[0195] In some implementations, during the fourth contrastive training, if there are 6 second sample labels, 3 second sample data points can be extracted from the sample support set for each second sample label, for a total of 18 second sample data points. These second sample data points are then input into the Weight-Net of the second preset model to obtain a sample quality score W for each second sample data point. Then, based on the quality score W, the second sample data points for each category are weighted to obtain a second feature template T for each category. T represents the common feature of all second sample data points under each second sample label.

[0196] Furthermore, the second sample data can be used as the first input of the second preset model, and the second feature template can be used as the second input of the second preset model. Both can be input into the second preset model to obtain the feature similarity matrix S.

[0197] Furthermore, we define the learning objective Y for the fourth contrastive training. The learning objective Y is a matrix, which is constructed based on the second feature template of the second sample data. For each element Y[i][j] in Y, if the i-th second sample data and the j-th second sample data belong to the same second feature template, then Y[i][j] is 1; if the i-th second sample data and the j-th second sample data belong to different second feature templates, then Y[i][j] is 0.

[0198] Furthermore, the fourth cross-entropy loss can be calculated based on the feature similarity matrix S and the learning target matrix Y. The difference between the feature similarity matrix S and the ideal learning target Y can be determined through the fourth cross-entropy loss.

[0199] Furthermore, the calculated fourth cross-entropy loss can be used to iteratively update the parameters of CSi-Net and the convolutional layers using gradient descent to minimize the fourth cross-entropy loss. In each iteration, the model parameters are updated in the opposite direction of the fourth cross-entropy loss gradient, gradually improving the predictive ability of the second preset model. Once the second preset model converges or reaches the preset number of training iterations, the target model can be obtained.

[0200] By conducting third and fourth contrastive training on the first target model, the similarity between samples can be focused on in the third contrastive training stage to enhance the first target model's ability to distinguish samples of different categories. In the fourth contrastive training stage, the utilization rate of high-quality samples of the target model can be improved by evaluating the sample quality score. This enables the first target model to learn the common features of different second feature templates even in scenarios with few samples, so that the trained target model can efficiently and accurately classify the data to be classified in the future.

[0201] Step 103: Input the data to be classified and multiple first feature templates into the target model to obtain multiple feature similarities between the data to be classified and the multiple first feature templates.

[0202] In some implementations, since the first feature template represents the common features of multiple first sample data under the corresponding first sample label, in order to quickly classify the data to be classified, the first feature template most similar to the data to be classified can be determined by calculating the feature similarity between the data to be classified and each first feature template, thereby determining the target category of the data to be classified.

[0203] Feature similarity refers to the degree of similarity between the data to be classified and multiple first feature templates in the feature space. High similarity indicates that the data to be classified and the first feature templates are very close in terms of features, while low similarity indicates that the data to be classified and the first feature templates are quite different in terms of features. Similarity can be measured using various methods such as Euclidean distance, cosine similarity, and dot product.

[0204] Specifically, each first feature template can represent a general feature of the first sample data under a first sample label. Therefore, by inputting the data to be classified and multiple first feature templates into the target model, multiple feature similarities between the data to be classified and multiple first feature templates can be obtained, thereby indirectly evaluating the feature similarity between the data to be classified and each first sample label.

[0205] It is understandable that when there is no sample support set, the data to be classified can be classified based on the first feature template. When there is a sample support set, the data to be classified should be classified based on the second feature template. The methods for obtaining the first and second feature templates have been explained above and will not be repeated here.

[0206] Furthermore, when no sample support set exists, the data to be classified and multiple first feature templates can be input into the target model to obtain multiple feature similarities between the data to be classified and the multiple first feature templates. Based on the feature similarity, the multiple first feature templates with higher feature similarity are selected as target domain templates. Further, based on the calculated feature similarity between the data to be classified and each target domain template, the target domain template with the highest feature similarity to the data to be classified can be selected as the target feature template, and the target category corresponding to the target feature template can be determined. The target category is then used as the classification result for the data to be classified.

[0207] Furthermore, when a sample support set exists, the data to be classified and multiple second feature templates can be input into the target model to obtain multiple feature similarities between the data to be classified and multiple second feature templates, so as to select the second feature template with the highest feature similarity to the data to be classified as the target feature template, determine the target category corresponding to the target feature template, and use the target category as the classification result of the data to be classified.

[0208] By calculating the feature similarity between the data to be classified and the first feature template, and classifying the data accordingly, accurate classification can be achieved without relying on a large amount of sample data. At the same time, it is convenient to determine the target category based on feature similarity in the future.

[0209] Step 104: Based on multiple feature similarities, determine the first feature template with the highest feature similarity to the data to be classified as the target feature template, and determine the target category corresponding to the target feature template.

[0210] In some implementations, the feature similarity maximum represents the first feature template that is most similar to the feature of the data to be classified among multiple first feature templates. The first feature template is used to characterize the general features of a class of first sample data. Therefore, the first feature template with the highest feature similarity can be determined as the target feature template to facilitate the determination of the target category of the data to be classified.

[0211] The target feature template can be the first feature template with the highest feature similarity to the data to be classified among all the first feature templates learned by the target model. During training, the target model learns the first feature template from multiple first sample labels for each first sample label (i.e., sample category). For example, in a human pose classification task, a feature template may contain all the key features of a certain first sample label (such as "waving"), such as the angle change and trajectory of the arm swing, hand posture, body posture, etc.

[0212] The target category can be the first sample label (i.e., the sample category) corresponding to the target feature template. Since the target feature template can be the first feature template with the highest feature similarity to the data to be classified among all the first feature templates learned by the target model, the target category can also be the sample category corresponding to the first sample label with the highest feature similarity to the data to be classified among all the first sample labels.

[0213] For example, when the feature similarity between the data to be classified and the first feature template 1 is 0.8 and the feature similarity between the data and the first feature template 2 is 0.6, the first sample label corresponding to the first feature template 1 is waving, and the first sample label corresponding to the first feature template 2 is clapping, the feature similarity between the data to be classified and the first feature template 1 is high. Therefore, the first feature template 1 can be determined as the target feature template, and waving can be determined as the target category.

[0214] By using the first feature template learned by the target model, the features of the data to be classified can be captured more accurately, thereby improving the accuracy of classification. This makes it easier to determine the target category corresponding to the target feature template as the classification result of the data to be classified.

[0215] Step 105: Determine the target category as the classification result of the data to be classified.

[0216] In some implementations, in order to obtain the classification result of the data to be classified, the target category corresponding to the target feature template with the highest feature similarity to the data to be classified can be determined as the classification result of the data to be classified, thereby simplifying the classification process and improving the accuracy and efficiency of classification.

[0217] The classification result can be the final category assignment of the data to be classified, output by the target model after the target model has completed the classification task.

[0218] Specifically, by comparing the data to be classified with the first feature templates of all possible categories, the target feature template with the highest feature similarity to the data to be classified is found, and the target category corresponding to the target feature template is taken as the classification result of the data to be classified. For example, if the target category corresponding to the target feature template is waving, then the classification result of the data to be classified is waving.

[0219] The above methods can achieve efficient and accurate classification of data to be classified, meeting the needs of practical applications.

[0220] This application embodiment acquires data to be classified; acquires a preset target model and multiple first feature templates of the target model; wherein, the target model is obtained by the preset model based on a first similarity matrix obtained from the sample feature relationship between multiple first sample data, a first comparison training with preset first sample labels, and a second comparison training based on the first sample data and the first feature templates; the first feature templates are obtained by performing feature weighting calculation on multiple first sample data under each first sample label according to the first similarity matrix corresponding to the multiple first sample data; the data to be classified and the multiple first feature templates are input into the target model to obtain multiple feature similarities between the data to be classified and the multiple first feature templates respectively; based on the multiple feature similarities, the first feature template with the largest feature similarity to the data to be classified is determined as the target feature template, and the target category corresponding to the target feature template is determined; the target category is determined as the classification result of the data to be classified. In this way, the category features can be represented by the first feature template, realizing efficient learning and accurate classification of a small number of samples, reducing the dependence on traditional large-scale sample training, thereby reducing training costs. At the same time, since the first feature template can accurately reflect the essential features of similar data, the classification result can be determined more accurately by matching the similarity between the data to be classified and the first feature template. In summary, this application can improve the accuracy of data classification while reducing the training cost of the model.

[0221] Please refer to Figure 6 In some implementations, combined with Figure 6 The overall implementation process of this application is described below.

[0222] For example, for gesture recognition tasks based on CSI data, the target model proposed in this application is CSi-Net. The specific training and application process of CSi-Net is as follows:

[0223] First, sample data was collected. Specifically, an ESP32-S3 receiver was used to collect CSI data, with a sampling rate of 8Hz. Seven volunteers performed six different hand gestures (pushing hands left and right, pushing hands up and down, pushing hands forward and backward, spinning clockwise, clapping, and waving), each lasting for one minute. The collected gestures were then divided into a training set, with each training set containing multiple first-sample data points, and each first-sample data point corresponding to a first-sample label.

[0224] Furthermore, the eighth volunteer repeated the above actions for one minute. The data from the first 3 seconds was used as the support set, and the remaining data was used as the test set. The data in the test set could be used as the data to be classified to test the application effect of the target model. Furthermore, a non-overlapping sliding window could be used to divide all data into 1-second samples. For example, the 3 seconds of data in the support set corresponded to 3 samples. Each support set had multiple second samples, and each second sample corresponded to a second sample label.

[0225] For example, in the first comparative training phase, 64 first sample data can be randomly selected from the sample training set and input into CSi-Net to calculate a 64x64 first similarity matrix S1. Simultaneously, a learning target Y1 is defined, with a size of 64x64. The value of Y is determined based on the first sample label: first sample data with the same first sample label (gesture in this embodiment) have a value of 1, while first sample data with different first sample labels have a value of 0, thus obtaining the matrix corresponding to Y1.

[0226] Furthermore, the first cross-entropy loss can be calculated based on the first similarity matrix S1 and the learning target Y1, and the parameters of CSi-Net can be adjusted based on the first cross-entropy loss to obtain the first preset model.

[0227] Furthermore, in the second contrastive training phase, also known as the template learning phase, k first sample data points can be randomly selected from the sample training set. The selection of k can be determined based on the actual situation, for example, k can be 18. The selected k first sample data points should contain all the first sample labels in the sample training set, and each second sample label should contain the same number of first sample data points.

[0228] Then, the first similarity matrix obtained from the first comparison training phase can be input into the Weight-Net network to obtain the sample quality score of each first sample data. The sample quality scores of each first sample data under each first sample label are weighted to obtain the first feature template corresponding to each first sample label.

[0229] Furthermore, the first sample data can be used as the first input and the first feature template as the second input, both fed into CSi-Net to obtain the corresponding feature similarity matrix S2. Simultaneously, a learning objective Y2 of size 18x18 is defined. Then, CSi-Net is trained based on S2 and Y2, enabling it to accurately determine the corresponding first feature template from the first sample data.

[0230] Furthermore, during the third and fourth contrastive training processes on the sample support set, the third contrastive training process is similar to the first contrastive training described above, and the fourth contrastive training process is similar to the second contrastive training described above. For example, the quality score corresponding to each second sample data is obtained through the Weight-Net network, and the general features of all second sample data under each second sample label are calculated as the second feature template, etc., which will not be elaborated here.

[0231] For example, in the process of classifying the data to be classified in the sample test set, if there are few samples, the third and fourth contrastive training can be carried out to obtain the second feature template. Then, the feature similarity between the data to be classified and the second feature template is calculated to obtain the corresponding similarity matrix. The second sample label corresponding to the second feature template with the highest feature similarity to the data to be classified is taken as the category of the data to be classified, and the classification result is output, thereby completing the classification of the data to be classified.

[0232] For example, in a zero-shot scenario, if the preset model lacks a sample support set for training and only performs first and second contrastive training, multiple first feature templates and each data to be classified can be input into the target model to obtain a similarity matrix. Based on the similarity matrix, the multiple first feature templates with the highest feature similarity to each data to be classified can be determined as target domain templates. Further, the data to be classified from the sample test set and multiple target domain templates can be input into the target model. The first sample label corresponding to the target domain template with the highest feature similarity to each data to be classified can be used as the category of the data to be classified, and the classification result can be output, thus completing the classification of the data to be classified.

[0233] This application embodiment acquires data to be classified; acquires a preset target model and multiple first feature templates of the target model; wherein, the target model is obtained by the preset model based on a first similarity matrix obtained from the sample feature relationship between multiple first sample data, a first comparison training with preset first sample labels, and a second comparison training based on the first sample data and the first feature templates; the first feature templates are obtained by performing feature weighting calculation on multiple first sample data under each first sample label according to the first similarity matrix corresponding to the multiple first sample data; the data to be classified and the multiple first feature templates are input into the target model to obtain multiple feature similarities between the data to be classified and the multiple first feature templates respectively; based on the multiple feature similarities, the first feature template with the largest feature similarity to the data to be classified is determined as the target feature template, and the target category corresponding to the target feature template is determined; the target category is determined as the classification result of the data to be classified. In this way, the category features can be represented by the first feature template, realizing efficient learning and accurate classification of a small number of samples, reducing the dependence on traditional large-scale sample training, thereby reducing training costs. At the same time, since the first feature template can accurately reflect the essential features of similar data, the classification result can be determined more accurately by matching the similarity between the data to be classified and the first feature template. In summary, this application can improve the accuracy of data classification while reducing the training cost of the model.

[0234] Please see Figure 7 This application also provides an apparatus for classifying data using a few-shot learning model, which can implement the above-mentioned method for classifying data using a few-shot learning model. The apparatus for classifying data using a few-shot learning model includes:

[0235] The first acquisition module 71 is used to acquire data to be classified.

[0236] The second acquisition module 72 is used to acquire a preset target model and multiple first feature templates of the target model; wherein, the target model is obtained by the preset model based on a first similarity matrix obtained based on the sample feature relationship between multiple first sample data, a first comparison training with preset first sample labels, and a second comparison training based on the first sample data and the first feature templates; the first feature templates are obtained by performing feature weighting calculation on multiple first sample data under each first sample label according to the first similarity matrix corresponding to the multiple first sample data;

[0237] The input module 73 is used to input the data to be classified and multiple first feature templates into the target model to obtain multiple feature similarities between the data to be classified and the multiple first feature templates respectively;

[0238] The first determining module 74 is used to determine the first feature template with the highest feature similarity to the data to be classified as the target feature template based on multiple feature similarities, and to determine the target category corresponding to the target feature template.

[0239] The second determination module 75 is used to determine the target category as the classification result of the data to be classified.

[0240] The specific implementation of the device for classifying data based on a few-shot learning model is basically the same as the specific implementation of the method for classifying data based on a few-shot learning model described above, and will not be repeated here. Subject to meeting the requirements of the embodiments of this application, the device for classifying data based on a few-shot learning model may also be equipped with other functional modules to implement the method for classifying data based on a few-shot learning model in the above embodiments.

[0241] This application also provides a computer device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described method for data classification based on a few-shot learning model. This computer device can be any smart terminal, including tablet computers, in-vehicle computers, etc.

[0242] Please see Figure 8 , Figure 8 The hardware structure of a computer device according to another embodiment is illustrated. The computer device includes:

[0243] The processor 81 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.

[0244] The memory 82 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 82 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 82 and is called and executed by the processor 81 to execute the data classification method based on a few-shot learning model according to the embodiments of this application.

[0245] Input / output interface 83 is used to implement information input and output;

[0246] The communication interface 84 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0247] Bus 85 transmits information between various components of the device (e.g., processor 81, memory 82, input / output interface 83, and communication interface 84);

[0248] The processor 81, memory 82, input / output interface 83, and communication interface 84 are connected to each other within the device via bus 85.

[0249] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method for data classification based on a few-shot learning model.

[0250] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0251] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

[0252] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.

[0253] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0254] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.

[0255] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0256] It should be understood that in this application, "at least one" and "several" refer to one or more, and "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0257] In the embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0258] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0259] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0260] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0261] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.

Claims

1. A method for data classification based on a few-shot learning model, characterized in that, The method includes: Acquire data to be classified, wherein the data to be classified is channel state information data collected when the person being tested performs a specific hand gesture; A preset target model and multiple first feature templates of the target model are obtained; wherein, the target model is obtained by a first similarity matrix obtained by the preset model based on the sample feature relationship between multiple first sample data, a first comparison training with preset first sample labels, and a second comparison training based on the first sample data and the first feature templates; the first feature templates are obtained by performing feature weighting calculation on multiple first sample data under each first sample label according to the first similarity matrix corresponding to the multiple first sample data. The multiple first feature templates are obtained as follows: based on the first similarity matrix, the sample quality score of each first sample data is determined; for each first sample label in the sample training set, the product of each first sample data in the first sample label and the corresponding sample quality score is determined, and the multiple products corresponding to the multiple first sample data under the first sample label are accumulated to obtain the sum of the first products corresponding to the first sample label; the sum of the multiple sample quality scores of the multiple first sample data under the first sample label is obtained, and the ratio of the sum of the first products to the sum of the multiple sample quality scores is used as the first feature template corresponding to the first sample label; the first sample data is image data or channel state information data; The formula for calculating the first feature template for each first sample label comprising n first sample data is as follows: ; in, The first feature template representing the label of the first sample in the i-th class, This represents the j-th first sample data of the i-th class. This represents the sample quality score corresponding to the j-th first sample data of the i-th class. The data to be classified and the plurality of first feature templates are input into the target model to obtain multiple feature similarities between the data to be classified and the plurality of first feature templates respectively; Based on the multiple feature similarities, the first feature template with the highest feature similarity to the data to be classified is determined as the target feature template, and the target category corresponding to the target feature template is determined. The target category is determined as the classification result of the data to be classified.

2. The method for data classification based on a few-shot learning model according to claim 1, characterized in that, The target model is trained in the following way: Obtain a sample training set, and perform a first comparative training and a second comparative training on the preset model based on the sample training set to obtain a first target model; When there is no sample support set for training the first target model, the first target model is used as the target model; When a sample support set exists for training the first target model, the first target model is subjected to a third and a fourth comparative training based on the sample support set to obtain the target model; wherein the sample training set and the sample support set have no intersection; and the category of the data to be classified is the same as at least one sample label contained in the sample support set.

3. The method for data classification based on a few-shot learning model according to claim 2, characterized in that, The step of acquiring a sample training set and performing a first comparative training and a second comparative training on a preset model based on the sample training set to obtain a first target model includes: The first similarity matrix is ​​obtained by inputting multiple first sample data from the training set into a preset model; wherein, the first similarity matrix is ​​used to characterize the similarity between any two first sample data. Obtain the first sample label for each of the first sample data, and determine the first cross-entropy loss of the preset model based on the similarity between any two first sample data and the first sample label; The parameters of the preset model are adjusted according to the first cross-entropy loss to obtain the first preset model after the first comparative training of the preset model; Obtain multiple first feature templates corresponding to the sample training set, and calculate the second cross-entropy loss of the first preset model based on the similarity between any two first sample data and the corresponding first feature templates; The parameters of the first preset model are adjusted according to the second cross-entropy loss to obtain the first target model after the first preset model has undergone a second comparative training.

4. The method for data classification based on a few-shot learning model according to claim 1, characterized in that, The step of determining the sample quality score of each of the first sample data based on the first similarity matrix includes: Obtain the first similarity matrix corresponding to multiple first sample data; The first similarity matrix is ​​input into the convolutional layer of the first preset model to obtain multiple sample quality scores corresponding to the multiple first sample data. The sample quality score is determined by the convolutional layer for each first sample data by determining multiple similarities between each first sample data and other multiple first sample data from the first similarity matrix, and based on the differences between the multiple similarities.

5. The method for data classification based on a few-shot learning model according to claim 2, characterized in that, When a sample support set exists for training the first target model, the first target model is subjected to third and fourth contrastive training based on the sample support set to obtain the target model, including: When a sample support set exists for training the first target model, multiple second sample data from the sample support set are input into the first target model to obtain a second similarity matrix corresponding to the multiple second sample data; wherein, the second similarity matrix is ​​used to characterize the similarity between any two second sample data. Obtain the second sample labels of the two second sample data, and determine the third cross-entropy loss of the preset model based on the similarity between any two second sample data and the second sample labels; The parameters of the first target model are adjusted according to the third cross-entropy loss to obtain a second preset model after the first target model has undergone third contrast training. Obtain multiple second feature templates corresponding to the sample support set, and calculate the fourth cross-entropy loss of the second preset model based on the similarity between any two second sample data and the corresponding second feature template; The parameters of the second preset model are adjusted according to the fourth cross-entropy loss to obtain the target model after comparative training of the second preset model.

6. The method for data classification based on a few-shot learning model according to claim 1, characterized in that, The first similarity matrix is ​​obtained from a preset model through the following steps: Multiple copies of the first sample data are made to obtain sample copy data; The first sample data is used as the first input and input into the preset model, and the sample copy data is used as the second input and input into the preset model to obtain multiple feature similarities calculated by the preset model based on the sample feature relationship of any sample between the first sample data and the sample copy data. Based on the multiple feature similarities, a first similarity matrix corresponding to multiple first sample data is obtained.

7. An apparatus for classifying data using a model based on few-shot learning, characterized in that, The device includes: The first acquisition module is used to acquire data to be classified, wherein the data to be classified is channel state information data collected when the person being tested performs a specific gesture. The second acquisition module is used to acquire a preset target model and multiple first feature templates of the target model; wherein, the target model is obtained by the preset model through a first similarity matrix obtained based on the sample feature relationship between multiple first sample data, a first comparison training performed with preset first sample labels, and a second comparison training performed based on the first sample data and the first feature templates; the first feature templates are obtained by performing feature weighting calculation on multiple first sample data under each first sample label according to the first similarity matrix corresponding to the multiple first sample data; The multiple first feature templates are obtained as follows: based on the first similarity matrix, the sample quality score of each first sample data is determined; for each first sample label in the sample training set, the product of each first sample data in the first sample label and the corresponding sample quality score is determined, and the multiple products corresponding to the multiple first sample data under the first sample label are accumulated to obtain the sum of the first products corresponding to the first sample label; the sum of the multiple sample quality scores of the multiple first sample data under the first sample label is obtained, and the ratio of the sum of the first products to the sum of the multiple sample quality scores is used as the first feature template corresponding to the first sample label; the first sample data is image data or channel state information data; The formula for calculating the first feature template for each first sample label comprising n first sample data is as follows: ; in, The first feature template representing the label of the first sample in the i-th class, This represents the j-th first sample data of the i-th class. This represents the sample quality score corresponding to the j-th first sample data of the i-th class. The input module is used to input the data to be classified and the plurality of first feature templates into the target model to obtain multiple feature similarities between the data to be classified and the plurality of first feature templates respectively; The first determining module is used to determine the first feature template with the highest feature similarity to the data to be classified as the target feature template based on the plurality of feature similarities, and to determine the target category corresponding to the target feature template; The second determining module is used to determine the target category as the classification result of the data to be classified.

8. A computer device, characterized in that, The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the data classification method based on a few-shot learning model as described in any one of claims 1 to 6.

9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method for classifying data based on a few-shot learning model as described in any one of claims 1 to 6.