Data sampling method, device, and storage medium

By sampling samples based on the probabilities of different metrics, the problem of data imbalance caused by a single metric in existing technologies is solved, thus improving the data balancing effect and model training efficiency.

CN115204265BActive Publication Date: 2026-11-24安徽蔚来智驾科技有限公司
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210705342.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-21
Publication Date
2026-11-24
Estimated Expiration
2042-06-21

AI Technical Summary

Technical Problem

Existing data sampling methods rely on a single metric, resulting in samples that do not match actual needs, leading to poor data balancing and impacting model training efficiency.

Method used

By obtaining the number of samples in each metric group under different metric information, and based on the total number of samples, the number of samples in each metric group, and the preset data balance parameters, the single sample probability of each training sample under each metric information is determined, and all single sample probabilities are aggregated to obtain the final single sample probability. Finally, sampling is performed based on the final single sample probability.

Benefits of technology

This resulted in samples that better matched actual needs, improved data balancing, and increased model training efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115204265B_ABST
    Figure CN115204265B_ABST
Patent Text Reader

Abstract

This invention provides a data sampling method, device, and storage medium, including: acquiring the number of samples in each metric group under different metric information; determining the single-sample probability of each training sample under each metric information based on the total number of samples, the number of samples in each metric group, and preset data balancing parameters; aggregating all single-sample probabilities of each training sample to obtain the final single-sample probability of each training sample; and sampling from all training samples based on the final single-sample probability to obtain the sampling result. This method achieves the goal of obtaining the final single-sample probability of each training sample by integrating different metric information before sampling, thus ensuring that the sampled samples are more consistent with actual needs, improving data balancing, and increasing model training efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of deep learning technology, specifically providing a data sampling method, device, and storage medium. Background Technology

[0002] In real-world data distribution, imbalance is common, with some categories having a large number of samples while others have a small number, such as image or text datasets. Using traditional classification methods on imbalanced datasets can easily lead to under-recognition of minority class samples, resulting in classification results biased towards the majority class. Imbalanced datasets can typically be balanced through data sampling.

[0003] In related technologies, commonly used data sampling methods include online sampling and offline sampling. Online sampling methods can obtain the output probability of each sample based on loss functions such as focal loss and OHEM loss, then weight the samples based on the output probabilities of each sample, and sample according to the sample weights. Offline sampling methods perform single-attribute histogram statistics on samples of different categories, analyze and determine the weight of samples in each category, and sample according to the weight of samples in each category.

[0004] However, whether it is online sampling or offline sampling, it can only sample the weights of samples corresponding to a single metric. A single metric may result in the sampled samples not matching the actual needs, leading to poor data balancing and affecting the efficiency of model training. Summary of the Invention

[0005] To overcome the above-mentioned defects, this invention is proposed to provide a data sampling method, device, and storage medium that solves, or at least partially solves, the technical problem that a single metric may lead to a mismatch between the sampled data and the actual needs, resulting in poor data balancing and affecting the efficiency of model training.

[0006] In a first aspect, the present invention provides a data sampling method, comprising:

[0007] Obtain the number of samples within each metric group under different metric information;

[0008] Based on the total number of samples, the number of samples in each metric group, and the preset data balance parameters, determine the single-sample probability of each training sample under each metric.

[0009] Aggregate all single-sample probabilities for each training sample to obtain the final single-sample probability for each training sample;

[0010] Based on the final single-sample probability, sampling is performed from all training samples to obtain the sampling results.

[0011] Furthermore, in the data sampling method described above, the data balancing parameter includes the overall sampling rate of each metric group under each metric information;

[0012] Based on the total number of samples, the number of samples in each metric group, and preset data balance parameters, determine the single-sample probability of each training sample under each metric, including:

[0013] The sampling ratio of each metric group is determined based on the total number of training samples, the number of samples in each metric group, and the overall sampling rate of the metric group.

[0014] Based on the sampling ratio of each metric group and the total number of training samples, determine the single-sample probability of each training sample under each metric information.

[0015] Furthermore, in the data sampling method described above, the data balancing parameters also include the minimum sampling ratio of each metric group and the maximum sampling ratio of each metric group;

[0016] Before determining the sampling ratio for each metric group based on the total number of training samples, the number of samples within each metric group, and the overall sampling rate of the metric group, the following steps are also included:

[0017] If the sampling ratio of each metric group is less than the minimum sampling ratio of each metric group, the minimum sampling ratio of each metric group shall be used as the sampling ratio of each metric group;

[0018] If the sampling ratio of each metric group is greater than the maximum sampling ratio of each metric group, the maximum sampling ratio of each metric group shall be used as the sampling ratio of each metric group.

[0019] Furthermore, in the data sampling method described above, the measurement information includes loss measurement information;

[0020] The data balancing parameters include the outlier threshold and the overall sampling rate of each metric group under the loss metric information;

[0021] Based on the total number of samples, the number of samples in each metric group, and preset data balance parameters, determine the single-sample probability of each training sample under each metric, including:

[0022] Set the single-sample probability of the training samples in the first set of metrics to a preset probability value; wherein, the first set of metrics is a set of metrics with a sample number less than the outlier threshold.

[0023] Based on the total number of training samples, the number of samples in the second metric group set, and the overall sampling rate of the second metric group set, the sampling ratio of the metric group in the second metric group set is determined. Furthermore, based on the sampling ratio of the metric group in the second metric group set and the total number of training samples, the single-sample probability of the training samples in the metric group in the second metric group set under the loss metric information is determined. Wherein, the metric group in the second metric group set is the metric group with a sample number greater than the outlier threshold.

[0024] Furthermore, in the data sampling method described above, before aggregating all single-sample probabilities for each training sample to obtain the final single-sample probability for each training sample, the method further includes:

[0025] If at least one single sample probability is equal to the preset probability value, the preset probability value shall be used as the final single sample probability.

[0026] Aggregate all single-sample probabilities for each training sample to obtain the final single-sample probability for each training sample, including:

[0027] If none of the single sample probabilities are the preset probability value, the single sample probabilities are aggregated according to the following aggregation method to obtain the final single sample probabilities of the training samples.

[0028] The aggregation method includes:

[0029] Take the minimum of all single-sample probabilities as the final single-sample probability of the training sample; or

[0030] Take the maximum value among all single-sample probabilities as the final single-sample probability of the training sample; or

[0031] The average of all single-sample probabilities is taken as the final single-sample probability of the training sample.

[0032] Furthermore, in the data sampling method described above, the overall sampling rate of each metric group under each metric information is determined according to the same target distribution function, or according to different target distribution functions.

[0033] Furthermore, in the data sampling method described above, the training samples are sampled based on the final single-sample probability to obtain the sampling result, including:

[0034] If the sampling method is online sampling, based on the final single sample probability, discrete distribution sampling is performed from all training samples to obtain the sampling results;

[0035] If the sampling method is offline sampling, the number of times the training samples are sampled is determined based on the final single sample probability and the total number of target samples, and sampling is performed from all training samples based on the number of samplings to obtain the sampling results.

[0036] Furthermore, in the data sampling method described above, obtaining the number of samples within each metric group under different metric information includes:

[0037] Generate histograms for different measurement information based on the preset number of groups and preset measurement range under different measurement information;

[0038] Based on histograms under different metric information, the number of samples in each metric group under different metric information is obtained.

[0039] In a second aspect, the present invention provides a data sampling device, including a processor and a storage device, the storage device being adapted to store a plurality of program codes, the program codes being adapted to be loaded and run by the processor to perform the data sampling method described in any of the preceding claims.

[0040] In a third aspect, a computer-readable storage medium is provided, wherein a plurality of program codes are stored therein, the program codes being adapted to be loaded and run by a processor to perform the data sampling method described in any of the above-mentioned technical solutions.

[0041] The above-described technical solutions of the present invention have at least one or more of the following beneficial effects:

[0042] In implementing the technical solution of this invention, the number of samples in each metric group under different metric information is obtained; based on the total number of samples, the number of samples in each metric group, and preset data balancing parameters, the single-sample probability of each training sample under each metric information is determined; all single-sample probabilities of each training sample are aggregated to obtain the final single-sample probability of each training sample; based on the final single-sample probability, sampling is performed from all training samples to obtain the sampling result. This achieves the goal of obtaining the final single-sample probability of each training sample by integrating different metric information before sampling. In this way, the sampled samples are more consistent with the actual needs, improving the data balancing effect and the model training efficiency. Attached Figure Description

[0043] The disclosure of this invention will become more readily understood with reference to the accompanying drawings. It will be readily understood by those skilled in the art that these drawings are for illustrative purposes only and are not intended to limit the scope of protection of this invention. Furthermore, similar numbers in the drawings are used to denote similar components, wherein:

[0044] Figure 1 This is a schematic flowchart of the main steps of a data sampling method according to an embodiment of the present invention;

[0045] Figure 2 This is a schematic diagram comparing the single-sample probability of training samples when the data sampling method of the present invention is used and when the data sampling method of the present invention is not used;

[0046] Figure 3 This is a main structural block diagram of a data sampling device according to an embodiment of the present invention. Detailed Implementation

[0047] Some embodiments of the present invention will now be described with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are merely illustrative of the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.

[0048] In the description of this invention, "module" and "processor" can include hardware, software, or a combination of both. A module can include hardware circuitry, various suitable sensors, communication ports, memory, and may also include software components, such as program code, or a combination of software and hardware. A processor can be a central processing unit, microprocessor, image processor, digital signal processor, or any other suitable processor. The processor has data and / or signal processing capabilities. The processor can be implemented in software, in hardware, or a combination of both. Non-transitory computer-readable storage media includes any suitable medium capable of storing program code, such as magnetic disks, hard disks, optical disks, flash memory, read-only memory, random access memory, etc. The term "A and / or B" means all possible combinations of A and B, such as only A, only B, or A and B. The terms "at least one A or B" or "at least one of A and B" have a similar meaning to "A and / or B" and can include only A, only B, or A and B. The singular terms "a" or "this" can also include plural forms.

[0049] Typically, imbalanced datasets can be balanced using data sampling methods. Common data sampling methods include online sampling and offline sampling. Online sampling methods obtain the output probability of each sample based on loss functions such as focal loss and OHEMloss, then weight the samples based on these output probabilities and sample according to the sample weights. Offline sampling methods perform single-attribute histogram statistics on samples from different categories, analyze and determine the weight of samples from each category, and sample according to the weight of samples from each category.

[0050] However, whether it is online sampling or offline sampling, it can only sample the weights of samples corresponding to a single metric. A single metric may result in the sampled samples not matching the actual needs, leading to poor data balancing and affecting the efficiency of model training.

[0051] Therefore, in order to solve the above-mentioned technical problems, the present invention provides the following technical solutions.

[0052] See appendix Figure 1 , Figure 1 This is a schematic flowchart illustrating the main steps of a data sampling method according to an embodiment of the present invention. Figure 1 As shown, the data sampling method in this embodiment of the invention mainly includes the following steps 101-104.

[0053] Step 101: Obtain the number of samples in each metric group under different metric information;

[0054] In a specific implementation process, histograms of different measurement information can be generated based on the preset number of groups and preset measurement range under different measurement information; based on the histograms of different measurement information, the number of samples in each measurement group under different measurement information can be obtained.

[0055] For example, if the metric is a category, its corresponding metric group could be pedestrians, motor vehicles, bicycles, etc., and then the sample counts for pedestrians, motor vehicles, and bicycles can be obtained respectively. If the metric is time, its corresponding metric group could be morning, noon, afternoon, etc., and then the sample counts for morning, noon, and afternoon can be obtained respectively. If the metric is a loss value, its corresponding metric group could be different loss value ranges, and the sample counts for different loss value ranges can be obtained.

[0056] Step 102: Determine the single-sample probability of each training sample under each metric based on the total number of samples, the number of samples in each metric group, and the preset data balance parameters.

[0057] In a specific implementation, the data balancing parameter may include the overall sampling rate of each metric group under each metric information. The overall sampling rate of each metric group under each metric information can be uniform or non-uniform. Furthermore, the overall sampling rate of each metric group under each metric information can be determined based on the same target distribution function or different target distribution functions, so as to train on samples for certain metric information.

[0058] In a specific implementation, the sampling ratio of each metric group can be determined based on the total number of training samples, the number of samples in each metric group, and the overall sampling rate of the metric group; and the single-sample probability of each training sample under each metric information can be determined based on the sampling ratio of each metric group and the total number of training samples.

[0059] Specifically, the technical solution of the present invention will be described using the example that the overall sampling rate of each metric group can be uniform under each type of metric information. Assuming there are 4 metric groups, the overall sampling rate of each metric group is 0.25. Assuming that the number of samples in one metric group is 10 and the total number of training samples is 20, the sampling ratio under that metric group is 0.25 / (10 / 20) = 0.5, and the single sample probability of each training sample under that metric group is 0.5 / 20 = 0.025.

[0060] It should be noted that if the single-sample probability of each training sample under each metric is too small, the number of times it is sampled during sampling may be too low; if the single-sample probability of each training sample under each metric is too large, the number of times it is sampled during sampling may be too high. Both of these factors will affect the data balance. Therefore, a minimum sampling ratio and a maximum sampling ratio for each metric group can be set as data balance parameters. In this way, if the sampling ratio of each metric group is less than the minimum sampling ratio of each metric group, the minimum sampling ratio of each metric group is used as the sampling ratio of each metric group; if the sampling ratio of each metric group is greater than the maximum sampling ratio of each metric group, the maximum sampling ratio of each metric group is used as the sampling ratio of each metric group.

[0061] In a specific implementation, the metric information may include loss metric information. If the loss value corresponding to this loss metric information is large, it indicates that the sample may be an incorrect sample, which will affect the model training efficiency. Therefore, in the actual sampling process, it is not necessary to sample this sample. To prevent such samples from being sampled, an outlier threshold can be set as a data balancing parameter. Then, the metric groups with a sample size less than the outlier threshold are grouped together and called the first metric group set, and the metric groups with a sample size greater than the outlier threshold are grouped together and called the second metric group set.

[0062] In a specific implementation, the single-sample probability of the training samples in the first metric set can be set to a preset probability value, and the training samples in the first metric set can be cleared. This preset probability value can be 0.

[0063] For the second set of metrics, the sampling ratio of the metrics in the second set of metrics can be determined based on the total number of training samples, the number of samples in the second set of metrics, and the overall sampling rate of the second set of metrics. Furthermore, the single-sample probability of the training samples in the second set of metrics under the loss metric information can be determined based on the sampling ratio of the second set of metrics and the total number of training samples.

[0064] It should be noted that if the sampling ratio of the measurement groups in the second set of measurement groups is determined to be less than the minimum sampling ratio of each measurement group, the minimum sampling ratio of each measurement group is used as the sampling ratio of the measurement groups in the second set of measurement groups; if the sampling ratio of the measurement groups in the second set of measurement groups is determined to be greater than the maximum sampling ratio of each measurement group, the maximum sampling ratio of each measurement group is used as the sampling ratio of the measurement groups in the second set of measurement groups.

[0065] Step 103: Aggregate all single-sample probabilities for each training sample to obtain the final single-sample probability for each training sample;

[0066] In a specific implementation, all single-sample probabilities can be aggregated in the following way to obtain the final single-sample probabilities of the training samples.

[0067] The aggregation method includes:

[0068] Take the minimum of all single-sample probabilities as the final single-sample probability of the training sample; or

[0069] Take the maximum value among all single-sample probabilities as the final single-sample probability of the training sample; or

[0070] The average of all single-sample probabilities is taken as the final single-sample probability of the training sample.

[0071] It should be noted that if the metric information includes loss metric information, then aggregation can be performed in the above aggregation method only when all single sample probabilities of each training sample are not the preset probability value. However, if each training sample has at least one single sample probability that is the preset probability value, the preset probability value is used as the final single sample probability, and aggregation is no longer performed.

[0072] Step 104: Based on the final single-sample probability, sample from all training samples to obtain the sampling results.

[0073] In a specific implementation, if the sampling method is online sampling, discrete distribution sampling is performed from all training samples based on the final single-sample probability to obtain the sampling result. Thus, during sampling, it is not necessary to traverse all training samples; the decision to accept a particular training sample is made solely based on the discrete distribution probability. For detailed sampling procedures, please refer to existing related technologies, which will not be elaborated upon here.

[0074] In a specific implementation, if the sampling method is offline sampling, the number of times the training samples are sampled is determined based on the final single sample probability and the total number of target samples, and sampling is performed from all training samples based on the number of samplings to obtain the sampling results.

[0075] Specifically, the sampling number can be calculated by multiplying the total target number of samples by the final single-sample probability, rounding up, and recording this value as the number of times the training sample is sampled. This ensures that every training sample is sampled. Then, based on this sampling number, samples are taken from all training samples to obtain the sampling result. For example, if the total target number of samples is 100, and the final single-sample probability of a certain training sample is 0.2, then the sampling number for that training sample is 20. Thus, sampling that training sample 20 times is sufficient. After collecting 100 samples, shuffling yields the final sampling result.

[0076] The data sampling method in this embodiment obtains the number of samples in each metric group under different metric information; determines the single-sample probability of each training sample under each metric information based on the total number of samples, the number of samples in each metric group, and preset data balancing parameters; aggregates all single-sample probabilities of each training sample to obtain the final single-sample probability of each training sample; and samples are then sampled from all training samples based on the final single-sample probability to obtain the sampling result. This method achieves the goal of obtaining the final single-sample probability of each training sample by integrating different metric information before sampling. This ensures that the sampled samples are more consistent with actual needs, improves data balancing, and increases model training efficiency.

[0077] In a specific implementation process, the implementation process and the technical effects achieved by the present invention will be described using the measurement information including RPN loss measurement information, RCNN loss measurement information and depth loss measurement information as examples.

[0078] The first step is to train a 3D monocular object detection model. After iterating through the training samples for N rounds, the RPN loss value, RCNN loss value, and depth loss value of each training sample can be read.

[0079] The second step is to calculate the final single-sample probability of each training sample under each loss metric based on the histogram. The calculation process is as follows:

[0080] (1) Input: loss value, number of groups (n_bin), overall sampling rate of each metric group, minimum sampling ratio of each metric group, maximum sampling ratio of each metric group and outlier threshold;

[0081] (2) Calculate a histogram of the loss values ​​with n_bin groups, and obtain the number of samples and the interval for each metric group;

[0082] (3) Determine the sampling ratio of each metric group based on the total number of training samples, the number of samples in each metric group, and the overall sampling rate of the metric group;

[0083] (4) If the sampling ratio of each metric group is less than the minimum sampling ratio of each metric group, the minimum sampling ratio of each metric group shall be used as the sampling ratio of each metric group; if the sampling ratio of each metric group is greater than the maximum sampling ratio of each metric group, the maximum sampling ratio of each metric group shall be used as the sampling ratio of each metric group.

[0084] (5) Determine the single-sample probability of each training sample under each metric based on the sampling ratio of each metric group and the total number of training samples;

[0085] (6) Set the single-sample probability of training samples in the metric group whose sample size is less than the outlier threshold to 0.

[0086] It should be noted that step (6) can also be completed before step (3). In this way, the probability of a single sample in the metric group with a sample size less than the outlier threshold can be calculated only later.

[0087] In a specific implementation, the same objective distribution function is used to obtain the overall sampling rate for each metric group for both RPN and RCNN loss metrics. However, a different objective distribution function is used for the depth loss metric to obtain the overall sampling rate for each metric group. This allows the model to focus more on training samples with larger depth loss values. The objective distribution function for the depth loss metric can be, but is not limited to, NumPy library functions.

[0088] The third step is to take the average of the three returned single-sample probabilities as the final single-sample probability.

[0089] It should be noted that if for a certain sample, at least one of the three single-sample probabilities is 0, then the sample is an outlier and its single-sample probability can be set to 0 directly without performing mean calculation.

[0090] Figure 2 This is a schematic diagram comparing the single-sample probability of training samples when using the data sampling method of this invention and when not using the data sampling method of this invention. For example... Figure 2 As shown, the horizontal axis can be the RPN loss value or other loss values, and the vertical axis is the single-sample probability of the training sample. The single-sample probability of the training sample without using the data sampling method of this invention is shown in label A, and the single-sample probability of the training sample with the data sampling method of this invention is shown in label B. Figure 2It can be seen that by adopting the data sampling method of the present invention, the single sample probability of the training sample under the same RPN loss value can be changed from a larger value to a smaller value, and the single sample probability of the training sample can be changed from a smaller value to a larger value, so that the single sample probability of the balanced training sample is more balanced. In this way, the probability difference of each training sample being sampled can be reduced, and the sampled data is more balanced.

[0091] Step 4: Set the target total number of samples, calculate the number of times the training samples are sampled, and sample from all training samples based on the number of times the samples are sampled to obtain the sampling results.

[0092] Based on the above method, the evaluation results after 200 training epochs on the continuous frame evaluation set increased by about 5% compared to the baseline, and after only 50 training epochs, the results increased by 10%-20% compared to the baseline. This shows that by using the data sampling method of this application, the model can not only converge faster, but also ultimately obtain better training results.

[0093] It should be noted that although the steps in the above embodiments are described in a specific order, those skilled in the art will understand that in order to achieve the effects of the present invention, different steps do not necessarily have to be executed in such an order. They can be executed simultaneously (in parallel) or in other orders, and these variations are all within the scope of protection of the present invention.

[0094] Those skilled in the art will understand that all or part of the processes in the method of the above embodiment of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer-readable storage medium can include any entity or device capable of carrying the computer program code, a medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory, a random access memory, an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc. It should be noted that the content included in the computer-readable storage medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable storage medium does not include electrical carrier signals and telecommunication signals.

[0095] Furthermore, the present invention also provides a data sampling device.

[0096] Figure 3 This is a main structural block diagram of a data sampling device according to an embodiment of the present invention.

[0097] like Figure 3 As shown, in one embodiment of a data sampling device according to the present invention, the data sampling device includes a processor 30 and a storage device 31. The storage device 31 can be configured to store a program for executing the data sampling method of the above-described method embodiment, and the processor 30 can be configured to execute the program in the storage device 31. This program includes, but is not limited to, the program for executing the data sampling method of the above-described method embodiment. For ease of explanation, only the parts related to the embodiments of the present invention are shown; for specific technical details not disclosed, please refer to the method section of the embodiments of the present invention. This data sampling device can be a control device comprising various electronic devices. It can be applied to an autonomous driving system.

[0098] Furthermore, the present invention also provides a computer-readable storage medium. In one embodiment of the computer-readable storage medium according to the present invention, the computer-readable storage medium can be configured to store a program for performing the data sampling method of the above-described method embodiments. This program can be loaded and run by processor 30 to implement the above-described data sampling method. For ease of explanation, only the parts related to the embodiments of the present invention are shown; for specific technical details not disclosed, please refer to the method section of the embodiments of the present invention. The computer-readable storage medium can be a storage device comprising various electronic devices. Optionally, in the embodiments of the present invention, the computer-readable storage medium is a non-transitory computer-readable storage medium.

[0099] Furthermore, it should be understood that since the various modules are only provided to illustrate the functional units of the device of the present invention, the physical devices corresponding to these modules may be the processor itself, or a part of the processor's software, hardware, or a combination of software and hardware. Therefore, the number of modules shown in the figures is merely illustrative.

[0100] Those skilled in the art will understand that the various modules in the device can be adaptively split or combined. Such splitting or combining of specific modules will not cause the technical solution to deviate from the principles of the present invention; therefore, the technical solutions after splitting or combining will fall within the protection scope of the present invention.

[0101] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after such changes or substitutions will all fall within the scope of protection of the present invention.

Claims

1. A data sampling method applied to image target detection, characterized in that, include: Obtain the number of samples in each metric group under different metric information, wherein the training samples in the metric group are training samples used to train the 3D monocular target detection model; Based on the total number of samples, the number of samples in each metric group, and the preset data balance parameters, determine the single-sample probability of each training sample under each metric. Aggregate all single-sample probabilities for each training sample to obtain the final single-sample probability for each training sample; Based on the final single-sample probability, sampling is performed from all training samples to obtain sampling results. The sampling results are then used to train the 3D monocular target detection model, so that the trained 3D monocular target detection model can be used for target detection. The data balancing parameters include the overall sampling rate of each metric group under each metric information, and determining the single-sample probability of each training sample under each metric information includes: The sampling ratio of each metric group is determined based on the total number of training samples, the number of samples in each metric group, and the overall sampling rate of the metric group. The sampling ratio of the metric group is the ratio between the overall sampling rate of the metric group and the sample ratio, and the sample ratio is the ratio between the number of samples in the metric group and the total number of training samples. Based on the sampling ratio of each metric group and the total number of training samples, the single-sample probability of each training sample under each metric is determined, wherein the single-sample probability of each training sample under each metric group is the ratio of the sampling ratio of each metric group to the total number of training samples.

2. The data sampling method according to claim 1, characterized in that, The data balancing parameters also include the minimum sampling ratio and the maximum sampling ratio for each metric group; Before determining the sampling ratio for each metric group based on the total number of training samples, the number of samples within each metric group, and the overall sampling rate of the metric group, the following steps are also included: If the sampling ratio of each metric group is less than the minimum sampling ratio of each metric group, the minimum sampling ratio of each metric group shall be used as the sampling ratio of each metric group; If the sampling ratio of each metric group is greater than the maximum sampling ratio of each metric group, the maximum sampling ratio of each metric group shall be used as the sampling ratio of each metric group.

3. The data sampling method according to claim 1, characterized in that, The measurement information includes loss measurement information; The data balancing parameters include the outlier threshold and the overall sampling rate of each metric group under the loss metric information; Based on the total number of samples, the number of samples in each metric group, and preset data balance parameters, determine the single-sample probability of each training sample under each metric, including: Set the single-sample probability of the training samples in the first set of metrics to a preset probability value; wherein, the first set of metrics is a set of metrics with a sample number less than the outlier threshold. Based on the total number of training samples, the number of samples in the second metric group set, and the overall sampling rate of the second metric group set, the sampling ratio of the metric group in the second metric group set is determined. Furthermore, based on the sampling ratio of the metric group in the second metric group set and the total number of training samples, the single-sample probability of the training samples in the metric group in the second metric group set under the loss metric information is determined. Wherein, the metric group in the second metric group set is the metric group with a sample number greater than the outlier threshold.

4. The data sampling method according to claim 3, characterized in that, Before aggregating all single-sample probabilities for each training sample to obtain the final single-sample probability for each training sample, the following steps are also included: If at least one single sample probability is equal to the preset probability value, the preset probability value shall be used as the final single sample probability. Aggregate all single-sample probabilities for each training sample to obtain the final single-sample probability for each training sample, including: If none of the single sample probabilities are the preset probability value, the single sample probabilities are aggregated according to the following aggregation method to obtain the final single sample probabilities of the training samples. The aggregation method includes: Take the minimum of all single-sample probabilities as the final single-sample probability of the training sample; or Take the maximum value among all single-sample probabilities as the final single-sample probability of the training sample; or The average of all single-sample probabilities is taken as the final single-sample probability of the training sample.

5. The data sampling method according to any one of claims 1-4, characterized in that, The overall sampling rate for each metric group under each type of metric information is determined according to the same target distribution function, or according to different target distribution functions.

6. The data sampling method according to claim 1, characterized in that, Based on the final single-sample probability, the training samples are sampled to obtain the sampling results, including: If the sampling method is online sampling, based on the final single sample probability, discrete distribution sampling is performed from all training samples to obtain the sampling results; If the sampling method is offline sampling, the number of times the training samples are sampled is determined based on the final single sample probability and the total number of target samples, and sampling is performed from all training samples based on the number of samplings to obtain the sampling results.

7. The data sampling method according to claim 1, characterized in that, Obtain the number of samples within each metric group under different metric information, including: Generate histograms for different measurement information based on the preset number of groups and preset measurement range under different measurement information; Based on histograms under different metric information, the number of samples in each metric group under different metric information is obtained.

8. A data sampling device, comprising a processor and a storage device, said storage device being adapted to store multiple lines of program code, characterized in that, The program code is adapted to be loaded and run by the processor to perform the data sampling method according to any one of claims 1 to 7.

9. A computer-readable storage medium storing a plurality of program codes, characterized in that, The program code is adapted to be loaded and run by a processor to perform the data sampling method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Model training method and device and electronic equipment

    CN110717515A

  • PER-DDQN-based exoskeleton assistance movable carrying system control method

    CN113103210A

  • Sample screening method and system and neural network model training method

    CN114154570A