基于多目标优化的高效视觉检测规划方法【增强内容出版】
With the increasing demand for inspecting part surfaces, automated and efficient visual inspection is becoming a trend in industrial production. Due to the complexity of inspection planning problems where both viewpoint planning and path planning belong to the non-determinism of polynomial complexity problem, most of the current research studies the above two problems separately and seeks the minimum viewpoints to satisfy the viewpoint coverage by viewpoint planning, then obtaining efficient inspection paths via path planning for the set of viewpoints. However, viewpoint planning and path planning are coupled problems, and the distribution of viewpoints and paths can easily make the inspection efficiency fall into the local optimum. Therefore, some researchers propose to combine the viewpoint and path planning problems and simplify them into a single objective problem for global optimization, which improves inspection efficiency to a certain extent. However, during the optimization, viewpoints should be continuously added to the viewpoint set to meet the viewpoint coverage, which causes low planning efficiency. To this end, we propose a multi-objective holistic planning method of viewpoints and paths to quickly seek the viewpoint set and its path that satisfy viewpoint coverage and optimal inspection time cost.
In response to the need for efficient inspection of batch parts, we study the inspection planning method of automated visual inspection to reduce the inspection time cost of single parts. Inspection planning includes two subproblems of viewpoint planning and path planning. To seek the optimal solution of inspection time cost in inspection planning, we propose a multi-objective holistic planning method for viewpoints and paths, which models the viewpoint planning problem and path planning problem as a combinatorial optimization problem for multi-objective optimization. The proposed method performs adaptive redundant sampling of viewpoints based on surface curvature to cope with difficult coverage of complex curved surfaces and constructs a set of sampled viewpoints with both quality and diversity for subsequent inspection planning considered. A constraint-based non-dominated sorting genetic algorithm Ⅱ (C-NSGA-Ⅱ) is put forward for simultaneous optimization of the two objectives of viewpoint coverage and inspection time cost. During the optimization, the viewpoint coverage is constrained to be around the minimum coverage, and the globally optimal solution for the inspection time cost is quickly sought to achieve the holistic planning of viewpoints and paths and minimize the inspection time cost.
We propose a multi-objective holistic planning method for viewpoints and paths. Firstly, a redundant viewpoint sampling method based on surface curvature is proposed in the viewpoint sampling stage. Meanwhile, it is experimentally verified that compared with the commonly adopted random viewpoint sampling method, the viewpoint set sampled by the proposed method has better performance in subsequent inspection planning, which proves that the proposed viewpoint sampling method can construct a higher-quality and diversified sampled viewpoint set (Table 2). Then, C-NSGA-Ⅱ is put forward to carry out holistic planning for the problem of two successive coupling of viewpoint planning and path planning. Compared with the holistic planning method that is simplified into a single-objective optimization problem, the computational efficiency of C-NSGA-Ⅱ is improved by about 90% (Fig. 13). Compared with the traditional individual planning method of viewpoint first and then path, the inspection time cost planned by the proposed method is reduced by more than 10.52% (Table 3). Finally, the effectiveness and superiority of the proposed inspection planning method are verified in robot automated vision inspection applications (Table 4).
To reduce the inspection time cost of automated visual inspection, we propose a multi-objective holistic planning method for viewpoints and paths. The proposed method does not take reducing the number of planned viewpoints as the only goal, but directly takes the viewpoint coverage and inspection time cost as the optimization goals. The above two objectives are globally optimized by C-NSGA-Ⅱ, and the viewpoint set and its path with the optimal inspection time cost are finally planned. Compared with the holistic planning method that is simplified into a single-objective optimization problem, the proposed method does not need to be forced to meet the viewpoint coverage requirements during the optimization, which greatly improves computing efficiency. The experiments prove that the proposed method can quickly solve the global optimal solution compared with individual planning methods and other holistic planning methods, which helps improve the efficiency of automated visual inspection and provides a method for efficient inspection planning in real production. In the subsequent research, on the one hand, the accuracy evaluation index can be added to judge the viewpoints, and on the other hand, the influence of the field environment can be considered to provide feedback on the imaging quality of the viewpoints and make adjustments accordingly.
1 引言
自动化视觉检测,其形式通常由移动平台搭载视觉传感器对待检表面进行自动化信息采集与分析。随着机器人、无人机等技术的快速发展与应用,自动化视觉检测在现代工业制造领域得到广泛应用[1-3]。如今,大批量的自由曲面零件被生产制造,例如叶片、叶盘等,要求具备较高的尺寸精度和表面完整性,而传统的人工检测已无法满足其效率与精度要求[4],逐渐被基于机器视觉的检测方法取代[5],因此自动化视觉检测具有较大应用需求与研究意义。其中,检测规划是自动化视觉检测的前提,主要包括视点规划与路径规划两部分,均被证明为多项式复杂程度的非确定性问题[6],规划的路径难以达到最优,从而影响检测的效率。
视点规划通常经视点采样转换为集合覆盖问题(SCP)进行求解[7],采样视点集的质量影响着后续规划视点的覆盖率与规划路径的长度。在视点采样方面,主要分为空间采样、补丁采样、顶点采样等[8]。Wei等在视觉传感器的景深可行空间[9]和机器人可达空间[10]进行随机采样以确保采样视点的有效性,但采样过程过于随机,规划结果易受采样视点数量的影响。Mosbach等[11]根据待检表面几何复杂度自适应采样视点数,为随机采样提供一些指引,但视点固定指向补丁且平行于其法向,采样视点缺乏多样性。Gronle等[12]在每个网格顶点生成采样视点,再基于距离与方向相似性过滤得到优化视点集,但采样过程需进行大量运算。以上几类方法比较具有代表性但各有优劣,良好的视点采样方法应兼顾质量与多样性。
在视点规划与路径规划方面,研究者主要尝试通过单独优化规划视点来降低检测时间成本。刘洪鹏等[13]通过改进贪婪算法减少规划视点,有助于降低检测时间;Mohammadikaji等[14]将贪婪算法与粒子群优化相结合对视点数量进行全局优化;Bircher等[15]通过优化视点与其邻域视点的距离成本从而降低整体的距离成本;Almadhoun等[16]提出集成多个传感器以增大视点的覆盖区域的方式提高检测效率。此外,Phung等[17]允许视点集覆盖区域冗余,通过优化路径长度来降低检测时间成本。但是,视点规划与路径规划作为两个耦合的优化问题,单独优化难以兼顾视点覆盖率与检测时间成本。Jing等[18]尝试将视点规划与路径规划进行组合并将组合问题简化为单目标问题进行优化,检测效率得到一定提升;陈丽等[19]在此基础上加入无人机能耗作为优化目标,但该方法在优化过程中需不断补充视点来满足视点覆盖率,计算成本大,运算效率较低。
目前尚不存在完备最优的视点规划方法,且视点与路径整体规划的研究较少,依然存在规划视点不佳、自动化视觉检测效率低下等问题。为此,本文将视点规划与路径规划组合,提出视点与路径多目标整体规划方法。本文的主要贡献在于:1)提出基于表面曲率的视点冗余采样方法,约束采样视点的数量并确保其具备较高质量与多样性;2)将组合问题作为多目标优化问题进行整体规划,提出基于约束的非支配排序遗传算法(C-NSGA-Ⅱ)实现检测时间成本的全局高效寻优;3)在检测时间成本的寻优过程中,通过约束优化个体接近最小覆盖率而非强制满足,从而大幅提升运算效率。
2 问题描述
检测规划是对视觉传感器视点以及视点的访问顺序进行规划,主要目标一般为视点覆盖率与路径长度,为了更好地描述检测时间代价,本文结合检测过程中可能耗时的因素用检测时间成本代替路径成本。先视点再路径的单独规划方法是对两目标依次寻优,通过在构造的采样视点集中优选出满足视点覆盖率的最少视点,再对视点集基于旅行商问题求解出检测时间成本最优的视点访问顺序。但单独规划视点时未考虑视点间的距离成本,因此路径规划的最优解并非全局最优解。
针对上述问题,本文在采样视点集中进行视点规划的同时进行路径规划,对视点覆盖率与检测时间成本同时进行优化,检测规划示意图如
3 基于表面曲率的视点冗余采样
经网格均匀化和表面离散化处理,本文中的待检模型由处理后得到的点云集
式中:
3.1 冗余视点采样策略
规划视点由冗余的采样视点中优选得到,因此视点采样策略至关重要,需要考虑曲面复杂遮挡等情况,并确保满足视点覆盖率要求。此外,还应避免采样视点过多导致运算量过大的问题,同时能为后续规划提供多样性的视点选择,以增加规划出最优视点集的可能性。因此视点采样时需要满足以下准则:1)采样视点集须完全且冗余覆盖待检表面;2)采样视点集须保证多样性;3)采样视点须覆盖尽量大的曲面;4)采样视点的数量须尽量少。
结合采样视点集的多样性要求与避免采样视点过多的考量,本文根据视觉传感器景深中间平面面积
针对复杂曲面遮挡难覆盖的性质,利用曲率表征曲面的复杂程度以指引视点的采样。对于较复杂的曲面区域,采样视点难以覆盖,因此采样更多视点以保证覆盖率,并为后续的检测规划提供多样性选择;而对于容易被采样视点覆盖的较平坦区域,采样足够的视点即可保证多样性。其中,点云的曲面复杂度可参考点与其邻域点的法向量夹角[20],其向量内积可表示各点的曲率大小。点云任意一点
式中:
3.2 采样视点位姿的确定
为了确保基于表面曲率分配的采样视点能够覆盖待检表面的相应区域,首先在表面点云中进行采样,再根据采样点确定其对应的采样视点。其中,采样点作为视觉传感器测量范围的中心。如
式中,
图 2. 视觉传感器视场与视点采样示意图
Fig. 2. Illustration of visual sensor field of view and viewpoint sampling
如
3.3 采样视点的可视分析
在完成冗余视点的采样后,需通过可视分析统计每个采样视点覆盖点云集
4 基于C-NSGA-II的视点与路径整体规划
4.1 问题编码
为了将视点规划与路径规划进行组合优化,编码时需将两问题在一条染色体中进行基因型表示。视点规划问题即从采样视点集
4.2 种群初始化
为了大幅缩短寻优收敛时间,提高最终解的质量,本文兼顾时间成本,采用时间复杂度较低的贪婪搜索算法[13]生成规模为
4.3 适应度评估
本文的目标函数包括视点规划的视点对待检表面的覆盖率
假设
对于本文的组合问题,评估个体的好坏时无法通过单一指标进行比较,需要使用视点覆盖率
4.4 种群更新
4.4.1 个体选择
对种群中随机选择的两个体,采用经典的二元锦标赛的方法,基于非支配关系层级与近目标度选择较优个体。对于非同一非支配层级个体选择较优解集的个体,同一层级个体选择近目标度较小的个体。
4.4.2 交叉操作
交叉作为生成子代的主要方式,优秀的父代有较大概率获得较优个体。通过个体选择的两父代个体再次基于非支配关系层级与近目标度进行比较,较优个体作为主个体,较差个体作为次个体,进行快速交叉[24]。如
4.4.3 变异操作
变异是保持种群多样性、防止陷入局部最优的主要途径。为了在种群变异中生成优秀个体,变异个体的选择需要确保随机性,同时能够针对视点的质量自适应变异概率[25]。遍历染色体的基因时,为每个基因抽取一个随机数
式中:
如
Step 1:使用贪婪算法生成初始化种群
Step 2:计算种群的适应度,通过快速非支配排序得到非支配层级集合
Step 3:根据非支配层级
Step 4:对由
Step 5:精英保留
Step 6:生成由变异种群
Step 7:若
5 实验与分析
5.1 仿真实验分析
为验证本文方法的可行性与优越性,设计了本文提出的C-NSGA-Ⅱ与其他相关算法对相同待检对象的仿真对比实验,其中待检对象模型1[
图 8. 待检对象网络模型。(a)模型1;(b)模型2
Fig. 8. Mesh models of target objects. (a) Model 1; (b) model 2
实验中视觉传感器的工作距离范围为87~112 mm,视场为
5.1.1 视点与路径多目标整体规划结果
运用本文提出的C-NSGA-Ⅱ对待检对象进行规划,Pareto前沿解集如
图 9. Pareto前沿解集。(a)模型1;(b)模型2
Fig. 9. Pareto frontier solution set. (a) Model 1; (b) model 2
表 1. C-NSGA-Ⅱ规划结果
Table 1. Planning results of C-NSGA-Ⅱ
|
图 10. 检测规划效果图。(a)、(c)视点采样效果图;(b)、(d)视点与路径整体规划效果图
Fig. 10. Inspection planning renderings. (a), (c) Viewpoint sampling renderings; (b), (d) holistic planning renderings of viewpoints and paths
5.1.2 视点采样方法对比
为了体现本文所提基于表面曲率的视点冗余采样方法的优越性,开展相关实验进行验证。由于视点采样方法多样且各有优劣,因此设计本文视点采样方法与文献[13,18]中常用的随机视点采样方法进行对比实验。以本文采样方法为基准,由
表 2. 视点采样方法对比结果
Table 2. Comparison results of viewpoint sampling methods
|
5.1.3 检测规划算法对比
为了进一步验证本文所提C-NSGA-Ⅱ的优越性,开展本文算法与贪婪算法单独规划(Greedy-Greedy)、贪婪算法与遗传算法分别规划视点与路径(Greedy-GA)、遗传算法单独规划(GA-GA)以及遗传算法整体规划(GA)的对比实验。其中,Greedy-Greedy与Greedy-GA采用刘洪鹏等[13]的贪婪搜索算法单独规划视点;GA-GA与GA采用Wei等[18]简化为单目标优化问题的方法进行视点规划与整体规划。规划参数与本文算法一致,重复仿真实验10组。
图 11. 不同算法规划的检测时间成本最优解对比。(a)模型1;(b)模型2
Fig. 11. Comparison of optimal solutions for inspection time cost planned by different algorithms. (a) Model 1; (b) model 2
图 12. 不同算法规划的视点数对比。(a)模型1;(b)模型2
Fig. 12. Comparison of number of viewpoints planned by different algorithms. (a) Model 1; (b) model 2
由
表 3. 规划检测时间成本最优解结果
Table 3. Optimal solution results of planned inspection time costs
|
此外,GA在优化过程中需要不断添加视点以满足个体的最小覆盖率,导致规划时间大幅增加。如
5.2 验证实验分析
为验证本文算法在实际生产检测中的可行性,搭建如
图 14. 实验场景。(a)实物场景;(b)机器人可视化工具(Rviz)仿真场景
Fig. 14. Experimental scene. (a) Physical scene; (b) Rviz simulation scene
图 15. 待检对象实物与三维重建点云。(a)、(b)待检对象1;(c)、(d)待检对象2
Fig. 15. Photo and 3D reconstruction point cloud of target object. (a), (b) Object 1; (c), (d) object 2
实验中最小覆盖率设定为99.5%,对于待检对象1和对象2,本文检测规划的视点覆盖率分别为99.64%和99.53%。其中,由于底座对待检对象产生遮挡,视点覆盖率基于冗余采样视点对待检对象的视点覆盖率进行计算。扫描点云效果如图
进行对比实验,规划参数与仿真实验中规划参数一致,实际访问视点时间设置为
表 4. 规划检测时间成本与实际检测时间结果
Table 4. Planned inspection time cost versus actual inspection time results
|
6 结论
为了降低自动化视觉检测的时间成本,本文提出一种视点与路径多目标整体规划方法,不以降低规划视点数作为唯一目标,直接将视点覆盖率与检查时间成本作为优化目标,在全局中进行多目标优化,最终规划得到检测时间成本最优的视点集及其路径。实验证明,相较于单独规划方法与其他整体规划方法,本文算法能够快速地求解出全局较优解,有助于提高自动化视觉检测效率,为实际生产中的高效检测规划提供了方法。后续的工作一方面可以考虑在评判视点时添加精度评价指标,另一方面可以考虑现场环境影响,对视点成像质量进行反馈并做出相应调整。
[1] Koutecký T, Paloušek D, Brandejs J. Sensor planning system for fringe projection scanning of sheet metal parts[J]. Measurement, 2016, 94: 60-70.
[2] Peng W X, Wang Y N, Miao Z Q, et al. Viewpoints planning for active 3-D reconstruction of profiled blades using estimated occupancy probabilities (EOP)[J]. IEEE Transactions on Industrial Electronics, 2021, 68(5): 4109-4119.
[3] Raffaeli R, Mengoni M, Germani M, et al. Off-line view planning for the inspection of mechanical parts[J]. International Journal on Interactive Design and Manufacturing (IJIDeM), 2013, 7(1): 1-12.
[4] 郑刚, 闫立方, 张开伟, 等. 整体叶盘叶片型面高精度六轴检测与误差补偿方法研究[J]. 中国机械工程, 2023, 34(8): 908-915, 922.
Zheng G, Yan L F, Zhang K W, et al. Research on high-precision six-axis detection and error compensation method for blisk blade profiles[J]. China Mechanical Engineering, 2023, 34(8): 908-915, 922.
[5] 杨乐淼, 周富强. 基于机器视觉的划痕检测技术综述[J]. 激光与光电子学进展, 2022, 59(14): 1415009.
[6] KarpR M. Reducibility among combinatorial problems[M]//MillerR E, ThatcherJ W, BohlingerJ D. Complexity of computer computations. Boston: Springer, 1972: 85-103.
[7] Peuzin-Jubert M, Polette A, Nozais D, et al. Survey on the view planning problem for reverse engineering and automated control applications[J]. Computer-Aided Design, 2021, 141: 103094.
[8] Gospodnetić P, Mosbach D, Rauhut M, et al. Viewpoint placement for inspection planning[J]. Machine Vision and Applications, 2022, 33(1): 1-21.
[9] JingW, PoldenJ, LinW, et al. Sampling-based view planning for 3D visual coverage task with Unmanned Aerial Vehicle[C]//2016 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), October 9-14, 2016, Daejeon, Republic of Korea. New York: IEEE Press, 2016: 1808-1815.
[10] Jing W, Goh C F, Rajaraman M, et al. A computational framework for automatic online path generation of robotic inspection tasks via coverage planning and reinforcement learning[J]. IEEE Access, 2018, 6: 54854-54864.
[11] Mosbach D, Gospodnetić P, Rauhut M, et al. Feature-driven viewpoint placement for model-based surface inspection[J]. Machine Vision and Applications, 2021, 32(1): 1-21.
[12] Gronle M, Osten W. View and sensor planning for multi-sensor surface inspection[J]. Surface Topography: Metrology and Properties, 2016, 4(2): 024009.
[13] 刘洪鹏, 赵文政, 刘银华, 等. 测量不确定度约束下的结构光检测视点规划方法[J]. 计算机集成制造系统, 2022, 28(4): 1079-1086.
Liu H P, Zhao W Z, Liu Y H, et al. View planning of structured light for free-form surfaces with control of measurement uncertainty[J]. Computer Integrated Manufacturing Systems, 2022, 28(4): 1079-1086.
[14] MohammadikajiM, BergmannS, IrgenfriedS, et al. Inspection planning for optimized coverage of geometrically complex surfaces[C]//2018 Workshop on Metrology for Industry 4.0 and IoT, April 16-18, 2018, Brescia, Italy. New York: IEEE Press, 2018: 52-67.
[15] BircherA, AlexisK, BurriM, et al. Structural inspection path planning via iterative viewpoint resampling with application to aerial robotics[C]//2015 IEEE International Conference on Robotics and Automation (ICRA), May 26-30, 2015, Seattle, WA, USA. New York: IEEE Press, 2015: 6423-6430.
[16] AlmadhounR, TahaT, DiasJ, et al. Coverage path planning for complex structures inspection using unmanned aerial vehicle (UAV)[M]//YuH B, LiuJ G, JuZ J, et al. Intelligent robotics and applications. Lecture notes in computer science. Cham: Springer, 2019, 11744: 243-266.
[17] Phung M D, Quach C H, Dinh T H, et al. Enhanced discrete particle swarm optimization path planning for UAV vision-based surface inspection[J]. Automation in Construction, 2017, 81: 25-33.
[18] JingW, PoldenJ, TaoP Y, et al. Model-based coverage motion planning for industrial 3D shape inspection applications[C]//2017 13th IEEE Conference on Automation Science and Engineering (CASE), August 20-23, 2017, Xi'an, China. New York: IEEE Press, 2018: 1293-1300.
[19] 陈丽, 陈洋, 杨艳华. 面向三维结构视觉检测的无人机覆盖路径规划[J]. 电子测量与仪器学报, 2023, 37(2): 1-10.
Chen L, Chen Y, Yang Y H. UAV coverage path planning for 3D structure visual inspection[J]. Journal of Electronic Measurement and Instrumentation, 2023, 37(2): 1-10.
[20] 李新春, 闫振宇, 林森, 等. 基于邻域特征点提取和匹配的点云配准[J]. 光子学报, 2020, 49(4): 0415001.
[21] 乔玉晶, 谭世征, 姜金刚. 一种多视觉测量组网规划策略[J]. 光学学报, 2018, 38(5): 0515005.
[22] Hodgson J R, Kinnell P, Justham L, et al. Characterizing the influence of surface roughness and inclination on 3D vision sensor performance[J]. Proceedings of SPIE, 2015, 9875: 98751L.
[23] Deb K, Pratap A, Agarwal S, et al. A fast and elitist multiobjective genetic algorithm: NSGA-II[J]. IEEE Transactions on Evolutionary Computation, 2002, 6(2): 182-197.
[24] Gonçalves J F, Resende M G C. Biased random-key genetic algorithms for combinatorial optimization[J]. Journal of Heuristics, 2011, 17(5): 487-525.
[25] 贺锋涛, 余婕, 张建磊, 等. 采用改进遗传算法的可见光通信光源布局优化[J]. 中国激光, 2023, 50(13): 1306001.
[26] 何成刚, 郑衡, 丁克, 等. 基于机械臂辅助的多视角三维点云拼接算法[J]. 激光与光电子学进展, 2023, 60(20): 2015001.
Article Outline
崔海华, 田龙飞, 王嘉瑞, 曲峻学, 杨锋, 郭俊刚. 基于多目标优化的高效视觉检测规划方法[J]. 光学学报, 2024, 44(4): 0415001. Haihua Cui, Longfei Tian, Jiarui Wang, Junxue Qu, Feng Yang, Jungang Guo. Multi-Objective Optimization-Based Planning Algorithm for Efficient Visual Inspection[J]. Acta Optica Sinica, 2024, 44(4): 0415001.