A connection relationship identification method
By acquiring and processing target images, identifying connections and their location information, and filtering out deterministic and impossible connection relationships, the problem of difficult connection relationship identification in nuclear power plant simulators is solved, thus improving modeling efficiency and quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA NUCLEAR POWER OPERATION TECH CORP
- Filing Date
- 2022-11-28
- Publication Date
- 2026-06-09
AI Technical Summary
In the development of a full-range nuclear power plant simulator, manual modeling is inefficient and has a high error rate, especially the difficulty in identifying connection relationships, which affects the efficiency of simulation modeling.
By acquiring target images, identifying the connections and their location information, filtering out deterministic and impossible connections, and using component properties and probabilistic methods to identify possible connections, automated identification is achieved.
It enables automatic identification of connectivity relationships in target images, improves modeling efficiency and quality, and provides a basis for intelligent image recognition.
Smart Images

Figure CN115880712B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image processing technology, and specifically relates to a method for identifying connection relationships. Background Technology
[0002] The development of a full-scale nuclear power plant simulator requires simulation modeling of hundreds of power plant process systems, hundreds of power distribution systems, thousands of DCS control logic diagrams, and various styles of process flow diagrams, teaching control diagrams, and control panel diagrams. Manual modeling is inefficient and prone to errors, a key factor affecting simulator development efficiency. Therefore, there is an urgent need to implement automated modeling methods to automatically convert design drawings into simulation models, thereby improving modeling efficiency and quality.
[0003] To achieve automatic modeling, intelligent image recognition must first be realized. Connection relationship recognition is crucial for intelligent image recognition. How to achieve automatic recognition of connection relationships is a problem that this invention urgently needs to solve. Summary of the Invention
[0004] The purpose of this invention is to provide a connection relationship recognition method to solve the problem of automatic recognition of connection relationships in images.
[0005] The technical solution of the present invention is as follows: a connection relationship identification method, the method specifically includes:
[0006] S1. Acquire the target image;
[0007] S2. After processing the target image, identify the connecting lines and their position information in the target image, and identify the position information of the corner points in the target image to obtain the inflection points of the connecting lines in the target image and the connection points of the components in the target image.
[0008] S3. Identify possible connectivity relationships in the target image;
[0009] S3.1 Identify whether there is a possible connection between two adjacent elements;
[0010] S3.2 Identify whether there are possible connections between adjacent elements and inflection points;
[0011] S3.3 Identify whether there is a possible connection between two adjacent inflection points;
[0012] S4. Based on the attributes of the components, filter out deterministic and impossible connections from the obtained possible connections.
[0013] S5. Remove impossible connections from the target image to complete the identification of line connections in the target image.
[0014] The specific steps in step S4 of filtering deterministic and impossible connections include:
[0015] When there are horizontal or vertical straight line connections between components, a probabilistic identification method is used to filter out deterministic and impossible connection relationships:
[0016] (1) Calculate the overlap ratio D of the opposite surfaces of two adjacent elements:
[0017]
[0018] Where A and B represent the widths of the opposite faces of two adjacent elements, respectively; and C represents the overlap width of the opposite faces of two adjacent elements.
[0019] (2) Calculate the ratio G of the line length to the spacing between two adjacent elements:
[0020]
[0021] Where F represents the length of the connection between two components, and E represents the length of the connection and the spacing between two adjacent components;
[0022] (3) When the overlap ratio D of two components and the ratio of the connection length to the spacing G reach the corresponding predetermined probability threshold, it is determined that there is a possible connection relationship between the two adjacent components.
[0023] Based on the D and G values, the possible connections between each element are sorted, and deterministic connections are filtered according to the element's attribute definition and the sorting results.
[0024] The specific steps in step S4 for filtering deterministic connections include:
[0025] When a diagonal line is detected between two adjacent elements, if both elements have unconnected connection points and there are no other possible connections between them, then a deterministic connection is determined between the two elements. When a diagonal line is detected between an adjacent element and an inflection point, if the element has unconnected connection points and there are no other possible connections between them, then a deterministic connection is determined between the element and the inflection point.
[0026] The specific steps for filtering out impossible connection relationships from possible connection relationships in step S4 are as follows:
[0027] When the number of deterministic connections of an element in a certain direction is the same as the number of connection points defined by the element's attributes in the method, the uncertain possible connections of the element in that direction are determined as impossible connections; when the total number of deterministic connections of an element is the same as the total number of connection points defined by the element's attributes, the uncertain possible connections of the element are determined as impossible connections.
[0028] Step S4 further includes the step of outputting a corresponding prompt message when the number of connection points of a component is inconsistent with the number of connection points defined in the component's attributes, or when there are unconnected connection points:
[0029] When the difference between D and G corresponding to different possible connection relationships of the same component is within a predetermined difference range, the corresponding prompt message is output;
[0030] When the number of connection points of a detected element is inconsistent with the number of connection points defined in the element's attribute, a corresponding prompt message will be output.
[0031] When a component has an unconnected connection point, output the corresponding prompt message.
[0032] Step 3, which identifies possible connections between two adjacent elements, between adjacent elements and inflection points, and between two adjacent inflection points, includes the following steps:
[0033] S3.1 Identify whether there is a possible connection between two adjacent elements;
[0034] If two adjacent elements are found to have connection points facing opposite directions and there is a connection between the two adjacent elements that satisfies a first predetermined condition, then a possible connection relationship between the two adjacent elements is identified.
[0035] S3.2 Identify whether there are possible connections between adjacent elements and inflection points;
[0036] If an adjacent element and an inflection point are connected by a line that satisfies a first predetermined condition and the corresponding element has a connection point facing the line, then it is determined that there is a possible connection relationship between the corresponding element and the inflection point.
[0037] S3.3 Identify whether there is a possible connection between two adjacent inflection points;
[0038] If a line is found between two adjacent inflection points that satisfies a first predetermined condition, then it is determined that there is a possible connection between the two related inflection points.
[0039] The first predetermined condition is that the length of the connection is greater than or equal to a first multiple threshold of the distance between the two components;
[0040] Step 2 specifically includes:
[0041] S2.1 Preprocess the acquired target image;
[0042] S2.2 Identify components and text in the target image, and remove the identified components and text from the target image;
[0043] S2.3 identifies the connecting lines as a type of element to obtain the position information of the connecting lines in the target image;
[0044] If the average pixel value of a consecutive number of pixels in the target image is less than a predetermined pixel threshold, then it is determined that the consecutive number of pixels form a line, and the position information of the line is obtained.
[0045] S2.4 refines the lines in the target image, reducing lines of different thicknesses to a width of one pixel.
[0046] S2.5 Based on the obtained connection position information, identify the position information of corner points in the target image;
[0047] Corner points include the intersections between lines in an image, as well as the intersections between lines and elements. The positional information of corner points can be identified using the Shi-Tomasi detection algorithm.
[0048] S2.6 Based on the position information of the corner points in the target image, identify the inflection points of the connecting lines in the target image and the connection points of each component.
[0049] The step of identifying the inflection points of lines and the connection points of various components in the target image based on the position information of corner points in the target image includes:
[0050] Based on the obtained connection positions and corner point positions, determine whether there are at least two lines connecting each corner point in the target image and both of them are straight lines; for any corner point, if there are at least two lines connecting it and both of them are straight lines, then the corner point is identified as an inflection point.
[0051] For cases where the connecting lines are horizontal or vertical, based on the identified connecting lines and corner point position information, it is determined whether the connecting lines connecting each corner point in the target image form a right angle. If the connecting lines connecting to the corner point form a right angle, the corner point is identified as an inflection point.
[0052] After identifying the inflection point, exclude the inflection point and the intersection point formed by the curve from the identified corner points. The remaining corner points are the connection points of the components.
[0053] The specific steps for right-angle detection are as follows:
[0054] For any corner point, a rectangular target area is defined with that corner point as the center. A central area of a rectangle is defined at the center of the rectangular target area. The areas above and below the central area within the target area are defined as the vertical detection area, and the areas to the left and right of the central area within the target area are defined as the horizontal detection area. When there is a vertical line in the vertical detection area and the length of the vertical line is approximately equal to the height of the vertical detection area, and there is a horizontal line in the horizontal detection area and the length of the horizontal line is approximately equal to the width of the horizontal detection area, it is determined that the line connecting to the corresponding corner point forms a right angle.
[0055] The significant advantage of this invention is that the connection relationship recognition method described in this invention can identify possible connection relationships from a target image, filter out deterministic connection relationships and impossible connection relationships, and remove impossible connection relationships, thereby realizing the automatic recognition of connection relationships in the target image and providing a basis for subsequent intelligent image recognition. Attached Figure Description
[0056] Figure 1 This is a flowchart of a connection relationship identification method according to the present invention. Detailed Implementation
[0057] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0058] like Figure 1 As shown, a connection relationship identification method includes the following steps:
[0059] S1. Acquire the target image;
[0060] Acquire target images, which can be system flowcharts such as electrical diagrams, process diagrams, or panel diagrams. The target images include several components, text corresponding to the components, and lines connecting these components.
[0061] S2. After processing the target image, identify the connecting lines and their position information in the target image, and identify the position information of the corner points in the target image to obtain the inflection points of the connecting lines in the target image and the connection points of the components in the target image.
[0062] S2.1 Preprocess the acquired target image;
[0063] S2.1.1 Perform image grayscale processing on the acquired image to be identified;
[0064] S2.1.2 Filter the grayscale image to reduce image noise;
[0065] S2.1.3 Binarize the filtered image;
[0066] The filtered image is binarized by setting the value of each pixel in the image to 0 or 255, that is, setting the image pixels to black or white.
[0067] S2.2 Identify components and text in the target image, and remove the identified components and text from the target image;
[0068] S2.3 identifies the connecting lines as a type of element to obtain the position information of the connecting lines in the target image;
[0069] If the average pixel value of a consecutive number of pixels in the target image is less than a predetermined pixel threshold, then it is determined that the consecutive number of pixels form a line, and the position information of the line is obtained.
[0070] S2.4 refines the lines in the target image, reducing lines of different thicknesses to a width of one pixel.
[0071] S2.5 Based on the obtained connection position information, identify the position information of corner points in the target image;
[0072] Corner points include the intersections between lines in an image, as well as the intersections between lines and elements. The positional information of corner points can be identified using the Shi-Tomasi detection algorithm.
[0073] S2.6 Based on the position information of the corner points in the target image, identify the inflection points of the connecting lines in the target image and the connection points of each component;
[0074] Based on the obtained connection positions and corner point positions, determine whether there are at least two lines connecting each corner point in the target image and both of them are straight lines; for any corner point, if there are at least two lines connecting it and both of them are straight lines, then the corner point is identified as an inflection point.
[0075] For cases where the connecting lines are horizontal or vertical, the inflection point can be determined by detecting the right-angled sides. The specific steps are as follows:
[0076] Based on the identified connection and corner position information, determine whether the connecting lines to each corner in the target image form a right angle. If the connecting lines to the corner form a right angle, the corner is identified as an inflection point.
[0077] The specific steps for the right angle detection are as follows:
[0078] For any corner point, a rectangular target area is defined centered on that corner point. A central rectangular area is then defined at the center of the target area. The areas above and below the central area within the target area are defined as the vertical detection area, and the areas to the left and right of the central area within the target area are defined as the horizontal detection area. When there is a vertical line within the vertical detection area and the length of the vertical line is approximately equal to the height of the vertical detection area, and there is a horizontal line within the horizontal detection area and the length of the horizontal line is approximately equal to the width of the horizontal detection area, it is determined that the line connecting to the corresponding corner point forms a right angle.
[0079] After identifying the inflection point, exclude the inflection point and the intersection point formed by the curve from the identified corner points. The remaining corner points are the connection points of the components.
[0080] S3. Identify possible connectivity relationships in the target image;
[0081] S3.1 Identify whether there is a possible connection between two adjacent elements;
[0082] If two adjacent elements are detected to have a connection point facing opposite directions and there is a connection line between the two adjacent elements that satisfies a first predetermined condition, then a possible connection relationship is identified between the two adjacent elements. The first predetermined condition is, for example, that the length of the connection line is greater than or equal to a first multiple threshold of the distance between the two elements, such as 0.95 times. The connection line here can be a solid line, a dashed line, or a diagonal line.
[0083] S3.2 Identify whether there are possible connections between adjacent elements and inflection points;
[0084] If an adjacent element and an inflection point are connected by a line that satisfies a first predetermined condition and the corresponding element has a connection point facing the line, then it is determined that there is a possible connection relationship between the corresponding element and the inflection point.
[0085] S3.3 Identify whether there is a possible connection between two adjacent inflection points;
[0086] If a line that satisfies a first predetermined condition is detected between two adjacent inflection points, then it is determined that there is a possible connection between the two related inflection points.
[0087] S4. Based on the attributes of the components, filter out deterministic and impossible connections from the obtained possible connections.
[0088] S4.1 When there are horizontal or vertical straight line connections between components, use a probability identification method to filter out deterministic connection relationships and impossible connection relationships;
[0089] S4.1.1 Calculate the overlap ratio D of the opposite surfaces of two adjacent elements:
[0090]
[0091] Where A and B represent the widths of the opposite faces of two adjacent elements, respectively; and C represents the overlap width of the opposite faces of two adjacent elements.
[0092] S4.1.2 Calculate the ratio G of the connection length to the spacing between two adjacent elements:
[0093]
[0094] Where F represents the length of the connection between two components, and E represents the length of the connection and the spacing between two adjacent components;
[0095] S4.1.3 When the overlap ratio D of two components and the ratio of the connection length to the spacing G reach the corresponding predetermined probability threshold, it is determined that there is a possible connection relationship between the two adjacent components.
[0096] Based on the D and G values, the possible connections between each element are sorted, and deterministic connections are filtered according to the element's attribute definition and sorting results. The larger the D and G values, the greater the probability that the connection is a deterministic connection.
[0097] S4.2 When a diagonal line is detected between two adjacent elements, if both elements have unconnected connection points and there are no other possible connections between them, then a deterministic connection relationship is determined between the two elements. When a diagonal line is detected between an adjacent element and an inflection point, if the element has unconnected connection points and there are no other possible connections between them, then a deterministic connection relationship is determined between the element and the inflection point.
[0098] S4.3 Filter out impossible connections from possible connections;
[0099] When the number of deterministic connections of an element in a certain direction is the same as the number of connection points defined by the attribute of the element in the method, the uncertain possible connections of the element in that direction are determined to be impossible connections; when the total number of deterministic connections of an element is the same as the total number of connection points defined by the attribute of the element, the uncertain possible connections of the element are determined to be impossible connections.
[0100] S4.4 When the number of connection points of a component is found to be inconsistent with the number of connection points defined in the component's attributes, or when there are unconnected connection points, the corresponding prompt message will be output.
[0101] When the difference between D and G corresponding to different possible connection relationships of the same component is within a predetermined difference range, the corresponding prompt message is output;
[0102] When the number of connection points of a detected element is inconsistent with the number of connection points defined in the element's attribute, a corresponding prompt message will be output.
[0103] When a component has an unconnected connection point, output the corresponding prompt message.
[0104] S5. Remove impossible connections from the target image to complete the identification of line connections in the target image.
Claims
1. A method for identifying connection relationships, characterized in that, The method specifically includes: S1. Acquire the target image; S2. After processing the target image, identify the connecting lines and their position information in the target image, and identify the position information of the corner points in the target image to obtain the inflection points of the connecting lines in the target image and the connection points of the components in the target image. S3. Identify possible connectivity relationships in the target image; S3.1 Identify whether there is a possible connection between two adjacent elements; S3.2 Identify whether there are possible connections between adjacent elements and inflection points; S3.3 Identify whether there is a possible connection between two adjacent inflection points; S4. Based on the attributes of the components, filter out deterministic and impossible connections from the obtained possible connections. When there are horizontal or vertical straight line connections between components, a probabilistic identification method is used to filter out deterministic and impossible connection relationships: (1) Calculate the overlap ratio D of the opposite surfaces of two adjacent elements: , Where A and B represent the widths of the opposite faces of two adjacent elements, respectively; and C represents the overlap width of the opposite faces of two adjacent elements. (2) Calculate the ratio G of the line length between two adjacent components to the spacing: , Where F represents the length of the connection between two components, and E represents the length of the connection and the spacing between two adjacent components; (3) When the overlap ratio D of two components and the ratio of the connection length to the spacing G reach the corresponding predetermined probability threshold, it is determined that there is a possible connection relationship between the two adjacent components. Based on the D and G values, the possible connections between each element are sorted, and deterministic connections are filtered according to the element's attribute definition and the sorting results. S5. Remove impossible connections from the target image to complete the identification of line connections in the target image.
2. The connection relationship identification method according to claim 1, characterized in that, The specific steps in step S4 for filtering deterministic connections include: When a diagonal line is detected between two adjacent elements, if both elements have unconnected connection points and there are no other possible connections between them, then a deterministic connection is determined between the two elements. When a diagonal line is detected between an adjacent element and an inflection point, if the element has unconnected connection points and there are no other possible connections between them, then a deterministic connection is determined between the element and the inflection point.
3. The connection relationship identification method according to claim 1, characterized in that, The specific steps for filtering out impossible connection relationships from possible connection relationships in step S4 are as follows: When the number of deterministic connections of an element in a certain direction is the same as the number of connection points defined by the element's attributes in the method, the uncertain possible connections of the element in that direction are determined as impossible connections; when the total number of deterministic connections of an element is the same as the total number of connection points defined by the element's attributes, the uncertain possible connections of the element are determined as impossible connections.
4. The connection relationship identification method according to claim 3, characterized in that, Step S4 further includes the step of outputting a corresponding prompt message when the number of connection points of a component is inconsistent with the number of connection points defined in the component's attributes, or when there are unconnected connection points: When the difference between D and G corresponding to different possible connection relationships of the same component is within a predetermined difference range, the corresponding prompt message is output; When the number of connection points of a detected element is inconsistent with the number of connection points defined in the element's attribute, a corresponding prompt message will be output. When a component has an unconnected connection point, output the corresponding prompt message.
5. The connection relationship identification method according to claim 1, characterized in that, Step 3, which identifies possible connections between two adjacent elements, between adjacent elements and inflection points, and between two adjacent inflection points, includes the following steps: S3.1 Identify whether there is a possible connection between two adjacent elements; If two adjacent elements are found to have connection points facing opposite directions and there is a connection between the two adjacent elements that satisfies a first predetermined condition, then a possible connection relationship between the two adjacent elements is identified. S3.2 Identify whether there are possible connections between adjacent elements and inflection points; If an adjacent element and an inflection point are connected by a line that satisfies a first predetermined condition and the corresponding element has a connection point facing the line, then it is determined that there is a possible connection relationship between the corresponding element and the inflection point. S3.3 Identify whether there is a possible connection between two adjacent inflection points; If a line is found between two adjacent inflection points that satisfies a first predetermined condition, then it is determined that there is a possible connection between the two related inflection points.
6. The connection relationship identification method according to claim 5, characterized in that, The first predetermined condition is that the length of the connection is greater than or equal to a first multiple threshold of the distance between the two components.
7. The connection relationship identification method according to claim 1, characterized in that, Step 2 specifically includes: S2.1 Preprocess the acquired target image; S2.2 Identify the components and text in the target image, and remove the identified components and text from the target image; S2.3 The connecting lines are identified as a type of element to obtain the position information of the connecting lines in the target image; If the average pixel value of a consecutive number of pixels in the target image is less than a predetermined pixel threshold, then it is determined that the consecutive number of pixels form a line, and the position information of the line is obtained. S2.4 Thin out the lines in the target image, reducing straight lines of different thicknesses to a width of one pixel; S2.5 Based on the obtained connection position information, identify the position information of corner points in the target image; Corner points include the intersections between lines in an image, as well as the intersections between lines and elements. The positional information of corner points can be identified using the Shi-Tomasi detection algorithm. S2.6 Based on the position information of the corner points in the target image, identify the inflection points of the connecting lines in the target image and the connection points of each component.
8. The connection relationship identification method according to claim 7, characterized in that, The step of identifying the inflection points of lines and the connection points of various components in the target image based on the position information of corner points in the target image includes: Based on the obtained connection positions and corner point positions, determine whether there are at least two lines connecting each corner point in the target image and both of them are straight lines; for any corner point, if there are at least two lines connecting it and both of them are straight lines, then the corner point is identified as an inflection point. For cases where the connecting lines are horizontal or vertical, based on the identified connecting lines and corner point position information, it is determined whether the connecting lines connecting each corner point in the target image form a right angle. If the connecting lines connecting to the corner point form a right angle, the corner point is identified as an inflection point. After identifying the inflection point, exclude the inflection point and the intersection point formed by the curve from the identified corner points. The remaining corner points are the connection points of the components.
9. The connection relationship identification method according to claim 8, characterized in that, The specific steps for right-angle detection are as follows: For any corner point, a rectangular target area is defined with that corner point as the center. A central area of a rectangle is defined at the center of the rectangular target area. The areas above and below the central area within the target area are defined as the vertical detection area, and the areas to the left and right of the central area within the target area are defined as the horizontal detection area. When there is a vertical line in the vertical detection area and the length of the vertical line is approximately equal to the height of the vertical detection area, and there is a horizontal line in the horizontal detection area and the length of the horizontal line is approximately equal to the width of the horizontal detection area, it is determined that the line connecting to the corresponding corner point forms a right angle.