Relay node identification method and system, electronic equipment and storage medium
Through the detection model of red-green ratio screening and elliptical fitting combined with pin array features, the problems of high error rate and large calculation amount of traditional visual recognition technology in relay detection are solved, and efficient and accurate relay node recognition is achieved.
Patent Information
- Application Number
- CN202510863704.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-26
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2045-06-26
AI Technical Summary
Traditional visual recognition technology has high misjudgment rate, large calculation amount, high algorithm complexity in relay detection, and is difficult to meet the real-time processing requirements of industrial automation production lines, and cannot adapt to the rhythm of high-speed production lines.
The coil shape is determined by red-green ratio screening coil and elliptical fitting, combined with the rectangular array layout of the pins and high-contrast visual features for positioning, and using Gaussian-Newton iterative fine-tuning of transformation parameters to build a detection model, reducing the calculation amount and improving detection efficiency and accuracy.
The algorithm complexity is simplified, the calculation amount is reduced, the detection efficiency is improved, the anti-interference ability is enhanced, and the accuracy and stability of the detection results are ensured.
Smart Images

Figure CN120374986A_ABST
Abstract
Description
Background Art
[0002] In the context of the rapid development of Industry 4.0 and intelligent manufacturing, industrial automated production lines have extremely high requirements for the accuracy, speed, and stability of component detection. As a commonly used electronic component in industrial control systems, the accurate identification of relays is crucial for ensuring the normal operation of production lines and improving product quality. Visual recognition technology has become an important means for relay detection due to its advantages such as non-contact and comprehensive information acquisition. However, the complexity of the production line environment and the computing power limitations of embedded devices pose many challenges to traditional visual recognition technology in relay detection.
[0003] Traditional visual recognition technologies mostly rely on single color or edge detection methods. In the industrial production line environment, there are problems such as the mixing of multiple models of components, unstable lighting conditions, and oil pollution. These interference factors easily lead to misjudgments. For example, the detection method based on color thresholds may misidentify other red or copper-colored components as relay coils; edge detection is difficult to accurately extract the relay contour when covered with oil or under uneven lighting; complex image segmentation and feature matching algorithms have high requirements for computing resources. Embedded devices commonly used in industrial automated production lines, such as PLCs and industrial cameras, have limited CPU computing power. When traditional algorithms run on these devices, it is difficult to meet the real-time processing requirements of sub-milliseconds, resulting in low detection efficiency and inability to adapt to the rhythm of high-speed production lines. The existing technologies have not fully exploited the unique structural feature of the relay, namely "elliptical shape of the coil + strict rectangular array of pins", and transformed it into an effective detection constraint. This makes the algorithm have redundant calculations, which not only increases the computational amount but also reduces the accuracy and stability of detection. Summary of the Invention
[0004] Object of the Invention: To propose a method for identifying relay nodes, and further provide a system, an electronic device, and a storage medium that can run and implement the above method to solve the above problems existing in the prior art.
[0005] In the first aspect of the present invention, a method for identifying relay nodes is proposed, including the following steps: S1. Obtain the original RGB image data of the relay, perform red-green ratio operation, generate a color mask binary image through threshold segmentation, filter non-coil regions, and determine the coil region by fitting an ellipse equation, and output the color mask binary image of the coil region; S2. Extract the edge contour point set from the color mask binary image of the coil region, calculate the covariance matrix of the edge contour points, and obtain the main eigenvector corresponding to the maximum eigenvalue of the covariance matrix as the main axis direction vector of the coil, and construct the rigid body transformation matrix of the coil; S3. Convert the original RGB image of the relay into a grayscale image, extract the pin template coordinates, combine the pin template coordinates with the rigid body transformation matrix of the coil, calculate the predicted pixel coordinates of the pins, apply a Laplacian of Gaussian kernel to the grayscale image within a preset window around the predicted pixel coordinates of the pins for convolution operation, obtain the measured pixel coordinates of the pins through local maximum detection, and construct an objective function to output the optimized measured pixel coordinates of the pins and the optimized rigid body transformation matrix through iterative fine-tuning of the transformation parameters; S4. Extract the optimized measured pixel coordinates of the pins, the total number of pins, and the pixel tolerance, obtain the predefined labels of the pin template, map the predefined labels of the pin template to the measured pixel coordinates of the pins through isomorphic mapping, and perform confidence calculation to judge the reliability of the output result.
[0006] A further improvement of the present invention is that the S1 includes the following specific steps: S11. Obtain the original RGB image of the relay, and obtain the R-channel value of each pixel point of the original RGB image and the G-channel value , representing the pixel point coordinates; S12. Perform red-green ratio map calculation, and the red-green ratio map calculation formula is:
[0007] where, is a constant, and the value is ; S13. Perform threshold segmentation to generate a color mask binary image. For the pixel points in the original RGB image , mark the color mask , otherwise, ; S14. Fit an ellipse equation to the coil, and the ellipse equation is: ; where, a is the long semi-axis of the ellipse, b is the short semi-axis of the ellipse, is the center coordinate of the ellipse, and retain the ellipse region that satisfies the ellipse geometric constraint parameters as the finally determined coil region, and output the color mask binary image of the coil region.
[0008] A further improvement of the present invention is that the ellipse geometric constraint parameters in the S14 are specifically: the ratio of the long semi-axis to the short semi-axis is not less than 0.95 and not greater than 1.1, and the area is greater than 2000 pixels.
[0009] A further improvement of the present invention is that the S2 includes the following specific steps: S21. Extract the edge contour point set C from the color mask binary image of the coil region, calculate the covariance matrix of the edge contour points, and the calculation formula is:
[0010] Among them, Σ represents the covariance matrix of the edge contour points, N is the number of elements in the edge contour point set C, represents the pixel coordinates of the i-th edge contour point, represents the centroid coordinates of the edge contour points, and T represents the transpose of the matrix; S22. Select the principal eigenvector corresponding to the largest eigenvalue of the covariance matrix as the coil main axis direction vector ; calculate the scaling ratio of the coil ; among them, represents the length of the major semi-axis of the coil of the relay standard model; calculate the coil main axis direction vector and the included angle between the x-axis of the color mask binary image, and the formula is: ; represents the component of the coil main axis direction vector in the y-axis direction of the color mask binary image, represents the component of the coil main axis direction vector in the x-axis direction of the color mask binary image, and generate the rotation matrix ; S23. Combine the scaling ratio s of the coil, the rotation matrix and the centroid coordinates of the edge contour points , and construct the rigid body transformation matrix .
[0011] A further improvement of the present invention is that the S3 includes the following specific steps: S31. Convert the original RGB image of the relay into a grayscale image, extract the pin template coordinates , and combine the pin template coordinates with the rigid body transformation matrix of the coil , and calculate the predicted pixel coordinates of the pins , and the calculation formula is: ; among them, j represents pin j; S32. In the 9×9 window around the predicted pixel coordinates of the pins , apply the Laplacian of Gaussian kernel to the grayscale image for convolution operation, and find the point with the strongest response as the measured pixel coordinates of the pins ; S33. With the goal of minimizing the error between the predicted pixel coordinates and the measured pixel coordinates of the pins, construct a Gauss-Newton optimization objective function to fine-tune the rigid body transformation matrix of the coil, and the specific formula is:
[0012] Among them, is the fine-tuning amount of the rigid body transformation matrix of the coil; n represents the total number of relay pins; S34. Output the measured pixel coordinates of the pins after optimization and the optimized rigid body transformation matrix.
[0013] A further improvement of the present invention lies in that the S4 includes the following specific steps: S41. Extract the measured pixel coordinates of the pins after optimization , the total number n of pins, and the pixel tolerance ; S42. Obtain the predefined label of the pin template , and map the predefined label of the pin template to the measured pixel coordinates of the pins through isomorphic mapping ; S43. Perform confidence calculation, and the specific formula for the confidence calculation is:
[0014] where represents the Euclidean distance between the predicted pixel coordinates of the j-th pin and the measured pixel coordinates of the pins after optimization; S44. Judge the reliability of the output result. When the confidence , it is determined that the output result is reliable, otherwise the re-inspection mechanism is triggered.
[0015] In the second aspect of the present invention, a relay node recognition system is proposed, and the system includes: a coil extraction module, a rigid body transformation module, a pin joint optimization module, and a label assignment and confidence verification module.
[0016] The coil extraction module is used to obtain the original RGB image data of the relay, perform red-green ratio operation, generate a color mask binary image through threshold segmentation, filter the non-coil area, and determine the coil area by fitting an ellipse equation, and output the color mask binary image of the coil area; The rigid body transformation module is used to extract the edge contour point set from the color mask binary image of the coil area, calculate the covariance matrix of the edge contour points, and obtain the main eigenvector corresponding to the maximum eigenvalue of the covariance matrix as the coil main axis direction vector, and construct the rigid body transformation matrix of the coil; The pin joint optimization module is used to convert the original RGB image of the relay into a grayscale image, extract the pin template coordinates, combine the pin template coordinates with the rigid body transformation matrix of the coil, calculate the predicted pixel coordinates of the pins, perform convolution operation on the grayscale image with a Laplacian of Gaussian kernel within a preset window around the predicted pixel coordinates of the pins, obtain the measured pixel coordinates of the pins through local maximum detection, and construct an objective function to output the measured pixel coordinates of the pins after optimization and the optimized rigid body transformation matrix by iteratively fine-tuning the transformation parameters; The label assignment and confidence verification module is used to extract the measured pixel coordinates of the optimized pins, the total number of pins, and the pixel tolerance, and obtain the predefined labels of the pin template. The predefined labels of the pin template are mapped to the measured pixel coordinates of the pins through isomorphic mapping, and the confidence is calculated to judge the reliability of the output result.
[0017] In the third aspect of the present invention, an electronic device is proposed. The electronic device includes a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the relay node recognition method described in the first aspect is implemented.
[0018] In the fourth aspect of the present invention, a computer-readable storage medium is proposed. At least one executable instruction is stored in the storage medium. When the executable instruction runs on an electronic device, the electronic device executes the relay node recognition method described in the first aspect.
[0019] Beneficial effects: The novel relay node recognition method disclosed in the present invention constructs a detection model only relying on two prior features, namely coil color-geometry and pin array. The coil is screened by the red-green ratio, and the coil shape is determined by ellipse fitting. The rectangular array layout and high-contrast visual features of the pins are used for positioning, avoiding complex image segmentation and feature matching processes, fundamentally simplifying the algorithm complexity and reducing the computational amount; the search space for pin positioning is reduced from the entire image to a local window, improving the detection efficiency while reducing the computational amount; combined with the high-brightness characteristics of metal pins, background noise is suppressed and the anti-interference ability is enhanced. The global optimization link fine-tunes the transformation parameters through Gauss-Newton iteration to ensure the overall alignment accuracy of all pins. At the same time, the confidence calculation provides a quantitative reliability index. When the detection environment deteriorates, the system can automatically identify and trigger remedial measures, effectively eliminating false detection results and ensuring the accuracy and stability of the detection results. Description of the Drawings
[0020] Figure 1 It is a schematic flowchart of the relay node recognition method in the embodiment of the present invention.
[0021] Figure 2 It is a schematic structural diagram of the relay node recognition system in the embodiment of the present invention. Detailed Embodiments
[0022] In the following description, a large number of specific details are given to provide a more thorough understanding of the present invention. However, it is obvious to those skilled in the art that the present invention can be implemented without one or more of these details. In other examples, some well-known technical features are not described to avoid confusion with the present invention.
[0023] Embodiment 1: In this embodiment, a new relay node recognition method based on image recognition is constructed. The overall process is shown in Figure 1 as follows. The specific steps are as follows: S1. Obtain the original RGB image data of the relay, perform red-green ratio operation, generate a color mask binary image through threshold segmentation, filter the non-coil area, and determine the coil area by fitting an ellipse equation, and output the color mask binary image of the coil area.
[0024] In this embodiment, step S1 can be implemented by the following specific steps: S11. Obtain the original RGB image of the relay and obtain the R-channel value of each pixel point of the original RGB image and the G-channel value , representing the pixel point coordinates; S12. Perform red-green ratio map calculation. The red-green ratio map calculation formula is shown in Equation (1):
[0025] where, is a constant, and its value is ; S13. Perform threshold segmentation to generate a color mask binary image. For the pixel points in the original RGB image , mark the color mask , otherwise, ; S14. Fit the ellipse equation for the coil, as shown in Equation (2):
[0026] where, a is the major semi-axis of the ellipse, b is the minor semi-axis of the ellipse, is the center coordinate of the ellipse. Retain the ellipse area that satisfies the ellipse geometric constraint parameters as the finally determined coil area, and output the color mask binary image of the coil area. The ellipse geometric constraint parameters are specifically: the ratio of the major semi-axis to the minor semi-axis is not less than 0.95 and not greater than 1.1, and the area is greater than 2000 pixels.
[0027] Utilize the color specificity of the copper wire (high R / G ratio) to quickly filter the background, and then exclude non-coil interferences (such as cylindrical capacitors) through ellipse geometric constraints (ellipses close to circles), and finally obtain the coil mask. This step reduces the candidate area from the whole image to the periphery of the coil, reducing the subsequent calculation amount.
[0028] S2. Extract the edge contour point set from the color mask binary image of the coil area, calculate the covariance matrix of the edge contour points, and obtain the main eigenvector corresponding to the largest eigenvalue of the covariance matrix as the coil main axis direction vector, and construct the rigid body transformation matrix of the coil.
[0029] In this embodiment, step S2 can be implemented by the following specific steps: S21. Extract the edge contour point set C from the color mask binary image of the coil region, and calculate the covariance matrix of the edge contour points. The calculation formula is shown in Equation (3):
[0030] where Σ represents the covariance matrix of the edge contour points, N is the number of elements in the edge contour point set C, represents the pixel coordinates of the i-th edge contour point, represents the centroid coordinates of the edge contour points, and T represents the transpose of the matrix; S22. Select the principal eigenvector corresponding to the largest eigenvalue of the covariance matrix as the coil main axis direction vector ; calculate the scaling ratio of the coil ; where, represents the length of the long semi-axis of the coil of the relay standard model; calculate the angle between the coil main axis direction vector and the x-axis of the color mask binary image according to Equation (4):
[0031] represents the component of the coil main axis direction vector in the y-axis direction of the color mask binary image, represents the component of the coil main axis direction vector in the x-axis direction of the color mask binary image, and generate the rotation matrix shown in Equation (5):
[0032] S23. Combine the scaling ratio s of the coil, the rotation matrix and the centroid coordinates of the edge contour points to construct the rigid body transformation matrix shown in Equation (6):
[0033] S3. Convert the original RGB image of the relay into a grayscale image, extract the pin template coordinates, combine the pin template coordinates with the rigid body transformation matrix of the coil, calculate the predicted pixel coordinates of the pins, apply the Laplacian Gaussian kernel to perform convolution operation on the grayscale image within a preset window around the predicted pixel coordinates of the pins, obtain the measured pixel coordinates of the pins through local maximum detection, and construct an objective function to output the optimized measured pixel coordinates of the pins and the optimized rigid body transformation matrix by iteratively fine-tuning the transformation parameters.
[0034] In this embodiment, step S3 can be implemented by the following specific steps: S31. Convert the original RGB image of the relay into a grayscale image, and extract the pin template coordinates , combine the pin template coordinates with the rigid body transformation matrix of the coil , and calculate the predicted pixel coordinates of the pins according to Equation (7):
[0035] S32. Apply a Laplacian of Gaussian kernel to the grayscale image for convolution operation within a 9×9 window around the predicted pixel coordinates of the pins, and find the point with the strongest response as the measured pixel coordinates of the pins through local maximum detection ; S33. With the goal of minimizing the error between the predicted pixel coordinates and the measured pixel coordinates of the pins, construct a Gauss-Newton optimization objective function to fine-tune the rigid body transformation matrix of the coil. The specific formula is shown in Equation (8):
[0036] where is the fine-tuning amount of the rigid body transformation matrix of the coil; n represents the total number of relay pins S34. Output the optimized measured pixel coordinates of the pins and the optimized rigid body transformation matrix
[0037] First, generate pin candidate positions through template projection, and then utilize the high-contrast characteristic of metal pins to accurately locate the centroid of the bright spot in the local area through the LoG operator, reducing the computational amount of global search. Finally, optimize the rigid body parameters through Gauss-Newton iteration to ensure the overall alignment accuracy of all pins and avoid topological errors caused by single-point positioning errors
[0038] S4. Extract the optimized measured pixel coordinates of the pins, the total number of pins, and the pixel tolerance, and obtain the predefined labels of the pin template. Map the predefined labels of the pin template to the measured pixel coordinates of the pins through isomorphic mapping, and perform confidence calculation to judge the reliability of the output result
[0039] In this embodiment, step S4 can be implemented by the following specific steps S41. Extract the optimized measured pixel coordinates of the pins, the total number n of the pins, and the pixel tolerance ; S42. Obtain the predefined labels of the pin template, and map the predefined labels of the pin template to the measured pixel coordinates of the pins through isomorphic mapping ; S43. Calculate the confidence according to Equation (9):
[0040] Among them, represents the Euclidean distance between the predicted pixel coordinates of the j-th pin and the measured pixel coordinates of the optimized pin; S44. Determine the reliability of the output result. When the confidence level is met, it is determined that the output result is reliable; otherwise, trigger the recheck mechanism.
[0041] Utilize the characteristic that the topological relationship of the relay pins is fixed, directly map the template labels to the measured coordinates, and avoid complex semantic segmentation. The confidence level is calculated through the normalized mean error to quantify the reliability of the result, ensure that the output is unambiguous, and meet the accuracy requirements of industrial control.
[0042] Embodiment 2: This embodiment proposes a new relay node recognition system based on image recognition. As Figure 2 shown, it consists of four parts: a coil extraction module, a rigid body transformation module, a pin joint optimization module, and a label assignment and confidence verification module.
[0043] The coil extraction module is used to obtain the original RGB image data of the relay, perform red-green ratio operation, generate a color mask binary image through threshold segmentation, filter non-coil regions, and determine the coil region by fitting an ellipse equation, and output the color mask binary image of the coil region.
[0044] The rigid body transformation module is used to extract the edge contour point set from the color mask binary image of the coil region, calculate the covariance matrix of the edge contour points, and obtain the main eigenvector corresponding to the maximum eigenvalue of the covariance matrix as the coil main axis direction vector, and construct the rigid body transformation matrix of the coil.
[0045] The pin joint optimization module is used to convert the original RGB image of the relay into a grayscale image, extract the pin template coordinates, combine the pin template coordinates with the rigid body transformation matrix of the coil, calculate the predicted pixel coordinates of the pins, apply a Laplacian Gaussian kernel to perform convolution operation on the grayscale image within a preset window around the predicted pixel coordinates of the pins, obtain the measured pixel coordinates of the pins through local maximum detection, and construct an objective function to output the optimized measured pixel coordinates of the pins and the optimized rigid body transformation matrix by iteratively fine-tuning the transformation parameters.
[0046] The label assignment and confidence verification module is used to extract the optimized measured pixel coordinates of the pins, the total number of pins, and the pixel tolerance, obtain the predefined labels of the pin template, map the predefined labels of the pin template to the measured pixel coordinates of the pins through isomorphic mapping, and calculate the confidence level to determine the reliability of the output result.
[0047] For the above parameters and the steps for each unit module in the relay node recognition system of the present invention to achieve corresponding functions, reference can be made to the parameters and steps in the embodiment of a novel relay node recognition method based on image recognition in Embodiment 1 above, which will not be elaborated here.
[0048] Embodiment 3 This embodiment provides an electronic device, which includes a processor and a memory. Among them, a computer program that can be called by the processor is stored in the memory; the processor executes a novel relay node recognition method based on image recognition disclosed in Embodiment 1 above by calling the computer program stored in the memory.
[0049] This electronic device may have relatively large differences due to different configurations or performances, and can include one or more processors (Central Processing Units, CPUs) and one or more memories. Among them, at least one computer program is stored in the memory, and this computer program is loaded and executed by the processor to implement a novel relay node recognition method provided by the above method embodiment. This electronic device can also include other components for implementing the functions of the device. For example, this electronic device can also have components such as wired or wireless network interfaces and input / output interfaces for data input and output. This will not be elaborated in this embodiment.
[0050] Those skilled in the art know that the present invention can be implemented as a system, a method, or a computer program product. Therefore, the present disclosure can be specifically implemented in the following forms: it can be completely hardware, can also be completely software (including firmware, resident software, microcode, etc.), or can also be a combination of hardware and software, generally referred to as "circuit", "module", or "system" in this article. In addition, in some embodiments, the present invention can also be implemented in the form of a computer program product in one or more computer-readable media, which contains computer-readable program code.
[0051] Any combination of one or more computer-readable media may be employed. The computer-readable media may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer-readable storage medium may be any tangible medium that contains or stores a program which can be used by or in connection with an instruction execution system, apparatus, or device.
[0052] The present invention is described with reference to flowchart illustrations and block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each flow or block in the flowchart illustrations and block diagrams, and combinations of flows and blocks in the flowchart illustrations and block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to the processors of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the instructions executed by the processors of the computer or other programmable data processing device create means for implementing the functions specified in Figure 1 one flow or multiple flows and blocks Figure 1 one block or multiple blocks.
[0053] These computer program instructions may also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are performed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one flow or multiple flows and blocks Figure 1 one block or multiple blocks.
[0054] As described above, although the present invention has been shown and described with reference to particular preferred embodiments, it should not be construed as a limitation on the invention itself. Various changes in form and detail may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.
Claims
1. A method for identifying relay nodes, characterized in that, It includes the following steps: S1. Obtain the original RGB image data of the relay and perform a red-green ratio operation on it. Generate a color mask binary image through threshold segmentation, filter the non-coil regions, and determine the coil region by fitting an ellipse equation, and output the color mask binary image of the coil region; S2. Extract the edge contour point set from the color mask binary image of the coil region, calculate the covariance matrix of the edge contour points, and obtain the principal eigenvector corresponding to the largest eigenvalue of the covariance matrix as the coil main axis direction vector, and construct the rigid body transformation matrix of the coil; S3. Convert the original RGB image of the relay into a grayscale image, and extract the pin template coordinates. Combine the pin template coordinates with the rigid body transformation matrix of the coil, calculate the predicted pixel coordinates of the pins, apply a Laplacian of Gaussian kernel to convolve the grayscale image within a preset window around the predicted pixel coordinates of the pins, obtain the measured pixel coordinates of the pins through local maximum detection, and construct an objective function to iteratively fine-tune the transformation parameters to output the optimized measured pixel coordinates of the pins and the optimized rigid body transformation matrix; S4. Extract the optimized measured pixel coordinates of the pins, the total number of pins, and the pixel tolerance, and obtain the predefined label of the pin template. Map the predefined label of the pin template to the measured pixel coordinates of the pins through isomorphic mapping, and perform confidence calculation to judge the reliability of the output result.
2. The relay node recognition method according to claim 1, characterized in that, Step S1 specifically includes: S11. Obtain the original RGB image of the relay, and obtain the R-channel value of each pixel point in the original RGB image and the G-channel value , where represents the pixel point coordinates; S12. Calculate the red-green ratio map : In the formula, is a constant; S13. For the pixel points in the original RGB image mark the color mask ; otherwise mark the color mask ; S14. Determine the coil region by fitting an ellipse equation, and the ellipse equation is as follows: Where a is the semi-major axis of the ellipse and b is the semi-minor axis of the ellipse, is the center coordinate of the ellipse. The elliptical area that retains the parameters satisfying the geometric constraints of the ellipse is used as the finally determined coil area, and a binary image of the color mask of the coil area is output.
3. The relay node recognition method according to claim 2, wherein, The geometric constraint parameters of the ellipse are: the ratio of the major axis to the minor axis is not less than 0.95 and not greater than 1.1, and the area is greater than 2000 pixels.
4. The relay node identification method according to claim 3, wherein Step S2 specifically includes: S21. Extract the edge contour point set C from the color mask binary image of the coil region and calculate the covariance matrix of the edge contour points :[[]]END]] Where, Σ represents the covariance matrix of the edge contour points; N is the number of elements in the edge contour point set C; represents the pixel coordinates of the i-th edge contour point; represents the centroid coordinates of the edge contour points; T represents the transpose of the matrix; S22. Select the principal eigenvector corresponding to the maximum eigenvalue of the covariance matrix Σ as the coil main axis direction vector ; Calculate the scaling ratio s of the coil: In the formula, represents the length of the long semi-axis of the coil of the relay standard model; a is the long semi-axis of the ellipse; Calculate the direction vector of the coil spindle The angle with the x-axis of the binary image of the color mask : In the formula, represents the component of the coil main axis direction vector in the y-axis direction of the color mask binary image; represents the component of the coil main axis direction vector in the x-axis direction of the color mask binary image; Generate rotation matrix ; S23. Combine the scaling ratio s of the coil, the rotation matrix and the centroid coordinates of the edge contour points , and construct a rigid body transformation matrix .
5. The relay node identification method according to claim 4, wherein, Step S3 specifically includes: S31. Convert the original RGB image of the relay into a grayscale image, and extract the pin template coordinates , and combine the pin template coordinates with the rigid body transformation matrix of the coil to calculate the predicted pixel coordinates of pin j : S32. At the predicted pixel coordinates of the pin Within the surrounding 9×9 window, apply a Laplacian of Gaussian kernel to the grayscale image for convolution operation, and find the point with the strongest response through local maximum detection as the measured pixel coordinates of the pin ; S33. With the goal of minimizing the error between the predicted pixel coordinates and the measured pixel coordinates of the pins, construct a Gauss-Newton optimization objective function to fine-tune the rigid body transformation matrix of the coil, and the formula is: In the formula, is the fine-tuning amount of the rigid body transformation matrix of the coil; n represents the total number of relay pins; S34. Output the measured pixel coordinates of the optimized pins and the optimized rigid body transformation matrix.
6. The relay node recognition method according to claim 5, wherein Step S4 specifically includes: S41. Extract the measured pixel coordinates of the optimized pins , the total number n of pins and the pixel tolerance ; S42. Obtain the predefined labels of the pin template , through an isomorphic mapping map the predefined labels of the pin template to the measured pixel coordinates of the pin; S43. Calculate the confidence level : In the formula, represents the Euclidean distance between the predicted pixel coordinates of the j-th pin and the measured pixel coordinates of the optimized pin.
7. The relay node recognition method according to claim 6, wherein Step S4 also includes: S44. Determine the reliability of the output result. When the confidence level is met, the output result is determined to be reliable; otherwise, a re-inspection mechanism is triggered.
8. A relay node identification system for performing the relay node identification method according to any one of claims 1 to 7, characterized in that, It includes: A coil extraction module, which is used to obtain the original RGB image data of the relay, perform a red-green ratio operation, generate a color mask binary image through threshold segmentation, filter the non-coil regions, and determine the coil region by fitting an ellipse equation, and output the color mask binary image of the coil region; A rigid body transformation module, which is used to extract the edge contour point set from the color mask binary image of the coil region, calculate the covariance matrix of the edge contour points, and obtain the principal eigenvector corresponding to the largest eigenvalue of the covariance matrix as the coil main axis direction vector, and construct the rigid body transformation matrix of the coil; A pin joint optimization module, which is used to convert the original RGB image of the relay into a grayscale image, and extract the pin template coordinates. Combine the pin template coordinates with the rigid body transformation matrix of the coil, calculate the predicted pixel coordinates of the pins, apply a Laplacian of Gaussian kernel to convolve the grayscale image within a preset window around the predicted pixel coordinates of the pins, obtain the measured pixel coordinates of the pins through local maximum detection, and construct an objective function to iteratively fine-tune the transformation parameters to output the optimized measured pixel coordinates of the pins and the optimized rigid body transformation matrix; The label assignment and confidence verification module is used to extract the measured pixel coordinates of the optimized pins, the total number of pins, and the pixel tolerance, and obtain the predefined labels of the pin template. The predefined labels of the pin template are mapped to the measured pixel coordinates of the pins through isomorphic mapping to calculate the confidence and judge the reliability of the output result.
9. An electronic device, characterized in that, The device includes: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the relay node recognition method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that, At least one executable instruction is stored in the storage medium. When the executable instruction runs on an electronic device, the electronic device is caused to execute the relay node recognition method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Three-phase electrode positioning device in smelting process of electro-fused magnesia furnace and control method thereof
CN101765258A
Circuit for controlling push rod motor and centrifugal machine
CN114744589A
Image-based circuit board electronic component positioning method and system
CN118762003A
Power transmission line lightning stroke point positioning system and method and medium
CN118837668A
MEMS relay, control circuit and power equipment
CN119170456A