AI vision-based industrial robot workpiece defect rapid detection method
Patent Information
- Application Number
- CN202611129464.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-28
- Publication Date
- 2026-10-27
AI Technical Summary
[0004]针对现有技术存在的不足,本发明目的是提供基于AI视觉工业机器人工件缺陷快速检测方法,本发明旨在提高工件缺陷检测效率,为工件的高质量生产提供保障
1、本发明通过几何分析方法完成图像像素畸变率量化识别,能够从机器人多机位采集的多张工件图像中自动筛选畸变率最小的图像开展缺陷检测,规避畸变像素引发的工件轮廓形变、缺陷尺寸测算偏差问题,有效降低缺陷漏检、误检概率;同时摒弃高畸变无效图像推理,减少边缘设备算力占用,提升工件整体检测速度,适配流水线高速检测节拍需求。
Smart Images

Figure CN122989599A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence and relates to image recognition technology, specifically a rapid defect detection method for industrial robots based on AI vision. Background Technology
[0002] Existing AI vision industrial robots have the following shortcomings when performing rapid defect detection on workpieces: 1. Directly using the original images collected by the robot for defect identification cannot distinguish the degree of distortion of images from different shooting positions. It cannot automatically select the high-quality images with the lowest distortion rate for defect detection. Distorted pixels will cause workpiece contour stretching and defect size measurement distortion, which will greatly increase the probability of missed detection and false detection. At the same time, the lack of image selection logic will increase the computational power consumption of invalid image inference and slow down the production line inspection cycle. 2. Individually labeling scattered abnormal pixels lacks pixel clustering and partition traversal processes, making it impossible to integrate spatially adjacent defect pixels into complete defect regions. It is difficult to distinguish between isolated pseudo-abnormal pixels formed by dust noise and real defect contiguous pixels. It is also difficult to quantify the geometric parameters such as area, length, width, and position of each defect region. Relying on single-point pixel judgment of defects is prone to a large number of misjudgments, and the completeness of the identification of small continuous scratches and pore-like defects is insufficient.
[0003] To address this, we propose a rapid defect detection method for industrial robots based on AI vision. Summary of the Invention
[0004] To address the shortcomings of existing technologies, the purpose of this invention is to provide a rapid workpiece defect detection method based on AI vision industrial robots. This invention aims to improve the efficiency of workpiece defect detection and ensure high-quality workpiece production.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: Step S1: Collect pre-selected finished workpieces, perform visual image acquisition on the pre-selected finished workpieces to obtain multiple visual images of the pre-selected workpieces, and perform pixel distortion recognition on the visual images of the pre-selected workpieces. Based on the recognition results, obtain the visual acquisition data of the finished workpieces. Step S2: Obtain visual inspection and screening images based on the visual acquisition data of the finished workpiece, mark abnormal pixels in the visual inspection and screening images, and obtain visual defect marking images; Step S3: Perform defect detection on the pre-selected finished workpieces based on the visual defect mark images, and issue a defect warning based on the detection results.
[0006] Furthermore, in step S1, the specific steps are as follows: Collect finished workpieces that require rapid defect detection to obtain pre-selected finished workpieces; Step S11: Create several image acquisition positions for the finished workpiece, and control the AI vision industrial robot to sequentially acquire images of the same workpiece position at each image acquisition position to obtain multiple pre-selected workpiece visual images. Step S12: Randomly select a sample workpiece image from the multiple pre-selected workpiece visual images, and perform pixel distortion analysis on the sample workpiece image. Based on the analysis results, obtain the pixel distortion rate corresponding to the sample workpiece image. Step S13: Obtain the pixel distortion rate corresponding to the visual image of each pre-selected workpiece to obtain the visual acquisition data of the finished workpiece.
[0007] Furthermore, in step S12, the specific steps are as follows: A Cartesian coordinate system is created by taking the lower left corner vertex of the sample workpiece image as the origin, thus obtaining the pre-selected pixel coordinate system; The AI vision industrial robot's built-in image acquisition device is used to acquire checkerboard calibration images, and the pre-selected pixel coordinate system is mapped onto the checkerboard calibration images. Geometric center point acquisition is performed on the checkerboard calibration image to obtain the center point of the calibration image. The x-axis coordinate of the center point of the calibration image in the pre-selected pixel coordinate system is acquired to obtain the horizontal pixel coordinate of the principal point. The y-axis coordinate of the center point of the calibration image in the pre-selected pixel coordinate system is acquired to obtain the vertical pixel coordinate of the principal point. The equivalent focal length of the image is obtained by acquiring the pixels on the horizontal axis of the AI vision industrial robot using the built-in image acquisition device. The equivalent focal length of the image is obtained by acquiring the pixels on the vertical axis of the AI vision industrial robot using the built-in image acquisition device.
[0008] Furthermore, in step S12, the specific steps are as follows: Numerical acquisition is performed on the first-order radial distortion corresponding to the built-in image acquisition device of the AI vision industrial robot to obtain the K1 radial distortion value; numerical acquisition is performed on the second-order radial distortion corresponding to the built-in image acquisition device of the AI vision industrial robot to obtain the K2 radial distortion value; and numerical acquisition is performed on the third-order radial distortion corresponding to the built-in image acquisition device of the AI vision industrial robot to obtain the K3 radial distortion value. The image area covered by the pre-selected workpiece in the sample workpiece image is acquired to obtain the workpiece image coverage area, and a sample coverage pixel is arbitrarily selected within the workpiece image coverage area. The horizontal coordinates of the sample-covered pixels in the pre-selected pixel coordinate system are numerically collected to obtain the horizontal coordinate values of the sample pixels. The vertical coordinates of the sample-covered pixels in the pre-selected pixel coordinate system are numerically collected to obtain the vertical coordinate values of the sample pixels.
[0009] Furthermore, in step S12, the specific steps are as follows: Calculate the difference between the horizontal coordinate of the sample pixel and the horizontal pixel coordinate of the principal point, and obtain the ratio of the obtained difference to the equivalent focal length of the x-axis image to obtain the normalized value of the horizontal coordinate of the sample pixel. Calculate the difference between the vertical coordinate of the sample pixel and the vertical pixel coordinate of the principal point, and obtain the ratio of the obtained difference to the equivalent focal length of the y-axis image to obtain the normalized value of the vertical coordinate of the sample pixel. The sum of the squares of the normalized x-coordinate value and the normalized y-coordinate value of the sample pixel is used to obtain the pixel center polar radius length. Substituting the pixel center polar radius length, K1 radial distortion value, K2 radial distortion value, and K3 radial distortion value into the formula for total radial distortion scaling factor, the distortion scaling factor corresponding to the sample-covered pixel point is calculated.
[0010] Furthermore, in step S12, the specific steps are as follows: Obtain the distortion scaling factor corresponding to each pixel in the coverage area of the workpiece image, create a distortion scaling factor reference interval, if the distortion scaling factor is within the distortion scaling factor reference interval, then divide the corresponding pixel into regular image pixels; if the distortion scaling factor is not within the distortion scaling factor reference interval, then divide the corresponding pixel into distorted image pixels. The number of pixels in the area covered by the workpiece image is counted to obtain the number of pixels in the first area. The number of distorted pixels in the area covered by the workpiece image is counted to obtain the number of pixels in the second area. The ratio of the pixel value of the second image to the pixel value of the first image is calculated to obtain the pixel distortion rate corresponding to the sample workpiece image.
[0011] Furthermore, step S2 specifically includes the following: Obtain visual acquisition data of finished workpieces, obtain the pixel distortion rate corresponding to each pre-selected workpiece visual image based on the finished workpiece visual acquisition data, compare the pixel distortion rates, and mark the pre-selected workpiece visual image corresponding to the minimum pixel distortion rate as the visual inspection and screening image. The visual inspection and screening images are converted to grayscale, and the pixel depth of each pixel in the area covered by the workpiece image is acquired to obtain multiple actual pixel depth values.
[0012] Furthermore, step S2 specifically includes the following: Create a pixel depth reference range. If the actual pixel depth value is within the pixel depth reference range, mark the corresponding pixel in the region as a normal pixel. If the actual pixel depth value is not within the pixel depth reference range, mark the corresponding pixel in the region as an abnormal pixel. Abnormal pixels are marked on the visual inspection and screening images to obtain visual defect marked images.
[0013] Furthermore, in step S3, the specific steps are as follows: Obtain a visual defect marker image, and arbitrarily select one sample abnormal pixel from the abnormal pixels contained in the visual defect marker image; In the visual defect marking image, an abnormal pixel traversal rectangle is created. The geometric center point of the abnormal pixel traversal rectangle is controlled to coincide with the sample abnormal pixel. The abnormal pixels covered by the abnormal pixel traversal rectangle are connected with the sample abnormal pixels to obtain the abnormal pixel connected region corresponding to the sample abnormal pixel. The abnormal pixels in the abnormal pixel connected region are traversed using the abnormal pixel traversal rectangle. The abnormal pixel connected region is expanded according to the traversal result until there are no abnormal pixels in the abnormal pixel connected region. The finally obtained abnormal pixel connected region is set as the traversed abnormal region corresponding to the sample abnormal pixel.
[0014] Furthermore, in step S3, the specific steps are as follows: Repeat the process of obtaining the abnormal region corresponding to the abnormal pixel of the sample, and obtain the abnormal region corresponding to each abnormal pixel except the abnormal region corresponding to the abnormal pixel of the sample. The area values of the traversed abnormal regions are obtained to get multiple defect area values. The smallest defect area value is marked as the defect detection area value. Set a defect detection area benchmark value. If the defect detection area value is greater than the defect detection area benchmark value, a visual defect warning will be issued for the pre-selected finished workpiece. If the defect detection area value is less than or equal to the defect detection area benchmark value, there is no need to issue a visual defect warning for the pre-selected finished workpiece.
[0015] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are as follows: 1. This invention uses geometric analysis to quantify and identify the image pixel distortion rate. It can automatically select the image with the smallest distortion rate from multiple workpiece images acquired by the robot from multiple positions for defect detection, avoiding the problems of workpiece contour deformation and defect size measurement deviation caused by distorted pixels, and effectively reducing the probability of missed or false defects. At the same time, it abandons the inference of high-distortion invalid images, reduces the computing power occupation of edge devices, improves the overall detection speed of workpieces, and adapts to the high-speed detection cycle requirements of the production line.
[0016] 2. This invention performs connected component clustering traversal analysis on abnormal pixels, integrating spatially adjacent abnormal pixels into independent and complete defect regions. It can distinguish between isolated pseudo-abnormal pixels formed by dust and camera noise and real defect contiguous pixels, accurately eliminating pseudo-defect interference. It can also quantitatively calculate the geometric parameters such as defect area, length, and position based on the clustered defect regions, completely outlining the contours of continuous defects such as micro-scratches and pores, greatly improving the completeness of micro-defect identification and the accuracy of detection and judgment. Attached Figure Description
[0017] To facilitate understanding by those skilled in the art, the present invention will be further described below with reference to the accompanying drawings.
[0018] Figure 1 This is a schematic diagram of the pre-selected pixel coordinate system of the present invention; Figure 2 This is a schematic diagram of the visual defect marking image of the present invention; Figure 3 This is a schematic diagram of the abnormal pixel traversal rectangle of the present invention. Detailed Implementation
[0019] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0020] Example 1: This invention provides a technical solution: a rapid workpiece defect detection method based on AI vision industrial robots, comprising the following steps: Step S1: Collect pre-selected finished workpieces, perform visual image acquisition on the pre-selected finished workpieces to obtain multiple visual images of the pre-selected workpieces, and perform pixel distortion recognition on the visual images of the pre-selected workpieces. Based on the recognition results, obtain the visual acquisition data of the finished workpieces. In step S1, the specific steps are as follows: Collect finished workpieces that require rapid defect detection to obtain pre-selected finished workpieces; It should be noted here that: In this application, the finished workpiece referred to herein is specifically a workpiece in which all processing steps have been completed.
[0021] Several image acquisition positions are created for the finished workpiece, and the AI vision industrial robot is controlled to sequentially acquire images of the same workpiece position at each image acquisition position to obtain multiple pre-selected workpiece visual images. It should be noted here that: In this application, the finished workpiece referred to herein is a solid color workpiece, that is, the finished workpiece has a consistent color throughout.
[0022] Randomly select a sample workpiece image from the multiple pre-selected workpiece visual images, and perform pixel distortion analysis on the sample workpiece image. Based on the analysis results, obtain the pixel distortion rate corresponding to the sample workpiece image. Specifically as follows: Please see Figure 1 A Cartesian coordinate system is created by taking the lower left corner vertex of the sample workpiece image as the origin, thus obtaining the pre-selected pixel coordinate system; The AI vision industrial robot's built-in image acquisition device is used to acquire checkerboard calibration images, and the pre-selected pixel coordinate system is mapped onto the checkerboard calibration images. It should be noted here that: In this application, the checkerboard calibration image referred to herein is specifically an image obtained by the built-in image acquisition device of an AI vision industrial robot, which captures a high-precision black and white square grid calibration board. This image serves as a standard reference image for solving the camera's imaging geometric parameters. The side length of the grid on the calibration board is a precisely fixed size. The intersection of the black and white squares forms a large number of clear sub-pixel corner points. After inputting multiple checkerboard images from different angles and field of view positions into the calibration algorithm, the coordinates of all corner points can be extracted. The camera's intrinsic parameters, focal length, principal point position, and first, second, and third-order radial and tangential distortion coefficients can be fitted and solved. This establishes a geometric mapping relationship for ideal, distortion-free pixel imaging, providing a unified geometric reference for subsequent pixel-by-pixel distortion calculation and identification of distorted pixels, thus eliminating the errors in calculating workpiece contours and defect dimensions caused by lens optical deformation.
[0023] Geometric center point acquisition is performed on the checkerboard calibration image to obtain the center point of the calibration image. The x-axis coordinate of the center point of the calibration image in the pre-selected pixel coordinate system is acquired to obtain the horizontal pixel coordinate of the principal point. The y-axis coordinate of the center point of the calibration image in the pre-selected pixel coordinate system is acquired to obtain the vertical pixel coordinate of the principal point. It should be noted here that: In this application, if the built-in image acquisition device of the AI vision industrial robot is a 4K industrial camera with an image resolution of 3840×2160, then the coordinates of the center point of the calibrated image in the pre-selected pixel coordinate system are (1920, 1080). Thus, the horizontal pixel coordinate of the principal point is 1920, and the vertical pixel coordinate of the principal point is 1080.
[0024] The equivalent focal length of pixels on the horizontal axis of the image is collected by the built-in image acquisition device of the AI vision industrial robot to obtain the equivalent focal length value of the image on the x-axis. The equivalent focal length of pixels on the vertical axis of the image is collected by the built-in image acquisition device of the AI vision industrial robot to obtain the equivalent focal length value of the image on the y-axis. It should be noted here that: In this application, the equivalent focal length of the horizontal axis pixels of the image corresponding to the built-in image acquisition device of the AI vision industrial robot is calibrated as 4620.5px, and the equivalent focal length of the vertical axis pixels is calibrated as 4618.3px, that is, the first image equivalent focal length value is 4620.5 and the first image equivalent focal length value is 4618.3.
[0025] Numerical acquisition is performed on the first-order radial distortion corresponding to the built-in image acquisition device of the AI vision industrial robot to obtain the K1 radial distortion value; numerical acquisition is performed on the second-order radial distortion corresponding to the built-in image acquisition device of the AI vision industrial robot to obtain the K2 radial distortion value; and numerical acquisition is performed on the third-order radial distortion corresponding to the built-in image acquisition device of the AI vision industrial robot to obtain the K3 radial distortion value. It should be noted here that: In this application, first-order radial distortion, second-order radial distortion, and third-order radial distortion are the constituent parameters of the radial distortion Taylor series polynomial, and the first-order radial distortion corresponds to the lower-order term k1r of the polynomial. 2 It mainly affects the middle region from the image center to the edge, and is the dominant component of radial distortion in conventional industrial lenses. Its impact on image shift is most pronounced when the distance between pixels and the image center is moderate. Second-order radial distortion corresponds to the higher-order term k2r. 4 It only has a significant effect when the pixel is close to the edge of the image. It is used to correct the secondary deformation of the image edge that the first-order model cannot accurately fit. Its influence increases rapidly with the increase of the pixel polar diameter. The third-order radial distortion corresponds to the sixth term k3r6, which is used to compensate for the extreme distortion deviation of pixels at the extreme edge. In this application, if the lens used in the image acquisition device built into the AI vision industrial robot is a 25mm fixed-focus lens, then the radial distortion value of K1 is 0.021, the radial distortion value of K2 is -0.0035, and the radial distortion value of K3 is 0.0008.
[0026] The image area covered by the pre-selected workpiece in the sample workpiece image is acquired to obtain the workpiece image coverage area, and a sample coverage pixel is arbitrarily selected within the workpiece image coverage area. The horizontal coordinates of the sample-covered pixels in the pre-selected pixel coordinate system are numerically collected to obtain the horizontal coordinate values of the sample pixels. The vertical coordinates of the sample-covered pixels in the pre-selected pixel coordinate system are numerically collected to obtain the vertical coordinate values of the sample pixels. Calculate the difference between the horizontal coordinate of the sample pixel and the horizontal pixel coordinate of the principal point, and obtain the ratio of the obtained difference to the equivalent focal length of the x-axis image to obtain the normalized value of the horizontal coordinate of the sample pixel. Calculate the difference between the vertical coordinate of the sample pixel and the vertical pixel coordinate of the principal point, and obtain the ratio of the obtained difference to the equivalent focal length of the y-axis image to obtain the normalized value of the vertical coordinate of the sample pixel. The sum of the squares of the normalized x-coordinate value and the normalized y-coordinate value of the sample pixel is used to obtain the pixel center polar radius length. Substitute the pixel center polar radius length, K1 radial distortion value, K2 radial distortion value, and K3 radial distortion value into the formula for total radial distortion scaling factor to calculate the distortion scaling factor corresponding to the sample-covered pixel. The scaling factor for the distortion corresponding to the pixels covered by the sample is calculated using the following formula: ; Where Jfs is the distortion scaling factor corresponding to the pixel point covered by the sample, K1 is the K1 radial distortion value, K2 is the K2 radial distortion value, K3 is the K3 radial distortion value, and r is the pixel center polarity length value. It should be noted here that: In this application, if the measured value of the center polar radius of the pixel corresponding to the sample-covered pixel is 0.3754, and the calibrated radial distortion values are 0.021, -0.0035, 0.0008, and 0.021, the distortion scaling factor corresponding to the sample-covered pixel can be calculated to be approximately 1.0029.
[0027] Repeat the process of collecting the distortion scaling coefficients corresponding to the pixels covered by the sample, and obtain the distortion scaling coefficients corresponding to the pixels of each region covered by the workpiece image. Create a baseline range for the distortion scaling factor. If the distortion scaling factor is within the baseline range, the corresponding region pixels are classified as regular image pixels. If the distortion scaling factor is not within the baseline range, the corresponding region pixels are classified as distorted image pixels. It should be noted here that: In this application, the lower limit of the baseline interval for the distortion scaling factor is 0, which means that there is no pixel distortion in the corresponding region. The distortion scaling factor is collected for historical image pixels that have been identified as distorted image pixels, and the obtained distortion scaling factor is compared numerically. The minimum distortion scaling factor is set as the upper limit of the baseline interval for the distortion scaling factor.
[0028] The number of pixels in the area covered by the workpiece image is counted to obtain the number of pixels in the first area. The number of distorted image pixels in the area covered by the workpiece image is counted to obtain the number of pixels in the second area. The ratio of the second image pixel value to the first image pixel value is calculated to obtain the pixel distortion rate corresponding to the sample workpiece image. Repeat the process of obtaining the pixel distortion rate corresponding to the sample workpiece image, and obtain the pixel distortion rate corresponding to the visual image of each pre-selected workpiece to obtain the visual acquisition data of the finished workpiece. Step S2: Obtain visual inspection and screening images based on the visual acquisition data of the finished workpiece, mark abnormal pixels in the visual inspection and screening images, and obtain visual defect marking images; In step S2, the specific details are as follows: Obtain visual acquisition data of finished workpieces, obtain the pixel distortion rate corresponding to each pre-selected workpiece visual image based on the finished workpiece visual acquisition data, compare the pixel distortion rates, and mark the pre-selected workpiece visual image corresponding to the minimum pixel distortion rate as the visual inspection and screening image. The visual inspection and screening images are converted to grayscale, and the pixel depth of each pixel in the area covered by the workpiece image is acquired to obtain multiple actual pixel depth values. Create a pixel depth reference range. If the actual pixel depth value is within the pixel depth reference range, mark the corresponding pixel in the region as a normal pixel. If the actual pixel depth value is not within the pixel depth reference range, mark the corresponding pixel in the region as an abnormal pixel. It should be noted here that: In this application, the process for creating the pixel depth reference interval is as follows: Images of qualified finished workpieces that have undergone defect detection are acquired and grayscale processed to obtain pixel-comparison workpiece images. Pixel depths are acquired in the areas covered by the workpiece images in the pixel-comparison workpiece images to obtain multiple pre-selected standard pixel depths. The average value of the pre-selected standard pixel depths is calculated to obtain the first standard pixel depth value. The standard deviation of the pre-selected standard pixel depths is calculated to obtain the second standard pixel depth value. The sum of the first standard pixel depth value and the second standard pixel depth value is calculated to obtain the upper limit of the pixel depth reference interval. The difference between the first standard pixel depth value and the second standard pixel depth value is calculated to obtain the lower limit of the pixel depth reference interval.
[0029] Please see Figure 2 Abnormal pixels are marked on the visual inspection and screening images to obtain visual defect marked images; Step S3: Perform defect detection on the pre-selected finished workpieces based on the visual defect mark images, and issue a defect warning based on the detection results; The specific steps in step S3 are as follows: Obtain a visual defect marker image, and arbitrarily select one sample abnormal pixel from the abnormal pixels contained in the visual defect marker image; Please see Figure 3 An abnormal pixel traversal rectangle is created in the visual defect marking image. The geometric center point of the abnormal pixel traversal rectangle is controlled to coincide with the sample abnormal pixel. The abnormal pixels covered by the abnormal pixel traversal rectangle are connected with the sample abnormal pixels to obtain the abnormal pixel connected region corresponding to the sample abnormal pixel. The abnormal pixels in the abnormal pixel connected region are traversed using the abnormal pixel traversal rectangle. The abnormal pixel connected region is expanded according to the traversal result until there are no abnormal pixels in the abnormal pixel connected region. The finally obtained abnormal pixel connected region is set as the traversed abnormal region corresponding to the sample abnormal pixel. It should be noted here that: In this application, the abnormal pixel connected region includes the abnormal pixel point, the sample abnormal pixel point, and the region covered by the pixel connection line between the abnormal pixel point and the sample abnormal pixel point.
[0030] Repeat the process of obtaining the abnormal region corresponding to the abnormal pixel of the sample, and obtain the abnormal region corresponding to each abnormal pixel except the abnormal region corresponding to the abnormal pixel of the sample. It should be noted here that: In this application, the side length of the abnormal pixel traversal rectangle is set to 0.18 mm.
[0031] The area values of the traversed abnormal regions are obtained to get multiple defect area values. The smallest defect area value is marked as the defect detection area value. Set a defect detection area benchmark value. If the defect detection area value is greater than the defect detection area benchmark value, a visual defect warning will be issued for the pre-selected finished workpiece. If the defect detection area value is less than or equal to the defect detection area benchmark value, there is no need to issue a visual defect warning for the pre-selected finished workpiece.
[0032] It should be noted here that: The abnormal areas of qualified finished products that have completed defect detection are collected, and the area value of each abnormal area is obtained. The maximum area value is set as the defect detection area benchmark value.
[0033] Compared to the problems described in the background technology, this invention uses a geometric analysis method to quantify and identify the image pixel distortion rate. It can automatically select the image with the lowest distortion rate from multiple workpiece images acquired by the robot from multiple positions for defect detection, avoiding the problems of workpiece contour deformation and defect size measurement deviation caused by distorted pixels, and effectively reducing the probability of missed or false defects. At the same time, it abandons the inference of high-distortion invalid images, reduces the computing power occupation of edge devices, improves the overall workpiece detection speed, and adapts to the high-speed inspection cycle requirements of the production line.
[0034] Furthermore, this invention performs connected component clustering traversal analysis on abnormal pixels, integrating spatially adjacent abnormal pixels into independent and complete defect regions. This can distinguish between isolated pseudo-abnormal pixels formed by dust and camera noise and real defect contiguous pixels, accurately eliminating pseudo-defect interference. It can also quantitatively calculate geometric parameters such as defect area, length, and position based on the clustered defect regions, completely outlining the contours of continuous defects such as micro-scratches and pores, significantly improving the completeness of micro-defect identification and the accuracy of detection and judgment.
[0035] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to specific implementation methods. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to better understand and utilize the invention. The present invention is limited only to the technical solutions and their full scope and equivalents.
Claims
1. A rapid defect detection method for industrial robots based on AI vision, characterized in that, include: Step S1: Collect pre-selected finished workpieces, perform visual image acquisition on the pre-selected finished workpieces to obtain visual images of the pre-selected workpieces, perform pixel distortion recognition on the visual images of the pre-selected workpieces to obtain visual acquisition data of finished workpieces. Step S2: Analyze the visual acquisition data of the finished workpiece to obtain visual inspection and screening images, mark abnormal pixels in the visual inspection and screening images to obtain visual defect marking images; Step S3: Perform defect detection on the pre-selected finished workpieces based on the visual defect mark images, and issue a defect warning based on the detection results.
2. The method for rapid detection of workpiece defects based on AI vision industrial robots according to claim 1, characterized in that, In step S1, the specific steps are as follows: Step S11: Obtain pre-selected finished workpieces, create several image acquisition positions for the finished workpieces, and control the AI vision industrial robot to sequentially acquire images of the finished workpieces at each image acquisition position to obtain multiple pre-selected workpiece visual images. Step S12: Randomly select a sample workpiece image from the multiple pre-selected workpiece visual images, perform pixel distortion analysis on the sample workpiece image, and obtain the pixel distortion rate corresponding to the sample workpiece image. Step S13: Obtain the pixel distortion rate corresponding to the visual image of each pre-selected workpiece to obtain the visual acquisition data of the finished workpiece.
3. The rapid workpiece defect detection method based on AI vision industrial robot according to claim 2, characterized in that, In step S12, the specific steps are as follows: A Cartesian coordinate system is created by taking the lower left corner vertex of the sample workpiece image as the origin, thus obtaining the pre-selected pixel coordinate system; The image acquisition device acquires a checkerboard calibration image and maps the pre-selected pixel coordinate system onto the checkerboard calibration image. Geometric center point acquisition is performed on the checkerboard calibration image to obtain the center point of the calibration image. The x-axis coordinate of the center point of the calibration image in the pre-selected pixel coordinate system is acquired to obtain the horizontal pixel coordinate of the principal point. The y-axis coordinate of the center point of the calibration image in the pre-selected pixel coordinate system is acquired to obtain the vertical pixel coordinate of the principal point. The image acquisition device acquires the equivalent focal length of pixels along the horizontal axis of the image to obtain the equivalent focal length value of the image along the x-axis. The image acquisition device built into the AI vision industrial robot acquires the equivalent focal length of pixels along the vertical axis of the image to obtain the equivalent focal length value of the image along the y-axis.
4. The rapid workpiece defect detection method based on AI vision industrial robot according to claim 3, characterized in that, In step S12, the specific steps are as follows: Numerical acquisition is performed on the first-order radial distortion corresponding to the image acquisition device to obtain the K1 radial distortion value; numerical acquisition is performed on the second-order radial distortion corresponding to the built-in image acquisition device to obtain the K2 radial distortion value; and numerical acquisition is performed on the third-order radial distortion corresponding to the built-in image acquisition device to obtain the K3 radial distortion value. The image area covered by the pre-selected workpiece in the sample workpiece image is acquired to obtain the workpiece image coverage area. A sample coverage pixel is randomly selected within the workpiece image coverage area. The horizontal coordinates of the sample-covered pixels in the pre-selected pixel coordinate system are numerically collected to obtain the horizontal coordinate values of the sample pixels. The vertical coordinates of the sample-covered pixels in the pre-selected pixel coordinate system are numerically collected to obtain the vertical coordinate values of the sample pixels.
5. The rapid workpiece defect detection method based on AI vision industrial robot according to claim 4, characterized in that, In step S12, the specific steps are as follows: Calculate the difference between the horizontal coordinate of the sample pixel and the horizontal pixel coordinate of the principal point, and obtain the ratio of the obtained difference to the equivalent focal length of the x-axis image to obtain the normalized value of the horizontal coordinate of the sample pixel. Calculate the difference between the vertical coordinate of the sample pixel and the vertical pixel coordinate of the principal point, and obtain the ratio of the obtained difference to the equivalent focal length of the y-axis image to obtain the normalized value of the vertical coordinate of the sample pixel. The sum of the squares of the normalized x-coordinate value and the normalized y-coordinate value of the sample pixel is used to obtain the pixel center polar radius length. Substituting the pixel center polar radius length, K1 radial distortion value, K2 radial distortion value, and K3 radial distortion value into the formula for total radial distortion scaling factor, the distortion scaling factor corresponding to the sample-covered pixel point is calculated.
6. The rapid workpiece defect detection method based on AI vision industrial robot according to claim 5, characterized in that, Step S12 further includes: Obtain the distortion scaling factor corresponding to each pixel in the coverage area of the workpiece image, create a distortion scaling factor reference interval, if the distortion scaling factor is within the distortion scaling factor reference interval, then divide the corresponding pixel into a regular image pixel; otherwise, divide the corresponding pixel into a distorted image pixel. The number of pixels in the area covered by the workpiece image is counted to obtain the number of pixels in the first area. The number of distorted image pixels in the area covered by the workpiece image is counted to obtain the number of pixels in the second area. The pixel distortion rate is obtained by calculating the ratio of the second image pixel value to the first image pixel value.
7. The method for rapid detection of workpiece defects based on AI vision industrial robots according to claim 1, characterized in that, In step S2, the specific details are as follows: Acquire visual acquisition data of finished workpieces, obtain the pixel distortion rate corresponding to each pre-selected workpiece visual image based on the finished workpiece visual acquisition data, and mark the pre-selected workpiece visual image corresponding to the minimum pixel distortion rate as the visual inspection and screening image. The visual inspection and screening images are converted to grayscale, and the pixel depth of each pixel within the coverage area of the workpiece image is acquired to obtain multiple actual pixel depth values.
8. The method for rapid detection of workpiece defects based on AI vision industrial robots according to claim 7, characterized in that, In step S2, the specific details are as follows: Create a pixel depth reference range. If the actual pixel depth value is within the pixel depth reference range, mark the corresponding pixel in the region as a normal pixel. If the actual pixel depth value is not within the pixel depth reference range, mark the corresponding pixel in the region as an abnormal pixel. Abnormal pixels are marked on the visual inspection and screening images to obtain visual defect marked images.
9. The method for rapid detection of workpiece defects based on AI vision industrial robots according to claim 1, characterized in that, The specific steps in step S3 are as follows: Obtain a visual defect marker image, and arbitrarily select one sample abnormal pixel from the abnormal pixels contained in the visual defect marker image; In the visual defect marking image, an abnormal pixel traversal rectangle is created. The geometric center point of the abnormal pixel traversal rectangle is controlled to coincide with the sample abnormal pixel. The abnormal pixels covered by the abnormal pixel traversal rectangle are connected with the sample abnormal pixels to obtain the abnormal pixel connected region corresponding to the sample abnormal pixel. The abnormal pixel traversal rectangle is used to traverse the abnormal pixels in the abnormal pixel connected region to expand the abnormal pixel connected region until there are no abnormal pixels in the abnormal pixel connected region. The finally obtained abnormal pixel connected region is set as the traversed abnormal region.
10. The rapid workpiece defect detection method based on AI vision industrial robot according to claim 9, characterized in that, The specific steps in step S3 are as follows: Repeat the process of obtaining the abnormal region corresponding to the abnormal pixel of the sample, and obtain the abnormal region corresponding to each abnormal pixel except the abnormal region of the sample. The area values of the traversed abnormal regions are obtained to get multiple defect area values. The smallest defect area value is marked as the defect detection area value. Set a defect detection area benchmark value. If the defect detection area value is greater than the defect detection area benchmark value, a visual defect warning will be issued for the pre-selected finished workpiece. If the defect detection area value is less than or equal to the defect detection area benchmark value, there is no need to issue a visual defect warning for the pre-selected finished workpiece.
