Print

发布时间: 2020-04-16
摘要点击次数:
全文下载次数:
DOI: 10.11834/jig.190323
2020 | Volume 25 | Number 4




    图像分析和识别    




  <<上一篇 




  下一篇>> 





结合混沌鸟群算法的阴极铜板表面缺陷检测
expand article info 王卓1, 张长胜1, 李伟1, 钱俊兵1, 唐都作2, 蔡兵2, 常以涛2
1. 昆明理工大学信息工程与自动化学院, 昆明 650500;
2. 云南锡业股份有限公司铜业分公司, 昆明 661400

摘要

目的 铜电解过程中常因电解液溶解气体过饱阻止铜离子析出而在铜板表面形成凸起,常由操作员目视对铜板表面质量进行鉴别以决定归类,针对人工判别电解阴极铜板表面质量准确度和效率都较低的问题,提出一种结合混沌鸟群算法的铜板表面凸起智能识别方法。方法 为增强算法的全局搜索能力,引入鸟群算法;选取鸟群劣质个体交替进行混和动态步长位置更新增加种群多样性以免陷入局部最优;对铜板表面缺陷进行分析,提出基点生长法并结合形态学开操作消除铜板图像纹理以提高算法对凸起面积计算的准确性。将最佳熵阈值确定法(Kapur-Sahoo-Wong,KSW)作为鸟群算法的适应度函数对铜板图像进行阈值分割,通过统计分割图像凸起像素点个数,得到实际凸起面积占比以决定铜板是否合格。结果 将本文算法与遗传算法(genetic algorithm,GA)、鸡群算法(chicken swarm optimization,CSO)、萤火虫算法(glowworm swarm optimization,GSO)及鸟群算法(bird swarm algorithm,BSA)4种算法分别在时间、适应度值和结构相似度(structural similarity index measurement,SSIM)3个指标下分析对比,实验结果表明,本文算法适应度值可提高0.0030.701,SSIM值可提高0.0750.169。结论 本文方法能有效检测铜板表面凸起面积占比并对其进行合格品、次品分类。

关键词

铜板缺陷; 阈值分割; 鸟群算法; 混沌理论; 基点生长法; KSW熵法

Cathodic copper plate surface defect detection based on bird swarm algorithm with chaotic theory
expand article info Wang Zhuo1, Zhang Changsheng1, Li Wei1, Qian Junbing1, Tang Duzuo2, Cai Bing2, Chang Yitao2
1. Faculty of Information Engineering and Automation, Kunming University of Science and Technology, Kunming 650500, China;
2. Copper Branch of Yunnan Tin Copper limited, Kunming 661400, China
Supported by: National Natural Science Foundation of China(51665025)

Abstract

Objective From the global copper demand area, China still occupies the world's largest consumer of copper, accounting for nearly 40% of global total demand. Chinese economic data and news have been the focus of the copper market. In recent years, China's copper processing industry has shown a steady growth, and industry output gradually expanded. Copper processing materials are widely used in almost all national economy industries. Electrolytic copper plays an important role in copper smelting industry. During copper electrolysis, a large amount of air mixed in electrolyte is the main reason for the pores on the surface of copper cathode. The electrolyte dissolved gas is oversaturated to produce gas phase core, which gradually grows to form bubbles, and attaches to the surface of the cathode copper plate to form insulation point. This condition hinders the precipitation of copper ions, resulting in the appearance of bumps on the surface quality of copper plate. The surface quality of the copper plate is usually identified by the operator's eyes to determine the classification to solve the problem of low accuracy and efficiency of manually discriminating the surface quality of electrolytic cathode copper plate. This study proposes an intelligent recognition method of copper plate surface-raised image based on chaotic bird swarm algorithm. Method To enhance the global searching ability of the algorithm, the chaos theory is improved to make it enter into a completely chaotic state. The improved chaos theory was introduced based on the local optimal judgment of birds' own fitness value. In the iteration of bird flock, low-quality individuals were selected alternately to carry out chaos and dynamic step position update to increase the population diversity to avoid local optimization of the algorithm. Based on the analysis of surface defects of the copper plate, the base point growth method is proposed to design and detect structural elements. In addition, the texture of copper plate image is eliminated by combining with the morphological operation to improve the algorithm accuracy in calculating the raised area. The birds used Kapur-Sahoo-Wong(KSW) entropy as the fitness function to segment the copper plate images at the best threshold. Background pixels are mixed with raised category pixels in the initial segmentation result due to uneven illumination. Therefore, this study classifies the pixel of the corrected copper plate image through eight neighborhood search and takes it as the final segmentation result. According to the statistics of the number of raised pixels in the segmented image, the actual raised area proportion is obtained to determine whether the copper plate is qualified or defective. In this work, three copper plates with the smallest raised area are selected from 30 copper plates with fixed defective products through rough recognition by the human eyes. The exact bulge ratio is calculated using the algorithm in this study. To strengthen the fault tolerance rate of the algorithm, appropriate adjustment was made on the basis of the minimum value as the final threshold of copper plate classification. In addition, two arbitrary copper plates were selected to verify the method. Result The algorithm in this study is compared with genetic algorithm(GA), chicken swarm optimization(CSO), glowworm swarm optimization(GSO), and bird swarm algorithm(BSA) in three indexes of time, fitness value, and structural similarity index measurement(SSIM) value, respectively. Experimental results show that the fitness value of the algorithm in this study was increased by 0.0030.701, and the SSIM value was increased by 0.0750.169.The finding reveals the fault tolerance and superiority of this algorithm in the calculation of the proportion of copper plate surface bulge. Conclusion The proposed method can effectively detect the proportion of copper surface bulge area and classify qualified and defective products, thus providing a reference to determine the surface quality of electrolytic copper in metallurgical industry.

Key words

copper plate defects; threshold segmentation; bird swarm algorithm(BSA); chaos theory; base growth method; Kapur-Sahoo-Wong(KSW) entropy method

0 引言

铜电解是铜冶炼过程中的重要工艺,常因电解液溶解气体过饱和产生气相核心,形成气泡阻止铜离子的析出,致使阴极铜板表面凸起,影响其表面质量。常由人工判别凸起面积从而决定铜板是否合格。但这受到工人经验、周围环境等因素影响,导致最终的决策缺乏客观性,降低铜板归类的准确率及效率。电解液循环及铜板表面凸起成因如图 1所示。

图 1 铜板表面凸起成因示意图
Fig. 1 Cause diagram of copper plate surface bulge

群智能优化算法已逐渐成为人们解决该类问题的重要工具,如粒子群算法(particle swarm optimization, PSO)(Harrison等,2018a, 2018bKiran,2017Wang等,2018)、布谷鸟算法(cuckoo search, CS)(Lakshminarayanan和Kaur,2018Majumder等,2018)、鲸鱼算法(whale optimization algorithm, WOA)(Ding等,2018)和蚁群算法(ant colony optimization, ACO)(孙昊等,2018)等。Chen等人(2017)提出了双差分变异粒子群优化算法,其设计了一种双粒子群、顶层及底层的结构,由顶层优质粒子引导底层粒子,给子群赋予不同的变异参数,并证明该算法突出的搜索能力。He等人(2018)利用一种全映射函数将实向量映射为0~1向量,提出了一种新的二值人工蜂群算法(binary artificial bee colony, BABC),并将其与贪婪算法结合解决联合背包问题,证明了该算法具有较好的效果和鲁棒性。刘丁等人(2016)提出基于多目标人工鱼群算法(multi-objective artificial fish swarm algorithm, MAFSA)的2维直方图区域斜分多阈值分割方法来检测硅单晶直径,提高了算法对最佳分割阈值的搜索精度,但相应增加了时间成本。Majumder等人(2018)为解决一类工件准备时间不等的并行批处理机调度问题,将变邻搜索与布谷鸟搜索算法相结合, 提出了一种混合的离散布谷鸟搜索算法。Makas和Yumusak(2016)考虑到启发式算法独立于搜索空间,将候鸟优化算法(migrating birds optimization, MBO)应用于系统辨识邻域。Manshahia(2018)采用粒子群算法来实现无线传感器网络的拥塞控制和高效节能路由。Mohapatra等人(2017)通过对传统竞争群优化器算法(competitive swarm optimizer, CSO)改进,在较快收敛速度下获得了更大比例的搜索空间,并将其应用于大规模优化问题。任彩乐等人(2019)利用候鸟优化算法解决混合流水车间调度问题,提出了一种两阶段解码方法,增大了对最优解的搜索精度,加快了MBO算法的收敛速度。

Meng等人(2016)根据自然界鸟群警戒、觅食、飞行行为,提出了一种新的群智能优化算法——鸟群算法(bird swarm algorithm, BSA)。相比于其他群智能算法,BSA具有调节参数少、收敛精度高及鲁棒性好等优点,但BSA算法依然存在种群多样性不足、易陷入局部最优的缺点(王建伟和彭亦功,2018Wang等,2018)。王建伟和彭亦功(2018)将迁移、变异策略引入鸟群算法提高了原算法的收敛速度和寻优能力。王慧娟等人(2019)给鸟群算法引入线性学习系数,提高了其在搜索初期、后期的搜索能力,通过改进鸟群算法来识别电器运行状态及估计电器电流。Wang等人(2018)考虑到鸟群算法易陷入局部最优,设计了一种“干扰局部最优”的方法使得原算法能更加快速、稳定地收敛到全局最优,并将其应用到无人机目标检测领域,但该方法在计算速度方面略显不足。

本文针对人工判别电解阴极铜板表面质量准确度和效率都较低的问题,通过图像智能识别方法解放人力,为企业提高生产效率。提出一种结合混沌理论的鸟群算法(bird swarm algorithm with chaos theory,CBSA)识别铜板表面凸起缺陷,并由基点生长法结合开操作去除铜板图像纹理以增加凸起面积识别的准确率。根据局部最优判断将改进混沌理论引入鸟群算法, 在兼顾耗时的同时加强了全局搜索能力;让劣质个体交替进行混沌和动态步长位置更新增加种群多样性,实验表明本文算法相比于其他4种算法对于铜板图像的分割效果在适应度值、结构相似度(structural similarity index measurement, SSIM)值上都具有一定优势。

1 铜板表面凸起检测

铜板表面凸起的检测流程如图 2所示,读取处在检测区域的铜板图像,将最佳熵阈值确定法(Kapur-Sahoo-Wong,KSW)作为鸟群算法的适应度值函数寻取最佳分割阈值,对铜板图像进行分割,最后通过统计分割图像凸起像素数目得到实际凸起面积决定铜板是否合格。

图 2 铜板表面凸起检测流程
Fig. 2 Detection process of copper plate surface bump

光强及角度等因素使铜板部分凸起的成像亮度接近背景,以至于在图像分割环节被误分至背景部分。分析图 2次品铜板与合格铜板灰度直方图可知,右侧峰代表铜板平整区域像素,双峰之间为凸起部分像素,左侧峰包含凸起部分像素及背景像素两部分,其中位于左侧峰的凸起像素即为误分至背景的像素。

背景部分无凸起像素灰度值掺杂,误分至背景的凸起像素与其他凸起像素连成一片。基于此,进行以下矫正:背景像素8邻域内包含凸起像素灰度值,则视其为误分类像素,并重新归类为凸起像素类别。由于电解过程中添加剂和铜纯度的影响,致使铜板表面出现纹理结构,给凸起面积的检测计算带来了一定干扰,本文提出基点生长法结合开操作去除图像纹理,最终处理效果见图 2

2 鸟群算法

2.1 基本鸟群算法

鸟群算法根据鸟的行为方式、生活习性,建立了基于觅食、警戒和飞行行为的数学模型,以此更新寻取最优点位置。

1) 觅食行为。借鉴鸟群在觅食过程中根据自身经验和群体经验觅食的特点指导其进行位置更新,计算为

$ \begin{array}{*{20}{c}} {x_{i,j}^{t + 1} = x_{i,j}^t + \left( {{p_{i,j}} - x_{i,j}^t} \right) \times C \times r + }\\ {\left( {{g_j} - x_{i,j}^t} \right) \times S \times r} \end{array} $ (1)

式中,$j \in \left[ {1, \cdots, D} \right]$$D$为最大维数,$r$代表(0, 1)之间的随机数,$C, S$分别表示社会系数和加速传感系数,${p_{i, j}}$代表第$i$只鸟在第$j$维所经过的最佳位置,${g_j}$表示群体在第$j$维所经的最佳位置,$x_{i, j}^{t + 1}$$x_{i, j}^t$分别表示鸟群个体更新后及更新前的位置。

2) 警戒行为。处于警戒状态的鸟都会尝试着往群体中心移动,此时鸟个体之间就会产生相应的阻碍、干扰,其警戒行为的位置更新为

$ \begin{array}{*{20}{c}} {x_{i,j}^{t + 1} = x_{i,j}^t + A\left( {{m_j} - x_{i,j}^t} \right) \times r + }\\ {{A_2}\left( {{p_{k,j}} - x_{i,j}^t} \right) \times r} \end{array} $ (2)

$ {A_1} = {a_1} \times \exp \left( {\frac{{p_i^{{\rm{Fit}}}}}{{{s^{{\rm{Fit}}}} + \varepsilon }} \times N} \right) $ (3)

$ {A_2} = {a_2} \times \exp \left( {\frac{{p_i^{{\rm{Fit}}} - p_k^{{\rm{Fit}}}}}{{\left| {p_k^{{\rm{Fit}}} - p_i^{{\rm{Fit}}}} \right| + \varepsilon }} \cdot \frac{{N \times p_k^{{\rm{Fit}}}}}{{{s^{{\rm{Fit}}}} + \varepsilon }}} \right) $ (4)

式中,$k\left({k \ne i} \right) \in \left[ {1, N} \right]$为第$k$只个体,${a_1}$${a_2}$代表[0, 2]之间的两个常数,$p_i^{{\rm{Fit}}}$代表第$i$只鸟个体所经位置的最佳适应度值,${s^{{\rm{Fit}}}}$表示鸟群全部个体最佳适应度值的和,$\varepsilon $为趋近于0的非零数值,为保证分母不为0,${m_j}$表示鸟群所有个体在$j$维的位置平均值;$N$代表种群数目,其中${A_1}$表示外界环境给鸟个体带来的直接影响系数,${A_2}$表示外界环境给鸟个体带来的间接影响系数。

3) 飞行行为。鸟群在经过一定时间周期FQ后会飞往一个新的区域,然后按照相应规则分为生产者和乞食者,乞食者按概率选择跟随生产者觅食,生产者则主动觅食,生产者和乞食者的位置更新公式为

$ x_{i,j}^{t + 1} = x_{i,j}^t + {r_n}\left( {0,1} \right) \times x_{i,j}^t $ (5)

$ x_{i,j}^{t + 1} = x_{i,j}^t + \left( {x_{k,j}^t - x_{i,j}^t} \right) \times {F_L} \times r $ (6)

式中,${r_n}\left({0, 1} \right)$表示均值为0、标准差为1的高斯分布,$k\left({k \ne i} \right) \in \left[ {1, \cdots, N} \right]$${F_L} \in \left[ {0.5, 0.9} \right]$表示乞食者跟随生产者寻找食物的概率。

2.2 基于混沌理论的鸟群算法

2.2.1 适应度函数

为使分割后的铜板图像尽可能完整地显示出凸起缺陷区域,本文采用KSW熵作为鸟群算法适应度函数指导算法寻优,对于双阈值${S_1}$${S_2}$,计算为

$ \begin{array}{*{20}{c}} {H\left( {{S_1},{S_2}} \right) = \ln \sum\limits_{i = 1}^{{S_1}} {{p_i}} + \ln \sum\limits_{i = {S_1} + 1}^{{S_2}} {{p_i}} + \ln \sum\limits_{i = {s_2} + 1}^n {{p_i}} - }\\ {\frac{{\sum\limits_{i = 1}^{{S_1}} {{p_i}\ln {p_i}} }}{{\sum\limits_{i = 1}^{{S_1}} {{p_i}} }} - \frac{{\sum\limits_{i = {S_1} + 1}^{{S_2}} {{p_i}\ln {p_i}} }}{{\sum\limits_{i = {S_1} + 1}^{{S_2}} {{p_i}} }} - \frac{{\sum\limits_{i = {S_2} + 1}^n {{p_i}\ln {p_i}} }}{{\sum\limits_{i = {S_2} + 1}^n {{p_i}} }}} \end{array} $ (7)

式中,$H\left({{S_1}, {S_2}} \right)$表示当选取阈值分别为${{S_1}}$${{S_2}}$时的熵值,${p_i}$代表灰度级为$i$的像素的概率,$n$代表灰度级数,${{S_1}}$${S_2}\left({0 < {S_1} < {S_2} < n} \right)$分别代表随机选取的分割阈值。若阈值${{S_1}}$${{S_2}}$能使图像总熵取得最大值,则为最佳分割阈值,并记为${S_1}'$${S_2}'$,计算为

$ {{S'}_1},{{S'}_2} = \arg \mathop {\max }\limits_{0 < {S_1} < {S_2} \le n - 1} H\left( {{S_1},{S_2}} \right) $ (8)

2.2.2 局部最优解决方案

混沌代表着一种不规则运动,其表现为一种随机的、不确定的、不可预测的现象,现将其引入鸟群算法,增强鸟群全局搜索、跳出局部最优的能力,本文采用logistic混沌模型,定义为

$ \begin{array}{*{20}{c}} {{x_{n + 1}} = \mu \times {x_n} \times \left( {1 - {x_n}} \right)}\\ {{x_n} \in \left( {0,1} \right),\mu \in \left( {0,4} \right]} \end{array} $ (9)

式中,${x_{n + 1}}$代表更新结果,${x_n}$代表当前结果,参数$\mu $控制模型的混沌状态,当$3.569 < \mu \le 4$时系统为全然混沌状态。

图 3可知,当$3.569 < \mu \le 4$时,混沌序列的遍历均匀性欠佳,其上侧密度明显大于下侧,鉴于此,按概率调整原混沌序列位置,使其最大程度均匀遍历所有位置以满足鸟群算法种群多样性的需求,计算为

$ \begin{array}{l} y = {x_{n + 1}} - R\left( {r - \beta \times \left( {1 - {x_{n + 1}}} \right)} \right) \times \\ \;\;\;\;\;\;r \times {x_{n + 1}} \end{array} $ (10)

式中,$y$为改进后的混沌更新位置,$\beta $为位置调整因子,本文设为0.9,$R\left({} \right)$表示对括号内变量四舍五入,$\mu $取4使混沌序列进入全然混沌状态,改进结果如图 3所示。

图 3 混沌序列分布图
Fig. 3 Chaotic sequence distribution diagram
((a) before improving; (b) the improved)

为了在满足种群多样性的同时兼顾算法执行效率,引入上述改进混沌理论及局部最优判断条件,计算为

$ x_{i,j}^{t + 1} = \left\{ {\begin{array}{*{20}{l}} {x_{i,j}^t + x_{i,j}^t \times y}&{r \le p}\\ {{\rm{continue}}}&{r > p} \end{array}} \right. $ (11)

$ p = \cos \left( {\left( {{f^{{\rm{Max}}}} - {p^{{\rm{Fit}}}}} \right)/{f^{{\rm{Max}}}}} \right) $ (12)

式中,$y$计算见式(10),continue表示不执行混沌扰动,${f^{{\rm{Max}}}}$表示当前迭代次数下最佳适应度值,${p^{{\rm{Fit}}}}$表示当前个体适应度值,$p$表示执行混沌扰动的概率。若连续3次的迭代最佳适应度值没有发生改变,则可认为鸟群陷入局部最优,使所有鸟个体结合自身适应度值按照概率$p$选择混沌位置更新。

2.2.3 劣质个体混沌动态步长搜索

为了在增加种群多样性的同时提高算法收敛速度,让鸟群初始化适应度值最差的个体选择动态步长位置更新(式(13))和混沌位置更新(式(14))交替寻优,并将其每次寻优最佳位置与鸟群全局最优位置进行比较,选择更优者作为当前迭代次数下全局最优位置指导算法后续寻优,计算为

$ \begin{array}{*{20}{c}} {x_{n + 1}^i = x_n^i + {\lambda _i} \times x_n^i}\\ {{\lambda _i} = \left( {fit_n^i - fit_{n - 1}^i} \right)/fit_n^i} \end{array} $ (13)

$ x_{n + 1}^i = \left\{ {\begin{array}{*{20}{l}} {x_n^i + x_n^i \times y}&{r \le {p_i}}\\ {{\rm{continue}}}&{r > {p_i}} \end{array}} \right. $ (14)

式中,若第$i$只鸟为劣质鸟,则${\lambda _i}$代表动态步长系数,$fit_n^i$代表劣质鸟位置更新后的适应度值,$fit_{n - 1}^i$代表劣质鸟位置更新前的适应度值,$x_{n + 1}^i$表示第$i$只鸟混沌优化后的位置,$x_n^i$表示第$i$只鸟混沌优化前的位置,算法流程如图 4所示。

图 4 CBSA算法流程图
Fig. 4 Flow chart of CBSA algorithm

3 铜板图像纹理去除

由于电解过程中添加剂和铜纯度的影响,致使铜板表面出现纹理结构,给凸起面积的检测计算带来了一定干扰,但凸起大部分为不规则形状且连成一片,铜板纹理均呈竖线状且各自分开。考虑到并非所有铜板纹理都是垂直向下,也可能与垂线有略微角度偏移,针对该纹理特征提出一种算法——基点生长法,以检测、去除铜板纹理,构建结构元

$ \left\{ {\begin{array}{*{20}{l}} {{\mathit{\boldsymbol{m}}_1} = \left[ {\begin{array}{*{20}{l}} 1&0&0&0&1\\ 1&0&0&0&1\\ 1&0&0&0&1 \end{array}} \right]}\\ {{\mathit{\boldsymbol{m}}_2} = \left[ {\begin{array}{*{20}{l}} 0&1&1&1&0\\ 0&1&1&1&0\\ 0&1&1&1&0 \end{array}} \right]} \end{array}} \right. $ (15)

分别将${\mathit{\boldsymbol{m}}_1}$${\mathit{\boldsymbol{m}}_2}$按行以3像素间隔、列以4像素间隔遍历铜板图像,遍历滑动过程中,${\mathit{\boldsymbol{m}}_1}$${\mathit{\boldsymbol{m}}_2}$分别与铜板对应位置像素执行与运算,若图像中某点与${\mathit{\boldsymbol{m}}_1}$的运算结果全为0且与${\mathit{\boldsymbol{m}}_2}$的运算结果大于2,则该点记为基点,位置存入基点矩阵,如此得到铜板图像中所有基点,然后在铜板图像中以基点位置开始逐像素向上、向下搜索与该基点灰度值相等的像素,直至遇到不相等的像素,则停止搜索。

图 5,基点矩阵中每一个基点将自身位置映射到原图中,此时每个基点代表一条纹理,以该基点开始上下搜索至对应纹理两端,将该纹理又映射回基点矩阵中相应基点对应位置,如此反复对所有基点执行此操作,即可得到纹理图。

图 5 基点生长法原理图
Fig. 5 Schematic diagram of base point growth method

铜板纹理除上述提及特征外,还有粗细、长短不一和非绝对直线的特点,鉴于此,结合开操作以最大程度消除铜板纹理。根据铜板纹理特征,构建6行2列的全1矩阵$\mathit{\boldsymbol{B}}$, 可在消除纹理的同时最大程度保留凸起部分,开操作可表示为对图像先腐蚀后膨胀以达到消除铜板图像纹理的作用,定义为

$ \mathit{\boldsymbol{A}} \circ \mathit{\boldsymbol{B}} = \left( {\mathit{\boldsymbol{A}} \odot \mathit{\boldsymbol{B}}} \right) \oplus \mathit{\boldsymbol{B}} $ (16)

式中,$\mathit{\boldsymbol{A}}$为原图,$\mathit{\boldsymbol{B}}$为结构元,$\circ $表示开操作,$\odot $表示腐蚀运算,$\oplus $表示膨胀运算。

4 实验与结果分析

4.1 算法描述

本文铜板图像表面凸起检测算法伪代码为(其中, %表示取余):

读入铜板图像并灰度化;

初始化鸟群个体${{X}_{i}}\left(i=1, 2, \cdots, n \right)$位置, 并计算个体适应度值;

For i=1 :N

  If (t%FQ≠0)

    生成觅食概率prob(i), 其中t为当前时间;

    If (r < prob(i))

      根据式(1)更新个体位置;

    else

      根据式(2)更新个体位置;

    end

  else

    鸟群分为生产者和乞食者;

    For i=1 :N

      If (i为乞食者)

        根据式(5)更新个体位置;

      else

        根据式(6)更新个体位置;

      end

    end

  end

  if (陷入局部最优)

    按照2.2.2节所述策略执行;

    按照2.2.3节位置更新策略执行;

  else

    按照2.2.3节位置更新策略执行;

  end

end

基点生长法结合开操作去除铜板图像纹理干扰;

误分类像素点矫正归类;

统计凸起像素点个数,得到铜板表面实际凸起面积以决定其合格或是次品。

4.2 实验参数设置

考虑到本文中各对比算法搜索域0~255相对较小,若种群规模设置过大可能导致各算法均在较少迭代次数下都能寻取最佳阈值,种群规模若设置过小无法体现群智能算法对寻优问题求解的优势,同时无法体现各算法的优劣性。迭代次数若设置过大,可能导致各算法在最大迭代次数内均能寻取最佳阈值,迭代次数若设置过小,可能会增大算法偶然性,可信度不足,因此为尽可能体现各算法性能的优劣,经过多次反复实验与分析,本文将种群规模设置为10,迭代次数设置为20,其余参数见表 1。实验硬件条件为Core i5-5200 CPU @ 2.20 GHz, 内存4.00 GB电脑,编程环境为MATLAB 2017a。

表 1 各算法参数
Table 1 Parameters of each algorithm

下载CSV
算法 参数 取值
GA pm 0.03
pc 0.8
BSA FQ 10.0
C/S 1.5
a1/a2 1.0
CSO rpercent 0.2
hpercent 0.4
wmax 0.9
wmin 0.4
GSO alpha 0.5
gamma 0.001
delta 0.99
CBSA(本文) FQ 10.0
C/S 1.5
a1/a2 1.0

图 6所示铜板图像取自云锡铜业有限公司,图 6(a)(c)为次品铜板图像,图 6(d)为合格铜板图像,现将其作为本文测试样本,根据企业相关规定,当铜板表面凸起面积达到一定规模后就可认为其为次品,现通过阈值分割法检测铜板表面凸起面积并决定铜板合格或是次品。最后通过时间、适应度值、SSIM值3个指标对算法性能及分割效果进行评判。

图 6 铜板图像
Fig. 6 Copper plate images
((a)copper 1;(b)copper 2;(c)copper 3;(d)copper 4)

4.3 图像分割性能评价指标

为考察算法对铜板图像表面凸起分割的完整性,本文使用SSIM指标,其值越大说明算法越全面地分割出了铜板图像表面凸起区域,其值越小说明算法对凸起区域分割不够完整,SSIM计算为

$ S\left( {I,I'} \right) = \frac{{\left( {2{\mu _I}{\mu _{I'}} + {c_1}} \right) \times \left( {2{\sigma _{I,I'}} + {c_2}} \right)}}{{\left( {{\mu _I} + {\mu _{I'}} + {c_1}} \right) \times \left( {{\sigma _I} + {\sigma _{I'}} + {c_2}} \right)}} $ (17)

$ {c_1} = {\left( {{K_1} \times L} \right)^2} $

$ {c_2} = {\left( {{K_2} \times L} \right)^2} $

式中,${{\mu }_{I}}$代表分割前图像的平均值,${{\mu }_{I'}}$代表分割后图像的平均值, ${{\sigma }_{I}}$代表分割前图像的方差, ${{\sigma }_{I'}}$代表分割后图像的方差, ${{\sigma }_{I, I'}}$代表图像分割前与分割后的协方差,${{c}_{1}}$${{c}_{2}}$均为常数,其作用是避免分母为0,${{K}_{1}}$${{K}_{2}}$分别取值为0.01和0.03,$L$取灰度级数255。

4.4 结果分析

为验证本文算法对最佳阈值的搜索能力和算法的稳定性,将本文算法与遗传算法(genetic algorithm,GA)(Holland,1973)、萤火虫算法(glowworm swarm optimization,GSO)(Krishnanand和Ghose,2009)、鸡群算法(chicken swarm optimization,CSO)(Meng等,2014)和BSA(Meng等,2016)分别对图 6(a)(c) 3幅次品铜板图像进行分割实验,总体相比于上述4种算法,适应度值可提高0.003~0.701,SSIM值可提高0.075~0.169。

GA算法相比于其他几种算法具有较强全局搜索能力,但相应局部搜索能力欠佳,由于本文各算法搜索空间为0~255灰度区间,对算法局部搜索能力要求较高,导致算法效果不尽理想;CSO算法和GSO算法均存在易陷入局部最优、求解精度低的问题,导致其难以寻取最佳分割阈值;BSA算法因其收敛精度高,局部搜索能力较强的特点被广泛应用,从表 2表 3可知,其在适应度值及SSIM值两个指标下均优于GA、CSO和GSO 3种算法,但依然存在种群多样性不足致使算法易陷入局部最优的问题,经分析BSA算法的优缺点,本文在其基础上进行改进提出CBSA算法,弥补了算法种群多样性不足及易陷入局部最优的缺点,从表 2表 3可看出本文所提CBSA算法在SSIM值和适应度值方面均优于其他4种算法,且算法对最佳阈值寻取的准确性及稳定性均有了提升,但由于新理论的引入导致所提算法在时间方面略显不足。

表 2 各算法适应度值
Table 2 Fitness values of each algorithm

下载CSV
次品铜板图像 适应度 算法
GA CSO BSA GSO CBSA(本文)
图 6(a) 最佳值 11.083 11.267 11.267 11.151 11.267
最差值 9.407 10.897 10.766 10.245 11.245
平均值 10.562 11.160 11.207 10.912 11.263
图 6(b) 最佳值 12.673 12.688 12.688 12.672 12.688
最差值 10.639 12.401 12.661 11.484 12.685
平均值 12.319 12.667 12.681 12.437 12.686
图 6(c) 最佳值 12.230 12.247 12.247 12.237 12.247
最差值 10.417 12.082 12.147 11.687 12.236
平均值 11.792 12.203 12.238 11.985 12.245
注:加粗字体为每行最优值。

表 3 各算法性能指标
Table 3 Performance indexes of each algorithm

下载CSV
次品铜板图像 算法
GSO GA CSO BSA CBSA(本文)
SSIM 时间/s SSIM 时间/s SSIM 时间/s SSIM 时间/s SSIM 时间/s
图 6(a) 0.559 4 1.419 0.502 9 1.300 0.617 7 1.302 0.633 6 1.273 0.640 3 1.298
图 6(b) 0.540 6 1.327 0.491 9 1.284 0.534 0 1.289 0.576 3 1.293 0.581 9 1.314
图 6(c) 0.527 3 1.240 0.415 5 1.231 0.504 3 1.274 0.581 3 1.229 0.584 5 1.286
注:加粗字体为每行对应指标最优值。

4.5 算法有效性检验

在企业实际生产中,需操作员目视识别铜板表面凸起规模以决定其合格或是次品。为得到次品铜板分割阈值,通过在30张次品铜板中进行人眼粗识别,选出3张凸起面积占比最小的铜板,然后利用本文所提方法检测其精确凸起面积占比,计算为

$ p = \frac{n}{N} $ (18)

式中,$n$代表凸起像素数目,$N$代表总像素数目,$p$代表铜板凸起面积占比。3张次品铜板凸起检测结果如表 4

表 4 次品铜板凸起占比
Table 4 Defective copper plate bulge ratio

下载CSV
铜板1 铜板2 铜板3
p/% 4.35 2.04 7.82

表 4可知,30张次品铜板中最小凸起占比为2.04%,考虑到样本总数30相对较小,为提高算法容错率,在2.04%的基础上做适当调整,将1.5%定为次品铜板与合格铜板的分类阈值,大于该阈值归为次品铜板,小于该阈值归为合格铜板。对铜板2的处理流程如图 2所示,图 7为通过本文方法对人眼已定合格铜板与次品铜板进行凸起占比检测结果。

图 7 铜板凸起占比
Fig. 7 Copper plate bulge ratio

5 结论

通过对电解铜阴极板表面凸起成因进行分析总结,考虑到人工对于铜板表面凸起识别时多方面因素的干扰造成识别效率低、准确率低等问题,通过图像智能识别方法解放人力,为企业提高生产效率,提出了一种混沌鸟群算法以检测该缺陷。鸟群个体结合自身适应度值由局部最优判断引入改进混沌理论增强全局搜索能力;劣质个体交替进行混沌和动态步长位置更新增加种群多样性;提出一种基点生长法,结合开操作消除铜板图像纹理对凸起面积计算的干扰。

由于图像采集环境中光线的影响导致算法分割出现误分类,本文通过对目标及背景分类特点分析比较,并对分割结果进行矫正,通过统计分割图像凸起像素点个数得到实际凸起面积,结合企业生产实践中对于铜板表面质量的相关要求决定铜板为合格或是次品。最后将本文算法与GA、GSO、CSO和BSA 4种算法对铜板图像的分割效果在时间、适应度值和SSIM 3个指标进行分析,仿真结果表明本文算法相比于其他4种算法适应度值可提高0.003~0.701,SSIM值可提高0.075~0.169。

本文所提铜板表面缺陷检测方法略显繁琐,且铜板缺陷种类的多样化易降低算法的普适性,因此,进一步简化算法流程、增强算法鲁棒性是本文深入研究的方向。此外,光线对算法分割效果影响较大,若条件允许,对工业现场图像采集环境做相应处理可降低算法分割难度、增加分割准确率。

参考文献

  • Chen Y G, Li L X, Peng H P, Xiao J H, Yang Y X, Shi Y H. 2017. Particle swarm optimizer with two differential mutation. Applied Soft Computing, 61: 314-330 [DOI:10.1016/j.asoc.2017.07.020]
  • Ding T, Chang L, Li C S, Feng C, Zhang N. 2018. A mixed-strategy-based whale optimization algorithm for parameter identification of hydraulic turbine governing systems with a delayed water hammer effect. Energies, 11(9): 2367 [DOI:10.3390/en11092367]
  • Harrison K R, Engelbrecht A P, Ombuki-Berman B M. 2018a. Self-adaptive particle swarm optimization:a review and analysis of convergence. Swarm Intelligence, 12(3): 187-226 [DOI:10.1007/s11721-017-0150-9]
  • Harrison K R, Engelbrecht A P, Ombuki-Berman B M. 2018b. Optimal parameter regions and the time-dependence of control parameter values for the particle swarm optimization algorithm. Swarm and Evolutionary Computation, 41: 20-35 [DOI:10.1016/j.swevo.2018.01.006]
  • He Y C, Xie H R, Wong T L, Wang X Z. 2018. A novel binary artificial bee colony algorithm for the set-union knapsack problem. Future Generation Computer Systems, 78: 77-86 [DOI:10.1016/j.future.2017.05.044]
  • Holland J H. 1973. Genetic algorithms and the optimal allocation of trials. SIAM Journal on Computing, 2(2): 88-105 [DOI:10.1137/0202009]
  • Kiran M S. 2017. Particle swarm optimization with a new update mechanism. Applied Soft Computing, 60: 670-678 [DOI:10.1016/j.asoc.2017.07.050]
  • Krishnanand K N, Ghose D. 2009. Glowworm swarm optimization for simultaneous capture of multiple local optima of multimodal functions. Swarm Intelligence, 3(2): 87-124 [DOI:10.1007/s11721-008-0021-5]
  • Lakshminarayanan S, Kaur D. 2018. Optimal maintenance scheduling of generator units using discrete integer cuckoo search optimization algorithm. Swarm and Evolutionary Computation, 42: 89-98 [DOI:10.1016/j.swevo.2018.02.016]
  • Liu D, Zhang X Y, Chen Y J. 2016. Monocrystalline silicon diameter detection image threshold segmentation method using multi-objective artificial fish swarm algorithm. Acta Automatica Sinica, 42(3): 431-442 (刘丁, 张新雨, 陈亚军. 2016. 基于多目标人工鱼群算法的硅单晶直径检测图像阈值分割方法. 自动化学报, 42(3): 431-442) [DOI:10.16383/j.aas.2016.c150587]
  • Majumder A, Laha D, Suganthan P N. 2018. A hybrid cuckoo search algorithm in parallel batch processing machines with unequal job ready times. Computers and Industrial Engineering, 124: 65-76 [DOI:10.1016/j.cie.2018.07.001]
  • Makas H, Yumuşak N. 2016. System identification by using migrating birds optimization algorithm:a comparative performance analysis. Turkish Journal of Electrical Engineering and Computer Sciences, 24(3): 1879-1900 [DOI:10.3906/elk-1311-45]
  • Manshahia M S. 2018. Swarm intelligence-based energy-efficient data delivery in WSAN to virtualise IoT in smart cities. IET Wireless Sensor Systems, 8(6): 256-259 [DOI:10.1049/iet-wss.2018.5143]
  • Meng X B, Gao X Z, Lu L H, Liu Y, Zhang H Z. 2016. A new bio-inspired optimisation algorithm:bird swarm algorithm. Journal of Experimental and Theoretical Artificial Intelligence, 28(4): 673-687 [DOI:10.1080/0952813X.2015.1042530]
  • Meng X B, Liu Y, Gao X Z, Zhang H Z. 2014. A new bio-inspired algorithm:chicken swarm optimization. Lecture Notes in Computer Science, 8794(1): 86-94 [DOI:10.1007/978-3-319-11857-4_10]
  • Mohapatra P, Das K N, Roy S. 2017. A modified competitive swarm optimizer for large scale optimization problems. Applied Soft Computing, 59: 340-362 [DOI:10.1016/j.asoc.2017.05.060]
  • Ren C L, Zhang C Y, Meng L L, Yu J, Hong H. 2019. Hybrid flow-shop scheduling problems based on improved migrating birds optimization algorithm. Computer Integrated Manufacturing Systems, 25(3): 643-653 (任彩乐, 张超勇, 孟磊磊, 余俊, 洪辉. 2019. 基于改进候鸟优化算法的混合流水车间调度问题. 计算机集成制造系统, 25(3): 643-653) [DOI:10.13196/j.cims.2019.03.011]
  • Sun H, Zhang X S, Chen J W, Guo Y, Wei M T. 2018. Optimization of electronic prescription for parallel external fixator based on ant colony algorithm. Chinese Journal of Scientific Instrument, 39(10): 232-240 (孙昊, 张习帅, 陈建文, 郭悦, 魏梦婷. 2018. 基于蚁群算法的骨外固定器处方优化. 仪器仪表学报, 39(10): 232-240) [DOI:10.19650/j.cnki.cjsi.J1803798]
  • Wang D S, Tan D P, Liu L. 2018. Particle swarm optimization algorithm:an overview. Soft Computing, 22(2): 387-408 [DOI:10.1007/s00500-016-2474-6]
  • Wang H J, Yang W R, Yang Q X. 2019. Application of improved bird swarm algorithm in home appliance load disaggregation. Proceedings of the CSU-EPSA, 31(10): 140-144 (王慧娟, 杨文荣, 杨庆新. 2019. 改进鸟群算法在家电负荷分解中的应用. 电力系统及其自动化学报, 31(10): 140-144) [DOI:10.19635/j.cnki.csu-epsa.000165]
  • Wang J W, Peng Y G. 2018. Improved bird swarm algorithm based on migration and mutation strategy and its application in parameter estimation. Journal of East China University of Science and Technology (Natural Science Edition), 44(4): 617-624 (王建伟, 彭亦功. 2018. 引入迁移和变异策略的改进鸟群算法及其在参数估计中的应用. 华东理工大学学报(自然科学版), 44(4): 617-624) [DOI:10.14135/j.cnki.1006-3080.20170709001]
  • Wang X H, Deng Y M, Duan H B. 2018. Edge-based target detection for unmanned aerial vehicles using competitive bird swarm algorithm. Aerospace Science and Technology, 78: 708-720 [DOI:10.1016/j.ast.2018.04.047]