+

CN114692667A - Model training method and related device - Google Patents

Model training method and related device Download PDF

Info

Publication number
CN114692667A
CN114692667A CN202011623266.3A CN202011623266A CN114692667A CN 114692667 A CN114692667 A CN 114692667A CN 202011623266 A CN202011623266 A CN 202011623266A CN 114692667 A CN114692667 A CN 114692667A
Authority
CN
China
Prior art keywords
data
noise
network
output
noise reduction
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.)
Granted
Application number
CN202011623266.3A
Other languages
Chinese (zh)
Other versions
CN114692667B (en
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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202011623266.3A priority Critical patent/CN114692667B/en
Publication of CN114692667A publication Critical patent/CN114692667A/en
Application granted granted Critical
Publication of CN114692667B publication Critical patent/CN114692667B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • 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
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2218/00Aspects of pattern recognition specially adapted for signal processing
    • G06F2218/02Preprocessing
    • G06F2218/04Denoising

Landscapes

  • Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Image Analysis (AREA)

Abstract

本申请公开了一种模型训练方法,可以应用于人工智能领域。该方法包括:获取包括噪声数据和无噪声数据的样本对;将无噪声数据输入降噪网络和分类网络的降噪分类网络,得到降噪网络输出的第一输出数据和分类网络输出的第二输出数据;将噪声数据输入降噪分类网络,得到降噪网络的中间层输出的第三输出数据和分类网络输出的第四输出数据。根据第一输出数据和第三输出数据确定第一损失函数;根据第二输出数据和第四输出数据确定第二损失函数;至少根据第一损失函数和第二损失函数,训练降噪分类网络,直至满足预设训练条件,得到目标网络。本方案能够增强网络抑制局部噪声和扰动的能力,提高了网络进行分类识别的精度。

Figure 202011623266

The present application discloses a model training method, which can be applied to the field of artificial intelligence. The method includes: acquiring a sample pair including noise data and noise-free data; inputting the noise-free data into a noise reduction network and a noise reduction classification network of the classification network to obtain first output data output by the noise reduction network and second output data output by the classification network Output data; input the noise data into the noise reduction classification network to obtain the third output data output by the middle layer of the noise reduction network and the fourth output data output by the classification network. The first loss function is determined according to the first output data and the third output data; the second loss function is determined according to the second output data and the fourth output data; the noise reduction classification network is trained at least according to the first loss function and the second loss function, Until the preset training conditions are met, the target network is obtained. This scheme can enhance the network's ability to suppress local noise and disturbance, and improve the classification and recognition accuracy of the network.

Figure 202011623266

Description

一种模型训练方法及相关装置A model training method and related device

技术领域technical field

本申请涉及人工智能技术领域,尤其涉及一种模型训练方法及相关装置。The present application relates to the technical field of artificial intelligence, and in particular, to a model training method and related devices.

背景技术Background technique

人工智能(artificial intelligence,AI)是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。换句话说,人工智能是计算机科学的一个分支,它企图了解智能的实质,并生产出一种新的能以人类智能相似的方式作出反应的智能机器。人工智能也就是研究各种智能机器的设计原理与实现方法,使机器具有感知、推理与决策的功能。Artificial intelligence (AI) is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that responds in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that the machines have the functions of perception, reasoning and decision-making.

稀疏时序数据是一组按照时间先后顺序进行排列的非稠密数据序列。常见的稀疏时序数据例如包括人体骨骼关键点数据、心电图数据和惯性测量单元(IMU)数据。通过对稀疏时序数据进行分类识别,可以得到有用的信息。例如,基于人体骨骼关键点数据,可以识别得到人体的姿态动作;基于心电图数据,可以诊断得到人体的身体状况;基于可穿戴设备上的IMU数据,可以识别得到人体的运动状态。Sparse time series data is a set of non-dense data sequences arranged in chronological order. Common sparse time series data include, for example, human skeleton keypoint data, electrocardiogram data, and inertial measurement unit (IMU) data. Useful information can be obtained by classifying and identifying sparse time series data. For example, based on the key point data of the human skeleton, the posture and actions of the human body can be identified; based on the electrocardiogram data, the physical condition of the human body can be diagnosed; based on the IMU data on the wearable device, the motion state of the human body can be identified.

在真实环境中,稀疏时序数据通常会受到各种噪声干扰,导致设备采集得到的稀疏时序数据包括有噪声。基于此,相关技术中通常是对稀疏时序数据进行降噪后,再基于原有的分类方法对降噪后的稀疏时序数据进行分类识别。In the real environment, sparse time series data is usually interfered by various kinds of noise, resulting in the sparse time series data collected by the device including noise. Based on this, in the related art, the sparse time series data is usually denoised, and then the denoised sparse time series data is classified and identified based on the original classification method.

然而,相关技术中对有噪声的稀疏时序数据的分类识别精度较低,难以保证稀疏时序数据的正常识别。因此,亟需一种能够有效地对有噪声的稀疏时序数据进行分类识别的方法。However, in the related art, the classification and identification accuracy of noisy sparse time series data is low, and it is difficult to ensure the normal identification of sparse time series data. Therefore, there is an urgent need for a method that can effectively classify and identify noisy sparse time series data.

发明内容SUMMARY OF THE INVENTION

本申请提供了一种模型训练方法及相关装置,在训练降噪分类网络的过程中,基于无噪声数据在降噪分类网络的降噪网络的输出以及噪声数据在该降噪网络的中间层的输出求取第一损失函数,基于无噪声数据和噪声数据在整个降噪分类网络的输出求取第二损失函数,并基于第一损失函数和第二损失函数对降噪分类网络进行训练,以得到目标网络。通过对降噪分类网络进行训练,并基于无噪声数据以及噪声数据在降噪网络的输出以及降噪分类网络的输出来求取损失函数,能够保证降噪目标和分类精度目标一致,并使得网络在降噪阶段能够学习到更完备的全局特征,增强了网络抑制局部噪声和扰动的能力,提高了网络进行分类识别的精度。The present application provides a model training method and related device. In the process of training a noise reduction classification network, the output of the noise reduction network in the noise reduction classification network and the noise data in the middle layer of the noise reduction network are based on the noise-free data. The first loss function is obtained from the output, the second loss function is obtained based on the output of the noise-free data and the noise data in the entire noise reduction classification network, and the noise reduction classification network is trained based on the first loss function and the second loss function. Get the target network. By training the noise reduction classification network, and calculating the loss function based on the noise-free data and the output of the noise reduction network and the output of the noise reduction classification network, the noise reduction target and the classification accuracy target can be guaranteed to be consistent, and the network can be In the noise reduction stage, more complete global features can be learned, which enhances the network's ability to suppress local noise and disturbance, and improves the classification and recognition accuracy of the network.

本申请第一方面提供了一种模型训练方法,该方法包括:终端从包括多个样本对的样本集合中获取样本对,该样本对包括噪声数据和噪声数据对应的无噪声数据,即样本对中的噪声数据去掉噪声后即为该噪声数据对应的无噪声数据。终端将无噪声数据输入降噪分类网络,得到第一输出数据和第二输出数据。其中,降噪分类网络包括降噪网络和分类网络,第一输出数据为降噪网络的输出,第二输出数据为分类网络的输出。终端将噪声数据输入降噪分类网络,得到第三输出数据和第四输出数据。第三输出数据是基于降噪网络的中间层得到的,第四输出数据为分类网络的输出。A first aspect of the present application provides a model training method, the method includes: a terminal acquires a sample pair from a sample set including multiple sample pairs, where the sample pair includes noise data and noise-free data corresponding to the noise data, that is, a sample pair The noise-free data corresponding to the noise data is the noise-free data after removing the noise. The terminal inputs the noise-free data into the noise reduction classification network to obtain the first output data and the second output data. The noise reduction classification network includes a noise reduction network and a classification network, the first output data is the output of the noise reduction network, and the second output data is the output of the classification network. The terminal inputs the noise data into the noise reduction classification network to obtain third output data and fourth output data. The third output data is obtained based on the middle layer of the noise reduction network, and the fourth output data is the output of the classification network.

然后,终端根据第一输出数据和第三输出数据确定第一损失函数,第一损失函数用于表示第一输出数据与第三输出数据之间的差异。通过求取无噪声数据以及噪声数据分别在降噪网络的输出之间的第一损失函数,并基于该第一损失函数对降噪分类网络进行训练,能够使得降噪分类网络在降噪处理阶段学到更接近无噪声数据的全局特征,从而增强降噪网络抑制局部噪声和扰动的能力。Then, the terminal determines a first loss function according to the first output data and the third output data, where the first loss function is used to represent the difference between the first output data and the third output data. By obtaining the first loss function between the noise-free data and the noise data between the outputs of the noise reduction network, and training the noise reduction classification network based on the first loss function, the noise reduction classification network can be made in the noise reduction processing stage. Learn global features that are closer to noise-free data, thereby enhancing the ability of the denoising network to suppress local noise and perturbations.

其次,终端根据第二输出数据和第四输出数据确定第二损失函数,第二损失函数用于表示第二输出数据以及第四输出数据与无噪声数据的真实类别标签之间的差异。例如,通过求取第二输出数据与无噪声数据的真实类别标签的第一差异值与第四输出数据与无噪声数据的真实类别标签的第二差异值之和,来得到第二损失函数。Secondly, the terminal determines a second loss function according to the second output data and the fourth output data, where the second loss function is used to represent the difference between the second output data and the fourth output data and the real class labels of the noise-free data. For example, the second loss function is obtained by calculating the sum of the first difference value of the true class label of the second output data and the noise-free data and the second difference value of the fourth output data and the true class label of the noise-free data.

最后,终端至少根据第一损失函数和第二损失函数,训练降噪分类网络,直至满足预设训练条件,得到目标网络。具体地,终端可以基于第一损失函数和第二损失函数求取总损失函数,终端基于总损失函数对降噪分类网络进行训练该总损失函数可以是第一损失函数与第二损失函数之和,该总损失函数也可以是将第一损失函数与第一比例系数的乘积加上第二损失函数与第二比例系数的乘积所得到的。Finally, the terminal trains the noise reduction classification network at least according to the first loss function and the second loss function, until the preset training conditions are met, and the target network is obtained. Specifically, the terminal may obtain a total loss function based on the first loss function and the second loss function, and the terminal trains the noise reduction classification network based on the total loss function. The total loss function may be the sum of the first loss function and the second loss function , the total loss function may also be obtained by adding the product of the first loss function and the first proportional coefficient to the product of the second loss function and the second proportional coefficient.

本方案中,通过对降噪分类网络进行训练,并基于无噪声数据以及噪声数据在降噪网络的输出以及降噪分类网络的输出来求取损失函数,能够保证降噪目标和分类精度目标一致,并使得网络在降噪阶段能够学习到更完备的全局特征,增强了网络抑制局部噪声和扰动的能力,提高了网络进行分类识别的精度。In this scheme, the noise reduction classification network is trained, and the loss function is calculated based on the noise-free data and the output of the noise reduction network and the output of the noise reduction classification network, which can ensure that the noise reduction target and the classification accuracy target are consistent. , and enables the network to learn more complete global features in the noise reduction stage, enhances the network's ability to suppress local noise and disturbance, and improves the accuracy of the network's classification and recognition.

可选地,在一种可能的实现方式中,降噪网络为自编码器,该自编码器包括编码器和解码器。其中,自编码器也称为自动编码器,是一种人工神经网络,能够通过无监督学习,学到输入数据的高效表示。在实际应用中,通过对自编码器增加约束条件,可以使得自编码器能够对噪声数据实现降噪处理。在自编码器中,编码器用于对输入数据进行压缩编码,解码器则用于对编码器输出的数据进行数据重构,第一输出数据为编码器的输出,第三输出数据是基于编码器的中间层得到的。通过以包括编码器和解码器的自编码器来作为降噪网络,能够减少对现有技术的改动,提高方案的实用性。Optionally, in a possible implementation manner, the noise reduction network is an auto-encoder, and the auto-encoder includes an encoder and a decoder. Among them, the autoencoder, also known as the autoencoder, is an artificial neural network that can learn an efficient representation of the input data through unsupervised learning. In practical applications, by adding constraints to the self-encoder, the self-encoder can perform noise reduction processing on noisy data. In the self-encoder, the encoder is used to compress and encode the input data, and the decoder is used to reconstruct the data output by the encoder. The first output data is the output of the encoder, and the third output data is based on the encoder. obtained from the middle layer. By using an auto-encoder including an encoder and a decoder as the noise reduction network, changes to the prior art can be reduced, and the practicability of the solution can be improved.

可选地,在一种可能的实现方式中,终端将噪声数据输入降噪分类网络,得到第三输出数据,包括:终端将噪声数据输入降噪分类网络,得到降噪网络的中间层输出的特征数据。终端将特征数据划分为多个子特征数据,得到第三输出数据,第三输出数据包括多个子特征数据。终端确定第三输出数据中每个子特征数据与第一输出数据之间的差异值。终端根据每个子特征数据与第一输出数据之间的差异值,确定第一损失函数。Optionally, in a possible implementation manner, the terminal inputs the noise data into the noise reduction classification network, and obtains the third output data, including: the terminal inputs the noise data into the noise reduction classification network, and obtains the output of the middle layer of the noise reduction network. characteristic data. The terminal divides the feature data into multiple sub-feature data to obtain third output data, where the third output data includes multiple sub-feature data. The terminal determines a difference value between each sub-feature data in the third output data and the first output data. The terminal determines the first loss function according to the difference value between each sub-feature data and the first output data.

本方案中,通过将噪声数据在降噪网络的中间层输出的特征数据划分为多个子特征数据,并基于子特征数据与第一输出数据建立损失函数,能够指导降噪网络学习丰富的全局信息,提高降噪网络的降噪效果。In this solution, by dividing the feature data output by the noise data in the middle layer of the noise reduction network into multiple sub-feature data, and establishing a loss function based on the sub-feature data and the first output data, the noise reduction network can be guided to learn rich global information , to improve the noise reduction effect of the noise reduction network.

可选地,在一种可能的实现方式中,终端是按照时间顺序将特征数据均匀地划分为多个子特征数据,得到第三输出数据,其中,多个子特征数据中的每个子特征数据对应的时间段的长度相同,噪声数据为时序数据。Optionally, in a possible implementation manner, the terminal evenly divides the feature data into multiple sub-feature data in chronological order to obtain third output data, wherein each sub-feature data in the multiple sub-feature data corresponds to The lengths of the time periods are the same, and the noise data is time series data.

由于时序数据是连贯的,且相邻的时序数据具有一定的关联性,基于噪声数据对应的局部时序特征与无噪声数据对应的全局时序特征来构造损失函数,能够指导降噪网络学习到更为丰富的全局时序信息,从而增强降噪网络抑制局部噪声和扰动的能力。Since time-series data is coherent and adjacent time-series data has a certain correlation, constructing a loss function based on local time-series features corresponding to noise data and global time-series features corresponding to noise-free data can guide the noise reduction network to learn more Rich global timing information, thereby enhancing the ability of the noise reduction network to suppress local noise and disturbance.

可选地,在一种可能的实现方式中,由于第一输出数据是降噪网络中的编码器所输出的数据,而第三输出数据是降噪网络的编码器的中间层所输出的数据,两者的维度并不相同。因此,在求取第一损失函数之前,可以对第一输出数据和第三输出数据进行维度对齐操作,以使得两者的维度相同,然后再求取两者之间的差异值。Optionally, in a possible implementation manner, since the first output data is the data output by the encoder in the noise reduction network, and the third output data is the data output by the middle layer of the encoder in the noise reduction network. , the two dimensions are not the same. Therefore, before obtaining the first loss function, a dimension alignment operation may be performed on the first output data and the third output data, so that the dimensions of the two are the same, and then the difference value between the two is obtained.

具体地,终端确定第三输出数据中每个子特征数据与第一输出数据之间的差异值,包括:终端分别对第一输出数据和第三输出数据中的每个子特征数据执行维度对齐操作,得到维度对齐的第一输出数据和第三输出数据。终端确定维度对齐的第三输出数据中每个子特征数据与维度对齐的第一输出数据之间的差异值。在实际应用中,终端可以预先构建多个维度对齐子网络,通过将第一输出数据输入其中一个维度对齐子网络,将第三输出数据中的每个子特征数据输入其他对应的维度对齐子网络,得到维度对齐的第一输出数据和第三输出数据。Specifically, the terminal determining a difference value between each sub-feature data in the third output data and the first output data includes: the terminal performs a dimension alignment operation on each sub-feature data in the first output data and the third output data, respectively, Dimensionally aligned first output data and third output data are obtained. The terminal determines a difference value between each sub-feature data in the dimension-aligned third output data and the dimension-aligned first output data. In practical applications, the terminal can construct multiple dimension alignment sub-networks in advance, by inputting the first output data into one of the dimension alignment sub-networks, and inputting each sub-feature data in the third output data into other corresponding dimension alignment sub-networks, Dimensionally aligned first output data and third output data are obtained.

可选地,在一种可能的实现方式中,终端根据第二输出数据和第四输出数据确定第二损失函数,包括:终端确定第二输出数据与无噪声数据的真实类别标签之间的差异,得到第一差异值。终端确定第四输出数据与无噪声数据的真实类别标签之间的差异,得到第二差异值。终端根据第一差异值和第二差异值,获取第二损失函数。其中,第二输出数据为多分类的预测结果,用于表示分类网络预测的结果。Optionally, in a possible implementation manner, the terminal determines the second loss function according to the second output data and the fourth output data, including: the terminal determines the difference between the second output data and the true category labels of the noise-free data. , to get the first difference value. The terminal determines the difference between the fourth output data and the true category label of the noise-free data, and obtains a second difference value. The terminal obtains the second loss function according to the first difference value and the second difference value. Wherein, the second output data is the prediction result of multi-classification, which is used to represent the prediction result of the classification network.

可选地,在一种可能的实现方式中,在降噪分类网络的训练过程中,还可以引入二值分类器,该二值分类器能够基于降噪分类网络所提取的特征,对输入降噪分类网络的数据进行二分类预测,即预测输入降噪分类网络的数据是噪声数据还是无噪声数据。然后,基于二值分类器所输出的二分类结果以及输入数据对应的真实二分类标签,终端确定第三损失函数,该第三损失函数用于与第一损失函数和第二损失函数一并求取总损失函数,即该第三损失函数同样用于降噪分类网络的训练。Optionally, in a possible implementation manner, in the training process of the noise reduction classification network, a binary classifier can also be introduced, and the binary classifier can reduce the input noise based on the features extracted by the noise reduction classification network. Two-class prediction is performed on the data of the noise classification network, that is, to predict whether the data input to the noise reduction classification network is noise data or noise-free data. Then, based on the binary classification result output by the binary classifier and the real binary classification label corresponding to the input data, the terminal determines a third loss function, and the third loss function is used together with the first loss function and the second loss function. The total loss function is obtained, that is, the third loss function is also used for the training of the noise reduction classification network.

具体地,该方法还包括:终端获取第一特征,并根据第一特征预测无噪声数据对应的二分类结果,得到第一预测结果。其中,第一特征是在无噪声数据输入降噪分类网络之后,降噪分类网络中的分类网络提取的。终端获取第二特征,并根据第二特征预测噪声数据对应的二分类结果,得到第二预测结果。第二特征是在噪声数据输入降噪分类网络之后,降噪分类网络中的分类网络提取的。终端根据第一预测结果和无噪声数据的真实二分类标签、第二预测结果和噪声数据的真实二分类标签,确定第三损失函数。终端至少根据第一损失函数、第二损失函数和第三损失函数,训练降噪分类网络。其中,无噪声数据对应的二分类结果为无噪声类型或噪声类型,噪声数据对应的二分类结果为无噪声类型或噪声类型。Specifically, the method further includes: the terminal acquires the first feature, and predicts the second classification result corresponding to the noise-free data according to the first feature, to obtain the first prediction result. The first feature is extracted by the classification network in the noise reduction classification network after the noise-free data is input into the noise reduction classification network. The terminal acquires the second feature, and predicts a binary classification result corresponding to the noise data according to the second feature, to obtain a second prediction result. The second feature is extracted by the classification network in the noise reduction classification network after the noise data is input into the noise reduction classification network. The terminal determines a third loss function according to the first prediction result and the true binary label of the noise-free data, the second prediction result and the true binary label of the noise data. The terminal trains the noise reduction classification network at least according to the first loss function, the second loss function and the third loss function. The binary classification result corresponding to the noise-free data is the noise-free type or the noise type, and the binary classification result corresponding to the noise data is the noise-free type or the noise type.

本方案中,通过在训练阶段引入二值分类器,并且基于降噪分类网络中的分类网络所提取的特征,通过二值分类器来预测输入数据的二分类结果,获得二分类结果对应的损失函数。通过在原有损失函数的基础上,引入二分类结果对应的损失函数,能够引入一个额外的评价维度,使得训练得到的降噪分类网络对于不同类型的输入数据能够有自适应性的降噪分类尺度,提高降噪分类网络的分类精度。In this scheme, a binary classifier is introduced in the training phase, and based on the features extracted by the classification network in the noise reduction classification network, the binary classification result of the input data is predicted by the binary classifier, and the loss corresponding to the binary classification result is obtained. function. By introducing the loss function corresponding to the binary classification result on the basis of the original loss function, an additional evaluation dimension can be introduced, so that the noise reduction classification network obtained by training can have an adaptive noise reduction classification scale for different types of input data. , to improve the classification accuracy of the noise reduction classification network.

可选地,在一种可能的实现方式中,终端至少根据第一损失函数和第二损失函数,训练降噪分类网络,包括:终端至少根据第一损失函数和第二损失函数,通过误差反向传播算法对降噪分类网络的参数进行更新。简单来说,终端可以通过误差反向传播算法,在降噪分类网络的训练过程中修正初始的降噪分类网络中参数的大小,使得降噪分类网络的重建误差损失越来越小。具体地,前向传递输入信号直至输出会产生误差损失,通过反向传播误差损失信息来更新初始的降噪分类网络中的参数,从而使误差损失收敛。Optionally, in a possible implementation manner, the terminal trains the noise reduction classification network at least according to the first loss function and the second loss function, including: the terminal at least according to the first loss function and the second loss function, through the error inverse function. The parameters of the noise reduction classification network are updated by the propagation algorithm. In simple terms, the terminal can correct the size of the parameters in the initial noise reduction classification network through the error back propagation algorithm during the training process of the noise reduction classification network, so that the reconstruction error loss of the noise reduction classification network becomes smaller and smaller. Specifically, forwarding the input signal until the output will generate an error loss, and updating the parameters in the initial noise reduction classification network by back-propagating the error loss information, so that the error loss converges.

可选地,在一种可能的实现方式中,样本对中的噪声数据包括稀疏时序数据,该稀疏时序数据包括骨骼点坐标数据、心电图数据、惯性测量单元数据或故障诊断数据。Optionally, in a possible implementation manner, the noise data in the sample pair includes sparse time series data, where the sparse time series data includes skeleton point coordinate data, electrocardiogram data, inertial measurement unit data or fault diagnosis data.

本申请第二方面提供一种降噪分类方法,该方法包括:获取待分类数据;将所述待分类数据输入目标网络,得到预测结果,所述预测结果为所述待分类数据的分类结果;其中,所述目标网络用于对所述待分类数据进行降噪处理以及分类,所述目标网络是基于第一方面所述的方法训练得到的。A second aspect of the present application provides a noise reduction classification method, the method comprising: obtaining data to be classified; inputting the data to be classified into a target network to obtain a prediction result, where the prediction result is a classification result of the data to be classified; Wherein, the target network is used to perform noise reduction processing and classification on the data to be classified, and the target network is obtained by training based on the method described in the first aspect.

本申请第三方面提供了一种模型训练装置,包括:获取单元和处理单元。所述获取单元,用于获取样本对,所述样本对包括噪声数据和所述噪声数据对应的无噪声数据;所述处理单元,用于将所述无噪声数据输入降噪分类网络,得到第一输出数据和第二输出数据,所述降噪分类网络包括降噪网络和分类网络,所述第一输出数据为所述降噪网络的输出,所述第二输出数据为所述分类网络的输出;所述处理单元,还用于将所述噪声数据输入所述降噪分类网络,得到第三输出数据和第四输出数据,所述第三输出数据是基于所述降噪网络的中间层得到的,所述第四输出数据为所述分类网络的输出;所述处理单元,还用于根据所述第一输出数据和所述第三输出数据确定第一损失函数,所述第一损失函数用于表示所述第一输出数据与所述第三输出数据之间的差异;所述处理单元,还用于根据所述第二输出数据和所述第四输出数据确定第二损失函数,所述第二损失函数用于表示所述第二输出数据以及所述第四输出数据与所述无噪声数据的真实类别标签之间的差异;所述处理单元,还用于至少根据所述第一损失函数和所述第二损失函数,训练所述降噪分类网络,直至满足预设训练条件,得到目标网络。A third aspect of the present application provides a model training apparatus, including: an acquisition unit and a processing unit. The acquisition unit is configured to acquire sample pairs, the sample pairs include noise data and noise-free data corresponding to the noise data; the processing unit is configured to input the noise-free data into a noise reduction classification network to obtain the first an output data and a second output data, the noise reduction classification network includes a noise reduction network and a classification network, the first output data is the output of the noise reduction network, and the second output data is the output of the classification network output; the processing unit is further configured to input the noise data into the noise reduction classification network to obtain third output data and fourth output data, the third output data is based on the middle layer of the noise reduction network obtained, the fourth output data is the output of the classification network; the processing unit is further configured to determine a first loss function according to the first output data and the third output data, the first loss The function is used to represent the difference between the first output data and the third output data; the processing unit is further configured to determine a second loss function according to the second output data and the fourth output data, The second loss function is used to represent the difference between the second output data and the fourth output data and the true class labels of the noise-free data; the processing unit is further configured to at least according to the first A loss function and the second loss function are used to train the noise reduction classification network until the preset training conditions are met, and the target network is obtained.

可选地,在一种可能的实现方式中,所述降噪网络包括编码器和解码器,所述编码器用于对输入数据进行压缩编码,所述解码器用于对所述编码器输出的数据进行数据重构;所述第一输出数据为所述编码器的输出,所述第三输出数据是基于所述编码器的中间层得到的。Optionally, in a possible implementation manner, the noise reduction network includes an encoder and a decoder, the encoder is used to compress and encode the input data, and the decoder is used to compress the data output by the encoder. Perform data reconstruction; the first output data is the output of the encoder, and the third output data is obtained based on the middle layer of the encoder.

可选地,所述处理单元,还用于:将所述噪声数据输入所述降噪分类网络,得到所述降噪网络的中间层输出的特征数据;将所述特征数据划分为多个子特征数据,得到所述第三输出数据,所述第三输出数据包括所述多个子特征数据;确定所述第三输出数据中每个子特征数据与所述第一输出数据之间的差异值;根据所述每个子特征数据与所述第一输出数据之间的差异值,确定所述第一损失函数。Optionally, the processing unit is further configured to: input the noise data into the noise reduction classification network to obtain feature data output by the middle layer of the noise reduction network; divide the feature data into multiple sub-features data to obtain the third output data, where the third output data includes the plurality of sub-feature data; determine the difference value between each sub-feature data in the third output data and the first output data; according to The difference value between each sub-feature data and the first output data determines the first loss function.

可选地,在一种可能的实现方式中,所述处理单元,还用于按照时间顺序将所述特征数据均匀地划分为多个子特征数据,得到所述第三输出数据,所述多个子特征数据中的每个子特征数据对应的时间段的长度相同;其中,所述噪声数据为时序数据。Optionally, in a possible implementation manner, the processing unit is further configured to evenly divide the feature data into multiple sub-feature data in chronological order to obtain the third output data, the multiple sub-feature data The lengths of time periods corresponding to each sub-feature data in the feature data are the same; wherein, the noise data is time series data.

可选地,在一种可能的实现方式中,所述处理单元,还用于:分别对所述第一输出数据和所述第三输出数据中的每个子特征数据执行维度对齐操作,得到维度对齐的第一输出数据和第三输出数据。确定维度对齐的第三输出数据中每个子特征数据与维度对齐的第一输出数据之间的差异值。Optionally, in a possible implementation manner, the processing unit is further configured to: perform a dimension alignment operation on each sub-feature data in the first output data and the third output data, respectively, to obtain a dimension Aligned first output data and third output data. A difference value between each sub-feature data in the dimension-aligned third output data and the dimension-aligned first output data is determined.

可选地,在一种可能的实现方式中,所述处理单元,还用于:确定所述第二输出数据与所述无噪声数据的真实类别标签之间的差异,得到第一差异值;确定所述第四输出数据与所述无噪声数据的真实类别标签之间的差异,得到第二差异值;根据所述第一差异值和所述第二差异值,获取所述第二损失函数;其中,所述第二输出数据为多分类的预测结果,用于表示所述分类网络预测的结果。Optionally, in a possible implementation manner, the processing unit is further configured to: determine the difference between the second output data and the true category label of the noise-free data, and obtain a first difference value; Determine the difference between the fourth output data and the true category label of the noise-free data to obtain a second difference value; obtain the second loss function according to the first difference value and the second difference value ; wherein, the second output data is a multi-classification prediction result, which is used to represent the prediction result of the classification network.

可选地,在一种可能的实现方式中,所述获取单元,还用于获取第一特征,并根据所述第一特征预测所述无噪声数据对应的二分类结果,得到第一预测结果,所述第一特征是在所述无噪声数据输入降噪分类网络之后,所述降噪分类网络中的分类网络提取的;所述获取单元,还用于获取第二特征,并根据所述第二特征预测所述噪声数据对应的二分类结果,得到第二预测结果,所述第二特征是在所述噪声数据输入降噪分类网络之后,所述降噪分类网络中的分类网络提取的;所述处理单元,还用于根据所述第一预测结果和所述无噪声数据的真实二分类标签、所述第二预测结果和所述噪声数据的真实二分类标签,确定第三损失函数;所述处理单元,还用于至少根据所述第一损失函数、所述第二损失函数和所述第三损失函数,训练所述降噪分类网络;其中,所述无噪声数据对应的二分类结果为无噪声类型或噪声类型,所述噪声数据对应的二分类结果为无噪声类型或噪声类型。Optionally, in a possible implementation manner, the obtaining unit is further configured to obtain a first feature, and predict a binary classification result corresponding to the noise-free data according to the first feature, to obtain a first prediction result. , the first feature is extracted by the classification network in the noise reduction classification network after the noise-free data is input into the noise reduction classification network; the obtaining unit is further configured to obtain the second feature, and according to the The second feature predicts the second classification result corresponding to the noise data, and obtains the second prediction result. The second feature is extracted by the classification network in the noise reduction classification network after the noise data is input into the noise reduction classification network. ; The processing unit is also used to determine a third loss function according to the first prediction result and the true binary label of the noise-free data, the second prediction result and the true binary label of the noise data ; The processing unit is further configured to train the noise reduction classification network at least according to the first loss function, the second loss function and the third loss function; wherein, the two corresponding noise-free data The classification result is a noiseless type or a noise type, and the binary classification result corresponding to the noise data is a noiseless type or a noise type.

可选地,在一种可能的实现方式中,至少根据所述第一损失函数和所述第二损失函数,通过误差反向传播算法对所述降噪分类网络的参数进行更新。Optionally, in a possible implementation manner, at least according to the first loss function and the second loss function, the parameters of the noise reduction classification network are updated through an error back-propagation algorithm.

可选地,在一种可能的实现方式中,所述噪声数据包括稀疏时序数据。Optionally, in a possible implementation manner, the noise data includes sparse time series data.

可选地,在一种可能的实现方式中,所述稀疏时序数据包括骨骼点坐标数据、心电图数据、惯性测量单元数据或故障诊断数据。Optionally, in a possible implementation manner, the sparse time series data includes skeletal point coordinate data, electrocardiogram data, inertial measurement unit data or fault diagnosis data.

本申请第四方面提供一种降噪分类装置,该装置包括:获取单元和处理单元。所述获取单元,用于获取待分类数据。所述处理单元,用于将所述待分类数据输入目标网络,得到预测结果,所述预测结果为所述待分类数据的分类结果;其中,所述目标网络用于对所述待分类数据进行降噪处理以及分类,所述目标网络是基于第一方面所述的方法训练得到的。A fourth aspect of the present application provides a noise reduction classification device, which includes: an acquisition unit and a processing unit. The obtaining unit is used to obtain the data to be classified. The processing unit is configured to input the data to be classified into the target network to obtain a prediction result, where the prediction result is the classification result of the data to be classified; wherein, the target network is used to perform the data to be classified. Noise reduction processing and classification, the target network is obtained by training based on the method described in the first aspect.

本申请第五方面提供了一种模型训练装置,可以包括处理器,处理器和存储器耦合,存储器存储有程序指令,当存储器存储的程序指令被处理器执行时实现上述第一方面所述的方法。对于处理器执行第一方面的各个可能实现方式中的步骤,具体均可以参阅第一方面,此处不再赘述。A fifth aspect of the present application provides a model training device, which may include a processor, the processor is coupled to a memory, the memory stores program instructions, and the method described in the first aspect is implemented when the program instructions stored in the memory are executed by the processor . For the steps in each possible implementation manner of the first aspect performed by the processor, reference may be made to the first aspect for details, and details are not repeated here.

本申请第六方面提供了一种降噪分类装置,可以包括处理器,处理器和存储器耦合,存储器存储有程序指令,当存储器存储的程序指令被处理器执行时实现上述第二方面所述的方法。对于处理器执行第二方面的各个可能实现方式中的步骤,具体均可以参阅第二方面,此处不再赘述。A sixth aspect of the present application provides a noise reduction classification device, which may include a processor, the processor is coupled to a memory, the memory stores program instructions, and when the program instructions stored in the memory are executed by the processor, the above-mentioned second aspect is implemented method. For the steps in each possible implementation manner of the second aspect performed by the processor, reference may be made to the second aspect for details, and details are not repeated here.

本申请第七方面提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,当其在计算机上运行时,使得计算机执行上述第一方面或第二方面所述的方法。A seventh aspect of the present application provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when it runs on a computer, causes the computer to execute the first aspect or the second aspect. method.

本申请第八方面提供了一种计算机程序产品,所述计算机程序产品中存储有计算机程序,当其在计算机上运行时,使得计算机执行上述第一方面或第二方面所述的方法。An eighth aspect of the present application provides a computer program product, where a computer program is stored in the computer program product, and when the computer program product runs on a computer, causes the computer to execute the method described in the first aspect or the second aspect.

本申请第九方面提供了一种电路系统,所述电路系统包括处理电路,所述处理电路配置为执行上述第一方面或第二方面所述的方法。A ninth aspect of the present application provides a circuit system, the circuit system includes a processing circuit configured to perform the method of the first aspect or the second aspect.

本申请第十方面提供了一种芯片,包括一个或多个处理器。处理器中的部分或全部用于读取并执行存储器中存储的计算机程序,以执行上述任一方面任意可能的实现方式中的方法。可选地,该芯片该包括存储器,该存储器与该处理器通过电路或电线与存储器连接。可选地,该芯片还包括通信接口,处理器与该通信接口连接。通信接口用于接收需要处理的数据和/或信息,处理器从该通信接口获取该数据和/或信息,并对该数据和/或信息进行处理,并通过该通信接口输出处理结果。该通信接口可以是输入输出接口。本申请提供的方法可以由一个芯片实现,也可以由多个芯片协同实现。A tenth aspect of the present application provides a chip including one or more processors. Part or all of the processor is used to read and execute the computer program stored in the memory to execute the method in any possible implementation of any of the above aspects. Optionally, the chip includes a memory, and the memory and the processor are connected to the memory through a circuit or a wire. Optionally, the chip further includes a communication interface, and the processor is connected to the communication interface. The communication interface is used for receiving data and/or information to be processed, the processor obtains the data and/or information from the communication interface, processes the data and/or information, and outputs the processing result through the communication interface. The communication interface may be an input-output interface. The method provided by the present application may be implemented by one chip, or may be implemented by multiple chips cooperatively.

附图说明Description of drawings

图1为本申请实施例提供的人工智能主体框架的一种结构示意图;1 is a schematic structural diagram of an artificial intelligence main frame provided by an embodiment of the present application;

图2a为本申请实施例提供的一种数据处理系统;Fig. 2a is a kind of data processing system provided by the embodiment of this application;

图2b为本申请实施例提供的另一种数据处理系统;FIG. 2b is another data processing system provided by an embodiment of the present application;

图2c为本申请实施例提供的数据处理的相关设备的示意图;2c is a schematic diagram of a related device for data processing provided by an embodiment of the present application;

图3a为本申请实施例提供的一种系统100架构的示意图;FIG. 3a is a schematic diagram of the architecture of a system 100 provided by an embodiment of the present application;

图3b为本申请实施例提供的一种应用场景的示意图;FIG. 3b is a schematic diagram of an application scenario provided by an embodiment of the present application;

图3c为本申请实施例提供的一种时序数据的具体应用示意图;FIG. 3c is a schematic diagram of a specific application of time series data provided by an embodiment of the present application;

图4为本申请实施例提供的一种模型训练方法的流程示意图;4 is a schematic flowchart of a model training method provided by an embodiment of the present application;

图5为本申请实施例提供的一种降噪分类网络的结构示意图;FIG. 5 is a schematic structural diagram of a noise reduction classification network provided by an embodiment of the present application;

图6为本申请实施例提供的局部-全局特征关联模块和混合分类器的结构示意图;6 is a schematic structural diagram of a local-global feature association module and a hybrid classifier provided by an embodiment of the present application;

图7为本申请实施例提供的一种对降噪分类网络进行训练的流程示意图;FIG. 7 is a schematic flowchart of training a noise reduction classification network according to an embodiment of the present application;

图8为本申请实施例提供的一种生成噪声数据的示意图;FIG. 8 is a schematic diagram of generating noise data according to an embodiment of the present application;

图9a为本申请实施例提供的一种构造局部-全局特征关联损失的流程示意图;9a is a schematic flowchart of constructing a local-global feature association loss provided by an embodiment of the present application;

图9b为本申请实施例提供的一种构造局部-全局特征关联损失和混合分类损失的流程示意图;FIG. 9b is a schematic flowchart of constructing a local-global feature association loss and a mixed classification loss provided by an embodiment of the present application;

图10为本申请实施例提供的现有方案与本申请方案的对比示意图;FIG. 10 is a schematic diagram of the comparison between the existing solution provided by the embodiment of the present application and the solution of the present application;

图11为本申请实施例提供的一种模型训练装置的结构示意图;11 is a schematic structural diagram of a model training apparatus provided by an embodiment of the application;

图12为本申请实施例提供的一种降噪分类装置的结构示意图;12 is a schematic structural diagram of a noise reduction classification device provided by an embodiment of the application;

图13为本申请实施例提供的执行设备的一种结构示意图;13 is a schematic structural diagram of an execution device provided by an embodiment of the present application;

图14为本申请实施例提供的训练设备的一种结构示意图;14 is a schematic structural diagram of a training device provided by an embodiment of the application;

图15为本申请实施例提供的芯片的一种结构示意图。FIG. 15 is a schematic structural diagram of a chip provided by an embodiment of the present application.

具体实施方式Detailed ways

下面结合本发明实施例中的附图对本发明实施例进行描述。本发明的实施方式部分使用的术语仅用于对本发明的具体实施例进行解释,而非旨在限定本发明。The embodiments of the present invention will be described below with reference to the accompanying drawings in the embodiments of the present invention. The terms used in the embodiments of the present invention are only used to explain specific embodiments of the present invention, and are not intended to limit the present invention.

下面结合附图,对本申请的实施例进行描述。本领域普通技术人员可知,随着技术的发展和新场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。The embodiments of the present application will be described below with reference to the accompanying drawings. Those of ordinary skill in the art know that with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的术语在适当情况下可以互换,这仅仅是描述本申请的实施例中对相同属性的对象在描述时所采用的区分方式。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,以便包含一系列单元的过程、方法、系统、产品或设备不必限于那些单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它单元。The terms "first", "second" and the like in the description and claims of the present application and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged under appropriate circumstances, and this is only a distinguishing manner adopted when describing objects with the same attributes in the embodiments of the present application. Furthermore, the terms "comprising" and "having" and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, product or device comprising a series of elements is not necessarily limited to those elements, but may include no explicit or other units inherent to these processes, methods, products, or devices.

首先对人工智能系统总体工作流程进行描述,请参见图1,图1示出的为人工智能主体框架的一种结构示意图,下面从“智能信息链”(水平轴)和“IT价值链”(垂直轴)两个维度对上述人工智能主题框架进行阐述。其中,“智能信息链”反映从数据的获取到处理的一列过程。举例来说,可以是智能信息感知、智能信息表示与形成、智能推理、智能决策、智能执行与输出的一般过程。在这个过程中,数据经历了“数据—信息—知识—智慧”的凝练过程。“IT价值链”从人智能的底层基础设施、信息(提供和处理技术实现)到系统的产业生态过程,反映人工智能为信息技术产业带来的价值。First, the overall workflow of the artificial intelligence system will be described. Please refer to Figure 1. Figure 1 shows a schematic structural diagram of the main frame of artificial intelligence. The above-mentioned artificial intelligence theme framework is explained in two dimensions (vertical axis). Among them, the "intelligent information chain" reflects a series of processes from data acquisition to processing. For example, it can be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output. In this process, data has gone through the process of "data-information-knowledge-wisdom". The "IT value chain" reflects the value brought by artificial intelligence to the information technology industry from the underlying infrastructure of human intelligence, information (providing and processing technology implementation) to the industrial ecological process of the system.

(1)基础设施(1) Infrastructure

基础设施为人工智能系统提供计算能力支持,实现与外部世界的沟通,并通过基础平台实现支撑。通过传感器与外部沟通;计算能力由智能芯片(CPU、NPU、GPU、ASIC、FPGA等硬件加速芯片)提供;基础平台包括分布式计算框架及网络等相关的平台保障和支持,可以包括云存储和计算、互联互通网络等。举例来说,传感器和外部沟通获取数据,这些数据提供给基础平台提供的分布式计算系统中的智能芯片进行计算。The infrastructure provides computing power support for artificial intelligence systems, realizes communication with the outside world, and supports through the basic platform. Communication with the outside world through sensors; computing power is provided by smart chips (hardware acceleration chips such as CPU, NPU, GPU, ASIC, FPGA); the basic platform includes distributed computing framework and network-related platform guarantee and support, which can include cloud storage and computing, interconnection networks, etc. For example, sensors communicate with external parties to obtain data, and these data are provided to the intelligent chips in the distributed computing system provided by the basic platform for calculation.

(2)数据(2) Data

基础设施的上一层的数据用于表示人工智能领域的数据来源。数据涉及到图形、图像、语音、文本,还涉及到传统设备的物联网数据,包括已有系统的业务数据以及力、位移、液位、温度、湿度等感知数据。The data on the upper layer of the infrastructure is used to represent the data sources in the field of artificial intelligence. The data involves graphics, images, voice, and text, as well as IoT data from traditional devices, including business data from existing systems and sensory data such as force, displacement, liquid level, temperature, and humidity.

(3)数据处理(3) Data processing

数据处理通常包括数据训练,机器学习,深度学习,搜索,推理,决策等方式。Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making, etc.

其中,机器学习和深度学习可以对数据进行符号化和形式化的智能信息建模、抽取、预处理、训练等。Among them, machine learning and deep learning can perform symbolic and formalized intelligent information modeling, extraction, preprocessing, training, etc. on data.

推理是指在计算机或智能系统中,模拟人类的智能推理方式,依据推理控制策略,利用形式化的信息进行机器思维和求解问题的过程,典型的功能是搜索与匹配。Reasoning refers to the process of simulating human's intelligent reasoning method in a computer or intelligent system, using formalized information to carry out machine thinking and solving problems according to the reasoning control strategy, and the typical function is search and matching.

决策是指智能信息经过推理后进行决策的过程,通常提供分类、排序、预测等功能。Decision-making refers to the process of making decisions after intelligent information is reasoned, usually providing functions such as classification, sorting, and prediction.

(4)通用能力(4) General ability

对数据经过上面提到的数据处理后,进一步基于数据处理的结果可以形成一些通用的能力,比如可以是算法或者一个通用系统,例如,翻译,文本的分析,计算机视觉的处理,语音识别,图像的识别等等。After the above-mentioned data processing, some general capabilities can be formed based on the results of data processing, such as algorithms or a general system, such as translation, text analysis, computer vision processing, speech recognition, image identification, etc.

(5)智能产品及行业应用(5) Smart products and industry applications

智能产品及行业应用指人工智能系统在各领域的产品和应用,是对人工智能整体解决方案的封装,将智能信息决策产品化、实现落地应用,其应用领域主要包括:智能终端、智能交通、智能医疗、自动驾驶、平安城市等。Intelligent products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of the overall solution of artificial intelligence, and the productization of intelligent information decision-making to achieve landing applications. Its application areas mainly include: intelligent terminals, intelligent transportation, Smart healthcare, autonomous driving, safe city, etc.

接下来介绍几种本申请的应用场景。Next, several application scenarios of the present application are introduced.

图2a为本申请实施例提供的一种数据处理系统,该数据处理系统包括用户设备以及数据处理设备。其中,用户设备包括手机、个人电脑或者信息处理中心等智能终端。用户设备为数据处理的发起端,作为数据降噪分类请求的发起方,通常由用户通过用户设备发起请求。FIG. 2a is a data processing system provided by an embodiment of the present application, where the data processing system includes a user equipment and a data processing device. The user equipment includes smart terminals such as mobile phones, personal computers, or information processing centers. The user equipment is the initiator of data processing, and as the initiator of the data noise reduction classification request, the user usually initiates the request through the user equipment.

上述数据处理设备可以是云服务器、网络服务器、应用服务器以及管理服务器等具有数据处理功能的设备或服务器。数据处理设备通过交互接口接收来自智能终端的数据降噪分类请求,再通过存储数据的存储器以及数据处理的处理器环节进行机器学习,深度学习,搜索,推理,决策等方式的数据处理。数据处理设备中的存储器可以是一个统称,包括本地存储以及存储历史数据的数据库,数据库可以在数据处理设备上,也可以在其它网络服务器上。The above-mentioned data processing device may be a device or server with data processing functions, such as a cloud server, a network server, an application server, and a management server. The data processing equipment receives the data noise reduction classification request from the intelligent terminal through the interactive interface, and then performs data processing in the form of machine learning, deep learning, search, reasoning, decision-making, etc. through the memory for storing data and the processor for data processing. The memory in the data processing device may be a general term, including local storage and a database for storing historical data. The database may be on the data processing device or on other network servers.

在图2a所示的数据处理系统中,用户设备可以接收用户的指令,例如用户设备可以获取用户输入/选择的一组数据,然后向数据处理设备发起请求,使得数据处理设备针对用户设备得到的该数据执行数据降噪分类应用,从而得到针对该数据的对应的处理结果。示在图2a中,数据处理设备可以执行本申请实施例的模型训练方法。In the data processing system shown in FIG. 2a, the user equipment can receive instructions from the user, for example, the user equipment can obtain a set of data input/selected by the user, and then initiate a request to the data processing equipment, so that the data processing equipment can target the data obtained by the user equipment. The data is subjected to a data denoising classification application, thereby obtaining corresponding processing results for the data. As shown in FIG. 2a, the data processing device may execute the model training method of the embodiment of the present application.

图2b为本申请实施例提供的另一种数据处理系统,在图2b中,用户设备直接作为数据处理设备,该用户设备能够直接获取来自用户的输入并直接由用户设备本身的硬件进行处理,具体过程与图2a相似,可参考上面的描述,在此不再赘述。Fig. 2b is another data processing system provided by the embodiment of the application. In Fig. 2b, the user equipment is directly used as a data processing device, and the user equipment can directly obtain the input from the user and directly process it by the hardware of the user equipment itself, The specific process is similar to that of FIG. 2a, and the above description can be referred to, and details are not repeated here.

在图2b所示的数据处理系统中,用户设备可以接收用户的指令,例如用户设备可以获取用户在用户设备中所选择的一张数据,然后再由用户设备自身针对该数据执行数据处理应用,从而得到针对该数据的对应的处理结果。In the data processing system shown in Figure 2b, the user equipment can receive instructions from the user, for example, the user equipment can acquire a piece of data selected by the user in the user equipment, and then the user equipment itself executes a data processing application for the data, Thus, a corresponding processing result for the data is obtained.

在图2b中,用户设备自身就可以执行本申请实施例的模型训练方法。In FIG. 2b, the user equipment itself can execute the model training method of the embodiment of the present application.

图2c是本申请实施例提供的数据处理的相关设备的示意图。FIG. 2c is a schematic diagram of a related device for data processing provided by an embodiment of the present application.

上述图2a和图2b中的用户设备具体可以是图2c中的本地设备301或者本地设备302,图2a中的数据处理设备具体可以是图2c中的执行设备210,其中,数据存储系统250可以存储执行设备210的待处理数据,数据存储系统250可以集成在执行设备210上,也可以设置在云上或其它网络服务器上。The user equipment in the above-mentioned FIGS. 2a and 2b may specifically be the local device 301 or the local device 302 in FIG. 2c, and the data processing device in FIG. 2a may specifically be the execution device 210 in FIG. 2c, wherein the data storage system 250 may be To store the data to be processed by the execution device 210, the data storage system 250 may be integrated on the execution device 210, or may be set on the cloud or other network servers.

图2a和图2b中的处理器可以通过神经网络模型或者其它模型(例如,基于支持向量机的模型)进行数据训练/机器学习/深度学习,并利用数据最终训练或者学习得到的模型针对数据执行数据处理应用,从而得到相应的处理结果。The processors in Figures 2a and 2b may perform data training/machine learning/deep learning through a neural network model or other model (eg, a support vector machine-based model), and use the data to finally train or learn the model to execute against the data Data processing applications to obtain corresponding processing results.

图3a是本申请实施例提供的一种系统100架构的示意图,在图3a中,执行设备110配置输入/输出(input/output,I/O)接口112,用于与外部设备进行数据交互,用户可以通过客户设备140向I/O接口112输入数据,所述输入数据在本申请实施例中可以包括:各个待调度任务、可调用资源以及其他参数。FIG. 3a is a schematic diagram of the architecture of a system 100 provided by an embodiment of the present application. In FIG. 3a, the execution device 110 is configured with an input/output (I/O) interface 112 for performing data interaction with external devices, The user may input data to the I/O interface 112 through the client device 140, and the input data may include: various tasks to be scheduled, callable resources, and other parameters in this embodiment of the present application.

在执行设备110对输入数据进行预处理,或者在执行设备110的计算模块111执行计算等相关的处理(比如进行本申请中神经网络的功能实现)过程中,执行设备110可以调用数据存储系统150中的数据、代码等以用于相应的处理,也可以将相应处理得到的数据、指令等存入数据存储系统150中。When the execution device 110 preprocesses the input data, or the calculation module 111 of the execution device 110 performs computation and other related processing (for example, performing the function realization of the neural network in this application), the execution device 110 may call the data storage system 150 The data, codes, etc. in the corresponding processing can also be stored in the data storage system 150 .

最后,I/O接口112将处理结果返回给客户设备140,从而提供给用户。Finally, the I/O interface 112 returns the processing results to the client device 140 for provision to the user.

值得说明的是,训练设备120可以针对不同的目标或称不同的任务,基于不同的训练数据生成相应的目标模型/规则,该相应的目标模型/规则即可以用于实现上述目标或完成上述任务,从而为用户提供所需的结果。其中,训练数据可以存储在数据库130中,且来自于数据采集设备160采集的训练样本。It is worth noting that the training device 120 can generate corresponding target models/rules based on different training data for different goals or tasks, and the corresponding target models/rules can be used to achieve the above-mentioned goals or complete the above-mentioned tasks. , which provides the user with the desired result. The training data may be stored in the database 130 and come from training samples collected by the data collection device 160 .

在图3a中所示情况下,用户可以手动给定输入数据,该手动给定可以通过I/O接口112提供的界面进行操作。另一种情况下,客户设备140可以自动地向I/O接口112发送输入数据,如果要求客户设备140自动发送输入数据需要获得用户的授权,则用户可以在客户设备140中设置相应权限。用户可以在客户设备140查看执行设备110输出的结果,具体的呈现形式可以是显示、声音、动作等具体方式。客户设备140也可以作为数据采集端,采集如图所示输入I/O接口112的输入数据及输出I/O接口112的输出结果作为新的样本数据,并存入数据库130。当然,也可以不经过客户设备140进行采集,而是由I/O接口112直接将如图所示输入I/O接口112的输入数据及输出I/O接口112的输出结果,作为新的样本数据存入数据库130。In the case shown in FIG. 3 a , the user can manually specify input data, which can be operated through the interface provided by the I/O interface 112 . In another case, the client device 140 can automatically send the input data to the I/O interface 112 . If the user's authorization is required to request the client device 140 to automatically send the input data, the user can set the corresponding permission in the client device 140 . The user can view the result output by the execution device 110 on the client device 140, and the specific presentation form can be a specific manner such as display, sound, and action. The client device 140 can also be used as a data collection terminal to collect the input data of the input I/O interface 112 and the output result of the output I/O interface 112 as new sample data as shown in the figure, and store them in the database 130 . Of course, it is also possible not to collect through the client device 140, but the I/O interface 112 directly uses the input data input into the I/O interface 112 and the output result of the output I/O interface 112 as shown in the figure as a new sample The data is stored in database 130 .

值得注意的是,图3a仅是本申请实施例提供的一种系统架构的示意图,图中所示设备、器件、模块等之间的位置关系不构成任何限制,例如,在图3a中,数据存储系统150相对执行设备110是外部存储器,在其它情况下,也可以将数据存储系统150置于执行设备110中。如图3a所示,可以根据训练设备120训练得到神经网络。It is worth noting that FIG. 3a is only a schematic diagram of a system architecture provided by an embodiment of the present application, and the positional relationship between the devices, devices, modules, etc. shown in the figure does not constitute any limitation. For example, in FIG. 3a, the data The storage system 150 is an external memory relative to the execution device 110 , and in other cases, the data storage system 150 may also be placed in the execution device 110 . As shown in FIG. 3a, the neural network can be obtained by training according to the training device 120.

本申请实施例还提供的一种芯片,该芯片包括神经网络处理器NPU。该芯片可以被设置在如图3a所示的执行设备110中,用以完成计算模块111的计算工作。该芯片也可以被设置在如图3a所示的训练设备120中,用以完成训练设备120的训练工作并输出目标模型/规则。An embodiment of the present application also provides a chip, where the chip includes a neural network processor NPU. The chip can be set in the execution device 110 as shown in FIG. 3 a to complete the calculation work of the calculation module 111 . The chip can also be set in the training device 120 as shown in FIG. 3a to complete the training work of the training device 120 and output the target model/rule.

神经网络处理器NPU,NPU作为协处理器挂载到主中央处理器(centralprocessing unit,CPU)(host CPU)上,由主CPU分配任务。NPU的核心部分为运算电路,控制器控制运算电路提取存储器(权重存储器或输入存储器)中的数据并进行运算。The neural network processor NPU, the NPU is mounted on the main central processing unit (central processing unit, CPU) (host CPU) as a co-processor, and the main CPU assigns tasks. The core part of the NPU is an arithmetic circuit, and the controller controls the arithmetic circuit to extract the data in the memory (weight memory or input memory) and perform operations.

在一些实现中,运算电路内部包括多个处理单元(process engine,PE)。在一些实现中,运算电路是二维脉动阵列。运算电路还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路是通用的矩阵处理器。In some implementations, the arithmetic circuit includes a plurality of process engines (PE) inside. In some implementations, the arithmetic circuit is a two-dimensional systolic array. The arithmetic circuit may also be a one-dimensional systolic array or other electronic circuit capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit is a general-purpose matrix processor.

举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器(accumulator)中。For example, suppose there is an input matrix A, a weight matrix B, and an output matrix C. The operation circuit fetches the data corresponding to the matrix B from the weight memory, and buffers it on each PE in the operation circuit. The arithmetic circuit fetches the data of matrix A from the input memory and performs matrix operation on matrix B, and stores the partial result or final result of the matrix in an accumulator.

向量计算单元可以对运算电路的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。例如,向量计算单元可以用于神经网络中非卷积/非FC层的网络计算,如池化(pooling),批归一化(batch normalization),局部响应归一化(localresponse normalization)等。The vector calculation unit can further process the output of the arithmetic circuit, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison and so on. For example, the vector computing unit can be used for network computation of non-convolutional/non-FC layers in neural networks, such as pooling, batch normalization, local response normalization, etc.

在一些实现中,向量计算单元能将经处理的输出的向量存储到统一缓存器。例如,向量计算单元可以将非线性函数应用到运算电路的输出,例如累加值的向量,用以生成激活值。在一些实现中,向量计算单元生成归一化的值、合并值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路的激活输入,例如用于在神经网络中的后续层中的使用。In some implementations, the vector computation unit can store the processed output vector to a unified buffer. For example, the vector computing unit may apply a nonlinear function to the output of the arithmetic circuit, such as a vector of accumulated values, to generate activation values. In some implementations, the vector computation unit generates normalized values, merged values, or both. In some implementations, the vector of processed outputs can be used as activation input to an operational circuit, such as for use in subsequent layers in a neural network.

统一存储器用于存放输入数据以及输出数据。Unified memory is used to store input data as well as output data.

权重数据直接通过存储单元访问控制器(direct memory access controller,DMAC)将外部存储器中的输入数据搬运到输入存储器和/或统一存储器、将外部存储器中的权重数据存入权重存储器,以及将统一存储器中的数据存入外部存储器。The weight data directly transfers the input data in the external memory to the input memory and/or the unified memory through the memory unit access controller (direct memory access controller, DMAC), stores the weight data in the external memory into the weight memory, and transfers the unified memory store the data in the external memory.

总线接口单元(bus interface unit,BIU),用于通过总线实现主CPU、DMAC和取指存储器之间进行交互。The bus interface unit (bus interface unit, BIU) is used to realize the interaction between the main CPU, the DMAC and the instruction fetch memory through the bus.

与控制器连接的取指存储器(instruction fetch buffer),用于存储控制器使用的指令;The instruction fetch buffer connected to the controller is used to store the instructions used by the controller;

控制器,用于调用指存储器中缓存的指令,实现控制该运算加速器的工作过程。The controller is used for invoking the instructions cached in the memory to realize and control the working process of the operation accelerator.

一般地,统一存储器,输入存储器,权重存储器以及取指存储器均为片上(On-Chip)存储器,外部存储器为该NPU外部的存储器,该外部存储器可以为双倍数据率同步动态随机存储器(double data rate synchronous dynamic random access memory,DDRSDRAM)、高带宽存储器(high bandwidth memory,HBM)或其他可读可写的存储器。Generally, the unified memory, input memory, weight memory and instruction fetch memory are all on-chip memories, and the external memory is the memory outside the NPU, and the external memory can be double data rate synchronous dynamic random access memory (double data rate synchronous random access memory). rate synchronous dynamic random access memory, DDRSDRAM), high bandwidth memory (high bandwidth memory, HBM) or other readable and writable memory.

由于本申请实施例涉及大量神经网络的应用,为了便于理解,下面先对本申请实施例涉及的相关术语及神经网络等相关概念进行介绍。Since the embodiments of the present application involve a large number of neural network applications, for ease of understanding, related terms and neural networks and other related concepts involved in the embodiments of the present application are first introduced below.

(1)神经网络(1) Neural network

神经网络可以是由神经单元组成的,神经单元可以是指以xs和截距1为输入的运算单元,该运算单元的输出可以为:A neural network can be composed of neural units, and a neural unit can refer to an operation unit that takes xs and intercept 1 as inputs, and the output of the operation unit can be:

Figure BDA0002874360460000101
Figure BDA0002874360460000101

其中,s=1、2、……n,n为大于1的自然数,Ws为xs的权重,b为神经单元的偏置。f为神经单元的激活函数(activation functions),用于将非线性特性引入神经网络中,来将神经单元中的输入信号转换为输出信号。该激活函数的输出信号可以作为下一层卷积层的输入。激活函数可以是sigmoid函数。神经网络是将许多个上述单一的神经单元联结在一起形成的网络,即一个神经单元的输出可以是另一个神经单元的输入。每个神经单元的输入可以与前一层的局部接受域相连,来提取局部接受域的特征,局部接受域可以是由若干个神经单元组成的区域。Among them, s=1, 2,...n, n is a natural number greater than 1, Ws is the weight of xs, and b is the bias of the neural unit. f is an activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into an output signal. The output signal of this activation function can be used as the input of the next convolutional layer. The activation function can be a sigmoid function. A neural network is a network formed by connecting many of the above single neural units together, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected with the local receptive field of the previous layer to extract the features of the local receptive field, and the local receptive field can be an area composed of several neural units.

神经网络中的每一层的工作可以用数学表达式

Figure BDA0002874360460000102
来描述:从物理层面神经网络中的每一层的工作可以理解为通过五种对输入空间(输入向量的集合)的操作,完成输入空间到输出空间的变换(即矩阵的行空间到列空间),这五种操作包括:1、升维/降维;2、放大/缩小;3、旋转;4、平移;5、“弯曲”。其中1、2、3的操作由
Figure BDA0002874360460000111
完成,4的操作由+b完成,5的操作则由a()来实现。这里之所以用“空间”二字来表述是因为被分类的对象并不是单个事物,而是一类事物,空间是指这类事物所有个体的集合。其中,W是权重向量,该向量中的每一个值表示该层神经网络中的一个神经元的权重值。该向量W决定着上文所述的输入空间到输出空间的空间变换,即每一层的权重W控制着如何变换空间。训练神经网络的目的,也就是最终得到训练好的神经网络的所有层的权重矩阵(由很多层的向量W形成的权重矩阵)。因此,神经网络的训练过程本质上就是学习控制空间变换的方式,更具体的就是学习权重矩阵。The work of each layer in a neural network can be expressed mathematically
Figure BDA0002874360460000102
To describe: From the physical level, the work of each layer in the neural network can be understood as the transformation from the input space to the output space (that is, the row space of the matrix to the column space) through five operations on the input space (set of input vectors). ), the five operations include: 1. Dimension raising/lowering; 2. Enlarging/reducing; 3. Rotation; 4. Translation; 5. "Bending". Among them, the operations of 1, 2, and 3 are determined by
Figure BDA0002874360460000111
Complete, the operation of 4 is completed by +b, and the operation of 5 is realized by a(). The reason why the word "space" is used here is because the object to be classified is not a single thing, but a type of thing, and space refers to the collection of all individuals of this type of thing. Among them, W is the weight vector, and each value in the vector represents the weight value of a neuron in the neural network of this layer. The vector W determines the space transformation from the input space to the output space described above, that is, the weight W of each layer controls how the space is transformed. The purpose of training the neural network is to finally obtain the weight matrix of all layers of the trained neural network (the weight matrix formed by the vectors W of many layers). Therefore, the training process of the neural network is essentially learning the way to control the spatial transformation, and more specifically, learning the weight matrix.

因为希望神经网络的输出尽可能的接近真正想要预测的值,所以可以通过比较当前网络的预测值和真正想要的目标值,再根据两者之间的差异情况来更新每一层神经网络的权重向量(当然,在第一次更新之前通常会有初始化的过程,即为神经网络中的各层预先配置参数),比如,如果网络的预测值高了,就调整权重向量让它预测低一些,不断的调整,直到神经网络能够预测出真正想要的目标值。因此,就需要预先定义“如何比较预测值和目标值之间的差异”,这便是损失函数(loss function)或目标函数(objective function),它们是用于衡量预测值和目标值的差异的重要方程。其中,以损失函数举例,损失函数的输出值(loss)越高表示差异越大,那么神经网络的训练就变成了尽可能缩小这个loss的过程。Because we want the output of the neural network to be as close as possible to the value you really want to predict, you can compare the predicted value of the current network with the target value you really want, and then update each layer of the neural network according to the difference between the two. (of course, there is usually an initialization process before the first update, that is, pre-configuring parameters for each layer in the neural network), for example, if the predicted value of the network is high, adjust the weight vector to make it predict low Some, keep adjusting until the neural network can predict the real desired target value. Therefore, it is necessary to pre-define "how to compare the difference between the predicted value and the target value", which is the loss function or objective function, which is used to measure the difference between the predicted value and the target value. important equation. Among them, taking the loss function as an example, the higher the output value of the loss function (loss), the greater the difference, then the training of the neural network becomes the process of reducing the loss as much as possible.

(2)反向传播算法(2) Back propagation algorithm

神经网络可以采用误差反向传播(back propagation,BP)算法在训练过程中修正初始的神经网络模型中参数的大小,使得神经网络模型的重建误差损失越来越小。具体地,前向传递输入信号直至输出会产生误差损失,通过反向传播误差损失信息来更新初始的神经网络模型中参数,从而使误差损失收敛。反向传播算法是以误差损失为主导的反向传播运动,旨在得到最优的神经网络模型的参数,例如权重矩阵。The neural network can use the error back propagation (BP) algorithm to correct the size of the parameters in the initial neural network model during the training process, so that the reconstruction error loss of the neural network model becomes smaller and smaller. Specifically, the input signal is passed forward until the output will generate error loss, and the parameters in the initial neural network model are updated by back-propagating the error loss information, so that the error loss converges. The back-propagation algorithm is a back-propagation movement dominated by error loss, aiming to obtain the parameters of the optimal neural network model, such as the weight matrix.

下面从神经网络的训练侧和神经网络的应用侧对本申请提供的方法进行描述。The method provided by the present application will be described below from the training side of the neural network and the application side of the neural network.

本申请实施例提供的神经网络的训练方法,涉及数据的处理,具体可以应用于数据训练、机器学习、深度学习等数据处理方法,对训练数据(如本申请中的样本对)进行符号化和形式化的智能信息建模、抽取、预处理、训练等,最终得到训练好的降噪分类模型;并且,本申请实施例提供的数据降噪分类方法可以运用上述训练好的降噪模型,将输入数据(如本申请中的待处理数据)输入到所述训练好的降噪分类模型中,得到输出数据。需要说明的是,本申请实施例提供的模型训练方法和数据降噪分类方法是基于同一个构思产生的发明,也可以理解为一个系统中的两个部分,或一个整体流程的两个阶段:如模型训练阶段和模型应用阶段。The neural network training method provided in the embodiment of the present application involves data processing, and can be specifically applied to data processing methods such as data training, machine learning, and deep learning, and symbolizes and encodes training data (such as sample pairs in the present application). Formal intelligent information modeling, extraction, preprocessing, training, etc., finally obtain a trained noise reduction classification model; and, the data noise reduction classification method provided in the embodiment of the present application can use the above trained noise reduction model to Input data (such as data to be processed in this application) is input into the trained noise reduction classification model to obtain output data. It should be noted that the model training method and the data noise reduction classification method provided by the embodiments of this application are inventions based on the same concept, and can also be understood as two parts in a system, or two stages of an overall process: Such as model training phase and model application phase.

在日常生活中,稀疏时序数据无处不在。稀疏时序数据是一组按照时间先后顺序进行排列的非稠密数据序列。其中,稀疏时序数据中的稀疏与稠密相对,常见的稠密的数据例如为图像,常见的稀疏时序数据则例如包括体感游戏中多帧输入的人体骨骼点坐标数据,人体心电图数据和IMU获取的姿态数据等。在实际应用中,通过对稀疏时序数据进行分类识别,可以得到大量有用的信息。In daily life, sparse time series data is ubiquitous. Sparse time series data is a set of non-dense data sequences arranged in chronological order. Among them, sparseness in sparse time series data is opposite to denseness. Common dense data are images, for example, common sparse time series data include, for example, coordinate data of human skeleton points input from multiple frames in somatosensory games, human electrocardiogram data and posture obtained by IMU data etc. In practical applications, a large amount of useful information can be obtained by classifying and identifying sparse time series data.

例如,人体骨骼点坐标数据在体感交互领域有着非常广泛的应用。在体感游戏场景中,通常是通过采用体感交互设备获取人体骨骼点坐标数据并识别手部骨骼点来实现双手的虚拟交互。For example, human skeleton point coordinate data has a very wide range of applications in the field of somatosensory interaction. In a somatosensory game scene, the virtual interaction of hands is usually realized by using a somatosensory interaction device to obtain the coordinate data of human skeleton points and identify the skeleton points of the hands.

又例如,人体心电图数据是医生进行心血管疾病诊断的重要依据之一,随着人工智能技术的普及,应用基于大数据的深度学习实现自动化分析诊断可以突破传统统计模型的准确性和应用范围的局限。基于对心电图数据进行分类识别的自动化分析诊断技术可以更加深入地解读患者海量数据以及实现患者的精准分类。For another example, human electrocardiogram data is one of the important basis for doctors to diagnose cardiovascular diseases. With the popularization of artificial intelligence technology, the application of deep learning based on big data to realize automatic analysis and diagnosis can break through the accuracy and application scope of traditional statistical models. limited. The automatic analysis and diagnosis technology based on the classification and identification of ECG data can interpret the massive data of patients more deeply and realize the accurate classification of patients.

再例如,IMU在只能手机、平板电脑等智能终端以及虚拟现实头盔等可穿戴设备上已经非常普及。IMU采集到的IMU数据可以作为人体动作状态识别的重要依据,例如基于智能手环或智能手表上的陀螺仪所采集的IMU数据,可以实现佩戴者运动状态的识别。For another example, IMUs have become very popular in smart terminals such as mobile phones and tablet computers, and wearable devices such as virtual reality helmets. The IMU data collected by the IMU can be used as an important basis for the recognition of human motion status. For example, based on the IMU data collected by the gyroscope on the smart bracelet or smart watch, the wearer's motion status can be recognized.

上述所提及的各类应用场景均建立在能够对时序数据执行分类识别的基础之上,而真实环境中的稀疏时序数据会受到各种噪声干扰,进而导致稀疏时序数据的分类精度出现明显下降。例如,对于人体骨骼点坐标数据,由于身体被遮挡导致人体部分骨骼关键点坐标抖动或者缺失,从而出现动作类别预测错误。对于心电图数据,无论是医院、救护车、飞机、轮船、诊所还是家里,干扰源无处不在。对于IMU数据,IMU常见的系统误差包括有IMU开机后恒定的零偏误差,比例因子误差,不重合及非正交误差,非线性误差和温度误差等误差,这些误差都会不同程度地影响后续的分类识别任务。因此,时序数据降噪在各类应用场景中是一个不容忽视的问题。The various application scenarios mentioned above are based on the ability to perform classification and recognition on time series data, but the sparse time series data in the real environment will be disturbed by various noises, which will lead to a significant decrease in the classification accuracy of the sparse time series data. . For example, for the coordinate data of human skeleton points, due to the occlusion of the body, the coordinates of some key points of the skeleton of the human body are shaken or missing, resulting in wrong action category prediction. When it comes to ECG data, whether it's a hospital, ambulance, airplane, ship, clinic, or home, the source of interference is everywhere. For IMU data, the common system errors of IMU include constant zero bias error after IMU is turned on, scale factor error, misalignment and non-orthogonal error, nonlinear error and temperature error. These errors will affect the follow-up to varying degrees. Classification and recognition tasks. Therefore, time series data noise reduction is a problem that cannot be ignored in various application scenarios.

以人体骨骼点坐标数据为例,基于骨骼点的动作识别方法是以人体骨骼点坐标为直接输入,由于其数据量小,输入数据的语义特征明显,对复杂环境的高鲁棒性等特点,使其在人机交互,智能监控,服务机器人等领域有着广泛的应用。类似于图像处理领域的噪声,用户场景下的骨骼点坐标数据通常会由于遮挡或光照等问题,而出现骨骼关键点缺失或抖动等噪声问题。然而,现有的人体动作识别方法要求输入信息是完整、无缺失的,因此在将上述具有噪声问题的骨骼点坐标数据作为输入时,容易出现人体动作识别错误的现象。Taking the coordinate data of human skeleton points as an example, the action recognition method based on skeleton points takes the coordinates of human skeleton points as the direct input. Due to the small amount of data, the semantic features of the input data are obvious, and it is highly robust to complex environments. It has a wide range of applications in human-computer interaction, intelligent monitoring, service robots and other fields. Similar to the noise in the field of image processing, the coordinate data of skeleton points in the user scene usually have noise problems such as missing or jittering of skeleton key points due to problems such as occlusion or illumination. However, the existing human action recognition methods require the input information to be complete and free of defects. Therefore, when the above-mentioned skeleton point coordinate data with noise problem is used as input, the phenomenon of human action recognition errors is likely to occur.

基于此,相关技术中通常是对稀疏时序数据进行降噪后,再基于原有的分类方法对降噪后的稀疏时序数据进行分类识别。为了实现上述稀疏时序数据的降噪,现有的数据降噪方法通常是通过训练特定的降噪网络来实现稀疏时序数据的降噪。例如,在输入为人体骨骼点坐标数据时,在降噪网络的训练阶段使用保持视觉合理性的平滑损失来引导网络参数的更新,最终得到用于实现数据降噪的网络。一般来说,相关技术中的降噪网络通常是基于数据无位姿歧义、时序平滑和/或保持视觉合理性等方式为目标来实现降噪网络的训练。而对于一个端到端的降噪分类任务来说,其最终的目标是数据的分类精度,因此相关技术中的降噪网络优化目标和最终的分类精度目标之间存着间隙,导致相关技术中对降噪后的稀疏时序数据的分类识别精度较低,难以保证稀疏时序数据的正常识别。Based on this, in the related art, the sparse time series data is usually denoised, and then the denoised sparse time series data is classified and identified based on the original classification method. In order to realize the noise reduction of the sparse time series data, the existing data noise reduction methods usually realize the noise reduction of the sparse time series data by training a specific noise reduction network. For example, when the input is human skeleton point coordinate data, a smooth loss that maintains visual rationality is used in the training phase of the denoising network to guide the update of the network parameters, and finally a network for data denoising is obtained. Generally speaking, the noise reduction network in the related art usually realizes the training of the noise reduction network based on the data without pose ambiguity, time series smoothing, and/or maintaining visual rationality. For an end-to-end noise reduction classification task, the ultimate goal is the classification accuracy of the data. Therefore, there is a gap between the noise reduction network optimization goal and the final classification accuracy goal in the related art. The classification and recognition accuracy of sparse time series data after noise reduction is low, and it is difficult to ensure the normal recognition of sparse time series data.

有鉴于此,本申请实施例提供了一种模型训练方法及相关装置,在训练降噪分类网络的过程中,基于无噪声数据在降噪分类网络的降噪网络的输出以及噪声数据在该降噪网络的中间层的输出求取第一损失函数,基于无噪声数据和噪声数据在整个降噪分类网络的输出求取第二损失函数,并基于第一损失函数和第二损失函数对降噪分类网络进行训练,以得到目标网络。通过对降噪分类网络进行训练,并基于无噪声数据以及噪声数据在降噪网络的输出以及降噪分类网络的输出来求取损失函数,能够保证降噪目标和分类精度目标一致,并使得网络在降噪阶段能够学习到更完备的全局特征,增强了网络抑制局部噪声和扰动的能力,提高了网络对稀疏时序数据进行分类识别的精度。In view of this, the embodiments of the present application provide a model training method and a related device. In the process of training a noise reduction classification network, the output of the noise reduction network of the noise reduction classification network based on the noiseless data and the noise data in the noise reduction classification network. The first loss function is obtained from the output of the middle layer of the noise network, the second loss function is obtained based on the noise-free data and the noise data in the output of the entire noise reduction classification network, and the noise reduction is performed based on the first loss function and the second loss function. The classification network is trained to obtain the target network. By training the noise reduction classification network, and calculating the loss function based on the noise-free data and the output of the noise reduction network and the output of the noise reduction classification network, the noise reduction target and the classification accuracy target can be guaranteed to be consistent, and the network can be In the noise reduction stage, more complete global features can be learned, which enhances the network's ability to suppress local noise and disturbance, and improves the network's accuracy in classifying and identifying sparse time series data.

本申请实施例所提供的模型训练方法可以应用于终端上,该终端为能够执行模型训练的设备。在基于本申请实施例所提供的模型训练方法训练得到目标网络后,终端可以基于该目标网络对获取到的时序数据进行降噪分类。示例性地,该终端例如可以智能电视机、是个人电脑(personal computer,PC)、笔记本电脑、服务器、手机(mobile phone)、平板电脑、移动互联网设备(mobile internet device,MID)、可穿戴设备、虚拟现实(virtua lreality,VR)设备、增强现实(augmented reality,AR)设备、工业控制(industrial control)中的无线终端、无人驾驶(self driving)中的无线终端、远程手术(remotemedicalsurgery)中的无线终端、智能电网(smart grid)中的无线终端、运输安全(transportatio n safety)中的无线终端、智慧城市(smart city)中的无线终端、智慧家庭(smart home)中的无线终端等。该终端可以是运行安卓系统、IOS系统、windows系统以及其他系统的设备。The model training method provided in the embodiment of the present application can be applied to a terminal, where the terminal is a device capable of performing model training. After training the target network based on the model training method provided in the embodiment of the present application, the terminal may perform noise reduction classification on the acquired time series data based on the target network. Exemplarily, the terminal can be, for example, a smart TV, a personal computer (PC), a notebook computer, a server, a mobile phone (mobile phone), a tablet computer, a mobile internet device (MID), or a wearable device. , virtual reality (virtual reality, VR) equipment, augmented reality (augmented reality, AR) equipment, wireless terminals in industrial control (industrial control), wireless terminals in unmanned driving (self driving), in remote surgery (remotemedicalsurgery) wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, etc. The terminal may be a device running an Android system, an IOS system, a windows system, and other systems.

为了便于理解,以下将结合附图对本申请实施例所提供的一个具体的应用场景进行介绍。可以参阅图3b,图3b为本申请实施例提供的一种应用场景的示意图。如图3b所示,一个可能的应用场景为:智能电视机基于人体位姿、头部位姿、眼睛凝视方向、脸部表情、手势动作或语音等时序数据,对用户的意图进行分类识别,并基于分类识别得到的用户的意图,执行相应的操作,从而完成与用户的交互。For ease of understanding, a specific application scenario provided by the embodiments of the present application will be introduced below with reference to the accompanying drawings. Referring to FIG. 3b, FIG. 3b is a schematic diagram of an application scenario provided by an embodiment of the present application. As shown in Figure 3b, a possible application scenario is: the smart TV can classify and identify the user's intention based on time series data such as human body posture, head posture, eye gaze direction, facial expression, gesture action or voice, etc. And based on the user's intention identified by the classification, the corresponding operation is performed to complete the interaction with the user.

可以参阅图3c,图3c为本申请实施例提供的一种时序数据的具体应用示意图。具体来说,在智能电视机上可以安装有摄像头、麦克风等数据采集装置。通过摄像头以及麦克风等数据采集装置,智能电视机能够获取位于智能电视机周围的用户的相关数据。例如,智能电视机通过摄像头获取描述用户手势意图的手部关键点数据、描述用户身体动作意图的人体位姿数据、描述用户凝视方向意图的头部姿态数据和/或描述用户表情意图的脸部关键点数据等时序数据。又例如,智能电视机通过麦克风获取描述用户语音意图的音频数据。此外,智能电视机上还可以设置有通信装置,能够接收外部的数据采集装置所发送的数据。例如,智能电视机上设置有蓝牙模块,能够接收外部的智能手表或智能手环所发送的惯性测量单元数据。基于获取到的用于描述用户意图的时序数据,智能电视机能够通过内置的分类模型,对用户意图进行分类识别,得到用户意图的分类预测结果,从而完成相应的交互响应操作。Referring to FIG. 3c, FIG. 3c is a schematic diagram of a specific application of time series data provided by an embodiment of the present application. Specifically, a data collection device such as a camera and a microphone may be installed on the smart TV. Through data collection devices such as cameras and microphones, the smart TV can obtain relevant data of users located around the smart TV. For example, the smart TV obtains the hand key point data describing the user's gesture intention, the human body pose data describing the user's body movement intention, the head pose data describing the user's gaze direction intention, and/or the face describing the user's expression intention through the camera. Time series data such as key point data. For another example, a smart TV obtains audio data describing the user's voice intention through a microphone. In addition, a communication device may also be provided on the smart TV, which can receive data sent by an external data collection device. For example, a smart TV is provided with a Bluetooth module, which can receive inertial measurement unit data sent by an external smart watch or smart bracelet. Based on the obtained time series data used to describe the user's intention, the smart TV can classify and identify the user's intention through the built-in classification model, obtain the classification and prediction result of the user's intention, and complete the corresponding interactive response operation.

可以理解的是,在实际应用中,智能电视机所获取到的时序数据可以是前述的一种或多种类型的数据,智能电视机能够基于所获取到的一种或多种类型的数据,通过分类模型,对用户意图进行分类识别。简单来说,对于智能电视机中所预置的分类模型来说,分类模型的输入数据可以是一种或多种类型的数据。例如,分类模型的输入数据为上述描述用户凝视方向意图的头部姿态数据以及描述用户手势意图的手部关键点数据这两种数据;又例如,分类模型的输入数据为描述用户语音意图的音频数据这一种数据。在输入数据为多种类型的数据时,分类模型能够基于多种类型的数据的组合,对用户意图进行分类识别,得到用户意图的分类预测结果。It can be understood that, in practical applications, the time series data obtained by the smart TV can be one or more types of data as described above, and the smart TV can, based on the one or more types of data obtained, Through the classification model, the user intent is classified and identified. In short, for the classification model preset in the smart TV, the input data of the classification model can be one or more types of data. For example, the input data of the classification model is the above-mentioned head gesture data describing the user's gaze direction intention and the hand key point data describing the user's gesture intention; another example, the input data of the classification model is the audio describing the user's voice intention. data This kind of data. When the input data is various types of data, the classification model can classify and identify the user's intention based on the combination of the various types of data, and obtain the classification prediction result of the user's intention.

示例性地,在输入数据为描述用户凝视方向意图的头部姿态数据以及描述用户手势意图的手部关键点数据的情况下,当头部姿态数据具体表示为用户凝视方向为智能电视机所在方向且手部关键点数据具体表示为向右挥手时,则分类模型能够预测得到用户意图为切换电视频道。Exemplarily, when the input data are head gesture data describing the user's gaze direction intent and hand key point data describing the user's gesture intent, when the head gesture data is specifically represented as the user's gaze direction is the direction where the smart TV is located. And when the hand key point data is specifically represented as waving to the right, the classification model can predict that the user's intention is to switch TV channels.

可以参阅图4,图4为本申请实施例提供的一种模型训练方法的流程示意图。如图4所示,该模型训练方法包括以下的步骤401-406。Referring to FIG. 4 , FIG. 4 is a schematic flowchart of a model training method provided by an embodiment of the present application. As shown in Figure 4, the model training method includes the following steps 401-406.

步骤401,获取样本对,该样本对包括噪声数据和噪声数据对应的无噪声数据。Step 401: Obtain a sample pair, where the sample pair includes noise data and noise-free data corresponding to the noise data.

本实施例中,终端可以获取到包括多个样本对的样本集合,该样本集合中的每个样本对都包括有一对噪声数据和无噪声数据。其中,样本对中的无噪声数据与噪声数据是对应的,即样本对中的噪声数据去掉噪声后即为该噪声数据对应的无噪声数据,或者说,样本对中的无噪声数据添加噪声后即得到该无噪声数据对应的噪声数据。可选的,该样本对中的噪声数据可以为稀疏时序数据,例如该噪声数据为骨骼点坐标数据、心电图数据、惯性测量单元数据或故障诊断数据。其中,故障诊断数据例如可以为设备运行数据或者电网运行数据,比如电网运行过程中实时产生的电压、电流、频率或波形等数据。In this embodiment, the terminal may acquire a sample set including multiple sample pairs, and each sample pair in the sample set includes a pair of noise data and noise-free data. Among them, the noise-free data in the sample pair corresponds to the noise data, that is, the noise-free data in the sample pair is the noise-free data corresponding to the noise data after the noise is removed. In other words, the noise-free data in the sample pair is added with noise. That is, noise data corresponding to the noise-free data is obtained. Optionally, the noise data in the sample pair may be sparse time series data, for example, the noise data is skeleton point coordinate data, electrocardiogram data, inertial measurement unit data or fault diagnosis data. The fault diagnosis data may be, for example, equipment operation data or power grid operation data, such as data such as voltage, current, frequency, or waveform generated in real time during the operation of the power grid.

示例性地,该样本对中的噪声数据可以是一种或多种类型的数据,例如噪声数据仅为惯性测量单元数据,或者噪声数据为头部姿态数据以及手部关键点数据。为了便于描述,以下将以样本对中的噪声数据为一种类型的数据为例,对本申请实施例的模型训练方法进行介绍。Exemplarily, the noise data in the sample pair may be one or more types of data, for example, the noise data is only inertial measurement unit data, or the noise data is head pose data and hand key point data. For convenience of description, the following will introduce the model training method in the embodiment of the present application by taking the example that the noise data in the sample pair is one type of data.

在实际应用中,终端可以是在获取到无噪声数据之后,在无噪声数据上添加随机的噪声,以得到对应的噪声数据,从而构造得到样本对。在训练过程中,终端可以逐次从样本集合中获取样本对,以实现对降噪分类网络的训练。In practical applications, after acquiring the noise-free data, the terminal may add random noise to the noise-free data to obtain corresponding noise data, thereby constructing a sample pair. During the training process, the terminal can obtain sample pairs from the sample set one by one to realize the training of the noise reduction classification network.

在一个可能的示例中,本实施例中用于执行模型训练方法的终端例如可以为服务器,通过服务器执行图4对应的模型训练方法,得到训练好的模型。然后,训练好的模型可以在智能电视机出厂前部署于智能电视机中;或者,在智能电视机出厂后,智能电视机能够通过网络连接服务器,并且通过下载或更新的方式获得服务器上的训练好的模型,从而实现在智能电视机上部署训练好的模型。In a possible example, the terminal for executing the model training method in this embodiment may be, for example, a server, and the trained model is obtained by executing the model training method corresponding to FIG. 4 by the server. Then, the trained model can be deployed in the smart TV before the smart TV leaves the factory; or, after the smart TV leaves the factory, the smart TV can connect to the server through the network, and obtain the training on the server by downloading or updating. good model, so that the trained model can be deployed on the smart TV.

步骤402,将无噪声数据输入降噪分类网络,得到第一输出数据和第二输出数据。Step 402: Input the noise-free data into the noise reduction classification network to obtain the first output data and the second output data.

本实施例中,降噪分类网络包括降噪网络和分类网络,该降噪网络与该分类网络连接,且该降噪网络的输入即为降噪分类网络的输入,该降噪网络的输出为分类网络的输入。该降噪网络用于对输入降噪分类网络的数据进行降噪处理,得到降噪后的数据。在将无噪声数据输入降噪分类网络之后,可以得到第一输出数据和第二输出数据。其中,该第一输出数据为降噪网络的输出,该第二输出数据为分类网络的输出,即第二输出数据为分类网络所输出的、无噪声数据对应的分类结果。In this embodiment, the noise reduction classification network includes a noise reduction network and a classification network, the noise reduction network is connected to the classification network, the input of the noise reduction network is the input of the noise reduction classification network, and the output of the noise reduction network is Input to the classification network. The noise reduction network is used to perform noise reduction processing on the data input to the noise reduction classification network to obtain the noise reduction data. After inputting the noise-free data into the noise reduction classification network, the first output data and the second output data can be obtained. The first output data is the output of the noise reduction network, and the second output data is the output of the classification network, that is, the second output data is the classification result output by the classification network and corresponding to the noise-free data.

可选的,该降噪网络可以为自编码器,该自编码器包括编码器和解码器。其中,自编码器也称为自动编码器,是一种人工神经网络,能够通过无监督学习,学到输入数据的高效表示。在实际应用中,通过对自编码器增加约束条件,可以使得自编码器能够对噪声数据实现降噪处理。在自编码器中,编码器用于对输入数据进行压缩编码,解码器则用于对编码器输出的数据进行数据重构。通过由自编码器中的编码器对输入数据进行压缩编码,得到输入数据的关键信息,然后由自编码器中的解码器对压缩后的数据进行数据重构,以基于输入数据的关键信息实现输入数据的还原,并且还原后的数据实现了噪声的消除,即基于自编码器能够实现数据的降噪处理。示例性地,编码器和解码器可以是包括有多层卷积层的循环神经网络(Recurrent Neural Network,RNN)。Optionally, the noise reduction network may be an auto-encoder, and the auto-encoder includes an encoder and a decoder. Among them, the autoencoder, also known as the autoencoder, is an artificial neural network that can learn an efficient representation of the input data through unsupervised learning. In practical applications, by adding constraints to the self-encoder, the self-encoder can perform noise reduction processing on noisy data. In an autoencoder, the encoder is used to compress the input data, and the decoder is used to reconstruct the data output by the encoder. The key information of the input data is obtained by compressing and encoding the input data by the encoder in the self-encoder, and then the decoder in the self-encoder reconstructs the compressed data to realize the realization based on the key information of the input data. The input data is restored, and the restored data realizes the elimination of noise, that is, the noise reduction processing of the data can be realized based on the self-encoder. Exemplarily, the encoder and the decoder may be a Recurrent Neural Network (RNN) including multiple convolutional layers.

其中,上述的第一输出数据可以是将无噪声数据输入降噪分类网络之后,由降噪网络中的编码器对无噪声数据进行处理后所得到的输出数据。一般地,由降噪网络中的编码器处理得到的数据也称为内容向量。内容向量是指自编码器中编码器的输出,一般为一组高纬度特征向量。The above-mentioned first output data may be output data obtained after the noise-free data is processed by an encoder in the noise-reduction network after the noise-free data is input into the noise-reduction classification network. In general, the data processed by the encoder in the noise reduction network is also called the content vector. The content vector refers to the output of the encoder in the self-encoder, which is generally a set of high-dimensional feature vectors.

该分类网络用于获取经过降噪网络处理后的数据,并输出输入分类网络的数据所对应的一组概率值向量,向量中的每个元素值为则为输入数据对应类别的概率大小。一般地,概率最高的类别即为输入数据所属的类别。也就是说,分类网络用于对获取到的数据进行分类,得到数据对应的类别。示例性地,在输入降噪分类网络的数据为智能手环所采集的IMU数据时,该分类网络用于在步行、跑步、骑行以及爬阶梯这四个类别中对IMU数据进行分类。例如,在该分类网络输出的概率标签为{0.1,0.7,0.15,0.05}时,可以确定概率为0.7的类别(即跑步)为IMU数据所属的类别。The classification network is used to obtain the data processed by the noise reduction network, and output a set of probability value vectors corresponding to the data input to the classification network, and each element value in the vector is the probability of the corresponding category of the input data. Generally, the category with the highest probability is the category to which the input data belongs. That is to say, the classification network is used to classify the acquired data to obtain the corresponding category of the data. Exemplarily, when the data input to the noise reduction classification network is the IMU data collected by the smart bracelet, the classification network is used to classify the IMU data in four categories of walking, running, cycling, and climbing stairs. For example, when the probability label output by the classification network is {0.1, 0.7, 0.15, 0.05}, it can be determined that the category with probability 0.7 (ie, running) is the category to which the IMU data belongs.

其中,上述的第二输出数据可以是将无噪声数据输入降噪分类网络之后,经过降噪网络和分类网络处理之后,由分类网络所输出的数据。The above-mentioned second output data may be data output by the classification network after the noise-free data is input into the noise reduction classification network and processed by the noise reduction network and the classification network.

步骤403,将噪声数据输入降噪分类网络,得到第三输出数据和第四输出数据,第三输出数据是基于降噪网络的中间层得到的,第四输出数据为分类网络的输出。Step 403: Input the noise data into the noise reduction classification network to obtain third output data and fourth output data, the third output data is obtained based on the middle layer of the noise reduction network, and the fourth output data is the output of the classification network.

本实施例中,在将与上述无噪声数据对应的噪声数据输入降噪分类网络之后,终端可以获取降噪分类网络中的降噪网络的中间层所提取得到的第三输出数据,该第三输出数据为降噪网络的中间层所提取得到的特征数据。此外,终端还可以获取降噪分类网络中的分类网络输出的第四输出数据,该第四输出数据即为该分类网络所输出的、噪声数据对应的分类结果。In this embodiment, after inputting the noise data corresponding to the above noise-free data into the noise reduction classification network, the terminal can obtain the third output data extracted by the middle layer of the noise reduction network in the noise reduction classification network. The output data is the feature data extracted by the middle layer of the noise reduction network. In addition, the terminal may also acquire fourth output data output by the classification network in the noise reduction classification network, where the fourth output data is the classification result output by the classification network and corresponding to the noise data.

可选的,该第三输出数据可以是基于降噪网络中的编码器的中间层得到的。示例性地,该编码器中可以包括一个或多个中间层,终端可以获取编码器中的每个中间层所输出的特征数据,并将这些特征数据作为第三输出数据。例如,该编码器为一个包括三层卷积层的循环神经网络(Recurrent Neural Network,RNN),则该编码器的中间层则为该编码器中的后面两层卷积层,这两层卷积层所输出的数据则为第三输出数据。Optionally, the third output data may be obtained based on an intermediate layer of an encoder in a noise reduction network. Exemplarily, the encoder may include one or more intermediate layers, and the terminal may acquire feature data output by each intermediate layer in the encoder, and use these feature data as third output data. For example, if the encoder is a Recurrent Neural Network (RNN) including three convolutional layers, the middle layer of the encoder is the latter two convolutional layers in the encoder, and the two convolutional layers The data output by the multi-layer is the third output data.

可以理解的是,步骤402和步骤403并无执行顺序上的限定,在实际应用中可以先执行步骤402,也可以是先执行步骤403。本实施例不对步骤402和步骤403的执行顺序做具体限定。It can be understood that there is no limitation on the execution order of steps 402 and 403. In practical applications, step 402 may be executed first, or step 403 may be executed first. This embodiment does not specifically limit the execution order of step 402 and step 403 .

步骤404,根据第一输出数据和第三输出数据确定第一损失函数,该第一损失函数用于表示第一输出数据与第三输出数据之间的差异。Step 404: Determine a first loss function according to the first output data and the third output data, where the first loss function is used to represent the difference between the first output data and the third output data.

由于第一输出数据和第三输出数据都是基于降噪网络得到的,因此在得到第一输出数据和第三输出数据之后,可以基于第一输出数据和第三输出数据确定第一损失函数,以表征第一输出数据和第三输出数据之间的差异。这样,通过求取无噪声数据以及噪声数据分别在降噪网络的输出之间的第一损失函数,并基于该第一损失函数对降噪分类网络进行训练,能够使得降噪分类网络在降噪处理阶段学到更接近无噪声数据的全局特征,从而增强降噪网络抑制局部噪声和扰动的能力。Since both the first output data and the third output data are obtained based on the noise reduction network, after the first output data and the third output data are obtained, the first loss function can be determined based on the first output data and the third output data, to characterize the difference between the first output data and the third output data. In this way, by obtaining the first loss function between the noise-free data and the noise data respectively between the outputs of the noise reduction network, and training the noise reduction classification network based on the first loss function, the noise reduction classification network can be made in the noise reduction network. The processing stage learns global features closer to the noise-free data, thereby enhancing the ability of the denoising network to suppress local noise and perturbations.

可选的,在第三输出数据是基于降噪网络中的编码器的中间层得到的情况下,第三输出数据包括编码器的一个或多个中间层所输出的数据。在这种情况下,可以求取每个中间层所输出的数据与第一输出数据之间的差异值,并且通过求取多个中间层所输出的数据与第一输出数据之间的差异值之和,得到第一损失函数。Optionally, when the third output data is obtained based on an intermediate layer of an encoder in a noise reduction network, the third output data includes data output by one or more intermediate layers of the encoder. In this case, the difference value between the data output by each intermediate layer and the first output data can be obtained, and by obtaining the difference value between the data output by the plurality of intermediate layers and the first output data The sum, the first loss function is obtained.

可选的,在一个可能的实施例中,在步骤403中,终端在将噪声数据输入降噪分类网络,并得到降噪网络的中间层输出的特征数据之后,终端可以将得到的特征数据划分为多个子特征数据,得到第三输出数据,该第三输出数据则包括多个子特征数据。Optionally, in a possible embodiment, in step 403, after the terminal inputs the noise data into the noise reduction classification network, and obtains the feature data output by the middle layer of the noise reduction network, the terminal can divide the obtained feature data into For a plurality of sub-feature data, third output data is obtained, and the third output data includes a plurality of sub-feature data.

示例性地,在噪声数据为稀疏时序数据的情况下,终端可以按照时间顺序将特征数据均匀地划分为多个子特征数据,得到第三输出数据,多个子特征数据中的每个子特征数据对应的时间段的长度相同。例如,在降噪网络的中间层输出的特征数据为T0-T3时间段的数据时,终端可以将该特征数据按照时间顺序划分得到T0-T1时间段的第一子特征数据、T1-T2时间段的第二子特征数据、T2-T3时间段的第三子特征数据,其中,第一子特征数据、第二子特征数据和第三子特征数据对应的时间段的长度相同。Exemplarily, in the case where the noise data is sparse time series data, the terminal may evenly divide the feature data into multiple sub-feature data in chronological order to obtain third output data, where each sub-feature data in the multiple sub-feature data corresponds to The time periods are the same length. For example, when the feature data output by the middle layer of the noise reduction network is the data in the T0-T3 time period, the terminal can divide the feature data in time order to obtain the first sub-feature data in the T0-T1 time period, the T1-T2 time period The second sub-feature data of the segment and the third sub-feature data of the T2-T3 time period, wherein the time segments corresponding to the first sub-feature data, the second sub-feature data, and the third sub-feature data have the same length.

那么,在划分得到多个子特征数据之后,终端求取第三输出数据中每个子特征数据与第一输出数据之间的差异值,并且基于多个子特征数据与第一输出数据之间的差异值之和,确定第一损失函数。这样,通过提取降噪网络中不同的中间层所输出的噪声数据对应的特征数据,并均匀划分得到时序局部特征,以及基于降噪网络所输出的无噪声数据对应的特征数据构造时序全局特征,并基于时序局部特征和时序全局特征构造损失函数,能够引导降噪网络更充分地学习全局时序特征,从而增强降噪网络抑制局部噪声和扰动的能力。Then, after dividing and obtaining multiple sub-feature data, the terminal obtains the difference value between each sub-feature data in the third output data and the first output data, and based on the difference value between the multiple sub-feature data and the first output data The sum determines the first loss function. In this way, by extracting the feature data corresponding to the noise data output by different intermediate layers in the noise reduction network, and evenly dividing the time series local features, and constructing the time series global features based on the feature data corresponding to the noise-free data output by the noise reduction network, The loss function is constructed based on the time-series local features and the time-series global features, which can guide the noise reduction network to learn the global time-series features more fully, thereby enhancing the ability of the noise reduction network to suppress local noise and disturbance.

对于时序数据来说,时序数据是连贯的,且相邻的时序数据具有一定的关联性,基于噪声数据对应的局部时序特征与无噪声数据对应的全局时序特征来构造损失函数,能够指导降噪网络学习到更为丰富的全局时序信息,从而增强降噪网络抑制局部噪声和扰动的能力。例如,在噪声数据为缺失了一小段时间内的数据的时序数据时,基于上述方式来构造损失函数并训练降噪网络,能够使得降噪网络能够基于学习到的全局时序信息,还原得到所缺失的数据,从而能够以较好的降噪效果实现噪声数据的降噪。For time-series data, time-series data is coherent, and adjacent time-series data has a certain correlation. The loss function is constructed based on local time-series features corresponding to noise data and global time-series features corresponding to noise-free data, which can guide noise reduction. The network learns richer global timing information, thereby enhancing the ability of the denoising network to suppress local noise and disturbance. For example, when the noise data is time series data with missing data for a short period of time, constructing the loss function and training the noise reduction network based on the above method can enable the noise reduction network to restore the missing data based on the learned global time series information. Therefore, the noise reduction of noise data can be achieved with a better noise reduction effect.

可选的,在一个可能的实施例中,由于第一输出数据是降噪网络中的编码器所输出的数据,而第三输出数据是降噪网络的编码器的中间层所输出的数据,两者的维度并不相同。因此,在求取第一损失函数之前,可以对第一输出数据和第三输出数据进行维度对齐操作,以使得两者的维度相同,然后再求取两者之间的差异值。Optionally, in a possible embodiment, since the first output data is the data output by the encoder in the noise reduction network, and the third output data is the data output by the middle layer of the encoder in the noise reduction network, The two dimensions are not the same. Therefore, before obtaining the first loss function, a dimension alignment operation may be performed on the first output data and the third output data, so that the dimensions of the two are the same, and then the difference value between the two is obtained.

示例性地,终端分别对第一输出数据和第三输出数据中的每个子特征数据执行维度对齐操作,得到维度对齐的第一输出数据和第三输出数据。具体地,终端可以预先构建多个维度对齐子网络,通过将第一输出数据输入其中一个维度对齐子网络,将第三输出数据中的每个子特征数据输入其他对应的维度对齐子网络,得到维度对齐的第一输出数据和第三输出数据。其中,维度对齐子网络以门控循环单元(gated recurrent unit,GRU)为基本单元,通过多层GRU构成维度对齐子网络。维度对齐子网络能够对输入的数据进行维度的变更。在第三输出数据与第一输出数据的维度对齐后,终端确定维度对齐的第三输出数据中每个子特征数据与维度对齐的第一输出数据之间的差异值。Exemplarily, the terminal performs a dimension alignment operation on each sub-feature data in the first output data and the third output data, respectively, to obtain dimension-aligned first output data and third output data. Specifically, the terminal may construct multiple dimension alignment sub-networks in advance, and input the first output data into one of the dimension alignment sub-networks, and input each sub-feature data in the third output data into other corresponding dimension alignment sub-networks to obtain the dimension Aligned first output data and third output data. Among them, the dimension alignment sub-network takes the gated recurrent unit (GRU) as the basic unit, and constitutes the dimension alignment sub-network through multiple layers of GRUs. The dimension alignment sub-network can change the dimension of the input data. After the dimensions of the third output data and the first output data are aligned, the terminal determines a difference value between each sub-feature data in the dimension-aligned third output data and the dimension-aligned first output data.

示例性地,基于第一输出数据和第三输出数据确定第一损失函数的过程可以如以下的公式1所示。Exemplarily, the process of determining the first loss function based on the first output data and the third output data may be as shown in Equation 1 below.

Figure BDA0002874360460000171
Figure BDA0002874360460000171

其中,

Figure BDA0002874360460000172
表示第一损失函数;l表示编码器的第l层中间层;i表示第i个时序局部特征;log()表示对数函数;exp()表示指数函数;
Figure BDA0002874360460000174
表示对编码器第l层的中间层输出的特征均匀划分后得到的第i个时序局部特征;ρl表示编码器第l层中间层时序局部特征对应的维度对齐子网络;
Figure BDA0002874360460000173
表示编码器输出的内容向量对应的维度对齐子网络,即第一输出数据对应的维度对齐子网络。in,
Figure BDA0002874360460000172
represents the first loss function; l represents the l-th intermediate layer of the encoder; i represents the i-th time series local feature; log() represents the logarithmic function; exp() represents the exponential function;
Figure BDA0002874360460000174
Represents the i-th time series local feature obtained after evenly dividing the features of the intermediate layer output of the lth layer of the encoder;
Figure BDA0002874360460000173
Indicates the dimension alignment sub-network corresponding to the content vector output by the encoder, that is, the dimension alignment sub-network corresponding to the first output data.

具体地,采用GRU为基本单元的维度对齐子网络可以形式化表示为GRU(x,num_layers,out_dim),其中,num_layers为网络层数,out_dim表示期望输出维度。Specifically, the dimension alignment sub-network using GRU as the basic unit can be formally expressed as GRU(x, num_layers, out_dim), where num_layers is the number of network layers, and out_dim represents the desired output dimension.

步骤405,根据第二输出数据和第四输出数据确定第二损失函数,第二损失函数用于表示第二输出数据以及第四输出数据与无噪声数据的真实类别标签之间的差异。Step 405: Determine a second loss function according to the second output data and the fourth output data, where the second loss function is used to represent the difference between the second output data and the fourth output data and the true class labels of the noise-free data.

其中,第二输出数据为将无噪声数据输入降噪分类网络后,降噪分类网络的输出,即降噪分类网络所预测的无噪声数据对应的类别结果。第四输出数据为将噪声数据输入降噪分类网络后,降噪分类网络的输出,即降噪分类网络所预测的噪声数据对应的类别结果。实际上,无噪声数据和噪声数据对应的真实类别标签是相同的,因此,终端可以通过求取第二输出数据与无噪声数据的真实类别标签的第一差异值以及第四输出数据与无噪声数据的真实类别标签的第二差异值来确定第二损失函数。例如,通过求取第二输出数据与无噪声数据的真实类别标签的第一差异值与第四输出数据与无噪声数据的真实类别标签的第二差异值之和,来得到第二损失函数。The second output data is the output of the noise reduction classification network after the noiseless data is input into the noise reduction classification network, that is, the category result corresponding to the noiseless data predicted by the noise reduction classification network. The fourth output data is the output of the noise reduction classification network after the noise data is input into the noise reduction classification network, that is, the category result corresponding to the noise data predicted by the noise reduction classification network. In fact, the real class labels corresponding to the noise-free data and the noise-free data are the same. Therefore, the terminal can obtain the first difference value between the real class labels of the second output data and the noise-free data, and the fourth output data and the noise-free data The second difference value of the true class labels of the data is used to determine the second loss function. For example, the second loss function is obtained by calculating the sum of the first difference value of the true class label of the second output data and the noise-free data and the second difference value of the fourth output data and the true class label of the noise-free data.

以无噪声数据为IMU数据为例,在该IMU数据对应的类别为跑步时,则该IMU数据对应的真实类别标签可以为{0,1,0,0}。其中,真实类别标签中的四个元素值分别表示步行、跑步、骑行以及爬阶梯这四个类别。假设,在将无噪声数据输入降噪分类网络后,所得到的第二输出数据为{0.1,0.7,0.15,0.05}。那么,求取第二输出数据与无噪声数据的真实类别标签的第一差异值的过程实际上就是求取向量{0.1,0.7,0.15,0.05}与向量{0,1,0,0}之间的差异值。Taking the noise-free data as the IMU data as an example, when the category corresponding to the IMU data is running, the true category label corresponding to the IMU data may be {0, 1, 0, 0}. Among them, the four element values in the true category label represent the four categories of walking, running, cycling, and climbing stairs, respectively. Suppose, after inputting the noise-free data into the noise reduction classification network, the obtained second output data is {0.1, 0.7, 0.15, 0.05}. Then, the process of obtaining the first difference value of the real class label between the second output data and the noise-free data is actually to obtain the sum of the vector {0.1,0.7,0.15,0.05} and the vector {0,1,0,0} difference between.

示例性地,基于第二输出数据和第四输出数据确定第二损失函数的过程可以如以下的公式2所示。Exemplarily, the process of determining the second loss function based on the second output data and the fourth output data may be as shown in Equation 2 below.

L2=Lmul(Xnormal)+Lmul(Xnoise) 公式2L 2 =L mul (X normal )+L mul (X noise ) Formula 2

其中,L2表示第二损失函数;Lmul(Xnormal)表示第二输出数据与无噪声数据的真实类别标签之间的交叉熵损失;Lmul(Xnoise)表示第四输出数据与无噪声数据的真实类别标签之间的交叉熵损失。Wherein, L 2 represents the second loss function; L mul (X normal ) represents the cross-entropy loss between the second output data and the true class label of the noise-free data; L mul (X noise ) represents the fourth output data and the noise-free data Cross-entropy loss between the true class labels of the data.

在公式2中,

Figure BDA0002874360460000181
In Equation 2,
Figure BDA0002874360460000181

其中,p(Xnoise)表示输入样本Xnoise的预测类别为ynoise,i的概率。Among them, p(X noise ) represents the probability that the predicted category of the input sample X noise is y noise, i .

在公式2中,

Figure BDA0002874360460000182
In Equation 2,
Figure BDA0002874360460000182

其中,p(Xnormal)表示输入样本Xnormal的预测类别为ynormal,i的概率。Among them, p(X normal ) represents the probability that the predicted category of the input sample X normal is y normal, i .

在实际应用中,除了通过求取交叉熵损失来表示输出数据与真实类别标签的差异值之外,也可以是通过其他的差异度量方式来表示输出数据与真实类别标签的差异值,本实施例并不对此做具体限定。In practical applications, in addition to expressing the difference between the output data and the true category label by calculating the cross entropy loss, other difference measures can also be used to express the difference between the output data and the true category label. This embodiment There is no specific limitation on this.

步骤406,至少根据第一损失函数和第二损失函数,训练降噪分类网络,直至满足预设训练条件,得到目标网络。Step 406, at least according to the first loss function and the second loss function, train the noise reduction classification network until the preset training conditions are met, and the target network is obtained.

在得到第一损失函数和第二损失函数之后,终端可以基于第一损失函数和第二损失函数求取总损失函数,该总损失函数可以是第一损失函数与第二损失函数之和,该总损失函数也可以是将第一损失函数与第一比例系数的乘积加上第二损失函数与第二比例系数的乘积所得到的。在得到总损失函数之后,终端基于总损失函数对降噪分类网络进行训练。其中,终端基于总损失函数对降噪分类网络进行训练的过程包括:终端基于总损失函数的值调整降噪分类网络(包括降噪网络和分类网络)中的参数,并且重复执行步骤401-406,从而实现不断地调整降噪分类网络中的参数,直至求得的总损失函数小于预设阈值,即可确定已满足预设训练条件,得到目标网络。该目标网络即为训练好的降噪分类网络,能够用于后续的数据降噪和分类。After obtaining the first loss function and the second loss function, the terminal may obtain a total loss function based on the first loss function and the second loss function, and the total loss function may be the sum of the first loss function and the second loss function. The total loss function may also be obtained by adding the product of the first loss function and the first scale coefficient to the product of the second loss function and the second scale coefficient. After obtaining the total loss function, the terminal trains the noise reduction classification network based on the total loss function. Wherein, the process that the terminal trains the noise reduction classification network based on the total loss function includes: the terminal adjusts the parameters in the noise reduction classification network (including the noise reduction network and the classification network) based on the value of the total loss function, and repeats steps 401-406 , so as to continuously adjust the parameters in the noise reduction classification network, until the obtained total loss function is less than the preset threshold, it can be determined that the preset training conditions have been met, and the target network can be obtained. The target network is the trained noise reduction classification network, which can be used for subsequent data noise reduction and classification.

可选的,在降噪分类网络的训练过程中,终端可以通过误差反向传播算法对降噪分类网络的参数进行更新。简单来说,终端可以通过误差反向传播算法,在降噪分类网络的训练过程中修正初始的降噪分类网络中参数的大小,使得降噪分类网络的重建误差损失越来越小。具体地,前向传递输入信号直至输出会产生误差损失,通过反向传播误差损失信息来更新初始的降噪分类网络中的参数,从而使误差损失收敛。反向传播算法是以误差损失为主导的反向传播运动,旨在得到最优的神经网络模型的参数,例如权重矩阵。Optionally, in the training process of the noise reduction classification network, the terminal may update the parameters of the noise reduction classification network through the error back propagation algorithm. In simple terms, the terminal can correct the size of the parameters in the initial noise reduction classification network through the error back propagation algorithm during the training process of the noise reduction classification network, so that the reconstruction error loss of the noise reduction classification network becomes smaller and smaller. Specifically, forwarding the input signal until the output will generate an error loss, and updating the parameters in the initial noise reduction classification network by back-propagating the error loss information, so that the error loss converges. The back-propagation algorithm is a back-propagation movement dominated by error loss, aiming to obtain the parameters of the optimal neural network model, such as the weight matrix.

可选的,在一个可能的实施例中,在降噪分类网络的训练过程中,还可以引入二值分类器,该二值分类器能够基于降噪分类网络所提取的特征,对输入降噪分类网络的数据进行二分类预测,即预测输入降噪分类网络的数据是噪声数据还是无噪声数据。简单来说,该二值分类器所输出的二分类结果为一个概率值向量,该向量中包括两个元素值,分别表示输入数据属于无噪声数据类别以及噪声数据类别的概率大小。然后,基于二值分类器所输出的二分类结果以及输入数据对应的真实二分类标签,确定第三损失函数,该第三损失函数用于与第一损失函数和第二损失函数一并求取总损失函数,即该第三损失函数同样用于降噪分类网络的训练。Optionally, in a possible embodiment, in the training process of the noise reduction classification network, a binary classifier may also be introduced, and the binary classifier can denoise the input based on the features extracted by the noise reduction classification network. The data of the classification network is subjected to two-class prediction, that is, to predict whether the data input to the denoising classification network is noise data or noise-free data. In short, the binary classification result output by the binary classifier is a probability value vector, and the vector includes two element values, which respectively represent the probability that the input data belongs to the noise-free data category and the noise data category. Then, based on the binary classification result output by the binary classifier and the real binary classification label corresponding to the input data, a third loss function is determined, and the third loss function is used to calculate the first loss function and the second loss function together. Take the total loss function, that is, the third loss function is also used for the training of the noise reduction classification network.

具体地,终端获取第一特征,并根据第一特征预测无噪声数据对应的二分类结果,得到第一预测结果。其中,第一特征是在无噪声数据输入降噪分类网络之后,降噪分类网络中的分类网络提取的。例如,在无噪声数据输入降噪分类网络之后,降噪分类网络中的分类网络对所输入的数据进行特征提取,并基于提取得到的特征进行多类别预测,以实现对无噪声数据的分类。那么,终端可以通过获取分类网络所提取的特征,得到第一特征。然后,终端将获取到的第一特征输入二值分类器中,以预测得到无噪声数据对应的二分类结果。Specifically, the terminal acquires the first feature, and predicts the binary classification result corresponding to the noise-free data according to the first feature, to obtain the first prediction result. The first feature is extracted by the classification network in the noise reduction classification network after the noise-free data is input into the noise reduction classification network. For example, after the noise-free data is input into the noise reduction classification network, the classification network in the noise reduction classification network performs feature extraction on the input data, and performs multi-class prediction based on the extracted features, so as to realize the classification of the noise-free data. Then, the terminal can obtain the first feature by acquiring the feature extracted by the classification network. Then, the terminal inputs the acquired first feature into a binary classifier to predict a binary classification result corresponding to the noise-free data.

终端获取第二特征,并根据第二特征预测噪声数据对应的二分类结果,得到第二预测结果。其中,第二特征是在噪声数据输入降噪分类网络之后,降噪分类网络中的分类网络提取的。类似地,在噪声数据输入降噪分类网络之后,降噪分类网络中的分类网络对所输入的数据进行特征提取,并基于提取得到的特征进行多类别预测。终端则可以通过获取分类网络所提取的特征,得到第二特征。然后,终端将获取到的第二特征输入二值分类器中,以预测得到噪声数据对应的二分类结果。The terminal acquires the second feature, and predicts a binary classification result corresponding to the noise data according to the second feature, to obtain a second prediction result. The second feature is extracted by the classification network in the noise reduction classification network after the noise data is input into the noise reduction classification network. Similarly, after the noise data is input into the noise reduction classification network, the classification network in the noise reduction classification network performs feature extraction on the input data, and performs multi-class prediction based on the extracted features. The terminal can obtain the second feature by acquiring the feature extracted by the classification network. Then, the terminal inputs the acquired second feature into a binary classifier to predict a binary classification result corresponding to the noise data.

在得到第一预测结果和第二预测结果之后,终端确定第一预测结果和无噪声数据的真实二分类标签之间的第三差异值,以及第二预测结果与噪声数据的真实二分类标签之间的第四差异值,并根据第三差异值和第四差异值确定第三损失函数。After obtaining the first prediction result and the second prediction result, the terminal determines the third difference value between the first prediction result and the true binary label of the noise-free data, and the difference between the second prediction result and the true binary label of the noise data The fourth difference value between the two, and the third loss function is determined according to the third difference value and the fourth difference value.

最终,终端至少根据第一损失函数、第二损失函数和第三损失函数,训练降噪分类网络。其中,该总损失函数可以是第一损失函数、第二损失函数以及第三损失函数之和,该总损失函数也可以是第一损失函数与第一比例系数的乘积、第二损失函数与第二比例系数的乘积以及第三损失函数与第三比例系数之和。在实际应用中,可以根据降噪分类的精度需求,调整第一比例系数、第二比例系数以及第三比例系数,在此不做具体限定。Finally, the terminal trains the noise reduction classification network at least according to the first loss function, the second loss function and the third loss function. The total loss function may be the sum of the first loss function, the second loss function and the third loss function, and the total loss function may also be the product of the first loss function and the first proportional coefficient, the second loss function and the third loss function. The product of the two scale coefficients and the sum of the third loss function and the third scale coefficient. In practical applications, the first proportional coefficient, the second proportional coefficient, and the third proportional coefficient may be adjusted according to the accuracy requirements of noise reduction classification, which are not specifically limited herein.

示例性地,基于第一预测结果和第二预测结果确定第三损失函数的过程可以如以下的公式3所示。Exemplarily, the process of determining the third loss function based on the first prediction result and the second prediction result may be as shown in Formula 3 below.

L3=Lbin(Xnormal)+Lbin(Xnoise) 公式3L 3 =L bin (X normal )+L bin (X noise ) Equation 3

其中,L3表示第三损失函数;Lbin(Xnormal)表示第一预测结果和无噪声数据的真实二分类标签之间的交叉熵损失;Lbin(Xnoise)表示第二预测结果和噪声数据的真实二分类标签之间的交叉熵损失。Among them, L 3 represents the third loss function; L bin (X normal ) represents the cross-entropy loss between the first prediction result and the true binary label of the noise-free data; L bin (X noise ) represents the second prediction result and noise Cross-entropy loss between true binary labels of the data.

在公式3中,

Figure BDA0002874360460000191
In Equation 3,
Figure BDA0002874360460000191

其中,p(Xnormal)表示对应输入Xnormal预测标签为bi的概率,N为batch样本数量。Among them, p(X normal ) represents the probability that the corresponding input X normal predicts the label to be bi , and N is the number of batch samples.

在公式3中,

Figure BDA0002874360460000201
In Equation 3,
Figure BDA0002874360460000201

其中,p(Xnoise)表示对应输入Xnoise预测标签为bi的概率,N为batch样本数量。Among them, p(X noise ) represents the probability that the predicted label corresponding to the input X noise is bi , and N is the number of batch samples.

本实施例中,通过在训练阶段引入二值分类器,并且基于降噪分类网络中的分类网络所提取的特征,通过二值分类器来预测输入数据的二分类结果,获得二分类结果对应的损失函数。通过在原有损失函数的基础上,引入二分类结果对应的损失函数,能够引入一个额外的评价维度,使得训练得到的降噪分类网络对于不同类型的输入数据能够有自适应性的降噪分类尺度,提高降噪分类网络的分类精度。例如,对于无噪声数据以及噪声数据,降噪分类网络能够学习到不同的降噪分类尺度,从而使得无论输入数据是无噪声数据还是噪声数据,训练好的降噪分类网络都能够有较高的降噪分类精度。In this embodiment, a binary classifier is introduced in the training stage, and based on the features extracted by the classification network in the noise reduction classification network, the binary classifier is used to predict the binary classification result of the input data, and the corresponding binary classification result is obtained. loss function. By introducing the loss function corresponding to the binary classification result on the basis of the original loss function, an additional evaluation dimension can be introduced, so that the noise reduction classification network obtained by training can have an adaptive noise reduction classification scale for different types of input data. , to improve the classification accuracy of the noise reduction classification network. For example, for noiseless data and noisy data, the noise reduction classification network can learn different noise reduction classification scales, so that no matter whether the input data is noiseless data or noisy data, the trained noise reduction classification network can have a higher Noise reduction classification accuracy.

为了便于理解,以下将结合具体例子描述本申请实施例所提供的模型训练方法。For ease of understanding, the model training method provided by the embodiments of the present application will be described below with reference to specific examples.

可以参阅图5,图5为本申请实施例提供的一种降噪分类网络的结构示意图。如图5所示,在服务器500上保存有训练集501以及测试集502,且服务器500上还部署有降噪分类网络503。其中,训练集501包括多个样本对,用于训练降噪分类网络503;测试集502同样包括多个样本对,用于检验训练得到的降噪分类网络的性能。Referring to FIG. 5, FIG. 5 is a schematic structural diagram of a noise reduction classification network provided by an embodiment of the present application. As shown in FIG. 5 , a training set 501 and a test set 502 are stored on the server 500 , and a noise reduction classification network 503 is also deployed on the server 500 . The training set 501 includes a plurality of sample pairs for training the noise reduction classification network 503; the test set 502 also includes a plurality of sample pairs for testing the performance of the noise reduction classification network obtained by training.

降噪分类网络503包括有降噪网络5031和分类网络5032。降噪网络5031中包括编码器50311和解码器50312,编码器50311用于对输入数据进行压缩编码,解码器50312则用于对编码器50311输出的数据进行数据重构。基于编码器50311和解码器50312,能够实现输入数据的降噪处理。分类网络5032中包括特征提取模块50321和分类器50322,特征提取模块50321用于对解码器50312所输出的数据进行特征提取,分类器50322则用于基于特征提取模块50321提取得到的特征进行多类别的预测,得到预测结果,即输入降噪分类网络503对应的预测类别。The noise reduction classification network 503 includes a noise reduction network 5031 and a classification network 5032 . The noise reduction network 5031 includes an encoder 50311 and a decoder 50312, the encoder 50311 is used to compress and encode the input data, and the decoder 50312 is used to reconstruct the data output by the encoder 50311. Based on the encoder 50311 and the decoder 50312, noise reduction processing of the input data can be realized. The classification network 5032 includes a feature extraction module 50321 and a classifier 50322. The feature extraction module 50321 is used to perform feature extraction on the data output by the decoder 50312, and the classifier 50322 is used to perform multi-classification based on the features extracted by the feature extraction module 50321. to obtain the prediction result, that is, input the prediction category corresponding to the noise reduction classification network 503 .

此外,为实现降噪分类网络503的训练,服务器500上还部署有局部-全局特征关联模块504和混合分类器505。其中,局部-全局特征关联模块504用于基于无噪声数据在降噪网络5031的输出以及噪声数据在降噪网络5031的输出,求取局部-全局特征关联损失,即上述的第一损失函数。In addition, in order to realize the training of the noise reduction classification network 503 , a local-global feature association module 504 and a hybrid classifier 505 are also deployed on the server 500 . The local-global feature association module 504 is used to obtain the local-global feature association loss based on the output of the noise-free data in the noise reduction network 5031 and the output of the noise data in the noise reduction network 5031, that is, the above-mentioned first loss function.

具体地,可以参阅图6,图6为本申请实施例提供的局部-全局特征关联模块和混合分类器的结构示意图。如图6所示,局部-全局特征关联模块504包括特征划分模块5041和维度对齐子网络5042,特征划分模块5041用于获取噪声数据在编码器50311的中间层对应的输出数据(即特征数据),并且按照时间顺序对获取到的特征数据进行均匀划分,得到子特征数据。维度对齐子网络5042用于对均匀划分得到的子特征数据以及无噪声数据在编码器50311的输出数据进行维度对齐。这样,局部-全局特征关联模块504可以基于维度对齐后的数据求取求取局部-全局特征关联损失,即上述的第一损失函数。Specifically, reference may be made to FIG. 6, which is a schematic structural diagram of a local-global feature association module and a hybrid classifier provided by an embodiment of the present application. As shown in FIG. 6 , the local-global feature association module 504 includes a feature division module 5041 and a dimension alignment sub-network 5042. The feature division module 5041 is used to obtain the output data (ie, feature data) corresponding to the noise data in the middle layer of the encoder 50311. , and evenly divide the acquired feature data in chronological order to obtain sub-feature data. The dimension alignment sub-network 5042 is used to perform dimension alignment on the output data of the encoder 50311 for the sub-feature data obtained by uniform division and the noise-free data. In this way, the local-global feature association module 504 can obtain the local-global feature association loss based on the dimension-aligned data, that is, the above-mentioned first loss function.

混合分类器505则用于基于分类器50322的输出以及降噪分类网络503的原始输入数据对应的真实类别标签,求取多类别分类损失,即上述的第二损失函数。混合分类器505还用于特征划分模块5041的输出以及降噪分类网络503的原始输入数据对应的真实二分类标签,求取二分类损失,即上述的第三损失函数。如图6所示,混合分类器505包括二值分类器5051和多类别分类器5052,二值分类器5051用于求取二分类损失,多类别分类器5052用于求取多类别分类损失。示例性地,二值分类器5051可以是由两层全连接层加softmax层组成的,多类别分类器5052可以是由时空图神经网络构成的人体动作识别(Human ActionRecognition,HAR)分类器。The hybrid classifier 505 is used to obtain the multi-class classification loss based on the output of the classifier 50322 and the real class label corresponding to the original input data of the noise reduction classification network 503, that is, the above-mentioned second loss function. The hybrid classifier 505 is also used for the output of the feature division module 5041 and the real binary classification label corresponding to the original input data of the noise reduction classification network 503 to obtain the binary classification loss, that is, the above-mentioned third loss function. As shown in FIG. 6 , the hybrid classifier 505 includes a binary classifier 5051 and a multi-class classifier 5052. The binary classifier 5051 is used to obtain the binary classification loss, and the multi-class classifier 5052 is used to obtain the multi-class classification loss. Exemplarily, the binary classifier 5051 may be composed of two fully connected layers plus a softmax layer, and the multi-class classifier 5052 may be a Human Action Recognition (HAR) classifier composed of a spatiotemporal graph neural network.

在训练过程中,服务器500基于局部-全局特征关联模块504求得的第一损失函数以及混合分类器505求得的第二损失函数和第三损失函数,通过误差反向传播算法对降噪分类网络503中的参数进行更新,直至满足预设训练条件,得到目标网络。During the training process, the server 500 classifies the noise reduction through the error back propagation algorithm based on the first loss function obtained by the local-global feature association module 504 and the second loss function and the third loss function obtained by the hybrid classifier 505 The parameters in the network 503 are updated until the preset training conditions are met, and the target network is obtained.

以下将基于图5所示的降噪分类网络,详细介绍对降噪分类网络进行训练的过程。可以参阅图7,图7为本申请实施例提供的一种对降噪分类网络进行训练的流程示意图。如图7所示,在实验中,将人体骨骼关键点坐标数据输入降噪分类网络503中,基于局部全局特征关联模块504和混合分类器505得到对应的局部全局特征损失和混合分类损失,并根据局部全局特征损失和混合分类损失计算得到总损失函数。然后,由网络参数更新模块802基于计算得到的总损失函数,采用误差反向传播算法对降噪分类网络503中的降噪网络5031和分类网络5032的参数进行更新,从而实现降噪分类网络503的训练。Based on the noise reduction classification network shown in Figure 5, the following will introduce the process of training the noise reduction classification network in detail. Referring to FIG. 7 , FIG. 7 is a schematic flowchart of training a noise reduction classification network according to an embodiment of the present application. As shown in FIG. 7 , in the experiment, the human skeleton key point coordinate data is input into the noise reduction classification network 503, and the corresponding local global feature loss and mixed classification loss are obtained based on the local global feature association module 504 and the hybrid classifier 505, and The total loss function is calculated from the local global feature loss and the mixed classification loss. Then, based on the calculated total loss function, the network parameter update module 802 uses the error back propagation algorithm to update the parameters of the noise reduction network 5031 and the classification network 5032 in the noise reduction classification network 503, thereby realizing the noise reduction classification network 503 training.

具体地,下面将详细描述对降噪分类网络进行训练的流程。Specifically, the process of training the noise reduction classification network will be described in detail below.

一、在训练开始前,准备训练集和测试集。1. Before training starts, prepare the training set and test set.

在开始训练降噪分类网络之前,需要在服务器上准备好数据集,即训练集和测试集。其中,训练集和测试集均包括多个样本对,每个样本对中包括无噪声数据和噪声数据,且样本对中的无噪声数据和噪声数据均为时序数据。在实际应用中,可以是根据降噪分类网络所应用的场景来准备数据集。例如,在降噪分类网络用于对人体动作分类识别时,则准备由骨骼点坐标数据构成的训练集和测试集。Before starting to train the denoising classification network, you need to prepare the datasets on the server, namely the training set and the test set. The training set and the test set both include multiple sample pairs, each sample pair includes noise-free data and noise data, and the noise-free data and noise data in the sample pair are both time series data. In practical applications, the dataset can be prepared according to the scenario in which the denoising classification network is applied. For example, when the noise reduction classification network is used to classify and recognize human actions, a training set and a test set composed of skeleton point coordinate data are prepared.

具体地,构造训练集和测试集的过程可以如图8所示。图8为本申请实施例提供的一种生成噪声数据的示意图。终端可以是在获取到无噪声数据之后,在无噪声数据上添加随机的噪声,例如不同程度的噪声,以得到对应的噪声数据,从而构造得到样本对。在构造得到多个样本对之后,可以将一部分样本对划分为训练集,另一部分样本对则划分为测试集。其中,训练集和测试集所包括的样本对的比例例如可以为4:1。Specifically, the process of constructing a training set and a test set can be shown in FIG. 8 . FIG. 8 is a schematic diagram of generating noise data according to an embodiment of the present application. After acquiring the noise-free data, the terminal may add random noise, such as noise of different degrees, to the noise-free data to obtain corresponding noise data, thereby constructing a sample pair. After constructing a plurality of sample pairs, a part of the sample pairs can be divided into a training set, and another part of the sample pairs can be divided into a test set. The ratio of sample pairs included in the training set and the test set may be, for example, 4:1.

二、构造局部-全局特征关联损失。Second, construct the local-global feature association loss.

在训练阶段,服务器获取样本对中的噪声数据输入时编码器中间层所输出的特征数据,并且对获取到的特征数据进行均匀划分,得到时序局部特征。服务器还获取样本对中的无噪声数据输入时编码器所输出的内容向量,即时序全局特征。然后,服务器通过特征维度对齐子网络将划分得到的时序局部特征和无噪声数据对应的内容向量进行维度对齐,并构造局部-全局特征关联损失,即上述的第一损失函数。其中,服务器可以是基于上述的公式1来构造局部-全局特征关联损失,具体可以参考上述的公式1。In the training phase, the server obtains the feature data output by the intermediate layer of the encoder when the noise data in the sample pair is input, and divides the obtained feature data evenly to obtain time-series local features. The server also obtains the content vector output by the encoder when the noise-free data in the sample pair is input, that is, the time-series global feature. Then, the server performs dimension alignment on the divided time series local features and the content vector corresponding to the noise-free data through the feature dimension alignment sub-network, and constructs a local-global feature association loss, that is, the above-mentioned first loss function. The server may construct the local-global feature association loss based on the above-mentioned formula 1. For details, please refer to the above-mentioned formula 1.

示例性地,可以参阅图9a,图9a为本申请实施例提供的一种构造局部-全局特征关联损失的流程示意图。如图9a所示,Xnormal表示样本对中的无噪声数据,Xnoise表示样本对中的噪声数据,E1表示编码器,g表示编码器所输出的内容向量,D1表示解码器。在输入无噪声数据之后,服务器获取编码器所输出的内容向量g。在输入噪声数据之后,服务器则获取编码器的中间层所输出的特征数据(即图9a中的划分前的中间层时序特征),并且对获取到的特征数据进行均分划分,得到子特征数据(即图9a中的划分后的中间层时序特征)。然后,服务器基于维度对齐子网络对划分后的中间层时序特征以及内容向量g进行维度对齐,并构造局部-全局特征关联损失。For example, reference may be made to FIG. 9a, which is a schematic flowchart of constructing a local-global feature association loss provided by an embodiment of the present application. As shown in Figure 9a, X normal represents the noise-free data in the sample pair, X noise represents the noise data in the sample pair, E1 represents the encoder, g represents the content vector output by the encoder, and D1 represents the decoder. After inputting noise-free data, the server obtains the content vector g output by the encoder. After inputting the noise data, the server obtains the feature data output by the middle layer of the encoder (that is, the time series feature of the middle layer before division in Figure 9a), and divides the obtained feature data equally to obtain sub-feature data (ie, the divided intermediate layer timing features in Figure 9a). Then, the server performs dimension alignment on the divided intermediate layer timing features and content vector g based on the dimension alignment sub-network, and constructs a local-global feature association loss.

三、构造混合分类损失。Third, construct the mixed classification loss.

服务器所构造的混合分类器包括多类别分类器和二值分类器。对于样本对中的无噪声数据和噪声数据,混合分类器可以分别计算无噪声数据Xnormal和噪声数据Xnoise对应的混合损失,即多类别损失和二分类损失。具体地,服务器计算无噪声数据Xnormal和噪声数据Xnoise对应的混合分类损失的过程可以如以下的公式4和公式5所示。The hybrid classifier constructed by the server includes a multi-class classifier and a binary classifier. For the noise-free data and the noise data in the sample pair, the mixed classifier can calculate the mixed loss corresponding to the noise-free data X normal and the noise data X noise , namely the multi-class loss and the binary classification loss. Specifically, the process for the server to calculate the mixed classification loss corresponding to the noise-free data X normal and the noise data X noise may be shown in the following formula 4 and formula 5.

Lhc1=Lbin(Xnormal)+aLmul(Xnormal) 公式4L hc1 =L bin (X normal )+aL mul (X normal ) Equation 4

Lhc2=Lbin(Xnoise)+αLmul(Xnoise) 公式5L hc2 =L bin (X noise )+αL mul (X noise ) Equation 5

其中,Lhc1为无噪声数据Xnormal对应的混合分类损失;Lhc2为噪声数据Xnoise对应的混合分类损失;Lbin(Xnormal)表示第一预测结果和无噪声数据的真实二分类标签之间的交叉熵损失;α为比例系数;Lbin(Xnoise)表示第二预测结果和噪声数据的真实二分类标签之间的交叉熵损失;Lmul(Xnormal)表示第二输出数据与无噪声数据的真实类别标签之间的交叉熵损失;Lmul(Xnoise)表示第四输出数据与无噪声数据的真实类别标签之间的交叉熵损失。Among them, L hc1 is the mixed classification loss corresponding to the noise-free data X normal ; L hc2 is the mixed classification loss corresponding to the noise-free data X noise ; L bin (X normal ) represents the difference between the first prediction result and the true binary label of the noise-free data α is the scale coefficient; L bin (X noise ) represents the cross entropy loss between the second prediction result and the true binary label of the noise data; L mul (X normal ) represents the second output data and no The cross-entropy loss between the true class labels of the noisy data; L mul (X noise ) represents the cross-entropy loss between the fourth output data and the true class labels of the noise-free data.

可以参阅图9b,图9b为本申请实施例提供的一种构造局部-全局特征关联损失和混合分类损失的流程示意图。Xnormal表示样本对中的无噪声数据,Xnoise表示样本对中的噪声数据,E1表示编码器,g表示编码器所输出的内容向量,D1表示解码器。在输入无噪声数据之后,服务器获取编码器所输出的内容向量g。在输入噪声数据之后,服务器则获取编码器的中间层所输出的特征数据,并且对获取到的特征数据进行均分划分,得到子特征数据

Figure BDA0002874360460000221
然后,服务器基于维度对齐子网络对划分后的中间层时序特征以及内容向量g进行维度对齐,并构造局部-全局特征关联损失Lln。此外,降噪网络对无噪声数据和噪声数据进行降噪处理之后,由分类网络中的特征提取模块继续对降噪网络所输出的数据进行特征提取处理,并且提取得到的特征数据分别输入多类别分类器(binary classifier C1)和二值分类器(HAR classifier C2),以得到无噪声数据混合分类损失Lhc1以及噪声数据对应的混合分类损失Lhc2。Referring to FIG. 9b, FIG. 9b is a schematic flowchart of constructing a local-global feature association loss and a mixed classification loss provided by an embodiment of the present application. X normal represents the noise-free data in the sample pair, X noise represents the noise data in the sample pair, E1 represents the encoder, g represents the content vector output by the encoder, and D1 represents the decoder. After inputting noise-free data, the server obtains the content vector g output by the encoder. After inputting the noise data, the server obtains the feature data output by the middle layer of the encoder, and divides the obtained feature data equally to obtain sub-feature data
Figure BDA0002874360460000221
Then, based on the dimension alignment sub-network, the server performs dimension alignment on the divided intermediate layer timing features and the content vector g, and constructs a local-global feature association loss L ln . In addition, after the noise reduction network performs noise reduction processing on the noise-free data and the noise data, the feature extraction module in the classification network continues to perform feature extraction processing on the data output by the noise reduction network, and the extracted feature data are input into multiple categories respectively. A classifier (binary classifier C1) and a binary classifier (HAR classifier C2) are used to obtain a mixed classification loss L hc1 for noiseless data and a mixed classification loss L hc2 corresponding to noise data.

四、构造整个降噪分类网络的总损失函数,完成降噪分类网络的参数更新。Fourth, construct the total loss function of the entire noise reduction classification network, and complete the parameter update of the noise reduction classification network.

在基于步骤三和步骤四得到局部-全局特征关联损失和混合分类损失之后,服务器以局部-全局特征关联损失和混合分类损失之间的比例和作为整个降噪分类网络的总损失函数,并利用误差反向传播算法完成降噪分类网络的参数更新。其中,整个降噪分类网络的总损失函数可以如以下的公式6所示。After obtaining the local-global feature association loss and the mixed classification loss based on steps 3 and 4, the server takes the ratio between the local-global feature association loss and the mixed classification loss as the total loss function of the entire denoising classification network, and uses The error back-propagation algorithm completes the parameter update of the noise reduction classification network. Among them, the total loss function of the entire noise reduction classification network can be shown in Equation 6 below.

Ltotal=Lln+λ(Lhc1+Lhc2) 公式6L total =L ln +λ(L hc1 +L hc2 ) Equation 6

其中,Ltotal为降噪分类网络的总损失函数;Lln为局部-全局特征关联损失;λ为比例系数;Lhc1为无噪声数据Xnormal对应的混合分类损失;Lhc2为噪声数据Xnoise对应的混合分类损失。Among them, L total is the total loss function of the noise reduction classification network; L ln is the local-global feature association loss; λ is the scale coefficient; L hc1 is the hybrid classification loss corresponding to the noise-free data X normal ; L hc2 is the noise data X noise The corresponding mixed classification loss.

在降噪分类网络训练完毕后,可以将训练得到的目标网络部署于服务器或者智能手机等终端上,以实现时序数据的降噪分类应用。After the training of the noise reduction classification network is completed, the target network obtained by training can be deployed on a terminal such as a server or a smartphone, so as to realize the application of noise reduction classification of time series data.

可以参阅图10,图10为本申请实施例提供的现有方案与本申请方案的对比示意图。如图10所示,图10为现有方案中的分类网络以及采用本申请方法所训练的降噪分类网络的训练情况的对比图。其中,图10中的横坐标表示训练阶段的迭代次数,其单位为103;纵坐标为训练阶段现有方案中的分类网络以及采用本申请方法所训练的降噪分类网络在验证集上的损失函数曲线对比。根据图10可以看出,采用本申请方法所训练的降噪分类网络在迭代次数为20000时,其验证集损失已经低于现有方案中的分类网络。在迭代次数大于40000时,采用本申请方法所训练的降噪分类网络则开始收敛。Referring to FIG. 10 , FIG. 10 is a schematic diagram of a comparison between the existing solution provided by the embodiment of the present application and the solution of the present application. As shown in FIG. 10 , FIG. 10 is a comparison diagram of the training situation of the classification network in the existing solution and the noise reduction classification network trained by the method of the present application. Among them, the abscissa in Figure 10 represents the number of iterations in the training phase, and its unit is 103; the ordinate represents the classification network in the existing scheme in the training phase and the loss of the noise reduction classification network trained by the method of the present application on the validation set function curve comparison. It can be seen from Fig. 10 that when the number of iterations of the noise reduction classification network trained by the method of the present application is 20000, the loss of the validation set is already lower than that of the classification network in the existing scheme. When the number of iterations is greater than 40,000, the noise reduction classification network trained by the method of the present application begins to converge.

可以参阅表1,表1为现有方案中的人体动作分类模型ST-GCN以及采用本申请实施例提供的模型训练方法训练得到的降噪分类网络的分类精度的对比。Please refer to Table 1. Table 1 is a comparison of the classification accuracy of the human action classification model ST-GCN in the existing solution and the noise reduction classification network trained by the model training method provided in the embodiment of the present application.

表1Table 1

噪声级别=0noise level = 0 噪声级别=1noise level = 1 噪声级别=3noise level = 3 噪声级别=5noise level = 5 现有方案Existing program 81.57%81.57% 73.78%73.78% 57.76%57.76% 42.73%42.73% 本申请方案This application plan 84.49%84.49% 84.11%84.11% 83.28%83.28% 82.20%82.20%

在表1中,噪声级别n(n=0,1,3,5)表示在正常的人体骨骼点坐标数据中的每帧骨骼点上随机选取n个骨骼关节并添加随机的空间平移噪声。其中,添加噪声后的骨骼点空间坐标被限制在正常骨骼点空间坐标所确定的最小包围盒内。在噪声级别=0时,采用本申请实施例提供的模型训练方法训练得到的降噪分类网络能够起到数据增强的作用,可提升模型分类精度。随着噪声级别增大,本申请方案的降噪分类网络和现有方案中的分类网络的差距也逐渐增大。In Table 1, the noise level n (n=0, 1, 3, 5) indicates that n bone joints are randomly selected on each frame of bone points in the normal human bone point coordinate data and random spatial translation noise is added. Among them, the spatial coordinates of the skeleton points after adding noise are limited to the minimum bounding box determined by the spatial coordinates of the normal skeleton points. When the noise level=0, the noise reduction classification network trained by using the model training method provided in the embodiment of the present application can play a role of data enhancement, and can improve the classification accuracy of the model. As the noise level increases, the gap between the noise reduction classification network of the solution of the present application and the classification network of the existing solution also gradually increases.

本申请实施例还提供一种降噪分类方法,该方法包括:获取待分类数据;将所述待分类数据输入目标网络,得到预测结果,所述预测结果为所述待分类数据的分类结果。所述待分类数据包括稀疏时序数据,该稀疏时序数据包括骨骼点坐标数据、心电图数据、惯性测量单元数据或故障诊断数据。其中,所述目标网络用于对所述待分类数据进行降噪处理以及分类,所述目标网络是基于以上实施例所述的模型训练方法训练得到的,具体可以参阅上述实施例的介绍,在此不再赘述。可选的,所述目标网络可以是部署于智能电视机上,用于对智能电视机所获取到的数据进行降噪分类,以得到分类预测结果,该分类预测结果具体用于表示用户意图。这样,智能电视机能够基于得到的分类预测结果,执行与用户意图相关的交互响应操作,例如执行切换频道操作。The embodiment of the present application further provides a noise reduction classification method, the method includes: acquiring data to be classified; inputting the data to be classified into a target network to obtain a prediction result, where the prediction result is a classification result of the data to be classified. The data to be classified includes sparse time series data, and the sparse time series data includes skeleton point coordinate data, electrocardiogram data, inertial measurement unit data or fault diagnosis data. Wherein, the target network is used to perform noise reduction processing and classification on the data to be classified, and the target network is obtained by training based on the model training method described in the above embodiment. For details, please refer to the introduction of the above embodiment. This will not be repeated here. Optionally, the target network may be deployed on a smart TV to perform noise reduction classification on the data obtained by the smart TV to obtain a classification prediction result, where the classification prediction result is specifically used to represent the user's intention. In this way, the smart TV can perform an interactive response operation related to the user's intention based on the obtained classification prediction result, for example, perform a channel switching operation.

以上描述了本申请实施例所提供的模型训练方法以及降噪分类方法,以下将介绍用于执行以上实施例所提及的方法的设备。The model training method and the noise reduction classification method provided by the embodiments of the present application have been described above, and a device for executing the methods mentioned in the above embodiments will be introduced below.

可以参阅图11,图11为本申请实施例提供的一种模型训练装置的结构示意图。如图11所示,该模型训练装置包括:获取单元1101和处理单元1102。所述获取单元1101,用于获取样本对,所述样本对包括噪声数据和所述噪声数据对应的无噪声数据;所述处理单元1102,用于将所述无噪声数据输入降噪分类网络,得到第一输出数据和第二输出数据,所述降噪分类网络包括降噪网络和分类网络,所述第一输出数据为所述降噪网络的输出,所述第二输出数据为所述分类网络的输出;所述处理单元1102,还用于将所述噪声数据输入所述降噪分类网络,得到第三输出数据和第四输出数据,所述第三输出数据是基于所述降噪网络的中间层得到的,所述第四输出数据为所述分类网络的输出;所述处理单元1102,还用于根据所述第一输出数据和所述第三输出数据确定第一损失函数,所述第一损失函数用于表示所述第一输出数据与所述第三输出数据之间的差异;所述处理单元1102,还用于根据所述第二输出数据和所述第四输出数据确定第二损失函数,所述第二损失函数用于表示所述第二输出数据以及所述第四输出数据与所述无噪声数据的真实类别标签之间的差异;所述处理单元1102,还用于至少根据所述第一损失函数和所述第二损失函数,训练所述降噪分类网络,直至满足预设训练条件,得到目标网络。Referring to FIG. 11 , FIG. 11 is a schematic structural diagram of a model training apparatus provided by an embodiment of the present application. As shown in FIG. 11 , the model training apparatus includes: an acquisition unit 1101 and a processing unit 1102 . The obtaining unit 1101 is configured to obtain sample pairs, and the sample pairs include noise data and noise-free data corresponding to the noise data; the processing unit 1102 is configured to input the noise-free data into the noise reduction classification network, Obtain first output data and second output data, the noise reduction classification network includes a noise reduction network and a classification network, the first output data is the output of the noise reduction network, and the second output data is the classification The output of the network; the processing unit 1102 is further configured to input the noise data into the noise reduction classification network to obtain third output data and fourth output data, the third output data is based on the noise reduction network The fourth output data is the output of the classification network; the processing unit 1102 is further configured to determine a first loss function according to the first output data and the third output data, so The first loss function is used to represent the difference between the first output data and the third output data; the processing unit 1102 is further configured to determine according to the second output data and the fourth output data a second loss function, where the second loss function is used to represent the difference between the second output data and the fourth output data and the true class label of the noise-free data; the processing unit 1102 further uses The noise reduction classification network is trained according to at least the first loss function and the second loss function until a preset training condition is met, and a target network is obtained.

可选地,在一种可能的实现方式中,所述降噪网络包括编码器和解码器,所述编码器用于对输入数据进行压缩编码,所述解码器用于对所述编码器输出的数据进行数据重构;所述第一输出数据为所述编码器的输出,所述第三输出数据是基于所述编码器的中间层得到的。Optionally, in a possible implementation manner, the noise reduction network includes an encoder and a decoder, the encoder is used to compress and encode the input data, and the decoder is used to compress the data output by the encoder. Perform data reconstruction; the first output data is the output of the encoder, and the third output data is obtained based on the middle layer of the encoder.

可选地,所述处理单元1102,还用于:将所述噪声数据输入所述降噪分类网络,得到所述降噪网络的中间层输出的特征数据;将所述特征数据划分为多个子特征数据,得到所述第三输出数据,所述第三输出数据包括所述多个子特征数据;确定所述第三输出数据中每个子特征数据与所述第一输出数据之间的差异值;根据所述每个子特征数据与所述第一输出数据之间的差异值,确定所述第一损失函数。Optionally, the processing unit 1102 is further configured to: input the noise data into the noise reduction classification network to obtain feature data output by the middle layer of the noise reduction network; divide the feature data into multiple subsections feature data, to obtain the third output data, the third output data includes the plurality of sub-feature data; determine the difference value between each sub-feature data in the third output data and the first output data; The first loss function is determined according to the difference value between each sub-feature data and the first output data.

可选地,在一种可能的实现方式中,所述处理单元1102,还用于按照时间顺序将所述特征数据均匀地划分为多个子特征数据,得到所述第三输出数据,所述多个子特征数据中的每个子特征数据对应的时间段的长度相同;其中,所述噪声数据为时序数据。Optionally, in a possible implementation manner, the processing unit 1102 is further configured to evenly divide the feature data into multiple sub-feature data in chronological order to obtain the third output data, the multiple The lengths of time periods corresponding to each sub-feature data in the pieces of sub-feature data are the same; wherein, the noise data is time series data.

可选地,在一种可能的实现方式中,所述处理单元1102,还用于:分别对所述第一输出数据和所述第三输出数据中的每个子特征数据执行维度对齐操作,得到维度对齐的第一输出数据和第三输出数据。确定维度对齐的第三输出数据中每个子特征数据与维度对齐的第一输出数据之间的差异值。Optionally, in a possible implementation manner, the processing unit 1102 is further configured to: perform a dimension alignment operation on each sub-feature data in the first output data and the third output data, respectively, to obtain Dimensionally aligned first output data and third output data. A difference value between each sub-feature data in the dimension-aligned third output data and the dimension-aligned first output data is determined.

可选地,在一种可能的实现方式中,所述处理单元1102,还用于:确定所述第二输出数据与所述无噪声数据的真实类别标签之间的差异,得到第一差异值;确定所述第四输出数据与所述无噪声数据的真实类别标签之间的差异,得到第二差异值;根据所述第一差异值和所述第二差异值,获取所述第二损失函数;其中,所述第二输出数据为多分类的预测结果,用于表示所述分类网络预测的结果。Optionally, in a possible implementation manner, the processing unit 1102 is further configured to: determine the difference between the second output data and the true category label of the noise-free data, and obtain a first difference value ; Determine the difference between the true category label of the fourth output data and the noise-free data, and obtain a second difference value; Obtain the second loss according to the first difference value and the second difference value function; wherein, the second output data is a multi-classification prediction result, which is used to represent the prediction result of the classification network.

可选地,在一种可能的实现方式中,所述获取单元1101,还用于获取第一特征,并根据所述第一特征预测所述无噪声数据对应的二分类结果,得到第一预测结果,所述第一特征是在所述无噪声数据输入降噪分类网络之后,所述降噪分类网络中的分类网络提取的;所述获取单元1101,还用于获取第二特征,并根据所述第二特征预测所述噪声数据对应的二分类结果,得到第二预测结果,所述第二特征是在所述噪声数据输入降噪分类网络之后,所述降噪分类网络中的分类网络提取的;所述处理单元1102,还用于根据所述第一预测结果和所述无噪声数据的真实二分类标签、所述第二预测结果和所述噪声数据的真实二分类标签,确定第三损失函数;所述处理单元1102,还用于至少根据所述第一损失函数、所述第二损失函数和所述第三损失函数,训练所述降噪分类网络;其中,所述无噪声数据对应的二分类结果为无噪声类型或噪声类型,所述噪声数据对应的二分类结果为无噪声类型或噪声类型。Optionally, in a possible implementation manner, the obtaining unit 1101 is further configured to obtain a first feature, and predict a binary classification result corresponding to the noise-free data according to the first feature, to obtain a first prediction. As a result, the first feature is extracted by the classification network in the noise reduction classification network after the noise-free data is input into the noise reduction classification network; the obtaining unit 1101 is further configured to obtain the second feature, and according to The second feature predicts a binary classification result corresponding to the noise data, and obtains a second prediction result, where the second feature is a classification network in the noise reduction classification network after the noise data is input into the noise reduction classification network The processing unit 1102 is further configured to determine the first prediction result according to the first prediction result and the true binary label of the noise-free data, the second prediction result and the true binary label of the noise data Three loss functions; the processing unit 1102 is further configured to train the noise reduction classification network at least according to the first loss function, the second loss function and the third loss function; wherein the noise-free The binary classification result corresponding to the data is a noise-free type or a noise type, and the binary classification result corresponding to the noise data is a noise-free type or a noise type.

可选地,在一种可能的实现方式中,至少根据所述第一损失函数和所述第二损失函数,通过误差反向传播算法对所述降噪分类网络的参数进行更新。Optionally, in a possible implementation manner, at least according to the first loss function and the second loss function, the parameters of the noise reduction classification network are updated through an error back-propagation algorithm.

可选地,在一种可能的实现方式中,所述噪声数据包括稀疏时序数据。Optionally, in a possible implementation manner, the noise data includes sparse time series data.

可选地,在一种可能的实现方式中,所述稀疏时序数据包括骨骼点坐标数据、心电图数据、惯性测量单元数据或故障诊断数据。Optionally, in a possible implementation manner, the sparse time series data includes skeletal point coordinate data, electrocardiogram data, inertial measurement unit data or fault diagnosis data.

可以参阅图12,图12为本申请实施例提供的一种降噪分类装置的结构示意图。本申请实施例提供一种降噪分类装置,该装置包括:获取单元1201和处理单元1202。所述获取单元1201,用于获取待分类数据。所述处理单元1202,用于将所述待分类数据输入目标网络,得到预测结果,所述预测结果为所述待分类数据的分类结果;其中,所述目标网络用于对所述待分类数据进行降噪处理以及分类,所述目标网络是基于以上实施例所述的模型训练方法训练得到的。Referring to FIG. 12, FIG. 12 is a schematic structural diagram of a noise reduction classification apparatus provided by an embodiment of the present application. The embodiment of the present application provides a noise reduction classification device, the device includes: an acquisition unit 1201 and a processing unit 1202 . The obtaining unit 1201 is configured to obtain the data to be classified. The processing unit 1202 is configured to input the data to be classified into a target network to obtain a prediction result, where the prediction result is the classification result of the data to be classified; wherein, the target network is used to analyze the data to be classified. Noise reduction processing and classification are performed, and the target network is obtained by training based on the model training method described in the above embodiment.

接下来介绍本申请实施例提供的一种执行设备,请参阅图13,图13为本申请实施例提供的执行设备的一种结构示意图,执行设备1300具体可以表现为手机、平板、笔记本电脑、智能穿戴设备、服务器等,此处不做限定。其中,执行设备1300上可以部署有图13对应实施例中所描述的数据处理装置,用于实现图13对应实施例中数据处理的功能。具体的,执行设备1300包括:接收器1301、发射器1302、处理器1303和存储器1304(其中执行设备1300中的处理器1303的数量可以一个或多个,图13中以一个处理器为例),其中,处理器1303可以包括应用处理器13031和通信处理器13032。在本申请的一些实施例中,接收器1301、发射器1302、处理器1303和存储器1304可通过总线或其它方式连接。Next, an execution device provided by an embodiment of the present application is introduced. Please refer to FIG. 13 , which is a schematic structural diagram of the execution device provided by the embodiment of the present application. Smart wearable devices, servers, etc., are not limited here. The data processing apparatus described in the embodiment corresponding to FIG. 13 may be deployed on the execution device 1300 to implement the function of data processing in the embodiment corresponding to FIG. 13 . Specifically, the execution device 1300 includes: a receiver 1301, a transmitter 1302, a processor 1303, and a memory 1304 (wherein the number of processors 1303 in the execution device 1300 may be one or more, and one processor is taken as an example in FIG. 13 ) , wherein the processor 1303 may include an application processor 13031 and a communication processor 13032 . In some embodiments of the present application, the receiver 1301, the transmitter 1302, the processor 1303, and the memory 1304 may be connected by a bus or otherwise.

存储器1304可以包括只读存储器和随机存取存储器,并向处理器1303提供指令和数据。存储器1304的一部分还可以包括非易失性随机存取存储器(non-volatile randomaccess memory,NVRAM)。存储器1304存储有处理器和操作指令、可执行模块或者数据结构,或者它们的子集,或者它们的扩展集,其中,操作指令可包括各种操作指令,用于实现各种操作。Memory 1304 may include read-only memory and random access memory, and provides instructions and data to processor 1303 . A portion of memory 1304 may also include non-volatile random access memory (NVRAM). The memory 1304 stores processors and operating instructions, executable modules or data structures, or a subset thereof, or an extended set thereof, wherein the operating instructions may include various operating instructions for implementing various operations.

处理器1303控制执行设备的操作。具体的应用中,执行设备的各个组件通过总线系统耦合在一起,其中总线系统除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都称为总线系统。The processor 1303 controls the operation of the execution device. In a specific application, various components of the execution device are coupled together through a bus system, where the bus system may include a power bus, a control bus, a status signal bus, and the like in addition to a data bus. However, for the sake of clarity, the various buses are referred to as bus systems in the figures.

上述本申请实施例揭示的方法可以应用于处理器1303中,或者由处理器1303实现。处理器1303可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器1303中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器1303可以是通用处理器、数字信号处理器(digital signal processing,DSP)、微处理器或微控制器,还可进一步包括专用集成电路(application specific integratedcircuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。该处理器1303可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器1304,处理器1303读取存储器1304中的信息,结合其硬件完成上述方法的步骤。The methods disclosed in the above embodiments of the present application may be applied to the processor 1303 or implemented by the processor 1303 . The processor 1303 may be an integrated circuit chip, which has signal processing capability. In the implementation process, each step of the above-mentioned method can be completed by an integrated logic circuit of hardware in the processor 1303 or an instruction in the form of software. The above-mentioned processor 1303 may be a general-purpose processor, a digital signal processor (DSP), a microprocessor or a microcontroller, and may further include an application specific integrated circuit (ASIC), a field programmable gate Field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The processor 1303 may implement or execute the methods, steps, and logical block diagrams disclosed in the embodiments of this application. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in conjunction with the embodiments of the present application may be directly embodied as executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other storage media mature in the art. The storage medium is located in the memory 1304, and the processor 1303 reads the information in the memory 1304, and completes the steps of the above method in combination with its hardware.

接收器1301可用于接收输入的数字或字符信息,以及产生与执行设备的相关设置以及功能控制有关的信号输入。发射器1302可用于通过第一接口输出数字或字符信息;发射器1302还可用于通过第一接口向磁盘组发送指令,以修改磁盘组中的数据;发射器1302还可以包括显示屏等显示设备。The receiver 1301 can be used to receive input numerical or character information, and to generate signal input related to performing the relevant setting and function control of the device. The transmitter 1302 can be used to output digital or character information through the first interface; the transmitter 1302 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 1302 can also include a display device such as a display screen .

本申请实施例中,在一种情况下,处理器1303,用于执行图4对应实施例中的执行设备执行的降噪模型的训练方法。In the embodiment of the present application, in one case, the processor 1303 is configured to execute the training method of the noise reduction model executed by the execution device in the embodiment corresponding to FIG. 4 .

本申请实施例还提供了一种训练设备,请参阅图14,图14为本申请实施例提供的训练设备的一种结构示意图,具体的,训练设备1400由一个或多个服务器实现,训练设备1400可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上中央处理器(central processing units,CPU)1414(例如,一个或一个以上处理器)和存储器1432,一个或一个以上存储应用程序1442或数据1444的存储介质1430(例如一个或一个以上海量存储设备)。其中,存储器1432和存储介质1430可以是短暂存储或持久存储。存储在存储介质1430的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对训练设备中的一系列指令操作。更进一步地,中央处理器1414可以设置为与存储介质1430通信,在训练设备1400上执行存储介质1430中的一系列指令操作。This embodiment of the present application also provides a training device. Please refer to FIG. 14. FIG. 14 is a schematic structural diagram of the training device provided by the embodiment of the present application. Specifically, the training device 1400 is implemented by one or more servers. 1400 may vary greatly depending on configuration or performance, and may include one or more central processing units (CPUs) 1414 (eg, one or more processors) and memory 1432, one or more storage A storage medium 1430 (eg, one or more mass storage devices) for applications 1442 or data 1444. Among them, the memory 1432 and the storage medium 1430 may be short-term storage or persistent storage. The program stored in the storage medium 1430 may include one or more modules (not shown in the figure), and each module may include a series of instructions to operate on the training device. Further, the central processing unit 1414 may be configured to communicate with the storage medium 1430 to execute a series of instruction operations in the storage medium 1430 on the training device 1400 .

训练设备1400还可以包括一个或一个以上电源1426,一个或一个以上有线或无线网络接口1450,一个或一个以上输入输出接口1458;或,一个或一个以上操作系统1441,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM等等。The training device 1400 may also include one or more power supplies 1426, one or more wired or wireless network interfaces 1450, one or more input and output interfaces 1458; or, one or more operating systems 1441, such as Windows Server , Mac OS X TM , Unix TM , Linux TM , FreeBSD TM and many more.

本申请实施例中还提供一种包括计算机程序产品,当其在计算机上运行时,使得计算机执行如前述执行设备所执行的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。Embodiments of the present application also provide a computer program product that, when running on a computer, causes the computer to perform the steps performed by the aforementioned execution device, or causes the computer to perform the steps performed by the aforementioned training device.

本申请实施例中还提供一种计算机可读存储介质,该计算机可读存储介质中存储有用于进行信号处理的程序,当其在计算机上运行时,使得计算机执行如前述执行设备所执行的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。Embodiments of the present application further provide a computer-readable storage medium, where a program for performing signal processing is stored in the computer-readable storage medium, and when it runs on a computer, the computer executes the steps performed by the aforementioned execution device. , or, causing the computer to perform the steps as performed by the aforementioned training device.

本申请实施例提供的执行设备、训练设备或终端设备具体可以为芯片,芯片包括:处理单元和通信单元,所述处理单元例如可以是处理器,所述通信单元例如可以是输入/输出接口、管脚或电路等。该处理单元可执行存储单元存储的计算机执行指令,以使执行设备内的芯片执行上述实施例描述的数据处理方法,或者,以使训练设备内的芯片执行上述实施例描述的数据处理方法。可选地,所述存储单元为所述芯片内的存储单元,如寄存器、缓存等,所述存储单元还可以是所述无线接入设备端内的位于所述芯片外部的存储单元,如只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)等。The execution device, training device, or terminal device provided in this embodiment of the present application may specifically be a chip, and the chip includes: a processing unit and a communication unit, the processing unit may be, for example, a processor, and the communication unit may be, for example, an input/output interface, pins or circuits, etc. The processing unit can execute the computer executable instructions stored in the storage unit, so that the chip in the execution device executes the data processing method described in the above embodiments, or the chip in the training device executes the data processing method described in the above embodiment. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc., and the storage unit may also be a storage unit located outside the chip in the wireless access device, such as only Read-only memory (ROM) or other types of static storage devices that can store static information and instructions, random access memory (RAM), and the like.

具体的,请参阅图15,图15为本申请实施例提供的芯片的一种结构示意图,所述芯片可以表现为神经网络处理器NPU 1500,NPU 1500作为协处理器挂载到主CPU(Host CPU)上,由Host CPU分配任务。NPU的核心部分为运算电路1503,通过控制器1504控制运算电路1503提取存储器中的矩阵数据并进行乘法运算。Specifically, please refer to FIG. 15. FIG. 15 is a schematic structural diagram of a chip provided by an embodiment of the present application. The chip may be represented as a neural network processor NPU 1500, and the NPU 1500 is mounted on the main CPU (Host CPU) as a co-processor. CPU), tasks are allocated by the Host CPU. The core part of the NPU is the arithmetic circuit 1503, which is controlled by the controller 1504 to extract the matrix data in the memory and perform multiplication operations.

在一些实现中,运算电路1503内部包括多个处理单元(Process Engine,PE)。在一些实现中,运算电路1503是二维脉动阵列。运算电路1503还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路1503是通用的矩阵处理器。In some implementations, the arithmetic circuit 1503 includes multiple processing units (Process Engine, PE). In some implementations, the arithmetic circuit 1503 is a two-dimensional systolic array. The arithmetic circuit 1503 may also be a one-dimensional systolic array or other electronic circuitry capable of performing mathematical operations such as multiplication and addition. In some implementations, arithmetic circuit 1503 is a general-purpose matrix processor.

举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器1502中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器1501中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器(accumulator)1508中。For example, suppose there is an input matrix A, a weight matrix B, and an output matrix C. The arithmetic circuit fetches the data corresponding to the matrix B from the weight memory 1502 and buffers it on each PE in the arithmetic circuit. The arithmetic circuit fetches the data of matrix A and matrix B from the input memory 1501 to perform matrix operation, and stores the partial result or final result of the matrix in the accumulator 1508 .

统一存储器1506用于存放输入数据以及输出数据。权重数据直接通过存储单元访问控制器(Direct Memory Access Controller,DMAC)1505,DMAC被搬运到权重存储器1502中。输入数据也通过DMAC被搬运到统一存储器1506中。Unified memory 1506 is used to store input data and output data. The weight data is directly passed through a storage unit access controller (Direct Memory Access Controller, DMAC) 1505 , and the DMAC is transferred to the weight memory 1502 . Input data is also moved into unified memory 1506 via the DMAC.

BIU为Bus Interface Unit即,总线接口单元(Bus Interface Unit,BIU)1510,用于AXI总线与DMAC和取指存储器(Instruction Fetch Buffer,IFB)1509的交互。The BIU is a Bus Interface Unit (Bus Interface Unit, BIU) 1510 , which is used for the interaction between the AXI bus, the DMAC and the instruction fetch buffer (Instruction Fetch Buffer, IFB) 1509 .

总线接口单元1510,用于取指存储器1509从外部存储器获取指令,还用于存储单元访问控制器1505从外部存储器获取输入矩阵A或者权重矩阵B的原数据。The bus interface unit 1510 is used for the instruction fetch memory 1509 to obtain instructions from the external memory, and is also used for the storage unit access controller 1505 to obtain the original data of the input matrix A or the weight matrix B from the external memory.

DMAC主要用于将外部存储器DDR中的输入数据搬运到统一存储器1506或将权重数据搬运到权重存储器1502中或将输入数据数据搬运到输入存储器1501中。The DMAC is mainly used to transfer the input data in the external memory DDR to the unified memory 1506 or the weight data to the weight memory 1502 or the input data to the input memory 1501 .

向量计算单元1507包括多个运算处理单元,在需要的情况下,对运算电路1503的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。主要用于神经网络中非卷积/全连接层网络计算,如Batch Normalization(批归一化),像素级求和,对特征平面进行上采样等。The vector calculation unit 1507 includes a plurality of operation processing units, and further processes the output of the operation circuit 1503, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc., if necessary. It is mainly used for non-convolutional/fully connected layer network computation in neural networks, such as Batch Normalization, pixel-level summation, and upsampling of feature planes.

在一些实现中,向量计算单元1507能将经处理的输出的向量存储到统一存储器1506。例如,向量计算单元1507可以将线性函数;或,非线性函数应用到运算电路1503的输出,例如对卷积层提取的特征平面进行线性插值,再例如累加值的向量,用以生成激活值。在一些实现中,向量计算单元1507生成归一化的值、像素级求和的值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路1503的激活输入,例如用于在神经网络中的后续层中的使用。In some implementations, the vector computation unit 1507 can store the vector of processed outputs to the unified memory 1506 . For example, the vector calculation unit 1507 may apply a linear function; or a non-linear function to the output of the operation circuit 1503, such as linear interpolation of the feature plane extracted by the convolution layer, such as a vector of accumulated values, to generate activation values. In some implementations, the vector computation unit 1507 generates normalized values, pixel-level summed values, or both. In some implementations, the vector of processed outputs can be used as activation input to the arithmetic circuit 1503, such as for use in subsequent layers in a neural network.

控制器1504连接的取指存储器(instruction fetch buffer)1509,用于存储控制器1504使用的指令;an instruction fetch buffer 1509 connected to the controller 1504 for storing instructions used by the controller 1504;

统一存储器1506,输入存储器1501,权重存储器1502以及取指存储器1509均为On-Chip存储器。外部存储器私有于该NPU硬件架构。The unified memory 1506, the input memory 1501, the weight memory 1502 and the instruction fetch memory 1509 are all On-Chip memories. External memory is private to the NPU hardware architecture.

其中,上述任一处提到的处理器,可以是一个通用中央处理器,微处理器,ASIC,或一个或多个用于控制上述程序执行的集成电路。Wherein, the processor mentioned in any one of the above may be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the above program.

另外需说明的是,以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。另外,本申请提供的装置实施例附图中,模块之间的连接关系表示它们之间具有通信连接,具体可以实现为一条或多条通信总线或信号线。In addition, it should be noted that the device embodiments described above are only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be A physical unit, which can be located in one place or distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment. In addition, in the drawings of the device embodiments provided in the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到本申请可借助软件加必需的通用硬件的方式来实现,当然也可以通过专用硬件包括专用集成电路、专用CPU、专用存储器、专用元器件等来实现。一般情况下,凡由计算机程序完成的功能都可以很容易地用相应的硬件来实现,而且,用来实现同一功能的具体硬件结构也可以是多种多样的,例如模拟电路、数字电路或专用电路等。但是,对本申请而言更多情况下软件程序实现是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在可读取的存储介质中,如计算机的软盘、U盘、移动硬盘、ROM、RAM、磁碟或者光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,训练设备,或者网络设备等)执行本申请各个实施例所述的方法。From the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary general-purpose hardware. Special components, etc. to achieve. Under normal circumstances, all functions completed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structures used to implement the same function can also be various, such as analog circuits, digital circuits or special circuit, etc. However, a software program implementation is a better implementation in many cases for this application. Based on this understanding, the technical solutions of the present application can be embodied in the form of software products in essence, or the parts that make contributions to the prior art. The computer software products are stored in a readable storage medium, such as a floppy disk of a computer. , U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., including several instructions to enable a computer device (which may be a personal computer, training device, or network device, etc.) to execute the various embodiments of the application. method.

在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。In the above-mentioned embodiments, it may be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented in software, it can be implemented in whole or in part in the form of a computer program product.

所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、训练设备或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、训练设备或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的训练设备、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘(Solid State Disk,SSD))等。The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer may be a general purpose computer, special purpose computer, computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be retrieved from a website, computer, training device, or data Transmission from the center to another website site, computer, training facility or data center via wired (eg coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (eg infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that can be stored by a computer, or a data storage device such as a training device, a data center, or the like that includes an integration of one or more available media. The usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), and the like.

Claims (13)

1.一种模型训练方法,其特征在于,包括:1. a model training method, is characterized in that, comprises: 获取样本对,所述样本对包括噪声数据和所述噪声数据对应的无噪声数据;obtaining a sample pair, the sample pair including noise data and noise-free data corresponding to the noise data; 将所述无噪声数据输入降噪分类网络,得到第一输出数据和第二输出数据,所述降噪分类网络包括降噪网络和分类网络,所述第一输出数据为所述降噪网络的输出,所述第二输出数据为所述分类网络的输出;Input the noise-free data into a noise reduction classification network to obtain first output data and second output data, the noise reduction classification network includes a noise reduction network and a classification network, and the first output data is the noise reduction network. output, the second output data is the output of the classification network; 将所述噪声数据输入所述降噪分类网络,得到第三输出数据和第四输出数据,所述第三输出数据是基于所述降噪网络的中间层得到的,所述第四输出数据为所述分类网络的输出;Input the noise data into the noise reduction classification network to obtain third output data and fourth output data, the third output data is obtained based on the middle layer of the noise reduction network, and the fourth output data is the output of the classification network; 根据所述第一输出数据和所述第三输出数据确定第一损失函数,所述第一损失函数用于表示所述第一输出数据与所述第三输出数据之间的差异;determining a first loss function according to the first output data and the third output data, where the first loss function is used to represent the difference between the first output data and the third output data; 根据所述第二输出数据和所述第四输出数据确定第二损失函数,所述第二损失函数用于表示所述第二输出数据以及所述第四输出数据与所述无噪声数据的真实类别标签之间的差异;A second loss function is determined according to the second output data and the fourth output data, and the second loss function is used to represent the second output data and the truth of the fourth output data and the noise-free data Differences between category labels; 至少根据所述第一损失函数和所述第二损失函数,训练所述降噪分类网络,直至满足预设训练条件,得到目标网络。The noise reduction classification network is trained according to at least the first loss function and the second loss function until a preset training condition is met, and a target network is obtained. 2.根据权利要求1所述的方法,其特征在于,所述降噪网络包括编码器和解码器,所述编码器用于对输入数据进行压缩编码,所述解码器用于对所述编码器输出的数据进行数据重构;2. The method according to claim 1, wherein the noise reduction network comprises an encoder and a decoder, the encoder is used to compress the input data, and the decoder is used to output the encoder data reconstruction; 所述第一输出数据为所述编码器的输出,所述第三输出数据是基于所述编码器的中间层得到的。The first output data is the output of the encoder, and the third output data is obtained based on the middle layer of the encoder. 3.根据权利要求1或2所述的方法,其特征在于,将所述噪声数据输入所述降噪分类网络,得到第三输出数据,包括:3. The method according to claim 1 or 2, wherein the noise data is input into the noise reduction classification network to obtain third output data, comprising: 将所述噪声数据输入所述降噪分类网络,得到所述降噪网络的中间层输出的特征数据;Inputting the noise data into the noise reduction classification network to obtain feature data output by the middle layer of the noise reduction network; 将所述特征数据划分为多个子特征数据,得到所述第三输出数据,所述第三输出数据包括所述多个子特征数据;Dividing the feature data into multiple sub-feature data to obtain the third output data, where the third output data includes the multiple sub-feature data; 根据所述第一输出数据和所述第三输出数据确定第一损失函数,包括:Determining a first loss function according to the first output data and the third output data includes: 确定所述第三输出数据中每个子特征数据与所述第一输出数据之间的差异值;determining the difference value between each sub-feature data in the third output data and the first output data; 根据所述每个子特征数据与所述第一输出数据之间的差异值,确定所述第一损失函数。The first loss function is determined according to the difference value between each sub-feature data and the first output data. 4.根据权利要求3所述的方法,其特征在于,所述将所述特征数据划分为多个子特征数据,得到所述第三输出数据,包括:4. The method according to claim 3, wherein, dividing the feature data into multiple sub-feature data to obtain the third output data, comprising: 按照时间顺序将所述特征数据均匀地划分为多个子特征数据,得到所述第三输出数据,所述多个子特征数据中的每个子特征数据对应的时间段的长度相同;The feature data is evenly divided into a plurality of sub-feature data according to the time sequence, and the third output data is obtained, and the length of the time period corresponding to each sub-feature data in the plurality of sub-feature data is the same; 其中,所述噪声数据为时序数据。Wherein, the noise data is time series data. 5.根据权利要求3或4所述的方法,其特征在于,所述确定所述第三输出数据中每个子特征数据与所述第一输出数据之间的差异值,包括:5. The method according to claim 3 or 4, wherein the determining the difference value between each sub-feature data in the third output data and the first output data comprises: 分别对所述第一输出数据和所述第三输出数据中的每个子特征数据执行维度对齐操作,得到维度对齐的第一输出数据和第三输出数据;Perform a dimension alignment operation on each of the sub-feature data in the first output data and the third output data, respectively, to obtain dimension-aligned first output data and third output data; 确定维度对齐的第三输出数据中每个子特征数据与维度对齐的第一输出数据之间的差异值。A difference value between each sub-feature data in the dimension-aligned third output data and the dimension-aligned first output data is determined. 6.根据权利要求1-5任意一项所述的方法,其特征在于,所述根据所述第二输出数据和所述第四输出数据确定第二损失函数,包括:6. The method according to any one of claims 1-5, wherein the determining a second loss function according to the second output data and the fourth output data comprises: 确定所述第二输出数据与所述无噪声数据的真实类别标签之间的差异,得到第一差异值;determining the difference between the second output data and the true category label of the noise-free data to obtain a first difference value; 确定所述第四输出数据与所述无噪声数据的真实类别标签之间的差异,得到第二差异值;determining the difference between the fourth output data and the true category label of the noise-free data to obtain a second difference value; 根据所述第一差异值和所述第二差异值,获取所述第二损失函数;obtaining the second loss function according to the first difference value and the second difference value; 其中,所述第二输出数据为多分类的预测结果,用于表示所述分类网络预测的结果。Wherein, the second output data is a multi-classification prediction result, which is used to represent the prediction result of the classification network. 7.根据权利要求1-6任意一项所述的方法,其特征在于,所述方法还包括:7. The method according to any one of claims 1-6, wherein the method further comprises: 获取第一特征,并根据所述第一特征预测所述无噪声数据对应的二分类结果,得到第一预测结果,所述第一特征是在所述无噪声数据输入降噪分类网络之后,所述降噪分类网络中的分类网络提取的;Acquire a first feature, and predict the binary classification result corresponding to the noise-free data according to the first feature, and obtain a first prediction result, where the first feature is that after the noise-free data is input into the noise reduction classification network, the extracted from the classification network in the noise reduction classification network; 获取第二特征,并根据所述第二特征预测所述噪声数据对应的二分类结果,得到第二预测结果,所述第二特征是在所述噪声数据输入降噪分类网络之后,所述降噪分类网络中的分类网络提取的;Acquire a second feature, and predict a binary classification result corresponding to the noise data according to the second feature, and obtain a second prediction result, where the second feature is that after the noise data is input into the noise reduction classification network, the Extracted by the classification network in the noise classification network; 根据所述第一预测结果和所述无噪声数据的真实二分类标签、所述第二预测结果和所述噪声数据的真实二分类标签,确定第三损失函数;Determine a third loss function according to the first prediction result and the true binary classification label of the noise-free data, the second prediction result and the true binary classification label of the noise data; 所述至少根据所述第一损失函数和所述第二损失函数,训练所述降噪分类网络,包括:The training of the noise reduction classification network at least according to the first loss function and the second loss function includes: 至少根据所述第一损失函数、所述第二损失函数和所述第三损失函数,训练所述降噪分类网络;training the noise reduction classification network according to at least the first loss function, the second loss function and the third loss function; 其中,所述无噪声数据对应的二分类结果为无噪声类型或噪声类型,所述噪声数据对应的二分类结果为无噪声类型或噪声类型。Wherein, the second classification result corresponding to the noise-free data is a noise-free type or a noise type, and the second-classification result corresponding to the noise data is a noise-free type or a noise type. 8.根据权利要求1-7任意一项所述的方法,其特征在于,所述至少根据所述第一损失函数和所述第二损失函数,训练所述降噪分类网络,包括:8. The method according to any one of claims 1-7, wherein the training of the noise reduction classification network at least according to the first loss function and the second loss function comprises: 至少根据所述第一损失函数和所述第二损失函数,通过误差反向传播算法对所述降噪分类网络的参数进行更新。According to at least the first loss function and the second loss function, the parameters of the noise reduction classification network are updated through an error back-propagation algorithm. 9.根据权利要求1-8任意一项所述的方法,其特征在于,所述噪声数据包括稀疏时序数据。9. The method according to any one of claims 1-8, wherein the noise data comprises sparse time series data. 10.根据权利要求9所述的方法,其特征在于,所述稀疏时序数据包括骨骼点坐标数据、心电图数据、惯性测量单元数据或故障诊断数据。10. The method according to claim 9, wherein the sparse time series data comprises skeletal point coordinate data, electrocardiogram data, inertial measurement unit data or fault diagnosis data. 11.一种终端,其特征在于,包括存储器和处理器;所述存储器存储有代码,所述处理器被配置为执行所述代码,当所述代码被执行时,所述终端执行如权利要求1至10任一所述的方法。11. A terminal, comprising a memory and a processor; the memory stores code, the processor is configured to execute the code, and when the code is executed, the terminal executes the code as claimed in the claims The method of any one of 1 to 10. 12.一种计算机可读存储介质,其特征在于,包括计算机可读指令,当所述计算机可读指令在计算机上运行时,使得所述计算机执行如权利要求1至10中任一项所述的方法。12. A computer-readable storage medium, characterized by comprising computer-readable instructions, which, when the computer-readable instructions are executed on a computer, cause the computer to perform the execution of any one of claims 1 to 10 Methods. 13.一种计算机程序产品,其特征在于,包括计算机可读指令,当所述计算机可读指令在计算机上运行时,使得所述计算机执行如权利要求1至10任一项所述的方法。13. A computer program product comprising computer readable instructions which, when executed on a computer, cause the computer to perform the method of any one of claims 1 to 10.
CN202011623266.3A 2020-12-30 2020-12-30 Model training method and related device Active CN114692667B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011623266.3A CN114692667B (en) 2020-12-30 2020-12-30 Model training method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011623266.3A CN114692667B (en) 2020-12-30 2020-12-30 Model training method and related device

Publications (2)

Publication Number Publication Date
CN114692667A true CN114692667A (en) 2022-07-01
CN114692667B CN114692667B (en) 2025-06-10

Family

ID=82134676

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011623266.3A Active CN114692667B (en) 2020-12-30 2020-12-30 Model training method and related device

Country Status (1)

Country Link
CN (1) CN114692667B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118190032A (en) * 2023-01-13 2024-06-14 国家石油天然气管网集团有限公司 Optical fiber sensing waterfall diagram data noise reduction method, device and processor
CN118190031A (en) * 2023-01-13 2024-06-14 国家石油天然气管网集团有限公司 Optical fiber sensing waterfall diagram data noise reduction method, device and processor

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019071201A1 (en) * 2017-10-06 2019-04-11 Alivecor, Inc. Continuous monitoring of a user's health with a mobile device
CN109800875A (en) * 2019-01-08 2019-05-24 华南理工大学 Chemical industry fault detection method based on particle group optimizing and noise reduction sparse coding machine
CN110974217A (en) * 2020-01-03 2020-04-10 苏州大学 A two-stage ECG signal noise reduction method based on convolutional autoencoder
CN111027681A (en) * 2019-12-09 2020-04-17 腾讯科技(深圳)有限公司 Time sequence data processing model training method, data processing device and storage medium
CN111163690A (en) * 2018-09-04 2020-05-15 深圳先进技术研究院 Arrhythmia detection method, device, electronic device and computer storage medium
CN111797895A (en) * 2020-05-30 2020-10-20 华为技术有限公司 Training method of classifier, data processing method, system and equipment
CN111860588A (en) * 2020-06-12 2020-10-30 华为技术有限公司 A training method for graph neural network and related equipment
US20200388287A1 (en) * 2018-11-13 2020-12-10 CurieAI, Inc. Intelligent health monitoring
WO2020248492A1 (en) * 2019-06-14 2020-12-17 平安科技(深圳)有限公司 Method and device for denoising oct image based on cyclic generative adversarial network

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019071201A1 (en) * 2017-10-06 2019-04-11 Alivecor, Inc. Continuous monitoring of a user's health with a mobile device
CN111163690A (en) * 2018-09-04 2020-05-15 深圳先进技术研究院 Arrhythmia detection method, device, electronic device and computer storage medium
US20200388287A1 (en) * 2018-11-13 2020-12-10 CurieAI, Inc. Intelligent health monitoring
CN109800875A (en) * 2019-01-08 2019-05-24 华南理工大学 Chemical industry fault detection method based on particle group optimizing and noise reduction sparse coding machine
WO2020248492A1 (en) * 2019-06-14 2020-12-17 平安科技(深圳)有限公司 Method and device for denoising oct image based on cyclic generative adversarial network
CN111027681A (en) * 2019-12-09 2020-04-17 腾讯科技(深圳)有限公司 Time sequence data processing model training method, data processing device and storage medium
CN110974217A (en) * 2020-01-03 2020-04-10 苏州大学 A two-stage ECG signal noise reduction method based on convolutional autoencoder
CN111797895A (en) * 2020-05-30 2020-10-20 华为技术有限公司 Training method of classifier, data processing method, system and equipment
CN111860588A (en) * 2020-06-12 2020-10-30 华为技术有限公司 A training method for graph neural network and related equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118190032A (en) * 2023-01-13 2024-06-14 国家石油天然气管网集团有限公司 Optical fiber sensing waterfall diagram data noise reduction method, device and processor
CN118190031A (en) * 2023-01-13 2024-06-14 国家石油天然气管网集团有限公司 Optical fiber sensing waterfall diagram data noise reduction method, device and processor

Also Published As

Publication number Publication date
CN114692667B (en) 2025-06-10

Similar Documents

Publication Publication Date Title
CN112070207B (en) A model training method and device
CN113240079B (en) Model training method and device
CN112651511A (en) Model training method, data processing method and device
WO2022068623A1 (en) Model training method and related device
WO2022179492A1 (en) Pruning processing method for convolutional neural network, data processing method and devices
WO2021159714A1 (en) Data processing method and related device
US20240020541A1 (en) Model training method and apparatus
WO2022179586A1 (en) Model training method, and device associated therewith
CN112529149B (en) A data processing method and related device
CN113536970A (en) A training method and related device for a video classification model
CN113627163A (en) Attention model, feature extraction method and related device
CN113159315A (en) Neural network training method, data processing method and related equipment
CN113627422A (en) Image classification method and related equipment thereof
WO2022012668A1 (en) Training set processing method and apparatus
CN115238909A (en) Data value evaluation method based on federal learning and related equipment thereof
CN113869496A (en) Acquisition method of neural network, data processing method and related equipment
CN115081616A (en) Data denoising method and related equipment
WO2023273934A1 (en) Method for selecting hyper-parameter of model, and related apparatus
WO2023020185A1 (en) Image classification method and related device
WO2024046473A1 (en) Data processing method and apparatus
CN114692667A (en) Model training method and related device
CN116739154A (en) Fault prediction method and related equipment thereof
CN116259311A (en) Voice processing method and related equipment thereof
CN114841361A (en) Model training method and related equipment thereof
US20240265256A1 (en) Model training method and related device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载