Nothing Special   »   [go: up one dir, main page]

CN115049627B - Steel Surface Defect Detection Method and System Based on Domain Adaptive Deep Migration Network - Google Patents

Steel Surface Defect Detection Method and System Based on Domain Adaptive Deep Migration Network Download PDF

Info

Publication number
CN115049627B
CN115049627B CN202210739856.5A CN202210739856A CN115049627B CN 115049627 B CN115049627 B CN 115049627B CN 202210739856 A CN202210739856 A CN 202210739856A CN 115049627 B CN115049627 B CN 115049627B
Authority
CN
China
Prior art keywords
domain
loss
encoder
sample
separation
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.)
Active
Application number
CN202210739856.5A
Other languages
Chinese (zh)
Other versions
CN115049627A (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.)
Jiangnan University
Original Assignee
Jiangnan University
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 Jiangnan University filed Critical Jiangnan University
Priority to CN202210739856.5A priority Critical patent/CN115049627B/en
Publication of CN115049627A publication Critical patent/CN115049627A/en
Application granted granted Critical
Publication of CN115049627B publication Critical patent/CN115049627B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection
    • G06T2207/30136Metal
    • 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
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Computing Systems (AREA)
  • Medical Informatics (AREA)
  • Multimedia (AREA)
  • Databases & Information Systems (AREA)
  • Computational Linguistics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Quality & Reliability (AREA)
  • Data Mining & Analysis (AREA)
  • Molecular Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Image Analysis (AREA)
  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)

Abstract

本发明提供一种基于域自适应深度迁移网络的钢表面缺陷检测方法及系统,方法包括:获取带钢表面典型缺陷图像样本,并对样本进行预处理;构建对抗域分离与自适应网络模型;将新样本特征嵌入到源域图像样本的共享特征中,并计算任务分类损失和嵌入分类损失;通过将多个损失添加权重,动态地优化动态分类损失与动态适应损失,并更新模型参数;当迭代次数达最优时,保存所述模型参数,并输入所述目标领域测试集,得到所述目标领域中钢表面缺陷检测的精度。本发明在对抗域分离与自适应深度迁移网络的基础上引入自适应挖掘样本隐藏信息和添加动态权重优化损失算法,提高了网络模型的泛化能力,最终实现更加精确的钢表面缺陷检测。

Figure 202210739856

The invention provides a steel surface defect detection method and system based on a domain-adaptive deep migration network. The method includes: acquiring a typical defect image sample on the strip steel surface, and preprocessing the sample; constructing a confrontational domain separation and self-adaptive network model; Embed the new sample features into the shared features of the source domain image samples, and calculate the task classification loss and embedding classification loss; by adding weights to multiple losses, dynamically optimize the dynamic classification loss and dynamic adaptation loss, and update the model parameters; when When the number of iterations reaches the optimum, save the model parameters and input the test set in the target field to obtain the detection accuracy of steel surface defects in the target field. The invention introduces adaptive mining sample hidden information and adds dynamic weight optimization loss algorithm on the basis of confrontational domain separation and self-adaptive deep migration network, improves the generalization ability of the network model, and finally realizes more accurate detection of steel surface defects.

Figure 202210739856

Description

基于域自适应深度迁移网络的钢表面缺陷检测方法及系统Steel Surface Defect Detection Method and System Based on Domain Adaptive Deep Migration Network

技术领域technical field

本发明属于图像检测技术领域,尤其涉及一种基于域自适应深度迁移网络的钢表面缺陷检测方法及系统。The invention belongs to the technical field of image detection, and in particular relates to a steel surface defect detection method and system based on a domain-adaptive deep migration network.

背景技术Background technique

钢材广泛应用于汽车制造、航空航天、日常生活用品等域,是国民经济发展中不可缺少的重要原材料。随着社会的快速发展,其质量要求越来越严格。在生产加工过程中,由于受到环境、设备性能、加工工艺等因素的影响,钢材表面会产生各种缺陷,如孔洞、划痕等。这些可观察到的缺陷会导致钢材性能发生变化,极大地降低了产品质量,从而对制造企业造成很大的负面影响和经济损失。因此钢表面缺陷检测作为钢材质量监测的重要环节受到了广泛的关注。Steel is widely used in automobile manufacturing, aerospace, daily necessities and other fields, and is an indispensable and important raw material in the development of the national economy. With the rapid development of society, its quality requirements are becoming more and more stringent. In the process of production and processing, due to the influence of factors such as the environment, equipment performance, and processing technology, various defects, such as holes and scratches, will occur on the surface of the steel. These observable defects can lead to changes in steel properties and greatly reduce product quality, resulting in large negative impacts and economic losses on manufacturing companies. Therefore, steel surface defect detection, as an important part of steel quality monitoring, has received extensive attention.

钢材表面检测的首要目标是准确预测缺陷类型,由于早期主要采用人工检测,存在成本高、效率低、主观判断等不足。为此机器学习技术提供了一种高效、客观的图像检测方法,在一定程度上提高了缺陷识别的精度与效率。然而这种传统的机器学习需要专业人士具有丰富的经验及域知识才能提取出更加合适的特征,检测性能很大程度上依赖于特征的选择。与传统的机器学习不同,深度学习无需人工提取特征,可避免大量特征与分类器结合的试错实验,深层次、多角度地实现对图像特征的刻画。但深度学习在实际应用中仍存在许多待解决的问题,如计算量庞大、标注样本获取难、训练样本耗时费力等。The primary goal of steel surface inspection is to accurately predict the type of defect. Since manual inspection was mainly used in the early stage, there were deficiencies such as high cost, low efficiency, and subjective judgment. For this reason, machine learning technology provides an efficient and objective image detection method, which improves the accuracy and efficiency of defect recognition to a certain extent. However, this kind of traditional machine learning requires professionals with rich experience and domain knowledge to extract more suitable features, and the detection performance largely depends on the selection of features. Different from traditional machine learning, deep learning does not require manual feature extraction, which can avoid the trial-and-error experiment of combining a large number of features with classifiers, and achieve in-depth and multi-angle characterization of image features. However, there are still many problems to be solved in the practical application of deep learning, such as huge amount of calculation, difficulty in obtaining labeled samples, and time-consuming and laborious training samples.

随着人工智能技术的发展,迁移学习成为当前基于机器视觉的表面缺陷检测方法较为重要的研究内容之一,迁移学习的目标是将源任务获得的知识迁移到目标任务中辅助目标任务进行学习,解决深度学习中存在的样本量不足、训练效率低等问题。然而由于域差异(特征分布差异)的存在,直接迁移将降低模型性能。域自适应可以通过特征变换对齐源域与目标域的特征信息,解决域差异带来的问题。深度域自适应学习通过迁移特征信息打破了传统深度学习中样本同分布的局限性,加快了模型的收敛速度,但在实际应用中深度域自适应网络仍然存在图像特征提取能力弱、模型稳定性差且不易收敛等问题。因此,有必要优化深度域自适应网络,以进一步提高模型的训练性能。With the development of artificial intelligence technology, transfer learning has become one of the more important research contents of the current surface defect detection method based on machine vision. The goal of transfer learning is to transfer the knowledge obtained from the source task to the target task to assist the target task in learning. Solve the problems of insufficient sample size and low training efficiency in deep learning. However, due to the existence of domain differences (differences in feature distribution), direct transfer will degrade the model performance. Domain adaptation can align the feature information of the source domain and the target domain through feature transformation, and solve the problems caused by domain differences. Deep domain adaptive learning breaks the limitation of the same distribution of samples in traditional deep learning by transferring feature information, and accelerates the convergence speed of the model. However, in practical applications, the deep domain adaptive network still has weak image feature extraction capabilities and poor model stability. And it is not easy to converge and other problems. Therefore, it is necessary to optimize the deep domain adaptive network to further improve the training performance of the model.

发明内容Contents of the invention

本发明实施例提供一种基于域自适应深度迁移网络的钢表面缺陷检测方法及系统,用于解决现有技术中检测模型的泛化能力差,甚至存在较低识别率的技术缺陷的问题。Embodiments of the present invention provide a steel surface defect detection method and system based on a domain-adaptive deep migration network, which is used to solve the problem of poor generalization ability of detection models in the prior art and even technical defects of low recognition rate.

本发明实施例提供一种基于域自适应深度迁移网络的钢表面缺陷检测方法,该方法包括:An embodiment of the present invention provides a method for detecting steel surface defects based on a domain-adaptive deep migration network, the method comprising:

S1:获取带钢表面典型缺陷图像样本,并对样本进行预处理;S1: Obtain image samples of typical defects on the surface of the strip, and preprocess the samples;

S2:根据预处理后样本构建对抗域分离与自适应网络模型;S2: Construct an adversarial domain separation and adaptive network model based on the preprocessed samples;

S3:将新样本特征嵌入到预处理后得到的源域图像样本的共享特征中,并输入至所述对抗域分离与自适应网络模型,计算任务分类损失和嵌入分类损失;S3: Embedding the new sample feature into the shared feature of the source domain image sample obtained after preprocessing, and inputting it into the adversarial domain separation and adaptive network model, and calculating the task classification loss and embedding classification loss;

S4:通过对多个损失添加权重,动态地优化动态分类损失与动态适应损失,其中所述动态分类损失包括任务分类损失和嵌入分类损失,所述动态适应损失包括域适应损失与域分离损失,并更新所述对抗域分离与自适应网络模型的参数;S4: Dynamically optimize dynamic classification loss and dynamic adaptation loss by adding weights to multiple losses, wherein the dynamic classification loss includes task classification loss and embedding classification loss, and the dynamic adaptation loss includes domain adaptation loss and domain separation loss, And update the parameters of the confrontational domain separation and adaptive network model;

S5:判断更新中迭代次数是否达到最优迭代次数,若达到,则执行步骤S6,否则,返回执行步骤S3;S5: Determine whether the number of iterations in the update reaches the optimal number of iterations, if so, execute step S6, otherwise, return to execute step S3;

S6:保存所述参数,得到优化好的对抗域分离与自适应网络模型,并检测目标领域样本测试集,得到钢表面缺陷检测精度。S6: Save the parameters, obtain an optimized adversarial domain separation and adaptive network model, and detect the target domain sample test set to obtain the steel surface defect detection accuracy.

优选地,所述步骤S1中对样本进行预处理的方法为:Preferably, the method for preprocessing the sample in the step S1 is:

首先,对所有图像样本进行分割并统一尺寸,选取N个源域图像样本与N个目标域图像样本,其中,所述源域图像样本与所述目标域图像样本均包括合格图像样本与缺陷图像样本,N为正整数;First, all image samples are divided and unified in size, and N source domain image samples and N target domain image samples are selected, wherein the source domain image samples and the target domain image samples both include qualified image samples and defective images Sample, N is a positive integer;

然后,将所述源域图像样本与所述目标域图像样本按照相同的比例各分为训练集与测试集;Then, dividing the source domain image sample and the target domain image sample into a training set and a test set according to the same ratio;

最后,将所述源域图像样本输入深度提取网络模型中,训练所述深度提取网络模型,得到训练好的模型参数。Finally, the source domain image sample is input into a deep extraction network model, and the deep extraction network model is trained to obtain trained model parameters.

优选地,所述步骤S2中根据预处理后样本构建对抗域分离与自适应网络模型的方法为:Preferably, the method of constructing the confrontational domain separation and adaptive network model according to the preprocessed samples in the step S2 is as follows:

首先,将源域图像样本与目标域图像样本训练集输入基于深度卷积神经网络的多个编码器网络模型,基于所述多个编码器网络模型分离源域与目标域各自的私有部分以及源域和目标域之间的共享部分,实现域信息分离,所述多个编码器网络模型包括共享编码器、源域私有编码器和目标域私有编码器网络模型;First, the source domain image samples and target domain image sample training sets are input into multiple encoder network models based on deep convolutional neural networks, and based on the multiple encoder network models, the private parts of the source domain and the target domain and the source domain are separated. The shared part between the domain and the target domain realizes the separation of domain information, and the plurality of encoder network models include a shared encoder, a source domain private encoder and a target domain private encoder network model;

然后,利用所述源域图像样本训练好的模型参数初始化所述多个编码器网络模型;Then, initialize the plurality of encoder network models using the model parameters trained by the source domain image samples;

最后,将初始化后多个编码器网络模型的输出通过多层全连接网络输入到任务分类器、域适应鉴别器和域分离鉴别器中。Finally, the outputs of multiple encoder network models after initialization are input into the task classifier, domain adaptation discriminator and domain separation discriminator through a multi-layer fully connected network.

优选地,所述步骤S3中将新样本特征嵌入到预处理后得到的源域图像样本的共享特征中的方法为:Preferably, the method of embedding the new sample features into the shared features of the source domain image samples obtained after preprocessing in the step S3 is as follows:

根据对抗域分离与自适应网络模型的训练状态来自适应调整新样本特征的类间距离,并采用空间线性插值方法实现新样本的嵌入,所述对抗域分离与自适应模型的训练状态是通过训练过程中任务分类器的分类损失衡量;Adaptively adjust the inter-class distance of new sample features according to the training state of the confrontational domain separation and adaptive network model, and use the spatial linear interpolation method to realize the embedding of new samples. The classification loss measure of the task classifier in the process;

其中,所述新样本特征表示如下:Wherein, the new sample features are expressed as follows:

Figure BDA0003706170240000041
Figure BDA0003706170240000041

其中,

Figure BDA0003706170240000042
为嵌入的新样本特征,其标签对应相应的异类样本标签,X为同类样本特征,X-为异类样本特征,Ltask为任务分类损失,λ为调整嵌入新样本特征类间距离的参数;in,
Figure BDA0003706170240000042
is the embedded new sample feature, and its label corresponds to the corresponding heterogeneous sample label, X is the same sample feature, X - is the heterogeneous sample feature, L task is the task classification loss, and λ is a parameter to adjust the inter-class distance of the embedded new sample feature;

对所述新特征进行优化,其表达式如下:The new feature is optimized, and its expression is as follows:

Figure BDA0003706170240000043
Figure BDA0003706170240000043

DE(X,X+)=‖X,X+2 D E (X, X + ) = ‖X, X +2

Figure BDA0003706170240000044
Figure BDA0003706170240000044

DE(X,X+)<DE(X,X-)D E (X, X + )<D E (X, X - )

其中,

Figure BDA0003706170240000045
为嵌入的新样本特征,其标签对应相应的异类样本标签,X为同类样本特征,X-为异类样本特征,X+为原始样本特征,Ltask为任务分类损失,λ为调整嵌入新样本特征类间距离的参数,DE(X,X+)为同类样本之间的距离,DE(X,X-)为同类样本与异类样本之间的距离。in,
Figure BDA0003706170240000045
is the embedded new sample feature, its label corresponds to the corresponding heterogeneous sample label, X is the same sample feature, X - is the heterogeneous sample feature, X + is the original sample feature, L task is the task classification loss, λ is the adjusted embedding new sample feature The parameters of the distance between classes, D E (X, X + ) is the distance between samples of the same class, and D E (X, X - ) is the distance between samples of the same class and samples of different classes.

优选地,所述步骤S4中通过将多个损失添加权重,动态地优化动态分类损失与动态适应损失,具体包括:Preferably, in the step S4, the dynamic classification loss and the dynamic adaptation loss are dynamically optimized by adding weights to multiple losses, specifically including:

所述动态分类损失是通过动态地调整任务分类损失和嵌入分类损失的权重的结果,表示如下:The dynamic classification loss is the result of dynamically adjusting the weights of the task classification loss and the embedded classification loss, expressed as follows:

Figure BDA0003706170240000051
Figure BDA0003706170240000051

其中,Ldynamic-class为动态分类损失,Ltask为任务分类损失,Lembedded为嵌入分类损失;Among them, L dynamic-class is the dynamic classification loss, L task is the task classification loss, and L embedded is the embedded classification loss;

所述动态适应损失是通过动态地调整所述域适应损失与所述域分离损失的权重的结果,表示如下:The dynamic adaptation loss is the result of dynamically adjusting the weights of the domain adaptation loss and the domain separation loss, expressed as follows:

Figure BDA0003706170240000052
Figure BDA0003706170240000052

其中,Ldynamic-ad为动态适应损失,Ladapt为域适应损失,Lsep为域分离损失。Among them, L dynamic-ad is the dynamic adaptation loss, L adapt is the domain adaptation loss, and L sep is the domain separation loss.

优选地,所述任务分类损失Ltask根据交叉熵计算得到,表示如下:Preferably, the task classification loss L task is calculated according to cross entropy, expressed as follows:

Figure BDA0003706170240000053
Figure BDA0003706170240000053

其中,Ctask为任务分类器,Enj为共享编码器,

Figure BDA0003706170240000054
为任务分类器的权值参数,
Figure BDA0003706170240000055
为共享编码器的权值参数,xs为源域图像样本。Among them, C task is the task classifier, En j is the shared encoder,
Figure BDA0003706170240000054
is the weight parameter of the task classifier,
Figure BDA0003706170240000055
is the weight parameter of the shared encoder, and x s is the image sample in the source domain.

优选地,所述域适应损失Ladapt根据域适应鉴别器混淆域特征产生,表示如下:Preferably, the domain adaptation loss L adapt is generated according to the domain adaptation discriminator confusion domain features, expressed as follows:

Figure BDA0003706170240000061
Figure BDA0003706170240000061

其中,Enj为共享编码器,Dadapt为域适应鉴别器,

Figure BDA0003706170240000062
为共享编码器的权值参数,
Figure BDA0003706170240000063
为域适应鉴别器的权值参数,xs为源域图像样本,xt为目标域图像样本,Ex图像样本数学期望。Among them, En j is the shared encoder, D adapt is the domain adaptive discriminator,
Figure BDA0003706170240000062
is the weight parameter of the shared encoder,
Figure BDA0003706170240000063
is the weight parameter of the domain adaptation discriminator, x s is the image sample in the source domain, x t is the image sample in the target domain, and E x is the mathematical expectation of the image sample.

优选地,所述域分离损失Lsep根据域分离鉴别器分离域特征产生,表示如下:Preferably, the domain separation loss L sep is generated according to the separated domain features of the domain separation discriminator, expressed as follows:

Figure BDA0003706170240000064
Figure BDA0003706170240000064

其中,Enj为共享编码器,

Figure BDA0003706170240000065
为源域私有编码器,/>
Figure BDA0003706170240000066
为目标域私有编码器,Dsep为域分离鉴别器,/>
Figure BDA0003706170240000067
为共享编码器的权值参数,/>
Figure BDA0003706170240000068
为源域私有编码器的权值参数,
Figure BDA0003706170240000069
为目标域私有编码器的权值参数,/>
Figure BDA00037061702400000610
为域分离鉴别器的权值参数,xs为源域图像样本,xt为目标域图像样本,Ex图像样本数学期望。Among them, En j is the shared encoder,
Figure BDA0003706170240000065
private encoder for the source domain, />
Figure BDA0003706170240000066
is the target domain private encoder, D sep is the domain separation discriminator, />
Figure BDA0003706170240000067
is the weight parameter of the shared encoder, />
Figure BDA0003706170240000068
is the weight parameter of the private encoder in the source domain,
Figure BDA0003706170240000069
is the weight parameter of the private encoder in the target domain, />
Figure BDA00037061702400000610
is the weight parameter of the domain separation discriminator, x s is the source domain image sample, x t is the target domain image sample, E x the mathematical expectation of the image sample.

优选地,所述步骤S4中更新所述对抗域分离与自适应网络模型的的方法为:Preferably, the method for updating the confrontational domain separation and adaptive network model in the step S4 is:

通过动态分类损失、域适应损失和域分离损失进行反向传播迭代更新多个编码器、域适应鉴别器和域分离鉴别器的模型参数,具体包括:Iteratively update the model parameters of multiple encoders, domain adaptation discriminators and domain separation discriminators through backpropagation through dynamic classification loss, domain adaptation loss and domain separation loss, including:

初始化参数θ:Initialize parameter θ:

Figure BDA0003706170240000071
Figure BDA0003706170240000071

其中,

Figure BDA0003706170240000072
为域适应鉴别器的权值参数,/>
Figure BDA0003706170240000073
为域分离鉴别器的权值参数,
Figure BDA0003706170240000074
为任务分类器的权值参数,/>
Figure BDA0003706170240000075
为共享编码器的权值参数,/>
Figure BDA0003706170240000076
为源域私有编码器的权值参数,/>
Figure BDA0003706170240000077
为目标域私有编码器的权值参数;in,
Figure BDA0003706170240000072
weight parameter for the domain adaptation discriminator, />
Figure BDA0003706170240000073
is the weight parameter of the domain separation discriminator,
Figure BDA0003706170240000074
is the weight parameter of the task classifier, />
Figure BDA0003706170240000075
is the weight parameter of the shared encoder, />
Figure BDA0003706170240000076
is the weight parameter of the private encoder in the source domain, />
Figure BDA0003706170240000077
is the weight parameter of the private encoder of the target domain;

动态分类损失更新各网络参数如下:The dynamic classification loss updates each network parameter as follows:

Figure BDA0003706170240000078
Figure BDA0003706170240000078

Figure BDA0003706170240000079
Figure BDA0003706170240000079

其中,Enj为共享编码器,Ctask为任务分类器,

Figure BDA00037061702400000710
为共享编码器的权值参数,
Figure BDA00037061702400000711
为任务分类器的权值参数,Ldynamic-class为动态分类损失,η为学习率,/>
Figure BDA00037061702400000712
为微分运算符;Among them, En j is the shared encoder, C task is the task classifier,
Figure BDA00037061702400000710
is the weight parameter of the shared encoder,
Figure BDA00037061702400000711
is the weight parameter of the task classifier, L dynamic-class is the dynamic classification loss, η is the learning rate, />
Figure BDA00037061702400000712
is a differential operator;

域适应损失更新各网络模型参数如下:The domain adaptation loss updates the parameters of each network model as follows:

Figure BDA00037061702400000713
Figure BDA00037061702400000713

Figure BDA00037061702400000714
Figure BDA00037061702400000714

其中,Dadapt为域适应鉴别器,Enj为共享编码器,

Figure BDA00037061702400000715
为域适应鉴别器的权值参数,/>
Figure BDA00037061702400000716
为共享编码器的权值参数,Ladapt为域适应损失,η为学习率,/>
Figure BDA00037061702400000717
为微分运算符;Among them, D adapt is the domain adaptive discriminator, En j is the shared encoder,
Figure BDA00037061702400000715
weight parameter for the domain adaptation discriminator, />
Figure BDA00037061702400000716
is the weight parameter of the shared encoder, L adapt is the domain adaptation loss, η is the learning rate, />
Figure BDA00037061702400000717
is a differential operator;

域分离损失更新各网络模型参数如下:The domain separation loss updates the parameters of each network model as follows:

Figure BDA00037061702400000718
Figure BDA00037061702400000718

Figure BDA0003706170240000081
Figure BDA0003706170240000081

Figure BDA0003706170240000082
Figure BDA0003706170240000082

Figure BDA0003706170240000083
Figure BDA0003706170240000083

其中,Enj为共享编码器,

Figure BDA0003706170240000084
为源域私有编码器,/>
Figure BDA0003706170240000085
为目标域私有编码器,Dsep为域分离鉴别器,/>
Figure BDA0003706170240000086
为共享编码器的权值参数,/>
Figure BDA0003706170240000087
为源域私有编码器的权值参数,
Figure BDA0003706170240000088
为目标域私有编码器的权值参数,/>
Figure BDA0003706170240000089
为域分离鉴别器的权值参数,Ladapt为域适应损失,Lsep为域分离损失,η为学习率,/>
Figure BDA00037061702400000810
为微分运算符。Among them, En j is the shared encoder,
Figure BDA0003706170240000084
private encoder for the source domain, />
Figure BDA0003706170240000085
is the target domain private encoder, D sep is the domain separation discriminator, />
Figure BDA0003706170240000086
is the weight parameter of the shared encoder, />
Figure BDA0003706170240000087
is the weight parameter of the private encoder in the source domain,
Figure BDA0003706170240000088
is the weight parameter of the private encoder in the target domain, />
Figure BDA0003706170240000089
is the weight parameter of the domain separation discriminator, L adapt is the domain adaptation loss, L sep is the domain separation loss, η is the learning rate, />
Figure BDA00037061702400000810
is a differentiation operator.

本发明实施例提供一种基于域自适应深度迁移网络的钢表面缺陷检测系统,该系统包括:An embodiment of the present invention provides a steel surface defect detection system based on a domain-adaptive deep migration network, the system includes:

样本预处理模块,用于获取带钢表面典型缺陷图像样本,并对样本进行预处理;The sample preprocessing module is used to obtain image samples of typical defects on the surface of the strip and preprocess the samples;

构建网络模型模块,用于根据预处理后样本构建对抗域分离与自适应网络模型;Build a network model module, which is used to build an adversarial domain separation and adaptive network model based on preprocessed samples;

优化网络模型模块,用于将新样本特征嵌入到预处理后得到的源域图像样本的共享特征中,并输入至所述对抗域分离与自适应网络模型,计算任务分类损失和嵌入分类损失;通过对多个损失添加权重,动态地优化动态分类损失与动态适应损失,其中所述动态分类损失包括任务分类损失和嵌入分类损失,所述动态适应损失包括域适应损失与域分离损失,并更新所述对抗域分离与自适应网络模型的参数;判断更新中迭代次数是否达到最优迭代次数,若达到,则将优化结果输入样本检测模块,否则,继续进行迭代计算;Optimizing the network model module for embedding the new sample features into the shared features of the source domain image samples obtained after preprocessing, and inputting them into the confrontational domain separation and adaptive network model, calculating task classification loss and embedding classification loss; Dynamically optimize dynamic classification loss and dynamic adaptation loss by adding weights to multiple losses, wherein the dynamic classification loss includes task classification loss and embedding classification loss, the dynamic adaptation loss includes domain adaptation loss and domain separation loss, and updates The parameters of the confrontational domain separation and adaptive network model; judging whether the number of iterations in the update reaches the optimal number of iterations, if so, input the optimization result into the sample detection module, otherwise, continue the iterative calculation;

样本检测模块,用于保存所述参数,得到优化好的对抗域分离与自适应网络模型,并检测目标领域样本测试集,得到钢表面缺陷检测精度。The sample detection module is used to save the parameters, obtain the optimized confrontation domain separation and self-adaptive network model, and detect the target domain sample test set to obtain the steel surface defect detection accuracy.

所述系统用以实现上述所述的一种基于域自适应深度迁移网络的钢表面缺陷检测方法。The system is used to realize the above-mentioned steel surface defect detection method based on domain adaptive deep migration network.

与现有技术相比,本发明具有如下的有益效果:Compared with the prior art, the present invention has the following beneficial effects:

本发明提供一种基于域自适应深度迁移网络的钢表面缺陷检测方法及系统,本发明在对抗域分离与自适应深度迁移网络的基础上引入自适应挖掘样本隐藏信息和添加动态权重优化损失算法。自适应挖掘样本隐藏信息可以提高网络模型训练过程中的收敛速度与识别精度,而添加动态权重优化损失可以使在源领域上训练好的网络模型在目标领域上表现良好,使得网络模型自适应领域的变化,提高网络模型的泛化能力,最终实现更加精确的钢表面缺陷检测。The present invention provides a steel surface defect detection method and system based on a domain-adaptive deep migration network. The present invention introduces adaptive mining sample hidden information and adds a dynamic weight optimization loss algorithm on the basis of confrontational domain separation and adaptive deep migration network . Adaptive mining of sample hidden information can improve the convergence speed and recognition accuracy in the network model training process, and adding dynamic weight optimization loss can make the network model trained in the source domain perform well in the target domain, making the network model adaptive domain The change of the network model improves the generalization ability of the network model, and finally achieves more accurate steel surface defect detection.

附图说明Description of drawings

为了更清楚地说明本发明实施案例或现有技术中的技术方案,下边将对实施例中所需要使用的附图做简单介绍,通过参考附图会更清楚的理解本发明的特征和优点,附图是示意性的而不应该理解为对本发明进行任何限制,对于本域普通技术人员来讲,在不付出创造性劳动的前提下,可以根据这些附图获得其他的附图。其中:In order to more clearly illustrate the implementation cases of the present invention or the technical solutions in the prior art, the accompanying drawings that need to be used in the embodiments will be briefly introduced below, and the features and advantages of the present invention will be more clearly understood by referring to the accompanying drawings. The accompanying drawings are schematic and should not be construed as limiting the present invention in any way. Those skilled in the art can obtain other drawings according to these drawings without creative work. in:

图1是根据本发明实施例的一种基于域自适应深度迁移网络的钢表面缺陷检测方法的流程图;Fig. 1 is a flow chart of a steel surface defect detection method based on a domain-adaptive deep migration network according to an embodiment of the present invention;

图2是根据本发明实施例的一种基于对抗域分离与自适应深度迁移网络模型的结构图;FIG. 2 is a structural diagram of a network model based on confrontational domain separation and adaptive deep migration according to an embodiment of the present invention;

图3是根据本发明实施例的嵌入新样本特征原理示意图;Fig. 3 is a schematic diagram of the principle of embedding new sample features according to an embodiment of the present invention;

图4是根据本发明实施例的一种基于域自适应深度迁移网络的钢表面缺陷检测系统的框图。Fig. 4 is a block diagram of a steel surface defect detection system based on a domain-adaptive deep migration network according to an embodiment of the present invention.

具体实施方式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. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.

实施例一Embodiment one

本发明实施例提供一种基于域自适应深度迁移网络的钢表面缺陷检测方法,如图1所示,本实施例的方法包括:An embodiment of the present invention provides a steel surface defect detection method based on a domain-adaptive deep migration network. As shown in FIG. 1 , the method of this embodiment includes:

S101:获取带钢表面典型缺陷图像样本,并对样本进行预处理;S101: Obtain an image sample of a typical defect on the surface of the strip, and preprocess the sample;

S102:根据预处理后样本构建对抗域分离与自适应网络模型;S102: Construct an adversarial domain separation and adaptive network model according to the preprocessed samples;

S103:将新样本特征嵌入到预处理后得到的源域图像样本的共享特征中,并输入至所述对抗域分离与自适应网络模型,计算任务分类损失和嵌入分类损失;S103: Embedding the new sample feature into the shared feature of the source domain image sample obtained after preprocessing, and inputting it into the adversarial domain separation and adaptive network model, and calculating task classification loss and embedding classification loss;

S104:通过对多个损失添加权重,动态地优化动态分类损失与动态适应损失,其中所述动态分类损失包括任务分类损失和嵌入分类损失,所述动态适应损失包括域适应损失与域分离损失,并更新所述对抗域分离与自适应网络模型的参数;S104: Dynamically optimize dynamic classification loss and dynamic adaptation loss by adding weights to multiple losses, wherein the dynamic classification loss includes task classification loss and embedding classification loss, and the dynamic adaptation loss includes domain adaptation loss and domain separation loss, And update the parameters of the confrontational domain separation and adaptive network model;

S105:判断更新中迭代次数是否达到最优迭代次数,若达到,则执行步骤S106,否则,返回执行步骤S103;S105: Determine whether the number of iterations in the update reaches the optimal number of iterations, if so, execute step S106, otherwise, return to execute step S103;

S106:保存所述参数,得到优化好的对抗域分离与自适应网络模型,并检测目标领域样本测试集,得到钢表面缺陷检测精度。S106: Save the parameters, obtain an optimized adversarial domain separation and self-adaptive network model, and detect a target domain sample test set to obtain steel surface defect detection accuracy.

本发明提供一种基于域自适应深度迁移网络的钢表面缺陷检测方法,本发明通过建立基于分类损失的对抗域分离与自适应模型性能评价机制;同时利用空间线性插值方法自适应挖掘迁移空间隐藏的样本信息,将挖掘的新样本的分类结果作为衡量其对网络贡献性能的主要度量指标,并将贡献性能作为权重应用在分类损失上,旨在消除噪声样本对模型造成的影响;在对抗训练过程中,通过添加动态权重优化对抗损失、平滑网络参数,提高模型的判别性能。本发明能够提高网络模型的训练性能,很大程度地提高了领域偏移环境下钢表面缺陷检测的准确性。The invention provides a steel surface defect detection method based on a domain-adaptive deep migration network. The invention establishes an adversarial domain separation based on a classification loss and an adaptive model performance evaluation mechanism; at the same time, a spatial linear interpolation method is used to adaptively mine migration space hidden The sample information of the mined new sample is used as the main metric to measure its contribution to the network performance, and the contribution performance is applied as a weight to the classification loss, aiming to eliminate the influence of noise samples on the model; in confrontation training In the process, the discriminative performance of the model is improved by adding dynamic weights to optimize the confrontation loss and smooth the network parameters. The invention can improve the training performance of the network model, and greatly improves the accuracy of steel surface defect detection under the domain offset environment.

进一步地,在步骤S101中对样本进行预处理的方法为:Further, the method for preprocessing the sample in step S101 is:

首先,对所有图像样本进行分割并统一尺寸,选取N个源域图像样本{Xs}与N个目标域图像样本{Xt},其中,所述源域图像样本与所述目标域图像样本均包括合格图像样本与缺陷图像样本,N为正整数;First, all the image samples are divided and unified in size, and N source domain image samples {X s } and N target domain image samples {X t } are selected, wherein, the source domain image samples and the target domain image samples Both include qualified image samples and defective image samples, and N is a positive integer;

然后,将所述源域图像样本与所述目标域图像样本按照相同的比例各分为训练集与测试集;Then, dividing the source domain image sample and the target domain image sample into a training set and a test set according to the same ratio;

最后,将所述源域图像样本输入深度提取网络模型中,训练所述深度提取网络模型,得到训练好的模型参数。Finally, the source domain image sample is input into a deep extraction network model, and the deep extraction network model is trained to obtain trained model parameters.

图2为发明实施例的一种基于对抗域分离与自适应深度迁移网络模型的结构图,如图2所示,网络模型由三个部分组成:特征提取部分、特征迁移部分和任务分类部分。其中,特征提取部分包括共享编码器Enj、源域私有编码器

Figure BDA0003706170240000111
和目标域私有编码器/>
Figure BDA0003706170240000112
特征迁移部分包括域适应鉴别器Dadapt和域分离鉴别器Dsep,任务分类部分包括任务分类器Ctask。Fig. 2 is a structural diagram of a network model based on confrontational domain separation and adaptive deep migration according to an embodiment of the invention. As shown in Fig. 2, the network model consists of three parts: feature extraction part, feature migration part and task classification part. Among them, the feature extraction part includes the shared encoder En j , the source domain private encoder
Figure BDA0003706170240000111
and target domain private encoder />
Figure BDA0003706170240000112
The feature migration part includes a domain adaptation discriminator D adapt and a domain separation discriminator D sep , and the task classification part includes a task classifier C task .

所述共享编码器Enj、源域私有编码器

Figure BDA0003706170240000121
和目标域私有编码器/>
Figure BDA0003706170240000122
采用AlexNet网络的特征提取结构(即5个卷积层和3个全连接层),提取源域和目标域的共享特征/>
Figure BDA0003706170240000123
以及各自的私有特征/>
Figure BDA0003706170240000124
所述任务分类器Ctask由由一个全连接层构成,用于预测任务标签;所述域适应鉴别器Dadapt由两个全连接层组成,用于预测共享特征/>
Figure BDA0003706170240000125
的域标签,域分离鉴别器Dsep同样由两个全连接层组成,用于预测特征标签。The shared encoder En j , the source domain private encoder
Figure BDA0003706170240000121
and target domain private encoder />
Figure BDA0003706170240000122
Using the feature extraction structure of the AlexNet network (that is, 5 convolutional layers and 3 fully connected layers), extract the shared features of the source domain and the target domain />
Figure BDA0003706170240000123
and their respective private traits />
Figure BDA0003706170240000124
The task classifier C task is composed of a fully connected layer for predicting task labels; the domain adaptation discriminator D adapt is composed of two fully connected layers for predicting shared features/>
Figure BDA0003706170240000125
The domain label of the domain separation discriminator D sep also consists of two fully connected layers for predicting feature labels.

进一步地,在步骤S102中构建对抗域分离与自适应网络模型的方法为:Further, in step S102, the method for constructing the confrontational domain separation and adaptive network model is as follows:

首先,将源域图像样本{Xs}与目标域图像样本{Xt}训练集输入基于深度卷积神经网络的多个编码器网络模型,基于所述多个编码器网络模型分离源域与目标域各自的私有部分以及源域和目标域之间的共享部分,实现域信息分离,所述多个编码器网络模型包括共享编码器Enj、源域私有编码器

Figure BDA0003706170240000126
和目标域私有编码器/>
Figure BDA0003706170240000127
网络模型;First, the source domain image sample {X s } and the target domain image sample {X t } training set are input into multiple encoder network models based on deep convolutional neural networks, and the source domain and target domain image samples are separated based on the multiple encoder network models. The private part of the target domain and the shared part between the source domain and the target domain realize domain information separation, and the multiple encoder network models include shared encoder En j , source domain private encoder
Figure BDA0003706170240000126
and target domain private encoder />
Figure BDA0003706170240000127
network model;

然后,利用所述源域图像样本训练好的模型参数初始化所述多个编码器网络模型;Then, initialize the plurality of encoder network models using the model parameters trained by the source domain image samples;

最后,将初始化后多个编码器网络模型的输出通过多层全连接网络输入到任务分类器Ctask、域适应鉴别器Dadapt和域分离鉴别器Dsep中。Finally, the outputs of multiple encoder network models after initialization are input into the task classifier C task , the domain adaptation discriminator D adapt and the domain separation discriminator D sep through a multi-layer fully connected network.

图3为本发明实施例的嵌入新样本特征原理示意图,如图3所示,X+表示原始样本特征,X表示同类样本特征

Figure BDA0003706170240000128
表示嵌入的新样本特征/>
Figure BDA0003706170240000129
X-表示异类样本特征。Fig. 3 is a schematic diagram of the principle of embedding new sample features according to the embodiment of the present invention. As shown in Fig. 3, X + represents the original sample feature, and X represents the similar sample feature
Figure BDA0003706170240000128
represents the embedded new sample features />
Figure BDA0003706170240000129
X - Indicates heterogeneous sample features.

进一步地,在步骤S103中将新样本特征嵌入到预处理后得到的源域图像样本的共享特征中的方法为:Further, in step S103, the method of embedding the new sample features into the shared features of the source domain image samples obtained after preprocessing is:

根据对抗域分离与自适应网络模型的训练状态来自适应调整新样本特征的类间距离,并采用空间线性插值方法实现新样本的嵌入,所述对抗域分离与自适应模型的训练状态是通过训练过程中任务分类器Ctask的分类损失衡量;Adaptively adjust the inter-class distance of new sample features according to the training state of the confrontational domain separation and adaptive network model, and use the spatial linear interpolation method to realize the embedding of new samples. The classification loss measurement of the task classifier C task in the process;

其中,新样本特征表示如下:Among them, the new sample features are expressed as follows:

Figure BDA0003706170240000131
Figure BDA0003706170240000131

其中,

Figure BDA0003706170240000132
为嵌入新样本特征,其标签对应相应的异类样本标签,X为同类样本特征,X-为异类样本特征,Ltask为任务分类损失,λ为调整嵌入新样本特征类间距离的参数;in,
Figure BDA0003706170240000132
To embed new sample features, its label corresponds to the corresponding heterogeneous sample label, X is the same sample feature, X - is the heterogeneous sample feature, L task is the task classification loss, and λ is the parameter to adjust the inter-class distance of the embedded new sample feature;

为避免嵌入的新样本特征

Figure BDA0003706170240000133
和同类样本特征X的类间距离接近零的情况出现,对所述新样本特征/>
Figure BDA0003706170240000134
进行优化,其表达式如下:New sample features to avoid embedding
Figure BDA0003706170240000133
When the inter-class distance with the same sample feature X is close to zero, for the new sample feature />
Figure BDA0003706170240000134
To optimize, its expression is as follows:

Figure BDA0003706170240000135
Figure BDA0003706170240000135

DE(X,X+)=‖X,X+2 D E (X, X + ) = ‖X, X +2

Figure BDA0003706170240000136
Figure BDA0003706170240000136

DE(X,X+)<DE(X,X-)D E (X, X + )<D E (X, X - )

其中,

Figure BDA0003706170240000137
为嵌入的新样本特征,其标签对应相应的异类样本标签,X为同类样本特征,X-为异类样本特征,X+为原始样本特征,Ltask为任务分类损失,λ为调整嵌入新样本特征类间距离的参数,DE(X,X+)为同类样本之间的距离,DE(X,X-)为同类样本与异类样本之间的距离。in,
Figure BDA0003706170240000137
is the embedded new sample feature, its label corresponds to the corresponding heterogeneous sample label, X is the same sample feature, X - is the heterogeneous sample feature, X + is the original sample feature, L task is the task classification loss, λ is the adjusted embedding new sample feature The parameters of the distance between classes, D E (X, X + ) is the distance between samples of the same class, and D E (X, X - ) is the distance between samples of the same class and samples of different classes.

进一步地,在步骤S104中通过将多个损失添加权重,动态地优化动态分类损失与动态适应损失,具体包括:Further, in step S104, by adding weights to multiple losses, the dynamic classification loss and dynamic adaptation loss are dynamically optimized, specifically including:

所述动态分类损失是通过动态地调整任务分类损失和嵌入分类损失的权重的结果,表示如下:The dynamic classification loss is the result of dynamically adjusting the weights of the task classification loss and the embedded classification loss, expressed as follows:

Figure BDA0003706170240000141
Figure BDA0003706170240000141

其中,Ldynamic-class为动态分类损失,Ltask为任务分类损失,Lembedded为嵌入分类损失;Among them, L dynamic-class is the dynamic classification loss, L task is the task classification loss, and L embedded is the embedded classification loss;

所述动态适应损失是通过动态地调整所述域适应损失与所述域分离损失的权重的结果,表示如下:The dynamic adaptation loss is the result of dynamically adjusting the weights of the domain adaptation loss and the domain separation loss, expressed as follows:

Figure BDA0003706170240000142
Figure BDA0003706170240000142

其中,Ldynamic-ad为动态适应损失,Ladapt为域适应损失,Lsep为域分离损失。Among them, L dynamic-ad is the dynamic adaptation loss, L adapt is the domain adaptation loss, and L sep is the domain separation loss.

进一步地,所述任务分类损失Ltask根据交叉熵计算得到,表示如下:Further, the task classification loss L task is calculated according to the cross entropy, expressed as follows:

Figure BDA0003706170240000143
Figure BDA0003706170240000143

其中,Ctask为任务分类器,Enj为共享编码器,

Figure BDA0003706170240000144
为任务分类器的权值参数,
Figure BDA0003706170240000145
为共享编码器的权值参数,xs为源域图像样本。Among them, C task is the task classifier, En j is the shared encoder,
Figure BDA0003706170240000144
is the weight parameter of the task classifier,
Figure BDA0003706170240000145
is the weight parameter of the shared encoder, and x s is the image sample in the source domain.

进一步地,所述域适应损失Ladapt根据域适应鉴别器混淆域特征产生,表示如下:Further, the domain adaptation loss L adapt is generated according to the domain adaptation discriminator confusion domain features, expressed as follows:

Figure BDA0003706170240000151
Figure BDA0003706170240000151

其中,Enj为共享编码器,Dadapt为域适应鉴别器,

Figure BDA0003706170240000152
为共享编码器的权值参数,
Figure BDA0003706170240000153
为域适应鉴别器的权值参数,xs为源域图像样本,xt为目标域图像样本,Ex图像样本数学期望。Among them, En j is the shared encoder, D adapt is the domain adaptive discriminator,
Figure BDA0003706170240000152
is the weight parameter of the shared encoder,
Figure BDA0003706170240000153
is the weight parameter of the domain adaptation discriminator, x s is the image sample in the source domain, x t is the image sample in the target domain, and E x is the mathematical expectation of the image sample.

进一步地,所述域分离损失Lsep根据域分离鉴别器分离域特征产生,表示如下:Further, the domain separation loss L sep is generated according to the domain separation discriminator separation domain features, expressed as follows:

Figure BDA0003706170240000154
Figure BDA0003706170240000154

其中,Enj为共享编码器,

Figure BDA0003706170240000155
为源域私有编码器,/>
Figure BDA0003706170240000156
为目标域私有编码器,Dsep为域分离鉴别器,/>
Figure BDA0003706170240000157
为共享编码器的权值参数,/>
Figure BDA0003706170240000158
为源域私有编码器的权值参数,
Figure BDA0003706170240000159
为目标域私有编码器的权值参数,/>
Figure BDA00037061702400001510
为域分离鉴别器的权值参数,xs为源域图像样本,xt为目标域图像样本,Ex图像样本数学期望。Among them, En j is the shared encoder,
Figure BDA0003706170240000155
private encoder for the source domain, />
Figure BDA0003706170240000156
is the target domain private encoder, D sep is the domain separation discriminator, />
Figure BDA0003706170240000157
is the weight parameter of the shared encoder, />
Figure BDA0003706170240000158
is the weight parameter of the private encoder in the source domain,
Figure BDA0003706170240000159
is the weight parameter of the private encoder in the target domain, />
Figure BDA00037061702400001510
is the weight parameter of the domain separation discriminator, x s is the source domain image sample, x t is the target domain image sample, E x the mathematical expectation of the image sample.

再进一步地,更新所述对抗域分离与自适应网络模型的参数的方法为:Further, the method for updating the parameters of the confrontational domain separation and adaptive network model is:

通过动态分类损失、域适应损失和域分离损失进行反向传播迭代更新多个编码器、域适应鉴别器和域分离鉴别器的模型参数,具体包括:Iteratively update the model parameters of multiple encoders, domain adaptation discriminators and domain separation discriminators through backpropagation through dynamic classification loss, domain adaptation loss and domain separation loss, including:

初始化参数θ:Initialize parameter θ:

Figure BDA00037061702400001511
Figure BDA00037061702400001511

其中,

Figure BDA0003706170240000161
为域适应鉴别器的权值参数,/>
Figure BDA0003706170240000162
为域分离鉴别器的权值参数,
Figure BDA0003706170240000163
为任务分类器的权值参数,/>
Figure BDA0003706170240000164
为共享编码器的权值参数,/>
Figure BDA0003706170240000165
为源域私有编码器的权值参数,/>
Figure BDA0003706170240000166
为目标域私有编码器的权值参数;in,
Figure BDA0003706170240000161
weight parameter for the domain adaptation discriminator, />
Figure BDA0003706170240000162
is the weight parameter of the domain separation discriminator,
Figure BDA0003706170240000163
is the weight parameter of the task classifier, />
Figure BDA0003706170240000164
is the weight parameter of the shared encoder, />
Figure BDA0003706170240000165
is the weight parameter of the private encoder in the source domain, />
Figure BDA0003706170240000166
is the weight parameter of the private encoder of the target domain;

动态分类损失更新各网络参数如下:The dynamic classification loss updates each network parameter as follows:

Figure BDA0003706170240000167
Figure BDA0003706170240000167

Figure BDA0003706170240000168
Figure BDA0003706170240000168

其中,Enj为共享编码器,Ctask为任务分类器,

Figure BDA0003706170240000169
为共享编码器的权值参数,
Figure BDA00037061702400001610
为任务分类器的权值参数,Ldynamic-class为动态分类损失,η为学习率,/>
Figure BDA00037061702400001611
为微分运算符;Among them, En j is the shared encoder, C task is the task classifier,
Figure BDA0003706170240000169
is the weight parameter of the shared encoder,
Figure BDA00037061702400001610
is the weight parameter of the task classifier, L dynamic-class is the dynamic classification loss, η is the learning rate, />
Figure BDA00037061702400001611
is a differential operator;

域适应损失更新各网络模型参数如下:The domain adaptation loss updates the parameters of each network model as follows:

Figure BDA00037061702400001612
Figure BDA00037061702400001612

Figure BDA00037061702400001613
Figure BDA00037061702400001613

其中,Dadapt为域适应鉴别器,Enj为共享编码器,

Figure BDA00037061702400001614
为域适应鉴别器的权值参数,/>
Figure BDA00037061702400001615
为共享编码器的权值参数,Ladapt为域适应损失,η为学习率,/>
Figure BDA00037061702400001616
为微分运算符;Among them, D adapt is the domain adaptive discriminator, En j is the shared encoder,
Figure BDA00037061702400001614
weight parameter for the domain adaptation discriminator, />
Figure BDA00037061702400001615
is the weight parameter of the shared encoder, L adapt is the domain adaptation loss, η is the learning rate, />
Figure BDA00037061702400001616
is a differential operator;

域分离损失更新各网络模型参数如下:The domain separation loss updates the parameters of each network model as follows:

Figure BDA00037061702400001617
Figure BDA00037061702400001617

Figure BDA00037061702400001618
Figure BDA00037061702400001618

Figure BDA0003706170240000171
Figure BDA0003706170240000171

Figure BDA0003706170240000172
Figure BDA0003706170240000172

其中,Enj为共享编码器,

Figure BDA0003706170240000173
为源域私有编码器,/>
Figure BDA0003706170240000174
为目标域私有编码器,Dsep为域分离鉴别器,/>
Figure BDA0003706170240000175
为共享编码器的权值参数,/>
Figure BDA0003706170240000176
为源域私有编码器的权值参数,
Figure BDA0003706170240000177
为目标域私有编码器的权值参数,/>
Figure BDA0003706170240000178
为域分离鉴别器的权值参数,Ladapt为域适应损失,Lsep为域分离损失,η为学习率,/>
Figure BDA0003706170240000179
为微分运算符。Among them, En j is the shared encoder,
Figure BDA0003706170240000173
private encoder for the source domain, />
Figure BDA0003706170240000174
is the target domain private encoder, D sep is the domain separation discriminator, />
Figure BDA0003706170240000175
is the weight parameter of the shared encoder, />
Figure BDA0003706170240000176
is the weight parameter of the private encoder in the source domain,
Figure BDA0003706170240000177
is the weight parameter of the private encoder in the target domain, />
Figure BDA0003706170240000178
is the weight parameter of the domain separation discriminator, L adapt is the domain adaptation loss, L sep is the domain separation loss, η is the learning rate, />
Figure BDA0003706170240000179
is a differentiation operator.

实施例二Embodiment two

本发明实施例提供一种基于域自适应深度迁移网络的钢表面缺陷检测系统,如图4所示,包括:An embodiment of the present invention provides a steel surface defect detection system based on a domain-adaptive deep migration network, as shown in FIG. 4 , including:

样本预处理模块401,用于获取带钢表面典型缺陷图像样本,并对样本进行预处理;A sample preprocessing module 401, configured to obtain image samples of typical defects on the surface of the strip, and preprocess the samples;

构建网络模型模块402,用于根据预处理后样本构建对抗域分离与自适应网络模型;Building a network model module 402, used to build an adversarial domain separation and adaptive network model according to the preprocessed samples;

优化网络模型模块403,用于将新样本特征嵌入到预处理后得到的源域图像样本的共享特征中,并输入至所述对抗域分离与自适应网络模型,计算任务分类损失和嵌入分类损失;通过对多个损失添加权重,动态地优化动态分类损失与动态适应损失,其中所述动态分类损失包括任务分类损失和嵌入分类损失,所述动态适应损失包括域适应损失与域分离损失,并更新所述对抗域分离与自适应网络模型的参数;判断更新中迭代次数是否达到最优迭代次数,若达到,则将优化结果输入样本检测模块,否则,继续进行迭代计算;The optimization network model module 403 is used to embed the new sample features into the shared features of the source domain image samples obtained after preprocessing, and input them into the adversarial domain separation and adaptive network model, and calculate the task classification loss and embedding classification loss ; Dynamically optimize dynamic classification loss and dynamic adaptation loss by adding weights to multiple losses, wherein the dynamic classification loss includes task classification loss and embedding classification loss, and the dynamic adaptation loss includes domain adaptation loss and domain separation loss, and Updating the parameters of the adversarial domain separation and adaptive network model; judging whether the number of iterations in the update reaches the optimal number of iterations, if so, input the optimization result into the sample detection module, otherwise, continue the iterative calculation;

样本检测模块404,用于保存所述参数,得到优化好的对抗域分离与自适应网络模型,并检测目标领域样本测试集,得到钢表面缺陷检测精度。The sample detection module 404 is used to save the parameters, obtain an optimized confrontational domain separation and self-adaptive network model, and detect the sample test set in the target domain to obtain the detection accuracy of steel surface defects.

所述系统,用以实现上述实施例一所述的一种基于域自适应深度迁移网络的钢表面缺陷检测方法,在此不再赘述。The system is used to realize the steel surface defect detection method based on the domain-adaptive deep migration network described in the first embodiment above, which will not be repeated here.

本域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems, or computer program products. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.

本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to flowcharts and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a An apparatus for realizing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.

这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.

这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in the flow chart or blocks of the flowchart and/or the block or blocks of the block diagrams.

显然,上述实施例仅仅是为清楚地说明所作的举例,并非对实施方式的限定。对于所属域的普通技术人员来说,在上述说明的基础上还可以做出其它不同形式变化或变动。这里无需也无法对所有的实施方式予以穷举。而由此所引申出的显而易见的变化或变动仍处于本发明创造的保护范围之中。Apparently, the above-mentioned embodiments are only examples for clear description, and are not intended to limit the implementation. For those of ordinary skill in the art, other changes or changes in different forms can be made on the basis of the above description. It is not necessary and impossible to exhaustively list all the implementation manners here. However, the obvious changes or changes derived therefrom are still within the scope of protection of the present invention.

Claims (9)

1.一种基于域自适应深度迁移网络的钢表面缺陷检测方法,其特征在于,包括:1. A steel surface defect detection method based on domain adaptive deep migration network, characterized in that, comprising: S1:获取带钢表面典型缺陷图像样本,并对样本进行预处理;S1: Obtain image samples of typical defects on the surface of the strip, and preprocess the samples; S2:根据预处理后样本构建对抗域分离与自适应网络模型;S2: Construct an adversarial domain separation and adaptive network model based on the preprocessed samples; S3:将新样本特征嵌入到预处理后得到的源域图像样本的共享特征中,并输入至所述对抗域分离与自适应网络模型,计算任务分类损失和嵌入分类损失;S3: Embedding the new sample feature into the shared feature of the source domain image sample obtained after preprocessing, and inputting it into the adversarial domain separation and adaptive network model, and calculating the task classification loss and embedding classification loss; S4:通过对多个损失添加权重,动态地优化动态分类损失与动态适应损失,其中所述动态分类损失包括任务分类损失和嵌入分类损失,所述动态适应损失包括域适应损失与域分离损失,并更新所述对抗域分离与自适应网络模型的参数;S4: Dynamically optimize dynamic classification loss and dynamic adaptation loss by adding weights to multiple losses, wherein the dynamic classification loss includes task classification loss and embedding classification loss, and the dynamic adaptation loss includes domain adaptation loss and domain separation loss, And update the parameters of the confrontational domain separation and adaptive network model; S5:判断更新中迭代次数是否达到最优迭代次数,若达到,则执行步骤S6,否则,返回执行步骤S3;S5: Determine whether the number of iterations in the update reaches the optimal number of iterations, if so, execute step S6, otherwise, return to execute step S3; S6:保存所述参数,得到优化好的对抗域分离与自适应网络模型,并检测目标领域样本测试集,得到钢表面缺陷检测精度;S6: Save the parameters, obtain the optimized adversarial domain separation and adaptive network model, and detect the sample test set in the target domain to obtain the detection accuracy of steel surface defects; 所述步骤S2中根据预处理后样本构建对抗域分离与自适应网络模型的方法为:In the step S2, the method of constructing the confrontational domain separation and adaptive network model according to the preprocessed samples is as follows: 首先,将源域图像样本与目标域图像样本训练集输入基于深度卷积神经网络的多个编码器网络模型,基于所述多个编码器网络模型分离源域与目标域各自的私有部分以及源域和目标域之间的共享部分,实现域信息分离,所述多个编码器网络模型包括共享编码器、源域私有编码器和目标域私有编码器网络模型;First, the source domain image samples and target domain image sample training sets are input into multiple encoder network models based on deep convolutional neural networks, and based on the multiple encoder network models, the respective private parts of the source domain and the target domain and the source domain are separated. The shared part between the domain and the target domain realizes the separation of domain information, and the plurality of encoder network models include a shared encoder, a source domain private encoder and a target domain private encoder network model; 然后,利用所述源域图像样本训练好的模型参数初始化所述多个编码器网络模型;Then, initialize the plurality of encoder network models using the model parameters trained by the source domain image samples; 最后,将初始化后多个编码器网络模型的输出通过多层全连接网络输入到任务分类器、域适应鉴别器和域分离鉴别器中。Finally, the outputs of multiple encoder network models after initialization are input into the task classifier, domain adaptation discriminator and domain separation discriminator through a multi-layer fully connected network. 2.根据权利要求1所述的一种基于域自适应深度迁移网络的钢表面缺陷检测方法,其特征在于,所述步骤S1中对样本进行预处理的方法为:2. A kind of steel surface defect detection method based on domain self-adaptive deep migration network according to claim 1, is characterized in that, the method that sample is carried out preprocessing in described step S1 is: 首先,对所有图像样本进行分割并统一尺寸,选取N个源域图像样本与N个目标域图像样本,其中,所述源域图像样本与所述目标域图像样本均包括合格图像样本与缺陷图像样本,N为正整数;First, all image samples are divided and unified in size, and N source domain image samples and N target domain image samples are selected, wherein the source domain image samples and the target domain image samples both include qualified image samples and defective images Sample, N is a positive integer; 然后,将所述源域图像样本与所述目标域图像样本按照相同的比例各分为训练集与测试集;Then, dividing the source domain image sample and the target domain image sample into a training set and a test set according to the same ratio; 最后,将所述源域图像样本输入深度提取网络模型中,训练所述深度提取网络模型,得到训练好的模型参数。Finally, the source domain image sample is input into a deep extraction network model, and the deep extraction network model is trained to obtain trained model parameters. 3.根据权利要求1所述的一种基于域自适应深度迁移网络的钢表面缺陷检测方法,其特征在于,所述步骤S3中将新样本特征嵌入到预处理后得到的源域图像样本的共享特征中的方法为:3. A method for detecting steel surface defects based on a domain-adaptive deep migration network according to claim 1, wherein in said step S3, the new sample features are embedded into the source domain image samples obtained after preprocessing The methods in the shared trait are: 根据对抗域分离与自适应网络模型的训练状态来自适应调整新样本特征的类间距离,并采用空间线性插值方法实现新样本的嵌入,所述对抗域分离与自适应模型的训练状态是通过训练过程中任务分类器的分类损失衡量;Adaptively adjust the inter-class distance of new sample features according to the training state of the confrontational domain separation and adaptive network model, and use the spatial linear interpolation method to realize the embedding of new samples. The classification loss measure of the task classifier in the process; 其中,所述新样本特征表示如下:Wherein, the new sample features are expressed as follows:
Figure QLYQS_1
Figure QLYQS_1
其中,
Figure QLYQS_2
为嵌入的新样本特征,其标签对应相应的异类样本标签,X为同类样本特征,X-为异类样本特征,Ltask为任务分类损失,λ为调整嵌入新样本特征类间距离的参数;
in,
Figure QLYQS_2
is the embedded new sample feature, and its label corresponds to the corresponding heterogeneous sample label, X is the same sample feature, X - is the heterogeneous sample feature, L task is the task classification loss, and λ is a parameter to adjust the inter-class distance of the embedded new sample feature;
对所述新样本特征进行优化,其表达式如下:The new sample features are optimized, and its expression is as follows:
Figure QLYQS_3
Figure QLYQS_3
DE(X,X+)=‖X,X+2 D E (X, X + ) = ‖X, X +2
Figure QLYQS_4
Figure QLYQS_4
DE(X,X+)<DE(X,X-)D E (X, X + )<D E (X, X - ) 其中,
Figure QLYQS_5
为嵌入的新样本特征,其标签对应相应的异类样本标签,X为同类样本特征,X-为异类样本特征,X+为原始样本特征,Ltask为任务分类损失,λ为调整嵌入新样本特征类间距离的参数,DE(X,X+)为同类样本之间的距离,DE(X,X-)为同类样本与异类样本之间的距离。
in,
Figure QLYQS_5
is the embedded new sample feature, its label corresponds to the corresponding heterogeneous sample label, X is the same sample feature, X - is the heterogeneous sample feature, X + is the original sample feature, L task is the task classification loss, λ is the adjusted embedding new sample feature The parameters of the distance between classes, D E (X, X + ) is the distance between samples of the same class, and D E (X, X - ) is the distance between samples of the same class and samples of different classes.
4.根据权利要求1所述的一种基于域自适应深度迁移网络的钢表面缺陷检测方法,其特征在于,所述步骤S4中通过对多个损失添加权重,动态地优化动态分类损失与动态适应损失,具体包括:4. A method for detecting steel surface defects based on a domain-adaptive deep migration network according to claim 1, wherein in said step S4, by adding weights to multiple losses, dynamically optimize the dynamic classification loss and dynamic Adapting to loss, specifically: 所述动态分类损失是通过动态地调整任务分类损失和嵌入分类损失的权重的结果,表示如下:The dynamic classification loss is the result of dynamically adjusting the weights of the task classification loss and the embedded classification loss, expressed as follows:
Figure QLYQS_6
Figure QLYQS_6
其中,Ldynamic-class为动态分类损失,Ltask为任务分类损失,Lembedded为嵌入分类损失;Among them, L dynamic-class is the dynamic classification loss, L task is the task classification loss, and L embedded is the embedded classification loss; 所述动态适应损失是通过动态地调整所述域适应损失与所述域分离损失的权重的结果,表示如下:The dynamic adaptation loss is the result of dynamically adjusting the weights of the domain adaptation loss and the domain separation loss, expressed as follows:
Figure QLYQS_7
Figure QLYQS_7
其中,Ldynamic-ad为动态适应损失,Ladapt为域适应损失,Lsep为域分离损失。Among them, L dynamic-ad is the dynamic adaptation loss, L adapt is the domain adaptation loss, and L sep is the domain separation loss.
5.根据权利要求4所述的一种基于域自适应深度迁移网络的钢表面缺陷检测方法,其特征在于,所述任务分类损失Ltask根据交叉熵计算得到,表示如下:5. a kind of steel surface defect detection method based on domain adaptive deep migration network according to claim 4, is characterized in that, described task classification loss L task obtains according to cross-entropy calculation, expresses as follows:
Figure QLYQS_8
Figure QLYQS_8
其中,Ctask为任务分类器,Enj为共享编码器,
Figure QLYQS_9
为任务分类器的权值参数,/>
Figure QLYQS_10
为共享编码器的权值参数,xs为源域图像样本。
Among them, C task is the task classifier, En j is the shared encoder,
Figure QLYQS_9
is the weight parameter of the task classifier, />
Figure QLYQS_10
is the weight parameter of the shared encoder, and x s is the image sample in the source domain.
6.根据权利要求4所述的一种基于域自适应深度迁移网络的钢表面缺陷检测方法,其特征在于,所述域适应损失Ladapt根据域适应鉴别器混淆域特征产生,表示如下:6. a kind of steel surface defect detection method based on domain adaptive depth migration network according to claim 4, is characterized in that, described domain adaptation loss L adapt produces according to domain adaptation discriminator confusion domain feature, expresses as follows:
Figure QLYQS_11
Figure QLYQS_11
其中,Enj为共享编码器,Dadapt为域适应鉴别器,
Figure QLYQS_12
为共享编码器的权值参数,
Figure QLYQS_13
为域适应鉴别器的权值参数,xs为源域图像样本,xt为目标域图像样本,Ex图像样本数学期望。
Among them, En j is the shared encoder, D adapt is the domain adaptive discriminator,
Figure QLYQS_12
is the weight parameter of the shared encoder,
Figure QLYQS_13
is the weight parameter of the domain adaptation discriminator, x s is the image sample in the source domain, x t is the image sample in the target domain, and E x is the mathematical expectation of the image sample.
7.根据权利要求4所述的一种基于域自适应深度迁移网络的钢表面缺陷检测方法,其特征在于,所述域分离损失Lsep根据域分离鉴别器分离域特征产生,表示如下:7. A kind of steel surface defect detection method based on domain self-adaptive deep migration network according to claim 4, it is characterized in that, described domain separation loss L sep produces according to domain separation discriminator separation domain characteristic, expresses as follows:
Figure QLYQS_14
Figure QLYQS_14
其中,Enj为共享编码器,
Figure QLYQS_15
为源域私有编码器,/>
Figure QLYQS_16
为目标域私有编码器,Dsep为域分离鉴别器,/>
Figure QLYQS_17
为共享编码器的权值参数,/>
Figure QLYQS_18
为源域私有编码器的权值参数,/>
Figure QLYQS_19
为目标域私有编码器的权值参数,/>
Figure QLYQS_20
为域分离鉴别器的权值参数,xs为源域图像样本,xt为目标域图像样本,Ex图像样本数学期望。
Among them, En j is the shared encoder,
Figure QLYQS_15
private encoder for the source domain, />
Figure QLYQS_16
is the target domain private encoder, D sep is the domain separation discriminator, />
Figure QLYQS_17
is the weight parameter of the shared encoder, />
Figure QLYQS_18
is the weight parameter of the private encoder in the source domain, />
Figure QLYQS_19
is the weight parameter of the private encoder in the target domain, />
Figure QLYQS_20
is the weight parameter of the domain separation discriminator, x s is the source domain image sample, x t is the target domain image sample, E x the mathematical expectation of the image sample.
8.根据权利要求1或4所述的一种基于域自适应深度迁移网络的钢表面缺陷检测方法,其特征在于,所述步骤S4中更新所述对抗域分离与自适应网络模型的参数的方法为:8. A kind of steel surface defect detection method based on domain self-adaptive deep migration network according to claim 1 or 4, it is characterized in that, in the described step S4, update the parameters of the confrontational domain separation and self-adaptive network model The method is: 通过动态分类损失、域适应损失和域分离损失进行反向传播迭代更新多个编码器、域适应鉴别器和域分离鉴别器的模型参数,具体包括:Iteratively update the model parameters of multiple encoders, domain adaptation discriminators and domain separation discriminators through backpropagation through dynamic classification loss, domain adaptation loss and domain separation loss, including: 初始化参数θ:Initialize parameter θ:
Figure QLYQS_21
Figure QLYQS_21
其中,
Figure QLYQS_22
为域适应鉴别器的权值参数,/>
Figure QLYQS_23
为域分离鉴别器的权值参数,/>
Figure QLYQS_24
为任务分类器的权值参数,/>
Figure QLYQS_25
为共享编码器的权值参数,/>
Figure QLYQS_26
为源域私有编码器的权值参数,/>
Figure QLYQS_27
为目标域私有编码器的权值参数;
in,
Figure QLYQS_22
weight parameter for the domain adaptation discriminator, />
Figure QLYQS_23
is the weight parameter of the domain separation discriminator, />
Figure QLYQS_24
is the weight parameter of the task classifier, />
Figure QLYQS_25
is the weight parameter of the shared encoder, />
Figure QLYQS_26
is the weight parameter of the private encoder in the source domain, />
Figure QLYQS_27
is the weight parameter of the private encoder of the target domain;
动态分类损失更新各网络参数如下:The dynamic classification loss updates each network parameter as follows:
Figure QLYQS_28
Figure QLYQS_28
Figure QLYQS_29
Figure QLYQS_29
其中,Enj为共享编码器,Ctask为任务分类器,
Figure QLYQS_30
为共享编码器的权值参数,/>
Figure QLYQS_31
为任务分类器的权值参数,Ldynamic-class为动态分类损失,η为学习率,/>
Figure QLYQS_32
为微分运算符;
Among them, En j is the shared encoder, C task is the task classifier,
Figure QLYQS_30
is the weight parameter of the shared encoder, />
Figure QLYQS_31
is the weight parameter of the task classifier, L dynamic-class is the dynamic classification loss, η is the learning rate, />
Figure QLYQS_32
is a differential operator;
域适应损失更新各网络模型参数如下:The domain adaptation loss updates the parameters of each network model as follows:
Figure QLYQS_33
Figure QLYQS_33
Figure QLYQS_34
Figure QLYQS_34
其中,Dadapt为域适应鉴别器,Enj为共享编码器,
Figure QLYQS_35
为域适应鉴别器的权值参数,
Figure QLYQS_36
为共享编码器的权值参数,Ladapt为域适应损失,η为学习率,/>
Figure QLYQS_37
为微分运算符;
Among them, D adapt is the domain adaptive discriminator, En j is the shared encoder,
Figure QLYQS_35
is the weight parameter of the domain adaptation discriminator,
Figure QLYQS_36
is the weight parameter of the shared encoder, L adapt is the domain adaptation loss, η is the learning rate, />
Figure QLYQS_37
is a differential operator;
域分离损失更新各网络模型参数如下:The domain separation loss updates the parameters of each network model as follows:
Figure QLYQS_38
Figure QLYQS_38
Figure QLYQS_39
Figure QLYQS_39
Figure QLYQS_40
Figure QLYQS_40
Figure QLYQS_41
Figure QLYQS_41
其中,Enj为共享编码器,
Figure QLYQS_42
为源域私有编码器,/>
Figure QLYQS_43
为目标域私有编码器,Dsep为域分离鉴别器,/>
Figure QLYQS_44
为共享编码器的权值参数,/>
Figure QLYQS_45
为源域私有编码器的权值参数,/>
Figure QLYQS_46
为目标域私有编码器的权值参数,/>
Figure QLYQS_47
为域分离鉴别器的权值参数,Ladapt为域适应损失,Lsep为域分离损失,η为学习率,/>
Figure QLYQS_48
为微分运算符。
Among them, En j is the shared encoder,
Figure QLYQS_42
private encoder for the source domain, />
Figure QLYQS_43
is the target domain private encoder, D sep is the domain separation discriminator, />
Figure QLYQS_44
is the weight parameter of the shared encoder, />
Figure QLYQS_45
is the weight parameter of the private encoder in the source domain, />
Figure QLYQS_46
is the weight parameter of the private encoder in the target domain, />
Figure QLYQS_47
is the weight parameter of the domain separation discriminator, L adapt is the domain adaptation loss, L sep is the domain separation loss, η is the learning rate, />
Figure QLYQS_48
is a differentiation operator.
9.一种基于域自适应深度迁移网络的钢表面缺陷检测系统,其特征在于,包括:9. A steel surface defect detection system based on a domain-adaptive deep migration network, characterized in that it includes: 样本预处理模块,用于获取带钢表面典型缺陷图像样本,并对样本进行预处理;The sample preprocessing module is used to obtain image samples of typical defects on the surface of the strip and preprocess the samples; 构建网络模型模块,用于根据预处理后样本构建对抗域分离与自适应网络模型;Build a network model module, which is used to build an adversarial domain separation and adaptive network model based on preprocessed samples; 优化网络模型模块,用于将新样本特征嵌入到预处理后得到的源域图像样本的共享特征中,并输入至所述对抗域分离与自适应网络模型,计算任务分类损失和嵌入分类损失;通过对多个损失添加权重,动态地优化动态分类损失与动态适应损失,其中所述动态分类损失包括任务分类损失和嵌入分类损失,所述动态适应损失包括域适应损失与域分离损失,并更新所述对抗域分离与自适应网络模型的参数;判断更新中迭代次数是否达到最优迭代次数,若达到,则将优化结果输入样本检测模块,否则,继续进行迭代计算;Optimizing the network model module for embedding the new sample features into the shared features of the source domain image samples obtained after preprocessing, and inputting them into the confrontational domain separation and adaptive network model, calculating task classification loss and embedding classification loss; Dynamically optimize dynamic classification loss and dynamic adaptation loss by adding weights to multiple losses, wherein the dynamic classification loss includes task classification loss and embedding classification loss, the dynamic adaptation loss includes domain adaptation loss and domain separation loss, and updates The parameters of the confrontational domain separation and adaptive network model; judging whether the number of iterations in the update reaches the optimal number of iterations, if so, input the optimization result into the sample detection module, otherwise, continue the iterative calculation; 样本检测模块,用于保存所述参数,得到优化好的对抗域分离与自适应网络模型,并检测目标领域样本测试集,得到钢表面缺陷检测精度;The sample detection module is used to save the parameters, obtain the optimized confrontation domain separation and self-adaptive network model, and detect the sample test set in the target field to obtain the detection accuracy of steel surface defects; 所述构建网络模型模块中根据预处理后样本构建对抗域分离与自适应网络模型的方法为:The method of constructing confrontational domain separation and self-adaptive network model according to the sample after preprocessing in the described building network model module is: 首先,将源域图像样本与目标域图像样本训练集输入基于深度卷积神经网络的多个编码器网络模型,基于所述多个编码器网络模型分离源域与目标域各自的私有部分以及源域和目标域之间的共享部分,实现域信息分离,所述多个编码器网络模型包括共享编码器、源域私有编码器和目标域私有编码器网络模型;First, the source domain image samples and target domain image sample training sets are input into multiple encoder network models based on deep convolutional neural networks, and based on the multiple encoder network models, the respective private parts of the source domain and the target domain and the source domain are separated. The shared part between the domain and the target domain realizes the separation of domain information, and the plurality of encoder network models include a shared encoder, a source domain private encoder and a target domain private encoder network model; 然后,利用所述源域图像样本训练好的模型参数初始化所述多个编码器网络模型;Then, initialize the plurality of encoder network models using the model parameters trained by the source domain image samples; 最后,将初始化后多个编码器网络模型的输出通过多层全连接网络输入到任务分类器、域适应鉴别器和域分离鉴别器中。Finally, the outputs of multiple encoder network models after initialization are input into the task classifier, domain adaptation discriminator and domain separation discriminator through a multi-layer fully connected network.
CN202210739856.5A 2022-06-21 2022-06-21 Steel Surface Defect Detection Method and System Based on Domain Adaptive Deep Migration Network Active CN115049627B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210739856.5A CN115049627B (en) 2022-06-21 2022-06-21 Steel Surface Defect Detection Method and System Based on Domain Adaptive Deep Migration Network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210739856.5A CN115049627B (en) 2022-06-21 2022-06-21 Steel Surface Defect Detection Method and System Based on Domain Adaptive Deep Migration Network

Publications (2)

Publication Number Publication Date
CN115049627A CN115049627A (en) 2022-09-13
CN115049627B true CN115049627B (en) 2023-06-20

Family

ID=83164015

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210739856.5A Active CN115049627B (en) 2022-06-21 2022-06-21 Steel Surface Defect Detection Method and System Based on Domain Adaptive Deep Migration Network

Country Status (1)

Country Link
CN (1) CN115049627B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116883735B (en) * 2023-07-05 2024-03-08 江南大学 Domain self-adaptive wheat seed classification method based on public features and private features
CN117892203B (en) * 2024-03-14 2024-06-07 江南大学 Defective gear classification method, device and computer readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110880175A (en) * 2019-11-15 2020-03-13 广东工业大学 Welding spot defect detection method, system and equipment
CN113065581A (en) * 2021-03-18 2021-07-02 重庆大学 Vibration fault migration diagnosis method for reactance domain adaptive network based on parameter sharing

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109902798A (en) * 2018-05-31 2019-06-18 华为技术有限公司 Training method and device for deep neural network
CN111739076B (en) * 2020-06-15 2022-09-30 大连理工大学 Unsupervised content protection domain adaptation method for multiple CT lung texture recognition

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110880175A (en) * 2019-11-15 2020-03-13 广东工业大学 Welding spot defect detection method, system and equipment
CN113065581A (en) * 2021-03-18 2021-07-02 重庆大学 Vibration fault migration diagnosis method for reactance domain adaptive network based on parameter sharing

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于鉴别模型和对抗损失的无监督域自适应方法;赵文仓;袁立镇;徐长凯;;高技术通讯(第07期);全文 *
采用机器视觉与自适应卷积神经网络检测花生仁品质;张思雨;张秋菊;李可;;农业工程学报(第04期);全文 *

Also Published As

Publication number Publication date
CN115049627A (en) 2022-09-13

Similar Documents

Publication Publication Date Title
CN114627383B (en) A Few-Sample Defect Detection Method Based on Metric Learning
CN115049627B (en) Steel Surface Defect Detection Method and System Based on Domain Adaptive Deep Migration Network
CN110363344B (en) A Probabilistic Integral Parameter Prediction Method for Optimizing BP Neural Network Based on MIV-GP Algorithm
CN111860106B (en) Unsupervised bridge crack identification method
CN111815564B (en) Method and device for detecting silk ingots and silk ingot sorting system
CN109035233A (en) Visual attention network and Surface Flaw Detection method
CN110555467A (en) industrial data classification method based on model migration
CN104680509B (en) A kind of real-time circular printing image defect detection method
JP2021515885A (en) Methods, devices, systems and programs for setting lighting conditions and storage media
CN113297723B (en) Optimization method of electric spindle temperature measurement point based on mean shift-grey correlation analysis
CN102663422B (en) Floor layer classification method based on color characteristic
Jiang et al. Delving into sample loss curve to embrace noisy and imbalanced data
CN117611536A (en) A small sample metal defect detection method based on self-supervised learning
CN105405118A (en) Underwater sonar image target detection method based on hybrid quantum derivative frog leaping
Zeng et al. Steel sheet defect detection based on deep learning method
Gao et al. A hierarchical training-convolutional neural network with feature alignment for steel surface defect recognition
CN111239137A (en) Grain quality detection method based on transfer learning and adaptive deep convolutional neural network
CN113724233A (en) Transformer equipment appearance image defect detection method based on fusion data generation and transfer learning technology
CN112988815A (en) Method and system for online anomaly detection of large-scale high-dimensional high-speed stream data
CN116680639A (en) Deep-learning-based anomaly detection method for sensor data of deep-sea submersible
CN111080088A (en) Method for quickly judging product quality based on clustered hypersphere model
CN115222983A (en) A kind of cable damage detection method and system
CN110349119A (en) Pavement disease detection method and device based on edge detection neural network
CN113421236A (en) Building wall surface water leakage apparent development condition prediction method based on deep learning
CN116561710A (en) Transfer Learning Prediction Method of Welding Parameters Based on Data Space Transformation

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