A deep learning core training sample selection and weight calibration method and system for image classification
By using a CPU and GPU collaborative parallel computing architecture, core samples are dynamically selected and weights are optimized, solving the problems of large number of parameters and long training cycles in the deep learning model training process, and improving training efficiency and accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUNAN UNIV OF SCI & TECH
- Filing Date
- 2026-01-14
- Publication Date
- 2026-04-14
AI Technical Summary
Existing deep learning models suffer from problems such as large number of parameters, long training cycles, and high hardware computing power requirements during training. Furthermore, traditional optimization strategies are difficult to effectively improve training efficiency and accuracy in different scenarios.
It adopts a CPU and GPU collaborative parallel computing architecture, dynamically filters core samples and optimizes weights through core training sample selection process and sample weight calibration process, and accelerates convergence by utilizing multi-dimensional feature space and meta-learning framework.
It achieves accelerated convergence of deep learning model training, reduces resource consumption, avoids accuracy loss, and balances training efficiency and model performance, making it suitable for the field of image classification.
Smart Images

Figure CN121505311B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image classification, and in particular to a method and system for selecting core training samples and assigning weights in deep learning for image classification. Background Technology
[0002] With the rapid development of deep learning technology, various complex models and algorithms are constantly emerging. However, the problems of large model parameters, long training cycles, and high hardware computing power requirements are becoming increasingly prominent. To address these issues, the academic community is mainly conducting research in two directions. On the one hand, some scholars are dedicated to designing lightweight models to shorten training time. For example, the MobileNet series simplifies the network structure by using techniques such as depthwise separable convolutions and ReLU6 activation functions, significantly reducing model complexity. However, the reduction in model parameters inevitably leads to a loss in model performance, reflected in multiple metrics such as precision, recall, and accuracy. Although training speed is improved, the decline in accuracy cannot be ignored. On the other hand, some scholars focus on accelerating the training process through hardware optimization. Some works propose improving hardware reading efficiency through data reconstruction and preloading mechanisms; others have designed VGG accelerators for low-cost FPGAs, optimizing resource utilization through dedicated input buffers; still others have developed adaptive acceleration frameworks based on CPU-FPGA heterogeneous architectures, supporting rapid adaptation to different chips. However, these methods essentially rely on improving hardware performance and fail to address the problem from the perspective of the deep learning model itself. To truly achieve efficient training of neural networks, a deep understanding of the intrinsic mechanisms of model training is needed, particularly studying the differentiated impact of different training data on parameter updates. Therefore, starting with the training data itself is considered an important approach to seeking more fundamental solutions.
[0003] Some studies have attempted to find breakthroughs in accelerating model convergence by improving optimization strategies, such as designing new optimization methods or further refining gradient descent. However, for different scenarios, simply adjusting optimization strategies at a macro level may not yield good results. While improving optimization strategies has some use, this use should be secondary. In other words, besides adjusting optimization strategies, we should also start from the training mechanism of deep learning models themselves and design a more effective method that better reflects the essence of the problem. And what truly reflects the characteristics of the problem is the sample. As we all know, the selection of samples is crucial to model performance; selecting representative samples is more conducive to model convergence than selecting many similar and redundant samples.
[0004] Some academic research focuses on sample selection. For example, some methods propose designing a selector to remove unimportant samples and then using a simple linear transformation to synthesize samples. However, such simplistic aggregation schemes are unsuitable for high-dimensional online regression tasks. Furthermore, low-utility samples do not necessarily mean they contribute nothing, so directly and recklessly deleting these samples can lead to accuracy loss. Even if unimportant samples are not used directly, their utility should be reflected in other used samples as much as possible. Some methods, from the perspective of sample selection, investigate strategies to accelerate stochastic gradient descent (SGD). For example, ScreenNet trains an additional neural network to learn the scalar weights of each training instance; online batch selection methods sample instances exponentially with probability until their final known loss value is reached; some studies have proposed importance sampling schemes for deep learning models; and the proposed Iprox SGD method uses importance sampling to reduce variance. In addition, self-paced learning (SPL) uses the corresponding loss value to infer the difficulty of instances and then reduces the sample weights of difficult instances. In addition, some representative sample selection methods, such as RHO-LOSS and AutoAssist, have also attempted to improve training efficiency in specific scenarios, but they often have limitations in terms of accuracy preservation or generalization ability.
[0005] Based on the above background, this invention attempts to find solutions to the problem from the perspective of deep learning itself. Starting from the gradient descent method, a deep learning model optimization strategy, it designs and implements an algorithm to accelerate the convergence of deep learning models. The core idea is that if we can find a small subset S such that the weighted sum of the gradients of its elements is close to the total gradient on the entire training set V, then we can apply the incremental gradient method only to set S (with a step size equal to the weights of the elements in S), and we should still converge to the (approximate) optimal solution, but much faster. This is because in each training round, the number of iterations required decreases due to the reduced number of samples processed. Therefore, selecting representative core samples for training helps accelerate the convergence of deep learning model training. Summary of the Invention
[0006] To address the aforementioned shortcomings of existing technologies, this invention provides a method and system for dynamic sample selection and weight optimization in classification tasks. This invention utilizes a core sample selection module (selecting representative samples using a multi-dimensional feature space and a two-stage mechanism) and a weight calibration module (generating adaptive weights through a meta-learning "main model-MetaNet" dual network), combined with CPU-GPU parallel processing for efficiency improvement. Ultimately, the weighted gradient of the smallest sample subset approximates the full gradient, achieving accelerated deep learning training, reduced resource consumption, and avoidance of accuracy loss, making it suitable for image classification scenarios.
[0007] The specific technical solution of the present invention is as follows:
[0008] This invention provides a method for selecting core training samples and weighting for deep learning in image classification. The method is based on a collaborative parallel computing architecture of CPU and GPU. Through the coordinated execution of the core training sample selection process and the sample weighting process, it processes digital image data collected by image sensors, thereby accelerating the training of deep learning models in the field of image classification.
[0009] The core training sample selection process is executed by the CPU, employing a dynamic multi-index clustering strategy. It evaluates sample value by constructing a multi-dimensional feature space using gradient, training loss, and autoencoder loss, and utilizes a two-stage screening mechanism. The first stage randomly selects a candidate set from the full training set V that is larger than the actual number of training batches. The second stage clusters the candidate set samples based on the multi-dimensional feature space, selecting core samples from the candidate set to form the minimum training subset. ;
[0010] The sample weighting process is executed by the GPU, and an intelligent weight allocation system is built using a meta-learning framework. Through the collaborative work of the main model and MetaNet, dynamic evaluation of sample importance is achieved, and a weight coefficient is periodically dynamically assigned to each sample in the subset S. Each iteration updates the weights, forming a closed loop of "evaluation-weighting-optimization";
[0011] Through the coordination of the core training sample selection process and the sample weight calibration process, during training, for any optimized parameter w in the main model parameter space W, the weighted gradient of the subset S can be used to approximate the full gradient on the entire training set V, and the approximation error is controlled within a preset error threshold. This allows for accelerated convergence of deep learning model training.
[0012] Preferably, the CPU and GPU collaborative parallel computing architecture specifically uses multi-process queues AQ and BQ to realize data interaction between the core training sample selection process and the sample weight calibration process. The overall process follows the collaborative logic of "GPU forward computation → AQ transmission of training information → CPU screening of core samples → BQ transmission of sample index → GPU weight calibration and parameter update".
[0013] The multi-process queue AQ is used to enable the GPU to transmit sample gradient and loss value information generated during training to the CPU. The CPU extracts the above data from the AQ as the input basis for the core sample selection algorithm.
[0014] The multi-process queue BQ is used to enable the CPU to send the index of the core sample back to the GPU. The GPU uses the index to index the corresponding data as the core sample set for the next round of training.
[0015] Furthermore, the two-stage screening mechanism is as follows: The actual training batch size is set to B; in the first stage, 2B samples are randomly sampled from the entire training set V to form a candidate set, ensuring sample diversity; in the second stage, the soft-max confidence, training loss, autoencoder loss, number of forgettings, and labels of the candidate set samples are combined into a feature vector, and B core samples are selected through unsupervised clustering (with B clusters) to form the minimum training subset S. Through this two-stage screening, the importance of samples is accurately assessed while ensuring representativeness.
[0016] Preferably, the core training sample selection process specifically includes the following steps:
[0017] Step 101: Initialize the multi-process queue; set up two multi-process queues, denoted as AQ and BQ respectively. After the GPU completes the forward computation, it pushes the gradient information to AQ. The CPU extracts the data in AQ and executes the core sample selection algorithm. Then, it pushes the core sample index to BQ. The GPU obtains the index from BQ and loads the corresponding data, thereby realizing the efficient parallel execution of GPU-side model training and CPU-side sample selection.
[0018] Step 102: Extract training information from AQ; extract the sample training information computed by the GPU from the multi-process queue AQ. The sample training information includes Soft-max confidence, training loss, and whether the classification is correct. This information includes the gradient changes of each sample and the training loss value index, and originates from the sample set that previously participated in the main model training process.
[0019] Step 103: Update the cache array; Based on the sample training information obtained in step 102, dynamically update the sample state record array in the cache. The sample state record array contains a hash table array hash_table based on the number of sample forgettings. The update method is: if the current accuracy is 0 and the previous accuracy was 1, then the forgetting count is incremented by 1.
[0020] Step 104: Randomly select a candidate set; randomly sample 2B samples from the complete training dataset to form a dynamic candidate sample set, where B is the batch size of the current training;
[0021] Step 105: Input the autoencoder to obtain the autoencoder loss and update the cache array; feed the candidate set samples into the autoencoder, calculate the autoencoder loss for each sample, and update the corresponding autoencoder loss array in the cache.
[0022] Step 106: Autoencoder backpropagation to update parameters; perform backpropagation based on the autoencoder loss calculated in step 105 to adjust the autoencoder model parameters;
[0023] Step 107: Similarity calculation and clustering; as a specific implementation of the dynamic multi-index clustering strategy, the soft-max confidence, training loss, autoencoder loss, number of forgettings, and labels of the candidate set samples are combined into a feature vector to construct the multi-dimensional feature space, where the labels are only for classification problem data; calculate the Euclidean distance between samples and perform unsupervised clustering, with the number of clusters being B, and the cluster center samples being used as core samples;
[0024] Step 108: Select core samples and add them to BQ; add the indices of B core samples to the multi-process queue BQ;
[0025] Step 109: Repeat steps 102 to 108 until training is complete;
[0026] Steps 104 and 107 together constitute the two-stage screening mechanism: Step 104 is the first stage of randomly screening candidate sets to ensure diversity, and Step 107 is the second stage of clustering screening based on the multidimensional feature space to accurately evaluate the importance of samples.
[0027] Preferably, in step 103, the hash table array hash_table stores only half of the total number of forgetting counts of the entire training set V; when the forgetting count of the i-th sample is not stored in the hash_table and the storage capacity of the hash_table exceeds the upper limit, the sample record with the smallest forgetting count in the hash_table is deleted, the forgetting count of the i-th sample is assigned a value of 1, and the pre_acc value of the i-th sample is updated to the current_acc value.
[0028] Furthermore, the dynamically updated sample state records (including the number of forgettings) in step 103 provide dynamic feature data that changes with the training process for the clustering in step 107; based on this dynamic data, the dynamic multi-index clustering strategy can automatically adjust the clustering results in different training rounds, thereby enabling the sample selection criteria to adapt to the model training progress and meet the needs of different training stages.
[0029] Preferably, the sample weight calibration process specifically includes the following steps:
[0030] Step 201: Initialize MetaNet parameters; As part of the meta-learning framework, the parameters of the MetaNet model are initialized. The MetaNet adopts a three-layer fully connected network architecture. The input layer receives sample features and training metrics, the intermediate hidden layer performs non-linear transformation, and the output layer generates sample weight values.
[0031] Step 202: Copy the main model and call it a replica; perform a deep copy operation on the main model to fully preserve the main model's architectural details, parameter configurations, and all current weight parameters and model states;
[0032] Step 203: Input the core samples into the master model copy and calculate the loss; obtain the core training samples from BQ, input them in batches into the master model copy to perform forward propagation calculation, calculate the comprehensive training loss of the core samples based on the preset task-related loss function, denoted as "core sample training loss", where the task-related loss function is cross-entropy loss or mean squared error, and retain the loss contribution of each sample during the calculation process;
[0033] Step 204: Input the training loss of the core samples into the MetaNet output weights; input the training loss of the core samples into MetaNet, perform forward propagation calculation through a three-layer fully connected architecture, and output the personalized weight coefficients of each core sample.
[0034] Step 205: Weight the training loss of the core samples and backpropagate to update the parameters of the master model copy; calculate the average loss by weighting the training loss of the core samples obtained in step 203, execute the backpropagation algorithm to update the parameters of the master model copy, and do not update the MetaNet parameters; calculate the gradient by automatic differentiation, and iteratively update the weights by using a preset optimization algorithm combined with a learning rate strategy. The preset optimization algorithm is Adam or SGD optimization algorithm.
[0035] Step 206: Input metadata into the master model replica and calculate the loss; randomly sample a batch of samples from the metadata dataset that is completely independent of the master training set, input them into the updated master model replica for forward propagation calculation, and calculate the comprehensive training loss of the batch of samples based on the preset loss function, denoted as "metadata validation loss", where the preset loss function is mean squared error or cross-entropy loss;
[0036] Step 207: Update MetaNet parameters; Based on the metadata verification loss from step 206, the backpropagation algorithm is used to update only the network parameters of MetaNet, the gradient is calculated through automatic differentiation, and the network weights are iteratively updated by combining the optimizer and learning rate strategy.
[0037] Step 208: Calculate the core sample weighted loss; Input the core sample set into the main model for forward propagation calculation. Based on the task-preset loss function, calculate the training loss value of each core sample in the current model state, denoted as "core sample weighted loss".
[0038] Step 209: Input the weighted loss of the core samples into MetaNet to output the weights; input the weighted loss of the core samples from Step 208 into MetaNet, and calculate the personalized weight coefficients of each core sample through forward propagation.
[0039] Step 210: Update the main model parameters using backpropagation with weighted average loss; Based on the loss of each core sample calculated in step 208 and the corresponding weights generated in step 209, calculate the weighted average loss and update the parameters of the main model using the backpropagation algorithm;
[0040] Steps 203 to 210 together constitute the “evaluation-weighting-optimization” closed loop, and the dynamic evaluation of sample importance is achieved through the collaborative work of the main model and MetaNet.
[0041] Step 211: Repeat steps 202 to 210 until training is complete.
[0042] Preferably, in step 207, when updating the MetaNet parameters, the gradient of the metadata verification loss in step 206 with respect to the parameters of each layer of MetaNet is calculated using automatic differentiation technology; the network weights of MetaNet are iteratively updated in combination with a preset optimizer and learning rate strategy, wherein the preset optimizer is the Adam or SGD optimization algorithm.
[0043] Preferably, in step 210, the specific method for calculating the weighted average loss is as follows: multiply the training loss of each core sample by the weight coefficient corresponding to that sample; sum all the product results and take the average value to obtain the weighted average loss.
[0044] Furthermore, steps 203 to 210 together constitute the "evaluation-weighting-optimization" closed loop, and through the collaborative work of the main model and MetaNet, the real-time dynamic evaluation and adjustment of sample importance is achieved in each training round; the meta-learning framework maintains high computational efficiency while ensuring the accuracy of weight evaluation through the lightweight MetaNet structure.
[0045] This invention also provides a deep learning core training sample selection system for executing the core training sample selection process, deployed on the CPU side, comprising:
[0046] Multi-process queue initialization unit: used to execute step 101, by setting up two multi-process queues, AQ and BQ, to realize the transmission of sample gradients, loss values and core sample indices between GPU and CPU, ensuring parallel interaction efficiency;
[0047] Training information extraction unit: used to perform step 102, extract sample training information from AQ, the sample training information including Soft-max confidence, training loss, whether the classification is correct, and gradient change;
[0048] Cache update unit: used to execute step 103, update the sample state record array in the cache based on sample training information, including updating the hash table array hash_table based on the number of forgettings;
[0049] Candidate set construction unit: used to perform step 104, randomly sample 2B samples from the full training dataset to construct a candidate sample set, where B is the batch size of the current training;
[0050] Autoencoder loss calculation and cache update unit: used to perform step 105, receive candidate set samples and feed them into the autoencoder, calculate the autoencoder loss for each sample, and update the autoencoder loss array in the cache.
[0051] Autoencoder parameter update unit: used to perform step 106, perform backpropagation based on autoencoder loss, and adjust the model parameters of the autoencoder;
[0052] Clustering screening unit: used to perform step 107, combine the multidimensional indicators of the candidate set samples into a feature vector, calculate the Euclidean distance and perform unsupervised clustering, the number of clusters is B, and the cluster center sample is selected as the core sample.
[0053] Subscript output unit: used to execute step 108, put the subscript of the core sample into BQ, and realize data interaction with the GPU.
[0054] Furthermore, the candidate set construction unit and the clustering screening unit together constitute the two-stage screening mechanism;
[0055] Furthermore, the sample state records dynamically maintained by the cache update unit provide the clustering screening unit with dynamic feature data that changes with the training process, enabling the dynamic multi-index clustering strategy executed by the clustering screening unit to automatically adjust the sample selection criteria accordingly, thereby achieving adaptive screening that adapts to different training stages.
[0056] This invention further provides a deep learning sample weight calibration system for implementing the aforementioned sample weight calibration process, deployed on the GPU side, comprising:
[0057] MetaNet initialization unit: used to execute step 201, initializing the MetaNet parameters of the three-layer fully connected architecture;
[0058] Master Model Copy Unit: Used to execute step 202, perform a deep copy operation on the master model, and completely retain the network architecture details, parameter configuration and current parameter status of the master model;
[0059] First loss calculation unit: used to perform step 203, obtain core training samples from BQ, batch input the main model copy to calculate the comprehensive training loss and retain the sample loss contribution;
[0060] First weight generation unit: used to perform step 204, input the core sample training loss into MetaNet, and output the personalized weight coefficients of each core sample.
[0061] The replica parameter update unit is used to execute step 205, calculate the average loss by weighting the training loss of the core samples, update the replica parameters of the master model by backpropagation, and does not update the MetaNet parameters.
[0062] The second loss calculation unit is used to perform step 206, sample samples from the metadata dataset, and input the main model copy to calculate the metadata validation loss;
[0063] MetaNet parameter update unit: used to perform step 207, verify the loss based on metadata samples, and update only the network parameters of MetaNet through backpropagation;
[0064] The third loss calculation unit is used to execute step 208, input the core sample set into the main model, and calculate the core sample weighted loss of each core sample one by one.
[0065] The second weight generation unit is used to perform step 209, input the weighted loss of the core samples into MetaNet, and output the personalized weight coefficients of each core sample.
[0066] Main model parameter update unit: used to execute step 210, calculate the weighted average loss based on the core sample loss and weights, and update the main model parameters through backpropagation.
[0067] Furthermore, the first loss calculation unit, the first weight generation unit, the replica parameter update unit, the second loss calculation unit, the MetaNet parameter update unit, the third loss calculation unit, the second weight generation unit, and the main model parameter update unit together constitute the "evaluation-weighting-optimization" closed loop. Through the collaborative work of the main model and MetaNet, real-time dynamic evaluation and adjustment of sample importance are achieved. The lightweight MetaNet structure ensures the accuracy of weight evaluation while ensuring the overall computational efficiency of the system.
[0068] The beneficial technical effects of this invention are as follows:
[0069] 1. Accurately select core samples to effectively avoid accuracy loss.
[0070] This invention constructs a multi-dimensional feature space to evaluate sample value through a multi-index dynamic clustering strategy, including gradient, training loss, autoencoder loss, and number of forgettings. It adopts a two-stage mechanism of "first building a candidate pool to ensure diversity, and then clustering to select core samples," which avoids the reckless operation of directly deleting samples with low utility in traditional methods. By leveraging the representativeness of core samples, it indirectly reflects the potential value of such samples, thereby effectively solving the problems of one-sided evaluation by a single index, sample redundancy, or insufficient representativeness. While adapting to high-dimensional training tasks in the field of image classification, it ensures that the model accuracy is not compromised.
[0071] 2. Intelligent dynamic weight calibration optimizes training loop performance.
[0072] A dual-network collaborative optimization system, "Master Model-MetaNet," is constructed based on a meta-learning framework. MetaNet is trained using an independently maintained metadata dataset, ensuring the objectivity of sample weight labeling. The loss features of core samples are transformed into adaptive weights by MetaNet, forming a closed-loop optimization process of "training evaluation - weight generation - parameter update." This process can capture the changes in the importance of samples at different training stages in real time, fully reflecting the differentiated contributions of different samples to parameter updates, and solving the deficiency of traditional fixed weight allocation in adapting to dynamic training. Simultaneously, MetaNet employs a lightweight three-layer fully connected structure, ensuring both accuracy in weight evaluation and computational efficiency.
[0073] 3. Improve training efficiency and reduce resource consumption
[0074] By using a parallel collaborative design of CPU and GPU, the CPU focuses on core sample selection, while the GPU focuses on model training. Data interaction is achieved through multi-process queues AQ (transmitting sample gradients, loss, and other information) and BQ (transmitting core sample indices). Only sample indices are transmitted instead of complete sample data, which significantly reduces data transmission and storage pressure. This shortens the model training cycle from the perspective of data processing and hardware collaboration, reduces the hardware resource requirements of deep learning training, and achieves training efficiency optimization without relying on hardware performance improvements.
[0075] 4. Balancing training efficiency and model performance to resolve the performance loss dilemma.
[0076] This invention, through the representativeness of core samples and the precise allocation of adaptive weights, enables the weighted gradient of a subset of core samples to approximately recover the full gradient (with a maximum error not exceeding a set threshold), ensuring that the model converges to a near-optimal solution. This design successfully resolves the contradiction of "improving training efficiency at the expense of performance" in traditional lightweight models. Compared to traditional acceleration methods such as RHO-LOSS, AutoAssist, and ActiveLearning, as well as random sampling methods, it improves training efficiency while maintaining or even enhancing the model's performance at final convergence, achieving a dual optimization of efficiency and accuracy.
[0077] 5. Highly adaptable and widely applicable
[0078] The core sample selection module's dynamic feature space and adaptive clustering strategy can automatically adjust sample selection criteria according to the model training progress. The dual-network collaborative framework of the weight calibration module does not depend on a specific model architecture and is compatible with mainstream base models such as ResNet50 and GoogleNet. The overall approach starts from the training mechanism of deep learning models themselves, without relying on hardware optimization or adjustments to a single optimization strategy. It is applicable to various deep learning training scenarios in the field of image classification and has strong scene adaptability and application generalization. Attached Figure Description
[0079] Figure 1 This is an overall workflow diagram of the method proposed in this invention, used to integrate and demonstrate the collaborative working logic of the core training sample selection module (CPU side) and the sample weight calibration module (GPU side);
[0080] Figure 2 A flowchart illustrating the process of selecting core training samples in the CPU, demonstrating the specific steps involved in filtering the core samples required for GPU training.
[0081] Figure 3 This is a flowchart illustrating the sample weight calibration module, demonstrating the steps involved in training MetaNet using the meta-learning framework and generating adaptive weights for core samples in real time. Detailed Implementation
[0082] The present invention will now be described in detail with reference to the accompanying drawings and embodiments. Obviously, the described embodiments are merely some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0083] Example 1: Method Example
[0084] To facilitate understanding, the following explanations are provided for several key terms used in this article:
[0085] MetaNet (MetaNetwork): Refers to an auxiliary neural network built on a meta-learning framework, used to dynamically evaluate sample importance and generate sample weights. Its structure is a lightweight, fully connected network that learns the mapping relationship between sample loss and weights through training.
[0086] Metadata refers to the independent dataset used to train and evaluate MetaNet, which is independent of the main training set and is designed to ensure the objectivity and generalization ability of the weight labeling process.
[0087] Unless otherwise specified, all other terms shall be used in accordance with their conventional meaning in this field.
[0088] This embodiment addresses the problems of large parameter count, high computational resource requirements, and long training time in current deep learning systems by proposing a method for selecting core training samples and assigning weights. The method aims to dynamically select a representative minimum training subset S from the complete training sample set V, where S⊂V. Simultaneously, weights are dynamically assigned to each sample in subset S, ensuring that during model training, the weighted gradient using S effectively approximates the full gradient calculated using the full set V, with an approximation error not exceeding a preset, positive-zero threshold. This significantly accelerates training convergence while ensuring model performance.
[0089] The key symbols and concepts involved in the method are defined as follows:
[0090] V: Represents the complete set of training samples, i.e., the entire training set;
[0091] S: represents the core sample subset selected through the core training sample selection process to replace V in the current round of training; it is a subset of V.
[0092] B: Indicates the batch size set during training, which is the number of samples used to update model parameters in each iteration;
[0093] W: Represents the parameter space consisting of all trainable parameters of the main model;
[0094] w: represents a specific instance in the parameter space W, that is, a specific set of model parameter values;
[0095] : A preset error threshold greater than zero is used to theoretically constrain the maximum allowable deviation when using the weighted gradient of a subset S to approximate the full gradient. Its specific value can be set through cross-validation or according to the task's requirements for convergence accuracy.
[0096] : A positive integer used to control the update frequency of MetaNet parameters during the sample weight calibration process. For example, in a specific setting, let =100 means that a complete MetaNet parameter update loop is executed every 100 main model training iterations.
[0097] The image data used in this embodiment comes from the publicly available datasets CIFAR10 and CIFAR100; CIFAR-10 and CIFAR-100 are two widely used benchmark image datasets in the field of computer vision. CIFAR-10 contains image data in 10 categories, such as airplanes, cars, birds, cats, deer, dogs, frogs, horses, boats, and trucks; CIFAR-100 contains image data in 100 more granular categories, such as apples, bees, beds, bicycles, bottles, lions, maple trees, motorcycles, mountains, and roses. Both datasets contain a total of 60,000 images (50,000 training images and 10,000 test images), but the core difference lies in the granularity of the classification. The image size in both CIFAR-10 and CIFAR100 is 32x3 pixels. CIFAR-10 is a "coarse-grained" classification task dataset, while CIFAR-100 is a more challenging "fine-grained" classification task dataset. Together, they form a benchmark system for image classification from simple to complex.
[0098] This method relies on a parallel architecture of CPU and GPU, and executes the core training sample selection process and sample weight calibration process in a coordinated manner. The overall process is as follows: Figure 1 As shown, the collaborative logic follows: "GPU forward computation → AQ transmits training information → CPU selects core samples → BQ transmits sample indices → GPU weight calibration and parameter update." AQ and BQ are two multi-process queues used for data interaction between the CPU and GPU: AQ is used to transmit information such as sample gradients and loss values generated during training from the GPU to the CPU; BQ is used to send the indexes of the selected core samples back from the CPU to the GPU. The specific collaborative division of labor is as follows:
[0099] CPU thread 1: Executes steps 102 (AQ dequeue) and 103 (cache update), where AQ dequeue corresponds to extracting training information from the multi-process queue AQ, and cache update corresponds to dynamically updating the sample state record array in the cache;
[0100] CPU thread 2: Execute steps 104 (candidate set construction), 105 (autoencoder loss calculation), 106 (autoencoder parameter update), and 107 (feature similarity calculation and clustering).
[0101] BQ Enqueue: The CPU enqueues the selected core sample indices through step 108 (core sample indices are enqueued in BQ) to complete the data transfer to the GPU;
[0102] The candidate set construction process involves randomly selecting samples twice the batch size from all training samples as the candidate set. The autoencoder loss calculation stage involves inputting the samples from the candidate set into the autoencoder to calculate the autoencoder loss for each sample. The autoencoder parameter update involves updating the autoencoder parameters through backpropagation based on the autoencoder loss value calculated by forward propagation. The feature similarity calculation and clustering stage involves calculating the similarity of the samples in the candidate set based on their feature indices and performing clustering, with the cluster centers being the important samples. The BQ enqueue operation involves writing the index information of the important samples selected by the CPU into the multi-process queue BQ.
[0103] GPU module: Extracts important samples from BQ, executes the sample weight calibration process, and sequentially completes steps 203 (core sample loss calculation), 204 (weight generation), 205 (master model copy parameter update), 206 (metadata loss calculation), 207 (MetaNet parameter update), 208 (master model loss calculation), 209 (weight secondary generation), and 210 (master model parameter update), forming a complete closed-loop optimization.
[0104] The process involves several steps: BQ dequeueing reads important sample index information written by the CPU via the PCIe bus from the multi-process queue BQ in the shared memory area. Core sample loss calculation involves first copying the master model to obtain a master model replica, then inputting important samples into the master model replica, obtaining the model output through forward propagation, and calculating the loss value with the sample labels. Weight generation involves inputting the core sample loss value into MetaNet to output weights. Master model replica parameter update involves calculating the weighted loss of the core samples and updating the parameters of the master model replica. Metadata loss calculation involves inputting metadata data into the master model replica and calculating the loss value. MetaNet parameter update involves backpropagating based on the metadata loss value calculated in the previous step to update the MetaNet parameters. Master model loss calculation involves inputting core samples into the master model and calculating the loss value based on the output and labels. Weight secondary generation involves inputting the loss value calculated in the previous step into MetaNet to output sample weights. Master model parameter update involves first calculating the weighted loss value based on the loss values obtained in the previous two steps and the sample weights, and then updating the master model parameters through backpropagation of the weighted loss value.
[0105] (1) Core training sample selection process (CPU execution)
[0106] This process is executed in parallel by the CPU, employing a dynamic multi-index clustering strategy and a two-stage screening mechanism. Specifically, the two-stage screening mechanism is manifested in step 104 (randomly selecting a candidate set) and step 107 (similarity calculation and clustering): first, in step 104, a candidate set is randomly selected to ensure diversity; then, in step 107, core samples are precisely selected from the candidate set through clustering. Figure 2 As shown, the specific steps are as follows:
[0107] Step 101: Initialize the multi-process queue;
[0108] Two multi-process queues are set up, one denoted as AQ and the other as BQ. AQ is used by the GPU to transmit information such as sample gradients and loss values generated during training to the CPU. The CPU retrieves this data from AQ as input to the core sample selection algorithm to determine the core samples for the next round of training. BQ is used by the CPU to send the selection results back to the GPU. The CPU sends the indices of the core samples to the GPU through BQ, and the GPU uses the data corresponding to these indices as the core sample set for the next round of training. Specifically, after the GPU completes the forward computation, it pushes the gradient and other information to AQ. The CPU retrieves the data and executes the selection algorithm, then pushes the core sample indices to BQ. Finally, the GPU obtains the indices from BQ and loads the corresponding data, thus achieving efficient parallelism between GPU training and CPU sample selection.
[0109] Step 102: Extract training information from AQ;
[0110] To optimize the sample selection strategy and provide data support for subsequent model training, we extracted a set of sample training information (Soft-max confidence, training loss, and correct classification) computed by the GPU from the multi-process queue AQ. This information contains rich training details, mainly including key indicators such as gradient changes and training loss values for each sample, and originates from the sample set previously used in the main model training process. By analyzing and processing this data, we can evaluate the training effect of the samples, thus providing a reliable basis for sample selection in the next round of training.
[0111] Step 103: Update the cache array;
[0112] Based on the sample training information obtained in step 102 (including key metrics such as Soft-max confidence and training loss), we dynamically update the sample state record array in the cache. Specifically, there is a dedicated array for updating based on the number of sample forgetting events, and its update method is as follows:
[0113] ;
[0114] Where i is the index of the sample in the whole set V, current_acc indicates whether the i samples were correctly classified in the latest training (1 for yes, 0 for no), pre_acc indicates whether the i-th sample was correctly classified in the previous training, and hash_table is an array storing the number of forgettings. If current_acc=0 and pre_acc=1, it means that the sample was correctly classified in the previous training but not in the latest training, indicating that the sample has been "forgotten" by the model. In this case, the number of forgettings for the sample is incremented by 1 (fn represents the number of forgettings).
[0115] To reduce the storage space occupied by the hash_table array, the hash_table array only stores the forgetting count values of half the total number of samples in the entire training set V. When the forgetting count of the i-th sample is not stored in the hash_table and the number of samples storing forgetting counts in the hash_table exceeds the upper limit, the record of the sample with the smallest forgetting count is deleted from the hash_table, and the forgetting count of the i-th sample is assigned a value of 1. Subsequently, the pre_acc value of the i-th sample is updated to the current_acc value.
[0116] These arrays serve as a time-series database of sample training performance, continuously tracking and accumulating the state changes of each sample during the training process. By maintaining these metrics in real time, we can construct a complete evaluation system for sample training effectiveness, providing reliable data support for subsequent sample importance analysis and adaptive selection strategies.
[0117] Step 104: Randomly select a candidate set;
[0118] First, 2B samples (where B is the current training batch size) are randomly sampled from the complete training dataset V to form a dynamic candidate sample set. This candidate set, twice the size of the actual training batch, ensures the diversity of sample selection while providing ample optimization space for subsequent fine-tuning based on training metrics. This candidate set will serve as the basic data pool for further processing by subsequent sample importance evaluation and priority selection algorithms.
[0119] Step 105: Input the data into the autoencoder to obtain the autoencoder loss and update the cache array;
[0120] The reconstruction loss of the autoencoder reflects the degree of abnormality of the samples. A smaller autoencoder loss indicates that the samples are more likely to be normal, and this metric is an important indicator for selecting core samples. Therefore, the 2B candidate samples obtained in step 104 are input into the autoencoder to obtain the reconstruction output values of the candidate set samples. By comparing the output values with the original values, the autoencoder loss of each sample is calculated, and the corresponding autoencoder loss array in the cache is updated.
[0121] Step 106: Autoencoder backpropagation updates parameters;
[0122] Based on the autoencoder loss calculated in step 105, the backpropagation algorithm is executed to adjust the model parameters of the autoencoder. This step optimizes the reconstruction capability of the autoencoder, enabling it to better capture sample features.
[0123] Step 107: Similarity calculation and clustering;
[0124] The candidate set samples' soft-max confidence, training loss, autoencoder loss, number of forgettings, and labels (only for classification data) are combined into a feature vector. The Euclidean distance between samples is calculated, and unsupervised clustering is performed (the number of clusters is set to B). After clustering, the sample closest to the geometric center of each cluster is taken as the representative sample of that cluster (i.e., the cluster center sample). These cluster center samples are considered as the core samples in the candidate set.
[0125] Step 108: Select the core samples and subject them to BQ (Browsing and Questioning).
[0126] The indices of the B core samples selected in step 107 are added to the multi-process queue BQ. The set of these B samples is the core sample subset S selected in the current round. Storing only the indices instead of the complete sample data significantly reduces the transmission and storage pressure on BQ, improving efficiency.
[0127] Step 109: Repeat steps 102 to 108 until training is complete.
[0128] (2) Sample weight calibration process (GPU execution)
[0129] The purpose of selecting core samples in this invention is to use a small number of important samples instead of the entire sample for training, thereby reducing the training time until model convergence. Since the core training samples need to represent multiple samples, the loss of the core samples needs to be weighted before backpropagation. This process is executed by the GPU, using meta-learning to train the MetaNet used to generate the weights of the core training samples, and generating the weights of the core training samples in real time during training. The parameters of the MetaNet responsible for generating the weights are not updated in every iteration, but periodically. This update frequency is determined by the parameter... Control. In one specific embodiment, settings are configured. =100, meaning that every 100 training iterations, steps 202 to 210 are executed once to update the MetaNet parameters. For example... Figure 3 As shown, the specific steps are as follows:
[0130] Step 201: Initialize MetaNet parameters;
[0131] We first initialize the parameters of the MetaNet model, a network specifically designed to dynamically generate weights for training samples. MetaNet employs a carefully designed lightweight architecture consisting of three fully connected layers: the input layer receives sample features and training metrics, the intermediate hidden layers perform non-linear transformations, and the output layer generates the final sample weights. This concise yet efficient network structure effectively learns the complex mapping between sample importance and its training dynamics while maintaining computational efficiency. Through a reasonable parameter initialization strategy, we lay a solid foundation for subsequent end-to-end training of MetaNet.
[0132] Step 202: Copy the master model, and call it a copy;
[0133] We perform a deep copy operation on the main model, creating a complete, independent replica. This copying process not only fully preserves all architectural details of the main model, including network layer structure, connection methods, and parameter configurations, but also accurately replicates all current weight parameters and model states. This completely independent model replica ensures that various auxiliary calculations and evaluation operations can be safely performed without interfering with the training process of the original main model. The model copying process employs a deep copy mechanism to guarantee complete consistency between the replica and the main model in their initial states.
[0134] Step 203: Input the core samples into the master model copy and calculate the core sample training loss;
[0135] We obtain selected core training samples from the multi-process queue BQ and batch-input these samples into a previously replicated master model to perform forward propagation computation, obtaining the model's predicted output through the complete inference process. Subsequently, based on predefined task-related loss functions (such as cross-entropy loss or mean squared error), the system calculates the comprehensive training loss of these core samples in the current model state, denoted as the "core sample training loss." This calculation process not only obtains the overall loss value but also retains the loss contribution of each individual sample, providing a fine-grained reference for subsequent sample weight adjustments and model optimization. The entire process ensures accurate evaluation of the model's performance on the current core sample set without affecting the main training process.
[0136] Step 204: Input the training loss of the core samples into the output weights of MetaNet;
[0137] We use the training loss of the core samples in the master model replica obtained in step 203 as key input features and input them into the MetaNet network. Through the forward propagation calculation of MetaNet's three fully connected layers, the network performs non-linear transformation and importance evaluation on the loss value of each sample, and finally outputs personalized weight coefficients corresponding to each core sample.
[0138] Step 205: Weight the training loss of the core samples and backpropagate to update the parameters of the master model replica;
[0139] The weighted average loss value is calculated for the core sample training loss obtained in step 203, and then the backpropagation algorithm is executed to update the parameters of the master model replica (the computational graph of MetaNet is preserved but its parameters are not updated during this process). Specifically, the gradient of the loss function with respect to the parameters of each layer is first calculated using automatic differentiation. Then, a preset optimization algorithm (such as Adam or SGD) combined with the current learning rate strategy is used to iteratively update the model weights. This process not only considers the average gradient direction of the entire batch but also preserves the differentiated contribution of each sample to the parameter update, enabling the model to be optimized specifically for the features of the core sample set. The entire parameter update process effectively improves the model's performance on key samples while ensuring training stability.
[0140] Step 206: Input metadata into the primary model replica and calculate the metadata validation loss;
[0141] We randomly sample a batch of data of size `batch_size` from a pre-divided metadata dataset, ensuring complete independence from the main training set and guaranteeing the objectivity of the evaluation. These samples are then fed into the updated master model replica (as described in step 205) for forward propagation computation, obtaining the predicted output through network layer transformations. Subsequently, based on a predefined specific loss function (such as mean squared error or cross-entropy), the system calculates the comprehensive training loss of this batch of samples under the current parameter state of the master model replica, denoted as the "metadata validation loss".
[0142] Step 207: Update MetaNet parameters;
[0143] Based on the metadata validation loss calculated in step 206, the parameters are updated using the gradient calculated from the MetaNet computation graph retained in step 205, employing the backpropagation algorithm. Since the MetaNet parameters were not updated in step 205, the previous gradient information is retained. Therefore, this step treats the master model replica parameters as constants and optimizes them, performing end-to-end optimization only on the MetaNet network parameters. Specifically, the implementation process is as follows: First, the gradient of the loss function with respect to the parameters of each MetaNet layer is calculated using automatic differentiation. Then, combined with a preset optimizer (such as Adam or SGD) and learning rate strategy, the network weights are iteratively updated. This optimization process fully considers the feature distribution of samples in the metadata dataset, enabling MetaNet to adaptively adjust its weight generation strategy. The entire parameter update process effectively improves the accuracy and generalization ability of MetaNet in sample importance assessment while ensuring numerical stability.
[0144] Step 208: Calculate the core sample weighted loss
[0145] We input the selected core sample set into the main model for forward propagation. Through the transformations of each layer of the model, we obtain the predicted output for each sample. Then, based on the task-preset loss function (such as cross-entropy loss or mean squared error), we calculate the training loss value of each core sample in the current model state, denoted as the "core sample weighted loss". This process not only obtains a precise loss measure at the sample level but also preserves the differential information of each sample's contribution to model training, providing a fine-grained reference for subsequent sample weight adjustment and model optimization strategies. Through this refined loss calculation method, we can more accurately evaluate and utilize the training value of the core sample set, thereby improving the overall learning performance of the model.
[0146] Step 209: Input the weighted loss of the core samples into the MetaNet output weights;
[0147] We use the core sample weighted loss calculated in step 208 as the key input feature and feed it into the MetaNet network. Through MetaNet's three-layer fully connected architecture, the network performs forward propagation calculations, non-linearly transforming and evaluating the importance of each sample's loss value, ultimately outputting personalized weight coefficients corresponding to each core sample. These weight values not only reflect the relative importance of the sample in the current training phase but also encode the sample's potential contribution to model optimization. This weighting mechanism allows the model to adaptively adjust its training focus, thereby more effectively utilizing core samples with higher training value during subsequent backpropagation.
[0148] Step 210: Update the main model parameters using backpropagation with the weighted average loss value.
[0149] Based on the loss values of each core sample calculated in step 208 and the weights of each core sample obtained in step 209, a weighted average loss value is calculated, and this value is used to update the parameters of the main model through backpropagation. Specifically, the "calculation of weighted average loss" is performed as follows: the training loss of each core sample is multiplied by the weight coefficient corresponding to that sample; the sum of all products is then taken as the average to obtain the weighted average loss value. The calculation formula is:
[0150] loss = ;
[0151] Where i represents the sample index and n represents the number of training samples. This represents the training loss value of the i-th core sample calculated in step 208, and .
[0152] Step 211: Repeat steps 202 to 210 until training is complete.
[0153] The main model parameters are updated in each iteration, while the MetaNet parameters are updated every... Execute once per iteration.
[0154] Example 2: System Example
[0155] This embodiment provides a deep learning training acceleration system to implement the method described in Embodiment 1, and solves the problems of large number of deep learning parameters, high computing power requirements, and long training time. The system includes a deep learning core training sample selection module, a sample weight calibration module, a CPU processing module, and a GPU training module.
[0156] Deep learning core training sample selection module (CPU deployment)
[0157] This module is run by the CPU processing module and is used to execute the core training sample selection process in parallel. It includes the following functional units:
[0158] ① Multi-process queue initialization unit
[0159] To execute step 101, two multi-process queues, AQ and BQ, are set up. AQ is used for the GPU to pass information such as sample gradients and loss values generated during training to the CPU, and BQ is used for the CPU to pass back the index of core samples to the GPU. This ensures efficient parallelism between GPU training and CPU sample selection and enables data interaction between the two.
[0160] ② Training Information Extraction Unit
[0161] For performing step 102, extract sample training information (Soft-max confidence, training loss, whether correctly classified, gradient change situation) from the multi-process queue AQ. This information is derived from the sample set that previously participated in the main model training, providing data support for sample screening.
[0162] ③ Cache update unit
[0163] For performing step 103, dynamically update the sample status record array in the cache based on the sample training information, including the hash table array hash_table based on the sample forgetting times (update rule: If current_acc < pre_acc: hash_table [i].fn = hash_table [i].fn + 1); hash_table only stores the forgetting times values of half of the samples. When it exceeds the limit, delete the record with the smallest forgetting times, and assign the forgetting times of the un-stored samples as 1 and update pre_acc to current_acc.
[0164] ④ Candidate set construction unit
[0165] For performing step 104, randomly sample 2B samples (B is the current training batch size batch_size) from the complete training dataset to construct a dynamic candidate sample set, ensuring sample diversity and subsequent screening space.
[0166] ⑤ Autoencoder loss calculation and cache update unit
[0167] For performing step 105, receive the candidate set samples and input them into the autoencoder, calculate the autoencoder loss of each sample, and update the autoencoder loss array in the cache.
[0168] ⑥ Autoencoder parameter update unit
[0169] For performing step 106, perform backpropagation based on the autoencoder loss to adjust the model parameters of the autoencoder.
[0170] ⑦ Clustering screening unit
[0171] For performing step 107, combine the Soft-max confidence, training loss, autoencoder loss, forgetting times, and labels (classification problem data) of the candidate set samples into a feature vector, calculate the Euclidean distance between samples and perform unsupervised clustering (the number of clusters is B), and select the cluster center samples as the core samples.
[0172] ⑧ Subscript output unit
[0173] For performing step 108, put the subscripts of the core samples into BQ to achieve data interaction with the GPU.
[0174] (2) Sample weight calibration module (GPU deployment)
[0175] The system is run by a GPU training module to perform the sample weight calibration process, and includes the following functional units:
[0176] ①MetaNet Initialization Unit
[0177] To perform step 201, the parameters of the three-layer fully connected MetaNet architecture are initialized. The input layer receives sample features and training metrics, the intermediate hidden layers perform non-linear transformations, and the output layer generates sample weight values.
[0178] ② Master Model Replication Unit
[0179] This is used to execute step 202, which involves performing a deep copy operation on the main model to fully preserve the main model's architectural details, parameter configurations, and all current weight parameters and model states.
[0180] ③ First Loss Calculation Unit
[0181] To perform step 203, core training samples are obtained from BQ, batch input into the master model copy to perform forward propagation calculation, and the comprehensive training loss of the core samples is calculated based on the preset task-related loss function (such as cross-entropy loss or mean squared error), while retaining the loss contribution of each sample.
[0182] ④ First weight generation unit
[0183] To perform step 204, the training loss of the core samples is input into MetaNet, and forward propagation is performed through a three-layer fully connected architecture to output the personalized weight coefficients of each core sample.
[0184] ⑤ Replica Parameter Update Unit
[0185] To execute step 205, the average loss value is calculated by weighting the training loss of the core samples, the backpropagation algorithm is executed to update the parameters of the master model replica (without updating the MetaNet parameters), the gradient is calculated by automatic differentiation, and the weights are iteratively updated using a preset optimization algorithm (such as Adam or SGD) combined with a learning rate strategy.
[0186] ⑥ Second loss calculation unit
[0187] To perform step 206, a batch size of samples is randomly sampled from a metadata dataset that is completely independent of the main training set. These samples are then input into the updated copy of the main model for forward propagation calculation. Based on a preset loss function (such as mean squared error or cross-entropy), the comprehensive training loss of this batch of samples is calculated.
[0188] ⑦ MetaNet Parameter Update Unit
[0189] To perform step 207, based on the training loss of step 206, the backpropagation algorithm is used to update only the network parameters of MetaNet (treating the parameters of the master model copy as constants), the gradient is calculated through automatic differentiation, and the network weights are iteratively updated in combination with the optimizer and learning rate strategy.
[0190] ⑧ Third Loss Calculation Unit
[0191] To execute step 208, the core sample set is input into the main model for forward propagation calculation. Based on the task-preset loss function, the training loss value of each core sample in the current model state is calculated one by one.
[0192] ⑨ Second weight generation unit
[0193] To perform step 209, the core sample training loss from step 208 is input into MetaNet, and the personalized weight coefficients of each core sample are calculated and output through forward propagation.
[0194] ⑩ Master Model Parameter Update Unit
[0195] To perform step 210, based on the core sample loss values from step 208 and the weights from step 209, a weighted average loss value is calculated and the parameters of the main model are updated via backpropagation.
[0196] (3) CPU processing module and GPU training module
[0197] ①CPU processing module
[0198] Used to run the deep learning core training sample selection system, it receives training information such as sample gradients and loss values transmitted by the GPU training module through AQ, executes the process of steps 102 to 108, and transmits the core sample index to the GPU training module through BQ to achieve parallel collaboration with the GPU.
[0199] ②GPU training module
[0200] Used to run the main model training process and sample weight calibration system, load core samples to perform forward / backward propagation calculations; cooperates with the sample weight calibration system to complete the closed loop of steps 203 to 210, and cooperates with the deep learning sample weight calibration system to complete the closed loop process of "core sample loss calculation - weight generation - main model parameter update"; by approximating the full gradient through the weighted gradient of the core samples, the computational power consumption is reduced and the model training convergence is accelerated.
[0201] Example 3: Experimental Verification
[0202] This embodiment verifies the effectiveness of the above-mentioned deep learning core training sample selection and weight labeling method through experiments. The experimental design and results are as follows:
[0203] (1) Basic experimental setup
[0204] ①Dataset
[0205] The CIFAR-10 dataset is used, which contains 10 classes of image files and is a commonly used standard dataset for image classification tasks.
[0206] ② Base model
[0207] Two mainstream deep learning models were selected: ResNet (specifically ResNet50) and GoogleNet.
[0208] ③ Comparison method
[0209] Five sample selection / training acceleration methods were selected for comparison, as shown below:
[0210] RHO-LOSS stands for "Reduce Redundancy Loss". Its core idea is to use a selection function that reduces redundant loss, quantifying the loss reduction that each point can achieve on unseen data, and selecting data with less loss reduction for training.
[0211] AutoAssist is a tool that automatically selects samples. Its core idea is to filter out samples that have a relatively low contribution to improving the current model's training; that is, samples with small loss values contribute less to gradient descent and are therefore discarded.
[0212] Active Learning: This refers to self-directed learning, a type of machine learning method. Its core idea is to use a "loss prediction model" to predict the loss of input data points and select data points with higher predicted losses for training.
[0213] Forgetting: This method aims to eliminate a small subset of samples from the training dataset that are difficult for the model to forget, while maintaining generalization performance.
[0214] Uniform Random Selection: This refers to uniform random sampling. Its core idea is to randomly select a subset of all training samples according to a preset ratio as the actual training samples.
[0215] ④ Experimental parameter configuration of the present invention
[0216] In the experimental configuration of this invention, the training batch size B is set to 128. The candidate set size in the core sample selection process is correspondingly 2B = 256. Weight update frequency parameter... Setting it to 100 means that a complete MetaNet parameter update loop is executed once every 100 main model training iterations.
[0217] All comparative experiments were conducted on the same hardware platform and with the same maximum number of training epochs to ensure fairness in the comparison.
[0218] (2) Experimental results and analysis
[0219] The experiments were performed on the same equipment, and the results are shown in Tables 1 and 2. In the tables, "Time to Baseline" is defined as the time required to achieve the highest test accuracy of the baseline method (AutoAssist). Speedup factors are calculated based on this baseline time (AutoAssist is 1x).
[0220] Table 1 compares the performance of different data selection strategies on the CIFAR-10 dataset (ResNet50 model).
[0221]
[0222] Note 1: This experiment uses AutoAssist's highest test accuracy (83.02%) as the performance benchmark. "Time to reach benchmark" refers to the training time required to reach or exceed this accuracy. For methods that do not reach this benchmark accuracy, their "Time to reach benchmark" and "Speed-up factor" are marked as "—".
[0223] Note 2: "Speed-up factor" is calculated based on the training time of AutoAssist (1x). The larger the value, the higher the efficiency.
[0224] Table 2 compares the performance of different data selection strategies on the CIFAR-100 dataset (GoogleNet model).
[0225]
[0226] Note: This experiment uses AutoAssist's highest test accuracy (66.22%) as the performance benchmark. The definitions of "reaching the benchmark time" and "acceleration factor" are the same as in Table 1.
[0227] The following analysis is based on the experimental data in Tables 1 and 2:
[0228] ① Comparison of training time at the same accuracy: When achieving the same test accuracy as AutoAssist, the method proposed in this invention requires significantly less training time, with a reduction of about 75%, which is an acceleration of about 4 times (corresponding to 4.01 times in Table 1).
[0229] ② Comparison of final convergence performance: When training reaches convergence, the method proposed in this invention has the highest final test accuracy.
[0230] (3) Experimental conclusions
[0231] The deep learning core training sample selection and weight calibration method proposed in this invention can effectively accelerate training and maintain accuracy, solving the problems of large number of deep learning parameters, high computing power requirements, and long training time.
[0232] Although the embodiments of the present invention have been disclosed above, they are not limited to the applications listed in the specification and embodiments. They can be applied to various fields suitable for the present invention. For those skilled in the art, and for those of ordinary skill in the art, various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present invention. Therefore, the present invention is not limited to the specific details without departing from the general concept defined by the claims and their equivalents.
Claims
1. A method for selecting core training samples and assigning weights in deep learning for image classification, characterized in that, The method is based on a CPU and GPU collaborative parallel computing architecture. Through the collaborative execution of the core training sample selection process and the sample weight calibration process, it processes digital image data collected by image sensors, thereby accelerating the training of deep learning models in the field of image classification. The core training sample selection process is executed by the CPU and employs a dynamic multi-index clustering strategy. It evaluates sample value by constructing a multi-dimensional feature space using gradients, training loss, and the autoencoder loss calculated from the autoencoder. A two-stage screening mechanism is used: the first stage randomly selects a candidate set from the full training set V that is larger than the actual training batch size; the second stage clusters the candidate set samples based on the multi-dimensional feature space, selecting core samples from the candidate set to form the minimum training subset. ; The autoencoder loss is calculated by feeding the candidate set samples into the autoencoder; the multidimensional feature space is constructed by combining the soft-max confidence of the candidate set samples, the training loss, the autoencoder loss, the number of forgettings, and the labels into a feature vector. The sample weighting process is executed by the GPU, and an intelligent weight allocation system is built using a meta-learning framework. Through the collaborative work of the main model and MetaNet, dynamic evaluation of sample importance is achieved, and a weight coefficient is periodically dynamically assigned to each sample in the subset S. Each iteration updates the weights, forming a closed loop of "evaluation-weighting-optimization"; Through the coordination of the core training sample selection process and the sample weight calibration process, during training, for any optimized parameter w in the main model parameter space W, the weighted gradient of the subset S can be used to approximate the full gradient on the entire training set V, and the approximation error is controlled within a preset error threshold. This allows for accelerated convergence of deep learning model training.
2. The method according to claim 1, characterized in that, The CPU and GPU collaborative parallel computing architecture specifically uses multi-process queues AQ and BQ to realize data interaction between the core training sample selection process and the sample weight calibration process. The overall process follows the collaborative logic of "GPU forward computation → AQ transmission of training information → CPU screening of core samples → BQ transmission of sample subscripts → GPU weight calibration and parameter update". The multi-process queue AQ is used to enable the GPU to transmit sample gradient and loss value information generated during training to the CPU. The CPU extracts the above data from the AQ as the input basis for the core sample selection algorithm. The multi-process queue BQ is used to enable the CPU to send the index of the core sample back to the GPU. The GPU uses the index to index the corresponding data as the core sample set for the next round of training.
3. The method according to claim 2, characterized in that, The core training sample selection process specifically includes the following steps: Step 101: Initialize the multi-process queue; set up two multi-process queues, denoted as AQ and BQ respectively. After the GPU completes the forward computation, it pushes the gradient information to AQ. The CPU extracts the data in AQ and executes the core sample selection algorithm. Then, it pushes the core sample index to BQ. The GPU obtains the index from BQ and loads the corresponding data, thereby realizing the efficient parallel execution of GPU-side model training and CPU-side sample selection. Step 102: Extract training information from AQ; extract the sample training information computed by the GPU from the multi-process queue AQ. The sample training information includes Soft-max confidence, training loss, and whether the classification is correct. This information includes the gradient changes of each sample and the training loss value index, and originates from the sample set that previously participated in the main model training process. Step 103: Update the cache array; Based on the sample training information obtained in step 102, dynamically update the sample state record array in the cache. The sample state record array contains a hash table array hash_table based on the number of sample forgettings. The update method is: if the current accuracy is 0 and the previous accuracy was 1, then the forgetting count is incremented by 1. Step 104: Randomly select a candidate set; randomly sample 2B samples from the complete training dataset to form a dynamic candidate sample set, where B is the batch size of the current training; Step 105: Input the autoencoder to obtain the autoencoder loss and update the cache array; feed the candidate set samples into the autoencoder, calculate the autoencoder loss for each sample, and update the corresponding autoencoder loss array in the cache. Step 106: Autoencoder backpropagation to update parameters; perform backpropagation based on the autoencoder loss calculated in step 105 to adjust the autoencoder model parameters; Step 107: Similarity calculation and clustering; as a specific implementation of the dynamic multi-index clustering strategy, the soft-max confidence, training loss, autoencoder loss, number of forgettings, and labels of the candidate set samples are combined into a feature vector to construct the multi-dimensional feature space, where the labels are only for classification problem data; calculate the Euclidean distance between samples and perform unsupervised clustering, with the number of clusters being B, and the cluster center samples being used as core samples; Step 108: Select core samples and add them to BQ; add the indices of B core samples to the multi-process queue BQ; Step 109: Repeat steps 102 to 108 until training is complete; Steps 104 and 107 together constitute the two-stage screening mechanism: Step 104 is the first stage of randomly screening candidate sets to ensure diversity, and Step 107 is the second stage of clustering screening based on the multidimensional feature space to accurately evaluate the importance of samples.
4. The method according to claim 3, characterized in that, In step 103, the hash table array hash_table stores only half of the total number of forgetting counts of the entire training set V. When the forgetting count of the i-th sample is not stored in the hash_table and the storage capacity of the hash_table exceeds the upper limit, the sample record with the smallest forgetting count in the hash_table is deleted, the forgetting count of the i-th sample is assigned a value of 1, and the pre_acc value of the i-th sample is updated to the current_acc value.
5. The method according to claim 1, characterized in that, The sample weight calibration process specifically includes the following steps: Step 201: Initialize MetaNet parameters; As part of the meta-learning framework, the parameters of the MetaNet model are initialized. The MetaNet adopts a three-layer fully connected network architecture. The input layer receives sample features and training metrics, the intermediate hidden layer performs non-linear transformation, and the output layer generates sample weight values. Step 202: Copy the main model and call it a replica; perform a deep copy operation on the main model to fully preserve the main model's architectural details, parameter configurations, and all current weight parameters and model states; Step 203: Input the core samples into the master model copy and calculate the loss; obtain the core training samples from BQ, input them in batches into the master model copy to perform forward propagation calculation, calculate the comprehensive training loss of the core samples based on the preset task-related loss function, denoted as "core sample training loss", where the task-related loss function is cross-entropy loss or mean squared error, and retain the loss contribution of each sample during the calculation process; Step 204: Input the training loss of the core samples into the MetaNet output weights; input the training loss of the core samples into MetaNet, perform forward propagation calculation through a three-layer fully connected architecture, and output the personalized weight coefficients of each core sample. Step 205: Weight the training loss of the core samples and backpropagate to update the parameters of the master model copy; calculate the average loss by weighting the training loss of the core samples obtained in step 203, execute the backpropagation algorithm to update the parameters of the master model copy, and do not update the MetaNet parameters; calculate the gradient by automatic differentiation, and iteratively update the weights by using a preset optimization algorithm combined with a learning rate strategy. The preset optimization algorithm is Adam or SGD optimization algorithm. Step 206: Input metadata into the master model replica and calculate the loss; randomly sample a batch of samples from the metadata dataset that is completely independent of the master training set, input them into the updated master model replica for forward propagation calculation, and calculate the comprehensive training loss of the batch of samples based on the preset loss function, denoted as "metadata validation loss", where the preset loss function is mean squared error or cross-entropy loss; Step 207: Update MetaNet parameters; Based on the metadata verification loss from step 206, the backpropagation algorithm is used to update only the network parameters of MetaNet, the gradient is calculated through automatic differentiation, and the network weights are iteratively updated by combining the optimizer and learning rate strategy. Step 208: Calculate the core sample weighted loss; Input the core sample set into the main model for forward propagation calculation. Based on the task-preset loss function, calculate the training loss value of each core sample in the current model state, denoted as "core sample weighted loss"; Step 209: Input the weighted loss of the core samples into MetaNet to output the weights; input the weighted loss of the core samples from Step 208 into MetaNet, and calculate the personalized weight coefficients of each core sample through forward propagation. Step 210: Update the main model parameters using backpropagation with weighted average loss; Based on the loss of each core sample calculated in step 208 and the corresponding weights generated in step 209, calculate the weighted average loss and update the parameters of the main model using the backpropagation algorithm; Steps 203 to 210 together constitute the "evaluation-weighting-optimization" closed loop, and the dynamic evaluation of sample importance is achieved through the collaborative work of the main model and MetaNet. Step 211: Repeat steps 202 to 210 until training is complete.
6. The method according to claim 5, characterized in that, In step 207, when updating the MetaNet parameters, the gradient of the metadata verification loss in step 206 with respect to the parameters of each layer of MetaNet is calculated using automatic differentiation technology; the network weights of MetaNet are iteratively updated in combination with a preset optimizer and learning rate strategy, wherein the preset optimizer is the Adam or SGD optimization algorithm.
7. The method according to claim 5, characterized in that, In step 210, the specific method for calculating the weighted average loss is as follows: multiply the training loss of each core sample by the weight coefficient corresponding to that sample; sum all the product results and take the average value to obtain the weighted average loss.
8. A deep learning core training sample selection system, characterized in that, For executing the core training sample selection process described in claim 3, deployed on the CPU side, including: Multi-process queue initialization unit: used to execute step 101, by setting up two multi-process queues, AQ and BQ, to realize the transmission of sample gradients, loss values and core sample indices between GPU and CPU, ensuring parallel interaction efficiency; Training information extraction unit: used to perform step 102, extract sample training information from AQ, the sample training information including Soft-max confidence, training loss, whether the classification is correct, and gradient change; Cache update unit: used to execute step 103, update the sample state record array in the cache based on sample training information, including updating the hash table array hash_table based on the number of forgettings; Candidate set construction unit: used to perform step 104, randomly sample 2B samples from the full training dataset to construct a candidate sample set, where B is the batch size of the current training; Autoencoder loss calculation and cache update unit: used to perform step 105, receive candidate set samples and feed them into the autoencoder, calculate the autoencoder loss for each sample, and update the autoencoder loss array in the cache. Autoencoder parameter update unit: used to perform step 106, perform backpropagation based on autoencoder loss, and adjust the model parameters of the autoencoder; Clustering screening unit: used to perform step 107, combine the multidimensional indicators of the candidate set samples into a feature vector, calculate the Euclidean distance and perform unsupervised clustering, the number of clusters is B, and the cluster center sample is selected as the core sample. Subscript output unit: used to execute step 108, put the subscript of the core sample into BQ, and realize data interaction with the GPU.
9. A deep learning sample weight labeling system, characterized in that, To implement the sample weight calibration process described in claim 5, deployed on the GPU side, including: MetaNet initialization unit: used to execute step 201, initializing the MetaNet parameters of the three-layer fully connected architecture; Master Model Copy Unit: Used to execute step 202, perform a deep copy operation on the master model, and completely retain the network architecture details, parameter configuration and current parameter status of the master model; First loss calculation unit: used to perform step 203, obtain core training samples from BQ, batch input the main model copy to calculate the comprehensive training loss and retain the sample loss contribution; First weight generation unit: used to perform step 204, input the core sample training loss into MetaNet, and output the personalized weight coefficients of each core sample. The replica parameter update unit is used to execute step 205, calculate the average loss by weighting the training loss of the core samples, update the replica parameters of the master model by backpropagation, and does not update the MetaNet parameters. The second loss calculation unit is used to perform step 206, sample samples from the metadata dataset, and input the main model copy to calculate the metadata validation loss; MetaNet parameter update unit: used to perform step 207, verify the loss based on metadata samples, and update only the network parameters of MetaNet through backpropagation; The third loss calculation unit is used to execute step 208, input the core sample set into the main model, and calculate the core sample weighted loss of each core sample one by one. The second weight generation unit is used to perform step 209, input the weighted loss of the core samples into MetaNet, and output the personalized weight coefficients of each core sample. Main model parameter update unit: used to execute step 210, calculate the weighted average loss based on the core sample loss and weights, and update the main model parameters through backpropagation.
Citation Information
Patent Citations
Image annotation and model training method based on active learning
CN118135570A
Target detection online learning dynamic sample selection method and system, computer equipment and storage medium
CN120997492A