Methods, apparatus, computer equipment, and storage media for generating augmented samples
By selecting parent class samples from the reference sample set and updating feature values and classification options, expanded samples are generated, which solves the problem of insufficient sample diversity and improves the classification performance of the classification model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-10
- Publication Date
- 2026-04-03
AI Technical Summary
Existing sample amplification methods are unable to guarantee sample diversity, which affects the classification performance of classification models.
New samples are generated by selecting at least two parent class samples from the reference sample set, and expanded samples are generated by updating feature values and classification options based on statistical data of different types of features.
This increased the diversity of the expanded samples and improved the classification training effect of the classification model.
Smart Images

Figure CN116861240B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data processing technology, specifically to a method, apparatus, computer device, and storage medium for generating expanded samples. Background Technology
[0002] Classification models are a common type of supervised machine learning model. They are trained on labeled samples and can classify input data into different categories. Classification models have wide applications in various fields. For example, in news feed recommendation scenarios, news can be classified into multiple categories such as finance, technology, and sports based on features such as the title and content.
[0003] However, due to limitations in sample size and labeling costs, there may be insufficient labeled samples, making it difficult for classification models to classify accurately. To address this issue, sample augmentation is currently used to increase the number of samples. However, current sample augmentation methods can only generate a limited number of samples, making it difficult to guarantee sample diversity and still affecting the classification performance of the model. Summary of the Invention
[0004] In view of this, the present disclosure provides a method, apparatus, computer device, and storage medium for generating expanded samples to solve the problem of difficulty in amplifying diverse samples.
[0005] In a first aspect, embodiments of this disclosure provide a method for generating expanded samples, comprising: obtaining a set of reference samples to be expanded, and selecting at least two parent class samples from the set of reference samples; generating new samples based on the at least two parent class samples, wherein the new samples include at least a first type feature and a second type feature; updating the feature value of the first type feature according to a first statistical data of the first type feature in the set of reference samples, and updating the classification option of the second type feature according to a second statistical data of the second type feature in the set of reference samples; and generating expanded samples based on the updated feature value of the first type feature and the updated classification option of the second type feature.
[0006] The method for generating expanded samples provided in this disclosure generates new samples by selecting at least two parent class samples from a reference sample set, and updating the first and second type features included in the new samples to achieve feature updates of different types, thereby generating expanded samples. This allows for sample expansion by combining different types of features, ensuring the diversity of the expanded samples and further improving the classification training effect of the classification model.
[0007] Secondly, embodiments of this disclosure provide an apparatus for generating expanded samples, comprising: a sample set acquisition unit, configured to acquire a reference sample set to be expanded and select at least two parent class samples from the reference sample set; a new sample generation unit, configured to generate new samples based on at least two parent class samples, wherein the new samples include at least a first type feature and a second type feature; a feature update unit, configured to update the feature value of the first type feature according to a first statistical data of the first type feature in the reference sample set, and update the classification option of the second type feature according to a second statistical data of the second type feature in the reference sample set; and an expanded sample generation unit, configured to generate expanded samples based on the updated feature value of the first type feature and the updated classification option of the second type feature.
[0008] Thirdly, embodiments of this disclosure provide an electronic device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the method for generating extended samples according to the first aspect or any corresponding embodiment described above.
[0009] Fourthly, embodiments of this disclosure provide a computer-readable storage medium storing computer instructions for causing a computer to perform the method for generating an extended sample according to the first aspect or any corresponding embodiment. Attached Figure Description
[0010] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0011] Figure 1 This is a flowchart illustrating a method for generating expanded samples according to an embodiment of the present invention;
[0012] Figure 2 This is a flowchart illustrating another method for generating expanded samples according to an embodiment of the present invention;
[0013] Figure 3 This is a flowchart illustrating another method for generating expanded samples according to an embodiment of the present invention;
[0014] Figure 4 This is a structural block diagram of an apparatus for generating expanded samples according to an embodiment of the present invention;
[0015] Figure 5This is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Detailed Implementation
[0016] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0017] Among related technologies, there are three main types of methods for amplifying tagged samples:
[0018] (1) Augmentation based on unlabeled samples. Specifically, based on a set of unlabeled samples and a finite set of labeled samples, a feature space metric function is used to find close unlabeled and labeled samples. Under certain conditions, the labels of the labeled samples are assigned to the unlabeled samples, thus turning the latter into labeled samples, thereby achieving sample augmentation.
[0019] (2) Image transformation to achieve amplification. In image classification tasks, new samples are generated by randomly cropping and rotating labeled images. At the same time, the labels of the new samples inherit the labels of the original samples, thereby achieving sample amplification.
[0020] (3) Using embedding to achieve augmentation. In NLP classification tasks, text features are first embedded, and then the embedding features are randomly dropped to discard some features and form new sample embedding features. At the same time, the labels of the new samples inherit the labels of the original samples, thereby achieving sample augmentation.
[0021] However, the above-mentioned sample augmentation methods mostly use an existing unlabeled sample or transform the original labeled sample, without considering the type of sample features, resulting in limited diversity of the augmented samples, which in turn affects the subsequent model performance. In addition, the above methods have certain limitations. If there is no set of unlabeled samples for reference, they are not applicable to samples with non-image and non-embedding features. Furthermore, there is a lack of effective quality assessment for the augmented samples.
[0022] Based on this, the technical solution disclosed herein expands the samples by combining different types of features, ensuring that the expanded samples are diverse and are not limited to unlabeled sample sets. It can adapt to multiple types of features, thereby further improving the classification training effect of the classification model.
[0023] According to an embodiment of the present invention, an embodiment of a method for generating expanded samples is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0024] This embodiment provides a method for generating expanded samples, which can be used in computer devices such as computers and servers. Figure 1 This is a flowchart of a method for generating expanded samples according to an embodiment of the present invention, such as... Figure 1 As shown, the process includes the following steps:
[0025] Step S101: Obtain the reference sample set to be expanded, and select at least two parent class samples from the reference sample set.
[0026] A reference sample set is a collection of multiple reference samples, all of which belong to the same category. This reference sample set can be used by a classification model to identify the labels of the samples, thus obtaining multiple reference samples for the same category.
[0027] The parent sample is a reference sample used to reproduce new samples. After obtaining the reference sample set, the category of each reference sample in the reference sample set is predicted. Based on the category prediction results of each reference sample, two or more parent samples are selected from the reference sample set to be expanded.
[0028] Step S102: Generate new samples based on at least two parent samples, wherein the new samples include at least a first type feature and a second type feature.
[0029] A new sample is a combined sample obtained by cross-processing parent samples. The new sample contains features of at least two parent samples. Therefore, the new sample includes at least a first type feature and a second type feature. The first type feature and the second type feature come from different parent samples, and the features they represent are also different.
[0030] Taking two parent class samples of category label y in an information feed scenario as an example, the first type of feature can represent the traffic of information feed content, such as the number of video plays or the number of video completions, and is extracted from one parent class sample; the second type of feature can represent the category of information feed content, such as animation, news, or beauty, and is extracted from another parent class sample. Therefore, new features can be generated by cross-combining the features of the two parent class samples and combining them with the category label y.
[0031] Step S103: Update the feature value of the first type feature based on the first statistical data of the first type feature in the reference sample set, and update the classification option of the second type feature based on the second statistical data of the second type feature in the reference sample set.
[0032] The first statistical data represents the statistical data on the distribution of feature values for the first type of feature. By statistically analyzing the feature values corresponding to the first type of feature in the reference sample set, we can obtain the statistical data on the distribution of those feature values. This statistical data is then used to process the feature values corresponding to the first type of feature in order to update the feature values of the first type of feature.
[0033] The second statistical data represents the probability statistics of classification options for the second type of feature. By statistically analyzing the classification options corresponding to the second type of feature in the reference sample set, we can obtain the probability statistics for each classification option. These probability statistics are then used to process the classification options corresponding to the second type of feature to update the feature values of the second type of feature.
[0034] Step S104: Generate expanded samples based on the updated feature values of the first type of features and the updated classification options of the second type of features.
[0035] The first type of features after updating the feature values and the second type of features after updating the classification options are combined to generate an expanded sample, which has both the updated first type of features and the second type of features.
[0036] The method for generating expanded samples provided in this disclosure generates new samples by selecting at least two parent class samples from a reference sample set, and updating the first and second type features included in the new samples to achieve feature updates of different types, thereby generating expanded samples. This allows for sample expansion by combining different types of features, ensuring the diversity of the expanded samples and further improving the classification performance of the classification model.
[0037] This embodiment provides a method for generating expanded samples, which can be used in computer devices such as computers and servers. Figure 2 This is a flowchart of a method for generating expanded samples according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:
[0038] Step S201: Obtain the reference sample set to be expanded, and select at least two parent class samples from the reference sample set.
[0039] Specifically, step S201 above may include:
[0040] Step S2011: Obtain the classification sample set, where each sample in the classification sample set has its own classification label.
[0041] The classification sample set is an initially constructed set of samples with classification labels, which are the category identifiers assigned to the samples. Specifically, this classification sample set consists of samples from various categories collected beforehand, each sample bearing a pre-labeled classification label. Taking images as an example, the classification sample set can include images of multiple categories, such as images of people, landscapes, high-quality images, medium-quality images, blurry images, and so on.
[0042] Step S2012: Among the categories represented by the classification labels, determine the target category to be expanded, and determine the samples belonging to the target category in the classification sample set.
[0043] As mentioned above, the classification sample set contains multiple samples, and these samples belong to various categories, each characterized by a corresponding classification label. The target category to be expanded is a specific category that needs to be augmented, such as expanding the category of "images of people".
[0044] Specifically, after determining the categories represented by the classification labels, a category can be selected from these categories as the amplification target. Accordingly, the selected category is taken as the target category, and all samples belonging to the target category are extracted from the classification sample set.
[0045] Step S2013: Based on the samples belonging to the target category, generate a set of reference samples to be expanded.
[0046] The reference sample set is a subset derived from the classification sample set, specifically the set of samples belonging to the target category. Therefore, combining all samples belonging to the target category forms the reference sample set corresponding to the target category.
[0047] Step S2014: Determine the target number of parent class samples to be selected, and determine the classification fitness of each sample in the reference sample set.
[0048] Parent samples are used to generate new samples. The target number of parent samples is preset, such as 2, 3, or 4. The specific number can be determined based on the feature types of the parent samples. For example, if the parent samples have two types of features, then to ensure cross-processing to generate new samples, the target number of parent samples to be selected can be set to 2. Similarly, if the parent samples have three types of features, then the target number of parent samples to be selected can be set to 3.
[0049] Classification fitness represents the probability of predicting each sample's category as the target category. This fitness can be determined by combining the prediction results of a classification model. Specifically, the steps for determining the classification fitness of each sample in the reference sample set include:
[0050] Step a1: For any target sample in the reference sample set, predict the target sample based on the preset classification model to generate classification probability information of the target sample being classified into the target category to be expanded; the preset classification model is trained based on the classification sample set in which the reference sample set is located.
[0051] Step a2: Generate the classification fitness of the target sample based on the classification probability information.
[0052] The classification sample set contains multiple labeled samples. These labeled samples are used to train the model, generating a predefined classification model. This predefined classification model can be a machine learning model such as Logistic Regression (LR) or Support Vector Machine (SVM), or a deep learning model such as Deep Neural Networks (DNN) or Bidirectional Encoder Representations from Transformers (BERT). No specific limitations are imposed here; those skilled in the art can determine the appropriate model based on actual needs.
[0053] The reference sample set contains multiple samples. For any given target sample, the pre-trained classification model is used to predict its classification probability, thus determining the probability that the target sample belongs to the target category. The classification fitness of the target sample is numerically the same as its corresponding classification probability.
[0054] Specifically, let the target sample be Si(Xi,y), where Xi represents the sample features of the target sample, which have at least a first type of feature and a second type of feature; y represents the classification label of the target sample, used to characterize the target category. By performing classification prediction on the target sample according to the preset classification model, the prediction result predict_Xi can be obtained, and the classification probability p(predict_Xi==y) corresponding to the predicted classification label y can be determined. Thus, the classification fitness of the target sample, fit_score(Si)=p(predict_Xi==y), can be determined.
[0055] Step S2015: Select the target number of parent class samples from the reference sample set according to the classification fitness.
[0056] The fitness of each class is calculated as the sampling probability. The samples in the reference sample set are randomly sampled according to the sampling probability to obtain the corresponding number of parent class samples for the target: S1(X1,y), S2(X2,y)...Sj(Xj,y).
[0057] Step S202: Generate new samples based on at least two parent samples, wherein the new samples include at least a first type feature and a second type feature.
[0058] Specifically, step S202 may include: extracting partial sub-features from each parent sample and constructing new samples based on the extracted sub-features.
[0059] Each parent class sample extracts a subset of features, and the subsets extracted from each parent class sample are different. These subsets can be combined to form a new sample feature. This new sample feature is then combined with the classification label y to construct a new sample.
[0060] Specifically, taking two parent class samples as an example, here we can select some sub-features from the sample features X1 (a1, b1, A1, B1) of the parent class sample S1 (X1, y) according to a set ratio, and select some sub-features from the sample features X2 (a2, b2, A2, B2) of the parent class sample S2 (X2, y). The two sub-features are combined to generate new sample features Xnew, and combined with the classification label y, a new sample Snew (Xnew, y) is generated.
[0061] Where a1 and b1 are the first type features of sample feature X1; A1 and B1 are the second type features of sample feature X1; a2 and b2 are the first type features of sample feature X2; and A2 and B2 are the second type features of sample feature X2. If the first type features a1 and b1 are extracted from sample feature X1, and the second type features A2 and B2 are extracted from sample feature X2, they can be combined into Xnew(a1, b1, A2, B2).
[0062] Step S203: Update the feature value of the first type of feature based on the first statistical data of the first type of feature in the reference sample set, and update the classification option of the second type of feature based on the second statistical data of the second type of feature in the reference sample set. For detailed explanation, please refer to the relevant descriptions in the above embodiments, which will not be repeated here.
[0063] Step S204: Based on the updated feature values of the first type of features and the updated classification options of the second type of features, generate expanded samples. For detailed explanations, please refer to the relevant descriptions in the above embodiments; they will not be repeated here.
[0064] The method for generating expanded samples provided in this disclosure determines the target category of samples to be expanded by using the sample classification labels in a classification sample set, facilitating the expansion of samples in the target category. Using classification fitness as a reference, the required number of parent class samples are selected from the reference samples, making the selected parent class samples more accurate. A preset classification model is used to predict the classification probability information of any target sample in the reference sample set, and the corresponding classification fitness is determined based on this classification probability information. This allows for the selection of parent class samples from the reference sample set based on the classification fitness for the propagation of new samples.
[0065] This embodiment provides a method for generating expanded samples, which can be used in computer devices such as computers and servers. Figure 3 This is a flowchart of a method for generating expanded samples according to an embodiment of the present invention, such as... Figure 3 As shown, the process includes the following steps:
[0066] Step S301: Obtain the reference sample set to be expanded, and select at least two parent class samples from the reference sample set. For detailed explanation, please refer to the relevant descriptions in the above embodiments; they will not be repeated here.
[0067] Step S302: Generate new samples based on at least two parent class samples. The new samples include at least a first type of feature and a second type of feature. For detailed explanation, please refer to the relevant descriptions in the above embodiments, which will not be repeated here.
[0068] Step S303: Update the feature value of the first type feature according to the first statistical data of the first type feature in the reference sample set, and update the classification option of the second type feature according to the second statistical data of the second type feature in the reference sample set.
[0069] Specifically, the first type of feature can be a numerical feature, and the first statistical data represents the statistical variance of the first type of feature in the reference sample set. The second type of feature can be a classification option feature, and the second statistical data represents the probability distribution of each classification option in the second type of feature in the reference sample set. Accordingly, step S303 above may include:
[0070] Step S3031: Construct a normal distribution function based on statistical variance, and randomly generate noise values that conform to the normal distribution function.
[0071] Since the mean of the normal distribution function is 0, and the first type of feature is a numerical feature, we can perform statistical analysis on the first type of feature of each reference sample in the reference sample set to determine the statistical variance for the first type of feature. Based on this statistical variance, we can construct a normal distribution function to ensure that the first type of feature conforms to a normal distribution. Simultaneously, we can generate random noise values that conform to this normal distribution function, for example, using the inverse function of the normal distribution function or the Box-Muller transform.
[0072] Step S3032: Based on the original feature values of the first type of feature, noise values are superimposed to generate updated feature values of the first type of feature.
[0073] For the first type of feature in the sample features Xnew of a newly generated sample Snew(Xnew, y), noise values are added to its feature values with a specified probability to generate updated feature values. For example, the sample features Xnew of the newly generated sample Snew are (10, 9, A, B), where 10 and 9 represent the original feature values of the first type of feature, 10 represents the number of times the video was played, and 9 represents the number of times the video was completed. Adding a noise value of -1 to the original feature values yields the updated sample features X'new(9, 8, A, B).
[0074] By superimposing the noise value of the normal distribution function on the original feature value of the first type of feature, the first type of feature is updated. This allows for the mutation of new samples by combining the feature value of the first type of feature, so that the updated first type of feature has feature consistency with the first type of feature before the update.
[0075] Step S3033: Based on the distribution probability, replace the original classification option of the second type of feature with the target classification option, and use the target classification option as the classification option after the second type of feature is updated.
[0076] In the reference sample set, the second-type features of each reference sample are statistically analyzed to determine the probability distribution of each category corresponding to the second-type features. Target classification options are then randomly sampled based on the probability distribution of each category to replace the original classification options.
[0077] For the second type feature in the sample feature Xnew of the new sample Snew(Xnew, y), based on its original classification option, the original classification option is replaced with the target classification option with a specified probability to generate the updated classification option.
[0078] For example, the sample feature Xnew of a new sample Snew is (10, 9, A, B), where A and B represent the original classification options of the second type of feature, A representing anime and B representing beauty. If the classification options included in the reference sample set are anime, beauty, sports, news, and entertainment, with corresponding probability distributions of 10%, 25%, 15%, 20%, and 30%, respectively, and the target classification options are randomly determined according to the probability distribution as sports and entertainment, then we can replace anime and beauty with sports and entertainment respectively, thus obtaining the updated sample feature X”new(10, 9, A1, B1).
[0079] Of course, the classification options corresponding to the second type of features can also be replaced based on the sample features X'new(9, 8, A, B) after the feature values are updated, so as to generate sample features with updated feature values and classification options.
[0080] By updating the second-type features using probability distribution, the mutation of new samples can be combined with the second-type features, so that the updated second-type features have the same classification feature as the original second-type features.
[0081] Step S304: Based on the updated feature values of the first type of features and the updated classification options of the second type of features, generate expanded samples. For detailed explanations, please refer to the relevant descriptions in the above embodiments; they will not be repeated here.
[0082] Step S305: Determine the classification fitness of the expanded sample. If the classification fitness is less than the specified threshold, discard the expanded sample; if the classification fitness is greater than or equal to the specified threshold, add the expanded sample to the reference sample set.
[0083] Once the augmented samples are determined, their corresponding classification fitness is calculated. The classification fitness of these augmented samples is then compared to a specified threshold to determine the relationship between the two. If the classification fitness is less than the specified threshold, the augmented sample does not meet the requirements and is discarded. If the classification fitness is greater than or equal to the specified threshold, the augmented sample meets the requirements and is then added to the reference sample set.
[0084] Specifically, the steps for determining the classification fitness of the augmented sample include:
[0085] Step b1: Determine the target category corresponding to the reference sample set, and predict the expanded samples based on the preset classification model to generate classification probability information of the expanded samples being assigned to the target category.
[0086] Step b2: Generate the classification fitness of the augmented samples based on the classification probability information.
[0087] By analyzing the classification labels of each reference sample in the reference sample set, the target category corresponding to the reference sample set can be determined. The pre-trained classification model is then used to predict the classification of the expanded samples, thereby predicting the target category to which the expanded samples belong and determining the classification probability information of that target category. This classification probability information is then used as the classification fitness of the expanded samples.
[0088] The above method uses a pre-defined classification model to predict the classification probability information corresponding to the expanded samples in order to determine the classification fitness, thereby improving the accuracy of eliminating new samples.
[0089] The method for generating expanded samples provided in this disclosure extracts some sub-features from parent class samples to construct new samples, thereby giving the new samples multiple features and improving their feature diversity. By detecting the classification fitness of the expanded samples and a specified threshold, it is determined whether the expanded samples need to be discarded, thus realizing the elimination selection for new samples and facilitating further improvement in the amplification effect of new samples.
[0090] This embodiment also provides an apparatus for generating expanded samples, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0091] This embodiment provides an apparatus for generating expanded samples, such as... Figure 4 As shown, it includes:
[0092] The sample set acquisition unit 401 is used to acquire the reference sample set to be expanded and select at least two parent class samples from the reference sample set.
[0093] The new sample generation unit 402 is used to generate new samples based on at least two parent class samples, wherein the new samples include at least a first type feature and a second type feature.
[0094] The feature update unit 403 is used to update the feature value of the first type of feature based on the first statistical data of the first type of feature in the reference sample set, and to update the classification option of the second type of feature based on the second statistical data of the second type of feature in the reference sample set.
[0095] The expanded sample generation unit 404 is used to generate expanded samples based on the feature values updated by the first type of features and the classification options updated by the second type of features.
[0096] In some optional implementations, the sample set acquisition unit 401 described above may include:
[0097] The classification sample set acquisition sub-unit is used to obtain the classification sample set, in which each sample has its own classification label.
[0098] The target category determination subunit is used to determine the target category to be expanded among the various categories represented by the classification labels, and to determine the samples belonging to the target category in the classification sample set.
[0099] Generate sub-units to generate a set of reference samples to be expanded based on samples belonging to the target category.
[0100] The fitness determination subunit is used to determine the target number of parent class samples to be selected and to determine the classification fitness of each sample in the reference sample set.
[0101] The parent sample selection sub-unit is used to select the target number of parent samples from the reference sample set according to the classification fitness.
[0102] Specifically, the fitness determination subunit is used to: predict the target sample based on a preset classification model for any target sample in the reference sample set, so as to generate classification probability information of the target sample being classified into the target category to be expanded, wherein the preset classification model is trained based on the classification sample set in which the reference sample set is located; and generate the classification fitness of the target sample based on the classification probability information.
[0103] In some alternative implementations, the newly generated sample generation unit 402 may include:
[0104] The feature extraction subunit is used to extract partial sub-features from each parent class sample and construct new samples based on the extracted sub-features.
[0105] In some optional implementations, the first statistical data characterizes the statistical variance of the first type of feature in the reference sample set. The second statistical data characterizes the probability distribution of each classification option in the second type of feature in the reference sample set. The feature update unit 403 described above may include:
[0106] The noise generation subunit is used to construct a normal distribution function based on statistical variance and randomly generate noise values that conform to the normal distribution function.
[0107] The noise superposition subunit is used to superimpose noise values onto the original feature values of the first type of feature to generate updated feature values of the first type of feature.
[0108] The replacement sub-unit is used to replace the original classification option of the second type of feature with the target classification option according to the distribution probability, and use the target classification option as the classification option after the second type of feature is updated.
[0109] In some alternative embodiments, the above-described apparatus for generating expanded samples may further include:
[0110] The elimination selection unit is used to determine the classification fitness of the expanded sample. If the classification fitness is less than a specified threshold, the expanded sample is discarded; if the classification fitness is greater than or equal to the specified threshold, the expanded sample is added to the reference sample set.
[0111] In some alternative implementations, the elimination selection unit described above may include:
[0112] The prediction subunit is used to determine the target category corresponding to the reference sample set and to predict the expanded samples based on the preset classification model, so as to generate classification probability information of the expanded samples being assigned to the target category.
[0113] The classification fitness generation subunit is used to generate the classification fitness of the expanded samples based on classification probability information.
[0114] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.
[0115] In this embodiment, the device for generating expanded samples is presented in the form of a functional unit. Here, a unit refers to an ASIC circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above-mentioned functions.
[0116] The expanded sample generation apparatus provided in this embodiment generates new samples by selecting at least two parent class samples from a reference sample set, and updating the first type of features and the second type of features included in the new samples to achieve feature updates of different types, thereby generating expanded samples. Thus, it is possible to combine different types of features for sample expansion, ensuring the diversity of the expanded samples, thereby further improving the classification training effect of the classification model.
[0117] This invention also provides an electronic device having the above-described features. Figure 4 The apparatus shown is for generating expanded samples.
[0118] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device provided in an optional embodiment of the present invention, such as... Figure 5As shown, the electronic device may include one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other using different buses and may be mounted on a common motherboard or otherwise as required. The processor can process instructions executed within the electronic device, including instructions stored in or on memory to display graphical information of a GUI on an external input / output device (such as a display device coupled to the interface). In some alternative implementations, multiple processors and / or multiple buses may be used with multiple memories and multiple memory modules, if desired. Similarly, multiple electronic devices may be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 5 Take a processor 10 as an example.
[0119] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.
[0120] The memory 20 stores instructions executable by at least one processor 10 to cause the at least one processor 10 to perform the method shown in the above embodiments.
[0121] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the electronic device. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and these remote memories may be connected to the electronic device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0122] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.
[0123] The electronic device also includes a communication interface 30 for data communication between the electronic device and other devices or communication networks.
[0124] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.
[0125] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A method for generating expanded samples, characterized in that, The method includes: Obtain the reference sample set to be expanded, and select at least two parent class samples from the reference sample set; From each of the parent class samples, extract their respective sub-features, and construct new samples based on the extracted sub-features. The new samples include at least a first type of feature and a second type of feature. Based on the first statistical data of the first type of feature in the reference sample set, update the feature value of the first type of feature, and based on the second statistical data of the second type of feature in the reference sample set, update the classification option of the second type of feature; Based on the updated feature values of the first type of features and the updated classification options of the second type of features, an expanded sample is generated; The acquisition of the reference sample set to be expanded includes: Obtain a classification sample set, wherein each sample in the classification sample set has its own classification label, and the classification sample set includes images of multiple categories; Among the categories represented by the classification labels, the target category to be expanded is determined, and the samples belonging to the target category are determined in the classification sample set; Based on the samples belonging to the target category, a reference sample set to be expanded is generated.
2. The method according to claim 1, characterized in that, Selecting at least two parent class samples from the reference sample set includes: Determine the target number of parent class samples to be selected, and determine the classification fitness of each sample in the reference sample set; Based on the classification fitness, select the target number of parent class samples from the reference sample set.
3. The method according to claim 2, characterized in that, Determining the classification fitness of each sample in the reference sample set includes: For any target sample in the reference sample set, the target sample is predicted based on a preset classification model to generate classification probability information of the target sample being classified into the target category to be expanded; the preset classification model is trained based on the classification sample set in which the reference sample set is located. The classification fitness of the target sample is generated based on the classification probability information.
4. The method according to claim 1, characterized in that, The first statistical data characterizes the statistical variance of the first type of feature in the reference sample set; The steps for updating the feature values of the first type of feature specifically include: A normal distribution function is constructed based on the statistical variance, and noise values that conform to the normal distribution function are randomly generated; Based on the original feature values of the first type of feature, the noise value is superimposed to generate the updated feature values of the first type of feature.
5. The method according to claim 1, characterized in that, The second statistical data characterizes the distribution probability of each classification option in the second type of feature in the reference sample set; The specific steps for updating the classification options for the second type of feature include: Based on the distribution probability, the original classification option of the second type of feature is replaced with the target classification option, and the target classification option is used as the classification option after the second type of feature is updated.
6. The method according to claim 1, 4, or 5, characterized in that, After generating the augmented samples, the method further includes: Determine the classification fitness of the expanded sample. If the classification fitness is less than a specified threshold, discard the expanded sample. If the classification fitness is greater than or equal to the specified threshold, add the expanded sample to the reference sample set.
7. The method according to claim 6, characterized in that, Determining the classification fitness of the augmented samples includes: The target category corresponding to the reference sample set is determined, and the expanded samples are predicted based on a preset classification model to generate classification probability information of the expanded samples being classified into the target category; The classification fitness of the augmented samples is generated based on the classification probability information.
8. An apparatus for generating expanded samples, characterized in that, The device includes: The sample set acquisition unit is used to acquire the reference sample set to be expanded and select at least two parent class samples from the reference sample set; A new sample generation unit is used to generate new samples based on the at least two parent class samples, wherein the new samples include at least a first type of feature and a second type of feature; The feature update unit is configured to update the feature value of the first type of feature according to the first statistical data in the reference sample set, and update the classification option of the second type of feature according to the second statistical data in the reference sample set; An expanded sample generation unit is used to generate expanded samples based on the updated feature values of the first type of features and the updated classification options of the second type of features; The new sample generation unit includes: The feature extraction subunit is used to extract partial sub-features from each parent class sample and construct new samples based on the extracted sub-features; The sample set acquisition unit includes: The classification sample set acquisition subunit is used to acquire the classification sample set, in which each sample has its own classification label, and the classification sample set includes images of multiple categories; The target category determination subunit is used to determine the target category to be expanded among the categories represented by the classification labels, and to determine the samples belonging to the target category in the classification sample set; Generate sub-units to generate a set of reference samples to be expanded based on samples belonging to the target category.
9. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory being used to store a computer program that, when executed by the processor, implements the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Sample expansion method, terminal, device and readable storage medium
CN111291560A
Sample expansion method and device, equipment, storage medium and product
CN115859108A