A sample selection method and apparatus
Patent Information
- Application Number
- CN202611200572.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-07
- Publication Date
- 2026-10-30
AI Technical Summary
然而,高质量标注数据的获取仍主要依赖人工,尤其是在交通设施巡检、工业缺陷检测、医学影像分析等需要领域专业知识的计算机视觉应用场景中,人工标注不仅耗时费力,而且成本高昂,已成为制约模型实际部署的主要瓶颈
[0097]第四方面,本发明实施例提供了一种计算机设备,包括存储器,处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现如第一方面所述的样本选择方法。
Smart Images

Figure CN123014060A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the interdisciplinary fields of artificial intelligence, computer vision, and deep learning data engineering, and in particular to a sample selection method and apparatus. Background Technology
[0002] Deep learning has achieved remarkable results in computer vision tasks such as image classification, object detection, and semantic segmentation, which is inseparable from the support of large-scale labeled datasets. However, the acquisition of high-quality labeled data still mainly relies on manual labor, especially in computer vision applications that require domain expertise, such as traffic facility inspection, industrial defect detection, and medical image analysis. Manual annotation is not only time-consuming and labor-intensive, but also costly, and has become a major bottleneck restricting the practical deployment of models.
[0003] To alleviate the labeling pressure, existing technologies typically employ Active Learning (AL) methods, which iteratively select the most informative samples through active learning to reduce labeling requirements. However, its classic assumption is that all samples have equal labeling costs, i.e., the labeling cost for each sample is one unit, and the goal is to maximize model performance using k labeled samples. Summary of the Invention
[0004] To improve the quality and efficiency of sample screening and increase the selection space for active learning sample screening technology, this invention provides a sample selection method and apparatus.
[0005] In a first aspect, embodiments of the present invention provide a sample selection method, including:
[0006] The candidate sample pool input samples are selected and the training model is forward propagated to obtain the feature vector and class prediction probability distribution of each sample.
[0007] Based on the feature vector and category prediction probability distribution of each sample, a MIP model is constructed with the optimization objective of maximizing the comprehensive information gain of the samples and minimizing batch redundancy. Based on the preset constraints, the candidate sample set is obtained by solving the problem.
[0008] The candidate sample set is added to the current labeled sample set, and the sample selection training model is retrained based on the updated labeled sample set.
[0009] The above forward propagation, sample selection, and model training processes are executed iteratively until the model training reaches the preset termination condition, resulting in a trained sample selection model and a final labeled sample set.
[0010] In one or more optional embodiments, the method further includes: constructing the following MIP model with the optimization objectives of maximizing sample integrated information gain and minimizing batch redundancy:
[0011] ;
[0012] In formula 1, {0,1} represents the decision variables in the MIP model. =1 indicates that sample i is selected as a candidate sample. =0 indicates that sample i was not selected; N represents the total number of samples in the sample set used for MIP computation; Represents the proxy score for sample i; {0,1} represents the MIP binary variable, which is a redundant indicator variable when sample pairs (i,j) are selected simultaneously;
[0013] E represents the similarity between samples i and j; E represents the set of sample pairs whose pairwise similarity exceeds a preset similarity threshold τ.
[0014] In one or more alternative embodiments, the proxy score of the sample is calculated using the following formula:
[0015] , Formula 5; in Formula 5, Let M be the probability distribution of the class prediction for sample i in the m-th Monte Carlo Dropout inference, and M represent the number of times the inference is repeated by enabling the Dropout layer in the forward propagation. The recommended value for M is 10. To predict marginal uncertainty, , Formula 6; in Formula 6, That is, the difference between the probability of the largest class and the probability of the second largest class.
[0016] In one or more optional embodiments, the similarity between samples is calculated using the following formula:
[0017] ;In formula 7, and Let i and j represent the feature vectors of samples i and j, respectively. ∈[0.4, 0.6] represents the preset similarity threshold, with a preferred value of 0.5; for samples of different categories Cross-category similarity =∞.
[0018] In one or more optional embodiments, the preset constraints include:
[0019] Budget constraints:
[0020] ;
[0021] in:
[0022] , Formula 8; in Formula 8, [0.1, 0.3], where q represents the number of selected samples. This represents the arithmetic mean of the labeling costs for all N samples;
[0023] This represents the labeling cost of sample i. , formula 9;
[0024] In formula 9, This represents the predicted probability distribution of the class of sample i;
[0025] Predict Shannon entropy for the class of sample i. Formula 10; In Formula 10, ε = 1e-8, and C is the number of sample categories;
[0026] Normalized to the range [1,5];
[0027] ∈[0.5, 0.7], ∈[0.3, 0.5], which are the normalized weighting coefficients;
[0028] This represents the true category label of sample i;
[0029] This represents the prior frequency of the category to which sample i belongs. , Formula 11; For long-tail cost items, amplify the "relative cost" of tail-category samples to make them more prioritized for selection.
[0030] In one or more optional embodiments, the preset constraints include: cardinality constraints:
[0031] When the MIP model has no feasible solution, it automatically relaxes to ;
[0032] In one or more optional embodiments, the preset constraints include: complete link constraints:
[0033] .
[0034] In one or more optional embodiments, the preset constraints include: binary constraints:
[0035] , .
[0036] In one or more optional embodiments, the preset constraints include: a minimum number of entries at the category level constraint.
[0037] ,in, , [1.2, 2.0] represents the long-tail compensation factor; this constraint directly modifies the feasible region of MIP, ensuring the minimum inclusion threshold for tail-class samples.
[0038] In one or more optional embodiments, the preset constraints include: a maximum number of entries at the category level constraint.
[0039] , , ∈[0.3,0.8], is the head class inhibitory factor.
[0040] In one or more optional embodiments, the method further includes: constructing the following MIP model with the optimization objectives of maximizing sample integrated information gain and minimizing batch redundancy:
[0041] , formula 2;
[0042] In formula 2, {0,1} represents the decision variables in the MIP model. =1 indicates that sample i is selected as a candidate sample. =0 indicates that sample i was not selected; N represents the total number of samples in the sample set used for MIP computation; Represents the proxy score for sample i; {0,1} represents the MIP binary variable, which is a redundant indicator variable when sample pairs (i,j) are selected simultaneously; E represents the similarity between samples i and j; E represents the set of sample pairs whose pairwise similarity exceeds a preset similarity threshold τ. The minimum number of entries at the category level. , [1.2, 2.0] represents the long-tail compensation factor.
[0043] In one or more optional embodiments, the preset constraints include:
[0044] Budget constraints: ;
[0045] Cardinality constraint: When the MIP model has no feasible solution, it automatically relaxes to ;
[0046] Full link constraint: ;
[0047] Binary constraints: , ;
[0048] Maximum number of entries per category level: , , ∈[0.3, 0.8], which is the head class inhibitory factor.
[0049] In one or more optional embodiments, the step of predicting the probability distribution based on the feature vector and category of each sample, constructing a MIP model with the optimization objective of maximizing the comprehensive information gain of the samples and minimizing batch redundancy, and solving for the candidate sample set based on preset constraints, includes:
[0050] The candidate sample pool is divided into multiple sample sub-blocks;
[0051] For each sample sub-block, the probability distribution is predicted based on the feature vector and category of each sample in the sample sub-block. The MIP model is constructed with the optimization objective of maximizing the comprehensive information gain of the samples and minimizing batch redundancy. Based on the preset constraints, the corresponding candidate sample subset is obtained by solving.
[0052] The candidate sample subsets corresponding to the multiple sample sub-blocks are merged to obtain the candidate sample set.
[0053] In one or more optional embodiments, dividing the candidate sample pool into multiple sample sub-blocks includes:
[0054] For each sample in the candidate sample pool, based on the sample's feature vector, a vector index is constructed using FAISS and an approximate K-nearest neighbor search is performed to obtain the top K most similar neighbors of each sample and their corresponding similarity.
[0055] Based on the top K most similar neighbors of each sample and their corresponding similarity, the candidate sample pool is clustered to obtain a cluster with a preset total number of clusters;
[0056] For each cluster, iterate through all sample pairs within the cluster, calculate the sum of the cosine similarities between the feature vectors of the two samples in each sample pair, and combine the total number of all sample pairs to obtain the average similarity within the cluster.
[0057] Based on the average similarity within clusters, the size of the corresponding sample sub-block is obtained using the following formula:
[0058] , formula 3;
[0059] In formula 3, The average similarity within the cluster; The base block size; This is the block sensitivity coefficient, with a value range of [0.3, 0.7]. Minimum block size;
[0060] The maximum block size; < < ;
[0061] The corresponding clusters are divided according to the size of the sample sub-blocks to obtain at least one corresponding sample sub-block.
[0062] In one or more optional embodiments, after obtaining the candidate sample set, the method further includes:
[0063] Based on the labeling cost of each sample, the candidate sample set is divided into a preset number of cost levels, and the preset maximum selection ratio of each cost level is obtained.
[0064] The candidate sample set is traversed in descending order of the proxy scores of the samples. For each sample i:
[0065] Check if the current selected quantity of the corresponding cost category has reached the maximum selection ratio; if so, skip it.
[0066] Otherwise, check if the category to which the sample belongs has reached the maximum number of entries at the category level; if so, skip it.
[0067] Otherwise, calculate whether the maximum similarity between the sample and all samples in the selected sample set exceeds a preset similarity threshold; if so, skip this step.
[0068] Otherwise, add the sample to the selected sample set and update the remaining cost budget;
[0069] Determine if the total cost exceeds the cost budget. If so, iteratively remove the sample with the highest ratio of labeling cost to proxy score until the total cost is no greater than the cost budget, thus obtaining the selected candidate sample set.
[0070] In one or more optional embodiments, the method further includes: for each category of samples, if the number of samples is less than the minimum number of samples to be selected at the category level, then supplementing the remaining candidate samples with samples of that category in descending order of the ratio of proxy score to labeling cost, until the minimum number of samples to be selected at the category level is reached.
[0071] In one or more optional embodiments, the candidate sample pool is input into the sample selection training model and forward propagated to obtain the feature vector and class prediction probability distribution of each sample, including:
[0072] The candidate sample pool is obtained by randomly selecting a predetermined proportion of unlabeled samples from the original unlabeled sample pool;
[0073] The candidate sample pool is used to select and train the model for forward propagation, resulting in the feature vector and class prediction probability distribution for each sample.
[0074] In one or more optional embodiments, after obtaining the selected candidate sample set, the method further includes:
[0075] For any sample sub-block, calculate the category-level deviation vector between the optimal objective value of the MIP model of the sample sub-block and the solution of the greedy batch objective value of the same region;
[0076] Based on the category-level deviation vector, the sampling weights for each category of samples are calculated using the following weight update formula:
[0077] , formula 4;
[0078] In formula 4, [0.01, 0.5] represents the learning rate (preferably 0.1). express The class-level bias vector of the k-th class sample in each iteration. express The sampling weights of each category of samples in each round of iteration, Let k′ represent the sum of the weights of all categories after the update, where k′ = 1, ..., k, ..., C;
[0079] The step of randomly selecting a predetermined proportion of unlabeled samples from the original unlabeled sample pool to obtain the candidate sample pool includes:
[0080] Based on the sampling weights of each category of samples, the original unlabeled sample pool is compressed according to the preset ratio to obtain the candidate sample pool.
[0081] In one or more optional embodiments, the iterative execution of the above-described forward propagation, sample selection, and model training processes continues until the model training reaches a preset termination condition, resulting in a trained sample selection model and a final labeled sample set, including:
[0082] Iteratively execute the above forward propagation, sample selection, and model training processes, and determine whether the model training satisfies any of the following termination conditions:
[0083] The accuracy of the sample selection model remained unchanged for multiple rounds on the preset validation set;
[0084] The sample selection model has a correct classification ratio exceeding a preset classification ratio threshold in the updated labeled sample set.
[0085] The preset total number of labeled samples has been exhausted;
[0086] The mean proxy score of all samples in the candidate sample set is lower than a preset cost score threshold;
[0087] If so, output the trained sample selection model and the final labeled sample set.
[0088] In one or more alternative embodiments, before performing the step of forward propagating the model to select input samples from the unlabeled sample pool and train it to obtain the feature vector and class prediction probability distribution for each sample, the method further includes:
[0089] Collect multiple labeled samples of each sample category from the unlabeled sample pool to construct an initial labeled sample set;
[0090] Pre-training is performed based on the initial labeled sample set to obtain the initial sample selection training model.
[0091] Secondly, embodiments of the present invention provide a sample selection device, comprising:
[0092] The forward propagation module is used to select input samples from the candidate sample pool and train the model for forward propagation to obtain the feature vector and class prediction probability distribution of each sample.
[0093] The sample solving module is used to predict the probability distribution based on the feature vector and category of each sample, and construct the MIP model with the optimization objectives of maximizing the comprehensive information gain of the samples and minimizing batch redundancy. Based on the preset constraints, the candidate sample set is obtained.
[0094] The model training module is used to add the candidate sample set to the current labeled sample set, obtain and retrain the sample selection training model based on the updated labeled sample set;
[0095] The iterative control module is used to iteratively execute the above forward propagation, sample selection and model training processes until the model training reaches the preset termination condition, and obtain the trained sample selection model and the final labeled sample set.
[0096] Thirdly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the sample selection method as described in the first aspect.
[0097] Fourthly, embodiments of the present invention provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the sample selection method as described in the first aspect.
[0098] Fifthly, embodiments of the present invention provide a computer program product containing instructions that, when run on a computer device, cause the computer device to perform the sample selection method as described in the first aspect.
[0099] The beneficial effects of the above-described technical solutions provided in the embodiments of the present invention include at least the following:
[0100] The sample selection method provided in this invention constructs a MIP model with the optimization objectives of maximizing the comprehensive information gain of samples and minimizing batch redundancy. It achieves joint optimization of sample selection and cost constraints through global optimization of the MIP model, overcoming the local optima defect of greedy algorithms under non-sub-module objectives, ensuring theoretical optimality under diversity constraints, improving the accuracy and efficiency of sample selection, and enhancing the quality of sample screening. It is applicable to the construction of high-precision sample datasets in high-cost, high-labor-cost sensitive annotation scenarios such as road accident samples, rare industrial defect samples, and rare medical lesion samples. Through multiple iterations, it can ensure stable sample quality, and is particularly suitable for sample selection in long-tail distribution scenarios.
[0101] The sample selection method provided in this invention sets the cross-class similarity to a preset maximum (or infinity) for samples i and j of different classes during the construction of the MIP model. This ensures that the redundancy indicator variable representing the simultaneous selection of samples i and j in the MIP maximization objective function remains constant at 0 (i.e., forcibly excluding cross-class redundancy penalties), guaranteeing that cross-class samples are not excluded as redundant samples. For samples i and j of the same class, the similarity is calculated based on the sample pairwise similarity calculation formula. This ensures that cross-class diversity constraints are not affected by samples of the same class, meaning that samples of different classes will not mask each other, guaranteeing the diversity of class coverage.
[0102] The sample selection method provided in this invention introduces a budget constraint into the cost constraint of the MIP model. By combining a dynamic budget mechanism with annotation costs, cost factors are incorporated into the optimization, achieving cost awareness. In the cost constraint of the MIP model, an annotation cost function that integrates prediction entropy, class frequency, and long-tail frequency is introduced to quantify the annotation cost of each sample. By using a weighted term based on the inverse of class frequency, the "relative cost" of tail-class samples is amplified, making them more prioritized for selection. This achieves cost heterogeneity, making it easier for tail-class samples to be effectively screened in MIP optimization. This addresses the sample selection imbalance problem in long-tail scenarios from the source, significantly improving overall resource utilization.
[0103] The sample selection method provided in this embodiment of the invention improves the accuracy of solving the MIP model by introducing a pairwise similarity penalty term and a complete link constraint to perform pairwise diversity penalty.
[0104] The sample selection method provided in this invention introduces a category-level sampling rate control mechanism in the cost constraint of the MIP model. By constraining the minimum number of entries at the category level, sufficient tail class coverage can be provided in extreme long-tail scenarios (such as a category frequency <1%), ensuring that tail class samples are sufficiently representative in each round of query. At the same time, it avoids insufficient coverage of the head class due to overcompensation. Moreover, by constraining the maximum number of entries at the category level, it can ensure that the number of head class samples will not exceed the limit, overcoming the inherent NP-hard property of the MIP model and significantly improving the recall rate of tail class samples.
[0105] The sample selection method provided in this invention employs a self-organizing block strategy. It optimizes causal logic through sample density clustering and average similarity within clusters. Based on pre-set baseline block size, minimum block size, and maximum block size, it uses an adaptive block calculation formula to divide the candidate sample pool into multiple sample sub-blocks. The number of sample sub-blocks and the number of samples in each sub-block are dynamically determined based on the sample distribution density, rather than a fixed, equal division. The more similar the samples within a cluster (high clustering), the smaller the sample sub-block size (only a few representatives are needed for coverage). Conversely, the more discrete the samples within a cluster, the larger the sample sub-block size (more samples are needed for coverage). This directly solves the technical problem of "fixed sample block size clustering mechanisms leading to the dilution of long-tail clusters," overcomes the efficiency bottleneck of fixed block division when sample distribution is uneven, and shortens the MIP solution time.
[0106] The sample selection method provided in this invention strengthens the causal logic of "MIP hard constraint embedding" and "greedy compensation" by adopting hierarchical greedy global resource allocation and performing hierarchical constraint greedy global screening, thus balancing sample selection accuracy and computational efficiency.
[0107] The sample selection method provided in this embodiment of the invention effectively improves the recall rate of tail class samples based on a class compensation mechanism during the greedy screening stage, and solves the sample sparsity problem caused by class imbalance.
[0108] The sample selection method provided in this embodiment of the invention is based on the above-mentioned cross-mode bias feedback closed-loop mechanism. It utilizes the category-level solution bias generated between the optimal solution value of the MIP sub-block and the greedy batch target value to reversely correct the category sampling weight. Based on the global average bias obtained by class bias aggregation, it synchronously adjusts the MIP diversity coefficient and the greedy scoring parameters, so that the category sampling weight, MIP diversity constraint strength and greedy screening threshold are dynamically updated with the iteration process. This continuously reduces the performance gap between the greedy strategy and the optimal MIP strategy in multiple iterations and improves the stability of the long-term iteration process.
[0109] Other features and advantages of the invention will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description and the accompanying drawings.
[0110] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0111] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:
[0112] Figure 1 This is a flowchart illustrating the sample selection method provided in an embodiment of the present invention;
[0113] Figure 2 This is a structural block diagram of the sample selection device provided in the embodiments of the present invention;
[0114] Figure 3 This is a structural block diagram of a computer device provided in an embodiment of the present invention. Detailed Implementation
[0115] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0116] The inventors discovered that the mainstream active learning sample selection algorithms in the current industry are mainly divided into three categories: random sampling, greedy sampling, and MIP optimal sampling. However, all three types of active learning sample selection algorithms have obvious advantages and disadvantages:
[0117] (1) Random sampling: It has the lowest computational cost and the simplest deployment, but it lacks targeted screening logic, resulting in severe loss of rare tail-class samples and extremely low overall information gain of batch samples.
[0118] (2) Greedy sampling: Represented by Core-Set and BatchBALD, it relies on linear iterative optimization logic to adapt to massive data and is the mainstream industrial solution. However, when the objective function simultaneously integrates sample information gain and similarity redundancy penalty, the composite objective function loses its submodality and the greedy algorithm loses its fixed upper bound on approximation error.
[0119] (3) MIP optimal sampling: Represented by the method provided in MS Reynaud et al., "Subset Selection via MIP," JMLR, 2022, global optimal subset selection is achieved through mixed integer programming (MIP). However, it is only applicable to small-scale static datasets and cannot adapt to the constraints of massive samples and heterogeneity of annotation costs in active learning iterative scenarios.
[0120] Specifically, existing active learning sample selection algorithms have the following obvious drawbacks:
[0121] (1) Neglecting cost heterogeneity: Existing uncertainty-based sampling methods (random sampling) generally ignore the heterogeneity of sample labeling costs, tending to prioritize samples with high uncertainty but extremely high labeling costs, resulting in wasted labeling budgets and low overall resource utilization.
[0122] (2) Optimization dilemma of diversity constraints: Although diversity-based sampling methods (such as Core-Set) (greedy sampling) can improve sample coverage, after introducing a pairwise sample diversity penalty term, the objective function no longer satisfies the submodality, that is, the submodality is lost, which causes the traditional greedy algorithm to lose the approximation ratio guarantee and is very easy to fall into local optima, making it difficult to obtain high-quality sample screening results.
[0123] (3) Lack of global optimization: Existing technologies lack a unified global optimization framework. Conventional cost-aware greedy methods can only adapt to simple cost (labeling cost) constraints and cannot simultaneously model multiple optimization objectives such as sample information gain, labeling cost and sample diversity. The screening results do not have global optimality.
[0124] In order to at least partially solve the technical problems existing in the prior art, the inventors made this invention after further research and development, providing a sample selection method and apparatus.
[0125] Example 1
[0126] This invention provides a sample selection method, referring to... Figure 1 As shown, the method includes:
[0127] S101: Select the input samples from the candidate sample pool, train the model, and perform forward propagation to obtain the feature vector and class prediction probability distribution of each sample;
[0128] S102: Based on the feature vector and category of each sample, predict the probability distribution, construct the MIP model with the optimization objective of maximizing the comprehensive information gain of the samples and minimizing batch redundancy, and solve the candidate sample set based on the preset constraints.
[0129] S103: Add the candidate sample set to the current labeled sample set, and retrain the sample selection training model based on the updated labeled sample set;
[0130] S104: Iteratively execute the above forward propagation, sample selection, and model training processes until the model training reaches the preset termination condition, and obtain the trained sample selection model and the final labeled sample set.
[0131] In this embodiment of the invention, in step S101, the sample selection training model can employ existing deep learning models, including but not limited to ResNet-18, ResNet-50, EfficientNet (EfficientNet-B0~B7), and ViT (Vision Transformer) as the backbone network. The candidate sample pool can be obtained by randomly selecting from the original unlabeled sample set and compressing it according to a preset ratio. This original unlabeled sample pool can be an unlabeled sample pool U obtained by a processor (e.g., a synthetic simulation dataset (TrafficDataset, 512-dimensional feature vectors, simulating a long-tailed distribution) containing 100,000 samples (512-dimensional feature vectors) used to verify algorithm performance), encompassing multiple preset sample categories. Taking road defect samples in a traffic defect detection scenario as an example, the sample categories can include crack samples, pothole samples, repair samples, settlement samples, and normal samples. Image data of each sample in the candidate sample pool is acquired and input into the sample selection training model for forward propagation to obtain the feature vector and category prediction probability distribution of each sample. This step can be accelerated by GPU / TPU hardware for forward propagation. Taking the image data of sample i as an example, which is input into a sample selection training model with ResNet-18 as the backbone network, a 512-dimensional embedding vector can be extracted from the penultimate layer of the network. Obtain the class prediction probability distribution from the softmax layer. Of course, the unlabeled sample pool mentioned above can also be other types of image datasets, such as the FashionMNIST real image dataset.
[0132] In this embodiment of the invention, before sample labeling, the category frequency can be obtained from data source metadata statistics or preliminary sampling estimation. For scenarios with unknown class frequencies, use uniform prior frequencies. This serves as an initial estimate and is updated progressively as the annotation process continues.
[0133] In this embodiment of the invention, before performing step S101, the following may be included:
[0134] Construct an initial labeled sample set from multiple labeled samples of each sample category collected from the unlabeled sample pool;
[0135] Pre-training is performed based on the initial labeled sample set to obtain the initial sample selection training model.
[0136] In this embodiment of the invention, when constructing an initial labeled sample set from multiple labeled samples of each sample category collected from the unlabeled sample pool, a certain number of samples can be manually labeled from each sample category collected from the unlabeled sample pool to obtain labeled samples. For example, 10 labeled samples are selected for each tail category (such as crack samples, crater samples, repair samples, and settlement samples), while 750 samples are selected for each head category (such as normal samples) to form the initial labeled sample set. .
[0137] In this embodiment of the invention, step S101 above involves forward propagating the candidate sample pool input sample selection training model to obtain the feature vector and class prediction probability distribution of each sample, including:
[0138] The candidate sample pool is obtained by randomly selecting a predetermined proportion of unlabeled samples from the original unlabeled sample pool;
[0139] The candidate sample pool is used to select and train the model for forward propagation, resulting in the feature vector and class prediction probability distribution for each sample.
[0140] In this embodiment of the invention, the random sampling strategy for randomly selecting samples from the original unlabeled sample pool can employ weighted randomness, stratified weighted randomness, importance sampling, Poisson sampling, etc., and no specific limitation is made here. The preset ratio can be determined according to actual needs; for example, the preset ratio γ can range from [0.2, 0.5], preferably γ=0.3.
[0141] In this embodiment of the invention, in step S102 above, when constructing the MIP model, the decision variables of the MIP model are first designed in conjunction with business requirements:
[0142] {0,1} represents the decision variables in the MIP model. =1 indicates that sample i is selected as a candidate sample. =0 indicates that sample i was not selected;
[0143] The true category label (category index) of sample i is a known data label;
[0144] The prior frequency of the class to which sample i belongs is given by the formula: Definition: N represents the prior frequency of the class to which sample i belongs, and N represents the total number of samples in the sample set used for MIP calculation. The total number of sample categories;
[0145] {0,1}: A MIP binary variable representing a redundant indicator variable when sample pairs (i,j) are selected simultaneously. This indicates that samples i and j are selected simultaneously; otherwise, .
[0146] In one specific embodiment, the MIP model constructed above, with the optimization objectives of maximizing the comprehensive information gain of samples and minimizing batch redundancy, is as follows:
[0147] , formula 1;
[0148] In formula 1, Represents the proxy score for sample i; This indicates the similarity between samples i and j;
[0149] E represents the set of sample pairs whose pairwise similarity exceeds a preset similarity threshold τ.
[0150] In one specific embodiment, the proxy score of sample i The uncertainty fraction can be calculated using the following formula:
[0151] ;
[0152] middle, Let M be the probability distribution of the class prediction for sample i in the m-th Monte Carlo Dropout inference, where M represents the number of times the inference is repeated by enabling the Dropout layer in the forward propagation, M∈[5, 20], and the recommended value of M is 10. To predict marginal uncertainty, , Formula 6; in Formula 6, That is, the difference between the probability of the largest class and the probability of the second largest class.
[0153] In this embodiment of the invention, the above-mentioned uncertainty score calculation formula combines prediction entropy (measuring overall uncertainty) with prediction marginal uncertainty (measuring confidence redundancy), overcoming the redundancy defect of a single uncertainty index.
[0154] In some other embodiments, the proxy score of sample i described above It can also be calculated using various uncertainty indicators such as BALD score, gradient variance, and expected model output change. Specific implementation methods can be found in the detailed descriptions in existing technologies, and will not be elaborated upon here.
[0155] In one specific embodiment, the similarity between samples i and j can be calculated using the following formula for pairwise similarity:
[0156] , Formula 7;
[0157] In formula 7, and Let i and j represent the feature vectors of samples i and j, respectively. ∈[0.4, 0.6] represents the preset similarity threshold, with a preferred value of 0.5; ε=1e-8 is to avoid numerical overflow; for samples of different categories Cross-category similarity =∞ (when) ≠ ).
[0158] In this embodiment of the invention, for samples i and j of different categories, the cross-category similarity is set to a preset maximum value (or infinity) to maximize the MIP objective function. The value is always equal to 0 (i.e., forcibly excluding cross-class redundancy penalties), ensuring that cross-class samples are not excluded as redundant samples. For samples i and j of the same class, the similarity is calculated based on the sample pairwise similarity formula. This ensures that cross-class diversity constraints are not affected by samples of the same class, meaning that samples from different classes will not mask each other, guaranteeing the diversity of class coverage.
[0159] In some other embodiments, the similarity measure between samples can also be calculated using Euclidean distance, InfoNCE feature distance, or DINO feature similarity. Specific implementation methods can be found in the detailed descriptions in the prior art, and will not be repeated here.
[0160] In this embodiment, based on the above MIP model, maximizing represents high selection uncertainty ( Large and low diversity Larger sample pairs are added to the labeled set to maximize information gain.
[0161] The inventors discovered that existing mainstream long-tail optimization methods such as Focal Loss and Class-Balanced Loss are all applied during the model training phase, optimizing the model training effect through loss function reweighting. However, they do not optimize the sample selection phase and are not suitable for MIP-optimized sample selection scenarios. They cannot solve the core pain points of MIP optimization, such as tail class samples being easily "squeezed out" of the feasible region and tail class samples being difficult to effectively screen, and cannot fundamentally improve the sample selection imbalance problem in long-tail scenarios. If long-tail weights are directly added to the MIP objective function, due to the strictness of the MIP solver on the feasible region boundary, it is very easy to lead to no feasible solution or solution timeout.
[0162] To address this, the inventors considered introducing budget constraints when constructing the MIP model, designing a mechanism that ensures long-tail coverage without compromising MIP solution efficiency. By combining a dynamic budget mechanism with annotation costs, cost factors are incorporated into the optimization, achieving cost awareness. This makes it easier for tail-class samples in MIP optimization to be effectively screened, thus improving the sample selection imbalance problem in long-tail scenarios from the source. Specifically, in this embodiment of the invention, the preset constraints include budget constraints:
[0163] ;
[0164] in:
[0165] , Formula 8; in Formula 8, [0.1, 0.3] represents the budget margin, and q represents the number of selected samples. This represents the arithmetic mean of the labeled costs of all N samples; this constraint ensures that the total cost of the selected q samples does not exceed (1 + ... ... This provides a reasonable margin for budget allocation;
[0166] This represents the labeling cost of sample i. , formula 9;
[0167] In formula 9, This represents the predicted probability distribution of the class of sample i; Predict Shannon entropy for the class of sample i. Formula 10; In Formula 10, ε = 1e-8, and C is the number of sample categories;
[0168] Normalized to the range [1,5];
[0169] ∈[0.5, 0.7], ∈[0.3, 0.5], which are the normalized weighting coefficients;
[0170] This represents the true category label of sample i;
[0171] This represents the prior frequency of the category to which sample i belongs. , Formula 11; For the long-tail cost term, the "relative cost" of the tail class samples is amplified, making the total cost of the tail class samples significantly higher than that of the head class samples (normal samples), making them more likely to be selected in the MIP solution.
[0172] The sample selection method provided in this invention introduces a budget constraint into the cost constraint of the MIP model. By combining a dynamic budget mechanism with annotation costs, cost factors are incorporated into the optimization, achieving cost awareness. In the cost constraint of the MIP model, an annotation cost function that integrates prediction entropy, class frequency, and long-tail frequency is introduced to quantify the annotation cost of each sample. By using a weighted term based on the inverse of class frequency, the "relative cost" of tail-class samples is amplified, making them more prioritized for selection. This achieves cost heterogeneity, making it easier for tail-class samples to be effectively screened in MIP optimization. This addresses the sample selection imbalance problem in long-tail scenarios from the source, significantly improving overall resource utilization.
[0173] In this embodiment of the invention, the preset constraints include: cardinality constraints:
[0174] When the MIP model has no feasible solution, it automatically relaxes to .
[0175] In this embodiment of the invention, the preset constraints include: complete link constraints:
[0176] , Formula 12;
[0177] The sample selection method provided in this embodiment of the invention improves the accuracy of solving the MIP model by introducing a pairwise similarity penalty term and a complete link constraint to perform pairwise diversity penalty.
[0178] In this embodiment of the invention, the preset constraints include: binary constraints:
[0179] , .
[0180] Based on their analysis, the inventors discovered that the theoretical analysis of the long-tail distribution problem in existing technologies faces significant difficulties in adapting to MIP. Specifically, in the long-tail distribution scenario, assuming the dataset has K categories and the category frequency distribution is as follows... ,in >> (The frequency of head classes is much higher than that of tail classes). In the objective function of existing MIP methods, the probability of each sample being selected mainly depends on its information score, i.e., the surrogate score. And agent score This is related to the uncertainty of the samples. In long-tail scenarios, the number of head class samples is large, even if the proxy score of a single sample is high. The percentage is relatively low, but the overall probability of selection is high; the number of tail class samples is small, so even the proxy score of a single sample is low. While the overall selection probability is relatively high, it remains low. This leads to a severe mismatch between the number of tail-class samples selected in each round of query and their true proportion, resulting in a persistently low tail-class recall rate. Through further experiments, the inventors embedded category-level sampling rate control as a hard constraint into the optimization objective when constructing the cost constraint of the MIP model. Based on this, in this embodiment of the invention, the preset constraint conditions include: a minimum number of selections at the category level constraint.
[0181] ,in, , [1.2, 2.0] represents the long-tail compensation factor; this constraint directly modifies the feasible region of MIP, ensuring the minimum inclusion threshold for tail-class samples.
[0182] The preset constraints also include: a maximum number of entries at the category level constraint.
[0183] , , ∈[0.3,0.8], is the head class inhibitory factor.
[0184] The sample selection method provided in this invention introduces a category-level sampling rate control mechanism in the cost constraint of the MIP model. By constraining the minimum number of entries at the category level, sufficient tail class coverage can be provided in extreme long-tail scenarios (such as a category frequency <1%), ensuring that tail class samples are sufficiently representative in each round of query. At the same time, it avoids insufficient coverage of the head class due to overcompensation. Moreover, by constraining the maximum number of entries at the category level, it can ensure that the number of head class samples will not exceed the limit, overcoming the inherent NP-hard property of the MIP model and significantly improving the recall rate of tail class samples.
[0185] Among them, the minimum number of entries at the category level constraint Maximum number of entries per category level All are determined by category frequency Dynamically determined, this constraint directly modifies the feasible domain of MIP, ensuring the minimum inclusion threshold for tail class samples.
[0186] The sample selection method provided in this invention embeds category-level sampling rate control as a hard constraint of the MIP model into the optimization objective, forming a unified optimization framework with cost awareness and diversity constraints, thereby achieving deep integration of category constraints and the MIP model.
[0187] In another specific embodiment, the MIP model constructed above, with the optimization objectives of maximizing the comprehensive information gain of samples and minimizing batch redundancy, is as follows:
[0188] , formula 2;
[0189] The difference between this MIP model and the MIP model described above is that the MIP model constructed in this way replaces the category-level sampling rate control with a soft constraint, that is, it incorporates the minimum number of selections at the category level into the objective function instead of a hard constraint, and adds a penalty term to the objective function. , For the penalty term parameter, [0.1, 0.3]. The constraints of this MIP model can be found in the detailed description of the constraints of the MIP model above, and will not be repeated here.
[0190] In one specific embodiment, step S102 above, which involves predicting the probability distribution based on the feature vector and category of each sample, constructing a MIP model with the optimization objective of maximizing the overall information gain of the samples and minimizing batch redundancy, and solving for the candidate sample set based on preset constraints, specifically includes:
[0191] The candidate sample pool is divided into multiple sample sub-blocks;
[0192] For each sample sub-block, the probability distribution is predicted based on the feature vector and category of each sample in the sample sub-block. The MIP model is constructed with the optimization objective of maximizing the comprehensive information gain of the samples and minimizing batch redundancy. Based on the preset constraints, the corresponding candidate sample subset is obtained by solving.
[0193] The candidate sample subsets corresponding to the multiple sample sub-blocks are merged to obtain the candidate sample set.
[0194] The inventors discovered that existing sampling methods suffer from a 20-40 percentage point difference in accuracy between the head and tail categories, with severely low recall rates for tail category samples. The reasons for this include: existing clustering mechanisms are prone to misassigning a small number of tail category samples to high-density clusters, leading to over-filtering of tail category samples; conventional cost estimation methods rely solely on inverse category frequency weighting, failing to meet the category balance requirements of long-tail distributions; and diversity constraints only consider intra-class diversity, neglecting inter-class diversity constraints, resulting in sample selection concentrated in the head category, further exacerbating the problem of missing tail category samples.
[0195] To address this, the inventors propose a self-organizing block-splitting strategy: based on clustering algorithms and cluster cohesion assessment, adaptive block-splitting of samples is achieved, according to the average similarity within clusters and a pre-set baseline block size. Minimum block size and maximum block size Establish a formula for calculating the size of a sample sub-block to obtain the size of the corresponding sample sub-block.
[0196] Based on this self-organizing block strategy, the candidate sample pool is divided into multiple sample sub-blocks, specifically including:
[0197] For each sample in the candidate sample pool, based on the sample's feature vector We use FAISS to construct a vector index and perform an approximate K-nearest neighbor search to obtain the top K most similar neighbors of each sample and their corresponding similarity.
[0198] Based on the top K most similar neighbors of each sample and their corresponding similarity, the candidate sample pool is clustered to obtain a cluster with a preset total number of clusters;
[0199] For each cluster, iterate through all sample pairs within the cluster, calculate the sum of the cosine similarities between the feature vectors of the two samples in each sample pair, and combine the total number of all sample pairs to obtain the average similarity within the cluster.
[0200] Based on the average similarity within clusters, the size of the corresponding sample sub-block is obtained using the following formula:
[0201] , formula 3;
[0202] In formula 3, The average similarity within the cluster; The base block size;
[0203] This is the block sensitivity coefficient, with a value range of [0.3, 0.7]. Minimum block size;
[0204] The maximum block size; < < ;
[0205] The corresponding clusters are divided according to the size of the sample sub-blocks to obtain at least one corresponding sample sub-block.
[0206] In this embodiment of the invention, the above clustering process can employ the K-Means++ algorithm or density-based clustering algorithms such as DBSCAN and HDBSCAN to perform clustering on the sample pool. Clustering.
[0207] For each sample in the candidate sample pool, the above is performed based on the sample's feature vector. Using FAISS, a vector index is constructed and an approximate K-nearest neighbor search is performed to obtain the top K most similar neighbors of each sample and their corresponding similarities, specifically including:
[0208] For each sample in the candidate sample pool U′ Using a 512-dimensional feature vector set extracted from the penultimate layer of the sample selection training model (deep learning model) as input, a vector index is constructed using FAISS, and an approximate K-nearest neighbor query (K=15 nearest neighbors) is performed to obtain the top K most similar neighbors and cosine similarity for each sample. This neighbor relationship is used for subsequent intra-cluster clustering evaluation to calculate the average similarity between each sample and other samples in its cluster. Subsequently, the feature vector set is directly used as the sample representation, and the K-Means++ algorithm is used to cluster the set, setting the number of clusters. ∈[50,100], preferred =70, thus obtaining There are several clusters. Using this sample density clustering method, each cluster Cc contains several samples and their corresponding feature vectors, which serve as the basis for subsequent adaptive sub-block partitioning to obtain the sample sub-block size.
[0209] In one specific embodiment, for each cluster, all sample pairs within the cluster are traversed, and the sum of the cosine similarities between the feature vectors of the two samples in each sample pair is calculated. Combining this with the total number of all sample pairs, the average similarity within the cluster is obtained, including:
[0210] For each cluster, iterate through all sample pairs within the cluster, calculate the sum of the cosine similarities between the feature vectors of the two samples in each sample pair, and combine this with the total number of all sample pairs. Based on the following formula for calculating the average similarity within the cluster, the average similarity within the cluster is then calculated:
[0211] , Formula 13;
[0212] In formula 13, This represents the number of samples contained in cluster Cc. It is the reciprocal of the total number of sample pairs; Represents the sample feature vector of sample pair (i,j) and Cosine similarity between them.
[0213] In this embodiment of the invention, the above-mentioned reference block size Minimum block size and maximum block size It can be set according to actual needs, for example, =3000、 =500、 =5000.
[0214] Based on the above steps, adaptive sub-block partitioning is performed. After dividing the candidate sample pool into multiple sample sub-blocks, in step S102 above, when solving the problem, a MIP model is constructed for each sample sub-block.
[0215] In this embodiment of the invention, the above-mentioned sample density clustering and average similarity within clusters (cluster cohesion evaluation) are performed, and causal logic optimization is carried out based on a pre-set benchmark block size. Minimum block size and maximum block size By utilizing an adaptive block division calculation formula, the candidate sample pool is divided into multiple sample sub-blocks. The number of sample sub-blocks and the number of samples in each sub-block are dynamically determined based on the sample distribution density, rather than a fixed, equal division. The more similar the samples within a cluster (high clustering), the smaller the sample sub-block size (only a small number of representatives are needed for coverage). Conversely, the more discrete the samples within a cluster, the larger the sample sub-block size (more samples are needed for coverage). This directly solves the technical problem of "fixed sample block size clustering mechanisms causing dilution of long-tailed clusters." It also solves the efficiency bottleneck of fixed block division when the sample distribution is uneven, shortening the MIP solution time. Combined with pre-random screening, the effective processing boundary of MIP is extended from thousands to hundreds of thousands.
[0216] In this embodiment of the invention, during the MIP model solution process, K-nearest neighbor sparsity, MIP hot start, and cutting plane acceleration strategies can be enabled. Specifically, please refer to the detailed description in the prior art. Specifically, K-nearest neighbor sparsity retains only the top K most similar neighbors of each sample, where K ranges from [10, 30], reducing the number of variables to O(NK). For example, for each sample i, the pairwise similarity between it and all other samples j is calculated. Only retain The K neighbors with the largest values are selected as elements in the neighbor set E. K=15 is the recommended value, determined through cross-validation.
[0217] In this embodiment of the invention, the MIP module can be adapted to various commercial and open-source integer programming solvers (SCIP, HiGHS, OR-Tools, etc.).
[0218] The inventors discovered that in existing technologies, the optimization scale and computational efficiency of MIP optimization and greedy algorithms are disconnected. Specifically, the global optimal solution of mixed integer programming (MIP) can only stably handle thousands of samples. When the number of samples exceeds the limit, problems such as solution timeout and memory overflow will occur. On the other hand, the greedy algorithm can adapt to hundreds of thousands of massive samples with its linear computational complexity, but its optimization accuracy is limited. There is a natural boundary in the scale of computational power between the two, and existing technologies cannot balance the sampling accuracy and computational efficiency.
[0219] Further analysis by the inventors revealed four dimensions of boundary conflict between the MIP model and the greedy algorithm, resulting in a natural and insurmountable technical boundary separation between the global optimal solution of MIP and the greedy approximation solution. These specifically include:
[0220] (1) Boundary of optimality theory: MIP traverses the entire feasible region and outputs the global optimum; the greedy algorithm successively selects the local optimum, and there is no guarantee of convergence of the deviation under non-sub-module objectives.
[0221] (2) Computing power scale boundary: The complexity of MIP solution increases exponentially with the sample size. Under the standard configuration of commercial solvers, the effective sample size of a single batch is within the thousands. Greedy algorithm has linear logarithmic complexity, and can process hundreds of thousands of samples in seconds.
[0222] (3) Iterative performance boundary: MIP has no cumulative bias after multiple iterations; greedy local bias continues to accumulate, and the recall rate of rare samples continues to decline.
[0223] (4) Constraint adaptation boundary: MIP accurately carries multiple hard constraints, and the solution results are fully compliant; the greedy post-iteration verification of constraints is prone to budget overruns and sample redundancy under multiple constraints.
[0224] To address this, the inventors propose a hierarchical constraint greedy global resource allocation strategy. After obtaining the candidate sample set, the strategy uses the candidate sample set output by all sample sub-blocks MIP as input to perform hierarchical constraint greedy global screening.
[0225] Based on this, in one specific embodiment, after obtaining the candidate sample set, the method further includes:
[0226] According to the labeling cost of each sample The candidate sample set is divided into a preset number of cost tiers, and a preset maximum selection ratio for each cost tier is obtained. ;
[0227] According to the proxy score of the sample Traverse the candidate sample set in descending order. For each sample i:
[0228] Check if the current selected quantity for the corresponding cost level has reached the maximum selection ratio. If so, skip;
[0229] Otherwise, check whether the number of samples in a given category has reached the maximum number of entries allowed at that category level. If so, skip;
[0230] Otherwise, calculate whether the maximum similarity between the sample and all samples in the selected sample set exceeds a preset similarity threshold; if so, skip this step.
[0231] Otherwise, add the sample to the selected sample set and update the remaining cost budget B. , Formula 14;
[0232] Determine if the total cost exceeds the cost budget; if so, iteratively remove the annotation cost. With agent score The sample with the highest ratio is selected until the total cost does not exceed the cost budget, thus obtaining the refined candidate sample set.
[0233] In this embodiment of the invention, because of the labeling cost Normalized to 1-5, so the labeling cost per sample can be calculated. The candidate sample set is divided into 5 levels (corresponding to cost values 1 to 5).
[0234] The sample selection method provided in this invention strengthens the causal logic of "MIP hard constraint embedding" and "greedy compensation" by adopting hierarchical greedy global resource allocation and performing hierarchical constraint greedy global screening, thus balancing sample selection accuracy and computational efficiency.
[0235] In one specific embodiment, the method may also employ a fallback mechanism of class compensation to supplement sparse tail class samples. Specifically, the method further includes:
[0236] For each category of samples, if the number of samples is less than the minimum number of samples to be selected for each category level... Then, from the remaining candidate samples, select according to proxy score. With labeling cost The ratio is used to supplement the selection of samples in descending order for that category until the minimum number of samples to be selected at each category level is reached. .
[0237] The sample selection method provided in this embodiment of the invention effectively improves the recall rate of tail class samples based on a class compensation mechanism during the greedy screening stage, and solves the sample sparsity problem caused by class imbalance.
[0238] In one specific embodiment, after obtaining the selected candidate sample set, the method further includes a multi-parameter closed-loop iterative update step based on the cross-mode bias feedback closed-loop mechanism.
[0239] Specifically, the multi-parameter closed-loop iterative update step of the cross-mode deviation feedback closed-loop mechanism includes a deviation calculation step and a parameter adaptive update step based on deviation feedback. The deviation calculation step is used to calculate the solution difference between the MIP optimization mode and the greedy sampling mode, and to generate a feedback signal for subsequent parameter adjustment.
[0240] The aforementioned bias comprises two parts: the overall global bias of the sub-block and the category-level bias vector. The overall global bias of the sub-block is used to macroscopically evaluate the overall performance gap between the greedy sampling strategy and the optimal solution of the MIP in the current sample sub-block, serving only as a performance monitoring indicator. The category-level bias vector is used to detect the sampling imbalance of different categories of samples and serves as a feedback control signal to drive the adaptive adjustment of category sampling weights, MIP diversity coefficients, and greedy scoring parameters.
[0241] Specifically, the execution process includes the following:
[0242] For any sample sub-block, calculate the optimal objective value of the MIP model for that sample sub-block. Greedy batch target value in the same region Obtain the global deviation of the sub-block , .
[0243] In this embodiment of the invention, the overall global deviation of the sub-block This represents the overall performance gap between the optimal MIP solution and the greedy sampling result in the current sample sub-block. Since the overall global deviation can only reflect the overall performance gap of the entire sample sub-block and cannot distinguish the sampling bias between different categories of samples, the overall global deviation does not directly participate in parameter updates.
[0244] To achieve a finer perception of selection bias across different sample categories, the relative bias at the category level is further calculated according to the sample category. Let the total number of sample categories be C. For the k-th category sample, the category bias is calculated as follows:
[0245] , Formula 15;
[0246] In Formula 15, k is the sample category index, k=1,2,…,C, where C represents the total number of sample categories; Let be the optimal objective function value for the k-th class of samples under the MIP model (Formula 1); Let be the objective function value corresponding to the k-th class sample under the greedy algorithm (Formula 1); This represents the preset smoothing coefficient, used to avoid anomalies caused by a denominator of zero during calculation; when When, it indicates that the sampling performance obtained by the greedy algorithm in the k-th class of samples is lower than the optimal result of MIP, indicating that there is insufficient sample coverage or omission in this class; when When the result is 0, it means that the greedy algorithm and the MIP solution are basically the same in this category. If the MIP model or the greedy algorithm does not select the k-th class sample in a certain iteration, the objective function value of the corresponding k-th class sample is recorded as 0.
[0247] The category biases corresponding to all categories together constitute the category-level bias vector: ,in, This represents the feedback error signal, which consists of the biases of all categories and is used to describe the degree of imbalance between different categories of samples in the current sampling process.
[0248] Based on the above analysis, then the first The class-level bias vector of the k-th class sample in the round of iteration is Based on the category-level deviation vector, the first... The class-level bias vector of the k-th class sample in the round of iteration is .but:
[0249] Based on the category-level deviation vector, the sampling weights for each category of samples are calculated using the following weight update formula:
[0250] , formula 4;
[0251] In formula 4, [0.01, 0.5] represents the learning rate (preferably 0.1). express The class-level bias vector of the k-th class sample in each iteration. express The sampling weights of each category of samples in each round of iteration, Let k′ represent the sum of the weights of all categories after the update, where k′ = 1, ..., k, ..., C;
[0252] Accordingly, the above-mentioned random selection of a predetermined proportion of unlabeled samples from the original unlabeled sample pool to obtain the candidate sample pool specifically includes:
[0253] Based on the sampling weights of each category of samples, the original unlabeled sample pool is compressed according to the preset ratio to obtain the candidate sample pool.
[0254] Furthermore, the biases of all categories are aggregated to obtain the global average bias:
[0255] , Formula 16;
[0256] In formula 16, This represents the average level of all category biases. The global average bias is not an independent bias type, but rather a subset of the category-level bias vectors. The aggregated statistics are used to drive the feedback updates of the MIP diversity coefficient and the greedy scoring parameters; the category-level bias vector... It is used directly for adjusting category sampling weights.
[0257] The diversity coefficient in the MIP model is adjusted based on the global average bias obtained by aggregating category-level bias vectors; when When the sampling weight of class k is increased, it indicates that there is insufficient coverage of class k samples in the current greedy sampling process. Therefore, the sampling weight of class k is increased so that the probability of class k entering the candidate sample pool is increased in the next round of pre-screening, thereby reducing the risk of long-tail classes being missed.
[0258] Specifically, the diversity coefficient in the MIP model is adjusted based on the global average deviation obtained by aggregating category-level deviation vectors. If the current greedy strategy performs worse than the MIP optimization result, it indicates that the MIP model needs to be enhanced to accommodate sample diversity. The following update formula is adopted:
[0259]
[0260] in, This represents the MIP diversity coefficient in the (t-1)th iteration; This represents the updated diversity coefficient; This represents the diversity update coefficient, with a preferred value of 0.01. Indicates the positive truncation operator;
[0261] Furthermore, the scoring parameters in the greedy algorithm are adjusted based on the global average deviation and the actual sampling cost ratio. Let the greedy scoring parameters in the (t-1)th iteration be:
[0262]
[0263] in, The updated greedy scoring parameters; This represents the scoring parameter adjustment coefficient (preferably 0.5, with a value range of [0.3, 0.7]); CostRatio is the ratio between the actual sampling cost of the current round t and the preset budget, where CostRatio = To pre-set budget constraints, This represents the actual sampling cost;
[0264] when This indicates that the current greedy algorithm not only suffers from class selection bias but also from cost overruns, thus requiring improvement. This makes the greedy selection rules more stringent, reducing the probability of high-cost, low-return samples being selected.
[0265] when When this occurs, it indicates that the current greedy strategy has performance close to the optimal MIP strategy, without triggering significant parameter adjustments, thus making... = At this point, parameter updates are not performed to avoid over-adjustment of the system near the optimum and to improve the stability of the feedback closed-loop iterative process.
[0266] The sample selection method provided in this embodiment of the invention is based on the above-mentioned cross-mode deviation feedback closed-loop mechanism. It uses the deviation between the optimal value of the MIP sub-block and the target value of the greedy batch to reverse correct the sampling weight of the random pre-screening, continuously converges the inherent performance gap of the greedy algorithm (iteration cumulative deviation) under multiple iterations, and ensures the stability of long-term iteration.
[0267] In one specific embodiment, in step S103 above, the candidate sample set is... Add to the current labeled sample set Obtain and based on the updated labeled sample set The sample selection training model is retrained. The specific execution process can be described in detail in the existing deep learning model training methods. For example, it could involve updating the labeled sample set. Each time, 128 samples are taken to calculate the gradient. A stochastic gradient descent (SGD) optimizer with a learning rate of 0.01 and a momentum of 0.9 is set, and this training is repeated for 10 complete epochs.
[0268] In one specific embodiment, step S104 involves iteratively executing the forward propagation, sample selection, and model training processes until the model training reaches a preset termination condition, resulting in a trained sample selection model and a final labeled sample set. Specifically, this includes:
[0269] Iteratively execute the above forward propagation, sample selection, and model training processes, and determine whether the model training satisfies any of the following termination conditions:
[0270] The accuracy of the sample selection model remained unchanged for multiple rounds on the preset validation set;
[0271] The sample selection model has a correct classification ratio exceeding a preset classification ratio threshold in the updated labeled sample set.
[0272] The preset total number of labeled samples has been exhausted;
[0273] The mean proxy score of all samples in the candidate sample set is lower than a preset cost score threshold;
[0274] If so, output the trained sample selection model and the final labeled sample set.
[0275] To provide a clearer and more complete explanation of the sample selection method provided in the embodiments of the present invention, so that those skilled in the art can implement it, the following describes the sample selection method in detail using the process of screening road defect samples in a traffic defect detection scenario as an example:
[0276] S1: Initialize the unlabeled sample pool U (synthetic simulated dataset (TrafficDataset, 512-dimensional feature vector, simulating long-tail distribution), totaling 100,000 samples (512-dimensional feature vector), containing 5 classes: cracks 2%, potholes 3%, repairs 5%, settlement 15%, and normal samples 75%), and the initial labeled sample set. Ten labeled samples were provided for each class (40 defective samples + 750 normal samples = 790 samples in total). The selected backbone network ResNet-18 was pre-trained based on the initial labeled sample set to obtain the initial sample selection training model.
[0277] S2: The unlabeled sample pool U is randomly selected from the unlabeled sample pool U according to the sampling weight, with a preset proportion γ=0.3 to obtain the candidate sample pool U′. Input samples are used to select the training model for forward propagation, and a 512-dimensional embedding vector is extracted from the penultimate layer of the model. Obtain the class prediction probability distribution from the softmax layer. This step is completed via GPU / TPU hardware acceleration for forward propagation (including M=10 Monte Carlo Dropout inferences, Dropout rate=0.1).
[0278] Among them, the sampling weights of each category of samples in step S2 are dynamically updated based on historical iteration deviation feedback. The weight update formula is:
[0279] , formula 4;
[0280] In formula 4 =0.1.
[0281] S3: Based on the model output, perform long-tail distribution awareness and cost weighting calculation, specifically including:
[0282] (3a) Category frequency estimation:
[0283] Before labeling, category frequencies are obtained from data source metadata statistics or preliminary sampling estimates. Formula 11. For scenarios with unknown class frequencies, use uniform prior frequencies. This serves as an initial estimate and is updated progressively as the annotation process continues.
[0284] (3b) Long-tail cost weighting:
[0285] , formula 9;
[0286] In formula 9, Normalized to the range [1,5]; =0.5, =0.5, (α+β=1.0); The prior frequency of the class to which sample i belongs is given by the formula. definition;
[0287] For long-tail cost items, amplify the "relative cost" of tail-category samples to make them more prioritized for selection.
[0288] Taking cracked samples (p=0.02) and normal samples (p=0.75) as examples:
[0289] The long-tail cost term for the crack sample: f(1 / 0.02) = f(50) ≈ 5 (highest cost); the long-tail cost term for the normal sample: f(1 / 0.75) = f(1.33) ≈ 1.27 (lower cost). This makes the total cost of the crack sample... Significantly higher than normal samples, they are more likely to be selected in MIP solutions.
[0290] (3c) Agent score calculate:
[0291] , Formula 5;
[0292] In formula 5, ∈[5, 20], with a preferred value of 10.
[0293] (3d) Pairwise similarity calculate:
[0294] , Formula 7;
[0295] In formula 7, =0.5.
[0296] (3e) Cross-category similarity calculate:
[0297] For different categories of samples The cross-category similarity is set to a preset maximum value (or infinity) to maximize the MIP objective function. It is always equal to 0 (i.e., it forces the exclusion of cross-class redundancy penalties). For samples of the same class... , Calculated using standard methods. This ensures that cross-category diversity constraints are not affected by samples within the same category.
[0298] S4: Constructing a MIP model for long-tailed perceptual sample selection:
[0299] , formula 1;
[0300] Constraints of the MIP model:
[0301] (4a) Budget constraints:
[0302] in , =0.2.
[0303] (4b) Cardinality constraint: ;
[0304] When there is no feasible solution, automatic relaxation is... .
[0305] (4c) Complete link constraint:
[0306] , Formula 12.
[0307] (4d) Binary constraints: .
[0308] (4e) Minimum number of entries at the category level:
[0309] ,
[0310] in, , =1.5.
[0311] (4f) Maximum number of entries at the category level:
[0312] ,
[0313] in =0.6.
[0314] Key analysis of the minimum and maximum number of entries constraints at the above category levels:
[0315] Ensure that at least one tail class sample (crack, pit) is selected in each round to avoid tail classes being completely ignored;
[0316] Limit the proportion of head samples (normal) to prevent head samples from taking up too much budget;
[0317] =1.5 indicates that the tail class samples are compensated by 50%, so that their inclusion rate is higher than the true frequency.
[0318] S5: Multi-stage Hybrid Optimization Scheduling
[0319] S5.1: Divide the candidate sample pool into multiple adaptive sub-blocks. The number of sub-blocks and the number of samples in each block are dynamically determined based on the sample distribution density, rather than being a fixed, equal division. The specific steps are as follows:
[0320] S5.1.1: For all samples in the candidate sample pool, use the FAISS approximate K-nearest neighbor search to calculate the feature vector of each sample. Then, the K-Means++ algorithm is used to process the sample pool. Clustering ( ∈[50, 100], preferred =70), obtained There are several clusters.
[0321] S5.1.2: For each cluster Calculate the average intra-cluster similarity:
[0322] , Formula 13.
[0323] S5.1.3: Determine the actual sample sub-block size for each cluster based on cluster cohesion:
[0324] , formula 3;
[0325] In formula 3, The base block size is (preferably 3000). The block sensitivity coefficient is preferably 0.5. The minimum block size is preferred (500). The maximum block size is (preferably 5000).
[0326] S5.1.4: Construct a MIP model for each sample sub-block, and solve for the candidate sample subset based on preset constraints. During the solution process, K-nearest neighbor sparsity (K=15), MIP hot start, and cut plane acceleration strategies are enabled. The number of queries per round is q∈[50,500].
[0327] S5.2: Using the selected candidate samples output by all sub-blocks of MIP as input, perform a hierarchical constrained greedy global screening:
[0328] (1) Cost tiering: Candidate samples are categorized according to cost. Divided into 5 tiers (corresponding to cost values 1 to 5), with a maximum selection ratio set for each tier. .
[0329] (2) Iterative selection: based on comprehensive score Traverse the candidate samples in descending order, and for each sample :
[0330] (a) Check if the current selected quantity of the cost category has reached the upper limit; if so, skip it.
[0331] (b) Check category-level sampling rate constraints: If the category to which the sample belongs has reached... If so, skip it;
[0332] (c) Calculate the maximum similarity with all samples in the selected set; skip if the value is greater than τ.
[0333] (d) If not skipped, the sample will be... Add to selected collection, update budget , Formula 14.
[0334] (3) Budget verification: If the total cost exceeds the budget Iterative removal The sample with the highest ratio (lowest cost-effectiveness), up to the total cost. .
[0335] (4) Category compensation (key fallback mechanism): If certain categories do not meet the requirements Then select from the remaining candidates by... Select samples of this category in descending order of ratio until the ratio is reached. .
[0336] (5) Cross-modal bias feedback closed loop:
[0337] Select any sample sub-block and calculate the optimal objective value of the MIP model for that sample sub-block. Greedy batch target value in the same region The difference is used to obtain the global deviation of the sub-block. The overall global deviation of the sub-block This is used to characterize the overall performance gap between the optimal MIP solution and the greedy sampling result in the current sample sub-block, serving only as an overall performance monitoring indicator and not participating in parameter updates. Further, category-level relative biases are calculated according to sample categories to form category-level bias vectors, which are then aggregated to obtain the global average bias. Based on the category-level bias vectors, the category sampling weights of each category of samples are updated. Based on the global average bias, the MIP diversity coefficient and the greedy scoring parameters are adjusted to achieve a cross-modal bias feedback closed-loop update.
[0338] S6: Annotation set update and iteration:
[0339] The obtained candidate sample set Add to the current labeled sample set Update the labeled sample set Based on the updated labeled sample set Retrain the model using selected samples (epochs=10, SGD, learning rate 0.01, momentum 0.9, batch_size=128).
[0340] Step S7: Iterate through S2 to S6 until any of the following termination conditions are met, then output the final sample selection model and the complete labeled dataset:
[0341] (1) Validation set accuracy is continuous [3,10] rounds showed no significant improvement (threshold) ∈[0.001,0.01]);
[0342] (2) The proportion of correctly classified samples by the model in the labeled samples exceeds the threshold. [0.85, 0.95];
[0343] (3) Budget exhausted () );
[0344] (4) The mean uncertainty score of newly added samples is lower than the threshold. [0.1, 0.3].
[0345] Based on the above sample selection method, an active learning experiment was conducted on the above synthetic simulation dataset (TrafficDataset, 512-dimensional feature vector, simulating long-tail distribution), which contains 100,000 samples (512-dimensional feature vectors) and includes 5 categories: cracks 2%, potholes 3%, repairs 5%, settlement 15%, and normal samples 75%.
[0346] The experimental environment was set as follows: GPU server (NVIDIA Tesla T4, 16GB VRAM), CPU (Intel Xeon Gold 6133, 2.5GHz, 32 cores), 128GB RAM. Software: Python 3.8, PyTorch 1.12, pyscipopt 6.2.1. Backbone network: ResNet-18 (ImageNet pre-trained), 512-dimensional embedding vectors.
[0347] The core parameter settings include: optimization gap for MIP solution = 1%, time limit = 5 seconds, and number of threads = 4.
[0348] The classification accuracy was compared with that of a labeled sample size of 1000, with 5 random seed replicates, the mean was 78.3% ± standard deviation 0.29%. The sample selection method using random sampling had a mean of 70.2% ± standard deviation 0.38%. Statistical test: The t-test between the method of this invention and random sampling showed p=0.001 (<0.001), indicating a significant difference at the 99.9% confidence level.
[0349] With a labeled sample size of 1000, the tail class recall (4 types of defects) of the sample selection method and the random sampling method provided in this embodiment are shown in the table below:
[0350]
[0351] As can be seen from the table above, the tail class recall rate of the sample selection method and the random sampling method provided in the embodiments of the present invention is significantly improved.
[0352] The sample selection method provided in this invention can be flexibly deployed by selecting execution steps according to actual sample selection needs. For high-precision scientific research mode, weighted random screening of candidate sample pool can be performed first, followed by solving the self-organizing block MIP model, and finally, a hierarchical greedy global resource allocation and cross-mode deviation feedback closed-loop mechanism can be executed. For conventional industrial mass production scenarios, only random screening of candidate sample pool and solving the self-organizing block MIP model can be performed, or the self-organizing block MIP model can be solved by executing the hierarchical greedy global resource allocation and cross-mode deviation feedback closed-loop mechanism. For low-cost coarse screening, only weighted random screening of candidate sample pool can be performed, and the MIP model can be solved directly based on the candidate sample pool.
[0353] The sample selection method provided in this invention, based on the aforementioned cross-mode bias feedback closed-loop mechanism, is not a traditional black-box hyperparameter search. Instead, it directly quantifies the structural deficiencies of the current greedy strategy in specific categories by calculating the difference between the global optimum of MIP and the local suboptimal of the greedy strategy in real time. This feedback mechanism enables the system to automatically correct the sampling bias and diversity constraints of subsequent iterations through mathematical mapping within a single iteration, achieving a technological leap from "static parameters" to "dynamic adaptation".
[0354] The sample selection method provided in this invention constructs a MIP model with the optimization objectives of maximizing the comprehensive information gain of samples and minimizing batch redundancy. It achieves joint optimization of sample selection and cost constraints through global optimization of the MIP model, overcoming the local optima defect of greedy algorithms under non-sub-module objectives, ensuring theoretical optimality under diversity constraints, improving the accuracy and efficiency of sample selection, and enhancing the quality of sample screening. It is applicable to the construction of high-precision sample datasets in high-cost, high-labor-cost sensitive annotation scenarios such as road accident samples, rare industrial defect samples, and rare medical lesion samples. Through multiple iterations, it can ensure stable sample quality, and is particularly suitable for sample selection in long-tail distribution scenarios.
[0355] Example 2
[0356] Based on the same inventive concept, embodiments of the present invention also provide a sample selection device, referring to... Figure 2 As shown, it includes:
[0357] The forward propagation module 101 is used to select the input samples from the candidate sample pool and train the model for forward propagation to obtain the feature vector and class prediction probability distribution of each sample.
[0358] The sample solving module 102 is used to predict the probability distribution based on the feature vector and category of each sample, construct the MIP model with the optimization objective of maximizing the comprehensive information gain of the samples and minimizing batch redundancy, and solve for the candidate sample set based on the preset constraints.
[0359] Model training module 103 is used to add the candidate sample set to the current labeled sample set, obtain and retrain the sample selection training model based on the updated labeled sample set;
[0360] The iterative control module 104 is used to iteratively execute the above forward propagation, sample selection and model training processes until the model training reaches the preset termination condition, and obtain the trained sample selection model and the final labeled sample set.
[0361] Example 3
[0362] Based on the same inventive concept, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the sample selection method as described in Embodiment 1.
[0363] The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires; a portable computer disk drive; a hard disk drive; a random access memory (RAM); a read-only memory (ROM); an erasable programmable read-only memory (EPROM); a register; a hard disk drive; an optical fiber; a portable compact disc read-only memory (CD-ROM); an optical storage device; a magnetic storage device; or any suitable combination thereof; or any other form of computer-readable storage medium known in the art. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium may also be a component of the processor. The processor and the storage medium may reside in an application-specific integrated circuit (ASIC). In the embodiments of this application, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0364] Example 4
[0365] Based on the same inventive concept, embodiments of the present invention also provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the sample selection method as described in Embodiment 1.
[0366] Figure 3 A possible structural diagram of the computer device involved in the above embodiments is shown. The computer device includes a processor 1002 and a communication interface 1003. The processor 1002 is used to control and manage the operation of the computer device, for example, executing the alarm association method described above, and / or other processes of the technology described herein. The communication interface 1003 is used to support communication between the computer device and other network entities, for example, executing the steps performed by the communication unit 902 described above. The computer device may also include a memory 1001 and a bus 1004, the memory 1001 being used to store the program code and data of the computer device.
[0367] The memory 1001 may be a memory in a computer device, and the memory may include: volatile memory, such as random access memory; the memory may also include: non-volatile memory, such as read-only memory, flash memory, hard disk or solid-state drive; the memory may also include: a combination of the above types of memory.
[0368] The processor 1002 described above can implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor can be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computing functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0369] Bus 1004 can be an Extended Industry Standard Architecture (EISA) bus, etc. Bus 1004 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 3 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0370] Example 5
[0371] Based on the same inventive concept, embodiments of the present invention also provide a computer program product containing instructions that, when the computer program product is run on a computer device, cause the computer device to execute the sample selection method as described in Embodiment 1.
[0372] The principles by which the above-mentioned devices, media, and related products in the embodiments of the present invention solve the problem are similar to those of the aforementioned methods. Therefore, their implementation can refer to the implementation of the aforementioned methods, and repeated details will not be repeated.
[0373] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.
[0374] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0375] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0376] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0377] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A sample selection method, characterized in that, include: The candidate sample pool input samples are selected and the training model is forward propagated to obtain the feature vector and class prediction probability distribution of each sample. Based on the feature vector and category prediction probability distribution of each sample, a MIP model is constructed with the optimization objective of maximizing the comprehensive information gain of the samples and minimizing batch redundancy. Based on the preset constraints, the candidate sample set is obtained by solving the problem. The candidate sample set is added to the current labeled sample set, and the sample selection training model is retrained based on the updated labeled sample set. The above forward propagation, sample selection, and model training processes are executed iteratively until the model training reaches the preset termination condition, resulting in a trained sample selection model and a final labeled sample set.
2. The method according to claim 1, characterized in that, Also includes: With the optimization objectives of maximizing the overall information gain of the samples and minimizing batch redundancy, the following MIP model is constructed: ; In formula 1, {0,1} represents the decision variables in the MIP model. =1 indicates that sample i is selected as a candidate sample. =0 indicates that sample i was not selected; N represents the total number of samples in the sample set used for MIP computation; Represents the proxy score for sample i; {0,1} represents the MIP binary variable, which is a redundant indicator variable when sample pairs (i,j) are selected simultaneously; This represents the similarity between samples i and j; for samples of different categories... Cross-category similarity =∞;E represents the set of sample pairs whose pairwise similarity exceeds a preset similarity threshold τ; Correspondingly, the preset constraints include: budget constraints, cardinality constraints, complete link constraints, binary constraints, minimum number of entries at the category level constraints, and maximum number of entries at the category level constraints. or, With the optimization objectives of maximizing the overall information gain of the samples and minimizing batch redundancy, the following MIP model is constructed: , Formula 2; In formula 2, The minimum number of entries at the category level. , [1.2, 2.0] represents the long-tail compensation factor; Correspondingly, the preset constraints include: budget constraints, cardinality constraints, complete link constraints, binary constraints, and maximum number of entries at the category level.
3. The method according to claim 2, characterized in that, The method involves predicting the probability distribution based on the feature vector and category of each sample, constructing a MIP model with the optimization objective of maximizing the overall information gain of the samples and minimizing batch redundancy, and solving for the candidate sample set based on preset constraints, including: The candidate sample pool is divided into multiple sample sub-blocks; For each sample sub-block, the probability distribution is predicted based on the feature vector and category of each sample in the sample sub-block. The MIP model is constructed with the optimization objective of maximizing the comprehensive information gain of the samples and minimizing batch redundancy. Based on the preset constraints, the corresponding candidate sample subset is obtained by solving. The candidate sample subsets corresponding to the multiple sample sub-blocks are merged to obtain the candidate sample set.
4. The method according to claim 3, characterized in that, The step of dividing the candidate sample pool into multiple sample sub-blocks includes: For each sample in the candidate sample pool, based on the sample's feature vector, a vector index is constructed using FAISS and an approximate K-nearest neighbor search is performed to obtain the top K most similar neighbors of each sample and their corresponding similarity. Based on the K most similar neighbors of each sample and their corresponding similarity, the candidate sample pool is clustered to obtain a cluster with a preset total number of clusters; For each cluster, iterate through all sample pairs within the cluster, calculate the sum of the cosine similarities between the feature vectors of the two samples in each sample pair, and combine the total number of all sample pairs to obtain the average similarity within the cluster. Based on the average similarity within clusters, the size of the corresponding sample sub-block is obtained using the following formula: , Formula 3; In formula 3, The average similarity within the cluster; The base block size; This is the block sensitivity coefficient, with a value range of [0.3, 0.7]. Minimum block size; The maximum block size; < < ; The corresponding clusters are divided according to the size of the sample sub-blocks to obtain at least one corresponding sample sub-block.
5. The method according to claim 4, characterized in that, After obtaining the candidate sample set, the method further includes: Based on the labeling cost of each sample, the candidate sample set is divided into a preset number of cost levels, and the preset maximum selection ratio of each cost level is obtained. The candidate sample set is traversed in descending order of the proxy scores of the samples. For each sample i: Check if the current selected quantity of the corresponding cost category has reached the maximum selection ratio; if so, skip it. Otherwise, check if the category to which the sample belongs has reached the maximum number of entries at the category level; if so, skip it. Otherwise, calculate whether the maximum similarity between the sample and all samples in the selected sample set exceeds a preset similarity threshold; if so, skip this step. Otherwise, add the sample to the selected sample set and update the remaining cost budget; Determine if the total cost exceeds the cost budget. If so, iteratively remove the sample with the highest ratio of labeled cost to proxy score until the total cost is no greater than the cost budget, thus obtaining the selected candidate sample set.
6. The method according to claim 5, characterized in that, Also includes: For each category of samples, if the number of samples is less than the minimum number of samples to be selected at the category level, samples of that category are selected from the remaining candidate samples in descending order of the ratio of proxy score to labeling cost, until the minimum number of samples to be selected at the category level is reached.
7. The method according to claim 5, characterized in that, After obtaining the refined candidate sample set, the method further includes: For any sample sub-block, calculate the category-level deviation vector between the optimal objective value of the MIP model of the sample sub-block and the solution of the greedy batch objective value of the same region; Based on the category-level deviation vector, the sampling weights for each category of samples are calculated using the following weight update formula: , Equation 4; In formula 4, [0.01, 0.5] represents the learning rate. express The class-level bias vector of the k-th class sample in each iteration. express The sampling weights of each category of samples in each round of iteration, Let k′ represent the sum of the weights of all categories after the update, where k′ = 1, ..., k, ..., C; The step of randomly selecting a predetermined proportion of unlabeled samples from the original unlabeled sample pool to obtain the candidate sample pool includes: Based on the sampling weights of each category of samples, the original unlabeled sample pool is compressed according to the preset ratio to obtain the candidate sample pool.
8. A sample selection device, characterized in that, include: The forward propagation module is used to select input samples from the candidate sample pool and train the model for forward propagation to obtain the feature vector and class prediction probability distribution of each sample. The sample solving module is used to predict the probability distribution based on the feature vector and category of each sample, and construct the MIP model with the optimization objectives of maximizing the comprehensive information gain of the samples and minimizing batch redundancy. Based on the preset constraints, the candidate sample set is obtained. The model training module is used to add the candidate sample set to the current labeled sample set, obtain and retrain the sample selection training model based on the updated labeled sample set; The iterative control module is used to iteratively execute the above forward propagation, sample selection and model training processes until the model training reaches the preset termination condition, and obtain the trained sample selection model and the final labeled sample set.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the sample selection method as described in any one of claims 1-7.
10. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the sample selection method as described in any one of claims 1-7.
