Plant station wiring diagram equipment text matching method, system, device and storage medium
By using a combination of weighted bipartite diagrams and the Hungarian algorithm in the wiring diagram of the plant, the comprehensive weight of equipment and text is calculated and the optimal matching relationship is solved, which solves the accuracy problem of equipment text matching in complex drawings and achieves the globally optimal matching effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUAYAN INTELLIGENT TECH (GRP) CO LTD
- Filing Date
- 2026-05-06
- Publication Date
- 2026-06-02
AI Technical Summary
When existing technologies rely on the closest spatial distance matching method in plant wiring diagrams, they are prone to matching errors when faced with complex and ever-changing real-world drawings, especially due to inaccurate matching of equipment text caused by manual drawing or digitization errors.
The weighted bipartite graph method is adopted. By calculating the comprehensive weights between the device detection box and the text detection box, including spatial distance weight, semantic relevance weight and position weight, a weight matrix is constructed and converted into a cost matrix. The Hungarian algorithm is used to solve the minimum weight matching problem to determine the best matching relationship between the device and the text.
It significantly improves the accuracy of equipment text matching in plant wiring diagrams, and can provide globally optimal mathematical model solutions in complex real-world drawings, reducing matching errors.
Smart Images

Figure CN122135388A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of plant wiring diagram technology, and in particular to a method, system, device and storage medium for matching equipment text in plant wiring diagrams. Background Technology
[0002] In current graphic device and text matching processes, the "spatial nearest distance" method is typically relied upon. This method generally works for idealized, standardized drawings, but it often leads to matching errors when faced with complex and varied real-world drawings, especially those containing hand-drawn or digitized errors. Summary of the Invention
[0003] In view of this, the purpose of the present invention is to overcome the shortcomings of the prior art and provide a method, system, device and storage medium for matching text in plant wiring diagrams.
[0004] This invention provides the following technical solution: In a first aspect, the present invention provides a method for matching equipment text in a plant wiring diagram, the method comprising: Obtain the equipment inspection results and text inspection results of the plant wiring diagram; Based on the weighted bipartite graph, the equipment detection results and the text detection results are matched to obtain the comprehensive weight of all equipment text pairs in the plant wiring diagram. Construct a weight matrix based on the comprehensive weights, and then convert the weight matrix into a cost matrix; Solving the cost matrix yields the optimal device-text matching relationship between the device detection result and the text detection result.
[0005] In an optional implementation, the device detection result includes n device detection boxes and their corresponding detection box parameters, and the text detection result includes m text detection boxes and their corresponding detection box parameters, 1≤i≤n, 1≤j≤m; The method of performing equipment text matching based on the weighted bipartite graph of the equipment detection results and the text detection results yields the comprehensive weight of all equipment text pairs in the plant wiring diagram, including: Based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box, calculate the nearest distance between the i-th device detection box and the j-th text detection box; The spatial distance weight between the i-th device detection box and the j-th text detection box is determined based on the nearest distance. Based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box, the semantic association weight between the i-th device detection box and the j-th text detection box is obtained; Based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box, determine the position weights of the i-th device detection box and the j-th text detection box; The combined weight of the i-th device detection box and the j-th text detection box is obtained by weighted summation of the spatial distance weight, semantic relevance weight, and position weight.
[0006] In an optional implementation, calculating the nearest distance between the i-th device detection box and the j-th text detection box based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box includes: Based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box, determine the candidate edges corresponding to the i-th device detection box and the candidate edges corresponding to the j-th text detection box; Determine whether the candidate edge corresponding to the i-th device detection box intersects with the candidate edge of the j-th text detection box; If they intersect, the closest distance between the i-th device detection box and the j-th text detection box is 0; If they do not intersect, then obtain the relative projection overlap relationship between the candidate edge corresponding to the i-th device detection box and the candidate edge of the j-th text detection box; Determine whether the relative projection overlap relationship is an overlap; If they do not overlap, the closest distance between the i-th device detection box and the j-th text detection box is obtained by calculating the perpendicular distance between the candidate edge corresponding to the i-th device detection box and the candidate edge corresponding to the j-th text detection box. If they overlap, the endpoint distance between the candidate edges corresponding to the i-th device detection box and the j-th text detection box is calculated to obtain the shortest distance between the i-th device detection box and the j-th text detection box.
[0007] In an optional implementation, determining the spatial distance weight between the i-th device detection box and the j-th text detection box based on the nearest distance includes: Based on the diagonal length of the plant wiring diagram, the nearest distance between the i-th device detection box and the j-th text detection box is normalized to obtain the spatial distance weight between the i-th device detection box and the j-th text detection box.
[0008] In an optional implementation, obtaining the semantic association weight between the i-th device detection box and the j-th text detection box based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box includes: Based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box, perform device type keyword matching, text character composition preference analysis, and text length preference analysis to obtain the degree of correlation between the device type corresponding to the i-th device detection box and the text content corresponding to the j-th text detection box; The semantic correlation weight between the i-th device detection box and the j-th text detection box is determined based on the preset basic correlation weight and the correlation degree.
[0009] In an optional implementation, determining the positional weights of the i-th device detection box and the j-th text detection box based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box includes: Based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box, determine the device detection box positional relationship between the i-th device detection box and the j-th text detection box; Based on preset device type priority and preset device text label position preference, a weight is assigned to the positional relationship between the i-th device detection box and the j-th text detection box to obtain the positional weights of the i-th device detection box and the j-th text detection box.
[0010] In an optional implementation, solving the cost matrix to obtain the optimal device-text matching relationship between the device detection result and the text detection result includes: The cost matrix is subjected to minimum weight matching based on the Hungarian algorithm to determine the text detection boxes corresponding to the n device detection boxes, which are taken as the best matching relationship of the device text.
[0011] Secondly, the present invention provides a plant wiring diagram equipment text matching system, the system comprising: The acquisition module is used to acquire equipment inspection results and text inspection results of the plant wiring diagram; The matching module is used to perform equipment text matching based on the equipment detection results and the text detection results in the weighted bipartite graph to obtain the comprehensive weight of all equipment text pairs in the plant wiring diagram; The construction module is used to construct a weight matrix based on the comprehensive weights and convert the weight matrix into a cost matrix; The solution module is used to solve the cost matrix to obtain the optimal matching relationship between the device detection result and the text detection result.
[0012] Thirdly, the present invention provides a computer device including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, it implements the plant wiring diagram equipment text matching method as described in any of the foregoing embodiments.
[0013] Fourthly, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the plant wiring diagram equipment text matching method as described in any of the foregoing embodiments.
[0014] This invention discloses a method, system, device, and storage medium for matching equipment and text in plant wiring diagrams. The method acquires equipment detection results and text detection results from the plant wiring diagram. Based on a weighted bipartite graph, it performs equipment-text matching on the equipment detection results and text detection results to obtain the comprehensive weight of all equipment-text pairs in the plant wiring diagram. A weight matrix is constructed based on the comprehensive weight, and the weight matrix is converted into a cost matrix. The cost matrix is solved to obtain the optimal equipment-text matching relationship between the equipment detection results and the text detection results. Thus, based on the optimal matching scheme of a weighted bipartite graph, the association between equipment and text is transformed from a problem based on a single heuristic rule into a robust, quantifiable mathematical model problem that pursues global optimization, significantly improving matching accuracy when dealing with complex real-world diagrams. Attached Figure Description
[0015] To more clearly illustrate the technical solution of the present invention, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope of protection of the present invention. In the various drawings, similar components are numbered similarly.
[0016] Figure 1 This embodiment shows a flowchart of the plant wiring diagram equipment text matching method proposed in this embodiment; Figure 2 This illustration shows a schematic diagram of primitive text matching proposed in this embodiment; Figure 3 This illustration shows another flowchart of the plant wiring diagram equipment text matching method proposed in this embodiment; Figure 4 A schematic diagram of the device detection box and text detection box proposed in this embodiment is shown; Figure 5A schematic diagram of the plant wiring diagram equipment text matching system proposed in this embodiment is shown.
[0017] Explanation of reference numerals in the attached diagram: 500 - Plant Wiring Diagram Equipment Text Matching System; 501 - Acquisition Module; 502 - Matching Module; 503 - Construction Module; 504 - Solving Module. Detailed Implementation
[0018] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0019] The components of the embodiments of the invention described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0020] In the following, the terms “comprising,” “having,” and their cognates, which may be used in various embodiments of the invention, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as excluding, firstly, the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations thereof.
[0021] Furthermore, the terms "first," "second," and "third" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.
[0022] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of the invention pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be interpreted as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of the invention.
[0023] Example 1 This disclosure provides a method for matching equipment text in a plant wiring diagram.
[0024] Please see Figure 1The method for matching the wiring diagram equipment text in this plant includes steps S101 to S104, and each step is described in detail below.
[0025] Step S101: Obtain the equipment detection results and text detection results of the plant wiring diagram.
[0026] In this embodiment, the equipment detection results and text detection results obtained in advance through target detection are acquired from the plant wiring diagram. The equipment detection results include the coordinates of the equipment detection box and the equipment type, and the text detection results include the coordinates of the text detection box and the text content. Step S102: Based on the weighted bipartite graph, the equipment detection results and the text detection results are used for equipment-text matching to obtain the comprehensive weight of all equipment-text pairs in the plant wiring diagram.
[0027] In this embodiment, a weighted bipartite graph is used to treat the equipment detection results and text detection results as two independent sets in the bipartite graph, and the weight between the two is calculated by matching the equipment and text to obtain the comprehensive weight of all equipment and text pairs in the plant wiring diagram, thereby significantly improving the matching accuracy.
[0028] For example, a bipartite graph is represented as: , This means that all device detection boxes are considered as the set of vertices on one side of a bipartite graph. ; This means that all text detection boxes are considered as the set of vertices on the other side of a bipartite graph. ; This means establishing an edge between each device vertex and each text vertex, and assigning a comprehensive weight score to that edge.
[0029] If the relationship between device detection results and text detection results is matched based on the nearest distance method, the position of the text annotation may not be close to the device it describes due to layout crowding, drawing habits, or minor errors; a number that should belong to a more distant device may be accidentally "close" to another unrelated device on the drawing due to position offset during drawing, thus causing the text box to be incorrectly bound to the device box.
[0030] For example, see Figure 2 When matching the association between graph element d and text a, since text a is spatially closer to graph element c, the matching algorithm that relies solely on distance will match a and c, resulting in an incorrect association.
[0031] Please see Figure 3In one specific embodiment, the device detection result includes n device detection boxes and their corresponding detection box parameters, and the text detection result includes m text detection boxes and their corresponding detection box parameters, 1≤i≤n, 1≤j≤m; step S102 includes steps S1021~S1025, and each step is described in detail below.
[0032] Step S1021: Calculate the closest distance between the i-th device detection box and the j-th text detection box based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box.
[0033] In this embodiment, the detection box parameters corresponding to the device detection box include the device detection box coordinates and the device type, and the detection box parameters corresponding to the text detection box include the text detection box coordinates and the text content.
[0034] Calculate the shortest distance between the i-th device detection box and the j-th text detection box based on the detection box parameters corresponding to the i-th device detection box and the j-th text detection box.
[0035] It is understandable that the line segment corresponding to the shortest distance between two rectangles must have its two endpoints located on the edges of the two rectangles respectively. Therefore, the problem can be transformed into finding the minimum distance min_dist between any two edges of a rectangle.
[0036] Specifically, based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box, candidate edges corresponding to the i-th device detection box and the j-th text detection box are determined. Among them, the two candidate edges are the nearest neighbors.
[0037] For example, see Figure 4 For the device detection box (A1A2A3A4) corresponding to device A and the text detection box (B1B2B3B4) corresponding to text B, A1A4 and B2B3 are the corresponding candidate edges; for the device detection box (A1A2A3A4) corresponding to device A and the text detection box (C1C2C3C4) corresponding to text C, A1A4 and C2C3 are the corresponding candidate edges; for the device detection box (A1A2A3A4) corresponding to device A and the text detection box (D1D2D3D4) corresponding to text D, A2A3 and D1D3 are the corresponding candidate edges.
[0038] Furthermore, determine whether the candidate edge corresponding to the i-th device detection box intersects with the candidate edge of the j-th text detection box.
[0039] If they intersect, the closest distance between the i-th device detection box and the j-th text detection box is 0.
[0040] If they do not intersect, obtain the relative projection overlap relationship between the candidate edge corresponding to the i-th device detection box and the candidate edge of the j-th text detection box, and determine whether the relative projection overlap relationship is an overlap.
[0041] If they do not overlap, the perpendicular distance between the candidate edges of the i-th device detection box and the j-th text detection box is calculated using the point-to-line perpendicular distance. This yields the shortest distance between the i-th device detection box and the j-th text detection box. For example, Figure 3 The shortest distance between the device detection box (A1A2A3A4) corresponding to device A and the text detection box (C1C2C3C4) corresponding to text C is the vertical distance (dashed line length) from A1 to C2C3. The shortest distance between the device detection box (A1A2A3A4) corresponding to device A and the text detection box (D1D2D3D4) corresponding to text D is the vertical distance (dashed line length) from D3 to A2A3.
[0042] If there is overlap, the endpoint distance between the candidate edges corresponding to the i-th device detection box and the candidate edges of the j-th text detection box is calculated to obtain the nearest distance between the i-th device detection box and the j-th text detection box. For example, the nearest distance between the device detection box (A1A2A3A4) corresponding to device A and the text detection box (B1B2B3B4) corresponding to text B is the distance between A4B2.
[0043] Step S1022: Determine the spatial distance weight between the i-th device detection box and the j-th text detection box based on the nearest distance.
[0044] In this embodiment, the spatial distance weight between the i-th device detection box and the j-th text detection box is determined based on the nearest distance. Specifically, the nearest distance between the i-th device detection box and the j-th text detection box is normalized based on the diagonal length of the plant wiring diagram image to obtain the spatial distance weight between the i-th device detection box and the j-th text detection box. For example, the spatial distance weight... The calculation formula is: = In the formula, max_distance is the length of the image diagonal.
[0045] Understandably, by introducing the image diagonal length as a normalization benchmark, the spatial distance weights can be made to adapt to the drawing scaling ratio, completely eliminating the problem of absolute distance threshold failure caused by differences in scanning resolution and PDF export scaling, and ensuring the consistency of drawing matching across projects and eras.
[0046] Step S1023: Based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box, obtain the semantic association weight between the i-th device detection box and the j-th text detection box.
[0047] In this embodiment, based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box, semantic association analysis is performed on the device information corresponding to the i-th device detection box and the text information corresponding to the j-th text detection box to obtain the semantic association weight between the i-th device detection box and the j-th text detection box.
[0048] Specifically, based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box, device type keyword matching, text character composition preference analysis, and text length preference analysis are performed to obtain the degree of association between the device type corresponding to the i-th device detection box and the text content corresponding to the j-th text detection box; the preset basic association weight is adjusted according to the degree of association to obtain the semantic association weight between the i-th device detection box and the j-th text detection box.
[0049] As an example, keyword matching based on device type can be performed, text character composition preference analysis can be conducted based on the preference and exclusion regular expressions corresponding to device type, and text length preference analysis can be performed based on the character length preference range corresponding to device type. For example, if the text contains matching keywords corresponding to device type, the relevance is high, and a higher weight can be assigned on top of the preset basic relevance weight. If the text conforms to the naming pattern of device number, model, and device number length, and has a logical correspondence with the device type, the relevance is also high, and additional points can be awarded on top of the preset basic relevance weight. The matching keywords, preference regular expressions, exclusion regular expressions, and character length preference range corresponding to device type are shown in Table 1. Table 1:
[0050] Understandably, by dynamically matching device type keywords with text content and superimposing preference modeling on text character composition and length, semantic weights can identify and suppress common interference items, such as figure titles, legends, and irrelevant annotations, thereby reducing the semantic mismatch rate.
[0051] Step S1024: Determine the position weights of the i-th device detection box and the j-th text detection box based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box.
[0052] In this embodiment, the positional priors of the label positions set by different devices are used to analyze the detection box parameters corresponding to the i-th device detection box and the j-th text detection box to determine the positional weights of the i-th device detection box and the j-th text detection box.
[0053] Specifically, based on the detection box parameters corresponding to the i-th device detection box and the j-th text detection box, the positional relationship between the i-th device detection box and the j-th text detection box is determined. Based on the preset device type priority and preset device text label position preference, the positional relationship between the i-th device detection box and the j-th text detection box is weighted. After adjusting the preset basic weights, the positional weights of the i-th device detection box and the j-th text detection box are obtained.
[0054] It should be noted that a preset device type priority is introduced, assigning priority weights to different device types to ensure that when the number of text box detection results is less than the number of device elements, the most important device can obtain its corresponding text information first. In addition, a preset device text label position preference is introduced. For example, the labels of some devices (such as "circuit breaker") are usually located on the left and right sides, while the labels of some devices (such as "capacitor" and "reactor") may be located on the top and bottom sides.
[0055] Exemplary examples of device type prioritization and device text label position preferences are shown in Table 2: Table 2:
[0056] Step S1025: The combined weight of the i-th device detection box and the j-th text detection box is obtained by weighted summation of the spatial distance weight, semantic relevance weight and position weight.
[0057] In this embodiment, the spatial distance weight, semantic relevance weight, and positional weight between the i-th device detection box and the j-th text detection box are weighted and summed to obtain the comprehensive weight of the i-th device detection box and the j-th text detection box. The calculation expression is: In the formula, For the i-th device detection frame, For the j-th text detection box, For semantic relevance weights, For positional weights, The weighting coefficients of each component are hyperparameters. .
[0058] Understandably, by integrating the three heterogeneous features of space, semantics, and location into a single comprehensive weight, the constructed weighted bipartite graph takes into account geometric rationality, linguistic rationality, and engineering standardization, thus solving the fundamental defect of single-dimensional matching in complex drawings that fails to address all aspects and improving the overall matching accuracy.
[0059] Step S103: Construct a weight matrix based on the comprehensive weights, and convert the weight matrix into a cost matrix.
[0060] In this embodiment, the combined weights of all device text pairs are integrated into a weight matrix. Furthermore, the weight matrix Convert to cost matrix Cost matrix The expression is: .
[0061] Step S104: Solve the cost matrix to obtain the best matching relationship between the device detection result and the text detection result.
[0062] In this embodiment, the cost matrix is solved to obtain the best matching relationship between the device detection result and the text detection result, that is, the best matching text detection box corresponding to the i-th device detection box.
[0063] In one specific embodiment, step S104 includes: performing minimum weight matching on the cost matrix based on the Hungarian algorithm to determine the text detection boxes corresponding to the n device detection boxes respectively, which are the best matching relationships of the device text.
[0064] In this embodiment, the cost matrix is matched with minimum weight using the Hungarian algorithm to determine the text detection boxes corresponding to the n device detection boxes, which serve as the best matching relationship between the device and the text. This provides a mathematically provable global optimal solution and avoids the local optimum trap of greedy matching.
[0065] The plant wiring diagram equipment text matching method proposed in this embodiment obtains the equipment detection results and text detection results of the plant wiring diagram; performs equipment text matching on the equipment detection results and text detection results based on a weighted bipartite graph to obtain the comprehensive weight of all equipment text pairs in the plant wiring diagram; constructs a weight matrix based on the comprehensive weight, and converts the weight matrix into a cost matrix; solves the cost matrix to obtain the optimal equipment text matching relationship between the equipment detection results and the text detection results. Thus, based on the optimal matching scheme of a weighted bipartite graph, the association between equipment and text is transformed from a rule problem based on a single heuristic into a robust, quantifiable mathematical model problem that pursues global optimization, significantly improving matching accuracy when dealing with complex real-world drawings.
[0066] Example 2 Furthermore, this disclosure provides a plant wiring diagram equipment text matching system 500, please refer to [link to relevant documentation]. Figure 5 ,include: Module 501 is used to acquire the equipment detection results and text detection results of the plant wiring diagram; The matching module 502 is used to perform equipment text matching on the equipment detection results and the text detection results based on the weighted bipartite graph to obtain the comprehensive weight of all equipment text pairs in the plant wiring diagram; Construction module 503 is used to construct a weight matrix based on the comprehensive weights and convert the weight matrix into a cost matrix; The solution module 504 is used to solve the cost matrix to obtain the optimal device-text matching relationship between the device detection result and the text detection result.
[0067] In an optional implementation, the device detection result includes n device detection boxes and their corresponding detection box parameters, and the text detection result includes m text detection boxes and their corresponding detection box parameters, 1≤i≤n, 1≤j≤m; the matching module 502 is further configured to calculate the nearest distance between the i-th device detection box and the j-th text detection box based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box; determine the spatial distance weight between the i-th device detection box and the j-th text detection box based on the nearest distance; and determine the spatial distance weight between the i-th device detection box and the j-th text detection box based on the i-th device detection box... The semantic relevance weight between the i-th device detection box and the j-th text detection box is obtained by comparing the corresponding detection box parameters with those of the j-th text detection box. The positional weight between the i-th device detection box and the j-th text detection box is determined based on the detection box parameters of the i-th device detection box and the j-th text detection box. Finally, the combined weight between the i-th device detection box and the j-th text detection box is obtained by weighted summing the spatial distance weight, semantic relevance weight, and positional weight.
[0068] In an optional implementation, the matching module 502 is further configured to determine the candidate edge corresponding to the i-th device detection box and the candidate edge of the j-th text detection box based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box; determine whether the candidate edge corresponding to the i-th device detection box and the candidate edge of the j-th text detection box intersect; if they intersect, the shortest distance between the i-th device detection box and the j-th text detection box is 0; if they do not intersect, the shortest distance between the candidate edge corresponding to the i-th device detection box and the candidate edge of the j-th text detection box is obtained. The relative projection overlap relationship between the candidate edges of this detection box is determined; if the relative projection overlap relationship is not an overlap, the point-to-line perpendicular distance is calculated based on the candidate edge corresponding to the i-th device detection box and the candidate edge of the j-th text detection box to obtain the shortest distance between the i-th device detection box and the j-th text detection box; if the overlap is, the endpoint distance is calculated based on the candidate edge corresponding to the i-th device detection box and the candidate edge of the j-th text detection box to obtain the shortest distance between the i-th device detection box and the j-th text detection box.
[0069] In an optional implementation, the matching module 502 is further configured to normalize the nearest distance between the i-th device detection box and the j-th text detection box based on the length of the image diagonal of the plant wiring diagram, so as to obtain the spatial distance weight between the i-th device detection box and the j-th text detection box.
[0070] In an optional implementation, the matching module 502 is further configured to perform device type keyword matching, text character composition preference analysis, and text length preference analysis based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box, to obtain the degree of association between the device type corresponding to the i-th device detection box and the text content corresponding to the j-th text detection box; and to determine the semantic association weight between the i-th device detection box and the j-th text detection box based on the preset basic association weight and the degree of association.
[0071] In an optional implementation, the matching module 502 is further configured to determine the device detection box positional relationship between the i-th device detection box and the j-th text detection box based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box; and to assign weights to the device detection box positional relationship between the i-th device detection box and the j-th text detection box based on preset device type priority and preset device text label position preference, thereby obtaining the positional weights of the i-th device detection box and the j-th text detection box.
[0072] In an optional implementation, the solution module 504 is further configured to perform minimum weight matching on the cost matrix based on the Hungarian algorithm to determine the text detection boxes corresponding to the n device detection boxes respectively, as the best matching relationship of the device text.
[0073] The system provided in this embodiment can execute the steps of the plant wiring diagram equipment text matching method provided in Embodiment 1. To avoid repetition, the steps will not be repeated.
[0074] The plant wiring diagram equipment text matching method proposed in this embodiment obtains the equipment detection results and text detection results of the plant wiring diagram; performs equipment text matching on the equipment detection results and text detection results based on a weighted bipartite graph to obtain the comprehensive weight of all equipment text pairs in the plant wiring diagram; constructs a weight matrix based on the comprehensive weight, and converts the weight matrix into a cost matrix; solves the cost matrix to obtain the optimal equipment text matching relationship between the equipment detection results and the text detection results. Thus, based on the optimal matching scheme of a weighted bipartite graph, the association between equipment and text is transformed from a rule problem based on a single heuristic into a robust, quantifiable mathematical model problem that pursues global optimization, significantly improving matching accuracy when dealing with complex real-world drawings.
[0075] Example 3 Furthermore, this disclosure provides a computer device including a memory and a processor. The memory stores a computer program, which, when executed by the processor, implements the plant wiring diagram equipment text matching method described in Embodiment 1.
[0076] The device provided in this embodiment can execute the steps of the plant wiring diagram device text matching method provided in Embodiment 1. To avoid repetition, the steps will not be repeated.
[0077] Example 4 This disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the plant wiring diagram equipment text matching method described in Embodiment 1.
[0078] In this embodiment, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0079] The computer-readable storage medium provided in this embodiment can implement the plant wiring diagram equipment text matching method provided in Embodiment 1. To avoid repetition, it will not be described again here.
[0080] In all examples shown and described herein, any specific values should be interpreted as merely exemplary and not as limitations; therefore, other examples of exemplary embodiments may have different values.
[0081] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0082] The above-described embodiments are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention.
Claims
1. A method for matching equipment text in plant wiring diagrams, characterized in that, The method includes: Obtain the equipment inspection results and text inspection results of the plant wiring diagram; Based on the weighted bipartite graph, the equipment detection results and the text detection results are matched to obtain the comprehensive weight of all equipment text pairs in the plant wiring diagram. Construct a weight matrix based on the comprehensive weights, and then convert the weight matrix into a cost matrix; Solving the cost matrix yields the optimal device-text matching relationship between the device detection result and the text detection result.
2. The plant wiring diagram equipment text matching method according to claim 1, characterized in that, The device detection result includes n device detection boxes and their corresponding detection box parameters, and the text detection result includes m text detection boxes and their corresponding detection box parameters, 1≤i≤n, 1≤j≤m; The method of performing equipment text matching based on the weighted bipartite graph of the equipment detection results and the text detection results yields the comprehensive weight of all equipment text pairs in the plant wiring diagram, including: Based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box, calculate the nearest distance between the i-th device detection box and the j-th text detection box; The spatial distance weight between the i-th device detection box and the j-th text detection box is determined based on the nearest distance. Based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box, the semantic association weight between the i-th device detection box and the j-th text detection box is obtained; Based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box, determine the position weights of the i-th device detection box and the j-th text detection box; The combined weight of the i-th device detection box and the j-th text detection box is obtained by weighted summation of the spatial distance weight, semantic relevance weight, and position weight.
3. The plant wiring diagram equipment text matching method according to claim 2, characterized in that, The step of calculating the nearest distance between the i-th device detection box and the j-th text detection box based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box includes: Based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box, determine the candidate edges corresponding to the i-th device detection box and the candidate edges corresponding to the j-th text detection box; Determine whether the candidate edge corresponding to the i-th device detection box intersects with the candidate edge of the j-th text detection box; If they intersect, the closest distance between the i-th device detection box and the j-th text detection box is 0; If they do not intersect, then obtain the relative projection overlap relationship between the candidate edge corresponding to the i-th device detection box and the candidate edge of the j-th text detection box; Determine whether the relative projection overlap relationship is an overlap; If they do not overlap, the closest distance between the i-th device detection box and the j-th text detection box is obtained by calculating the perpendicular distance between the candidate edge corresponding to the i-th device detection box and the candidate edge corresponding to the j-th text detection box. If they overlap, the endpoint distance between the candidate edges corresponding to the i-th device detection box and the j-th text detection box is calculated to obtain the shortest distance between the i-th device detection box and the j-th text detection box.
4. The plant wiring diagram equipment text matching method according to claim 2, characterized in that, The step of determining the spatial distance weight between the i-th device detection box and the j-th text detection box based on the nearest distance includes: Based on the diagonal length of the plant wiring diagram, the nearest distance between the i-th device detection box and the j-th text detection box is normalized to obtain the spatial distance weight between the i-th device detection box and the j-th text detection box.
5. The plant wiring diagram equipment text matching method according to claim 2, characterized in that, The step of obtaining the semantic association weight between the i-th device detection box and the j-th text detection box based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box includes: Based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box, perform device type keyword matching, text character composition preference analysis, and text length preference analysis to obtain the degree of correlation between the device type corresponding to the i-th device detection box and the text content corresponding to the j-th text detection box; The semantic correlation weight between the i-th device detection box and the j-th text detection box is determined based on the preset basic correlation weight and the correlation degree.
6. The plant wiring diagram equipment text matching method according to claim 2, characterized in that, The step of determining the position weights of the i-th device detection box and the j-th text detection box based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box includes: Based on the detection box parameters corresponding to the i-th device detection box and the detection box parameters corresponding to the j-th text detection box, determine the device detection box positional relationship between the i-th device detection box and the j-th text detection box; Based on preset device type priority and preset device text label position preference, a weight is assigned to the positional relationship between the i-th device detection box and the j-th text detection box to obtain the positional weights of the i-th device detection box and the j-th text detection box.
7. The plant wiring diagram equipment text matching method according to claim 2, characterized in that, Solving the cost matrix to obtain the optimal device-text matching relationship between the device detection result and the text detection result includes: The cost matrix is subjected to minimum weight matching based on the Hungarian algorithm to determine the text detection boxes corresponding to the n device detection boxes, which are taken as the best matching relationship of the device text.
8. A plant wiring diagram equipment text matching system, characterized in that, The system includes: The acquisition module is used to acquire equipment inspection results and text inspection results of the plant wiring diagram; The matching module is used to perform equipment text matching based on the equipment detection results and the text detection results in the weighted bipartite graph to obtain the comprehensive weight of all equipment text pairs in the plant wiring diagram; The construction module is used to construct a weight matrix based on the comprehensive weights and convert the weight matrix into a cost matrix; The solution module is used to solve the cost matrix to obtain the optimal matching relationship between the device detection result and the text detection result.
9. A computer device, characterized in that, It includes a memory and a processor, the memory storing a computer program that, when executed by the processor, implements the plant wiring diagram equipment text matching method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the plant wiring diagram equipment text matching method as described in any one of claims 1 to 7.