A robot parameter adjustment optimization system and method applied to appearance detection

By combining an improved weighted median filtering and hybrid detection algorithm with an educational competitive optimization algorithm, the problems of slow robot parameter adjustment and insufficient adaptability are solved, achieving efficient defect identification and robot parameter optimization, which is suitable for appearance inspection.

CN120704242BActive Publication Date: 2026-07-07JINPIN ELECTRICAL CO LTD ZHUHAI S E Z

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JINPIN ELECTRICAL CO LTD ZHUHAI S E Z
Filing Date
2025-06-16
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

Existing technologies for robot parameter adjustment and optimization suffer from long debugging cycles, difficulty in adapting to the needs of multi-variety production, slow parameter adjustment and optimization speed in dynamic detection scenarios, leading to missed or false detections, and lack of artificial intelligence applications, thus failing to meet product production requirements.

Method used

An improved weighted median filtering algorithm and a hybrid detection algorithm are used for target region segmentation and extraction. The objective function for parameter adjustment is solved by combining the educational competition optimization algorithm. The robot parameters are optimized by the shortest time principle. The correlation matrix of the robot links is established and the parameters are adjusted using the educational competition optimization algorithm.

Benefits of technology

It improves the defect recognition rate, reduces missed or false detections, shortens the detection time, is applicable to a variety of optimization problems, and enables efficient adjustment of robot parameters and coordinated movement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120704242B_ABST
    Figure CN120704242B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of parameter adjustment, and discloses a robot parameter adjustment optimization system and method applied to appearance detection. First, an initial product image set to be detected is acquired, an improved weighted median filtering algorithm and a hybrid detection algorithm are used for target region segmentation and extraction, and a processed product image set to be detected is obtained; second, pixel point coordinates in the processed product image set to be detected are converted into a world coordinate system, spatial coordinates of robot joints in the world coordinate system are determined, and an associated matrix of a robot connecting rod is generated; third, a robot connecting rod end parameter data sequence is determined, a target function is established based on a shortest time principle; and finally, an education competition optimization algorithm is used to solve the target function, optimized robot parameters are generated, and robot parameter adjustment optimization is completed. The application realizes the purpose of robot parameter adjustment optimization by processing and analyzing robot parameters, and the method is objective and accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of parameter adjustment, specifically to a robot parameter adjustment and optimization system and method applied to appearance inspection. Background Technology

[0002] Chinese patent CN110501903B discloses a method for self-adjustment and optimization of robot inverse kinematics control system parameters. The method specifically includes: constructing a BP neural network and a PID control system; inputting the robot's motion error and its difference function into the BP neural network; using a genetic algorithm to optimize the weights and thresholds of the neural network; outputting optimized control system parameters; the robot executing motion, with joints controlled by the optimized control system parameters; calculating the time it takes for the robot to reach the target point; and then performing regression analysis on the optimized control system parameters based on the robot's motion error, fitting them into an nth-order function to obtain the optimized control system, thus completing self-adjustment and optimization. However, this invention does not provide different adjustment methods for different inputs, resulting in limited applicability.

[0003] Traditional parameter tuning and optimization methods typically rely on manual experience to adjust parameters, which has problems such as long debugging cycles and difficulty in adapting to the needs of multi-variety production. At the same time, in dynamic detection scenarios, the robot parameter tuning and optimization speed is slow, which may lead to missed or false detections, reduce the recognition rate of complex defects, and does not use artificial intelligence and other technologies. Most parameter tuning and optimization methods are single-objective optimizations, which cannot meet the needs of product production. Summary of the Invention

[0004] To address the problems in related technologies, this invention provides a robot parameter adjustment and optimization system and method for appearance inspection, thereby overcoming the aforementioned technical problems existing in the prior art.

[0005] To solve the above-mentioned technical problems, the present invention is achieved through the following technical solution:

[0006] This invention relates to a method for adjusting and optimizing robot parameters for appearance inspection, comprising the following steps:

[0007] S1. Obtain the product images to be detected, form an initial set of product images to be detected, and use an improved weighted median filtering algorithm and a hybrid detection algorithm to segment and extract the target region of the initial set of product images to be detected, thereby generating a processed set of product images to be detected.

[0008] S2. Obtain the pixel coordinates in the processed set of product images to be detected, transform the pixel coordinates to the world coordinate system to obtain the spatial coordinates of the product images to be detected, and at the same time determine the spatial coordinates of the robot joints in the world coordinate system to obtain the correlation matrix of the robot links.

[0009] S3. Obtain robot parameter data, determine the robot link end parameter data sequence based on the correlation matrix of the robot link and the spatial coordinates of the product image to be detected, and then establish a parameter adjustment optimization objective function based on the shortest time principle;

[0010] S4. Establish a fitness function, use the educational competition optimization algorithm to solve the objective function of parameter adjustment optimization, obtain the global optimal solution, generate the optimized robot parameters based on the global optimal solution, and complete the robot parameter adjustment optimization.

[0011] This invention acquires an initial set of product images to be inspected, and uses an improved weighted median filtering algorithm and a hybrid detection algorithm to segment and extract target regions, generating a processed set of product images to be inspected. Compared to traditional filtering algorithms, the improved weighted median filtering algorithm quickly removes outliers while maintaining processing speed, reducing real-time computation. The hybrid detection algorithm integrates two edge detection algorithms to achieve high-precision segmentation of the target region, balancing accuracy and time consumption, significantly reducing missed or false detections and improving defect recognition rate. Secondly, the pixel coordinates in the processed set of product images to be inspected are transformed to the world coordinate system to determine spatial coordinates and establish the association matrix of the robot links. This method uses coordinates... The method involves transforming the coordinates to obtain spatial coordinates, which facilitates the determination of robot motion parameters. These parameters are then controlled by identifying the connections between robot links, enabling subsequent coordinated robot motion. Next, the sequence of end-effector parameters is determined, and a parameter adjustment optimization objective function is established based on the shortest time principle. This objective function is then solved using an educational competition optimization algorithm to obtain the optimized robot parameters. This method quantifies the abstract problem through modeling. The educational competition optimization algorithm mimics the competition for educational resources in the real world, using a competition mechanism to search for and optimize the problem to obtain the optimal solution. It exhibits good convergence speed and the ability to escape local optima, effectively reducing detection time and making it suitable for various optimization problems.

[0012] Preferably, step S1 includes the following steps:

[0013] S11. When the robot performs appearance inspection, it uses a camera to acquire images of the product to be inspected, obtains images of the product to be inspected, forms an initial set of images of the product to be inspected, sets sample points in the images of the product to be inspected, the sample points are pixels, and quantizes the sample points to generate an initial matrix of images of the product to be inspected.

[0014] S12. Based on the initial product image matrix to be detected, the initial product image set to be detected is subjected to secondary filtering using an improved weighted median filtering algorithm, and outliers are then detected and removed to obtain the processed product image set to be detected. The specific steps are as follows:

[0015] S121. Set a filter window with a size of 3×3, place the filter window in the initial product image matrix to be detected, traverse the pixels in the filter window, and arrange the pixels according to their gray values ​​to obtain the arranged pixel gray values. Select the median of the arranged pixel gray values ​​and record it as the median of the filter window. Use the median of the filter window to replace the gray values ​​of all pixels in the filter window. Move the filter window sequentially until all pixels in the initial product image matrix to be detected have been filtered, and complete the first filtering process to obtain the filtered product image to be detected and the filtered product image matrix to be detected.

[0016] S122. Set a gradient window with a size of 5×5, place the gradient window in the filtered product image matrix to be detected, calculate the pixel gradient in the filter window, the pixel gradient includes the horizontal gradient and the vertical gradient of the pixel; then calculate the similarity of the gray values ​​of the pixels in the filter window, assign weights to the similarity of the gray values ​​of the pixels and the gradient of the pixels, and calculate the gradient window weights; move the gradient window sequentially until the filtered product image matrix to be detected is traversed, obtain several gradient window weights, generate a gradient window weight sequence, select the median of the gradient window weight sequence, find the gradient window corresponding to the median of the gradient window weight sequence, and calculate the median of the gray values ​​of the pixels in the gradient window, which is recorded as the weighted median;

[0017] S123. Traverse the filtered product image matrix to be detected, select any pixel point and record it as the detection pixel point, set a grayscale threshold, when the difference between the grayscale value of the detection pixel point and the grayscale value of its eight neighboring pixels is greater than the grayscale threshold, the detection pixel point is regarded as an outlier point and the grayscale value of the detection pixel point is replaced by the weighted median; otherwise, no replacement is performed. Continue until all pixels in the filtered product image matrix to be detected have been detected, and the second filtering process is completed to obtain the processed product image to be detected, forming a set of processed product images to be detected.

[0018] S13. Combining the Canny edge detection algorithm and the multi-directional Sobel operator, a hybrid detection algorithm is obtained. This algorithm is used to extract and segment the target region of the processed set of product images to be detected, generating a processed set of product images to be detected. The specific steps are as follows:

[0019] S131. Perform convolution processing on the processed set of product images to be detected, and then generate a processed product image matrix to be detected. Calculate the gradient magnitude and gradient direction of the pixels in the processed product image matrix to be detected. Set an edge detection neighborhood, and compare the gradient magnitude of the center pixel of the edge detection neighborhood with that of the adjacent pixels along the gradient direction. If the gradient magnitude of the adjacent pixels is greater than the gradient magnitude of the center pixel, the center pixel is not an edge pixel. Otherwise, the center pixel is regarded as an edge pixel. In this way, all edge pixels in the processed product image matrix to be detected are obtained to form the first image edge.

[0020] S132. Select eight directions on the processed product image matrix to be detected. The eight directions include 0 degrees, 22.5 degrees, 45 degrees, 67.5 degrees, 90 degrees, 112.5 degrees, 135 degrees and 157.5 degrees. Set an edge detection window. Calculate the gradient magnitude and gradient direction of the pixels in the edge detection window in the eight directions in turn. Keep the pixels corresponding to the maximum gradient magnitude in the same gradient direction in the edge detection window. Iterate through all pixels in the processed product image matrix to be detected to form the second image edge.

[0021] S133. Overlay the edges of the first image and the second image to generate new image edges. Use morphological closing operation to repair the new image edges to form the final edge region. Complete the target region segmentation and extract the target region to obtain the processed set of product images to be detected.

[0022] This invention uses an improved weighted median filtering algorithm and a hybrid detection algorithm to segment and extract target regions, generating a processed set of product images to be inspected. Compared with traditional filtering algorithms, it can quickly remove outliers while ensuring processing speed and reducing real-time computation. The hybrid detection algorithm integrates two edge detection algorithms to achieve high-precision segmentation of the target region, while balancing accuracy and time consumption, greatly reducing missed or false detections and improving the defect recognition rate.

[0023] Preferably, step S2 includes the following steps:

[0024] S21. Convert the processed set of product images to be detected into a processed matrix of product images to be detected. Determine a pixel coordinate system on the processed matrix of product images to be detected. Randomly select pixel coordinates (x1, y1) as the coordinates of the pixel to be converted. Set the horizontal pixel spacing and vertical pixel spacing of the camera to be d. x and d y The projection center is (x0, y0); the imaging coordinate system is set, and the coordinates of the pixel to be converted are transformed into the imaging coordinate system to obtain the imaging coordinates (x2, y2). The calculation formula is as follows:

[0025]

[0026] Let the focal length of the camera in the imaging coordinate system be f. x and f y With a normalization coefficient of α, the imaging coordinate system is then transformed into the camera coordinate system to obtain the camera coordinates (x3, y3, z3). The calculation formula is as follows:

[0027]

[0028] Let the camera rotation vector be B and the camera translation vector be C. Perform a rigid body transformation on the camera coordinate system to convert it to the world coordinate system o-xyz, obtaining the world coordinates (x4, y4, z4). The calculation formula is as follows:

[0029]

[0030] The pixels in the processed product image matrix are sequentially transformed to the world coordinate system to obtain the spatial coordinates of the product image.

[0031] S22. Label the robot joints to obtain the robot joint set A1 = {a1, a2, a3, ..., a...} m}, where a m This represents the m-th robot joint. The robot is divided into several links by the set of robot joints, and after labeling, we obtain the robot link set A2 = {a′1, a′2, a3′, ..., a′}. m-1}, where a′ m-1 Represent the (m-1)th robot link, completing the robot modeling process; determine the spatial coordinates of the robot joints in the world coordinate system, calculate the rotation operator on the x-axis and the translation and rotation operators on the z-axis of the nth robot joint, and obtain the rotation angle β of the nth robot joint on the x-axis. n Translation distance d along the z-axis n and the rotation angle θ on the z-axis n The correlation matrix of the robot links at this time is as follows:

[0032]

[0033] Where B1 represents the correlation matrix of the robot links.

[0034] This invention transforms the pixel coordinates in the processed set of product images to be inspected into the world coordinate system, determines the spatial coordinates, establishes the correlation matrix of the robot links, which facilitates the determination of robot motion parameters, and controls the robot motion parameters by finding the robot link correlations, which facilitates the subsequent coordinated movement of the robot.

[0035] Preferably, step S3 includes the following steps:

[0036] S31. When the robot link moves, robot motion parameters are collected. The robot motion parameters include the rotation angle of the robot link, the speed of the robot link, and the acceleration of the robot link, to obtain robot parameter data. Based on the spatial coordinates of the robot joint in the world coordinate system and combined with the correlation matrix of the robot link, the position of the end of the robot link is obtained. Then, combined with the position of the end of the robot link, the robot link end parameter data sequence A3={x′,y′,z′,δ′,δ″,δ″′} is obtained, where x′,y′,z′ represent the coordinates of the end position of the robot link, and δ′,δ″,δ″′ represent the rotation angle of the end position of the robot link.

[0037] S32. Obtain the motion time and end-effector position motion time of the robot links in the robot link set. Based on the shortest time principle, use the minimum value of the robot link motion time and end-effector position motion time as parameters to adjust and optimize the objective function. Set constraints, including the maximum speed and maximum acceleration of the robot link motion, to ensure that the robot link motion speed is less than the maximum speed and the robot link motion acceleration is equal to the maximum acceleration.

[0038] Preferably, step S4 includes the following steps:

[0039] S41. Using the parameter adjustment optimization objective function as the fitness function, and under constraints, using the education competition optimization algorithm to solve the parameter adjustment optimization objective function to obtain the global optimal solution, the specific steps are as follows:

[0040] S411. In solving the objective function for parameter adjustment optimization, a search space exists, containing a population. School populations and student populations are determined based on the population. The school population has dimension j, and students compete for school admission. Each individual in the school population represents a candidate solution, including the robot link motion speed, robot link motion acceleration, and camera sampling frequency. The school population and student population are initialized using chaotic mapping. In the primary school stage, the current iteration number is set to t, and the maximum iteration number is set to T. The adaptive step size is then... In the t-th iteration, the position of the c-th school is... Distance from school location Let the nearest school location be X′, and the average school location at the t-th iteration be (X′ - X′ - X′). The Levy flight coefficient is Lexy(j), and d1 is a normally distributed random vector; in the school population, the position of the (c+1)th school at the t-th iteration. The student population updates along with the school population, thus obtaining...

[0041] S412. In secondary school, the patience coefficient ε is used to measure the learning patience of the student population, and the learning aptitude coefficient of the student population is calculated based on the patience coefficient. In the school population, the optimal position of the school at the t-th iteration is denoted as . get The student population is updated following the school population. Let d2 represent a random number between [0,1], and let the school location... Update when d2 < 0.5. When d2≥0.5, In each iteration, the student population moves toward the current best fitness function value to obtain the current best solution and determine the position of the school population.

[0042] S413. In high school, let d3 represent a random number between [0,1]. Then, consider the school location... Update and get The student population is updated following the school population. Let d3 represent a random number between [0,1] to update the school location. When d3 < 0.5, When d3 ≥ 0.5, After completing all phase updates, select the top 10% of fitness function values ​​to form a school population, and the remaining 90% to form a student population. Form a new school population and a new student population, and enter the next round of iteration. Stop iterating when the current iteration count reaches the maximum iteration count, and obtain the final school population. Record the school position corresponding to the best fitness function value in the final school population as the global optimal solution.

[0043] S42. The global optimal solution includes the optimized robot link motion speed, the optimized robot link motion acceleration, and the optimized camera sampling frequency, which together form the optimized robot parameters. When the robot performs appearance inspection on the product to be inspected, the optimized robot parameters are used to adjust and optimize the robot, thus completing the robot parameter adjustment and optimization.

[0044] This invention establishes a parameter adjustment optimization objective function based on the shortest time principle, and solves the parameter adjustment optimization objective function using an educational competition optimization algorithm. By simulating the competition for educational resources in the real world, it uses a competition mechanism to search for and optimize the problem to obtain the optimal solution. It has a good convergence speed and the ability to escape local optima, effectively reducing the detection time and is applicable to a variety of optimization problems.

[0045] This embodiment also discloses a system for adjusting and optimizing robot parameters applied to appearance inspection, specifically including: a target region segmentation and extraction module, a robot link association module, an objective function establishment module, and a parameter adjustment and optimization module;

[0046] The target region segmentation and extraction module is used to segment and extract the target region from the initial set of product images to be detected using filtering algorithms and hybrid detection algorithms.

[0047] The robot link association module is used to determine the spatial coordinates of the robot joints and generate the association matrix of the robot links;

[0048] The objective function establishment module is used to establish a parameter adjustment and optimization objective function based on the shortest time principle;

[0049] The parameter adjustment and optimization module is used to solve the parameter adjustment and optimization objective function using the educational competition optimization algorithm to obtain the optimized robot parameters.

[0050] The present invention has the following beneficial effects:

[0051] 1. This invention uses an improved weighted median filtering algorithm and a hybrid detection algorithm to segment and extract target regions, generating a processed set of product images to be inspected. Compared with traditional filtering algorithms, it can quickly remove outliers while ensuring processing speed and reducing real-time computation. The hybrid detection algorithm integrates two edge detection algorithms to achieve high-precision segmentation of the target region, while balancing accuracy and time consumption, greatly reducing missed or false detections and improving the defect recognition rate.

[0052] 2. This invention transforms the pixel coordinates in the processed set of product images to be inspected into the world coordinate system, determines the spatial coordinates, establishes the correlation matrix of the robot links, which facilitates the determination of robot motion parameters, and controls the robot motion parameters by finding the robot link correlations, which facilitates the subsequent coordinated movement of the robot.

[0053] 3. This invention establishes a parameter adjustment optimization objective function based on the shortest time principle, solves the parameter adjustment optimization objective function using an educational competition optimization algorithm, and obtains the optimal solution by imitating the competition for educational resources in the real world and using a competition mechanism to search and optimize the problem. It has a good convergence speed and the ability to escape local optima, effectively reduces the detection time, and is applicable to a variety of optimization problems.

[0054] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description

[0055] To more clearly illustrate the technical solutions of the embodiments of the invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the invention. For those skilled in the art, the drawings can be obtained from these drawings without creative effort.

[0056] Figure 1 This invention provides a schematic diagram of the robot parameter adjustment and optimization process in a robot parameter adjustment and optimization system applied to appearance inspection. Detailed Implementation

[0057] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. 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 skilled in the art without creative effort are within the scope of protection of the present invention.

[0058] In the description of this invention, it should be understood that the terms "opening", "upper", "lower", "top", "middle", "inner", etc., which indicate orientation or positional relationship, are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the components or elements referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation on the invention.

[0059] Example 1

[0060] Please see Figure 1 This embodiment discloses a method for adjusting and optimizing robot parameters for appearance inspection, specifically including the following:

[0061] S1. Obtain the product images to be detected, form an initial set of product images to be detected, and use an improved weighted median filtering algorithm and a hybrid detection algorithm to segment and extract the target region of the initial set of product images to be detected, thereby generating a processed set of product images to be detected.

[0062] S1 includes the following steps:

[0063] S11. When the robot performs appearance inspection, it uses a camera to acquire images of the product to be inspected, obtains images of the product to be inspected, forms an initial set of images of the product to be inspected, sets sample points in the images of the product to be inspected, the sample points are pixels, and quantizes the sample points to generate an initial matrix of images of the product to be inspected.

[0064] S12. Based on the initial product image matrix to be detected, the initial product image set to be detected is subjected to secondary filtering using an improved weighted median filtering algorithm, and outliers are then detected and removed to obtain the processed product image set to be detected. The specific steps are as follows:

[0065] S121. Set a filter window with a size of 3×3, place the filter window in the initial product image matrix to be detected, traverse the pixels in the filter window, and arrange the pixels according to their gray values ​​to obtain the arranged pixel gray values. Select the median of the arranged pixel gray values ​​and record it as the median of the filter window. Use the median of the filter window to replace the gray values ​​of all pixels in the filter window. Move the filter window sequentially until all pixels in the initial product image matrix to be detected have been filtered, and complete the first filtering process to obtain the filtered product image to be detected and the filtered product image matrix to be detected.

[0066] S122. Set a gradient window with a size of 5×5, place the gradient window in the filtered product image matrix to be detected, calculate the pixel gradient in the filter window, the pixel gradient includes the horizontal gradient and the vertical gradient of the pixel; then calculate the similarity of the gray values ​​of the pixels in the filter window, assign weights to the similarity of the gray values ​​of the pixels and the gradient of the pixels, and calculate the gradient window weights; move the gradient window sequentially until the filtered product image matrix to be detected is traversed, obtain several gradient window weights, generate a gradient window weight sequence, select the median of the gradient window weight sequence, find the gradient window corresponding to the median of the gradient window weight sequence, and calculate the median of the gray values ​​of the pixels in the gradient window, which is recorded as the weighted median;

[0067] S123. Traverse the filtered product image matrix to be detected, select any pixel point and record it as the detection pixel point, set a grayscale threshold, when the difference between the grayscale value of the detection pixel point and the grayscale value of its eight neighboring pixels is greater than the grayscale threshold, the detection pixel point is regarded as an outlier point and the grayscale value of the detection pixel point is replaced by the weighted median; otherwise, no replacement is performed. Continue until all pixels in the filtered product image matrix to be detected have been detected, and the second filtering process is completed to obtain the processed product image to be detected, forming a set of processed product images to be detected.

[0068] S13. Combining the Canny edge detection algorithm and the multi-directional Sobel operator, a hybrid detection algorithm is obtained. This algorithm is used to extract and segment the target region of the processed set of product images to be detected, generating a processed set of product images to be detected. The specific steps are as follows:

[0069] S131. Perform convolution processing on the processed set of product images to be detected, and then generate a processed product image matrix to be detected. Calculate the gradient magnitude and gradient direction of the pixels in the processed product image matrix to be detected. Set an edge detection neighborhood, and compare the gradient magnitude of the center pixel of the edge detection neighborhood with that of the adjacent pixels along the gradient direction. If the gradient magnitude of the adjacent pixels is greater than the gradient magnitude of the center pixel, the center pixel is not an edge pixel. Otherwise, the center pixel is regarded as an edge pixel. In this way, all edge pixels in the processed product image matrix to be detected are obtained to form the first image edge.

[0070] S132. Select eight directions on the processed product image matrix to be detected. The eight directions include 0 degrees, 22.5 degrees, 45 degrees, 67.5 degrees, 90 degrees, 112.5 degrees, 135 degrees and 157.5 degrees. Set an edge detection window. Calculate the gradient magnitude and gradient direction of the pixels in the edge detection window in the eight directions in turn. Keep the pixels corresponding to the maximum gradient magnitude in the same gradient direction in the edge detection window. Iterate through all pixels in the processed product image matrix to be detected to form the second image edge.

[0071] S133. Overlay the edges of the first image and the second image to generate new image edges. Use morphological closing operation to repair the new image edges to form the final edge region, complete the target region segmentation, extract the target region, and obtain the processed set of product images to be detected.

[0072] S2. Obtain the pixel coordinates in the processed set of product images to be detected, transform the pixel coordinates to the world coordinate system to obtain the spatial coordinates of the product images to be detected, and at the same time determine the spatial coordinates of the robot joints in the world coordinate system to obtain the correlation matrix of the robot links.

[0073] S2 includes the following steps:

[0074] S21. Convert the processed set of product images to be detected into a processed matrix of product images to be detected. Determine a pixel coordinate system on the processed matrix of product images to be detected. Randomly select pixel coordinates (x1, y1) as the coordinates of the pixel to be converted. Set the horizontal pixel spacing and vertical pixel spacing of the camera to be d. x and d y The projection center is (x0, y0); the imaging coordinate system is set, and the coordinates of the pixel to be converted are transformed into the imaging coordinate system to obtain the imaging coordinates (x2, y2). The calculation formula is as follows:

[0075]

[0076] Let the focal length of the camera in the imaging coordinate system be f.x and f y With a normalization coefficient of α, the imaging coordinate system is then transformed into the camera coordinate system to obtain the camera coordinates (x3, y3, z3). The calculation formula is as follows:

[0077]

[0078] Let the camera rotation vector be B and the camera translation vector be C. Perform a rigid body transformation on the camera coordinate system to convert it to the world coordinate system o-xyz, obtaining the world coordinates (x4, y4, z4). The calculation formula is as follows:

[0079]

[0080] The pixels in the processed product image matrix are sequentially transformed to the world coordinate system to obtain the spatial coordinates of the product image.

[0081] S22. Label the robot joints to obtain the robot joint set A1 = {a1, a2, a3, ..., a...} m}, where a m This represents the m-th robot joint. The robot is divided into several links by the set of robot joints, and after labeling, we obtain the robot link set A2 = {a′1, a′2, a3′, ..., a′}. m-1}, where a′ m-1 Represent the (m-1)th robot link, completing the robot modeling process; determine the spatial coordinates of the robot joints in the world coordinate system, calculate the rotation operator on the x-axis and the translation and rotation operators on the z-axis of the nth robot joint, and obtain the rotation angle β of the nth robot joint on the x-axis. n Translation distance d along the z-axis n and the rotation angle θ on the z-axis n The correlation matrix of the robot links at this time is as follows:

[0082]

[0083] Where B1 represents the correlation matrix of the robot links;

[0084] S3. Obtain robot parameter data, determine the robot link end parameter data sequence based on the correlation matrix of the robot link and the spatial coordinates of the product image to be detected, and then establish a parameter adjustment optimization objective function based on the shortest time principle;

[0085] S3 includes the following steps:

[0086] S31. When the robot link moves, robot motion parameters are collected. The robot motion parameters include the rotation angle of the robot link, the speed of the robot link, and the acceleration of the robot link, to obtain robot parameter data. Based on the spatial coordinates of the robot joint in the world coordinate system and combined with the correlation matrix of the robot link, the position of the end of the robot link is obtained. Then, combined with the position of the end of the robot link, the robot link end parameter data sequence A3={x′,y′,z′,δ′,δ″,δ″′} is obtained, where x′,y′,z′ represent the coordinates of the end position of the robot link, and δ′,δ″,δ″′ represent the rotation angle of the end position of the robot link.

[0087] S32. Obtain the motion time and end-effector position motion time of the robot links in the robot link set. Based on the shortest time principle, use the minimum value of the robot link motion time and end-effector position motion time as parameters to adjust and optimize the objective function. Set constraints, including the maximum speed and maximum acceleration of the robot link motion, to ensure that the robot link motion speed is less than the maximum speed and the robot link motion acceleration is equal to the maximum acceleration.

[0088] S4. Establish a fitness function, use the education competition optimization algorithm to solve the parameter adjustment optimization objective function, obtain the global optimal solution, generate the optimized robot parameters based on the global optimal solution, and complete the robot parameter adjustment optimization.

[0089] S4 includes the following steps:

[0090] S41. Using the parameter adjustment optimization objective function as the fitness function, and under constraints, using the education competition optimization algorithm to solve the parameter adjustment optimization objective function to obtain the global optimal solution, the specific steps are as follows:

[0091] S411. In solving the objective function for parameter adjustment optimization, a search space exists, containing a population. School populations and student populations are determined based on the population. The school population has dimension j, and students compete for school admission. Each individual in the school population represents a candidate solution, including the robot link motion speed, robot link motion acceleration, and camera sampling frequency. The school population and student population are initialized using chaotic mapping. In the primary school stage, the current iteration number is set to t, and the maximum iteration number is set to T. The adaptive step size is then... In the t-th iteration, the position of the c-th school is... Distance from school location Let the nearest school location be X′, and the average school location at the t-th iteration be (X′ - X′ - X′). The Levy flight coefficient is Lexy(j), and d1 is a normally distributed random vector; in the school population, the position of the (c+1)th school at the t-th iteration. The student population updates along with the school population, thus obtaining...

[0092] S412. In secondary school, the patience coefficient ε is used to measure the learning patience of the student population, and the learning aptitude coefficient of the student population is calculated based on the patience coefficient. In the school population, the optimal position of the school at the t-th iteration is denoted as . get The student population is updated following the school population. Let d2 represent a random number between [0,1], and let the school location... Update when d2 < 0.5. When d2≥0.5, In each iteration, the student population moves toward the current best fitness function value to obtain the current best solution and determine the position of the school population.

[0093] S413. In high school, let d3 represent a random number between [0,1]. Then, consider the school location... Update and get The student population is updated following the school population. Let d3 represent a random number between [0,1] to update the school location. When d3 < 0.5, When d3 ≥ 0.5, After completing all phase updates, select the top 10% of fitness function values ​​to form a school population, and the remaining 90% to form a student population. Form a new school population and a new student population, and enter the next round of iteration. Stop iterating when the current iteration count reaches the maximum iteration count, and obtain the final school population. Record the school position corresponding to the best fitness function value in the final school population as the global optimal solution.

[0094] S42. The global optimal solution includes the optimized robot link motion speed, the optimized robot link motion acceleration, and the optimized camera sampling frequency, which together form the optimized robot parameters. When the robot performs appearance inspection on the product to be inspected, the optimized robot parameters are used to adjust and optimize the robot, thus completing the robot parameter adjustment and optimization.

[0095] Example 2

[0096] This embodiment also discloses a system for adjusting and optimizing robot parameters applied to appearance inspection, specifically including: a target region segmentation and extraction module, a robot link association module, an objective function establishment module, and a parameter adjustment and optimization module;

[0097] The target region segmentation and extraction module is used to segment and extract the target region from the initial set of product images to be detected using filtering algorithms and hybrid detection algorithms.

[0098] The robot link association module is used to determine the spatial coordinates of the robot joints and generate the association matrix of the robot links;

[0099] The objective function establishment module is used to establish a parameter adjustment and optimization objective function based on the shortest time principle;

[0100] The parameter adjustment and optimization module is used to solve the parameter adjustment and optimization objective function using the educational competition optimization algorithm to obtain the optimized robot parameters.

[0101] In the description of this specification, references to terms such as "an embodiment," "example," "specific example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0102] The preferred embodiments of the 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 the specific implementations described. 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.

Claims

1. A method for adjusting and optimizing robot parameters for appearance inspection, characterized in that, Includes the following steps: S1. Obtain the product images to be detected, form an initial set of product images to be detected, and use an improved weighted median filtering algorithm and a hybrid detection algorithm to segment and extract the target region of the initial set of product images to be detected, thereby generating a processed set of product images to be detected. S2. Obtain the pixel coordinates in the processed set of product images to be detected, transform the pixel coordinates to the world coordinate system to obtain the spatial coordinates of the product images to be detected, and at the same time determine the spatial coordinates of the robot joints in the world coordinate system to obtain the correlation matrix of the robot links. S2 includes the following steps: S21. Convert the processed set of product images to be detected into a processed product image matrix, determine the pixel coordinate system on the processed product image matrix, and then convert the pixels to the imaging coordinate system, camera coordinate system and world coordinate system in sequence to obtain the spatial coordinates of the product image to be detected. S22. Label the robot joints to obtain the robot joint set and the robot link set. Determine the spatial coordinates of the robot joints in the world coordinate system. Calculate the translation and rotation operators of the robot joints to obtain the rotation angle and translation distance of the robot joints. Generate the correlation matrix of the robot links. S3. Obtain robot parameter data, determine the robot link end parameter data sequence based on the correlation matrix of the robot link and the spatial coordinates of the product image to be detected, and then establish a parameter adjustment optimization objective function based on the shortest time principle; S3 includes the following steps: S31. When the robot link moves, the robot motion parameters are collected to obtain robot parameter data; based on the spatial coordinates of the robot joints in the world coordinate system and the correlation matrix of the robot link, the robot link end position and robot link end parameter data sequence are obtained. S32. Obtain the motion time of the robot link and the motion time of the robot link end position in the robot link set. Based on the shortest time principle, use the minimum value of the robot link motion time and the robot link end position motion time as parameters to adjust and optimize the objective function, and set constraints. S4. Establish a fitness function, solve the objective function for parameter adjustment and optimization, obtain the global optimal solution, and generate optimized robot parameters based on the global optimal solution to complete the robot parameter adjustment and optimization. S4 includes the following steps: S41. The parameter adjustment optimization objective function is used as the fitness function, and under the constraints, the educational competition optimization algorithm is used to solve the parameter adjustment optimization objective function to obtain the global optimal solution; S42. The global optimal solution includes the optimized robot link motion speed, the optimized robot link motion acceleration, and the optimized camera sampling frequency, which together form the optimized robot parameters. When the robot performs appearance inspection on the product to be inspected, the optimized robot parameters are used to adjust and optimize the robot, thus completing the robot parameter adjustment and optimization.

2. The method for adjusting and optimizing robot parameters for appearance inspection according to claim 1, characterized in that, S1 includes the following steps: S11. When the robot performs appearance inspection, it uses a camera to acquire images of the product to be inspected, obtains an initial set of images of the product to be inspected, and generates an initial image matrix of the product to be inspected. S12. Based on the initial product image matrix to be detected, the initial product image set to be detected is subjected to secondary filtering processing using an improved weighted median filtering algorithm, and outliers are detected and deleted to obtain the processed product image set to be detected. S13. Combining the Canny edge detection algorithm and the multi-directional Sobel operator, a hybrid detection algorithm is obtained. The target region is extracted and segmented on the processed set of product images to be detected, and a processed set of product images to be detected is generated.

3. The method for adjusting and optimizing robot parameters for appearance inspection according to claim 2, characterized in that, S12 includes the following steps: S121. Set the filtering window and perform median filtering on the initial product image matrix to be detected to obtain the filtered product image matrix to be detected. S122. Set a gradient window. In the filtered product image matrix, calculate the pixel gradient and pixel gray value similarity in the filter window, assign pixel gray value similarity and pixel gradient weights, calculate the gradient window weights, find the median of pixel gray values ​​in the gradient window, and record it as the weighted median. S123. Set a grayscale threshold, calculate the difference between the grayscale value of a pixel and the grayscale value of its eight neighboring pixels in the filtered product image matrix, compare it with the grayscale threshold, detect and delete outliers, and generate a processed set of product images to be detected.

4. The method for adjusting and optimizing robot parameters for appearance inspection according to claim 3, characterized in that, S13 includes the following steps: S131. After performing convolution processing on the processed set of product images to be detected, the gradient magnitude and gradient direction of the pixels are calculated. The gradient magnitude of the center pixel of the edge detection neighborhood along the gradient direction and the gradient magnitude of the adjacent pixels are compared to identify the edge pixels and form the first image edge. S132. Select eight directions on the processed product image matrix to be detected, set an edge detection window, calculate the gradient magnitude and gradient direction of the pixels in the edge detection window in the eight directions, and retain the pixels corresponding to the maximum gradient magnitude in the same gradient direction in the edge detection window to form the second image edge. S133. Overlay the edges of the first image and the second image to generate new image edges. Use morphological closing operation to repair the new image edges to form the final edge region. Complete the target region segmentation and extract the target region to obtain the processed set of product images to be detected.

5. The method for adjusting and optimizing robot parameters for appearance inspection according to claim 4, characterized in that, S41 includes the following steps: S411. In solving the objective function for parameter adjustment optimization, a search space exists, containing a population. School populations and student populations are determined based on the population. The school population has dimension j, and students compete for school admission. Each individual in the school population represents a candidate solution, including the robot link motion speed, robot link motion acceleration, and camera sampling frequency. The school population and student population are initialized using chaotic mapping. In the primary school stage, the current iteration number is set to t, and the maximum iteration number is set to T. The adaptive step size is then... The location of the c-th school in the t-th iteration is Distance from school location The nearest school location is recorded as The average location of the school at the t-th iteration is Levi's flight coefficient is , Let the random vectors follow a normal distribution; in the school population, the position of the (c+1)th school at the t-th iteration. The student population updates along with the school population, thus obtaining... ; S412. In secondary school, use the patience coefficient. To measure the learning patience of a student population, a learning aptitude coefficient is calculated based on the patience coefficient. ; In the school population, the optimal position of the school at the t-th iteration is denoted as . ,get The student population updates along with the school population, setting... Indicates that it is within the interval Random numbers for school location Update when hour, ,when hour, ; In each iteration, the student population moves toward the current best fitness function value to obtain the current best solution and determine the position of the school population. S413. In high school, set Indicates that it is within the interval Random numbers, again for the school location Update and get The student population updates along with the school population, setting... Indicates that it is within the interval Use random numbers to update school locations ,when hour, ,when hour, After completing all phase updates, select the top 10% of fitness function values ​​to form a school population, and the remaining 90% to form a student population. Form a new school population and a new student population, and enter the next iteration. Stop iterating when the current iteration count reaches the maximum iteration count, and obtain the final school population. Record the school position corresponding to the best fitness function value in the final school population as the global optimal solution.

6. A system for implementing the robot parameter adjustment and optimization method for appearance inspection as described in any one of claims 1-5, characterized in that, Specifically, it includes: The module includes a target region segmentation and extraction module, a robot link association module, an objective function establishment module, and a parameter adjustment and optimization module. The target region segmentation and extraction module is used to segment and extract the target region from the initial set of product images to be detected using filtering algorithms and hybrid detection algorithms. The robot link association module is used to determine the spatial coordinates of the robot joints and generate the association matrix of the robot links; The objective function establishment module is used to establish a parameter adjustment and optimization objective function based on the shortest time principle; The parameter adjustment and optimization module is used to solve the parameter adjustment and optimization objective function using the educational competition optimization algorithm to obtain the optimized robot parameters.