[go: up one dir, main page]

CN115797710A - Neural network image classification performance improving method based on hidden layer feature difference - Google Patents

Neural network image classification performance improving method based on hidden layer feature difference Download PDF

Info

Publication number
CN115797710A
CN115797710A CN202310077690.XA CN202310077690A CN115797710A CN 115797710 A CN115797710 A CN 115797710A CN 202310077690 A CN202310077690 A CN 202310077690A CN 115797710 A CN115797710 A CN 115797710A
Authority
CN
China
Prior art keywords
hidden layer
heterogeneous
network
image classification
output
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
CN202310077690.XA
Other languages
Chinese (zh)
Other versions
CN115797710B (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.)
Chengdu Univeristy of Technology
Original Assignee
Chengdu Univeristy of Technology
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 Chengdu Univeristy of Technology filed Critical Chengdu Univeristy of Technology
Priority to CN202310077690.XA priority Critical patent/CN115797710B/en
Publication of CN115797710A publication Critical patent/CN115797710A/en
Application granted granted Critical
Publication of CN115797710B publication Critical patent/CN115797710B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Image Analysis (AREA)

Abstract

本发明公开了一种基于隐藏层特征差异的神经网络图像分类性能提升方法,涉及图像数据处理技术领域,包括:构造由二元组组成的异类组合集,每个异类样本二元组包括两张异类图像,和该两张异类图像的类别标签;构建权值共享两路网络;将异类组合集输入权值共享两路网络,得到若干隐藏层输出特征差异;根据交叉熵损失和隐藏层输出特征差异,得到组合损失函数,其中包括隐藏层输出特征差异的倒数;根据异类组合集和组合损失函数,端到端的训练权值共享两路网络;从训练好的权值共享两路网络中取出任一分支,并输入测试图像数据集,输出得到图像分类结果。本发明提高了模型分类精度,能有效遏制网络因为退化导致不同类别样本的隐层特征相似的情况。

Figure 202310077690

The invention discloses a neural network image classification performance improvement method based on hidden layer feature difference, relates to the technical field of image data processing, including: constructing a heterogeneous combination set composed of binary groups, each heterogeneous sample binary group includes two Heterogeneous images, and the category labels of the two heterogeneous images; construct a weight-sharing two-way network; input the heterogeneous combination set into the weight-sharing two-way network, and obtain the output feature differences of several hidden layers; according to the cross-entropy loss and hidden layer output features difference, get the combined loss function, which includes the reciprocal of the hidden layer output feature difference; according to the heterogeneous combination set and the combined loss function, the end-to-end training weights share the two-way network; take any weight from the trained weight sharing two-way network One branch, and input the test image dataset, and output the image classification result. The invention improves the classification accuracy of the model, and can effectively restrain the situation that the characteristics of the hidden layer of samples of different categories are similar due to the degradation of the network.

Figure 202310077690

Description

基于隐藏层特征差异的神经网络图像分类性能提升方法Performance improvement method of neural network image classification based on hidden layer feature difference

技术领域technical field

本发明涉及图像数据处理技术领域,具体而言,涉及一种基于隐藏层特征差异的神经网络图像分类性能提升方法。The present invention relates to the technical field of image data processing, in particular to a neural network image classification performance improvement method based on hidden layer feature differences.

背景技术Background technique

随着数据的产生、获取、传输代价降低,数据不断积累,同时,由于手机、平板的移动设备的广泛使用,监控设备的广泛部署,产生了大量的图像数据。图像识别技术已经逐渐应用于越来越多的领域,与此同时,图像识别的准确性、可靠性和实时要求也越来越严格。神经网络作为机器学习的重要方向,在自然语言、图像等领域体现出显著优势。特别在图像分类这一基础且重要的应用领域,取得了极大发展。并且得益于计算力的提高和优化算法的改进,神经网络的发展呈现出越来越深的趋势。As the cost of data generation, acquisition, and transmission decreases, data continues to accumulate. At the same time, due to the widespread use of mobile devices such as mobile phones and tablets, and the widespread deployment of monitoring equipment, a large amount of image data is generated. Image recognition technology has been gradually applied in more and more fields, at the same time, the accuracy, reliability and real-time requirements of image recognition are becoming more and more stringent. As an important direction of machine learning, neural network has shown significant advantages in natural language, image and other fields. Especially in the basic and important application field of image classification, great development has been achieved. And thanks to the improvement of computing power and the improvement of optimization algorithms, the development of neural networks is showing a deeper and deeper trend.

神经网络在处理分类任务时,训练网络以优化网络参数主要依赖网络最终的输出与图像真实类别的差异。定义网络输出与图像真实类别之间的损失,例如交叉熵损失或似然损失,以最小化这一损失值为优化目标,来训练网络。由于传统的优化目标主要依赖于网络的最终输出,整个网络作为黑盒模型,没有充分利用网路中的隐藏层特征,并且随着网络深度增加,各隐藏层对输入空间的收缩,折叠程度加大,导致不同类别的图像在某些隐藏层具有相似的特征,使得网络的训练难度增大。[DOI:10.1109/CVPR.2016.90]中表明,在网络深度超过某阈值,会导致网络性能会退化。影响图像分类的准确率。When a neural network handles classification tasks, training the network to optimize network parameters mainly depends on the difference between the final output of the network and the true category of the image. Define the loss between the network output and the real category of the image, such as cross-entropy loss or likelihood loss, and train the network with the optimization goal of minimizing this loss. Since the traditional optimization goal mainly depends on the final output of the network, the entire network is a black box model that does not make full use of the hidden layer features in the network, and as the depth of the network increases, each hidden layer shrinks the input space and the degree of folding increases. Large, resulting in images of different categories having similar features in some hidden layers, making the training of the network more difficult. [DOI:10.1109/CVPR.2016.90] shows that when the network depth exceeds a certain threshold, the network performance will be degraded. affect the accuracy of image classification.

发明内容Contents of the invention

本发明的目的在于提供一种基于隐藏层特征差异的神经网络图像分类性能提升方法,以解决不同类别图像在隐藏层的特征相似而带来的训练难度大、分类准确率不高的问题。The purpose of the present invention is to provide a neural network image classification performance improvement method based on the difference in hidden layer features to solve the problems of high training difficulty and low classification accuracy caused by similar features of different types of images in the hidden layer.

本发明采取的技术方案如下:The technical scheme that the present invention takes is as follows:

基于隐藏层特征差异的神经网络图像分类性能提升方法,包括以下步骤:A neural network image classification performance improvement method based on hidden layer feature differences, comprising the following steps:

S1、对训练图像数据集进行预处理,组合所有异类样本,构造由所有异类样本二元组组成的异类组合集,每个异类样本二元组包括两张异类图像,和该两张异类图像的类别标签;S1. Preprocess the training image data set, combine all heterogeneous samples, and construct a heterogeneous combination set composed of all heterogeneous sample pairs, each heterogeneous sample pair includes two heterogeneous images, and the two heterogeneous images. category label;

S2、构建权值共享两路网络,所述权值共享两路网络包括两个并列的结构相同且共享权值的分支,每个分支均采用resnet34去除残差连接后的主干网络,包括:1个步长为2,卷积核大小为7*7,输出通道为64的卷积层;1个步长为2的池化层;6个步长为1,卷积核大小为3*3,输出通道为64的卷积层;1个步长为2,卷积核大小为3*3,输出通道为128的卷积层,7个步长为1,卷积核大小为3*3,输出通道为128的卷积层;1个步长为2,卷积核大小为3*3,输出通道为256的卷积层;11个步长为1,卷积核大小为3*3,输出通道为256的卷积层;6个步长为1,卷积核大小为3*3,输出通道为512的卷积层;1个平均池化层;1个线性层。S2. Construct a two-way weight sharing network. The two-way weight sharing network includes two juxtaposed branches with the same structure and sharing weights. Each branch uses resnet34 to remove the backbone network after the residual connection, including: 1 A convolution layer with a stride of 2, a convolution kernel size of 7*7, and an output channel of 64; a pooling layer with a stride of 2; 6 strides of 1, and a convolution kernel size of 3*3 , a convolutional layer with an output channel of 64; a convolutional layer with a stride of 2, a convolutional kernel size of 3*3, an output channel of 128, 7 strides of 1, and a convolutional kernel size of 3*3 , a convolution layer with an output channel of 128; a convolution layer with a stride of 2, a convolution kernel size of 3*3, and an output channel of 256; 11 strides of 1, and a convolution kernel size of 3*3 , a convolutional layer with an output channel of 256; 6 convolutional layers with a step size of 1, a convolution kernel size of 3*3, and an output channel of 512; an average pooling layer; and a linear layer.

S3、对于异类组合集中的每个异类样本二元组,将该异类样本二元组中的两张异类图像分别输入权值共享两路网络中的两个分支,根据两个分支相同结构和层级的隐藏层输出的对应特征,得到两个分支相同结构和层级的隐藏层输出特征差异;S3. For each heterogeneous sample pair in the heterogeneous combination set, input the two heterogeneous images in the heterogeneous sample pair into the two branches of the weight sharing two-way network, according to the same structure and level of the two branches The corresponding features of the hidden layer output of the two branches are obtained, and the difference of the hidden layer output features of the two branches with the same structure and level is obtained;

S4、根据步骤S3中两个分支的交叉熵损失,和所有层级的隐藏层输出特征差异,定义得到基于隐藏层特征差异的组合损失函数,其中包括隐藏层输出特征差异的倒数;S4. According to the cross-entropy loss of the two branches in step S3, and the hidden layer output feature differences of all levels, define a combined loss function based on the hidden layer feature difference, including the reciprocal of the hidden layer output feature difference;

S5、根据异类组合集和基于隐藏层特征差异的组合损失函数,端到端的训练权值共享两路网络;S5. According to the heterogeneous combination set and the combined loss function based on the difference in hidden layer features, the end-to-end training weights share the two-way network;

S6、从训练好的权值共享两路网络中取出任一分支,作为最终的神经网络图像分类预测模型;S6. Take any branch from the trained weight sharing two-way network as the final neural network image classification prediction model;

S7、将测试图像数据集输入神经网络图像分类预测模型,输出得到图像分类结果。S7. Input the test image data set into the neural network image classification prediction model, and output the image classification result.

在本发明的一较佳实施方式中,步骤S1中,对训练图像数据集进行预处理的过程具体包括:对训练图像数据集中所有类别进行组合,遍历所有类别组合方式,对每种组合中两个类别的图片集做笛卡尔乘积,将该笛卡尔乘积并入异类组合集。In a preferred embodiment of the present invention, in step S1, the process of preprocessing the training image dataset specifically includes: combining all categories in the training image dataset, traversing all category combinations, The Cartesian product of the image sets of each category is merged into the heterogeneous combination set.

在本发明的一较佳实施方式中,步骤S3中,异类样本二元组中分别对应两个分支的两张异类图像分别为input1和input2,则两个分支中分别得到的第i个隐藏层的特征,分别记为Hiddeni(input1)和Hiddeni(input2),第i个隐藏层输出特征差异为:In a preferred embodiment of the present invention, in step S3, the two heterogeneous images corresponding to the two branches in the heterogeneous sample binary group are respectively input1 and input2, then the i-th hidden layer obtained in the two branches respectively The features of are recorded as Hidden i (input1) and Hidden i (input2), respectively, and the output feature difference of the i-th hidden layer is:

Disi(input1,input2) = || Hiddeni(input1)-Hiddeni(input2) ||2Dis i (input1,input2) = || Hidden i (input1)-Hidden i (input2) || 2 .

在本发明的一较佳实施方式中,步骤S4中,基于隐藏层特征差异的组合损失函数包括所有隐藏层特征差异以及网络最终输出与标签的交叉熵损失,具体为:In a preferred embodiment of the present invention, in step S4, the combined loss function based on the hidden layer feature difference includes all hidden layer feature differences and the cross-entropy loss between the final output of the network and the label, specifically:

Loss = ∑1/Disi + cross_entropy(output1,label1) + cross_entropy(output2,label2)。Loss = ∑1/Dis i + cross_entropy(output1,label1) + cross_entropy(output2,label2).

其中,Disi为第i个隐藏层输出特征差异,input1,input2为两张异类图像,label1,label2为两张异类图像对应的标签,函数cross_entropy(x,y)即计算结果为x和y的交叉熵。Among them, Dis i is the output feature difference of the i-th hidden layer, input1 and input2 are two heterogeneous images, label1 and label2 are the labels corresponding to the two heterogeneous images, and the function cross_entropy(x,y) is the calculation result of x and y cross entropy.

在本发明的一较佳实施方式中,步骤S5中,训练权值共享两路网络的目标,在于使基于隐藏层特征差异的组合损失达到最小,判断损失最小的依据为训练权值共享两路网络的损失连续十轮下降都不超过1/10000。In a preferred embodiment of the present invention, in step S5, the goal of training the weight sharing two-way network is to minimize the combined loss based on the difference in hidden layer features, and the basis for judging the minimum loss is that the training weights share the two-way The loss of the network has not dropped more than 1/10000 for ten consecutive rounds.

在本发明的一较佳实施方式中,步骤S5中,权值共享两路网络的训练过程为:遍历异类组合集中的异类样本二元组,将其中一张异类图像和该异类图像的类别标签输入到权值共享两路网络中的一个分支,将其中另一张异类图像和该异类图像的类别标签输入到权值共享两路网络中的另一个分支,使用基于隐藏层特征差异的组合损失函数作为训练损失,进行端到端训练。In a preferred embodiment of the present invention, in step S5, the training process of the weight sharing two-way network is: traversing the heterogeneous sample pairs in the heterogeneous combination set, and combining one of the heterogeneous images with the category label of the heterogeneous image Input to one branch of the weight-sharing two-way network, input another heterogeneous image and the category label of the heterogeneous image to the other branch of the weight-sharing two-way network, using a combined loss based on the difference in hidden layer features function as the training loss for end-to-end training.

与现有技术相比,本发明的有益效果是:Compared with prior art, the beneficial effect of the present invention is:

与传统神经网络只关注网络最终输出相比,本发明利用了网络中间隐藏层特征,在优化网络时,不仅使得模型输出与标签的交叉熵损失最小,同时最大化不同类别图片的隐藏层特征差异,提高了分类精度;Compared with the traditional neural network that only focuses on the final output of the network, the present invention utilizes the characteristics of the hidden layer in the middle of the network. When optimizing the network, it not only minimizes the cross-entropy loss between the model output and the label, but also maximizes the difference in hidden layer features of different types of pictures. , which improves the classification accuracy;

采用了隐藏层特征差异的倒数作为损失的一部分,当网络因为退化导致不同类别样本的隐层特征相似时,具有很大梯度,在梯度下降时将跳出这种情况,能有效的遏制了网络的退化。The reciprocal of the hidden layer feature difference is used as part of the loss. When the network has similar hidden layer features of different categories of samples due to degradation, it has a large gradient, and it will jump out of this situation when the gradient drops, which can effectively curb the network. degradation.

为使本发明的上述目的、特征和优点能更明显易懂,下文特举本发明实施例,并配合所附附图,作详细说明如下。In order to make the above-mentioned objects, features and advantages of the present invention more comprehensible, the embodiments of the present invention will be described in detail below together with the accompanying drawings.

附图说明Description of drawings

为了更清楚地说明本发明实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本发明的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to illustrate the technical solutions of the embodiments of the present invention more clearly, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention, and thus It should be regarded as a limitation on the scope, and those skilled in the art can also obtain other related drawings based on these drawings without creative work.

图1是基于隐藏层特征差异的神经网络图像分类性能提升方法的总体流程图;Fig. 1 is the overall flowchart of the neural network image classification performance improvement method based on hidden layer feature difference;

图2是数据预处理示例图;Figure 2 is an example diagram of data preprocessing;

图3是权值共享两路网络的结构示意图;Fig. 3 is a schematic structural diagram of a weight sharing two-way network;

图4是基于隐藏层特征差异的组合损失函数的定义方式示意图。Fig. 4 is a schematic diagram of the definition method of the combination loss function based on the difference of hidden layer features.

具体实施方式Detailed ways

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments.

请参照图1,本发明公开了一种基于隐藏层特征差异的神经网络图像分类性能提升方法,包括以下步骤:Please refer to Fig. 1, the present invention discloses a neural network image classification performance improvement method based on hidden layer feature difference, comprising the following steps:

S1、对训练图像数据集进行预处理,构造异类组合集,每个异类样本二元组包括两张异类图像,和该两张异类图像的类别标签。S1. Preprocessing the training image data set to construct a heterogeneous combination set. Each heterogeneous sample pair includes two heterogeneous images and category labels of the two heterogeneous images.

为了充分利用不同类别数据在隐藏层的特征,加大异类数据在隐藏层的特征的差异。In order to make full use of the characteristics of different types of data in the hidden layer, the difference in the characteristics of heterogeneous data in the hidden layer is increased.

本发明从原始的训练图像数据集出发,组合所有异类样本,得到由所有异类样本二元组组成的集合,即异类组合集,构造的方法如下:The present invention starts from the original training image data set, combines all heterogeneous samples, and obtains a set composed of all heterogeneous sample binary groups, that is, a heterogeneous combination set, and the construction method is as follows:

若训练图像数据集包含k种类别,则记为:C1,C2...Ck,构造异类组合集的具体方法为:If the training image data set contains k categories, it is recorded as: C1, C2...Ck, and the specific method of constructing a heterogeneous combination set is:

(1-1)k种类别之间两两组合,得到 k*(k-1)/2 种类别组合方式;(1-1) Combining pairs of k categories to get k*(k-1)/2 category combinations;

(1-2)对每种组合方式(Ci,Cj),Ci类别的所有样本与Cj类别的所有样本做直积,Ci所有样本与Cj所有样本的直积 = { (s1,s2) | s1∈Ci , s2∈Cj },将得到的直积并入异类组合集。(1-2) For each combination (Ci, Cj), do direct product of all samples of Ci category and all samples of Cj category, the direct product of all samples of Ci and all samples of Cj = { (s1,s2) | s1 ∈Ci , s2∈Cj }, merge the obtained direct product into the heterogeneous combination set.

(1-3)遍历 k*(k-1)/2 种组合方式,将所有得到的直积并入异类组合集。(1-3) Traverse k*(k-1)/2 combinations, and merge all obtained direct products into heterogeneous combination sets.

以cifar-10数据集为例,如图2所示。cifar-10数据集的训练集包括50000张图片,分为十个类别。其中十种类别为飞机(airplane)、汽车(automobile)、猫(cat)、鸟类(bird)、鹿(deer)、狗(dog)、蛙类(frog)、马(horse)、船(ship)和卡车(truck)。每种类别有5000张图片。先将10种类别进行两两组合,可以采用将飞机(airplane)与剩下类别组合,再将汽车(automobile)与剩下类别组合,以此类推,最终得到(飞机,汽车)、(飞机,猫)、(汽车、猫)等10*9/2种组合。对每种组合中所包含的两种类别,将第一种类别的5000张图片与第二种类比的5000张图片进行组合,例如类别组合(飞机,汽车),将飞机类的5000张图片{飞机1,飞机2...飞机5000}与汽车类别的5000张图片{汽车1,汽车2...汽车5000}进行组合,得到(飞机1,汽车1)、(飞机1,汽车2)、(飞机2,汽车1)、(飞机2,汽车2)等5000*5000个组合结果。将该组合集并入异类组合集。以此类推,遍历19*9/2种类别组合,得到每种类别组合分别的样本组合集,并入异类组合集,得到最终的结果。Take the cifar-10 dataset as an example, as shown in Figure 2. The training set of the cifar-10 dataset includes 50,000 images divided into ten categories. The ten categories are airplane (airplane), automobile (automobile), cat (cat), bird (bird), deer (deer), dog (dog), frog (frog), horse (horse), ship (ship) ) and trucks. Each category has 5000 images. First combine the 10 categories in pairs, you can combine the aircraft (airplane) with the remaining categories, then combine the automobile (automobile) with the remaining categories, and so on, and finally get (airplane, automobile), (airplane, cat), (car, cat) and other 10*9/2 combinations. For the two categories included in each combination, combine the 5000 pictures of the first category with the 5000 pictures of the second category, for example, category combination (aircraft, car), and combine the 5000 pictures of the aircraft category { Airplane 1, Airplane 2...Aircraft 5000} are combined with 5000 pictures of the car category {Car 1, Car 2...Car 5000} to get (Aircraft 1, Car 1), (Aircraft 1, Car 2), (airplane 2, car 1), (aircraft 2, car 2) and other 5000*5000 combination results. Merge that combination set into a heterogeneous combination set. By analogy, 19*9/2 category combinations are traversed to obtain a sample combination set for each category combination, which is merged into a heterogeneous combination set to obtain the final result.

S2、构建权值共享两路网络,以让神经网络在训练过程中能利用异类数据的隐藏层特征,权值共享两路网络包括两个并列的结构相同且共享权值的分支,每个分支均采用resnet34去除残差连接后的主干网络,如图3所示。S2. Construct a weight sharing two-way network so that the neural network can use the hidden layer characteristics of heterogeneous data during the training process. The weight sharing two-way network includes two juxtaposed branches with the same structure and shared weights. Each branch Both use resnet34 to remove the backbone network after the residual connection, as shown in Figure 3.

由于两分支共享权值,因此,在分别向两分支输入两张异类图像时,两张异类图像的隐藏层特征是采用相同的神经网络提取得到,由此可以得到异类图像在同一网络下分别的隐藏层特征。Since the two branches share weights, when two heterogeneous images are input to the two branches respectively, the hidden layer features of the two heterogeneous images are extracted by the same neural network, so that the heterogeneous images under the same network can be obtained separately Hidden layer features.

S3、对于异类组合集中的每个异类样本二元组,将该异类样本二元组中的两张异类图像分别输入权值共享两路网络中的两个分支,两张异类图像在各自的分支中前向传播,并计算各自的隐藏层特征,根据两个分支相同结构和层级的隐藏层输出的对应特征,得到两个分支相同结构和层级的隐藏层输出特征差异,如图4所示。S3. For each heterogeneous sample binary group in the heterogeneous combination set, input the two heterogeneous images in the heterogeneous sample binary group into the two branches of the weight sharing two-way network respectively, and the two heterogeneous images are in the respective branches In the forward propagation, and calculate the respective hidden layer features, according to the corresponding features of the hidden layer output of the two branches with the same structure and level, the difference of the hidden layer output features of the two branches with the same structure and level is obtained, as shown in Figure 4.

在本发明中,隐藏层特征之间的差异使用不同类别数据在各自分支中同一隐藏层特征的L2距离。In the present invention, the difference between the hidden layer features uses the L2 distance of the same hidden layer features in the respective branches of different categories of data.

例如,设异类样本二元组中分别对应两个分支的两张异类图像分别为input1和input2,则两个分支中分别得到的第i个隐藏层的特征,分别记为Hiddeni(input1)和Hiddeni(input2),第i个隐藏层输出特征差异为:For example, if the two heterogeneous images corresponding to the two branches in the heterogeneous sample binary group are respectively input1 and input2, then the features of the i-th hidden layer obtained in the two branches are recorded as Hidden i (input1) and Hidden i (input1) and Hidden i (input2), the i-th hidden layer output feature difference is:

Disi(input1,input2) = || Hiddeni(input1)-Hiddeni(input2) ||2Dis i (input1,input2) = || Hidden i (input1)-Hidden i (input2) || 2 .

S4、根据步骤S3中两个分支的交叉熵损失,和所有层级的隐藏层输出特征差异,定义得到基于隐藏层特征差异的组合损失函数,如图4所示;S4, according to the cross-entropy loss of the two branches in step S3, and the hidden layer output feature difference of all levels, define the combined loss function based on the hidden layer feature difference, as shown in Figure 4;

基于隐藏层特征差异的组合损失函数包括所有隐藏层特征差异以及网络最终输出与标签的交叉熵损失,具体为:The combined loss function based on the hidden layer feature difference includes all hidden layer feature differences and the cross-entropy loss between the final output of the network and the label, specifically:

Loss = ∑1/Disi + cross_entropy(output1,label1) + cross_entropy(output2,label2)。Loss = ∑1/Dis i + cross_entropy(output1,label1) + cross_entropy(output2,label2).

其中包括隐藏层输出特征差异的倒数。This includes the inverse of the difference in the hidden layer output features.

该损失与异类图像特征差异负相关,与网络最终输出与标签的交叉熵正相关。训练模型以最小化该损失,将会使得训练集中图像的最终输出拟合其真实类别标签,同时使得不同类别图像之间的网络隐藏层特征差异增大。The loss is negatively correlated with the feature difference of heterogeneous images, and positively correlated with the cross-entropy of the final output of the network and the label. Training the model to minimize this loss will make the final output of the images in the training set fit their true class labels, while increasing the difference in the hidden layer features of the network between images of different classes.

S5、根据异类组合集和基于隐藏层特征差异的组合损失函数,端到端的训练权值共享两路网络。S5. According to the heterogeneous combination set and the combined loss function based on the difference in hidden layer features, the end-to-end training weights share the two-way network.

其中,训练权值共享两路网络的目标,在于使基于隐藏层特征差异的组合损失达到最小,通过最小化该损失,可以使得网络在拟合数据类别的同时,扩大异类数据之间的隐藏层特征差异。Among them, the goal of training weight sharing two-way network is to minimize the combined loss based on the difference in hidden layer features. By minimizing this loss, the network can expand the hidden layer between heterogeneous data while fitting the data category. characteristic difference.

S6、从训练好的权值共享两路网络中取出任一分支,作为最终的神经网络图像分类预测模型。S6. Take any branch from the trained two-way weight sharing network as the final neural network image classification prediction model.

S7、将测试图像数据集输入神经网络图像分类预测模型,输出得到图像分类结果。S7. Input the test image data set into the neural network image classification prediction model, and output the image classification result.

以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and changes. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.

Claims (8)

1.一种基于隐藏层特征差异的神经网络图像分类性能提升方法,其特征在于,包括以下步骤:1. A neural network image classification performance improvement method based on hidden layer feature differences, characterized in that, comprising the following steps: S1、对训练图像数据集进行预处理,组合所有异类样本,构造由所有异类样本二元组组成的异类组合集,每个异类样本二元组包括两张异类图像,和该两张异类图像的类别标签;S1. Preprocess the training image data set, combine all heterogeneous samples, and construct a heterogeneous combination set composed of all heterogeneous sample pairs, each heterogeneous sample pair includes two heterogeneous images, and the two heterogeneous images. category label; S2、构建权值共享两路网络,权值共享两路网络包括两个并列的结构相同且共享权值的分支,每个分支均采用resnet34去除残差连接后的主干网络;S2. Construct a weight-sharing two-way network. The weight-sharing two-way network includes two juxtaposed branches with the same structure and shared weights. Each branch uses resnet34 to remove the backbone network after the residual connection; S3、对于异类组合集中的每个异类样本二元组,将该异类样本二元组中的两张异类图像分别输入权值共享两路网络中的两个分支,根据两个分支相同结构和层级的隐藏层输出的对应特征,得到两个分支相同结构和层级的隐藏层输出特征差异;S3. For each heterogeneous sample pair in the heterogeneous combination set, input the two heterogeneous images in the heterogeneous sample pair into the two branches of the weight sharing two-way network, according to the same structure and level of the two branches The corresponding features of the hidden layer output of the two branches are obtained, and the difference of the hidden layer output features of the two branches with the same structure and level is obtained; S4、根据步骤S3中两个分支的交叉熵损失,和所有层级的隐藏层输出特征差异,定义得到基于隐藏层特征差异的组合损失函数,其中包括隐藏层输出特征差异的倒数;S4. According to the cross-entropy loss of the two branches in step S3, and the hidden layer output feature differences of all levels, define a combined loss function based on the hidden layer feature difference, including the reciprocal of the hidden layer output feature difference; S5、根据异类组合集和基于隐藏层特征差异的组合损失函数,端到端的训练权值共享两路网络;S5. According to the heterogeneous combination set and the combined loss function based on the difference in hidden layer features, the end-to-end training weights share the two-way network; S6、从训练好的权值共享两路网络中取出任一分支,作为最终的神经网络图像分类预测模型;S6. Take any branch from the trained weight sharing two-way network as the final neural network image classification prediction model; S7、将测试图像数据集输入神经网络图像分类预测模型,输出得到图像分类结果。S7. Input the test image data set into the neural network image classification prediction model, and output the image classification result. 2.根据权利要求1所述的基于隐藏层特征差异的神经网络图像分类性能提升方法,其特征在于,步骤S1中,对训练图像数据集进行预处理的过程具体包括:对训练图像数据集中所有类别进行组合,遍历所有类别组合方式,对每种组合中两个类别的图片集做笛卡尔乘积,将该笛卡尔乘积并入异类组合集。2. the neural network image classification performance improvement method based on hidden layer feature difference according to claim 1, it is characterized in that, in step S1, the process that the training image data set is carried out to preprocessing specifically comprises: all in the training image data set Combining categories, traversing all category combinations, performing a Cartesian product on the image sets of two categories in each combination, and merging the Cartesian product into heterogeneous combination sets. 3.根据权利要求2所述的基于隐藏层特征差异的神经网络图像分类性能提升方法,其特征在于,权值共享两路网络中的每个分支,均按层级依次包括:1个卷积核大小为7*7,输出通道为64的卷积层;1个步长为2的池化层;6个卷积核大小为3*3,输出通道为64的卷积层;8个卷积核大小为3*3,输出通道为128的卷积层;12个卷积核大小为3*3,输出通道为256的卷积层;6个卷积核大小为3*3,输出通道为512的卷积层;1个平均池化层;1个线性层。3. The neural network image classification performance improvement method based on hidden layer feature differences according to claim 2, wherein each branch in the weight sharing two-way network includes: 1 convolution kernel in sequence A convolutional layer with a size of 7*7 and an output channel of 64; 1 pooling layer with a stride of 2; 6 convolutional layers with a kernel size of 3*3 and an output channel of 64; 8 convolutions The convolutional layer with a kernel size of 3*3 and an output channel of 128; 12 convolutional kernels with a size of 3*3 and a convolutional layer with an output channel of 256; 6 convolutional kernels with a size of 3*3 and an output channel of 512 convolutional layers; 1 average pooling layer; 1 linear layer. 4.根据权利要求3所述的基于隐藏层特征差异的神经网络图像分类性能提升方法,其特征在于,步骤S3中,异类样本二元组中分别对应两个分支的两张异类图像分别为input1和input2,则两个分支中分别得到的第i个隐藏层的特征,分别记为Hiddeni(input1)和Hiddeni(input2),第i个隐藏层输出特征差异为:4. The neural network image classification performance improvement method based on hidden layer feature difference according to claim 3, characterized in that, in step S3, the two heterogeneous images respectively corresponding to two branches in the heterogeneous sample binary group are respectively input1 and input2, then the features of the i-th hidden layer obtained in the two branches are respectively recorded as Hidden i (input1) and Hidden i (input2), and the output feature difference of the i-th hidden layer is: Disi(input1,input2) = || Hiddeni(input1)-Hiddeni(input2) ||2Dis i (input1,input2) = || Hidden i (input1)-Hidden i (input2) || 2 . 5.根据权利要求4所述的基于隐藏层特征差异的神经网络图像分类性能提升方法,其特征在于,步骤S4中,基于隐藏层特征差异的组合损失函数包括所有隐藏层特征差异以及网络最终输出与标签的交叉熵损失,具体为:5. The neural network image classification performance improvement method based on hidden layer feature difference according to claim 4, characterized in that, in step S4, the combined loss function based on hidden layer feature difference includes all hidden layer feature differences and the final output of the network The cross-entropy loss with labels, specifically: Loss = ∑1/Disi + cross_entropy(output1,label1) + cross_entropy(output2,label2),Loss = ∑1/Dis i + cross_entropy(output1,label1) + cross_entropy(output2,label2), 其中,Disi为第i个隐藏层输出特征差异,input1,input2为两张异类图像,label1,label2为两张异类图像对应的标签,output1,output2分别为权值共享两路网络的两个分支的最终输出,函数cross_entropy(x,y)即计算结果为x和y的交叉熵。Among them, Dis i is the output feature difference of the i-th hidden layer, input1 and input2 are two heterogeneous images, label1 and label2 are the labels corresponding to the two heterogeneous images, output1 and output2 are the two branches of the weight sharing two-way network respectively The final output of the function cross_entropy(x,y) is the cross entropy of x and y. 6.根据权利要求5所述的基于隐藏层特征差异的神经网络图像分类性能提升方法,其特征在于,步骤S5中,训练权值共享两路网络的目标,在于使基于隐藏层特征差异的组合损失达到最小。6. The neural network image classification performance improvement method based on hidden layer feature difference according to claim 5, characterized in that, in step S5, the goal of training weights sharing two-way network is to make the combination based on hidden layer feature difference The loss is minimized. 7.根据权利要求6所述的基于隐藏层特征差异的神经网络图像分类性能提升方法,其特征在于,训练权值共享两路网络的损失连续十轮下降都不超过1/10000,则认为基于隐藏层特征差异的组合损失达到最小。7. The neural network image classification performance improvement method based on hidden layer feature difference according to claim 6, characterized in that, the loss of the training weight sharing two-way network does not exceed 1/10000 for ten consecutive rounds of decline, then it is considered that based on The combined loss of the hidden layer feature difference is minimized. 8.根据权利要求7所述的基于隐藏层特征差异的神经网络图像分类性能提升方法,其特征在于,步骤S5中,权值共享两路网络的训练过程为:遍历异类组合集中的异类样本二元组,将其中一张异类图像和该异类图像的类别标签输入到权值共享两路网络中的一个分支,将其中另一张异类图像和该异类图像的类别标签输入到权值共享两路网络中的另一个分支,使用基于隐藏层特征差异的组合损失函数作为训练损失,进行端到端训练。8. The method for improving the performance of neural network image classification based on hidden layer feature differences according to claim 7, wherein in step S5, the training process of the weight sharing two-way network is: traversing the heterogeneous samples in the heterogeneous combination set A tuple, input one of the heterogeneous images and the category label of the heterogeneous image into a branch of the weight sharing two-way network, and input the other heterogeneous image and the category label of the heterogeneous image into the weight sharing two-way Another branch in the network is trained end-to-end using a combined loss function based on the difference in hidden layer features as the training loss.
CN202310077690.XA 2023-02-08 2023-02-08 Neural network image classification performance improving method based on hidden layer feature difference Active CN115797710B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310077690.XA CN115797710B (en) 2023-02-08 2023-02-08 Neural network image classification performance improving method based on hidden layer feature difference

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310077690.XA CN115797710B (en) 2023-02-08 2023-02-08 Neural network image classification performance improving method based on hidden layer feature difference

Publications (2)

Publication Number Publication Date
CN115797710A true CN115797710A (en) 2023-03-14
CN115797710B CN115797710B (en) 2023-04-07

Family

ID=85430390

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310077690.XA Active CN115797710B (en) 2023-02-08 2023-02-08 Neural network image classification performance improving method based on hidden layer feature difference

Country Status (1)

Country Link
CN (1) CN115797710B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016033708A1 (en) * 2014-09-03 2016-03-10 Xiaoou Tang Apparatus and methods for image data classification
US20170180398A1 (en) * 2015-12-21 2017-06-22 Ebay Inc. Automatic detection of hidden link mismatches with spoofed metadata
CN113011499A (en) * 2021-03-22 2021-06-22 安徽大学 Hyperspectral remote sensing image classification method based on double-attention machine system
CN113177916A (en) * 2021-04-21 2021-07-27 清华大学深圳国际研究生院 Slight hypertension fundus identification model based on few-sample learning method
CN113987294A (en) * 2021-11-10 2022-01-28 国网上海市电力公司 CVT (continuously variable transmission) online fault diagnosis method based on genetic optimization GRU (generalized regression Unit) neural network
CN114925736A (en) * 2021-07-20 2022-08-19 王树松 Object classification method, device, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016033708A1 (en) * 2014-09-03 2016-03-10 Xiaoou Tang Apparatus and methods for image data classification
US20170180398A1 (en) * 2015-12-21 2017-06-22 Ebay Inc. Automatic detection of hidden link mismatches with spoofed metadata
CN113011499A (en) * 2021-03-22 2021-06-22 安徽大学 Hyperspectral remote sensing image classification method based on double-attention machine system
CN113177916A (en) * 2021-04-21 2021-07-27 清华大学深圳国际研究生院 Slight hypertension fundus identification model based on few-sample learning method
CN114925736A (en) * 2021-07-20 2022-08-19 王树松 Object classification method, device, equipment and storage medium
CN113987294A (en) * 2021-11-10 2022-01-28 国网上海市电力公司 CVT (continuously variable transmission) online fault diagnosis method based on genetic optimization GRU (generalized regression Unit) neural network

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
GUANSHUO WANG等: "learning discriminative features with multiple granularities for person re-identification" *
张敏等: "基于可区分度的连续空间属性约简算法研究" *
赵子豪: "基于卷积神经网络的白细胞图像检测及分类技术" *
陈薪羽等: "基于多列卷积神经网络的参数异步更新算法" *

Also Published As

Publication number Publication date
CN115797710B (en) 2023-04-07

Similar Documents

Publication Publication Date Title
CN111275711B (en) Real-time image semantic segmentation method based on lightweight convolutional neural network model
Liu et al. FDDWNet: a lightweight convolutional neural network for real-time semantic segmentation
WO2020221200A1 (en) Neural network construction method, image processing method and devices
CN109344893B (en) A kind of image classification method based on mobile terminal
CN115131558A (en) Semantic segmentation method under less-sample environment
CN114926636A (en) Point cloud semantic segmentation method, device, equipment and storage medium
CN116403090B (en) Small-size target detection method based on dynamic anchor frame and transducer
CN112016670A (en) A Model Optimization and Compression Method for Lightweight Neural Networks
WO2022161387A1 (en) Neural network training method and related device
CN110110775A (en) A kind of matching cost calculation method based on hyper linking network
CN112215199A (en) SAR image ship detection method based on multi-receptive field and dense feature aggregation network
CN115797710B (en) Neural network image classification performance improving method based on hidden layer feature difference
CN113792822B (en) Efficient dynamic image classification method
Luan et al. LRP‐based network pruning and policy distillation of robust and non‐robust DRL agents for embedded systems
CN111368995A (en) General network compression framework and compression method based on sequence recommendation system
CN115937121A (en) Non-reference image quality evaluation method and system based on multi-dimensional feature fusion
CN115019101A (en) Image classification method based on information bottleneck algorithm in image classification network
CN118587562B (en) Knowledge distillation method, image processing method and equipment for graphic multi-mode model
Zhan et al. Field programmable gate array‐based all‐layer accelerator with quantization neural networks for sustainable cyber‐physical systems
CN118690783A (en) A model building method based on hybrid experts and parameter reuse
Dongfang et al. Traffic sign classification network using inception module
CN117010462A (en) A method and system for generating neural network models
CN116226547A (en) Incremental graph recommendation method based on streaming data
CN116306942A (en) Reasoning processing method, device and electronic equipment for language processing model
CN113947193A (en) A point cloud-oriented high-efficiency binarized neural network quantization method and 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