WO2025201138A1 - 模型训练方法、装置、设备、存储介质及计算机程序产品 - Google Patents

模型训练方法、装置、设备、存储介质及计算机程序产品

Info

Publication number
WO2025201138A1
WO2025201138A1 PCT/CN2025/083444 CN2025083444W WO2025201138A1 WO 2025201138 A1 WO2025201138 A1 WO 2025201138A1 CN 2025083444 W CN2025083444 W CN 2025083444W WO 2025201138 A1 WO2025201138 A1 WO 2025201138A1
Authority
WO
WIPO (PCT)
Prior art keywords
label
data
classification model
model
classification
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
PCT/CN2025/083444
Other languages
English (en)
French (fr)
Inventor
沈瑶
郝娅倩
胡晨光
冯俊兰
邓超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
Research Institute of China Mobile Communication Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
Research Institute of China Mobile Communication Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, Research Institute of China Mobile Communication Co Ltd filed Critical China Mobile Communications Group Co Ltd
Publication of WO2025201138A1 publication Critical patent/WO2025201138A1/zh
Pending legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Definitions

  • the present application relates to the field of artificial intelligence technology, and in particular to a model training method, apparatus, device, storage medium, and computer program product.
  • AI artificial intelligence
  • NL noisy labels
  • NL refers to incorrect or abnormal labels in training data. NL can cause models to learn incorrect patterns or regularities during training, reducing the accuracy of model predictions.
  • solutions in related technologies usually use robustness training to improve the model's tolerance to NL.
  • the goal of these solutions is only to reduce the impact of NL and prevent model overfitting. They do not care whether NL can be screened out, or even cannot detect NL, that is, the NL detection effect is poor.
  • the embodiments of the present application provide a model training method, device, equipment, storage medium and computer program product.
  • an embodiment of the present application provides a model training method, the method comprising:
  • the first loss function is used to update parameters of the first encoder network and parameters of the second encoder network until the loss value of the first loss function converges, thereby generating a noise label detection model.
  • an embodiment of the present application further provides a model training device, the device comprising:
  • a first acquiring unit configured to acquire target training data
  • a first determining unit configured to train a classification model based on the target training data to obtain simulation data related to the classification model
  • an embodiment of the present application further provides a model training device, comprising: a processor and a memory for storing a computer program that can be run on the processor;
  • NL non-labeled data
  • NL refers to the presence of incorrect or anomalous labels in training data. For example, a photo of a dog may be incorrectly labeled as a wolf. This can be due to human error, data collection issues, or other reasons. Therefore, NL has a significant impact on models and can lead to bias. This means that the model learns incorrect patterns or regularities during training, significantly reducing the accuracy of its predictions.
  • the existing solution is generally to conduct robustness training, and reduce the impact of NL on the model through various means to make the model more tolerant to NL.
  • the specific methods can be roughly divided into four categories: 1. Constructing a robust network architecture, such as adding a noise adaptive layer to learn the label transfer matrix, and co-teaching (a new deep learning paradigm used to resist label noise), that is, training two deep neural networks at the same time and cross-updating parameters to reduce model overfitting; 2. Regularization, including explicit regularization such as random inactivation (dropout) regularization, implicit regularization such as data augmentation, can improve the generalization ability of the model and reduce model overfitting; 3. Designing robust loss function.
  • Loss function such as Sub-center ArcFace
  • ArcFace is an improved ArcFace. By introducing additional sub-centers, it allows each category to have multiple sub-centers. By relaxing the intra-class constraints through the sub-centers, it can effectively improve the robustness of noisy labels.
  • ArcFace is a face recognition loss function based on angular cosine. It maximizes the angular cosine value of samples in the same category and infers the angular cosine values of samples in different categories to a fixed interval to achieve optimization in face recognition tasks; 4.
  • Sample selection such as co-teaching, only selects a certain proportion of samples with small loss values to update the network. These samples are usually clean label samples.
  • the meta-learning-based label noise monitoring method proposed in the related art uses a meta-network to screen noisy labels, where the input of the meta-network is the loss value and sample feature vector of the current classification network, and the output of the meta-network is the weight value for determining whether it is a noise label.
  • the meta-network parameters are updated with the help of a small number of clean sample sets.
  • the present application embodiment provides a model training method, which is applied to a model training device.
  • FIG1 is a flow chart of the model training method according to the present application embodiment. As shown in FIG1 , the model training method includes:
  • Step 101 Obtain target training data, and train a classification model based on the target training data to obtain simulation data related to the classification model.
  • the target training data is a training sample containing a certain proportion of noise labels
  • the simulation data related to the classification model includes one or more of the following parameters: the number of iterations of each iteration of the classification model; the accuracy of the classification model; and the output result of the classification layer of the classification model.
  • the model training device uses clean label data to generate data with noisy labels, namely the target training data.
  • obtaining target training data includes: obtaining original training data; the original training data includes clean label samples, and the clean label samples represent training samples that do not contain noise labels; performing label noise processing on the original training data to obtain the target training data; the target training data represents training samples containing noise labels.
  • a training sample containing a noise label i.e., the target training data
  • the corresponding noise label is added to the clean label sample data according to the set noise addition ratio to obtain the target training data containing the noise label.
  • the noise addition ratio can be understood as the proportion of the noise label in the target training data. It should be noted that the noise addition ratio can be pre-set according to actual needs. For example, the noise addition ratio can be set to 30%, which is not limited in the embodiment of the present application.
  • the type of noise labels contained in the target training data is symmetric noise, for example, random noise labels or intra-class noise labels.
  • the clean label sample data can be selected from public datasets for classification tasks, such as image recognition datasets or speech recognition datasets, which are not limited in this embodiment of the present application.
  • the classification model is trained using training samples containing noise labels, namely target training data, to obtain the training features of the noise label detection model, namely simulated data related to the classification model.
  • the model training device can use the simulated data related to the classification model as prior knowledge, combined with the label type sequence, and input it into the deep learning network to realize the training of the noise label detection model.
  • the classification model is trained based on the target training data to obtain simulation data related to the classification model, including: extracting features from the target training data to obtain a feature vector of the target training data; based on the feature vector of the target training data, using a second loss function to update the parameters of the classification model until the loss value of the second loss function converges to obtain simulation data related to the classification model; wherein the simulation data related to the classification model includes one or more of the following parameters: the number of iterations of each iteration of the classification model; the accuracy of the classification model; and the output result of the classification layer of the classification model.
  • the error value is determined based on the training results, the training samples containing noise labels (i.e., the feature vectors of the target training data) and the preset loss function (i.e., the second loss function).
  • the classification model is determined to converge, that is, the loss value of the second loss function converges;
  • the model parameters in the classification model are adjusted or updated until the error value reaches the preset threshold range, and the classification model is determined to converge, that is, the loss value of the second loss function converges, thereby obtaining simulation data related to the classification model.
  • the classification layer output result of the classification model may be a classification result obtained by classifying the feature vector of the target training data through a fully connected layer, wherein the fully connected layer is the classification layer, specifically the softmax layer.
  • the network framework of the classification model is a model with classification function, such as the residual neural network (ResNet)34, the more mainstream deep neural network model for voiceprint recognition (ECAPA-TDNN, Emphasized Channel Attention Propagation and Aggregation-Time Delay Neural Network), etc., are all included in the scope of protection of this application.
  • ResNet residual neural network
  • ECAPA-TDNN Emphasized Channel Attention Propagation
  • Aggregation-Time Delay Neural Network etc.
  • Step 102 Obtain a tag type sequence.
  • obtaining the label type sequence includes: determining the label type of the target training data; the target training data is obtained by performing label noise processing on the original training data, and the original training data includes clean label samples; performing sequence conversion on the label type of the target training data to obtain the label type sequence.
  • the label type of the target training data includes one of the following: noise label type; clean label type; wherein, a clean label means that the label of the sample is correct.
  • the noise label type can be represented by 1
  • the clean label type can be represented by 0
  • the label type of the target training data can be represented by 1.
  • the value of can be expressed by the following formula (1):
  • label type sequence is a sequence with a value of 0 or 1.
  • the label type of the target training data can be calculated by the following formula (2): Perform sequence conversion to obtain label type sequence
  • the tag type sequence The length is E, e represents the current training round number (epoch), m represents the number of iterations of the current iteration, i represents the i-th sample, and the label type sequence It includes multiple elements, express The e-th element of the sequence is simply understood as the clean label sample The elements of the sequence are all 0, and the noise label samples If the previous element in the sequence If it is 1, all subsequent elements are 1, otherwise it is determined by the sequence function R The sequence is either 0 or 1.
  • the probability of the sequence function R is determined by the accuracy (Acc) of the classification model of the current iteration, where the value of the sequence function R can be 0 or 1.
  • the probability of the sequence function R can be calculated by the following formulas (3) and (4):
  • Step 103 Determine a first loss function based on the label type sequence and the simulated data related to the classification model.
  • the model training device inputs the label type sequence and simulated data related to the classification model into a deep learning network (wherein the deep learning network includes a first encoder network and a second encoder network) to obtain corresponding feature information, namely label features and data features, and then determines a first loss function based on the obtained label features and data features.
  • a deep learning network includes a first encoder network and a second encoder network
  • determining the first loss function based on the label type sequence and the simulated data related to the classification model includes: inputting the label type sequence into the first encoder network to obtain corresponding label features; inputting the simulated data related to the classification model into the second encoder network to obtain corresponding data features; and determining the first loss function based on the label features and the data features.
  • the first encoder network can be a label encoder network
  • the second encoder network can be a feature encoder network.
  • the model training device first converts the label type of each target training sample to obtain a label type sequence, and then uses the label type sequence as input data to input into the label encoder network, and performs feature extraction (i.e., feature encoding) on the label type sequence through the encoding layer of the label encoder network to obtain label features corresponding to the label type sequence; similarly, after obtaining simulation data related to the classification model, such as the number of iterations of each iteration of the classification model, the accuracy of the classification model, and the output result of the classification layer of the classification model, the model training device first splices the number of iterations of each iteration of the classification model, the accuracy of the classification model, and the output result of the classification layer of the classification model to obtain spliced simulation data, and then uses the spliced simulation
  • the simulation data related to the classification model is input into the second encoder network to obtain corresponding data features, including: when the simulation data related to the classification model includes the number of iterations of each iteration of the classification model, the number of iterations of each iteration of the classification model is positionally encoded to obtain corresponding position features; the position features, the accuracy of the classification model and the output result of the classification layer of the classification model are spliced to obtain spliced simulation data; and the spliced simulation data is input into the second encoder network to obtain corresponding data features.
  • first encoder network and the second encoder network can be a deep learning model (transformer model) based on the attention mechanism, or a recurrent neural network (RNN), which is not limited in this embodiment of the present application.
  • the output of the first encoder network is associated with the historical label
  • the output of the second encoder network is associated with the current data features and the historical data features.
  • determining the first loss function based on the label features and the data features includes: inputting the label features and the data features into a joint network to obtain a first prediction result output by the joint network; the first prediction result represents a fusion feature of the label features and the data features; and determining the first loss function based on the first prediction result and the label type sequence.
  • the joint network is used to perform feature fusion on the label features and data features.
  • the model training device fuses these two features through the joint network to obtain a fused feature.
  • the fused feature is input into an activation function, such as a Sigmoid function, to obtain a correct probability calculated by using the activation function for the fused feature.
  • the correct probability is then combined with the label type sequence to determine a corresponding loss function, namely the first loss function.
  • Step 104 Use the first loss function to update the parameters of the first encoder network and the parameters of the second encoder network until the loss value of the first loss function converges, thereby generating a noise label detection model.
  • the data used by the noise label detection model in modeling is the output result of the classification layer of the classification model, the number of iterations of each iteration of the classification model and the accuracy of the classification model, rather than the classification task data itself. It can be seen that the noise label detection model learns the common characteristics of noise labels in the classification model training process through a deep learning network, and does not rely on a single threshold. Therefore, the solution of obtaining a noise label detection model using the model training method of this application has cross-task, cross-model and cross-data universality.
  • real data containing noise labels can be used to train the classification model, and noise label detection can be performed during the classification model training process. That is, the trained noise label detection model can be used for streaming detection to screen out noise label samples.
  • the classification task data includes image classification data, audio classification data, text classification data, etc., which are not limited here.
  • the encoder of the noise label detection model can adopt a network framework such as a transformer, RNN, or a long short-term memory unit (LSTM) model.
  • the decoder of the noise label detection model can adopt a transducer, streaming decoding, and the output result depends on historical information, fully utilizing the information throughout the training process and reducing dependence on thresholds.
  • the classification task data to be detected containing noise labels is input into the classification model.
  • the simulation data related to the classification model generated in each training round (epoch), such as the number of iterations of the classification model, the accuracy of the classification model, and the output result of the classification layer (softmax layer) of the classification model, are used as the input data of the noise label detection model to obtain the probability of the category label sample being judged as a noise label in each epoch, that is, the second prediction result.
  • the probability of the noise label of each epoch also depends on the probability of the noise label of the historical epoch.
  • the noise label detection method of streaming decoding is adopted, considering the characteristics of multiple nodes and multiple dimensions, that is, the probability of the noise labels of all historical epochs, and making full use of the information in the entire training process to improve the accuracy of noise label detection.
  • detecting a noise label from the classification task data to be detected includes: comparing the second prediction result with a probability threshold to obtain a comparison result; when the comparison result indicates that the second prediction result is greater than the probability threshold, determining that the category label sample corresponding to the second prediction result greater than the probability threshold is a noise label.
  • the noise label may be judged as a clean label in the subsequent epoch and the model is updated. In actual tests, it can be found that the range of variation of the loss value of the noise label in different epochs may be very large. In some epochs, the loss value can even be comparable to that of the clean label (i.e., the loss value is very small). If the noise label is not screened out in time, the loss of the noise label sample will fluctuate to a smaller value, and it will be treated as a clean label to update the model parameters, causing the model to overfit the noise label, making it more difficult to distinguish it from the noise label, and falling into a vicious cycle.
  • the probability threshold can be pre-set according to actual needs, such as setting the probability threshold to 0.8, which is not limited in the embodiment of the present application.
  • the probability threshold is 0.8
  • the category label sample can be determined to be a noise label sample. Then, the noise label sample is screened out, and in subsequent training rounds, the noise label sample will no longer be used to update the model parameters, thereby achieving the purpose of real-time screening of noise labels.
  • FIG2 is a second flow chart of the model training method of the present application embodiment. As shown in FIG2 , the model training method includes:
  • Step 201 Obtain target training data.
  • obtaining target training data includes: obtaining original training data; the original training data includes clean label samples, and the clean label samples represent training samples that do not contain noise labels; and performing label noise processing on the original training data to obtain the target training data.
  • Step 202 Train the classification model based on the target training data to obtain simulation data related to the classification model.
  • the classification model is trained based on the target training data to obtain simulation data related to the classification model, including: extracting features from the target training data to obtain a feature vector of the target training data; based on the feature vector of the target training data, updating the parameters of the classification model using a second loss function until the loss value of the second loss function converges to obtain simulation data related to the classification model; wherein the simulation data related to the classification model includes one or more of the following parameters: the number of iterations of each iteration of the classification model; the accuracy of the classification model; and the output result of the classification layer of the classification model.
  • Step 203 Obtain a tag type sequence.
  • obtaining the label type sequence includes: determining the label type of the target training data; the target training data is obtained by performing label noise processing on the original training data, and the original training data includes clean label samples; performing sequence conversion on the label type of the target training data to obtain the label type sequence.
  • Step 205 Input the simulated data related to the classification model into the second encoder network to obtain corresponding data features.
  • Step 206 Input the label features and the data features into the joint network to obtain a first prediction result output by the joint network.
  • the first prediction result represents a fusion feature of the label feature and the data feature.
  • Step 208 Use the first loss function to update the parameters of the first encoder network and the parameters of the second encoder network until the loss value of the first loss function converges, thereby generating a noise label detection model.
  • FIG3 is a flow chart of the model training method according to the present application. As shown in FIG3 , the model training method includes:
  • Step 301 Obtain target training data.
  • the target training data is used to characterize training samples containing noise labels.
  • obtaining target training data includes: obtaining original training data; the original training data includes clean label samples, and the clean label samples represent training samples that do not contain noise labels; and performing label noise processing on the original training data to obtain the target training data.
  • Step 302 Train the classification model based on the target training data to obtain simulation data related to the classification model.
  • the classification model is trained based on the target training data to obtain simulation data related to the classification model, including: extracting features from the target training data to obtain a feature vector of the target training data; based on the feature vector of the target training data, updating the parameters of the classification model using a second loss function until the loss value of the second loss function converges to obtain simulation data related to the classification model; wherein the simulation data related to the classification model includes one or more of the following parameters: the number of iterations of each iteration of the classification model; the accuracy of the classification model; and the output result of the classification layer of the classification model.
  • Step 303 Obtain a tag type sequence.
  • obtaining the label type sequence includes: determining the label type of the target training data; the target training data is obtained by performing label noise processing on the original training data, and the original training data includes clean label samples; performing sequence conversion on the label type of the target training data to obtain the label type sequence.
  • Step 304 Input the label type sequence into the first encoder network to obtain corresponding label features.
  • the first encoder network may be a label encoder network
  • the first encoder network may be a transformer model, or may be an RNN, which is not limited here.
  • Step 305 Input the simulated data related to the classification model into the second encoder network to obtain corresponding data features.
  • the second encoder network may be a feature encoder network
  • the second encoder network may be a transformer model, or may be an RNN, which is not limited here.
  • the analog data related to the classification model is input into a second encoder network to obtain corresponding data features, including: when the analog data related to the classification model includes the number of iterations of each iteration of the classification model, position encoding the number of iterations of each iteration of the classification model to obtain corresponding position features; splicing the position features, the accuracy of the classification model and the classification layer output result of the classification model to obtain spliced analog data; and inputting the spliced analog data into the second encoder network to obtain corresponding data features.
  • Step 306 Input the label features and the data features into the joint network to obtain a first prediction result output by the joint network.
  • the first prediction result represents a fusion feature of the label feature and the data feature.
  • Step 307 Determine a first loss function based on the first prediction result and the label type sequence.
  • Step 308 Use the first loss function to update the parameters of the first encoder network and the parameters of the second encoder network until the loss value of the first loss function converges, thereby generating a noise label detection model.
  • Step 309 Acquire the classification task data to be detected, and train the classification model based on the classification task data to be detected, and generate simulation data related to the classification model corresponding to each training round.
  • the classification task data to be detected includes one or more category label samples, and the classification task data includes image classification data, audio classification data, text classification data, etc., which are not limited here.
  • Step 310 Input the simulation data related to the classification model corresponding to each training round into the noise label detection model to obtain a second prediction result, and based on the second prediction result, detect the noise label from the classification task data to be detected.
  • the second prediction result represents the probability that each category label sample is determined to be a noise label in the corresponding training round.
  • detecting a noise label from the classification task data to be detected includes: comparing the second prediction result with a probability threshold to obtain a comparison result; when the comparison result indicates that the second prediction result is greater than the probability threshold, determining that the category label sample corresponding to the second prediction result greater than the probability threshold is a noise label.
  • the noise label sample that is, the target training data itself
  • a noise label detection model for noise label detection is trained separately.
  • the input data or loss value of the classification network is not used as training data.
  • the classification model is trained based on the training samples containing noise labels.
  • the simulated data related to the classification model is used as training data. In this way, the characteristics of the noise label samples and the clean label samples output during the classification model training process can be learned, the robustness of the noise label detection model is improved, and the detection effect of the noise label is greatly improved.
  • the processor 82 is configured to:
  • the simulation data related to the classification model includes the number of iterations of each iteration of the classification model
  • the number of iterations of each iteration of the classification model is positionally encoded to obtain corresponding position features; the position features, the accuracy of the classification model and the classification layer output results of the classification model are spliced to obtain spliced simulation data; the spliced simulation data is input into the second encoder network to obtain corresponding data features.
  • the steps of the model training method disclosed in the embodiment of the present application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a storage medium, which is located in the memory 83.
  • the processor 82 reads the information in the memory 83 and completes the steps of the above-mentioned model training method in combination with its hardware.
  • the memory 83 of the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories.
  • the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory.
  • the volatile memory can be a random access memory (RAM), which is used as an external cache.
  • the present application also provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, such as a memory 83 storing a computer program.
  • the computer program can be executed by the processor 82 in the model training device 80 to complete the steps of the model training method described in the embodiment of the present application.
  • the computer-readable storage medium can be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface storage, optical disk, or CD-ROM.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Health & Medical Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Image Analysis (AREA)

Abstract

本申请公开了一种模型训练方法、装置、设备、存储介质及计算机程序产品。其中,该模型训练方法包括:获取目标训练数据,并基于所述目标训练数据对分类模型进行训练,得到所述分类模型相关的模拟数据;获取标签类型序列;基于所述标签类型序列和所述分类模型相关的模拟数据,确定第一损失函数;利用所述第一损失函数更新第一编码器网络的参数和第二编码器网络的参数,直至所述第一损失函数的损失值收敛,生成噪声标签检测模型。

Description

模型训练方法、装置、设备、存储介质及计算机程序产品
相关申请的交叉引用
本申请基于申请号为202410346106.0、申请日为2024年03月25日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此以全文引入的方式引入本申请。
技术领域
本申请涉及人工智能技术领域,尤其涉及一种模型训练方法、装置、设备、存储介质及计算机程序产品。
背景技术
人工智能的成功很大程度上依赖于大规模的、可信标注的训练数据,因此,高质量的训练数据对模型训练至关重要,但实际应用中噪声标签(NL,Noisy Label)不可避免,其中,NL是指训练数据中存在错误或异常的标注标签。而NL可能会导致模型在训练过程中学习到错误的模式或规律,使得模型预测的准确率下降。
为了减少NL对模型的影响,相关技术中的方案通常是通过鲁棒性训练来提高模型对NL的耐受性,但这些方案的目标仅仅是为了减小NL的影响,防止模型过拟合,其并不关心是否能筛选出NL,甚至无法做到检测出NL,即NL检测效果较差。
发明内容
为解决相关技术中存在的技术问题,本申请实施例提供一种模型训练方法、装置、设备、存储介质及计算机程序产品。
为达到上述目的,本申请实施例的技术方案是这样实现的:
第一方面,本申请实施例提供了一种模型训练方法,所述方法包括:
获取目标训练数据,并基于所述目标训练数据对分类模型进行训练,得到所述分类模型相关的模拟数据;
获取标签类型序列;
基于所述标签类型序列和所述分类模型相关的模拟数据,确定第一损失函数;
利用所述第一损失函数更新第一编码器网络的参数和第二编码器网络的参数,直至所述第一损失函数的损失值收敛,生成噪声标签检测模型。
第二方面,本申请实施例还提供了一种模型训练装置,所述装置包括:
第一获取单元,配置为获取目标训练数据;
第一确定单元,配置为基于所述目标训练数据对分类模型进行训练,得到所述分类模型相关的模拟数据;
第二获取单元,配置为获取标签类型序列;
第二确定单元,配置为基于所述标签类型序列和所述分类模型相关的模拟数据,确定第一损失函数;
第一生成单元,配置为利用所述第一损失函数更新第一编码器网络的参数和第二编码器网络的参数,直至所述第一损失函数的损失值收敛,生成噪声标签检测模型。
第三方面,本申请实施例还提供了一种模型训练设备,包括:处理器和用于存储能够在所述处理器上运行的计算机程序的存储器;
其中,所述处理器用于运行所述计算机程序时,执行本申请实施例所述的模型训练方法的步骤。
第四方面,本申请实施例还提供了一种存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现本申请实施例所述的模型训练方法的步骤。
第五方面,本申请实施例还提供了一种计算机程序产品,包括计算机程序,所述计算机程序在被处理器执行时实现本申请实施例所述的模型训练方法的步骤。
本申请实施例提供的模型训练方法、装置、设备、存储介质及计算机程序产品,获取目标训练数据,并基于所述目标训练数据对分类模型进行训练,得到所述分类模型相关的模拟数据;获取标签类型序列;基于所述标签类型序列和所述分类模型相关的模拟数据,确定第一损失函数;利用所述第一损失函数更新第一编码器网络的参数和第二编码器网络的参数,直至所述第一损失函数的损失值收敛,生成噪声标签检测模型。采用本申请实施例的模型训练方法,通过深度学习网络对噪声标签样本即目标训练数据本身进行建模,单独训练一个用于噪声标签检测的噪声标签检测(NLD,Noisy Label Detection)模型,且在噪声标签检测模型的训练过程中,并非采用分类网络的输入数据或损失值作为训练数据,而是采用基于含有噪声标签的训练样本对分类模型进行训练得到的分类模型相关的模拟数据作为训练数据,如此,能够学习到噪声标签样本、干净标签(CL,Clean Label)样本在分类模型训练过程中输出的特性,提高噪声标签检测模型的鲁棒性,从而使得噪声标签的检测效果大大提升。
附图说明
图1为本申请实施例的模型训练方法的流程示意图一;
图2为本申请实施例的模型训练方法的流程示意图二;
图3为本申请实施例的模型训练方法的流程示意图三;
图4为本申请实施例的数据准备阶段的流程示意图;
图5为本申请实施例的噪声标签检测模型训练阶段的流程示意图;
图6为本申请实施例的噪声标签检测模型实际应用阶段的流程示意图;
图7为本申请实施例的模型训练装置的组成结构示意图;
图8为本申请实施例的模型训练设备的硬件组成结构示意图。
具体实施方式
下面结合附图及实施例对本申请再作进一步详细的说明。
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中在本申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请。
人工智能的成功很大程度上依赖于大规模的、可信标注的训练数据,因此,高质量的训练数据对模型训练至关重要,然而,实际应用中NL不可避免。其中,NL是指在训练数据中存在错误或异常的标注标签,例如一张狗的照片被错误标注为了狼,这可能是由于人为标注错误、数据收集问题或其他原因导致的。可见,NL对模型有重要影响,可能会导致模型产生偏倚,即模型在训练过程中学习到错误的模式或规律,使得模型在预测时准确率大幅下降。
针对NL,现有的解决方案一般是进行鲁棒性训练,通过各种方式减少NL对模型的影响,使模型对NL更耐受,具体方式大致可分为四类:1、构建鲁棒的网络构架,比如增加噪声自适应层学习标签转移矩阵,又比如协同指导(co-teaching,一种新的深度学习范式,用于抵抗标签的噪声),也就是说,同时训练两个深度神经网络,并交叉更新参数以减少模型过拟合;2、正则化,包括显式正则化比如随机失活(dropout)正则化,隐式正则化比如数据增强,都能提升模型泛化能力,减少模型的过拟合;3、设计鲁棒的损失函数,比如子中心ArcFace(Sub-center ArcFace),为一种改进的ArcFace,通过引入额外的子中心,允许每个类别有多个子中心,通过子中心放宽类内约束,能有效提升噪声标签的鲁棒性,其中,ArcFace是一种基于角度余弦的人脸识别损失函数,通过最大化同一类别样本的角度余弦值,同时将不同类别样本的角度余弦值推理一个固定的间隔,来实现人脸识别任务中的优化;4、样本选择,比如co-teaching只选择一定比例小损失值的样本更新网络,这部分样本通常为干净标签样本。
例如,相关技术中提出的基于元学习的标签噪声监测方法,是利用元网络来筛选噪声标签,其中,元网络的输入为当前分类网络的损失值和样本特征向量,元网络的输出为判定是否是噪声标签的权重值,而元网络参数是借助一个数量很少的干净样本集进行更新。
由此可见,相关技术中的通过鲁棒性训练提高模型对NL的耐受性的方案,并非直接检测NL,也即并非对NL建模,故NL检测能力不够强。这是因为这些方案的目标仅仅是为了减小NL的影响,防止模型过拟合,并不关心是否能筛选出NL,甚至无法做到检测出NL(比如正则化方式),即NL检测效果较差。
基于此,本申请实施例提出一种模型训练方法,在本申请的各种实施例中,通过深度学习网络对噪声标签样本即目标训练数据本身进行建模,单独训练一个用于噪声标签检测的噪声标签检测模型,且在噪声标签检测模型的训练过程中,并非采用分类网络的输入数据或损失值作为训练数据,而是采用基于含有噪声标签的训练样本对分类模型进行训练得到的分类模型相关的模拟数据作为训练数据,如此,能够学习到噪声标签样本、干净标签样本在分类模型训练过程中输出的特性,提高噪声标签检测模型的鲁棒性,从而使得噪声标签的检测效果大大提升。
本申请实施例提供了一种模型训练方法,该方法应用于模型训练装置,图1为本申请实施例的模型训练方法的流程示意图一;如图1所示,该模型训练方法包括:
步骤101:获取目标训练数据,并基于所述目标训练数据对分类模型进行训练,得到所述分类模型相关的模拟数据。
在本申请实施例中,目标训练数据为含有一定比例噪声标签的训练样本,分类模型相关的模拟数据包括以下一个或多个参数:所述分类模型每次迭代的迭代次数;所述分类模型的准确率;所述分类模型的分类层输出结果。
实际应用时,模型训练装置使用干净标签数据生成含有噪声标签的数据,即目标训练数据。
基于此,在一实施例中,所述获取目标训练数据,包括:获取原始训练数据;所述原始训练数据包括干净标签样本,所述干净标签样本表征未含有噪声标签的训练样本;对所述原始训练数据进行标签加噪处理,得到所述目标训练数据;所述目标训练数据表征含有噪声标签的训练样本。
这里,通过在干净标签样本数据中进行标签加噪,可以得到含有噪声标签的训练样本,即目标训练数据。具体的,在干净标签样本数据中按照设定的加噪比例添加相应的噪声标签,得到含有噪声标签的目标训练数据。其中,加噪比例可以理解为噪声标签在目标训练数据中所占的比例。需要说明的是,加噪比例可根据实际需要进行预先设置,例如,可以设置加噪比例为30%,本申请实施例在此不做限定。
这里,目标训练数据中含有的噪声标签的种类为对称噪声,例如,可以为随机噪声标签,也可以为类内噪声标签。其中,干净标签样本数据可以选用一些分类任务的公开数据集,比如图像识别的数据集,也可以是语音识别的数据集,本申请实施例在此不做限定。
实际应用时,使用含有噪声标签的训练样本即目标训练数据,对分类模型进行训练,可以得到噪声标签检测模型的训练特征,即分类模型相关的模拟数据,这样,模型训练装置可以将分类模型相关的模拟数据作为先验知识,结合标签类型序列输入至深度学习网络中,实现噪声标签检测模型的训练。
基于此,在一实施例中,所述基于所述目标训练数据对分类模型进行训练,得到所述分类模型相关的模拟数据,包括:对所述目标训练数据进行特征提取,得到所述目标训练数据的特征向量;基于所述目标训练数据的特征向量,利用第二损失函数更新所述分类模型的参数,直至所述第二损失函数的损失值收敛,得到所述分类模型相关的模拟数据;其中,所述分类模型相关的模拟数据包括以下一个或多个参数:所述分类模型每次迭代的迭代次数;所述分类模型的准确率;所述分类模型的分类层输出结果。
这里,分类模型可以包括输入层、编码层和全连接层,其中,模型训练装置将目标训练数据作为输入数据通过输入层输入至分类模型,然后通过编码层对目标训练数据进行特征提取,即通过对目标训练数据进行特征编码得到目标训练数据的特征向量,之后将目标训练数据的特征向量通过全连接层进行分类处理,最终得到分类结果,该分类结果是对上述含有噪声标签的训练样本进行分类得到的分类结果。
这里,根据训练结果、含有噪声标签的训练样本(即目标训练数据的特征向量)和预设损失函数(即第二损失函数)确定误差值,当所述误差值在预设阈值范围内时,确定分类模型收敛,也即第二损失函数的损失值收敛;当所述误差值未在预设阈值范围内时,则调整即更新分类模型中的模型参数,直至所述误差值达到所述预设阈值范围为止,确定分类模型收敛,也即第二损失函数的损失值收敛,从而得到分类模型相关的模拟数据。
在本申请实施例中,所述分类模型的分类层输出结果,可以为将目标训练数据的特征向量通过全连接层进行分类处理得到的分类结果,其中,全连接层即为分类层,具体为softmax层。
需要说明的是,分类模型的网络框架可以有多种选择,只要是具有分类功能的模型即可,比如残差神经网络(ResNet,Residual Neural Network)34、用于声纹识别的较主流的深度神经网络模型(ECAPA-TDNN,Emphasized Channel Attention Propagation and Aggregation-Time Delay Neural Network)等,都包括在本申请的保护范围之内。
步骤102:获取标签类型序列。
实际应用时,模型训练装置通过对每个目标训练样本的标签类型进行转换,可以得到标签类型序列。
基于此,在一实施例中,所述获取标签类型序列,包括:确定所述目标训练数据的标签类型;所述目标训练数据是通过对原始训练数据进行标签加噪处理得到的,所述原始训练数据包括干净标签样本;对所述目标训练数据的标签类型进行序列转换,得到所述标签类型序列。
这里,所述目标训练数据的标签类型包括以下之一:噪声标签类型;干净标签类型;其中,干净标签是指样本的标注标签正确无误。实际应用中,噪声标签类型可以用1表示,干净标签类型可以用0表示,目标训练数据的标签类型的取值可通过以下公式(1)表示:
其中,i表示目标训练样本的编号;表示样本的标注标签;yi表示样本的真实分类标签。
需要说明的是,标签类型序列是值为0或1的序列,可通过以下公式(2)对目标训练数据的标签类型进行序列转换,得到标签类型序列
其中,标签类型序列的长度为E,e表示当前训练轮数(epoch),m表示当前迭代的迭代次数,i表示第i个样本,标签类型序列中包括多个元素,表示序列的第e个元素,简单理解就是,干净标签样本的序列的元素全为0,噪声标签样本的序列中如果前一个元素为1,之后的元素都为1,否则通过序列函数R判定序列是0或者1。
这里,序列函数R的取值的概率由当前迭代的分类模型的准确率(Acc)确定,其中,序列函数R的取值可以是0或者1,序列函数R的取值的概率可通过以下公式(3)和(4)计算得到:
其中,表示对第i个样本进行第m次迭代下,序列函数R的取值为1的概率;表示对第i个样本进行第m次迭代下,序列函数R的取值为0的概率;表示对第i个样本进行第m次迭代下对应的分类模型的准确率;m表示当前迭代的迭代次数。
步骤103:基于所述标签类型序列和所述分类模型相关的模拟数据,确定第一损失函数。
实际应用时,模型训练装置通过将标签类型序列和分类模型相关的模拟数据分别输入至深度学习网络(其中,深度学习网络包括第一编码器网络和第二编码器网络)中,得到相应的特征信息,即标签特征和数据特征,从而根据得到的标签特征和数据特征确定第一损失函数。如此,考虑到噪声标签的特征是多维度的,甚至部分维度特征是隐式的特点,利用深度学习判定是否是噪声标签,能更好的挖掘噪声标签的隐式特征。
基于此,在一实施例中,所述基于所述标签类型序列和所述分类模型相关的模拟数据,确定第一损失函数,包括:将所述标签类型序列输入至所述第一编码器网络,得到相应的标签特征;将所述分类模型相关的模拟数据输入至所述第二编码器网络,得到相应的数据特征;基于所述标签特征和所述数据特征,确定所述第一损失函数。
在本申请实施例中,所述第一编码器网络可以为标签编码器网络,所述第二编码器网络可以为特征编码器网络。具体来说,模型训练装置在得到每个目标训练样本的标签类型之后,先对每个目标训练样本的标签类型进行转换,得到标签类型序列,然后将标签类型序列作为输入数据,输入至标签编码器网络中,通过标签编码器网络的编码层对标签类型序列进行特征提取(即特征编码),得到标签类型序列对应的标签特征;同样的,模型训练装置在得到分类模型相关的模拟数据,例如分类模型每次迭代的迭代次数、分类模型的准确率、分类模型的分类层输出结果之后,先将分类模型每次迭代的迭代次数、分类模型的准确率、分类模型的分类层输出结果进行拼接,得到拼接后的模拟数据,然后将拼接后的模拟数据作为输入数据,输入至特征编码器网络中,通过特征编码器网络的编码层对该拼接后的模拟数据进行特征提取,得到该拼接后的模拟数据对应的数据特征。
实际应用时,对于特征编码器网络的输入数据中的分类模型每次迭代的迭代次数来说,通常还需要对分类模型每次迭代的迭代次数进行位置编码,然后对通过位置编码得到的位置特征,与分类模型的准确率和分类模型的分类层输出结果进行融合,即拼接,得到拼接后的模拟数据。
基于此,在一实施例中,所述将所述分类模型相关的模拟数据输入至所述第二编码器网络,得到相应的数据特征,包括:在所述分类模型相关的模拟数据包括所述分类模型每次迭代的迭代次数的情况下,对所述分类模型每次迭代的迭代次数进行位置编码,得到相应的位置特征;将所述位置特征、所述分类模型的准确率和所述分类模型的分类层输出结果进行拼接,得到拼接后的模拟数据;将所述拼接后的模拟数据输入至所述第二编码器网络,得到相应的数据特征。
需要说明的是,第一编码器网络、第二编码器网络可以为基于注意力机制的深度学习模型(transformer模型),还可以为循环神经网络(RNN,Recurrent Neural Network),本申请实施例在此不做限定。这里,第一编码器网络的输出与历史标签存在关联,第二编码器网络的输出与当前数据特征和历史数据特征存在关联。
在一实施例中,所述基于所述标签特征和所述数据特征,确定所述第一损失函数,包括:将所述标签特征和所述数据特征输入至联合网络,得到所述联合网络输出的第一预测结果;所述第一预测结果表征所述标签特征和所述数据特征的融合特征;基于所述第一预测结果和所述标签类型序列,确定所述第一损失函数。
这里,所述联合网络用于对标签特征和数据特征进行特征融合。实际应用时,模型训练装置在得到第一编码器网络的输出结果和第二编码器网络的输出结果,即标签特征和数据特征之后,通过联合网络对这两种特征进行融合,得到融合特征,并将该融合特征输入至激活函数,例如Sigmoid函数,得到利用激活函数对融合特征进行计算得到的正确概率,并结合该正确概率和标签类型序列确定相应的损失函数,即第一损失函数。
步骤104:利用所述第一损失函数更新第一编码器网络的参数和第二编码器网络的参数,直至所述第一损失函数的损失值收敛,生成噪声标签检测模型。
这里,噪声标签检测模型的网络框架可以采用transformer-transducer结构或者循环神经网络转换器(RNN-T,Recurrent Neural Network-Transducer)结构,本申请实施例在此不做限定。
实际应用时,噪声标签检测模型在建模时所用到的数据是分类模型的分类层输出结果,以及分类模型每次迭代的迭代次数和分类模型的准确率,而并非是分类任务数据本身,可见,噪声标签检测模型是通过深度学习网络学习到噪声标签在分类模型训练过程中的通用特征,不依赖单一阈值,故利用本申请的模型训练方法得到噪声标签检测模型的方案具有跨任务、跨模型、跨数据的通用性。
在实际应用阶段,可以使用真实的包含噪声标签的数据训练分类模型,在分类模型训练过程中进行噪声标签检测,即利用已经训练好的噪声标签检测模型进行流式检测,以筛除出噪声标签样本。
基于此,在一实施例中,在所述生成噪声标签检测模型之后,所述方法还包括:获取待检测的分类任务数据;所述待检测的分类任务数据包括一个或多个类别标签样本;基于所述待检测的分类任务数据对所述分类模型进行训练,生成各训练轮次对应的分类模型相关的模拟数据;将所述各训练轮次对应的分类模型相关的模拟数据输入至所述噪声标签检测模型,得到第二预测结果;所述第二预测结果表征各类别标签样本在相应的训练轮次下被判定为噪声标签的概率;基于所述第二预测结果,从所述待检测的分类任务数据中检测出噪声标签。
在本申请实施例中,分类任务数据包括图像分类数据、音频分类数据、文本分类数据等,在此不做限定。噪声标签检测模型的编码器可采用transformer、RNN或者长短期记忆单元(LSTM,Long Short Term Memory)模型等网络框架,噪声标签检测模型的解码器可采用transducer,流式解码,输出结果依赖历史信息,充分利用整个训练过程中的信息,减少对阈值的依赖。具体的,将包含有噪声标签的待检测的分类任务数据输入至分类模型,在分类模型的训练过程中,每个训练轮次(epoch)生成的分类模型相关的模拟数据,例如分类模型每次迭代的迭代次数、分类模型的准确率、分类模型的分类层(softmax层)的输出结果,作为噪声标签检测模型的输入数据,得到类别标签样本在每个epoch下被判定为噪声标签的概率,即第二预测结果,并且,每个epoch的噪声标签的概率还依赖于历史epoch的噪声标签的概率,这样,采用流式解码的噪声标签检测方法,考虑多节点、多维度的特征,即所有历史epoch的噪声标签的概率,充分利用整个训练过程中的信息,提高噪声标签检测的精度。
在一实施例中,所述基于所述第二预测结果,从所述待检测的分类任务数据中检测出噪声标签,包括:将所述第二预测结果与概率阈值进行比较,得到比较结果;在所述比较结果表征所述第二预测结果大于所述概率阈值的情况下,确定大于所述概率阈值的第二预测结果所对应的类别标签样本为噪声标签。
由于噪声标签在后续epoch还有可能被判定为干净标签并更新模型。实际测试中可以发现,噪声标签在不同epoch损失(loss)值的变化范围可能会很大,在部分epoch甚至损失值能跟干净标签相当(即损失值很小)。如果不及时筛除噪声标签,噪声标签样本就会出现损失波动到较小值,被当成干净标签而更新模型参数,导致模型对噪声标签过拟合,从而更难再将其与噪声标签区分开,陷入恶性循环。因此,尽早筛除噪声标签,并防止其更新模型参数极为重要。而相关技术中未能尽早筛除可能的噪声标签。为此,在本申请的模型训练方法中,当类别标签样本在某一个训练轮次中一旦被判定为噪声标签,则立即将该噪声标签筛除,即将该噪声标签从更新数据集移到筛除数据集中,之后训练过程中只使用更新数据集中的数据更新模型参数,而筛除数据集中的数据不参与模型参数更新的过程。
基于此,在一实施例中,所述方法还包括:确定类别标签样本在目标训练轮次下被判定为噪声标签的概率是否大于概率阈值;在所述类别标签样本在目标训练轮次下被判定为噪声标签的概率大于所述概率阈值的情况下,筛除在所述目标训练轮次下训练的所述类别标签样本。
这里,概率阈值可根据实际需要进行预先设置,比如设置概率阈值为0.8,本申请实施例在此不做限定。
举例来说,假设概率阈值为0.8,当判定出类别标签样本在某个训练轮次,即目标训练轮次下被判定为噪声标签的概率大于0.8,则可确定该类别标签样本为噪声标签样本,那么,筛除该噪声标签样本,且在后续的训练轮次中,该噪声标签样本将不再用于更新模型参数,从而达到实时筛除噪声标签的目的。
本申请实施例还提供了另一种模型训练方法,该方法应用于模型训练装置,图2为本申请实施例的模型训练方法的流程示意图二;如图2所示,该模型训练方法包括:
步骤201:获取目标训练数据。
在本申请实施例中,所述目标训练数据用于表征含有噪声标签的训练样本。
在一实施例中,所述获取目标训练数据,包括:获取原始训练数据;所述原始训练数据包括干净标签样本,所述干净标签样本表征未含有噪声标签的训练样本;对所述原始训练数据进行标签加噪处理,得到所述目标训练数据。
步骤202:基于所述目标训练数据对分类模型进行训练,得到所述分类模型相关的模拟数据。
在一实施例中,所述基于所述目标训练数据对分类模型进行训练,得到所述分类模型相关的模拟数据,包括:对所述目标训练数据进行特征提取,得到所述目标训练数据的特征向量;基于所述目标训练数据的特征向量,利用第二损失函数更新所述分类模型的参数,直至所述第二损失函数的损失值收敛,得到所述分类模型相关的模拟数据;其中,所述分类模型相关的模拟数据包括以下一个或多个参数:所述分类模型每次迭代的迭代次数;所述分类模型的准确率;所述分类模型的分类层输出结果。
步骤203:获取标签类型序列。
在一实施例中,所述获取标签类型序列,包括:确定所述目标训练数据的标签类型;所述目标训练数据是通过对原始训练数据进行标签加噪处理得到的,所述原始训练数据包括干净标签样本;对所述目标训练数据的标签类型进行序列转换,得到所述标签类型序列。
步骤204:将所述标签类型序列输入至第一编码器网络,得到相应的标签特征。
在本申请实施例中,所述第一编码器网络可以为标签编码器网络,第一编码器网络可以为transformer模型,还可以为RNN,这里不做限定。
步骤205:将所述分类模型相关的模拟数据输入至第二编码器网络,得到相应的数据特征。
在本申请实施例中,所述第二编码器网络可以为特征编码器网络,第二编码器网络可以为transformer模型,还可以为RNN,这里不做限定。
在一实施例中,所述将所述分类模型相关的模拟数据输入至第二编码器网络,得到相应的数据特征,包括:在所述分类模型相关的模拟数据包括所述分类模型每次迭代的迭代次数的情况下,对所述分类模型每次迭代的迭代次数进行位置编码,得到相应的位置特征;将所述位置特征、所述分类模型的准确率和所述分类模型的分类层输出结果进行拼接,得到拼接后的模拟数据;将所述拼接后的模拟数据输入至所述第二编码器网络,得到相应的数据特征。
步骤206:将所述标签特征和所述数据特征输入至联合网络,得到所述联合网络输出的第一预测结果。
在本申请实施例中,所述第一预测结果表征所述标签特征和所述数据特征的融合特征。
步骤207:基于所述第一预测结果和所述标签类型序列,确定第一损失函数。
步骤208:利用所述第一损失函数更新第一编码器网络的参数和第二编码器网络的参数,直至所述第一损失函数的损失值收敛,生成噪声标签检测模型。
本申请实施例还提供了另一种模型训练方法,该方法应用于模型训练装置,图3为本申请实施例的模型训练方法的流程示意图三;如图3所示,该模型训练方法包括:
步骤301:获取目标训练数据。
在本申请实施例中,所述目标训练数据用于表征含有噪声标签的训练样本。
在一实施例中,所述获取目标训练数据,包括:获取原始训练数据;所述原始训练数据包括干净标签样本,所述干净标签样本表征未含有噪声标签的训练样本;对所述原始训练数据进行标签加噪处理,得到所述目标训练数据。
步骤302:基于所述目标训练数据对分类模型进行训练,得到所述分类模型相关的模拟数据。
在一实施例中,所述基于所述目标训练数据对分类模型进行训练,得到所述分类模型相关的模拟数据,包括:对所述目标训练数据进行特征提取,得到所述目标训练数据的特征向量;基于所述目标训练数据的特征向量,利用第二损失函数更新所述分类模型的参数,直至所述第二损失函数的损失值收敛,得到所述分类模型相关的模拟数据;其中,所述分类模型相关的模拟数据包括以下一个或多个参数:所述分类模型每次迭代的迭代次数;所述分类模型的准确率;所述分类模型的分类层输出结果。
步骤303:获取标签类型序列。
在一实施例中,所述获取标签类型序列,包括:确定所述目标训练数据的标签类型;所述目标训练数据是通过对原始训练数据进行标签加噪处理得到的,所述原始训练数据包括干净标签样本;对所述目标训练数据的标签类型进行序列转换,得到所述标签类型序列。
步骤304:将所述标签类型序列输入至第一编码器网络,得到相应的标签特征。
在本申请实施例中,所述第一编码器网络可以为标签编码器网络,第一编码器网络可以为transformer模型,还可以为RNN,这里不做限定。
步骤305:将所述分类模型相关的模拟数据输入至第二编码器网络,得到相应的数据特征。
在本申请实施例中,所述第二编码器网络可以为特征编码器网络,第二编码器网络可以为transformer模型,还可以为RNN,这里不做限定。
在一实施例中,所述将所述分类模型相关的模拟数据输入至第二编码器网络,得到相应的数据特征,包括:在所述分类模型相关的模拟数据包括所述分类模型每次迭代的迭代次数的情况下,对所述分类模型每次迭代的迭代次数进行位置编码,得到相应的位置特征;将所述位置特征、所述分类模型的准确率和所述分类模型的分类层输出结果进行拼接,得到拼接后的模拟数据;将所述拼接后的模拟数据输入至所述第二编码器网络,得到相应的数据特征。
步骤306:将所述标签特征和所述数据特征输入至联合网络,得到所述联合网络输出的第一预测结果。
在本申请实施例中,所述第一预测结果表征所述标签特征和所述数据特征的融合特征。
步骤307:基于所述第一预测结果和所述标签类型序列,确定第一损失函数。
步骤308:利用所述第一损失函数更新第一编码器网络的参数和第二编码器网络的参数,直至所述第一损失函数的损失值收敛,生成噪声标签检测模型。
步骤309:获取待检测的分类任务数据,并基于所述待检测的分类任务数据对所述分类模型进行训练,生成各训练轮次对应的分类模型相关的模拟数据。
在本申请实施例中,所述待检测的分类任务数据包括一个或多个类别标签样本,分类任务数据包括图像分类数据、音频分类数据、文本分类数据等,在此不做限定。
步骤310:将所述各训练轮次对应的分类模型相关的模拟数据输入至所述噪声标签检测模型,得到第二预测结果,并基于所述第二预测结果,从所述待检测的分类任务数据中检测出噪声标签。
在本申请实施例中,所述第二预测结果表征各类别标签样本在相应的训练轮次下被判定为噪声标签的概率。
在一实施例中,所述基于所述第二预测结果,从所述待检测的分类任务数据中检测出噪声标签,包括:将所述第二预测结果与概率阈值进行比较,得到比较结果;在所述比较结果表征所述第二预测结果大于所述概率阈值的情况下,确定大于所述概率阈值的第二预测结果所对应的类别标签样本为噪声标签。
采用本申请实施例的技术方案,通过深度学习网络对噪声标签样本即目标训练数据本身进行建模,单独训练一个用于噪声标签检测的噪声标签检测模型,且在噪声标签检测模型的训练过程中,并非采用分类网络的输入数据或损失值作为训练数据,而是采用基于含有噪声标签的训练样本对分类模型进行训练得到的分类模型相关的模拟数据作为训练数据,如此,能够学习到噪声标签样本、干净标签样本在分类模型训练过程中输出的特性,提高噪声标签检测模型的鲁棒性,从而使得噪声标签的检测效果大大提升。
下面结合应用实施例对本申请进行说明。
相关技术中大多方案是通过鲁棒性训练提高模型对NL的耐受性,大部分存在以下缺点:
1、并非直接检测NL,并非对NL建模,故NL检测能力不够强。多数方案的目标仅仅是为了减小NL的影响,防止模型过拟合,并不关心是否能筛选出NL,甚至无法做到检测出NL。
2、多数方案是通过单一节点、单一维度的阈值筛选NL。比如基于当前epoch的损失值,保留部分小损失值数据更新模型,而当前epoch为单一节点,未考虑之前节点(epochs)的结果,而事实上纵观整个训练过程,NL样本是有明显特征的,比如模型通常优先拟合CL样本,表现为CL样本的损失在训练前期明显下降,而NL样本则在训练后期模型过拟合后才逐渐下降,故纵观整个训练的多节点(epoch)特征也是很重要的。只通过损失大小判定NL是单一维度的,实际上NL的特征是多维度的,比如除了损失值本身以外,其不同epoch的变化范围也是一个重要特征,NL的变化范围通常大于CL。另外,单一维度阈值很难确定,而且具有很强敏感性,如果训练数据不匹配往往效果很差。
3、只通过显式特征判定NL。与上述第二条中对单一维度的论述类似,NL的特征是多维度的,甚至部分维度特征是隐式的,很难人为总结出。
4、未尽早筛除可能的NL。NL在后续epoch还有可能被判定为CL而更新模型参数。实际测试中可以发现,NL在不同epoch损失值的变化范围可能会很大,在部分epoch甚至损失值能跟CL相当。如果不及时筛除NL,NL样本就会出现损失波动到较小值,被误判成CL而更新模型参数,导致模型对NL过拟合,从而更难再将其与NL区分开,陷入恶性循环。因此,尽早筛除NL并防止其更新模型参数极为重要。
5、通用性低。多数方案的通用性较低,换一批数据或者换到其他分类任务上,效果往往会变差。尤其是对阈值敏感的方案,如果改变数据或者应用场景,需要重新设置阈值,而找到合适的阈值通常很困难。且不同的分类任务,比如图像和语音,其分类训练特征是不同的,图像分类任务的阈值并不适用于语音分类任务。
针对上述技术问题,本申请提出以下解决方案:
1、从根本上出发,以检测并筛除NL为目标。单独训练一个NLD模型,在分类模型训练时,通过已经训练好的NLD模型筛除NL。
2、多节点(所有历史epoch)、多维度,减少阈值依赖。NLD模型的编码器(encoder)采用transformer、RNN或者LSTM等网络框架,NLD模型的解码器(decoder)采用transducer,流式解码,输出结果依赖历史信息,充分利用整个训练过程中的信息,减少对阈值的依赖。
3、支持隐式特征。用深度学习判定是否是NL,能更好的发掘NL的隐式特征。
4、尽早筛选出NL。采用流式解码,样本在某一个epoch中一旦被判定为NL,则立即将该样本数据从更新集移到筛除集,之后只使用更新集的数据更新模型参数,而筛除集的数据不参与模型参数的更新。
5、通用性较高。NL建模所用到的数据是分类任务的softmax层输出,而非分类任务数据本身。NLD模型是通过深度学习学会NL在分类模型训练过程中的通用特征,不依赖单一阈值,故具有跨任务、跨模型、跨数据的通用性。
本申请的技术方案流程主要可以分为三个阶段:第一阶段为数据准备阶段,即获取含NL的训练数据(对应前述的目标训练数据)和NLD模型的训练特征(对应前述的分类模型相关的模拟数据);第二阶段为NLD模型训练阶段,即使用模拟数据训练NLD模型;第三阶段为实际应用阶段,即使用真实带NL数据(对应前述的待检测的分类任务数据)训练分类模型,使用已训练好的NLD模型进行流式检测,筛除NL样本。下面对这三个阶段的过程进行详细说明。
第一阶段:数据准备阶段
图4为本申请实施例的数据准备阶段的流程示意图,如图4所示,在该阶段中,首先获取CL数据,然后对CL数据进行标签加噪处理,以生成含一定比例NL的数据,即生成包含NL的数据,以及得到每个样本的标签类型接下来使用包含NL的数据训练分类模型,得到分类模型相关的模拟数据,例如分类模型每次迭代的迭代次数m、分类模型的准确率Acc和分类模型softmax层输出结果并将这些分类模型相关的模拟数据进行保存,以作为NLD模型的输入。
这里,生成的包含NL的数据中NL种类为对称噪声(例如随机NL、类内NL),即样本转换为其他标签的概率相等,其转换概率P可通过以下公式(5)表示:
其中,i和j表示样本的编号,i和j为两个不同样本;η表示生成包含NL的数据中NL所占比例,通常可取值为1%~30%;c表示分类数;表示样本的标注标签;yi和yj分别表示样本i和样本j对应的真实分类标签。
在分类模型训练中,E、e分别表示训练过程中总训练轮次(epoch)数和当前epoch数,而M、m分别表示训练总迭代数和当前迭代数,N为总样本数。其中,每用一个一次训练所抓取的数据样本数量(batchsize)的数据训练一次为一次迭代,一个epoch包含多次迭代,M和E的关系可通过以下公式(6)表示:
其中,向下取整,即为每个epoch的迭代数,向下取整是因为最后剩余的样本量不足batchsize而被丢弃。
该数据准备阶段会多次进行,生成大批量数据。CL数据、分类模型、NL比例η等参数可以改变,即使不改变这些参数,每次生成的NL样本也是随机的。其中,CL数据可以选用一些分类任务的公开数据集,比如图像识别的数据集,如VGG-Face、MS-Celeb-1M、MNIST,也可以是语音的数据集,比如VoxCeleb、CN-Celeb等。分类模型框架也有多种选择,比如Resnet34、ECAPA-TDNN等。使用多种数据、多种分类任务、多种分类模型以及多种NL比例生成目标训练数据,能提高NLD模型的鲁棒性。
第二阶段:NLD模型训练阶段
该阶段使用第一阶段生成的数据,即标签类型序列和分类模型相关的模拟数据训练NLD模型,图5为本申请实施例的噪声标签检测模型训练阶段的流程示意图,如图5所示,首先,需要将标签类型转换为标签类型序列是长度为E,值为0或1的序列,其转换方法如上述公式(2)所示,其中,e、m为当前epoch数和迭代数,i表示第i个样本,代表序列的第e个元素。简单理解就是,CL样本的序列全为0,NL样本的序列中如果前一个元素为1,之后的元素都为1,否则通过序列函数R判定序列是0或者1,而R的取值受到当前迭代的Acc影响,具体R的取值的概率可通过上述公式(3)和(4)计算得到。
接下来,将第一阶段保存的分类模型相关的模拟数据:m、Acc和拼接成特征X,作为特征编码器的输入,得到特征编码器的输出hFE,其中,还可将m经过位置编码得到相应的位置特征,然后将位置特征与Acc和进行拼接,以拼接成特征X,位置编码与transformer中的相同,见公式(7)。将标签类型序列作为标签编码器的输入,得到标签编码器的输出hLE。其中,特征编码器和标签编码器可以是transformer或者RNN。然后,将标签编码器的输出和特征编码器的输出通过联合网络生成J,如公式(8)所示。其中,特征编码器的输出与当前特征(Xe)和历史特征(X1,X2,...Xe-1)相关,而标签编码器输出与历史标签相关。
这里,公式(7)和(8)可表示为:
其中,表示i样本在迭代次数为m时的位置编码;d表示模型隐藏层的维度;k表示位置编码的维度索引。
其中,表示通过联合网络生成的标签特征和数据特征的融合特征;表示当前特征;分别表示历史特征;分别表示历史标签;Linear表示线性运算。
NLD模型的输出结果为二分类(即是/否为NL),故选用Sigmoid函数,见公式(9),其中,代表样本i的预测序列中第e个元素的正确概率。公式(10)中P(zixi)表示样本i的整个序列预测的正确率,其等于每个元素正确率的累乘。损失函数loss(对应前述的第一损失函数)可通过公式(11)得到,具体的,为对该批数据(n个样本)中所有样本序列的预测准确率进行负对数求和处理得到。
这里,公式(9)、(10)和(11)可表示为:
需要说明的是,对于公式(9)、(10)和(11)中各参数的含义可参考上文相同参数的含义而理解,这里不再赘述。
第三阶段:NLD模型实际应用阶段
该阶段是使用第二阶段训练好的NLD模型检测实际训练数据(对应前述的待检测的分类任务数据)中的NL样本,其检测过程是流式的,在分类模型训练过程中进行检测,图6为本申请实施例的噪声标签检测模型实际应用阶段的流程示意图,如图6所示,将包含NL的数据输入至分类模型,在分类模型的训练过程中,每个epoch生成的分类模型的softmax层输出结果每次迭代的迭代次数m和分类模型的准确率Acc作为NLD模型的输入,得到样本在该epoch下被判定为NL的概率y,而且每个epoch的y值还依赖于历史epoch的y值。如果某样本在某个epoch下的y>0.8,则认为有足够的证据认定该样本为NL样本,在后续的epoch中,该样本不再用于更新模型参数,从而达到筛除NL的目的。
与相关技术的方案相比,本申请的方案具有以下有益效果:
1、通过深度学习网络直接对NL建模,训练数据并非是分类网络的输入数据,也并非损失值,而是输出的softmax层数据以及模型每次迭代的迭代次数和分类模型的准确率,能学习到NL、CL样本在分类网络训练过程中输出的特性,NLD效果更好。
2、NLD模型的网络架构选用transformer-transducer或RNN-T,每一个epoch判定是否是NL还依赖于历史值,能充分利用整个训练过程中的信息。
3、深度学习能学会更多的隐式特征,能通过多维度特征进行NL的判定,对阈值依赖极小。
4、实际应用中采用流式解码,无需等训练完才判定NL,能在分类训练过程中实时进行NL的检测,并尽早筛选出NL,防止NL过拟合。
5、通用性较高。模拟生成的NLD模型训练数据本身来自于多任务、多模型、多数据集,NLD模型本身也是学习的NL、CL样本在分类训练中的通用特性,故NLD模型具有通用性。
为了实现本申请实施例的模型训练方法,本申请实施例还提供了一种模型训练装置,图7为本申请实施例的模型训练装置的组成结构示意图,如图7所示,该模型训练装置包括:
第一获取单元71,配置为获取目标训练数据;
第一确定单元72,配置为基于所述目标训练数据对分类模型进行训练,得到所述分类模型相关的模拟数据;
第二获取单元73,配置为获取标签类型序列;
第二确定单元74,配置为基于所述标签类型序列和所述分类模型相关的模拟数据,确定第一损失函数;
第一生成单元75,配置为利用所述第一损失函数更新第一编码器网络的参数和第二编码器网络的参数,直至所述第一损失函数的损失值收敛,生成噪声标签检测模型。
在一实施例中,所述第一获取单元71,配置为:
获取原始训练数据;所述原始训练数据包括干净标签样本,所述干净标签样本表征未含有噪声标签的训练样本;对所述原始训练数据进行标签加噪处理,得到所述目标训练数据;所述目标训练数据表征含有噪声标签的训练样本。
在一实施例中,所述第一确定单元72,配置为:
对所述目标训练数据进行特征提取,得到所述目标训练数据的特征向量;基于所述目标训练数据的特征向量,利用第二损失函数更新所述分类模型的参数,直至所述第二损失函数的损失值收敛,得到所述分类模型相关的模拟数据;其中,所述分类模型相关的模拟数据包括以下一个或多个参数:所述分类模型每次迭代的迭代次数;所述分类模型的准确率;所述分类模型的分类层输出结果。
在一实施例中,所述第二获取单元73,配置为:
确定所述目标训练数据的标签类型;所述目标训练数据是通过对原始训练数据进行标签加噪处理得到的,所述原始训练数据包括干净标签样本;对所述目标训练数据的标签类型进行序列转换,得到所述标签类型序列。
在一实施例中,所述第二确定单元74包括:第一确定子单元、第二确定子单元和第三确定子单元;其中,
所述第一确定子单元,配置为将所述标签类型序列输入至所述第一编码器网络,得到相应的标签特征;
所述第二确定子单元,配置为将所述分类模型相关的模拟数据输入至所述第二编码器网络,得到相应的数据特征;
所述第三确定子单元,配置为基于所述标签特征和所述数据特征,确定所述第一损失函数。
在一实施例中,所述第三确定子单元,配置为:
将所述标签特征和所述数据特征输入至联合网络,得到所述联合网络输出的第一预测结果;所述第一预测结果表征所述标签特征和所述数据特征的融合特征;基于所述第一预测结果和所述标签类型序列,确定所述第一损失函数。
在一实施例中,所述分类模型相关的模拟数据包括以下一个或多个参数:所述分类模型每次迭代的迭代次数;所述分类模型的准确率;所述分类模型的分类层输出结果;
所述第二确定子单元,配置为:
在所述分类模型相关的模拟数据包括所述分类模型每次迭代的迭代次数的情况下,对所述分类模型每次迭代的迭代次数进行位置编码,得到相应的位置特征;将所述位置特征、所述分类模型的准确率和所述分类模型的分类层输出结果进行拼接,得到拼接后的模拟数据;将所述拼接后的模拟数据输入至所述第二编码器网络,得到相应的数据特征。
在一实施例中,该模型训练装置还包括:第三获取单元、第二生成单元、第三确定单元和检测单元;其中,
所述第三获取单元,配置为在所述第一生成单元75生成噪声标签检测模型之后,获取待检测的分类任务数据;所述待检测的分类任务数据包括一个或多个类别标签样本;
所述第二生成单元,配置为基于所述待检测的分类任务数据对所述分类模型进行训练,生成各训练轮次对应的分类模型相关的模拟数据;
所述第三确定单元,配置为将所述各训练轮次对应的分类模型相关的模拟数据输入至所述噪声标签检测模型,得到第二预测结果;所述第二预测结果表征各类别标签样本在相应的训练轮次下被判定为噪声标签的概率;
所述检测单元,配置为基于所述第二预测结果,从所述待检测的分类任务数据中检测出噪声标签。
在一实施例中,该模型训练装置还包括:第四确定单元和筛除单元;其中,
所述第四确定单元,配置为确定类别标签样本在目标训练轮次下被判定为噪声标签的概率是否大于概率阈值;
所述筛除单元,配置为在所述类别标签样本在目标训练轮次下被判定为噪声标签的概率大于所述概率阈值的情况下,筛除在所述目标训练轮次下训练的所述类别标签样本。
在一实施例中,所述检测单元,配置为:
将所述第二预测结果与概率阈值进行比较,得到比较结果;在所述比较结果表征所述第二预测结果大于所述概率阈值的情况下,确定大于所述概率阈值的第二预测结果所对应的类别标签样本为噪声标签。
实际应用时,第一获取单元71和第二获取单元73可由模型训练装置中的通信接口实现;第一确定单元72、第二确定单元74和第一生成单元75可由模型训练装置中的处理器实现。
需要说明的是:上述实施例提供的模型训练装置在进行模型训练时,仅以上述各程序模块的划分进行举例说明,实际应用中,可以根据需要而将上述处理分配由不同的程序模块完成,即将装置的内部结构划分成不同的程序模块,以完成以上描述的全部或者部分处理。另外,上述实施例提供的模型训练装置与模型训练方法实施例属于同一构思,其具体实现过程详见模型训练方法实施例,这里不再赘述。
基于上述程序模块的硬件实现,且为了实现本申请实施例的模型训练方法,本申请实施例还提供了一种模型训练设备,图8为本申请实施例的模型训练设备的硬件组成结构示意图,如图8所示,该模型训练设备80包括:
通信接口81,能够与其他设备进行信息交互;
处理器82,与所述通信接口81连接,以实现与其他设备进行信息交互,用于运行计算机程序时,执行上述提供的模型训练方法,而所述计算机程序存储在存储器83上。
具体地,所述通信接口81,配置为获取目标训练数据;
所述处理器82,配置为基于所述目标训练数据对分类模型进行训练,得到所述分类模型相关的模拟数据;
所述通信接口81,还配置为获取标签类型序列;
所述处理器82,还配置为基于所述标签类型序列和所述分类模型相关的模拟数据,确定第一损失函数;利用所述第一损失函数更新第一编码器网络的参数和第二编码器网络的参数,直至所述第一损失函数的损失值收敛,生成噪声标签检测模型。
在一实施例中,所述通信接口81,配置为:
获取原始训练数据;所述原始训练数据包括干净标签样本,所述干净标签样本表征未含有噪声标签的训练样本;对所述原始训练数据进行标签加噪处理,得到所述目标训练数据;所述目标训练数据表征含有噪声标签的训练样本。
在一实施例中,所述处理器82,配置为:
对所述目标训练数据进行特征提取,得到所述目标训练数据的特征向量;基于所述目标训练数据的特征向量,利用第二损失函数更新所述分类模型的参数,直至所述第二损失函数的损失值收敛,得到所述分类模型相关的模拟数据;其中,所述分类模型相关的模拟数据包括以下一个或多个参数:所述分类模型每次迭代的迭代次数;所述分类模型的准确率;所述分类模型的分类层输出结果。
在另一实施例中,所述通信接口81,配置为:
确定所述目标训练数据的标签类型;所述目标训练数据是通过对原始训练数据进行标签加噪处理得到的,所述原始训练数据包括干净标签样本;对所述目标训练数据的标签类型进行序列转换,得到所述标签类型序列。
在另一实施例中,所述处理器82,配置为:
将所述标签类型序列输入至所述第一编码器网络,得到相应的标签特征;将所述分类模型相关的模拟数据输入至所述第二编码器网络,得到相应的数据特征;基于所述标签特征和所述数据特征,确定所述第一损失函数。
在另一实施例中,所述处理器82,配置为:
将所述标签特征和所述数据特征输入至联合网络,得到所述联合网络输出的第一预测结果;所述第一预测结果表征所述标签特征和所述数据特征的融合特征;基于所述第一预测结果和所述标签类型序列,确定所述第一损失函数。
在另一实施例中,所述分类模型相关的模拟数据包括以下一个或多个参数:所述分类模型每次迭代的迭代次数;所述分类模型的准确率;所述分类模型的分类层输出结果;所述处理器82,配置为:
在所述分类模型相关的模拟数据包括所述分类模型每次迭代的迭代次数的情况下,对所述分类模型每次迭代的迭代次数进行位置编码,得到相应的位置特征;将所述位置特征、所述分类模型的准确率和所述分类模型的分类层输出结果进行拼接,得到拼接后的模拟数据;将所述拼接后的模拟数据输入至所述第二编码器网络,得到相应的数据特征。
在一实施例中,所述通信接口81,还配置为在所述处理器82生成噪声标签检测模型之后,获取待检测的分类任务数据;所述待检测的分类任务数据包括一个或多个类别标签样本;
所述处理器82,还配置为基于所述待检测的分类任务数据对所述分类模型进行训练,生成各训练轮次对应的分类模型相关的模拟数据;将所述各训练轮次对应的分类模型相关的模拟数据输入至所述噪声标签检测模型,得到第二预测结果;所述第二预测结果表征各类别标签样本在相应的训练轮次下被判定为噪声标签的概率;基于所述第二预测结果,从所述待检测的分类任务数据中检测出噪声标签。
在一实施例中,所述处理器82,还配置为:
确定类别标签样本在目标训练轮次下被判定为噪声标签的概率是否大于概率阈值;在所述类别标签样本在目标训练轮次下被判定为噪声标签的概率大于所述概率阈值的情况下,筛除在所述目标训练轮次下训练的所述类别标签样本。
在一实施例中,所述处理器82,配置为:
将所述第二预测结果与概率阈值进行比较,得到比较结果;在所述比较结果表征所述第二预测结果大于所述概率阈值的情况下,确定大于所述概率阈值的第二预测结果所对应的类别标签样本为噪声标签。
需要说明的是:通信接口81和处理器82的具体处理过程可参照上述模型训练方法而理解。
当然,实际应用时,模型训练设备80中的各个组件通过总线系统84耦合在一起。可以理解的是,总线系统84用于实现这些组件之间的连接通信。总线系统84除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图8中将各种总线都标为总线系统84。
本申请实施例中的存储器83用于存储各种类型的数据以支持模型训练设备80的操作。这些数据的示例包括:用于在模型训练设备80上操作的任何计算机程序。
上述本申请实施例揭示的模型训练方法可以应用于所述处理器82中,或者由所述处理器82实现。所述处理器82可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述模型训练方法的各步骤可以通过所述处理器82中的硬件的集成逻辑电路或者软件形式的指令完成。上述的所述处理器82可以是通用处理器、数字信号处理器(DSP,Digital Signal Processor),或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。所述处理器82可以实现或者执行本申请实施例中公开的各模型训练方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合本申请实施例所公开的模型训练方法的步骤,可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于存储介质中,该存储介质位于存储器83,所述处理器82读取存储器83中的信息,结合其硬件完成前述模型训练方法的步骤。
在示例性实施例中,模型训练设备80可以被一个或多个应用专用集成电路(ASIC,Application Specific Integrated Circuit)、DSP、可编程逻辑器件(PLD,Programmable Logic Device)、复杂可编程逻辑器件(CPLD,Complex Programmable Logic Device)、现场可编程门阵列(FPGA,Field-Programmable Gate Array)、通用处理器、控制器、微控制器(MCU,Micro Controller Unit)、微处理器(Microprocessor)、或者其他电子元件实现,用于执行前述模型训练方法。
可以理解,本申请实施例的存储器83可以是易失性存储器或者非易失性存储器,也可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(ROM,Read Only Memory)、可编程只读存储器(PROM,Programmable Read-Only Memory)、可擦除可编程只读存储器(EPROM,Erasable Programmable Read-Only Memory)、电可擦除可编程只读存储器(EEPROM,Electrically Erasable Programmable Read-Only Memory)、磁性随机存取存储器(FRAM,ferromagnetic random access memory)、快闪存储器(Flash Memory)、磁表面存储器、光盘、或只读光盘(CD-ROM,Compact Disc Read-Only Memory);磁表面存储器可以是磁盘存储器或磁带存储器。易失性存储器可以是随机存取存储器(RAM,Random Access Memory),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(SRAM,Static Random Access Memory)、同步静态随机存取存储器(SSRAM,Synchronous Static Random Access Memory)、动态随机存取存储器(DRAM,Dynamic Random Access Memory)、同步动态随机存取存储器(SDRAM,Synchronous Dynamic Random Access Memory)、双倍数据速率同步动态随机存取存储器(DDRSDRAM,Double Data Rate Synchronous Dynamic Random Access Memory)、增强型同步动态随机存取存储器(ESDRAM,Enhanced Synchronous Dynamic Random Access Memory)、同步连接动态随机存取存储器(SLDRAM,SyncLink Dynamic Random Access Memory)、直接内存总线随机存取存储器(DRRAM,Direct Rambus Random Access Memory)。本申请实施例描述的存储器83旨在包括但不限于这些和任意其它适合类型的存储器。
在示例性实施例中,本申请实施例还提供了一种存储介质,即计算机存储介质,具体为计算机可读存储介质,例如包括存储计算机程序的存储器83,上述计算机程序可由模型训练设备80中的处理器82执行,以完成前述本申请实施例所述的模型训练方法的步骤。其中,所述计算机可读存储介质可以是FRAM、ROM、PROM、EPROM、EEPROM、Flash Memory、磁表面存储器、光盘、或CD-ROM等存储器。
在示例性实施例中,本申请实施例还提供了一种计算机程序产品,包括计算机程序,所述计算机程序可由模型训练设备80中的处理器82执行,以完成前述本申请实施例所述的模型训练方法的步骤。
需要说明的是:“第一”、“第二”、“第三”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。
另外,本申请实施例所记载的技术方案之间,在不冲突的情况下,可以任意组合。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (14)

  1. 一种模型训练方法,所述方法包括:
    获取目标训练数据,并基于所述目标训练数据对分类模型进行训练,得到所述分类模型相关的模拟数据;
    获取标签类型序列;
    基于所述标签类型序列和所述分类模型相关的模拟数据,确定第一损失函数;
    利用所述第一损失函数更新第一编码器网络的参数和第二编码器网络的参数,直至所述第一损失函数的损失值收敛,生成噪声标签检测模型。
  2. 根据权利要求1所述的方法,其中,所述获取目标训练数据,包括:
    获取原始训练数据;所述原始训练数据包括干净标签样本,所述干净标签样本表征未含有噪声标签的训练样本;
    对所述原始训练数据进行标签加噪处理,得到所述目标训练数据;所述目标训练数据表征含有噪声标签的训练样本。
  3. 根据权利要求1所述的方法,其中,所述基于所述目标训练数据对分类模型进行训练,得到所述分类模型相关的模拟数据,包括:
    对所述目标训练数据进行特征提取,得到所述目标训练数据的特征向量;
    基于所述目标训练数据的特征向量,利用第二损失函数更新所述分类模型的参数,直至所述第二损失函数的损失值收敛,得到所述分类模型相关的模拟数据;
    其中,所述分类模型相关的模拟数据包括以下一个或多个参数:
    所述分类模型每次迭代的迭代次数;所述分类模型的准确率;所述分类模型的分类层输出结果。
  4. 根据权利要求1所述的方法,其中,所述获取标签类型序列,包括:
    确定所述目标训练数据的标签类型;所述目标训练数据是通过对原始训练数据进行标签加噪处理得到的,所述原始训练数据包括干净标签样本;
    对所述目标训练数据的标签类型进行序列转换,得到所述标签类型序列。
  5. 根据权利要求1所述的方法,其中,所述基于所述标签类型序列和所述分类模型相关的模拟数据,确定第一损失函数,包括:
    将所述标签类型序列输入至所述第一编码器网络,得到相应的标签特征;
    将所述分类模型相关的模拟数据输入至所述第二编码器网络,得到相应的数据特征;
    基于所述标签特征和所述数据特征,确定所述第一损失函数。
  6. 根据权利要求5所述的方法,其中,所述基于所述标签特征和所述数据特征,确定所述第一损失函数,包括:
    将所述标签特征和所述数据特征输入至联合网络,得到所述联合网络输出的第一预测结果;所述第一预测结果表征所述标签特征和所述数据特征的融合特征;
    基于所述第一预测结果和所述标签类型序列,确定所述第一损失函数。
  7. 根据权利要求5所述的方法,其中,所述分类模型相关的模拟数据包括以下一个或多个参数:所述分类模型每次迭代的迭代次数;所述分类模型的准确率;所述分类模型的分类层输出结果;
    所述将所述分类模型相关的模拟数据输入至所述第二编码器网络,得到相应的数据特征,包括:
    在所述分类模型相关的模拟数据包括所述分类模型每次迭代的迭代次数的情况下,对所述分类模型每次迭代的迭代次数进行位置编码,得到相应的位置特征;
    将所述位置特征、所述分类模型的准确率和所述分类模型的分类层输出结果进行拼接,得到拼接后的模拟数据;
    将所述拼接后的模拟数据输入至所述第二编码器网络,得到相应的数据特征。
  8. 根据权利要求1所述的方法,其中,在所述生成噪声标签检测模型之后,所述方法还包括:
    获取待检测的分类任务数据;所述待检测的分类任务数据包括一个或多个类别标签样本;
    基于所述待检测的分类任务数据对所述分类模型进行训练,生成各训练轮次对应的分类模型相关的模拟数据;
    将所述各训练轮次对应的分类模型相关的模拟数据输入至所述噪声标签检测模型,得到第二预测结果;所述第二预测结果表征各类别标签样本在相应的训练轮次下被判定为噪声标签的概率;
    基于所述第二预测结果,从所述待检测的分类任务数据中检测出噪声标签。
  9. 根据权利要求8所述的方法,其中,所述方法还包括:
    确定类别标签样本在目标训练轮次下被判定为噪声标签的概率是否大于概率阈值;
    在所述类别标签样本在目标训练轮次下被判定为噪声标签的概率大于所述概率阈值的情况下,筛除在所述目标训练轮次下训练的类别标签样本。
  10. 根据权利要求8所述的方法,其中,所述基于所述第二预测结果,从所述待检测的分类任务数据中检测出噪声标签,包括:
    将所述第二预测结果与概率阈值进行比较,得到比较结果;
    在所述比较结果表征所述第二预测结果大于所述概率阈值的情况下,确定大于所述概率阈值的第二预测结果所对应的类别标签样本为噪声标签。
  11. 一种模型训练装置,所述装置包括:
    第一获取单元,配置为获取目标训练数据;
    第一确定单元,配置为基于所述目标训练数据对分类模型进行训练,得到所述分类模型相关的模拟数据;
    第二获取单元,配置为获取标签类型序列;
    第二确定单元,配置为基于所述标签类型序列和所述分类模型相关的模拟数据,确定第一损失函数;
    第一生成单元,配置为利用所述第一损失函数更新第一编码器网络的参数和第二编码器网络的参数,直至所述第一损失函数的损失值收敛,生成噪声标签检测模型。
  12. 一种模型训练设备,包括:处理器和用于存储能够在所述处理器上运行的计算机程序的存储器;
    其中,所述处理器用于运行所述计算机程序时,执行权利要求1至10任一项所述方法的步骤。
  13. 一种存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1至10任一项所述方法的步骤。
  14. 一种计算机程序产品,包括计算机程序,所述计算机程序在被处理器执行时实现权利要求1至10任一项所述方法的步骤。
PCT/CN2025/083444 2024-03-25 2025-03-19 模型训练方法、装置、设备、存储介质及计算机程序产品 Pending WO2025201138A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202410346106.0A CN118797432A (zh) 2024-03-25 2024-03-25 模型训练方法、装置、设备、存储介质及计算机程序产品
CN202410346106.0 2024-03-25

Publications (1)

Publication Number Publication Date
WO2025201138A1 true WO2025201138A1 (zh) 2025-10-02

Family

ID=93034814

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2025/083444 Pending WO2025201138A1 (zh) 2024-03-25 2025-03-19 模型训练方法、装置、设备、存储介质及计算机程序产品

Country Status (2)

Country Link
CN (1) CN118797432A (zh)
WO (1) WO2025201138A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120953735A (zh) * 2025-10-16 2025-11-14 杭州海康威视数字技术股份有限公司 图像分类模型的训练方法及装置和图像分类方法及装置
CN121744059A (zh) * 2026-02-27 2026-03-27 厦门大学 物理引导增强的多个未知动荷载定位方法、设备及产品

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118797432A (zh) * 2024-03-25 2024-10-18 中国移动通信有限公司研究院 模型训练方法、装置、设备、存储介质及计算机程序产品

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021055904A1 (en) * 2019-09-20 2021-03-25 Google Llc Robust training in the presence of label noise
CN114358188A (zh) * 2022-01-05 2022-04-15 腾讯科技(深圳)有限公司 特征提取模型处理、样本检索方法、装置和计算机设备
CN114424253A (zh) * 2019-11-08 2022-04-29 深圳市欢太科技有限公司 模型训练方法、装置、存储介质及电子设备
CN116229196A (zh) * 2022-11-16 2023-06-06 上海高德威智能交通系统有限公司 一种噪声样本的识别方法及装置
US20230252771A1 (en) * 2022-01-14 2023-08-10 Samsung Electronics Co., Ltd. Method and apparatus with label noise processing
CN118797432A (zh) * 2024-03-25 2024-10-18 中国移动通信有限公司研究院 模型训练方法、装置、设备、存储介质及计算机程序产品

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021055904A1 (en) * 2019-09-20 2021-03-25 Google Llc Robust training in the presence of label noise
CN114424253A (zh) * 2019-11-08 2022-04-29 深圳市欢太科技有限公司 模型训练方法、装置、存储介质及电子设备
CN114358188A (zh) * 2022-01-05 2022-04-15 腾讯科技(深圳)有限公司 特征提取模型处理、样本检索方法、装置和计算机设备
US20230252771A1 (en) * 2022-01-14 2023-08-10 Samsung Electronics Co., Ltd. Method and apparatus with label noise processing
CN116229196A (zh) * 2022-11-16 2023-06-06 上海高德威智能交通系统有限公司 一种噪声样本的识别方法及装置
CN118797432A (zh) * 2024-03-25 2024-10-18 中国移动通信有限公司研究院 模型训练方法、装置、设备、存储介质及计算机程序产品

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120953735A (zh) * 2025-10-16 2025-11-14 杭州海康威视数字技术股份有限公司 图像分类模型的训练方法及装置和图像分类方法及装置
CN121744059A (zh) * 2026-02-27 2026-03-27 厦门大学 物理引导增强的多个未知动荷载定位方法、设备及产品

Also Published As

Publication number Publication date
CN118797432A (zh) 2024-10-18

Similar Documents

Publication Publication Date Title
CN107871014A (zh) 一种基于深度融合哈希的大数据跨模态检索方法及系统
CN111027681B (zh) 时序数据处理模型训练方法、数据处理方法、装置及存储介质
CN112420125B (zh) 分子属性预测方法、装置、智能设备和终端
CN112749737A (zh) 图像分类方法及装置、电子设备、存储介质
CN117648950A (zh) 神经网络模型的训练方法、装置、电子设备及存储介质
CN118797432A (zh) 模型训练方法、装置、设备、存储介质及计算机程序产品
CN117935291B (zh) 草图生成模型的训练方法、草图生成方法、终端及介质
CN114898339B (zh) 驾驶行为预测模型的训练方法、装置、设备、存储介质
CN110490304A (zh) 一种数据处理方法及设备
CN110275928A (zh) 迭代式实体关系抽取方法
WO2024146203A1 (zh) 图像的文本识别模型的训练方法和装置、设备及介质
CN120744143A (zh) 基于多阶渐进对齐的多模态语义理解方法、装置、计算机设备和存储介质
CN111562943A (zh) 一种基于事件嵌入树及gat网络的代码克隆检测方法和装置
Huang et al. Strode: Stochastic boundary ordinary differential equation
CN114332469A (zh) 模型训练方法、装置、设备及存储介质
CN114723167B (zh) 一种基于BiLSTM-RVFL模型的短时车速预测方法
CN121051306A (zh) 基于对比学习的跨域推荐方法、系统、设备及存储介质
CN121125771A (zh) 基于图神经网络的电力通信网络关键节点识别方法
CN116091867A (zh) 一种模型训练、图像识别方法、装置、设备及存储介质
CN114692624A (zh) 一种基于多任务迁移的信息抽取方法、装置及电子设备
CN112949590B (zh) 一种跨域行人重识别模型构建方法及构建系统
CN117743568B (zh) 基于资源流量和置信度融合的内容生成方法和系统
CN117371482B (zh) 一种云平台运维时序知识图谱推理方法
CN116821691B (zh) 基于任务融合的训练情感识别模型的方法和装置
CN114155417B (zh) 图像目标的识别方法、装置、电子设备及计算机存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 25778015

Country of ref document: EP

Kind code of ref document: A1