Method and related equipment for object recognition based on few-sample learning model
By detecting environmental channel changes and using a small sample learning method, the Wi-Fi-based object recognition technology improves the accuracy and training efficiency of the model when the environment changes, and solves the problem of the reduction in object recognition accuracy and high resource consumption in the prior art. question.
Patent Information
- Application Number
- CN202411074110.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-07
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2044-08-07
AI Technical Summary
The existing Wi-Fi-based object recognition technology reduces the accuracy of the model when the environment changes, and the tagged sample collection and training resources required for retraining consume huge amounts, making it difficult to achieve efficient object recognition.
A model method based on few-sample learning is proposed. By detecting changes in environmental channel data, obtaining the channel data to be analyzed, and using the target model to train based on the difference information of the sample training set and auxiliary set to improve the accuracy and training of object recognition efficiency.
In the case of a small sample, the training efficiency of the model and the accuracy of object recognition are improved, the resource consumption is reduced for adapting to environmental changes, and the model's adaptability in the new environment is enhanced.
Smart Images

Figure CN118585901B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method for object recognition based on a few-sample learning model and related equipment. Background Art
[0002] Wi-Fi-based object recognition technology is widely used in attendance, security inspection and other object recognition fields. It can mainly use channel state information (CSI) for perception, and identify the current action object through the different effects of different behavior habits of different objects on CSI. In this way, privacy can be effectively protected and will not be affected by the makeup, hair and clothing of the object, and there is no need to wait in line.
[0003] However, different environments can cause significant changes in CSI, rendering the trained model invalid. It is unrealistic to collect a large number of labeled CSI samples in the new scene and retrain each time the environment changes. This requires a lot of training resources and has low training efficiency. On the other hand, there are related technologies that directly apply the training results of the source domain to the new environment, which will cause the accuracy of the model to decrease in object recognition during the application process. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to propose a method and related equipment for object recognition based on a model of few-sample learning, which can improve the training efficiency of the model in a few-sample scenario while improving the accuracy of object recognition by the trained model.
[0005] To achieve the above objectives, a first aspect of an embodiment of the present application proposes a method for object recognition based on a model of few-sample learning, the method comprising:
[0006] detecting a state of channel data of a second environment;
[0007] When the state of the channel data of the second environment changes, acquiring the channel data to be analyzed from the second environment;
[0008] Inputting the channel data to be analyzed into a target model to obtain an object label;
[0009] The target model is determined based on the difference between the first prediction result of each first sample channel data in the sample training set and the corresponding first sample object label, and based on the mean difference between the target first sample channel data in the sample training set and the second sample channel data in the sample auxiliary set under the same sample object label;
[0010] The sample training set includes first sample channel data for each object in a first environment and a first sample object label for each object among a plurality of objects;
[0011] The sample auxiliary set includes second sample channel data of the target object in the second environment and a second sample object label of each target object, the target object is an object selected from the plurality of objects, and the number of the target objects is less than the number of the objects;
[0012] The target first sample channel data and the second sample channel data belong to channel data of the same object in the first environment and the second environment respectively.
[0013] Accordingly, a second aspect of an embodiment of the present application proposes a device for object recognition based on a model of few-sample learning, the device comprising:
[0014] A detection module, used to detect the state of the channel data of the second environment;
[0015] an acquisition module, configured to acquire the channel data to be analyzed from the second environment when the state of the channel data of the second environment changes;
[0016] An input module is used to input the channel data to be analyzed into a target model to obtain an object label; wherein the target model is determined based on the difference between the first prediction result of each first sample channel data in the sample training set and the corresponding first sample object label, and based on the mean difference between the target first sample channel data in the sample training set and the second sample channel data in the sample auxiliary set under the same sample object label; the sample training set includes the first sample channel data of each object in a first environment and the first sample object label of each object among multiple objects; the sample auxiliary set includes the second sample channel data of the target object in a second environment and the second sample object label of each target object, the target object is an object selected from the multiple objects, and the number of the target objects is less than the number of the objects; the target first sample channel data and the second sample channel data belong to the channel data of the same object in the first environment and the second environment respectively.
[0017] In some embodiments, the device for object recognition based on a few-sample learning model further includes a training module for:
[0018] Inputting first sample channel data in a sample training set into a preset model to obtain a first prediction result obtained by the preset model for predicting the first sample channel data;
[0019] Determining a first loss of the preset model based on a difference between the first prediction result and a first sample object label corresponding to the first sample channel data;
[0020] Based on the sample support set in the second environment, determining a sample auxiliary set from a plurality of third sample channel data of the sample test set;
[0021] Inputting the target first sample channel data in the sample training set and the second sample channel data in the sample auxiliary set into the preset model to obtain the mean difference between the target first sample channel data and the second sample channel data under the same sample object label;
[0022] Based on the mean difference, determining a second loss of the preset model;
[0023] Constructing a target loss according to the first loss and the second loss;
[0024] The preset model is trained based on the target loss until a convergence condition of the preset model is reached to obtain a trained target model.
[0025] In some embodiments, the training practice Modules are also used to:
[0026] Acquire a sample support set corresponding to the target object in the second environment, and a fourth sample object label corresponding to each fourth sample channel data in the sample support set;
[0027] Determine a third sample object label for each of the third sample channel data according to a first characteristic distance between each of the third sample channel data in the sample test set and a plurality of the fourth sample channel data in the sample support set;
[0028] Determine, from the sample support set, a plurality of target fourth sample channel data having the same sample object label as the third sample channel data;
[0029] Calculate the evaluation index of the corresponding third sample channel data according to the plurality of target fourth sample channel data;
[0030] Based on the evaluation index corresponding to each of the third sample channel data, a plurality of the second sample channel data are determined from a plurality of the third sample channel data to obtain a sample auxiliary set.
[0031] In some embodiments, the training practice Modules are also used to:
[0032] Acquire a plurality of second characteristic distances between each of the third sample channel data and a corresponding plurality of the target fourth sample channel data;
[0033] Sorting the plurality of second characteristic distances, and selecting a target distance from the plurality of second characteristic distances according to the obtained sorting result;
[0034] Determining the confidence level of the corresponding third sample channel data according to the target distance corresponding to each third sample channel data;
[0035] Acquire a true sample object label of each of the third sample channel data, and determine a first classification accuracy of the third sample channel data based on a comparison between the true sample object label and the third sample object label;
[0036] An evaluation index of each of the third sample channel data is calculated based on the confidence and the first classification accuracy.
[0037] In some embodiments, the training practice Modules are also used to:
[0038] Inputting the target first sample channel data in the sample training set and the second sample channel data in the sample auxiliary set into the preset model to obtain a first feature vector corresponding to the target first sample channel data and a second feature vector corresponding to the second sample channel data;
[0039] The first feature vector and the second feature vector corresponding to the same sample object label are input into the second loss function preset by the preset model to obtain the mean difference between the target first sample channel data and the second sample channel data under the same sample object label.
[0040] In some embodiments, the training practice Modules are also used to:
[0041] For each sample object label, determining a mean difference between a first feature vector of the first sample channel data and a second feature vector of the second sample channel data corresponding to each sample object label;
[0042] The sample object label is used as the division dimension, and the mean difference under each sample object label is accumulated to obtain the second loss of the preset model.
[0043] In some embodiments, the training practice Modules are also used to:
[0044] Update the first parameter of the preset model based on the target loss, and input a plurality of fourth sample channel data in the sample support set into the preset model to obtain a plurality of second prediction results of the plurality of fourth sample channel data;
[0045] Compare the second prediction result with the corresponding fourth sample object label to obtain a comparison result;
[0046] Determining a second classification accuracy of the preset model under the first parameter according to the comparison result;
[0047] Repeatedly update the first parameter of the preset model based on the target loss, and input multiple fourth sample channel data in the sample support set into the preset model to obtain multiple second prediction results of the multiple fourth sample channel data; compare the second prediction result with the corresponding fourth sample object label to obtain a comparison result; determine the new second classification accuracy of the preset model under the first parameter according to the comparison result, until the number of times the new second classification accuracy remains unchanged reaches a preset number, stop training the preset model, and use the first parameter corresponding to the training round with the highest second classification accuracy as the target parameter of the target model to obtain the target model.
[0048] Correspondingly, the third aspect of the embodiments of the present application proposes a computer device, which includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, it implements the method for object recognition based on a model of few-sample learning as described in any one of the embodiments of the first aspect of the present application.
[0049] Correspondingly, the fourth aspect of the embodiments of the present application proposes a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the method for object recognition based on a model based on few-sample learning as described in any one of the embodiments of the first aspect of the present application.
[0050] The embodiment of the present application detects the state of the channel data of the second environment; when the state of the channel data of the second environment changes, obtains the channel data to be analyzed from the second environment; inputs the channel data to be analyzed into the target model to obtain the object label; wherein the target model is determined based on the difference between the first prediction result of each first sample channel data in the sample training set and the corresponding first sample object label, and based on the mean difference between the target first sample channel data in the sample training set and the second sample channel data in the sample auxiliary set under the same sample object label; the sample training set includes the first sample channel data of each object in the first environment and the first sample object label of each object among multiple objects; the sample auxiliary set includes the second sample channel data of the target object in the second environment and the second sample object label of each target object, the target object is an object selected from multiple objects, and the number of target objects is less than the number of objects; the target first sample channel data and the second sample channel data belong to the channel data of the same object in the first environment and the second environment respectively. In this way, the sample training set of the source domain and the sample auxiliary set of the target domain can be aligned according to the same sample object label. In this way, the distribution of each sample object label in the source domain and the target domain can be roughly the same through the intermediate feature space, so that the model can achieve good training results even in the case of few-sample training, thereby improving the training efficiency of the model in the few-sample scenario. At the same time, since the target model is determined based on the difference between the prediction result and the sample object label, and the mean difference between the target first sample channel data and the second sample channel data, the accuracy of the trained model in object recognition can be improved. In summary, the present application can improve the accuracy of the trained model in object recognition while improving the training efficiency of the model in the few-sample scenario. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 It is a schematic diagram of the architecture of a system for object recognition based on a model of few-sample learning provided in an embodiment of the present application;
[0052] Figure 2 is a flowchart of a method for object recognition based on a model of few-sample learning provided in an embodiment of the present application;
[0053] Figure 3 is a flowchart of the steps for training a preset model provided in an embodiment of the present application;
[0054] Figure 4 It is a network structure diagram of a preset model provided in an embodiment of the present application;
[0055] Figure 5 It is an overall flow chart of training a preset model provided in an embodiment of the present application;
[0056] Figure 6It is a functional module diagram of a device for object recognition based on a model of few-sample learning provided in an embodiment of the present application;
[0057] Figure 7 It is a schematic diagram of the hardware structure of the computer device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0059] It should be noted that, although the functional modules are divided in the device schematic diagram and the 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 above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0060] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0061] Wi-Fi-based object recognition technology is widely used in attendance, security inspection and other object recognition fields. It can mainly use channel state information (CSI) for perception, and identify the current action object through the different effects of different behavior habits of different objects on CSI. In this way, privacy can be effectively protected and will not be affected by the makeup, hair and clothing of the object, and there is no need to wait in line.
[0062] However, different environments can cause significant changes in CSI, rendering the trained model invalid. It is unrealistic to collect a large number of labeled CSI samples in new scenes and retrain each time the environment changes, which requires a lot of training resources and has low training efficiency.
[0063] On the other hand, there are related technologies that directly apply the training results of the source domain to the new environment, which will cause the accuracy of the model to decrease during the application process. Specifically, the traditional domain adaptation method is based on the assumption that = , but in fact, ≠ , which makes it difficult for the neural network to learn = The correct parameters are, therefore, = The assumption is not valid in most cases, that is, it is unreasonable to make the distribution of the entire source domain and the target domain the same in related technologies. Specifically, it can be constructed through the conditional probability formula:
[0064]
[0065]
[0066]
[0067] In the actual scenario, there are ≈ , that is, the samples of each category are balanced. Based on the above formula, if ≈ Established, it can make ≈ Therefore, the present application makes the distribution of the source domain and the target domain in each category roughly the same by finding an intermediate feature space, instead of hoping to make the distribution of the entire source domain and the target domain the same as in the related art.
[0068] Based on this, the embodiments of the present application provide a method and related equipment for object recognition based on a model of few-sample learning, which can improve the training efficiency of the model in a few-sample scenario while improving the accuracy of object recognition by the trained model.
[0069] The method and related equipment for object recognition based on a model of few-sample learning provided in the embodiments of the present application are specifically illustrated through the following embodiments. First, the system for object recognition based on a model of few-sample learning in the embodiments of the present application is described.
[0070] Please refer to Figure 1 In some implementations, an embodiment of the present application provides a system for object recognition based on a model of few-sample learning, and the system for object recognition based on a model of few-sample learning includes a terminal 11 and a server 12.
[0071] Specifically, the terminal 11 may be a device for data collection and preliminary processing. For example, the terminal 11 may be an ESP32-S3 receiver with a single antenna, which is used to collect CSI data. The terminal 11 may detect changes in the CSI data of the target environment in real time or periodically. When changes in the CSI data are detected, the collected data is preprocessed and the collected CSI data is transmitted to the server for further processing.
[0072] In some embodiments, the server 12 is a computing platform for data processing, model training and object recognition, which can perform efficient data processing, model training and parameter optimization, as well as testing and evaluation of the final model performance. After receiving the CSI data from the terminal 11, the server 12 can further process the CSI data, such as dividing samples and constructing sample training sets, sample test sets, sample support sets and sample auxiliary sets, and training the preset model through the sample training sets and sample auxiliary sets, so that the trained target model has the ability to accurately identify objects in new environments; or, after obtaining the target model, the CSI data can be directly identified.
[0073] The method for object recognition based on a few-sample learning model in the embodiments of the present application can be illustrated by the following embodiments.
[0074] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on data related to user identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first. Moreover, the collection, use, and processing of these data will comply with relevant laws, regulations, and standards. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or separate consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the user's separate permission or separate consent, the necessary user-related data for enabling the normal operation of the embodiment of the present application will be obtained.
[0075] In the embodiment of the present application, the device for object recognition based on a model of few-sample learning is described from the perspective of the device, and the device for object recognition based on a model of few-sample learning can be integrated in a computer device. Figure 2 , Figure 2 The flowchart of the method for object recognition based on a model of few-sample learning provided in the embodiment of the present application is as follows: The embodiment of the present application takes the device for object recognition based on a model of few-sample learning as an example, in which the device is specifically integrated on a terminal or a server. When the processor on the terminal or the server executes the program instructions corresponding to the method for object recognition based on a model of few-sample learning, the specific process is as follows:
[0076] Step 101: Detect the state of channel data of the second environment.
[0077] It is understandable that in order to accurately and timely identify the object when it appears, the state of the channel data of the second environment where the object is located can be detected to determine whether the corresponding channel data needs to be collected.
[0078] Among them, the second environment can be a specific environment or scene for object recognition. For example, when identifying a person punching in, the area where the person punches in is the second environment; when conducting a security check, the security check area is the second environment. The second environment can be multiple new environments that are different from the first environment, and different second environments can be processed in the manner of this application. Furthermore, the second environment can be adjusted according to actual conditions, and it is only necessary to ensure that the channel data to be analyzed of the object to be identified can be collected through the second environment.
[0079] The channel data may be a series of parameters or features generated by the characteristics of the wireless channel in the wireless communication system. The channel data may include the amplitude, phase, delay, etc. of the signal, and may be used to characterize the changes of the wireless signal during the transmission process.
[0080] In some implementations, the state of the channel data of the second environment may be detected periodically or in real time. The time interval for the timed detection setting may be 5 seconds, 10 seconds, etc. Further, the detection method may be adaptively adjusted according to different time periods, for example, real-time detection may be used during peak hours, and timed detection may be used during periods with few people, and the time interval for the timed detection may be set by the user.
[0081] Exemplarily, the status of the channel data may be collected by a wireless sensor, a base station, or a mobile device.
[0082] By detecting the state of the channel data of the second environment, it is possible to subsequently determine whether the state of the channel data has changed, so as to obtain the channel data to be analyzed when the state of the channel data has changed.
[0083] Step 102: when the state of the channel data of the second environment changes, the channel data to be analyzed is obtained from the second environment.
[0084] In some implementations, when the state of the channel data of the second environment changes, it indicates that a new object may enter the second environment. At this time, the new object needs to be identified to accurately and timely identify the new object.
[0085] The channel data to be analyzed may be channel data corresponding to the object to be identified, and may include channel amplitude, phase, delay, etc., which are used to reflect the characteristics of the wireless signal during the propagation process.
[0086] Specifically, when a new object (such as a person) enters the environment, it will interfere with and block the wireless signal, change the signal strength and propagation path, and thus change the state of the channel data. Therefore, whether a new person enters the second environment can be determined by whether the state of the channel data has changed, so as to more accurately detect and identify the object.
[0087] By acquiring the channel data to be analyzed from the second environment, it is possible to facilitate the subsequent timely and accurate identification of the entering object.
[0088] Step 103: input the channel data to be analyzed into the target model to obtain an object label.
[0089] The target model is determined based on the difference between the first prediction result of each first sample channel data in the sample training set and the corresponding first sample object label, and based on the mean difference between the target first sample channel data in the sample training set and the second sample channel data in the sample auxiliary set under the same sample object label;
[0090] The sample training set includes first sample channel data for each object in a first environment and a first sample object label for each object among the plurality of objects;
[0091] The sample auxiliary set includes second sample channel data of the target object in the second environment and a second sample object label of each target object, the target object is an object selected from a plurality of objects, and the number of the target objects is less than the number of the objects;
[0092] The target first sample channel data and the second sample channel data belong to channel data of the same object in a first environment and a second environment respectively.
[0093] In some embodiments, in order to identify objects and improve the safety of places and the efficiency of personnel identification, the channel data to be analyzed corresponding to the object can be input into a pre-trained target model to obtain the object label of the object to be analyzed, that is, the specific category. In this way, the object can be identified quickly and accurately.
[0094] Among them, the target model can be a machine learning model for identifying object labels, such as a support vector machine, a convolutional neural network, a recurrent neural network, etc.
[0095] The object label may be a specific category of the object to be analyzed, and the corresponding object label may be directly obtained by inputting the channel data to be analyzed into the target model.
[0096] Among them, the sample training set can be a data set used to train the target model. By inputting the first sample channel data in the sample training set into the model for training, and adjusting the parameters of the model in combination with the corresponding first sample object label, the model can learn the characteristics of the data and the relationship between these characteristics and labels.
[0097] The first sample channel data may be sample channel data in a sample training set. For example, the first sample channel data may be channel data when user A passes through an office building (a first environment), channel data when user B passes through the first environment, and so on.
[0098] The first prediction result may be a predicted object label output by the preset model after the first sample channel data is input into the preset model, and the first prediction result may be used to feedback the classification performance of the current model. For example, the first prediction result corresponding to the first sample channel data is user A.
[0099] Among them, the first sample object label can be the real object label of the first sample channel data, which is used to perform a difference comparison with the first prediction result to verify the classification performance of the preset model. For example, the first sample object label corresponding to the first sample channel data is user B.
[0100] The target first sample channel data may be channel data of a target object in a first environment, and the target object to which the target first sample channel data belongs has corresponding second sample channel data in a second environment.
[0101] Among them, the sample auxiliary set can be a data set composed of sample channel data with higher evaluation indicators selected from the sample test set, which is used to enable the preset model to align sample object labels in the first environment and the second environment.
[0102] The second sample channel data may be channel data acquired from a target object in the second environment. The target object to which the second sample channel data belongs has corresponding target first sample channel data in the first environment.
[0103] Among them, the first environment can be the environment when the first sample channel data is collected. It can be understood that since the channel state information is a description of the propagation characteristics of the wireless signal in different environments, and these characteristics will change with the change of the environment. For example, factors such as the position of the object, the material of the wall, and the movement of people will affect the propagation path and strength of the wireless signal. Therefore, in cross-environment applications, it is necessary to consider the impact of environmental changes on the channel data of the target object to ensure that the target model also has better performance in the new environment. Therefore, in addition to using the first sample channel data of the first environment to train the preset model, it is also necessary to align the sample object labels of the second sample channel data in the second environment with the target sample channel data of the first environment.
[0104] The second sample object label may be a real label corresponding to the second sample channel data.
[0105] Exemplarily, if you want to train a target model to identify the identity of employees in different environments, you can train the preset model in the following way. Without violating the concept of this application, the following examples can be applied to other environments or scenarios. First, if the first environment is an office building, the first sample channel data of employees such as users A, B, and C passing through the office building has been collected. The first sample channel data constitutes a sample training set and has a corresponding first sample object label, such as the first sample object label of user A is A, that of user B is B, and so on.
[0106] Furthermore, if the second environment is a company access control, the target objects that need to be identified by the company access control are determined, such as user A and user B. In the second sample channel data of the company access control, the second sample channel data constitutes a sample auxiliary set and has a corresponding second sample object label.
[0107] At this time, the channel data of user A in the office building is input into the preset model, and the first prediction result output by the preset model may be A or other labels. The first loss is determined based on the first prediction result and the first sample object label. Furthermore, the sample channel data of user A in the office building and the company access control can be compared, and the second loss can be constructed using the mean difference of the characteristic values of the two. Through the second loss, the preset model can align the target first sample channel data and the second sample channel data corresponding to user A based on the sample object label A, so as to ensure that when the sample size of the company access control is small, the experience gained from the sample training set can be used to enable the preset model to accurately identify user A in the company access control.
[0108] Furthermore, the preset model can be trained by constructing a target loss through the first loss and the second loss, and the model parameters can be continuously adjusted during the training process, so that the model can learn the relationship between the characteristics of the sample channel data and the corresponding sample object labels from the existing sample training set in the first environment, and implement the application in the second environment, so that the target model can also accurately identify the second sample channel data in the second environment.
[0109] The embodiment of the present application detects the state of the channel data of the second environment; when the state of the channel data of the second environment changes, obtains the channel data to be analyzed from the second environment; inputs the channel data to be analyzed into the target model to obtain the object label; wherein the target model is determined based on the difference between the first prediction result of each first sample channel data in the sample training set and the corresponding first sample object label, and based on the mean difference between the target first sample channel data in the sample training set and the second sample channel data in the sample auxiliary set under the same sample object label; the sample training set includes the first sample channel data of each object in the first environment and the first sample object label of each object among multiple objects; the sample auxiliary set includes the second sample channel data of the target object in the second environment and the second sample object label of each target object, the target object is an object selected from multiple objects, and the number of target objects is less than the number of objects; the target first sample channel data and the second sample channel data belong to the channel data of the same object in the first environment and the second environment respectively. In this way, the sample training set of the source domain and the sample auxiliary set of the target domain can be aligned according to the same sample object label. In this way, the distribution of each sample object label in the source domain and the target domain can be roughly the same through the intermediate feature space, so that the model can achieve good training results even in the case of few-sample training, thereby improving the training efficiency of the model in the few-sample scenario. At the same time, since the target model is determined based on the difference between the prediction result and the sample object label, and the mean difference between the target first sample channel data and the second sample channel data, the accuracy of the trained model in object recognition can be improved. In summary, the present application can improve the accuracy of the trained model in object recognition while improving the training efficiency of the model in the few-sample scenario.
[0110] Please refer to Figure 3 In some implementations, in order to enable the model to quickly adapt to the new environment and accurately identify the sample channel data of the new environment when there are only a few sample channel data in the new environment, the preset model can be trained so that the trained target model can have both accurate classification capabilities and good adaptability to the new environment. For example, the target model is trained in the following way:
[0111] Step 201: input first sample channel data in a sample training set into a preset model to obtain a first prediction result obtained by the preset model for predicting the first sample channel data.
[0112] In some embodiments, the first sample channel data can be input into a preset model, and the preset model can process the input data according to the current model parameters and output a first prediction result, so as to facilitate subsequent comparison with the first sample object label of the first sample channel data according to the first prediction result to determine the classification performance of the preset model under the current model parameters, so as to facilitate subsequent improvement of the preset model. Exemplarily, the first sample channel data is the sample channel data corresponding to user A, and the first prediction result obtained may be for user A or user B, that is, the first prediction result of the preset model for the first sample channel data may not be accurate.
[0113] Step 202: Determine a first loss of a preset model based on a difference between a first prediction result and a first sample object label of corresponding first sample channel data.
[0114] Among them, the first loss can be a cross entropy loss, which is a function used to measure the difference between the first prediction result (predicted value) of the preset model for the first sample channel data and the first sample object label (true value), that is, a quantitative indicator of the difference between the first prediction result and the first sample object label.
[0115] Specifically, the lower the first loss is, the more accurate the prediction of the first sample channel data by the preset model is. Through back propagation or other optimization algorithms, the preset model can adjust the model parameters according to the value of the first loss to reduce the loss.
[0116] Through the above method, the first loss of the preset model can be determined, so as to improve the classification performance of the preset model based on the subsequent combination of the first loss and the second loss.
[0117] Step 203: determine a sample auxiliary set from a plurality of third sample channel data of the sample test set based on the sample support set in the second environment.
[0118] Among them, the sample support set can be the sample channel data in the second environment, the sample support set can be used to screen the sample auxiliary set from the sample test set, and the sample support set can also be used to make early stopping decisions during the training process of the preset model, that is, to decide when to stop training the preset model according to the change in the accuracy of the preset model on the support set.
[0119] The sample test set may be a data set in the second environment, and may be used to select second sample channel data with higher quality.
[0120] The third sample channel data may be sample channel data on a sample test set, and the third sample channel data, the second sample channel data, and the channel data to be analyzed are all in the second environment.
[0121] In some embodiments, in order to prevent the quality of the sample support set from affecting the classification accuracy of the preset model in the second environment, the third sample channel data in the sample test set can be classified based on the sample support set, and the evaluation index of each third sample channel data can be determined, so as to select the second sample channel data with a higher evaluation index from multiple third sample channel data to train the preset model.
[0122] Through the above method, a sample auxiliary set with higher quality and more obvious classification characteristics can be determined from multiple third sample channel data of the sample test set, so as to facilitate the subsequent determination of the mean difference between the target first sample channel data and the second sample channel data under the same sample object label.
[0123] In some implementations, in order to improve the accuracy and stability of the target model in cross-environment applications, overcome the limitations of traditional methods, and achieve more efficient cross-domain recognition, a sample auxiliary set can be constructed to introduce high-confidence samples, so that the alignment process of the preset model in the feature space is more stable and accurate. For example, step 203 may include:
[0124] (203.1) Obtain a sample support set corresponding to the target object in the second environment, and a fourth sample object label corresponding to each fourth sample channel data in the sample support set;
[0125] (203.2) determining a third sample object label for each third sample channel data according to a first characteristic distance between each third sample channel data in the sample test set and a plurality of fourth sample channel data in the sample support set;
[0126] (203.3) determining, from the sample support set, a plurality of target fourth sample channel data having the same sample object label as the third sample channel data;
[0127] (203.4) Calculating an evaluation index of corresponding third sample channel data according to a plurality of target fourth sample channel data;
[0128] (203.5) Based on the evaluation index corresponding to each third sample channel data, determine a plurality of second sample channel data from the plurality of third sample channel data to obtain a sample auxiliary set.
[0129] The fourth sample channel data may be sample channel data in the sample support set.
[0130] The fourth sample object label may be a true sample object label of the first sample channel data.
[0131] The first characteristic distance may be the Euclidean distance between the third sample channel data and the fourth sample channel data. Exemplarily, the first characteristic distance may also be the Manhattan distance, the Mahalanobis distance, the cosine similarity, and the like.
[0132] The third sample object label may be a sample object label of the third sample channel data determined by the first characteristic distance. Since the third sample object in the original sample test set does not have a sample object label, the third sample object label of the third sample channel data may be determined based on the fourth sample object label of each fourth sample channel data in the sample support set.
[0133] The target fourth sample channel data may be fourth sample channel data having the same sample object label as the corresponding third sample channel data. For example, if the third sample object label of the third sample channel data is A, and the fourth sample object label of the fourth sample channel data is also A, then the fourth sample channel data is the target sample channel data.
[0134] The evaluation index may be a comprehensive index of the confidence and accuracy of the third sample channel data, and is used to evaluate the quality of the third sample channel data. Further, the evaluation index may also be one of the confidence and the accuracy.
[0135] Exemplarily, when the first characteristic distance is the Euclidean distance, the third sample object label of each third sample channel data can be determined by calculating the Euclidean distance between each third sample channel data and all fourth sample channel data in the sample support set. Exemplarily, for each third sample channel data, k fourth sample channel data with the closest Euclidean distance can be selected, and the fourth sample object labels of the k fourth sample channel data can be obtained, and the fourth sample object label with the highest frequency among the k fourth sample channel data is used as the third sample object label of the third sample channel data. Further, the value of k can be determined according to actual conditions.
[0136] For example, when the k fourth sample channel data whose Euclidean distances are closest to the third sample channel data are channel data A, whose corresponding fourth sample object label is 1, channel data B, whose corresponding fourth sample object label is 1, channel data C, whose corresponding fourth sample object label is 1, channel data D, whose corresponding fourth sample object label is 2, and channel data E, whose corresponding fourth sample object label is 1, then the third sample object label of the third sample channel data is 1.
[0137] Further, based on the third sample object label corresponding to the third sample channel data, the fourth sample channel data with the same sample object label can be determined from the sample support set. For example, if the third sample object label of the third sample channel data is A, then all fourth sample channel data with the sample object label A can be determined from the sample support set as the target fourth sample channel data.
[0138] Further, the confidence of the third sample channel data and the accuracy of classification of the third sample channel data can be determined according to the multiple target fourth sample channel data corresponding to each third sample channel data, and the evaluation index of the third sample channel data can be calculated according to the confidence and accuracy. Further, only the confidence or accuracy can be used as the evaluation index of the third sample channel data.
[0139] Exemplarily, second sample channel data with a higher evaluation index may be selected from the third sample channel data, and a sample auxiliary set may be constructed based on the plurality of second sample data.
[0140] Through feature distance matching and calculation of evaluation indicators, the third sample object label of each third sample channel data can be effectively determined, and the second sample channel data with higher quality can be selected to construct a sample auxiliary set. By utilizing the labeled data in the sample support set, a systematic approach is provided to classify and optimize the test data, making the results more reliable and accurate.
[0141] In some implementations, in order to construct a reliable sample auxiliary set and reduce the impact of erroneous samples, high-quality samples can be effectively selected and utilized by calculating the evaluation index of each third sample channel data, thereby improving the performance of the preset model in different domain environments. For example, (203.4) includes:
[0142] (203.4.1) Obtain multiple second characteristic distances between each third sample channel data and the corresponding multiple target fourth sample channel data;
[0143] (203.4.2) sorting the plurality of second characteristic distances, and selecting a target distance from the plurality of second characteristic distances according to the sorting result;
[0144] (203.4.3) Determine the confidence level of the corresponding third sample channel data according to the target distance corresponding to each third sample channel data;
[0145] (203.4.4) Obtaining a true sample object label for each third sample channel data, and determining a first classification accuracy of the third sample channel data based on comparing the true sample object label with the third sample object label;
[0146] (203.4.5) Based on the confidence and the first classification accuracy, calculate the evaluation index of each third sample channel data.
[0147] The second characteristic distance may be the distance between the third sample channel data and the target fourth sample channel data in the characteristic space, and is used to evaluate the similarity between the third sample channel data and the fourth sample channel data. For example, the second characteristic distance may be Euclidean distance, Manhattan distance, Mahalanobis distance, or cosine similarity, etc.
[0148] The sorting result may be a result obtained by sorting according to the second characteristic distance between the third sample channel data and the fourth sample channel data, and the sorting method may be sequential sorting or reverse sorting.
[0149] The target distance may be the smallest second characteristic distance selected from the sorting results. For example, the second characteristic distances may be sorted in reverse order to obtain 4, 3, 3, 2, 1, and 1 is the target distance.
[0150] Among them, the confidence level can be an indicator for measuring the reliability of the third sample channel data label, and the confidence level can be calculated based on the target distance, specifically the inverse of the target distance. For example, if the target distance is 2, the confidence level is 1 / 2.
[0151] The real sample object label may be a real label of the third sample channel data, and the real sample object label of the third sample channel data may be determined manually or based on reliable technical means.
[0152] The first classification accuracy may be the accuracy of classification of the third sample channel data, and may be calculated based on the matching degree between the third sample object label and the true sample object label.
[0153] Exemplarily, obtaining multiple second characteristic distances between each third sample channel data and the corresponding multiple target fourth sample channel data
[0154] For example, if there is a third sample channel data T3 and three target fourth sample channel data T41, T42, T43, by calculating the Euclidean distance between T3 and T41, T42, T43 respectively (which can be replaced by other distance metrics, such as Manhattan distance, etc.), the following results are obtained: d(T3, T41)=5, d(T3, T42)=3, d(T3, T43)=8, and the target distance is the smallest second characteristic distance, that is, 3. Further, the confidence level is determined to be 1 / 3.
[0155] Furthermore, the real sample object label of T3 can be obtained. If the real sample object label of T3 is A and the third sample object label is also A, the first classification accuracy of the third sample channel data is 1 (or 100%). Furthermore, the evaluation index can be calculated by combining the confidence and the first classification accuracy. The specific evaluation index can be the product of the confidence and the first classification accuracy, which is 1 / 3 in this example.
[0156] Exemplarily, a preset number or a preset ratio of third sample channel data may be determined based on the evaluation index corresponding to each third sample channel data, and the specific selection rule is to select the third sample channel data with a higher evaluation index, and the preset number and the preset ratio may be set according to the actual situation. For example, if the preset number is 15, then the 15 third sample channel data with the highest evaluation index may be selected as the second sample channel data, and the sample auxiliary set may be constructed based on the 15 third sample channel data.
[0157] By combining confidence and classification accuracy to evaluate the reliability of the third sample channel data, and selecting samples with higher evaluation indicators to construct a sample auxiliary set, the accuracy and reliability of sample channel data selection can be effectively improved, thereby enhancing the overall performance of the model.
[0158] Step 204 , input the target first sample channel data in the sample training set and the second sample channel data in the sample auxiliary set into a preset model to obtain the mean difference between the target first sample channel data and the second sample channel data under the same sample object label.
[0159] In some embodiments, in order to make the distribution of the source domain and the target domain in each sample object label (i.e., each category) roughly the same, the intermediate feature space of the source domain (sample training set) and the target domain (sample auxiliary set) can be determined to more accurately align the category distribution in the source domain and the target domain, thereby further improving the domain adaptation effect of the target model.
[0160] The preset model may be a model to be trained. After the preset model is trained and converged, a target model may be obtained.
[0161] The mean difference may be the mean difference between the target first sample channel data and the second sample channel data under the same sample object label.
[0162] Please refer to Figure 4 , Figure 4is the network structure of the preset model. Exemplarily, for each sample object label, the target first sample channel data and the second sample channel data of the same sample object label can be input into the Resnet (residual) network, and the Resnet network will output the feature vectors of the target first sample channel data and the second sample channel data, and then the feature vectors of the same sample object label are input into the Marginalized Kernel Maximum Mean Discrepancy (MK-MMD) loss function to calculate the mean difference between the target first sample channel data and the second sample channel data under the same sample object label.
[0163] Through the above method, the mean difference between the target first sample channel data and the second sample channel data under the same sample object label can be obtained, so as to facilitate the subsequent determination of the second loss of the preset model.
[0164] In some implementations, in order to effectively reduce the distribution difference between different channel data under the same sample object label and improve the generalization ability of the target model in the second environment, the mean difference between the target first sample channel data and the second sample channel data under the same sample object label can be determined so that the target first sample channel data and the second sample channel data under the same sample object label are aligned in the intermediate feature space. For example, step 204 may include:
[0165] (204.1) Inputting the target first sample channel data in the sample training set and the second sample channel data in the sample auxiliary set into a preset model to obtain a first feature vector corresponding to the target first sample channel data and a second feature vector corresponding to the second sample channel data;
[0166] (204.2) Inputting the first eigenvector and the second eigenvector corresponding to the same sample object label into the second loss function pre-set in the preset model, obtains the mean difference between the target first sample channel data and the second sample channel data under the same sample object label.
[0167] The first feature vector may be a vector generated in the feature extraction stage of the preset model, representing the representation of the target first sample channel data in the intermediate feature space. The first feature vector may be used to characterize the essential attributes of the target first sample channel data.
[0168] The second feature vector may be a vector generated in the feature extraction stage of the preset model, representing the representation of the second sample channel data in the intermediate feature space. The first feature vector may be used to characterize the essential attributes of the second sample channel data.
[0169] The second loss function may be a MK-MMD loss function. The second loss function is used for the mean difference between the target first sample channel data and the second sample channel data under each sample object label.
[0170] Exemplarily, the target first sample channel data and the second sample channel data with the same sample object label can be input into the preset model. For example, for the sample object label A, multiple target first sample channel data can be extracted from the sample training set, and multiple second sample channel data can be extracted from the sample auxiliary set. The multiple target first sample channel data and the multiple second sample channel data are simultaneously input into the preset model, and the Resnet network of the preset model will output the first feature vector of the target first sample channel data and the second feature vector of the second sample channel data. For example, the first feature vector corresponding to the multiple target first sample channel data is [0.5, 0.3, 0.2], and the second feature vector corresponding to the multiple second sample channel data is [0.4, 0.35, 0.25].
[0171] Furthermore, the mean difference between the first eigenvector and the second eigenvector can be calculated by the MK-MMD loss function. Exemplarily, the difference between the mean embeddings of the first eigenvector and the second eigenvector in the intermediate feature space, or the maximum mean difference can be calculated. For example, it can be the difference between the mean embeddings of the first eigenvector and the second eigenvector in the Maximum Mean Discrepancy (RKHS).
[0172] By calculating the mean difference between the first eigenvector and the second eigenvector corresponding to each sample object label, the preset model can identify and reduce the inconsistencies between different data sources (such as sample training sets and sample auxiliary sets), thereby improving the generalization ability of the preset model in an unseen second environment.
[0173] Step 205: Determine a second loss of the preset model based on the mean difference.
[0174] In some embodiments, in order to help the preset model learn how to make different sample channel data of the same sample object label as similar as possible in the feature space, the second loss of the preset model can be determined based on the mean difference, so that the sample channel data belonging to the same sample object label in the sample training set and the sample auxiliary set can be aligned in category, further improving the generalization ability of the target model and the accuracy of classification.
[0175] The second loss can be obtained by accumulating the mean differences corresponding to multiple sample object labels.
[0176] Exemplarily, if there are sample object label 1 and sample object label 2. For sample object label 1, the mean difference 1 corresponding to the first eigenvector of multiple target first sample channel data and the second eigenvector of multiple second sample channel data can be calculated; for sample object label 2, the mean difference 2 corresponding to the first eigenvector of multiple target first sample channel data and the second eigenvector of multiple second sample channel data can be calculated; by adding the mean difference 1 and the mean difference 2, the second loss of the preset model can be obtained.
[0177] By introducing the second loss, the similarity of different sample channel data belonging to the same sample object label in the sample training set and the sample auxiliary set in the feature space is enhanced. This category alignment helps the preset model to better learn the commonalities of different sample channel data, thereby improving the performance of the target model when processing unknown data, so that the preset model can achieve efficient learning even with a few samples.
[0178] In some implementations, in order to improve the generalization ability of the target model, the second sample channel data of each second sample object label in the sample auxiliary set may be aligned with the first sample channel data in the sample training set having the same sample object label, so step 205 may include:
[0179] (205.1) For each sample object label, determine a mean difference between a first eigenvector of the first sample channel data and a second eigenvector of the second sample channel data corresponding to each sample object label;
[0180] (205.2) Using the sample object label as the division dimension, the mean difference under each sample object label is accumulated to obtain the second loss of the preset model.
[0181] In some embodiments, for each sample object label, multiple second sample channel data of the sample auxiliary set and multiple target first sample channel data of the sample training set under the same sample object label can be obtained, and the multiple second sample channel data and the multiple target first sample channel data are simultaneously input into the Resnet network of the preset model to obtain the first feature vectors corresponding to the multiple target first sample channel data and the second feature vectors corresponding to the multiple second sample channel data, and then the mean difference between the first feature vector and the second feature vector under the sample object label is calculated.
[0182] Furthermore, the sample object label can be used as a division dimension, that is, different sample object labels correspond to different dimensions, each dimension corresponds to a mean difference, that is, one sample object label corresponds to a mean difference, and the mean differences of all dimensions are added together to obtain the second loss of the preset model.
[0183] By calculating the second loss of the preset model, the above method, the beneficial effect of calculating the MK-MMD loss function is that when the samples of each category are balanced and the conditional distributions of the source domain and the target domain are similar, it can ensure the distribution of source and target domain samples of different categories in the feature space. This is more effective than the traditional method of hoping to make the distribution of the overall source domain and target domain the same in the feature space. In this way, the performance of the model in cross-domain tasks can be improved, especially when the conditional distributions of the source domain and the target domain are similar.
[0184] Step 206: construct a target loss based on the first loss and the second loss.
[0185] In some embodiments, in order to better solve the distribution alignment problem of the target model in adapting to the new environment, the network training can be performed by combining the first loss (cross entropy loss) and the second loss (MK-MMD loss), so that the target model can ensure classification performance while minimizing the distribution difference.
[0186] Please refer to Figure 4 In some embodiments, when the first loss function is a cross entropy loss function and the second loss function is a MK-MMD loss function, for the feature vector under the same sample object label, the first sample channel data in the sample training set can be used to train a preset model, and the first loss can be calculated using the cross entropy loss function.
[0187] At the same time, the MK-MMD loss function is added to the feature space extracted by the Resnet network. Specifically, when calculating the second loss, it is necessary to calculate the second loss for different sample object labels, that is, to construct different MK-MMD losses (i.e., second losses) for sample channel data with different sample object labels in the sample training set and the sample auxiliary set. The final target loss formula is:
[0188]
[0189] in, is the cross entropy loss, i.e. the first loss, For the second loss, represents the set of all second sample channel data with the second sample object label i in the sample training set, Represents the set of all target first sample channel data with the first sample object label i in the sample auxiliary set.
[0190] The first loss can make the target model have better classification performance, and the second loss can minimize the distribution difference between the source domain and the target domain. The first loss and the second loss are added to get the target loss, which can facilitate the subsequent training of the preset model according to the target loss, thereby improving the training efficiency.
[0191] Step 207: Train the preset model based on the target loss until the convergence condition of the preset model is reached to obtain a trained target model.
[0192] In some embodiments, the preset model can be trained based on the target loss obtained by combining the first loss and the second loss, and the first parameter of the preset model can be optimized in the process until the convergence condition is reached. The training of the preset model can be stopped to obtain the trained target model.
[0193] Exemplarily, the convergence condition may be that the number of times the preset model is trained reaches a preset number of training times, for example, reaches a preset 100 times; in some embodiments, after each adjustment of the first parameter of the preset model, the fourth sample channel data in the sample support set may be input into the preset model with the first parameter adjusted, and the fourth sample channel data in the sample support set may be input into the preset model with the first parameter adjusted. Figure 4 The second prediction result output by the linear layer is compared with the fourth sample object label of the fourth sample channel data, and the classification accuracy is calculated. When the classification accuracy remains unchanged for a consecutive number of times, for example, when the classification accuracy remains unchanged for 30 times, the training of the preset model can be stopped to obtain the target model.
[0194] Through the above method, the trained target model can have good classification ability in the second environment, while improving the performance of the target model.
[0195] In some implementations, in order to solve the problem that the few-sample learning method in the related art cannot find the optimal parameters through early stopping, etc., the sample support set data can be used to design an early stopping scheme, and the optimal model parameters can be determined by the accuracy of the preset model on the sample support set, so as to effectively avoid overfitting and ensure the generalization ability of the target model. Exemplarily, step 207 may include:
[0196] Update the first parameter of the preset model based on the target loss, and input a plurality of fourth sample channel data in the sample support set into the preset model to obtain a plurality of second prediction results of the plurality of fourth sample channel data;
[0197] Compare the second prediction result with the corresponding fourth sample object label to obtain a comparison result;
[0198] Determine the second classification accuracy of the preset model under the first parameter according to the comparison result;
[0199] Repeatedly update the first parameter of the preset model based on the target loss, and input multiple fourth sample channel data in the sample support set into the preset model to obtain multiple second prediction results of the multiple fourth sample channel data; compare the second prediction result with the corresponding fourth sample object label to obtain a comparison result; determine the new second classification accuracy of the preset model under the first parameter according to the comparison result, until the new second classification accuracy remains unchanged for a preset number of times, stop training the preset model, and use the first parameter corresponding to the training round with the highest second classification accuracy as the target parameter of the target model to obtain the target model.
[0200] The second prediction result may be a prediction output after a preset model performs prediction after receiving a plurality of fourth sample channel data, and the second prediction result is a judgment on the category to which the fourth sample channel data belongs.
[0201] Among them, the comparison result can be the result obtained by comparing the second prediction result of the preset model with the corresponding fourth sample object label, and the comparison result can be the same or different, so as to evaluate the prediction accuracy of the preset model.
[0202] The second classification accuracy may be the accuracy rate of correct classification of the preset model under preset parameter settings, which is used to characterize the ratio of the number of sample channel data correctly predicted by the preset model to the total number of sample channel data.
[0203] Among them, the first parameter can be a variable inside the preset model, which determines the specific form and decision boundary of the preset model, and the first parameter can be updated by the target loss.
[0204] Among them, the preset number of times can be the number of times the second classification accuracy set for the preset model does not change, and the preset number of times can be adjusted according to actual conditions, for example, the preset number of times can be 20 times, 30 times, etc.
[0205] Exemplarily, when there are 10 fourth sample channel data, and the comparison result indicates that there are 6 fourth sample channel data that are accurately classified by the preset model, then the second classification accuracy is 60%.
[0206] Exemplarily, after each update of the first parameter of the preset model, multiple fourth sample channel data of the sample support set are input into the preset model with the updated first parameter, and the second classification accuracy of the preset model for the multiple fourth sample channel data is calculated. The second classification accuracy is compared with the second classification accuracy calculated after the last adjustment of the first parameter, and the number of times the second classification accuracy remains unchanged continuously is recorded. When the number of times the second classification accuracy remains unchanged continuously exceeds the preset number, the training of the preset model can be stopped, and the first parameter corresponding to the highest second classification accuracy in history is used as the target parameter of the target model to obtain a trained target model.
[0207] Please refer to Figure 5 In some embodiments, in combination Figure 5 An embodiment of the overall training process of the present application is introduced.
[0208] For example, an ESP32-S3 with a single antenna can be used as a receiver, with a sampling rate of 100Hz, connected to a home Wi-Fi router to collect sample channel data. First, 8 volunteers were asked to collect 6 minutes of sample channel data in environment 1 and annotate to build a sample training set. Then, 8 volunteers were asked to collect 3 seconds of data in environment 2 and annotate to build a sample support set. Next, 8 volunteers were asked to enter and exit environment 2 at will (only 1 person entered the environment at a time), and about 6 minutes of data were collected to build a sample test set (no need to record the specific people entering, that is, no need to annotate the corresponding sample object labels).
[0209] Furthermore, the amplitude values of all sample channel data can be used as input to the preset model, and the interpolation method can be used to fill the missing data. Then, the input data is divided into multiple 1-second long samples using a non-overlapping sliding window. Therefore, 3 seconds of data in the sample support set corresponds to 3 fourth sample channel data, and the description here corresponds to a 3-shot scene.
[0210] Furthermore, the K-Nearest Neighbors (KNN) algorithm can be used to preliminarily classify the third sample channel data set in the sample test set to obtain the third sample object label corresponding to the third sample channel data. Afterwards, a sample auxiliary set is constructed based on the evaluation index of each third sample channel data.
[0211] Furthermore, the first sample channel data of the sample training set can be used to train the neural network model using the cross entropy loss (first loss). At the same time, based on the target first sample channel data of the sample training set and the second sample channel data of the sample auxiliary set, the MK-MMD loss (second loss) is constructed in each sample object label, and the MK-MMD loss is combined with the cross entropy loss function to construct the final objective function to train the preset model.
[0212] Exemplarily, when to stop training can be determined based on the second classification accuracy of the trained preset model on the sample support set. Specifically, when the second classification accuracy of the preset model on the sample support set does not improve for 30 consecutive training rounds, the training can be stopped. Finally, the first parameter corresponding to the training round with the highest second classification accuracy of the sample support set is selected as the final model parameter.
[0213] Furthermore, the trained target can be directly used to classify the third sample channel data of the sample test set. Experimental results show that in the 3-shot scenario, the classification accuracy of the target model exceeds 85%, which is even better than the performance of direct classification using the ResNet network in a single environment, indicating that this application can effectively achieve cross-environment pedestrian recognition.
[0214] The embodiment of the present application detects the state of the channel data of the second environment; when the state of the channel data of the second environment changes, obtains the channel data to be analyzed from the second environment; inputs the channel data to be analyzed into the target model to obtain the object label; wherein the target model is determined based on the difference between the first prediction result of each first sample channel data in the sample training set and the corresponding first sample object label, and based on the mean difference between the target first sample channel data in the sample training set and the second sample channel data in the sample auxiliary set under the same sample object label; the sample training set includes the first sample channel data of each object in the first environment and the first sample object label of each object among multiple objects; the sample auxiliary set includes the second sample channel data of the target object in the second environment and the second sample object label of each target object, the target object is an object selected from multiple objects, and the number of target objects is less than the number of objects; the target first sample channel data and the second sample channel data belong to the channel data of the same object in the first environment and the second environment respectively. In this way, the sample training set of the source domain and the sample auxiliary set of the target domain can be aligned according to the same sample object label. In this way, the distribution of each sample object label in the source domain and the target domain can be roughly the same through the intermediate feature space, so that the model can achieve good training results even in the case of few-sample training, thereby improving the training efficiency of the model in the few-sample scenario. At the same time, since the target model is determined based on the difference between the prediction result and the sample object label, and the mean difference between the target first sample channel data and the second sample channel data, the accuracy of the trained model in object recognition can be improved. In summary, the present application can improve the accuracy of the trained model in object recognition while improving the training efficiency of the model in the few-sample scenario.
[0215] See also Figure 6The embodiment of the present application further provides a device for object recognition based on a model of few-sample learning, which can implement the above-mentioned method for object recognition based on a model of few-sample learning. The device for object recognition based on a model of few-sample learning includes:
[0216] A detection module 61, used to detect the state of the channel data of the second environment;
[0217] An acquisition module 62, configured to acquire the channel data to be analyzed from the second environment when the state of the channel data of the second environment changes;
[0218] An input module 63 is used to input the channel data to be analyzed into a target model to obtain an object label; wherein the target model is determined based on the difference between the first prediction result of each first sample channel data in the sample training set and the corresponding first sample object label, and based on the mean difference between the target first sample channel data in the sample training set and the second sample channel data in the sample auxiliary set under the same sample object label; the sample training set includes the first sample channel data of each object in a first environment and the first sample object label of each object among multiple objects; the sample auxiliary set includes the second sample channel data of the target object in a second environment and the second sample object label of each target object, the target object is an object selected from multiple objects, and the number of target objects is less than the number of objects; the target first sample channel data and the second sample channel data belong to the channel data of the same object in the first environment and the second environment respectively.
[0219] The specific implementation of the device for object recognition based on a model of few-sample learning is basically the same as the specific implementation of the method for object recognition based on a model of few-sample learning, and will not be repeated here. On the premise of meeting the requirements of the embodiments of the present application, the device for object recognition based on a model of few-sample learning can also be provided with other functional modules to implement the method for object recognition based on a model of few-sample learning in the above-mentioned embodiment.
[0220] The embodiment of the present application also provides a computer device, the computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned method of object recognition based on a model of few-sample learning when executing the computer program. The computer device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0221] See also Figure 7 , Figure 7 The hardware structure of a computer device according to another embodiment is shown, and the computer device includes:
[0222] The processor 71 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (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 the present application;
[0223] The memory 72 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 72 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 72, and the processor 71 calls and executes the method for object recognition based on a few-sample learning model in the embodiment of this application;
[0224] Input / output interface 73, used to implement information input and output;
[0225] Communication interface 74, used to realize communication interaction between the device and other devices, which can be realized by wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.);
[0226] A bus 75 that transmits information between the various components of the device (e.g., the processor 71, the memory 72, the input / output interface 73, and the communication interface 74);
[0227] The processor 71 , the memory 72 , the input / output interface 73 and the communication interface 74 are connected to each other in communication within the device via a bus 75 .
[0228] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the above-mentioned method for object recognition based on a model of few-sample learning.
[0229] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0230] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0231] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0232] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0233] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0234] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0235] It should be understood that in the present application, "at least one (item)" and "several" refer to one or more, and "plurality" refers to two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers 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 mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0236] In the several embodiments provided in the present 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 schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0237] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0238] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0239] If the integrated unit is implemented in the form of 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 the present application, 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, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0240] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A method for object recognition based on a few-sample learning model, characterized in that: The method comprises: detecting a state of channel data of a second environment; When the state of the channel data of the second environment changes, acquiring the channel data to be analyzed from the second environment; Inputting the channel data to be analyzed into a target model to obtain an object label; The target model is determined based on the difference between the first prediction result of each first sample channel data in the sample training set and the corresponding first sample object label, and based on the mean difference between the target first sample channel data in the sample training set and the second sample channel data in the sample auxiliary set under the same sample object label; The sample training set includes first sample channel data for each object in a first environment and a first sample object label for each object among a plurality of objects; The sample auxiliary set includes second sample channel data of the target object in the second environment and a second sample object label of each target object, the target object is an object selected from the plurality of objects, and the number of the target objects is less than the number of the objects; The target first sample channel data and the second sample channel data belong to channel data of the same object in the first environment and the second environment respectively.
2. The method for object recognition based on a model of few-sample learning according to claim 1, characterized in that: The target model is trained in the following way: Inputting first sample channel data in a sample training set into a preset model to obtain a first prediction result obtained by the preset model for predicting the first sample channel data; Determining a first loss of the preset model based on a difference between the first prediction result and a first sample object label corresponding to the first sample channel data; Based on the sample support set in the second environment, determining a sample auxiliary set from a plurality of third sample channel data of the sample test set; Inputting the target first sample channel data in the sample training set and the second sample channel data in the sample auxiliary set into the preset model to obtain the mean difference between the target first sample channel data and the second sample channel data under the same sample object label; Based on the mean difference, determining a second loss of the preset model; Constructing a target loss according to the first loss and the second loss; The preset model is trained based on the target loss until a convergence condition of the preset model is reached to obtain a trained target model.
3. The method for object recognition based on a model of few-sample learning according to claim 2, characterized in that: The step of determining the sample auxiliary set from a plurality of third sample channel data of the sample test set based on the sample support set in the second environment comprises: Acquire a sample support set corresponding to the target object in the second environment, and a fourth sample object label corresponding to each fourth sample channel data in the sample support set; Determine a third sample object label for each of the third sample channel data according to a first characteristic distance between each of the third sample channel data in the sample test set and a plurality of the fourth sample channel data in the sample support set; Determine, from the sample support set, a plurality of target fourth sample channel data having the same sample object label as the third sample channel data; Calculate the evaluation index of the corresponding third sample channel data according to the plurality of target fourth sample channel data; Based on the evaluation index corresponding to each of the third sample channel data, a plurality of the second sample channel data are determined from a plurality of the third sample channel data to obtain a sample auxiliary set.
4. The method for object recognition based on a model of few-sample learning according to claim 3, characterized in that: The calculating the evaluation index of the corresponding third sample channel data according to the plurality of target fourth sample channel data comprises: Acquire a plurality of second characteristic distances between each of the third sample channel data and a corresponding plurality of the target fourth sample channel data; Sorting the plurality of second characteristic distances, and selecting a target distance from the plurality of second characteristic distances according to the obtained sorting result; Determining the confidence level of the corresponding third sample channel data according to the target distance corresponding to each third sample channel data; Acquire a true sample object label of each of the third sample channel data, and determine a first classification accuracy of the third sample channel data based on a comparison between the true sample object label and the third sample object label; An evaluation index of each of the third sample channel data is calculated based on the confidence and the first classification accuracy.
5. The method for object recognition based on a model of few-sample learning according to claim 2, characterized in that: The step of inputting the target first sample channel data in the sample training set and the second sample channel data in the sample auxiliary set into the preset model to obtain the mean difference between the target first sample channel data and the second sample channel data under the same sample object label includes: Inputting the target first sample channel data in the sample training set and the second sample channel data in the sample auxiliary set into the preset model to obtain a first feature vector corresponding to the target first sample channel data and a second feature vector corresponding to the second sample channel data; The first feature vector and the second feature vector corresponding to the same sample object label are input into the second loss function preset by the preset model to obtain the mean difference between the target first sample channel data and the second sample channel data under the same sample object label.
6. The method for object recognition based on a model of few-sample learning according to claim 5, characterized in that: The determining the second loss of the preset model based on the mean difference includes: For each sample object label, determining a mean difference between a first feature vector of the first sample channel data and a second feature vector of the second sample channel data corresponding to each sample object label; The sample object label is used as the division dimension, and the mean difference under each sample object label is accumulated to obtain the second loss of the preset model.
7. The method for object recognition based on a model of few-sample learning according to claim 2, characterized in that: The step of training the preset model based on the target loss until a convergence condition of the preset model is reached to obtain a trained target model includes: Update the first parameter of the preset model based on the target loss, and input a plurality of fourth sample channel data in the sample support set into the preset model to obtain a plurality of second prediction results of the plurality of fourth sample channel data; Compare the second prediction result with the corresponding fourth sample object label to obtain a comparison result; Determining a second classification accuracy of the preset model under the first parameter according to the comparison result; Repeatedly update the first parameter of the preset model based on the target loss, and input multiple fourth sample channel data in the sample support set into the preset model to obtain multiple second prediction results of the multiple fourth sample channel data; compare the second prediction result with the corresponding fourth sample object label to obtain a comparison result; determine the new second classification accuracy of the preset model under the first parameter according to the comparison result, until the number of times the new second classification accuracy remains unchanged reaches a preset number, stop training the preset model, and use the first parameter corresponding to the training round with the highest second classification accuracy as the target parameter of the target model to obtain the target model.
8. A device for object recognition based on a model of few-sample learning, characterized in that: The device comprises: A detection module, used to detect the state of the channel data of the second environment; an acquisition module, configured to acquire the channel data to be analyzed from the second environment when the state of the channel data of the second environment changes; An input module is used to input the channel data to be analyzed into a target model to obtain an object label; wherein the target model is determined based on the difference between the first prediction result of each first sample channel data in the sample training set and the corresponding first sample object label, and based on the mean difference between the target first sample channel data in the sample training set and the second sample channel data in the sample auxiliary set under the same sample object label; the sample training set includes the first sample channel data of each object in a first environment and the first sample object label of each object among multiple objects; the sample auxiliary set includes the second sample channel data of the target object in a second environment and the second sample object label of each target object, the target object is an object selected from the multiple objects, and the number of the target objects is less than the number of the objects; the target first sample channel data and the second sample channel data belong to the channel data of the same object in the first environment and the second environment respectively.
9. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the method for object recognition based on a model of few-sample learning as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for object recognition based on a model of few-sample learning as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Object classification based on wireless communication
CN114175126A
Method for identifying few samples based on brain-computer interface
CN114847973A
Few-sample image recognition method with embedded uncertainty information
CN115661539A
Class determination method and device, equipment and storage medium
CN117708698A
Wifi-based object detection method and system, and storage medium
WO2020228324A1