Training data generation method, classifier training method, device, equipment and medium
By generating new features to expand the features of the tail category, the problem of low tail category recognition accuracy in long-tail distribution data is solved, and a higher classifier recognition accuracy is achieved.
Patent Information
- Application Number
- CN202210509643.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-11
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2042-05-11
AI Technical Summary
In long-tail distribution data, it is difficult for the prior art to effectively train the network to improve the recognition accuracy of tail categories, resulting in the network overfitting the head category and ignoring the characteristics of tail categories.
By obtaining the feature mean and variance of the training sample, a new feature is generated using the Gaussian distribution function, the feature set of tail categories is expanded, and the original features and generated features are combined to form more diverse training data.
It improves the feature diversity and recognition accuracy of the tail category, and improves the overall recognition accuracy of the classifier.
Smart Images

Figure CN114925758B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technologies, and particularly to a training data generation method, a classifier training method, an apparatus, a device, and a medium. Background Art
[0002] Long-tail distribution data is a skewed distribution, which means that several categories (also called head categories) contain a large number of samples, while most categories (also called tail categories) have only a very small number of samples. When training a network using long-tail distribution data, the result often overfits to the head categories and ignores the tail categories, resulting in the trained network being unable to accurately identify the data of the tail categories. Summary of the Invention
[0003] In view of this, this application provides a training data generation method, a classifier training method, an apparatus, a device, and a medium to expand the features of the tail categories and improve the recognition accuracy of the tail categories.
[0004] To achieve the above object, the technical solutions provided in this application are as follows:
[0005] In the first aspect of this application, a training data generation method is provided. The method includes:
[0006] Obtain a first training sample set, where the first training sample set includes first training samples of multiple categories, and the first training sample set has a long-tail distribution;
[0007] For a first category, obtain a first original feature set according to the first training samples of the first category, where the first category is a category included in the multiple categories;
[0008] Determine the feature mean and feature variance corresponding to the first category according to the features in the first original feature set;
[0009] Obtain a generated feature set corresponding to the first category according to the Gaussian distribution function and the feature mean and feature variance corresponding to the first category, where the generated feature set includes newly generated features;
[0010] Combine the first original feature set of the first category and the generated feature set to obtain the training data corresponding to the first category.
[0011] In the second aspect of this application, a classifier training method is provided. The method further includes:
[0012] Obtain training data, where the training data is obtained by the method described in the first aspect;
[0013] Train a classifier using the training data.
[0014] In the third aspect of the present application, a training data generation device is provided. The device includes:
[0015] A first acquisition unit, configured to acquire a first training sample set, where the first training sample set includes first training samples of multiple categories, and the first training sample set has a long-tailed distribution;
[0016] A second acquisition unit, configured to, for a first category, acquire a first original feature set according to the first training samples of the first category, where the first category is a category included in the multiple categories;
[0017] A determination unit, configured to determine a feature mean and a feature variance corresponding to the first category according to the features in the first original feature set;
[0018] A third acquisition unit, configured to acquire a generated feature set corresponding to the first category according to a Gaussian distribution function and the feature mean and feature variance corresponding to the first category, where the generated feature set includes newly generated features;
[0019] A fourth acquisition unit, configured to combine the first original feature set of the first category and the generated feature set to obtain training data corresponding to the first category.
[0020] In the fourth aspect of the present application, a classifier training device is provided. The device includes:
[0021] An acquisition unit, configured to acquire training data, where the training data is acquired by the method described in the first aspect;
[0022] A training unit, configured to train a classifier by using the training data.
[0023] In the fifth aspect of the present application, an electronic device is provided. The device includes: a processor and a memory; the memory is configured to store instructions or computer programs; the processor is configured to execute the instructions or computer programs in the memory so that the electronic device executes the training data generation method described in the first aspect or the classifier training method described in the second aspect.
[0024] In the sixth aspect of the present application, a computer-readable storage medium is provided. Instructions are stored in the computer-readable storage medium, and when the instructions run on a device, the device is caused to execute the training data generation method described in the first aspect or the classifier training method described in the second aspect.
[0025] In the seventh aspect of the present application, there is provided a computer program product, which includes a computer program / instructions, and when the computer program / instructions are executed by a processor, the training data generation method described in the first aspect or the classifier training method described in the second aspect is implemented.
[0026] Thus, the embodiments of the present application have the following beneficial effects:
[0027] In the embodiments of the present application, after obtaining the first training sample set with the characteristics of long-tail distribution, for any category in the first training sample set, that is, the first category, the first original feature set is obtained according to the first training samples of the first category, and the feature mean and feature variance corresponding to the first category are determined according to the features in the first original feature set. Then, the generated feature set corresponding to the first category is obtained based on the Gaussian distribution function and the feature mean and feature variance corresponding to the first category. That is, the features of the first category are expanded by the Gaussian distribution function, the feature mean, and the feature variance to generate new features. The first original feature set and the generated feature set of the first category are combined as the training data corresponding to the first category. It can be seen that the present application expands the features of the tail category by generating new features, thereby increasing the diversity of the features of the tail category and improving the accuracy of training for the tail category. Description of the Drawings
[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments recorded in the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0029] Figure 1 It is a flowchart of a training data generation method provided by an embodiment of the present application;
[0030] Figure 2 It is a schematic diagram of an application scenario provided by an embodiment of the present application;
[0031] Figure 3 It is a schematic diagram of the structure of a training data generation device provided by an embodiment of the present application;
[0032] Figure 4 It is a schematic diagram of the structure of a classifier training device provided by an embodiment of the present application;
[0033] Figure 5 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Detailed Embodiments
[0034] To enable those skilled in the art to better understand the solution of this application, the following will clearly and completely describe the technical solution in the embodiments of this application in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of this application.
[0035] The long-tail problem in deep learning is a relatively common problem. Essentially, the long-tail problem refers to the phenomenon that due to the imbalance of data categories, a small number of classes (head classes) account for the majority of samples, while the majority of classes (tail classes) have only a small number of samples, presenting a long tail on the quantity distribution graph. A dataset like this will make the deep learning network perform well in head classes but inefficiently in tail classes, resulting in a significant decline in the overall recognition accuracy. Currently, common methods to solve the long-tail problem include data rebalancing, adjusting logits (probabilities), knowledge transfer, etc.
[0036] Among them, data rebalancing:
[0037] a. Data resampling: Oversample the data of tail classes. The specific approach is generally as follows: Randomly select a tail class, and then copy its data. After different data augmentations, it can be used to expand the data space of tail classes; Downsample the data of head classes. The specific approach is generally as follows: Randomly select a head class, and then discard its data, which can reduce the data volume of head classes.
[0038] b. Loss function reweighting: For tail classes, increase the weight of their loss functions, which can make the network pay more attention to them; For head classes, reduce the weight of their loss functions, which can make the network pay less attention to them.
[0039] Adjusting logits:
[0040] a. Adjust logits during the training phase: By reducing the logits of tail classes during the training process, the prediction probability is decreased, and thus the backpropagation gradient is increased, which can make the network pay more attention to the learning of tail classes; At the same time, the logits of difficult samples can be reduced during the training process, which can also make the network pay more attention to the learning of difficult samples.
[0041] b. Adjust logits during the inference phase: By increasing the logits of tail classes during the inference phase, the prediction probability is increased, thereby improving the prediction accuracy of tail classes.
[0042] Knowledge transfer:
[0043] a. Since the samples of the head category are sufficient and diverse, the knowledge of the head category can be transferred to the tail category to assist the learning of the tail category.
[0044] b. The knowledge that can be transferred includes semantic features, angular distribution within the class, etc. Additionally, the samples of the head category can be converted into the tail category by training an additional classifier.
[0045] Through research, it is found that the above solutions are all relatively complex, difficult to apply in practice, and take a long time to use, which affects the training efficiency.
[0046] Based on this, the present application provides a training data generation method that resamples in the feature domain, thereby increasing the feature diversity of the tail category samples and expanding the feature space of the tail category. Specifically, for the original features of the tail category, the feature mean and feature variance corresponding to the original features are determined, and new features are generated based on the feature mean and feature variance. The original features and the generated features are combined as the resampled features of the tail category, and then a classifier is trained based on the resampled features to train a more accurate and balanced classifier.
[0047] To facilitate understanding of the technical solution provided by the embodiments of the present application, the following will be described in conjunction with the accompanying drawings.
[0048] See Figure 1 , which is a flowchart of a training data generation method provided by an embodiment of the present application. This method can be executed by a training data generation device, which can be a server, an electronic device, or other devices, without limitation here. Among them, the server can be a cloud server or a server cluster and other devices with storage and computing functions. The electronic device can include mobile phones, tablets, desktop computers, laptop computers, vehicle-mounted terminals, wearable electronic devices, all-in-one machines, smart home devices, and other devices with communication functions, or can also be a device simulated by a virtual machine or an emulator. As Figure 1 shown, the method can include the following steps:
[0049] S101: Obtain a first training sample set, which includes first training samples of multiple categories, and the first training sample set has a long-tail distribution.
[0050] In this embodiment, to train a classifier, first, training samples are obtained, that is, the first training sample set, which can include first training samples corresponding to multiple categories respectively. Among them, the first training sample set has a long-tail distribution, that is, the number of first training samples of the head category in the first training sample set is large, and the number of first training samples of the tail category is small.
[0051] S102: For the first category, obtain the first original feature set according to the first training samples of the first category.
[0052] S103: Determine the feature mean and feature variance corresponding to the first category according to the features in the first original feature set.
[0053] In this embodiment, for the first category among multiple categories, obtain the first original feature set according to the first training samples of the first category. Specifically, the first training samples of the first category can be input into a pre-trained feature extraction model to extract the first original feature set corresponding to the first category through the feature extraction model. Among them, the first original feature set includes multiple feature vectors corresponding to the first category. Among them, the first category can be only the tail category among multiple categories to expand the features of the tail category. Or the first category can also be any category among multiple categories to expand the features of all categories.
[0054] After obtaining the first original feature set corresponding to the first category, determine the feature mean and feature variance corresponding to the first category according to the feature vectors in the first original feature set. That is, calculate the feature mean and feature variance of all feature vectors in the first original feature set corresponding to the first category.
[0055] Optionally, to obtain a better feature representation, before obtaining the first original feature set according to the first training samples of the first category, the first training samples in the first training sample set can also be enhanced, and then the first original feature set can be obtained according to the enhanced first training sample set, so as to increase the diversity of features in the first original feature set. Among them, the enhancement process can include using a generative adversarial network to generate new training samples, so the first training sample set includes not only the first training samples but also the new training samples. Or it can also be other sample enhancement methods, such as random flipping, sample superposition, etc.
[0056] S104: Obtain the generated feature set corresponding to the first category based on the Gaussian distribution function and the feature mean and feature variance corresponding to the first category.
[0057] After determining the feature mean and feature variance corresponding to the first category, generate new features based on the Gaussian distribution function, feature mean, and feature variance, so as to obtain the generated feature set. Among them, the generated feature set includes the new features generated by using the Gaussian distribution function, feature mean, and feature variance.
[0058] Optionally, to increase the diversity of the generated features of the augmented tail category, transfer the feature variances of other categories to the first category. Specifically: determine the similarity between the feature mean of the first category and the feature mean of the second category; use the similarity as a weight to perform a weighted sum of the feature variances corresponding to the second category to obtain the transferred variance; determine the final variance based on the feature variance corresponding to the first category and the transferred variance; obtain the set of generated features corresponding to the first category according to the Gaussian distribution function, the feature mean corresponding to the first category, and the final variance. Here, the second category is any other category except the first category among the multiple categories.
[0059] For example, there are a total of 5 categories, namely Category 1 - Category 5. Among them, Category 1 - Category 3 belong to the head category, and Category 4 and Category 5 belong to the tail category. For any category, obtain the mean Ei and the feature variance Si of the feature U of this category, where i ranges from 1 to 5. If Category 4 is the first category, then determine the similarities between the feature mean E4 of Category 4 and the feature means of Category 1, Category 2, Category 3, and Category 5 respectively. Through calculation, the similarity between Category 4 and Category 1 is a41, the similarity between Category 4 and Category 2 is a42, the similarity between Category 4 and Category 3 is a43, and the similarity between Category 4 and Category 5 is a45. Then the transferred variance Sf = a41 * S1 + a42 * S2 + a43 * S3 + a45 * S5. Then determine the final variance based on the feature variance S4 of Category 4 and the transferred variance Sf.
[0060] Among them, there are multiple implementation methods for determining the final variance based on the feature variance corresponding to the first category and the transferred variance. One is to determine the mean of the feature variance and the transferred variance as the final variance; another is to determine the larger value of the feature variance and the transferred variance as the final variance.
[0061] Optionally, to avoid the errors caused by the artificial division of the head category and the tail category, calculate the transferred variance for each category in the first training sample set, determine the final variance according to the feature variance corresponding to this category and the transferred variance, and then generate the new features corresponding to this category according to the feature mean and the final variance of this category.
[0062] Optionally, new features can be obtained in the following way: generate multiple random features according to the Gaussian distribution function; for any random feature, multiply the random feature by the feature variance and add the feature mean to obtain the generated feature. Among them, the Gaussian distribution function can be the torch.normal() function with a mean of 0 and a variance of 1, and use the torch.normal() function to generate multiple random features. Select a preset number of features from the multiple random features as the target features, multiply the target features by the feature variance (final variance) corresponding to the first category, and then add the feature mean corresponding to the first category to obtain the generated feature. Among them, the number of features included in the generated feature set is determined based on the sampling probability, and the sampling probability is inversely proportional to the number of effective training samples corresponding to the first category. That is, the more effective training samples corresponding to the first category, the smaller the corresponding sampling probability; the fewer effective training samples corresponding to the first category, the smaller the corresponding sampling probability. That is, the sampling probability of the head category is small, and the sampling probability of the tail category is large. Among them, the effective training sample refers to the training sample that can bring gain to the training. Usually, during the training process, as the number of samples increases, the gain brought by it is marginally decreasing, and the number of effective training samples can better describe the actual contribution of this type of sample to the training.
[0063] S105: Combine the first original feature set and the generated feature set to obtain the training data corresponding to the first category.
[0064] After determining the generated feature set corresponding to the first category, combine the first original feature set of the first category and the generated feature set to obtain the training data corresponding to the first category. Specifically, merge the first original feature set and the generated feature set to obtain the training data. For example, the first original feature set corresponding to category 1 is T11, and the generated feature set is T12, then the training data corresponding to category 1 is T11 ∪ T12.
[0065] It can be seen that after obtaining the first training sample set with the characteristics of long-tailed distribution, for any category in the first training sample set, that is, the first category, obtain the first original feature set according to the first training samples of the first category, and determine the feature mean and feature variance corresponding to the first category according to the features in the first original feature set. Then, obtain the generated feature set corresponding to the first category based on the Gaussian distribution function and the feature mean and feature variance corresponding to the first category. That is, expand the features of the first category through the Gaussian distribution function, feature mean, and feature variance to generate new features. Combine the first original feature set and the generated feature set of the first category as the training data corresponding to the first category. It can be seen that the present application expands the features of the tail category by generating new features, thereby increasing the diversity of the tail category features and improving the training accuracy of the tail category.
[0066] After obtaining the training data through the above method, the classifier can be trained using the training data corresponding to each category, so that the trained classifier can accurately identify various types of data.
[0067] Optionally, when training the classifier using the training data, the loss function used during training can also be replaced with a more novel loss function to improve the recognition performance of the classifier.
[0068] See Figure 2 , which is a framework diagram of a classifier training provided by an embodiment of this application. In FIG. 2, the training process includes two stages, namely stage one and stage two. Among them, in stage one, an original feature set is obtained using the data with the original long-tail distribution, and the feature mean and feature variance of each category are calculated based on the features in the original feature set and stored in the memory. In stage two, feature resampling is performed. For each category, new features are generated using its feature mean, feature variance, and the Gaussian distribution function. Through Figure 2 it can be seen that in the original feature set, there are more features corresponding to the head categories and fewer features corresponding to the tail categories; in the generated feature set, there are fewer features corresponding to the head categories and more features corresponding to the tail categories. Therefore, a more balanced feature distribution can be obtained by combining the original feature set and the generated feature set.
[0069] Optionally, during the training process, the feature mean and feature variance stored in the memory can also be updated, which can further enhance the feature diversity of the tail categories and thus make the prediction results of the trained classifier more accurate.
[0070] Specifically, the stored feature mean and feature variance can be updated in the following way: obtain a second training sample set, which includes second training samples of multiple categories and has a long-tail distribution. For the first category in the second training sample set, obtain a second original feature set based on the second training samples of the first category, and determine the feature mean and feature variance corresponding to the first category according to the second original feature set. Then, determine the feature mean corresponding to the first category using the feature mean corresponding to the first category determined according to the features in the first original feature set and the feature mean corresponding to the first category determined according to the features in the second original feature set. And, determine the feature variance corresponding to the first category using the feature variance corresponding to the first category determined according to the features in the first original feature set and the feature variance corresponding to the first category determined according to the features in the second original feature set. That is, use the feature means determined by different batches to update the feature mean stored in the memory, and use the feature variances determined by different batches to update the feature variance stored in the memory.
[0071] For example, the training samples of categories 1-5 are included in batch1, and the training samples of categories 1-5 are also included in batch2. Taking category 1 as the first category for illustration. The feature mean value determined by the training samples of category 1 in batch1 is E11, and the feature mean value determined by the training samples of category 1 in batch2 is E21. Then, the feature mean value E1 of category 1 in the memory is E1 = α * E11 + β * E21. Where α and β are numbers greater than 0 and less than 1 respectively, and the sum of the two is 1. When there is batch3, the feature mean value determined by the training samples of category 1 in batch3 is E31. Then, the feature mean value E1 of category 1 in the memory is E1 = α * E1 + β * E31, and so on.
[0072] Similarly, for the feature variance of category 1, the feature variance determined by the training samples of category 1 in batch1 is S11, and the feature variance determined by the training samples of category 1 in batch2 is S21. Then, the feature mean value S1 of category 1 in the memory is S1 = γ * S11 + k * S21. Where γ and k are numbers greater than 0 and less than 1 respectively, and the sum of the two is 1. When there is batch3, the feature variance determined by the training samples of category 1 in batch3 is S31. Then, the feature mean value S1 of category 1 in the memory is S1 = γ * S1 + k * S31, and so on.
[0073] To verify the effectiveness of the method provided by the embodiments of the present application, the training data generation method provided by this embodiment will be used to balance the commonly used large-scale long-tail dataset ImageNet_LT. The results are shown in the following table:
[0074] Overall accuracy many-shot accuracy medium-shot accuracy few-shot accuracy Baseline method 44.4 65.9 37.5 7.7 Method of this embodiment 53 64 48.6 37.5
[0075] Among them, many-shot refers to the category set with the number of samples greater than 100, medium-shot refers to the category set with the number of samples between 20 and 100, and few-shot refers to the category set with the number of samples less than 20. It can be seen from the table that the method of this embodiment has a very significant improvement in few-shot, and the overall accuracy rate has also increased significantly.
[0076] Based on the above method embodiments, the embodiments of the present application provide a training data generation device and a classifier training device, which will be described below with reference to the accompanying drawings.
[0077] See Figure 3, This figure is a structural diagram of a training data generation device provided by an embodiment of the present application. As shown in 300, the device may include: a first acquisition unit 301, a second acquisition unit 302, a determination unit 303, a third acquisition unit 304, and a fourth acquisition unit 305.
[0078] The first acquisition unit 301 is configured to acquire a first training sample set, where the first training sample set includes first training samples of multiple categories, and the first training sample set has a long-tail distribution;
[0079] The second acquisition unit 302 is configured to, for a first category, acquire a first original feature set according to the first training samples of the first category, where the first category is a category included in the multiple categories;
[0080] The determination unit 303 is configured to determine a feature mean and a feature variance corresponding to the first category according to the features in the first original feature set;
[0081] The third acquisition unit 304 is configured to acquire a generated feature set corresponding to the first category according to a Gaussian distribution function and the feature mean and feature variance corresponding to the first category, where the generated feature set includes newly generated features;
[0082] The fourth acquisition unit 305 is configured to combine the first original feature set of the first category and the generated feature set to obtain training data corresponding to the first category.
[0083] In an optional implementation manner, the third acquisition unit 304 is specifically configured to determine a similarity between the feature mean of the first category and the feature mean of a second category, where the second category is any other category except the first category among the multiple categories; use the similarity as a weight to perform a weighted sum of the feature variances corresponding to the second category to obtain a transfer variance; determine a final variance according to the feature variance corresponding to the first category and the transfer variance; and acquire a generated feature set corresponding to the first category according to a Gaussian distribution function and the feature mean and final variance corresponding to the first category.
[0084] In an optional implementation manner, the third acquisition unit 304 is specifically configured to determine the larger value between the feature variance corresponding to the first category and the transfer variance as the final variance.
[0085] In an optional implementation manner, the third acquisition unit 304 is specifically configured to generate a plurality of random features according to a Gaussian distribution function; for any random feature, multiply the random feature by the feature variance and add the feature mean to obtain a generated feature.
[0086] In an alternative implementation, the number of features included in the generated feature set is determined based on a sampling probability, and the sampling probability is inversely proportional to the number of valid training samples corresponding to the first category.
[0087] In an alternative implementation, the first category is the tail category among the multiple categories.
[0088] In an alternative implementation, the first acquisition unit 301 is further configured to acquire a second training sample set, where the second training sample set includes second training samples of the multiple categories, and the second training sample set has a long-tail distribution;
[0089] The second acquisition unit 302 is further configured to, for the first category, acquire a second original feature set according to the second training samples of the first category;
[0090] The determination unit 303 is further configured to determine the feature mean and feature variance corresponding to the first category according to the features in the second original feature set;
[0091] The determination unit 303 is further configured to determine the feature mean corresponding to the first category by using the feature mean corresponding to the first category determined according to the features in the first original feature set and the feature mean corresponding to the first category determined according to the features in the second original feature set;
[0092] The determination unit 303 is further configured to determine the feature variance corresponding to the first category by using the feature variance corresponding to the first category determined according to the features in the first original feature set and the feature variance corresponding to the first category determined according to the features in the second original feature set.
[0093] In an alternative implementation, the apparatus further includes: a processing unit;
[0094] The processing unit is configured to perform enhancement processing on the first training samples in the first training sample set before acquiring the first original feature set according to the first training samples of the first category.
[0095] It should be noted that the implementation of each unit in this embodiment can refer to the relevant descriptions in the above method embodiment, and will not be elaborated here.
[0096] See Figure 4 , this figure is a structural diagram of a classifier training apparatus provided by an embodiment of the present application. As Figure 4 shown, the apparatus 400 includes: an acquisition unit 401 and a training unit 402.
[0097] An acquisition unit 401, configured to acquire training data, where the training data is acquired by Figure 1 the method described above;
[0098] A training unit 402, configured to train a classifier by using the training data.
[0099] It should be noted that for the specific implementation of each unit in this embodiment, reference may be made to the relevant descriptions in the foregoing method embodiments.
[0100] The division of units in the embodiments of the present application is illustrative. It is only a logical function division. In actual implementation, there may be other division methods. Each functional unit in the embodiments of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. For example, in the foregoing embodiment, the processing unit and the sending unit may be the same unit or different units. The above integrated unit may be implemented in the form of hardware or in the form of a software functional unit.
[0101] See Figure 5 , which shows a schematic structural diagram of an electronic device 500 suitable for implementing the embodiments of the present disclosure. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), PMPs (Portable Multimedia Players), in-vehicle terminals (such as in-vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is only an example and should not impose any limitation on the functions and usage scope of the embodiments of the present disclosure.
[0102] As Figure 5 shown, the electronic device 500 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 501, which may perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0103] Typically, the following devices can be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 can allow the electronic device 500 to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 5 an electronic device 500 with various devices is shown, it should be understood that it is not required to implement or have all the shown devices. Instead, more or fewer devices can be implemented or had.
[0104] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product that includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program codes for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication device 509, or installed from the storage device 508, or installed from the ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0105] The electronic device provided by the embodiment of the present disclosure and the method provided by the above embodiment belong to the same inventive concept. Technical details not described in detail in this embodiment can be referred to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
[0106] An embodiment of the present disclosure provides a computer storage medium, on which a computer program is stored, and when the program is executed by a processor, the method provided by the above embodiment is implemented.
[0107] It should be noted that the computer-readable medium described above can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, apparatus, or device. In the present disclosure, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, and this computer-readable signal medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0108] In some embodiments, the client and the server can communicate using any currently known or future-developed network protocol such as HTTP (Hyper Text Transfer Protocol), and can be interconnected with digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include local area networks ("LANs"), wide area networks ("WANs"), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any currently known or future-developed networks.
[0109] The above computer-readable medium can be included in the above electronic device; or it can exist separately without being assembled into the electronic device.
[0110] The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by the electronic device, the electronic device can execute the above method.
[0111] Computer program code for performing the operations of this disclosure may be written in one or more programming languages or combinations thereof. The foregoing programming languages include, but are not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0112] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a part of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions noted in the blocks may occur in an order different from that noted in the drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0113] The units involved in the embodiments described in this disclosure may be implemented in software or in hardware. Among them, the name of the unit / module does not constitute a limitation to the unit itself in some cases.
[0114] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGA), application specific integrated circuits (ASIC), application specific standard products (ASSP), system on a chip (SOC), complex programmable logic devices (CPLD), and the like.
[0115] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0116] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. For the same or similar parts among the various embodiments, reference can be made to each other. For the systems or apparatuses disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and reference can be made to the method part for the relevant parts.
[0117] It should be understood that in this application, "at least one (item)" means one or more, and "a plurality" means two or more. "And / or" is used to describe the association relationship of associated objects and indicates that three relationships can exist. For example, "A and / or B" can mean: only A exists, only B exists, and both A and B exist simultaneously. Here, A and B can be singular or plural. The character " / " generally indicates an "or" relationship between the associated objects before and after. "At least one (one) of the following" or its similar expressions refer to any combination of these items, including any combination of single items (ones) or plural items (ones). For example, at least one (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, and c can be single or multiple.
[0118] It should also be noted that, in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the phrase "comprising a..." does not exclude the presence of additional identical elements in the process, method, article or device comprising said element.
[0119] The steps of the methods or algorithms described in connection with the embodiments disclosed herein may be implemented directly in hardware, in a software module executed by a processor, or in a combination thereof. The software module may be disposed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0120] The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for generating training data, characterized in that, The method is applied to the scenario of training a classifier for classifying image data with a long-tail distribution characteristic, and includes: Obtain a first training sample set, where the first training sample set includes first training samples of multiple categories. The first training samples are image data, and the first training sample set has a long-tail distribution. The multiple categories include head categories and tail categories, and the number of first training samples in the head categories is much larger than the number of first training samples in the tail categories; For a first category, obtain a first original feature set according to the first training samples of the first category, where the first category includes at least the tail category; Determine the feature mean and feature variance corresponding to the first category according to the features in the first original feature set; Obtain a generated feature set corresponding to the first category according to the Gaussian distribution function and the feature mean and feature variance corresponding to the first category, where the generated feature set includes newly generated features; Combine the first original feature set and the generated feature set of the first category to obtain the training data corresponding to the first category, so as to train the classifier using the training data.
2. The method according to claim 1, wherein The obtaining the generated feature set corresponding to the first category according to the Gaussian distribution function and the feature mean and feature variance corresponding to the first category includes: Determine the similarity between the feature mean of the first category and the feature mean of a second category, where the second category is any other category except the first category among the multiple categories; Use the similarity as a weight to perform weighted summation on the feature variances corresponding to the second category to obtain a transfer variance; Determine the final variance according to the feature variance corresponding to the first category and the transfer variance; Obtain the generated feature set corresponding to the first category according to the Gaussian distribution function and the feature mean and final variance corresponding to the first category.
3. The method according to claim 2, characterized in that, The determining the final variance according to the feature variance corresponding to the first category and the transfer variance includes: Determine the larger value among the feature variance corresponding to the first category and the transfer variance as the final variance.
4. The method according to any one of claims 1 to 3, characterized in that, The obtaining the generated feature set corresponding to the first category according to the Gaussian distribution function and the feature mean and feature variance corresponding to the first category includes: Generate multiple random features according to the Gaussian distribution function; For any random feature, multiply the random feature by the feature variance and add the feature mean to obtain a generated feature.
5. The method according to claim 4, characterized in that, The number of features included in the generated feature set is determined based on a sampling probability, and the sampling probability is inversely proportional to the number of valid training samples corresponding to the first category.
6. The method according to claim 1, wherein The first category is the tail category among the multiple categories.
7. The method according to claim 1, wherein The method further includes: Obtain a second training sample set, where the second training sample set includes second training samples of the multiple categories. The second training samples are image data, and the second training sample set has a long-tail distribution; For the first category, obtain a second original feature set according to the second training samples of the first category; Determine the feature mean and feature variance corresponding to the first category according to the features in the second original feature set; Determine the feature mean corresponding to the first category by using the feature mean corresponding to the first category determined according to the features in the first original feature set and the feature mean corresponding to the first category determined according to the features in the second original feature set; Determine the feature variance corresponding to the first category by using the feature variance corresponding to the first category determined according to the features in the first original feature set and the feature variance corresponding to the first category determined according to the features in the second original feature set.
8. The method according to claim 1, characterized in that, Before obtaining the first original feature set according to the first training samples of the first category, the method further includes: Performing enhancement processing on the first training samples in the first training sample set.
9. A classifier training method, characterized in that, The method further includes: Obtaining training data, where the training data is obtained by the method according to any one of claims 1-8; Training a classifier by using the training data, where the classifier is used to classify image data with a long-tail distribution characteristic.
10. A training data generation device, characterized in that, The apparatus includes: A first acquisition unit, configured to acquire a first training sample set, where the first training sample set includes first training samples of multiple categories, the first training samples are image data, the first training sample set has a long-tail distribution, the multiple categories include a head category and a tail category, and the number of first training samples of the head category is much larger than the number of first training samples of the tail category; A second acquisition unit, configured to, for a first category, acquire a first original feature set according to the first training samples of the first category, where the first category includes at least the tail category; A determination unit, configured to determine the feature mean and feature variance corresponding to the first category according to the features in the first original feature set; A third acquisition unit, configured to acquire a generated feature set corresponding to the first category according to the Gaussian distribution function and the feature mean and feature variance corresponding to the first category, where the generated feature set includes newly generated features; A fourth acquisition unit, configured to combine the first original feature set and the generated feature set of the first category to obtain training data corresponding to the first category, so as to train a classifier by using the training data, where the classifier is used to classify image data with a long-tail distribution characteristic.
11. A classifier training device, characterized in that, The apparatus includes: An acquisition unit, configured to acquire training data, where the training data is obtained by the method according to any one of claims 1-8; A training unit, configured to train a classifier by using the training data, where the classifier is used to classify image data with a long-tail distribution characteristic.
12. An electronic device, characterized in that, The device includes: a processor and a memory; The memory is configured to store instructions or computer programs; The processor is configured to execute the instructions or computer programs in the memory, so that the electronic device executes the method according to any one of claims 1-8 or the method according to claim 9.
13. A computer-readable storage medium, characterized in that, Instructions are stored in the computer-readable storage medium, and when the instructions are run on the device, the device is caused to execute the method according to any one of claims 1-8 or the method according to claim 9.
14. A computer program product, characterized in that, The computer program product includes a computer program / instructions, and when the computer program / instructions are executed by a processor, the method according to any one of claims 1-8 or the method according to claim 9 is implemented.
Citation Information
Patent Citations
System and method for wireless motion monitoring
EP3978949A2
Systems and method for reducing fixed pattern noise in image data
US20130321671A1