Robot parameter adjusting and optimizing system and method applied to appearance detection

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

CN120704242AActive Publication Date: 2025-09-26JINPIN ELECTRICAL CO LTD ZHUHAI S E Z
View PDF 12 Cites 0 Cited by

Patent Information

Application Number
CN202510798198.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-16
Publication Date
2025-09-26
Estimated Expiration
2045-06-16

AI Technical Summary

Technical Problem

The existing technology in robot parameter adjustment and optimization has the problems of long debugging cycle, difficulty in adapting to the production needs of multiple varieties, slow parameter adjustment and optimization speed in dynamic detection scenarios, resulting in missed detection or false detection, and lack of artificial intelligence application, which cannot meet product production needs.

Method used

An improved weighted median filtering algorithm and hybrid detection algorithm are used to segment and extract the target area. The educational competitive optimization algorithm is combined to solve the parameter adjustment optimization objective function, and the robot parameters are optimized according to the shortest time principle.

Benefits of technology

It improves the defect recognition rate, reduces missed detection or false detection, and realizes rapid optimization of robot parameters. It is applicable to a variety of optimization problems and has good convergence speed and the ability to escape local optimality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120704242A_ABST
    Figure CN120704242A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of parameter adjustment, and discloses a robot parameter adjustment optimization system and method applied to appearance detection. The method comprises the following steps: firstly, acquiring an initial to-be-detected product image set, and performing target region segmentation and extraction by using an improved weighted median filtering algorithm and a hybrid detection algorithm to obtain a processed to-be-detected product image set; secondly, pixel point coordinates in the processed to-be-detected product image set are converted into a world coordinate system, space coordinates of robot joints in the world coordinate system are determined, and an incidence matrix of robot connecting rods is generated; determining a robot connecting rod tail end parameter data sequence, and establishing a target function based on a shortest time principle; and finally, solving the objective function by using an educational competition optimization algorithm, generating optimized robot parameters, and completing adjustment and optimization of the robot parameters. According to the method, the robot parameters are processed and analyzed, the purpose of adjusting and optimizing the robot parameters is achieved, and the method is objective and accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of parameter adjustment, and in particular to a robot parameter adjustment optimization system and method applied to appearance inspection. Background Art

[0002] Chinese patent CN110501903B discloses a method for self-adjusting and optimizing the parameters of a robot's control system without inverse solution. The method specifically includes constructing a BP neural network and a PID control system, inputting the robot's motion error and the differential function of the error into the BP neural network, and using a genetic algorithm to optimize the weights and thresholds of the neural network, outputting the optimized control system parameters; the robot performs motion, and the joints are controlled by the optimized control system parameters, and the time it takes for the robot to move to the target point is calculated; then, based on the robot's motion error, the optimized control system parameters are subjected to regression analysis, fitted into an nth-order function, and the optimized control system is obtained, completing self-adjustment and optimization. However, this invention does not provide different adjustment methods for different inputs, and its applicability is not strong.

[0003] Traditional parameter adjustment and optimization methods usually rely on manual experience to adjust parameters, which have problems such as long debugging cycles and difficulty in adapting to the production needs of multiple varieties. At the same time, in dynamic detection scenarios, the robot parameter adjustment and optimization speed is slow, which may lead to missed detections or false detections, and reduce the recognition rate of complex defects. It also does not use technologies such as artificial intelligence. Parameter adjustment and optimization methods are mostly single-objective optimization and cannot meet product production needs. Summary of the Invention

[0004] In response to the problems in the related art, the present invention provides a robot parameter adjustment and optimization system and method applied to appearance inspection to overcome the above-mentioned technical problems existing in the existing related art.

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

[0006] The present invention is a robot parameter adjustment and optimization method applied to appearance inspection, comprising the following steps:

[0007] S1. Acquire images of products to be inspected to form an initial set of product images to be inspected. Use an improved weighted median filter algorithm and a hybrid detection algorithm to segment and extract target regions from the initial set of product images to generate a processed set of product images to be inspected.

[0008] S2. Obtain pixel coordinates in the processed set of images of the product to be inspected, convert the pixel coordinates into a world coordinate system to obtain spatial coordinates of the image of the product to be inspected, and simultaneously determine the spatial coordinates of the robot joints in the world coordinate system to obtain an association matrix of the robot links;

[0009] S3. Obtain robot parameter data, determine the robot link end parameter data sequence based on the robot link association matrix and the spatial coordinates of the product image to be inspected, 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 parameter adjustment optimization objective function, obtain a global optimal solution, generate optimized robot parameters according to the global optimal solution, and complete the robot parameter adjustment optimization.

[0011] This invention obtains an initial set of product images to be inspected, uses an improved weighted median filtering algorithm and a hybrid detection algorithm to segment and extract the target area, and generates a processed set of product images to be inspected; compared with the traditional filtering algorithm, the improved weighted median filtering algorithm can quickly remove outliers while ensuring processing speed, reducing the amount of real-time calculations; the hybrid detection algorithm integrates two edge detection algorithms to achieve high-precision segmentation of the target area, while taking into account accuracy and time consumption, greatly reducing missed detection or false detection, and improving the defect recognition rate; secondly, the pixel point coordinates in the processed set of product images to be inspected are converted to the world coordinate system, the spatial coordinates are determined, and the association matrix of the robot link is established; this method is implemented by sitting The spatial coordinates are obtained by standard transformation, which is convenient for determining the robot motion parameters, and the robot motion parameters are controlled by finding the robot link association, so as to realize the subsequent coordinated motion of the robot; then the parameter data sequence of the robot link end is determined, and the parameter adjustment optimization objective function is established based on the shortest time principle, and the educational competition optimization algorithm is used to solve the parameter adjustment optimization objective function to obtain the optimized robot parameters; this method digitizes the abstract problem through modeling, and the educational competition optimization algorithm imitates the competition for educational resources in the real world, and obtains the optimal solution through the competition mechanism search and optimization problem, which has good convergence speed and the ability to jump out of local optimality, effectively reduces the detection time, and is applicable to a variety of optimization problems.

[0012] Preferably, the S1 comprises the following steps:

[0013] S11. When performing appearance inspection, the robot uses a camera to capture 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 (i.e., pixels) in the images of the product to be inspected, and quantizes the sample points to generate an initial image matrix of the product to be inspected.

[0014] S12. Based on the initial product image matrix to be inspected, use an improved weighted median filter algorithm to perform secondary filtering on the initial product image set to be inspected, then detect and delete outliers to obtain a processed product image set to be inspected. The specific steps are as follows:

[0015] S121. Set a filter window of size 3×3, place the filter window in the initial matrix of the product image to be inspected, traverse the pixels in the filter window, and arrange them according to their grayscale values ​​to obtain the grayscale values ​​of the arranged pixels. Select the median of the grayscale values ​​of the arranged pixels and record it as the median in the filter window. Use the median in the filter window to replace the grayscale values ​​of all pixels in the filter window. Move the filter window sequentially until all pixels in the initial matrix of the product image to be inspected are filtered, completing the first filtering process and obtaining a filtered product image to be inspected and a filtered product image matrix to be inspected.

[0016] S122. Set a gradient window of size 5×5, place the gradient window in the filtered product image matrix to be inspected, calculate the gradient of the pixels in the filter window, and the pixel gradient includes the horizontal gradient and the vertical gradient of the pixel. Then, calculate the similarity of the grayscale values ​​of the pixels in the filter window, assign the pixel grayscale value similarity and the pixel gradient weight, and calculate the gradient window weight. Move the gradient window sequentially until the filtered product image matrix to be inspected is traversed, obtain a number of 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 grayscale values ​​of the pixels in the gradient window, which is recorded as the weighted median.

[0017] S123, traversing the filtered product image matrix to be inspected, selecting any pixel point, recording it as a detection pixel point, setting a grayscale threshold, and when the difference between the grayscale value of the detection pixel point and the grayscale values ​​of the eight neighboring pixels is greater than the grayscale threshold, the detection pixel point is considered an outlier, and the grayscale value of the detection pixel point is replaced by the weighted median; otherwise, no replacement is performed; until all pixels in the filtered product image matrix to be inspected are detected, completing the second filtering process, and obtaining a processed product image to be inspected, which constitutes a processed product image set to be inspected;

[0018] S13. Combining the Canny edge detection algorithm and the multi-directional Sobel operator to obtain a hybrid detection algorithm, extracting and segmenting the target area of ​​the processed product image set to be detected, and generating a processed product image set to be detected. The specific steps are as follows:

[0019] S131. Perform convolution processing on the processed product image set to generate a processed product image matrix, calculate the gradient amplitude and gradient direction of the pixels in the processed product image matrix; set an edge detection neighborhood, compare the gradient amplitude of the central pixel of the edge detection neighborhood along the gradient direction with the gradient amplitude of the adjacent pixels, and when the gradient amplitude of the adjacent pixels is greater than the gradient amplitude of the central pixel, the central pixel is not an edge pixel; otherwise, the central pixel is considered an edge pixel. All edge pixels in the processed product image matrix are obtained in sequence to form a first image edge.

[0020] S132. Select eight directions on the processed product image matrix to be inspected, where 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, sequentially calculate the gradient magnitudes and gradient directions of pixels in the edge detection window in the eight directions, retain the pixels corresponding to the maximum gradient magnitude in the same gradient direction in the edge detection window, and sequentially traverse all pixels in the processed product image matrix to form a second image edge.

[0021] S133. Superimpose the first image edge and the second image edge to generate a new image edge, use morphological closing operation to patch the new image edge to form a final edge area, complete the target area segmentation, and extract the target area to obtain a processed set of product images to be inspected.

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

[0023] Preferably, said S2 comprises the following steps:

[0024] S21, converting the processed product image set to be inspected into a processed product image matrix to be inspected, determining a pixel coordinate system on the processed product image matrix to be inspected, randomly selecting pixel coordinates as the pixel coordinates to be converted (x1, y1), setting the horizontal pixel spacing and vertical pixel spacing of the camera to be d respectively. x and d y , the projection center is (x0, y0); set the imaging coordinate system, transform the coordinates of the pixel to be converted into the imaging coordinate system, and obtain the imaging coordinates (x2, y2). The calculation formula is as follows:

[0025]

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

[0027]

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

[0029]

[0030] Convert all pixels in the processed image matrix of the product to be inspected into the world coordinate system in sequence to obtain the spatial coordinates of the product image to be inspected;

[0031] S22. Label the robot joints to obtain the robot joint set A1 = {a1, a2, a3, ..., a m}, where a m Denotes the mth robot joint. The robot is divided into several links through the robot joint set. After labeling, the robot link set A2 = {a′1, a′2, a3′, ..., a′ m-1}, where a′ m-1 Represent the m-1th robot link and complete the robot modeling process; determine the spatial coordinates of the robot joint in the world coordinate system, calculate the rotation operator of the nth robot joint on the x-axis and the translation operator and rotation operator on the z-axis, and obtain the rotation angle β of the nth robot joint on the x-axis n , translation distance d on the z axis n and the rotation angle θ on the z-axis n , the association matrix of the robot link is as follows:

[0032]

[0033] Where B1 represents the association matrix of the robot link.

[0034] This invention converts the pixel coordinates in the processed image set of the product to be inspected into the world coordinate system, determines the spatial coordinates, and establishes the association matrix of the robot links to facilitate the determination of the robot motion parameters. The robot motion parameters are controlled by finding the association of the robot links, which facilitates the subsequent coordinated movement of the robots.

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

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

[0037] S32. Obtain the robot link movement time and the robot link end position movement time in the robot link set. Based on the shortest time principle, use the minimum value of the robot link movement time and the robot link end position movement time as parameters to adjust the optimization objective function; and set constraint conditions, set the maximum speed of the robot link movement and the maximum acceleration of the robot link movement, to ensure that the robot link movement speed is less than the maximum speed of the robot link movement and the robot link movement acceleration is equal to the maximum acceleration of the robot link movement.

[0038] Preferably, said S4 comprises the following steps:

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

[0040] S411. It is assumed that in the process of solving the parameter adjustment optimization objective function, there is a search space, there is a population in the search space, the school population and the student population are determined according to the population, the school population dimension is j, and the students compete to obtain school admission. Each individual in the school population represents a candidate solution, and the candidate solution includes the robot link motion speed, the robot link motion acceleration and the camera sampling frequency; the school population and the student population are initialized using a chaotic map. In the primary school stage, the current number of iterations is set to t, the maximum number of iterations is set to T, and the adaptive step size is At the tth iteration, the location of the cth school is Distance from school The nearest school location is recorded as X′, and the average location of the schools at the tth iteration is The Levy flight coefficient is Lexy(j), d1 is a random vector that follows a normal distribution; in the school population, the position of the c+1th school at the tth iteration is The student population is updated following the school population, and we get

[0041] S412. In middle school, the patience coefficient ε is used to measure the learning patience of the student population, and the learning talent coefficient of the student population is calculated based on the patience coefficient In the school population, the best position of the school at the tth iteration is recorded as get The student population is updated following the school population. Set d2 to represent a random number between the interval [0,1], and update the school location. Update, when d2<0.5, When d2≥0.5, In each iteration, the student population moves toward the current optimal fitness function value, obtains the current optimal solution, and determines the position of the school population;

[0042] S413. In the high school stage, set d3 to represent a random number between the interval [0,1], and again calculate the school location. Update and get The student population is updated following the school population. Set d3 to represent a random number between the interval [0,1] and update the school position. When d3<0.5, When d3≥0.5, After all phase updates are completed, the top 10% of fitness function values ​​are selected to form the school population, and the remaining 90% are selected to form the student population. A new school population and a new student population are formed, and the next round of iteration is started. When the current number of iterations reaches the maximum number of iterations, the iteration is stopped and the final school population is obtained. The school position corresponding to the best fitness function value in the final school population is recorded 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 constitute 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 to complete the robot parameter adjustment optimization.

[0044] This invention establishes a parameter adjustment optimization objective function based on the shortest time principle, uses an educational competition optimization algorithm to solve the parameter adjustment optimization objective function, imitates the competition for educational resources in the real world, uses a competition mechanism to search and optimize problems to obtain the optimal solution, has good convergence speed and the ability to jump out of local optimality, effectively reduces detection time, and is applicable to a variety of optimization problems.

[0045] This embodiment also discloses a system for a robot parameter adjustment and optimization method applied to appearance inspection, specifically comprising: a target area 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 of the initial set of product images to be detected using a filtering algorithm and a hybrid detection algorithm;

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

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

[0049] The parameter adjustment optimization module is used to solve the parameter adjustment 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 the target area, generating a processed set of product images to be inspected. Compared with the traditional filtering algorithm, it can quickly remove outliers while ensuring processing speed, reducing the amount of real-time calculation. The hybrid detection algorithm integrates two edge detection algorithms to achieve high-precision segmentation of the target area, while taking into account accuracy and time consumption, greatly reducing missed detections or false detections, and improving the defect recognition rate.

[0052] 2. The invention converts the pixel coordinates in the processed image set of the product to be inspected into the world coordinate system, determines the spatial coordinates, and establishes the association matrix of the robot links to facilitate the determination of the robot motion parameters. The robot motion parameters are controlled by finding the association of the robot links, which facilitates the subsequent coordinated movement of the robots.

[0053] 3. This invention establishes a parameter adjustment optimization objective function based on the shortest time principle, uses an educational competition optimization algorithm to solve the parameter adjustment optimization objective function, imitates the competition for educational resources in the real world, uses a competition mechanism to search and optimize problems to obtain the optimal solution, has good convergence speed and the ability to jump out of local optimality, effectively reduces detection time, and is applicable to a variety of optimization problems.

[0054] Of course, any product implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the technical solutions of the embodiments of the invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the invention. For ordinary technicians in this field, they can also obtain drawings based on these drawings without paying any creative work.

[0056] Figure 1 The present invention provides a flow chart of robot parameter adjustment and optimization in a robot parameter adjustment and optimization system applied to appearance inspection. DETAILED DESCRIPTION

[0057] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.

[0058] In the description of the present invention, it should be understood that the terms "opening", "upper", "lower", "top", "middle", "inside" and the like indicating 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, be constructed and operate in a specific orientation, and therefore cannot be understood as limiting the invention.

[0059] Example 1

[0060] See also Figure 1 This embodiment discloses a robot parameter adjustment and optimization method for appearance inspection, which specifically includes the following contents:

[0061] S1. Acquire images of products to be inspected to form an initial set of product images to be inspected. Use an improved weighted median filter algorithm and a hybrid detection algorithm to segment and extract target regions from the initial set of product images to generate a processed set of product images to be inspected.

[0062] Said S1 comprises the following steps:

[0063] S11. When performing appearance inspection, the robot uses a camera to capture 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 (i.e., pixels) in the images of the product to be inspected, and quantizes the sample points to generate an initial image matrix of the product to be inspected.

[0064] S12. Based on the initial product image matrix to be inspected, use an improved weighted median filter algorithm to perform secondary filtering on the initial product image set to be inspected, then detect and delete outliers to obtain a processed product image set to be inspected. The specific steps are as follows:

[0065] S121. Set a filter window of size 3×3, place the filter window in the initial matrix of the product image to be inspected, traverse the pixels in the filter window, and arrange them according to their grayscale values ​​to obtain the grayscale values ​​of the arranged pixels. Select the median of the grayscale values ​​of the arranged pixels and record it as the median in the filter window. Use the median in the filter window to replace the grayscale values ​​of all pixels in the filter window. Move the filter window sequentially until all pixels in the initial matrix of the product image to be inspected are filtered, completing the first filtering process and obtaining a filtered product image to be inspected and a filtered product image matrix to be inspected.

[0066] S122. Set a gradient window of size 5×5, place the gradient window in the filtered product image matrix to be inspected, calculate the gradient of the pixels in the filter window, and the pixel gradient includes the horizontal gradient and the vertical gradient of the pixel. Then, calculate the similarity of the grayscale values ​​of the pixels in the filter window, assign the pixel grayscale value similarity and the pixel gradient weight, and calculate the gradient window weight. Move the gradient window sequentially until the filtered product image matrix to be inspected is traversed, obtain a number of 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 grayscale values ​​of the pixels in the gradient window, which is recorded as the weighted median.

[0067] S123, traversing the filtered product image matrix to be inspected, selecting any pixel point, recording it as a detection pixel point, setting a grayscale threshold, and when the difference between the grayscale value of the detection pixel point and the grayscale values ​​of the eight neighboring pixels is greater than the grayscale threshold, the detection pixel point is considered an outlier, and the grayscale value of the detection pixel point is replaced by the weighted median; otherwise, no replacement is performed; until all pixels in the filtered product image matrix to be inspected are detected, completing the second filtering process, and obtaining a processed product image to be inspected, which constitutes a processed product image set to be inspected;

[0068] S13. Combining the Canny edge detection algorithm and the multi-directional Sobel operator to obtain a hybrid detection algorithm, extracting and segmenting the target area of ​​the processed product image set to be detected, and generating a processed product image set to be detected. The specific steps are as follows:

[0069] S131. Perform convolution processing on the processed product image set to generate a processed product image matrix, calculate the gradient amplitude and gradient direction of the pixels in the processed product image matrix; set an edge detection neighborhood, compare the gradient amplitude of the central pixel of the edge detection neighborhood along the gradient direction with the gradient amplitude of the adjacent pixels, and when the gradient amplitude of the adjacent pixels is greater than the gradient amplitude of the central pixel, the central pixel is not an edge pixel; otherwise, the central pixel is considered an edge pixel. All edge pixels in the processed product image matrix are obtained in sequence to form a first image edge.

[0070] S132. Select eight directions on the processed product image matrix to be inspected, where 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, sequentially calculate the gradient magnitudes and gradient directions of pixels in the edge detection window in the eight directions, retain the pixels corresponding to the maximum gradient magnitude in the same gradient direction in the edge detection window, and sequentially traverse all pixels in the processed product image matrix to form a second image edge.

[0071] S133: Superimpose the first image edge and the second image edge to generate a new image edge, use a morphological closing operation to patch the new image edge to form a final edge region, complete the target region segmentation, and extract the target region to obtain a processed set of product images to be inspected;

[0072] S2. Obtain pixel coordinates in the processed set of images of the product to be inspected, convert the pixel coordinates into a world coordinate system to obtain spatial coordinates of the image of the product to be inspected, and simultaneously determine the spatial coordinates of the robot joints in the world coordinate system to obtain an association matrix of the robot links;

[0073] The S2 comprises the following steps:

[0074] S21, converting the processed product image set to be inspected into a processed product image matrix to be inspected, determining a pixel coordinate system on the processed product image matrix to be inspected, randomly selecting pixel coordinates as the pixel coordinates to be converted (x1, y1), setting the horizontal pixel spacing and vertical pixel spacing of the camera to be d respectively. x and d y , the projection center is (x0, y0); set the imaging coordinate system, transform the coordinates of the pixel to be converted into the imaging coordinate system, and obtain the imaging coordinates (x2, y2). The calculation formula is as follows:

[0075]

[0076] Set the focal length of the camera in the imaging coordinate system to be fx and f y , the normalization coefficient is α. At this time, the imaging coordinate system is projected and transformed into the camera coordinate system to obtain the camera coordinates (x3, y3, z3). The calculation formula is as follows:

[0077]

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

[0079]

[0080] Convert all pixels in the processed image matrix of the product to be inspected into the world coordinate system in sequence to obtain the spatial coordinates of the product image to be inspected;

[0081] S22. Label the robot joints to obtain the robot joint set A1 = {a1, a2, a3, ..., a m}, where a m Denotes the mth robot joint. The robot is divided into several links through the robot joint set. After labeling, the robot link set A2 = {a′1, a′2, a3′, ..., a′ m-1}, where a′ m-1 Represent the m-1th robot link and complete the robot modeling process; determine the spatial coordinates of the robot joint in the world coordinate system, calculate the rotation operator of the nth robot joint on the x-axis and the translation operator and rotation operator on the z-axis, and obtain the rotation angle β of the nth robot joint on the x-axis n , translation distance d on the z axis n and the rotation angle θ on the z-axis n , the association matrix of the robot link is as follows:

[0082]

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

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

[0085] The S3 includes the following steps:

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

[0087] S32. Obtain the robot link motion time and the robot link end position motion time in the robot link set, and 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 a parameter to adjust the optimization objective function; and set constraint conditions, set the maximum speed of the robot link motion and the maximum acceleration of the robot link motion, to ensure that the robot link motion speed is less than the maximum speed of the robot link motion and the robot link motion acceleration is equal to the maximum acceleration of the robot link motion;

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

[0089] The S4 comprises the following steps:

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

[0091] S411. It is assumed that in the process of solving the parameter adjustment optimization objective function, there is a search space, there is a population in the search space, the school population and the student population are determined according to the population, the school population dimension is j, and the students compete to obtain school admission. Each individual in the school population represents a candidate solution, and the candidate solution includes the robot link motion speed, the robot link motion acceleration and the camera sampling frequency; the school population and the student population are initialized using a chaotic map. In the primary school stage, the current number of iterations is set to t, the maximum number of iterations is set to T, and the adaptive step size is At the tth iteration, the location of the cth school is Distance from school The nearest school location is recorded as X′, and the average location of the schools at the tth iteration is The Levy flight coefficient is Lexy(j), d1 is a random vector that follows a normal distribution; in the school population, the position of the c+1th school at the tth iteration is The student population is updated following the school population, and we get

[0092] S412. In middle school, the patience coefficient ε is used to measure the learning patience of the student population, and the learning talent coefficient of the student population is calculated based on the patience coefficient In the school population, the best position of the school at the tth iteration is recorded as get The student population is updated following the school population. Set d2 to represent a random number between the interval [0,1], and update the school location. Update, when d2<0.5, When d2≥0.5, In each iteration, the student population moves toward the current optimal fitness function value, obtains the current optimal solution, and determines the position of the school population;

[0093] S413. In the high school stage, set d3 to represent a random number between the interval [0,1], and again calculate the school location. Update and get The student population is updated following the school population. Set d3 to represent a random number between the interval [0,1] and update the school position. When d3<0.5, When d3≥0.5, After all phase updates are completed, the top 10% of fitness function values ​​are selected to form the school population, and the remaining 90% are selected to form the student population. A new school population and a new student population are formed, and the next round of iteration is started. When the current number of iterations reaches the maximum number of iterations, the iteration is stopped and the final school population is obtained. The school position corresponding to the best fitness function value in the final school population is recorded 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 constitute 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 to complete the robot parameter adjustment optimization.

[0095] Example 2

[0096] This embodiment also discloses a system for a robot parameter adjustment and optimization method applied to appearance inspection, specifically comprising: a target area 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 of the initial set of product images to be detected using a filtering algorithm and a hybrid detection algorithm;

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

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

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

[0101] Throughout this specification, references to terms such as "one embodiment," "example," or "specific example" indicate that the specific features, structures, materials, or characteristics described in conjunction with that embodiment or example are included in at least one embodiment or example of the invention. In this specification, schematic representations of these 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 any one or more embodiments or examples.

[0102] The preferred embodiments of the invention disclosed above are intended only to help illustrate the invention. These preferred embodiments do not exhaust all details, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and variations are possible based on the content of this specification. These embodiments are selected and described in detail in this specification 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 robot parameter adjustment and optimization method for appearance inspection, characterized in that: The steps include: S1. Acquire images of products to be inspected to form an initial set of product images to be inspected. Use an improved weighted median filter algorithm and a hybrid detection algorithm to segment and extract target regions from the initial set of product images to generate a processed set of product images to be inspected. S2. Obtain pixel coordinates in the processed set of images of the product to be inspected, convert the pixel coordinates into a world coordinate system to obtain spatial coordinates of the image of the product to be inspected, and simultaneously determine the spatial coordinates of the robot joints in the world coordinate system to obtain an association matrix of the robot links; S3. Obtain robot parameter data, determine the robot link end parameter data sequence based on the robot link association matrix and the spatial coordinates of the product image to be inspected, and then establish a parameter adjustment optimization objective function based on the shortest time principle; S4. Establish a fitness function, solve the parameter adjustment optimization objective function, obtain a global optimal solution, generate optimized robot parameters according to the global optimal solution, and complete the robot parameter adjustment optimization.

2. A robot parameter adjustment and optimization method for appearance inspection according to claim 1, characterized in that: The S1 comprises the following steps: S11. When performing appearance inspection, the robot uses a camera to capture images of the product to be inspected, obtains an initial image set of the product to be inspected, and generates an initial image matrix of the product to be inspected; S12. Performing secondary filtering on the initial set of product images to be inspected using an improved weighted median filtering algorithm based on the initial product image matrix to be inspected, and then detecting and deleting outliers to obtain a processed set of product images to be inspected; S13. Combining the Canny edge detection algorithm and the multi-directional Sobel operator to obtain a hybrid detection algorithm, extracting and segmenting the target area of ​​the processed product image set to be detected, and generating a processed product image set to be detected.

3. The robot parameter adjustment and optimization method for appearance inspection according to claim 2, characterized in that: The S12 includes the following steps: S121, setting a filtering window, performing median filtering on the initial image matrix of the product to be inspected, and obtaining a filtered image matrix of the product to be inspected; S122. Set a gradient window, calculate the pixel gradients and grayscale value similarities of the pixels in the filtered image matrix, assign grayscale value similarities and pixel gradient weights to the pixels, calculate the gradient window weight, and find the median of the grayscale values ​​of the pixels in the gradient window, which is recorded as the weighted median. S123. Set a grayscale threshold, calculate the difference between the grayscale value of the pixel in the filtered image matrix of the product to be detected and the grayscale value of the pixel in the eight neighborhoods, compare it with the grayscale threshold, detect and delete outliers, and generate a processed set of product images to be detected.

4. A robot parameter adjustment and optimization method for appearance inspection according to claim 3, characterized in that: The S13 comprises the following steps: S131. After performing convolution processing on the processed product image set to be detected, the gradient magnitude and gradient direction of the pixel points are calculated, and the gradient magnitudes of the central pixel point and the adjacent pixel points along the gradient direction of the edge detection neighborhood are compared to identify the edge pixel points and form a first image edge. S132: Select eight directions on the processed product image matrix to be inspected, set an edge detection window, calculate the gradient magnitudes and gradient directions of pixels in the edge detection window in the eight directions, retain the pixels corresponding to the maximum gradient magnitude in the same gradient direction in the edge detection window, and form a second image edge; S133. Superimpose the first image edge and the second image edge to generate a new image edge, use morphological closing operation to patch the new image edge to form a final edge area, complete the target area segmentation, and extract the target area to obtain a processed set of product images to be inspected.

5. The robot parameter adjustment and optimization method for appearance inspection according to claim 4, characterized in that: The S2 comprises the following steps: S21. Converting the processed product image set to a processed product image matrix, determining a pixel coordinate system on the processed product image matrix, and sequentially converting the pixel points to an imaging coordinate system, a camera coordinate system, and a world coordinate system to obtain spatial coordinates of the product image; S22. Label the robot joints to obtain a robot joint set and a robot link set, determine the spatial coordinates of the robot joints in the world coordinate system, calculate the translation operator and rotation operator of the robot joints, obtain the rotation angle and translation distance of the robot joints, and generate the association matrix of the robot links.

6. The robot parameter adjustment and optimization method for appearance inspection according to claim 5, characterized in that: The S3 comprises the following steps: S31, collecting robot motion parameters when the robot link moves to obtain robot parameter data; obtaining the robot link end position and the robot link end parameter data sequence according to the spatial coordinates of the robot joint in the world coordinate system and the association matrix of the robot link; S32. Obtain the robot link motion time and the robot link end position motion time 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 the optimization objective function, and set constraint conditions.

7. The robot parameter adjustment and optimization method for appearance inspection according to claim 6, characterized in that: The S4 comprises the following steps: S41, using the parameter adjustment optimization objective function as a fitness function, and using an educational competitive optimization algorithm to solve the parameter adjustment optimization objective function under constraints to obtain a 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 constitute 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 to complete the robot parameter adjustment optimization.

8. The robot parameter adjustment and optimization method for appearance inspection according to claim 7, characterized in that: The S41 includes the following steps: S411. It is assumed that in the process of solving the parameter adjustment optimization objective function, there is a search space, there is a population in the search space, the school population and the student population are determined according to the population, the school population dimension is j, and the students compete to obtain school admission. Each individual in the school population represents a candidate solution, and the candidate solution includes the robot link motion speed, the robot link motion acceleration and the camera sampling frequency; the school population and the student population are initialized using a chaotic map. In the primary school stage, the current number of iterations is set to t, the maximum number of iterations is set to T, and the adaptive step size is At the tth iteration, the location of the cth school is Distance from school The nearest school location is recorded as X′, and the average location of the schools at the tth iteration is The Levy flight coefficient is Lexy(j), d1 is a random vector that follows a normal distribution; in the school population, the position of the c+1th school at the tth iteration is The student population is updated following the school population, and we get S412. In middle school, the patience coefficient ε is used to measure the learning patience of the student population, and the learning talent coefficient of the student population is calculated based on the patience coefficient In the school population, the best position of the school at the tth iteration is recorded as get The student population is updated following the school population. Set d2 to represent a random number between the interval [0,1], and update the school location. Update, when d2<0.5, When d2≥0.5, In each iteration, the student population moves toward the current optimal fitness function value, obtains the current optimal solution, and determines the position of the school population; S413. In the high school stage, set d3 to represent a random number between the interval [0,1], and again calculate the school location. Update and get The student population is updated following the school population. Set d3 to represent a random number between the interval [0,1] and update the school position. When d3<0.5, When d3≥0.5, After completing all stage updates, select the top 10% of fitness function values ​​to form the school population, and the remaining 90% to form the student population. Form a new school population and a new student population, and enter the next round of iteration until the current number of iterations reaches the maximum number of iterations. Stop the iteration and obtain the final school population. The school position corresponding to the best fitness function value in the final school population is recorded as the global optimal solution.

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

Citation Information

Patent Citations

  • Self-adjustment and optimization methods for parameters of robot inverse-solution-free control systems

    CN110501903B

  • Automatic hand-eye calibration method based on variation particle swarm optimization

    CN110695991A

  • Hand-eye calibration parameter identification method, hand-eye calibration parameter identification system based on differential evolution algorithm and medium

    CN110842914A

  • Electric power integrated energy system scheduling method and device under dual-carbon target

    CN114565236A

  • Robot trajectory optimization method, system, equipment and medium

    CN116442231A