Connector restoration method, device, electronic device and storage medium for structure diagram

By performing line detection and structure recognition on the structure diagram, combined with pattern unit matching, the connector path is automatically restored, which solves the problem of low connector restoration efficiency in the structure diagram in the existing technology and achieves efficient connector path restoration.

CN114155160BActive Publication Date: 2024-10-18BEIJING SOGOU TECHNOLOGY DEVELOPMENT CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202111274776.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-29
Publication Date
2024-10-18
Estimated Expiration
2041-10-29

AI Technical Summary

Technical Problem

When the structure diagram is displayed in the form of a picture, the efficiency of obtaining the connector connection relationship between the graphics devices in the image is low and manual operations are required, resulting in inefficient restoration paths.

Method used

By performing line detection and structure recognition on the target structure picture, the lines and connection points are obtained, combined with the pattern unit for matching, the connector path is automatically restored, and the line detection method and pattern recognition model are used for identification and matching.

Benefits of technology

The accuracy and efficiency of the structure diagram connector restoration path are improved, and the automated connector restoration process is realized.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114155160B_ABST
    Figure CN114155160B_ABST
Patent Text Reader

Abstract

The present invention discloses a connector restoration method for a structure diagram, which performs line detection on a target structure image, obtains m lines and n connection points corresponding to the m lines, performs structural recognition on the target structure image, and identifies k graphic unit units in the target structure image; the m lines, the n connection points, and the k graphic unit units are matched to obtain a connector restoration path for the target structure image. The connector restoration method, device, and electronic device for a structure diagram disclosed by the present invention can automatically restore the connector restoration path in the structure image and can improve the restoration efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a connector restoration method, device and electronic equipment for a structure diagram. Background Art

[0002] With the rapid development of Internet technology, in order to improve the display effect, various structural diagrams are usually displayed in the form of pictures to provide users with a better experience.

[0003] However, when the structure diagram is displayed in the form of a picture, if it is necessary to obtain the connection relationship between connectors such as lines between various graphic devices in the image, manual operation is required according to the connectors displayed in the picture, resulting in extremely low restoration efficiency of the connector restoration path.

[0004] Therefore, a method for restoring the connector restoration path in the image is urgently needed. Summary of the invention

[0005] The embodiments of the present invention provide a method, device and electronic device for restoring connectors in a structure diagram, which can automatically restore the connector restoration path in the structure diagram and improve the restoration efficiency.

[0006] A first aspect of an embodiment of the present invention provides a connector restoration method for a structure diagram, the method comprising:

[0007] Perform line detection on the target structure image to obtain m lines and n connection points corresponding to the m lines, where m and n are both positive integers;

[0008] Performing structural recognition on the target structure picture to identify k graphic unit units in the target structure picture, where k is a positive integer;

[0009] The m lines, the n connection points and the k graphics units are matched to obtain a connector restoration path of the target structure image.

[0010] Optionally, performing line detection on the target structure image to obtain m lines and n connection points corresponding to the m lines includes:

[0011] Using a line detection method to perform line recognition on the target structure image, and recognize the m lines;

[0012] Connecting point detection is performed on the m lines to obtain the n connecting points.

[0013] Optionally, after obtaining the n connection points, the method further includes:

[0014] Classify and detect the n connection points to obtain the type of each connection point in the n connection points.

[0015] Optionally, performing structural recognition on the target structure picture to identify k graphics units in the target structure picture includes:

[0016] The target structure image is subjected to structural recognition by using a pre-trained graphic device recognition model to identify the k graphic device units, wherein each graphic device unit includes a graphic device shape and a graphic device position.

[0017] Optionally, the step of training the graphic recognition model includes:

[0018] Acquire a training sample set, wherein each training sample in the training sample set includes a training structure picture and graphic annotation information in the training structure picture, wherein the graphic annotation information includes a graphic device shape and a graphic device position;

[0019] Model training is performed using each training structure picture and the graphic annotation information in each training structure picture to obtain the graphic recognition model.

[0020] Optionally, matching the m lines, the n connection points, and the k graphics units to obtain a connector restoration path of the target structure image includes:

[0021] According to the distance relationship between the m lines and the n connection points, obtaining a line-point connection relationship between the m lines and the n connection points;

[0022] According to the positional relationship between the n connection points and the k graphic devices, obtaining a graph point connection relationship between the n connection points and the k graphic devices;

[0023] According to the type of each connection point, the line-point connection relationship and the graph-point connection relationship, a connection path consisting of the m lines and the n connection points is obtained, and the connection path is used as the connector restoration path.

[0024] Optionally, acquiring the connection path consisting of the m lines and the n connection points according to the type of each connection point, the line-point connection relationship, and the graph-point connection relationship includes:

[0025] According to the type of each connection point, the line-point connection relationship and the graph-point connection relationship, an undirected graph consisting of the m lines and the n connection points is obtained;

[0026] A path selection algorithm is used to perform path selection on the undirected graph to obtain a processed undirected graph, and the processed undirected graph is used as the connection path.

[0027] A second aspect of an embodiment of the present invention further provides a connector restoration device for a structure diagram, the device comprising:

[0028] A line detection unit is used to perform line detection on the target structure image to obtain m lines and n connection points corresponding to the m lines, wherein m and n are both positive integers;

[0029] A structure recognition unit, used to perform structure recognition on the target structure picture, and identify k graphic units in the target structure picture, where k is a positive integer;

[0030] A matching unit is used to match the m lines, the n connection points and the k graphic units to obtain a connector restoration path of the target structure image.

[0031] Optionally, the line detection unit is used to perform line recognition on the target structure image using a line detection method to identify the m lines; and perform connection point detection on the m lines to obtain the n connection points.

[0032] Optionally, also include:

[0033] The connection point classification unit is used to classify and detect the n connection points after obtaining the n connection points, so as to obtain the type of each connection point in the n connection points.

[0034] A third aspect of an embodiment of the present invention provides an electronic device, comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to execute operation instructions corresponding to the connector restoration method for performing the structure diagram provided in the first aspect.

[0035] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps corresponding to the connector restoration method of the structure diagram provided in the first aspect.

[0036] The above one or at least one technical solution in the embodiments of the present application has at least the following technical effects:

[0037] Based on the above technical solution, line detection is performed on the target structure image to obtain m lines and n connection points corresponding to the m lines; structure recognition is performed on the target structure image to identify k graphic device units in the target structure image; matching is performed based on the m lines, the n connection points and the k graphic device units to obtain the connector restoration path of the target structure image. It can be seen that the n connection points can be matched with the m lines, and then the connection relationship between the m lines and the k graphic devices can be determined based on the positional relationship between the n connection points and the k graphic devices. Then, the path of the connector of the target structure image is restored based on the connection relationship to obtain the connector restoration path, thereby ensuring the accuracy and efficiency of restoration. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 A schematic flow chart of a connector restoration method for a structure diagram provided in an embodiment of the present application;

[0039] Figure 2 A flowchart of the steps of training a graphics recognition model provided in an embodiment of the present application;

[0040] Figure 3a A schematic diagram of a structure for identifying m lines in a target structure image provided by an embodiment of the present application;

[0041] Figure 3b A structural schematic diagram of identifying n connection points in a target structure image provided by an embodiment of the present application;

[0042] Figure 3c A schematic diagram of a structure for identifying k graphic units in a target structure picture provided by an embodiment of the present application;

[0043] Figure 3d A schematic diagram of the structure of a connector restoration path provided in an embodiment of the present application;

[0044] Figure 4 A block diagram of a connector restoration device of a structural diagram provided in an embodiment of the present application;

[0045] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0046] The main implementation principles, specific implementation methods and corresponding beneficial effects of the technical solutions of the embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0047] Example

[0048] Please refer to Figure 1, an embodiment of the present application provides a connector restoration method for a structure diagram, the method comprising:

[0049] S101, performing line detection on the target structure image to obtain m lines and n connection points corresponding to the m lines, where m and n are both positive integers;

[0050] S102, performing structural recognition on the target structure picture, identifying k graphic unit units in the target structure picture, where k is a positive integer;

[0051] S103, matching the m lines, the n connection points and the k graphics units to obtain a connector restoration path of the target structure image.

[0052] In the embodiments of the present specification, the target structure image may be an image including structure images such as flow charts and mind maps; the connector restoration method provided in the embodiments of the present specification may be applied in a server or in a user terminal, wherein the server may be, for example, a desktop computer, a laptop computer, an all-in-one machine, etc., and the user terminal may be, for example, a desktop computer, a laptop computer, an all-in-one machine, a tablet computer, a smart phone, etc.

[0053] In step S101, a target structure image is first obtained, and then a line detection method is used to identify lines in the target structure image. After m lines are identified, connection point detection is performed on the m lines to obtain n connection points. The line detection method may be, for example, a target detection method or an instance segmentation method, m may be, for example, a positive integer such as 1, 2, 4, and 6, and n may be, for example, a positive integer such as 1, 3, and 5. m and n may be the same or different.

[0054] When connection point detection is performed on m lines to obtain n connection points, all line intersections and turning points between the m lines can be obtained, and all the obtained line intersections and turning points are used as n connection points, wherein each of the n connection points can be a line intersection point, for example, when each graphic unit in the target structure image corresponds to only one line, each connection point is a line intersection point. Of course, the n connection points can also include both line intersection points and connection points.

[0055] Specifically, a line detection model can also be pre-trained, and then the line detection model is used to perform line detection on the target structure image to obtain m lines and n connection points. In this case, the training steps of the line detection model are as follows: obtain a training sample set, each training sample in the training sample set includes a training structure image, and line annotation information and connection point annotation information in the training structure image; use each training structure image, the line annotation information and connection point annotation information in each training structure image to perform model training to obtain a line detection model. In this way, after the line detection model is trained, the target structure image can be directly input into the line detection model to obtain m lines and n connection points.

[0056] Furthermore, after obtaining n connection points, the n connection points can be classified and detected to obtain the type of each of the n connection points. In this case, a classification model can be trained, and after obtaining n connection points through the line detection model, each connection point is input into the classification model to obtain the type of each connection point.

[0057] Of course, when obtaining the type of each connection point, the line detection model can also be used directly to obtain the type of each connection point when n connection points are obtained. At this time, the training steps of the line detection model are as follows: obtain a training sample set, each training sample in the training sample set includes a training structure image, and line annotation information and connection point annotation information in the training structure image, and the connection point annotation information includes the type of the connection point; use each training structure image, the line annotation information and the connection point annotation information in each training structure image to perform model training to obtain a line detection model. In this way, after the line detection model is trained, the target structure image can be directly input into the line detection model to obtain m lines and n connection points, where the n connection points include the type of each connection point.

[0058] In the embodiments of this specification, the types of connection points include starting points, turning points, and heading points such as arrows. Of course, the types of connection points can also be set according to actual needs, or can be set manually or by the device. Furthermore, the types of connection points are different, and the corresponding colors can also be set differently. For example, the color corresponding to the connection point of the starting point type is green, the color corresponding to the connection point of the turning point type is red, and the color corresponding to the connection point of the heading point type is yellow. Of course, the color corresponding to the type of connection point can be set according to actual needs, or can be set manually or by the device, and this specification does not make specific restrictions.

[0059] After obtaining m lines and n connection points, step S102 is executed.

[0060] In step S102, structure recognition is performed on the target structure image to identify k graphic units, where k can be a positive integer such as 1, 2, 4, or 6.

[0061] In the embodiments of this specification, step S102 may be executed simultaneously with step S101, or step S102 may be executed first and then step S101, etc.

[0062] Specifically, a graphic device recognition model can be pre-trained, and then the graphic device recognition model can be used to perform structural recognition on the target structure image, and all graphic device units in the target structure image can be identified as k graphic device units, wherein each graphic device unit includes a graphic device shape and a graphic device position, and each text box includes a text box position. Of course, image recognition technology can also be directly used to perform structural recognition on the target structure image to identify k graphic device units, and this specification does not make specific restrictions.

[0063] In the embodiments of this specification, each graphic unit also includes a graphic color corresponding to the graphic shape, for example, if the graphic shape is an ellipse, the graphic color is blue; if the graphic shape is a rectangle, the graphic color is green; and if the graphic shape is a diamond, the graphic color is yellow. Of course, the graphic shape and its corresponding color can be set according to actual needs, or can be set manually or by the device, and this specification does not make specific restrictions.

[0064] Therefore, before performing structural recognition on the target structure image, a graphic recognition model needs to be trained, see Figure 2 , the training steps of the graph recognition model include:

[0065] S201, obtaining a training sample set, wherein each training sample in the training sample set includes a training structure picture and graphic annotation information in the training structure picture, wherein the graphic annotation information includes a graphic device shape and a graphic device position;

[0066] Specifically, a large amount of image data of structural diagrams such as flowcharts and mind maps can be collected, and the graphic devices contained in each collected image data are annotated, and the shape and position of the graphic devices are annotated, so that the graphic mark information of each image data includes the shape and position of the graphic device. Of course, the color of the graphic device can also be annotated. In this case, the graphic annotation information of each image data also includes the color of the graphic. In this way, each collected image data and its corresponding annotation information are used as a training sample set.

[0067] S202: Perform model training using each training structure picture and the graphic annotation information in each training structure picture to obtain the graphic recognition model.

[0068] Specifically, an initial model can be set in advance, and the graphic feature vector of each training structure picture is used as input, and the graphic annotation information in each training structure picture is used as output. The initial model is trained until the trained model meets the constraint conditions, and the model that meets the constraint conditions is used as the graphic recognition model, so that the prediction accuracy of the graphic recognition model is high. The constraint conditions can be, for example, that the classification accuracy is not less than the set accuracy, etc. The set accuracy can be set according to actual needs, or it can be set by humans or the device itself, and the set accuracy can be, for example, 98% and 95%.

[0069] In the embodiments of this specification, the graphic recognition model can be, for example, a deep neural network (Deep Neural Networks, DNN for short), a convolutional neural network (Convolutional Neural Networks, CNN for short), a recurrent neural network (Recurrent Neural Networks, RNN for short), etc.

[0070] Thus, after the graphic device recognition model is trained, the graphic feature vector in the target structure picture is extracted, and the graphic feature vector in the target structure picture is input into the graphic device recognition model to obtain k graphic device units, wherein each graphic device unit includes a graphic device shape and a graphic device position. Since the graphic device recognition model obtained by training uses the graphic annotation information in each training structure picture as output, the prediction accuracy of the graphic device recognition model is high, and thus the accuracy of the predicted k graphic device units is also high.

[0071] After k graphics units are acquired, step S103 is executed.

[0072] In step S103, the m lines, n connection points and k graphics units may be directly connected according to the positions of the m lines, n connection points and k graphics units, thereby obtaining a connector restoration path of the target structure image.

[0073] Specifically, it is also possible to obtain the line-point connection relationship between the m lines and the n connection points based on the distance relationship between the m lines and the n connection points; and then obtain the graph-point connection relationship between the n connection points and the k graph devices based on the position relationship between the n connection points and the k graph devices; and obtain the connection path composed of the m lines and the n connection points based on the line-point connection relationship and the graph-point connection relationship, and use the connection path as the connector restoration path.

[0074] In the embodiments of the present specification, when the connection relationship of the graph points is obtained, the matching relationship between each connection point and each graphics unit can be obtained, and each connection point connected to the graphics unit can be obtained; in this way, according to the connection relationship between each connection point connected to the graphics unit and the line point, an undirected graph composed of m lines and each graphics unit is determined. At this time, the obtained undirected graph can be directly used as a connection path; or a path selection algorithm can be used to select a path for the undirected graph to obtain a processed undirected graph, and the processed undirected graph can be used as a connection path.

[0075] Specifically, after obtaining the type of each connection point, a connection path consisting of m lines and n connection points can be obtained according to the type of each connection point, the line-point connection relationship and the graph-point connection relationship, and the connection path can be used as a connector restoration path.

[0076] Furthermore, when obtaining a connection path consisting of m lines and n connection points according to the type of each connection point, the line-point connection relationship, and the graph-point connection relationship, an undirected graph consisting of m lines and n connection points can be obtained according to the type of each connection point, the line-point connection relationship, and the graph-point connection relationship; and then a path selection algorithm is used to perform path selection on the undirected graph to obtain a processed undirected graph, and the processed undirected graph is used as the connection path.

[0077] In the embodiments of this specification, the path selection algorithm may be a shortest path algorithm, an optimal path algorithm, or the like.

[0078] In the embodiments of the present specification, when the connection relationship of the graph points is obtained, the matching relationship between each connection point and each graphics unit can be obtained, and each connection point connected to the graphics unit can be obtained. Since the type of each connection point is obtained, the connection relationship between the connection point of the starting point type and the graphics unit can be determined, as well as the connection relationship between the connection point of the direction point type and the graphics unit can be determined; in this way, according to the connection relationship between each connection point connected to the graphics unit and the line point, an undirected graph consisting of m lines and each graphics unit is determined. At this time, the obtained undirected graph can be directly used as a connection path; or a path selection algorithm can be used to select a path for the undirected graph to obtain a processed undirected graph, and the processed undirected graph can be used as a connection path.

[0079] Due to the type of each connection point obtained, the connection relationship between the connection point of type starting point and the graphics unit can be determined, as well as the connection relationship between the connection point of type direction point and the graphics unit can be determined, so that the processed undirected graph can determine the connection relationship between the connection point of type starting point and the first graphics unit, and the connection relationship between the connection point of type direction point and the second graphics unit in each line. In this way, the connection relationship between the starting point and direction point of each line and the graphics unit can be restored, so that the processed undirected graph has a higher matching degree with the line path in the target structure image, and the accuracy of the connector restoration path obtained according to the processed undirected graph will also be higher, thereby effectively improving the accuracy and restoration efficiency of the connector restoration of the target structure image.

[0080] For example, see Figure 3a , Figure 3a The image 30 shown in the figure is the target structure image. Line detection is performed on the image 30 to obtain lines 301, 302, 303, 304, 305, 306 and 307 as m lines. Then all the intersection points and turning points between the lines are obtained as Figure 3b The connection points 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322 and 323 are regarded as n connection points, among which the types of connection points 311, 313, 315, 317, 319 and 321 are all starting points, the types of connection points 312, 314, 316, 318 and 323 are all arrows, and the types of connection points 320 and 322 are all turning points.

[0081] And, the structure of the image 30 is recognized by the graphic recognition model, and the Figure 3c The graphics unit 331, the graphics unit 332, the graphics unit 333, the graphics unit 334, the graphics unit 335 and the graphics unit 336 in are regarded as k graphics units.

[0082] Further, according to the type of each connection point, the line-point connection relationship and the graph-point connection relationship, an undirected graph consisting of m lines and n connection points is obtained; a path selection algorithm is used to select a path for the undirected graph to obtain a processed undirected graph, the processed undirected graph is used as a connection path, and then the connection path is output in a drawing tool such as Visio. Figure 3dAs shown, the connector restoration path of the picture 30 can be restored in the drawing tool, wherein the connector restoration path is the same as the connector path in the picture 30, thereby achieving the technical effect of restoring the connector path in the picture 30.

[0083] The above one or at least one technical solution in the embodiments of the present application has at least the following technical effects:

[0084] Based on the above technical solution, line detection is performed on the target structure image to obtain m lines and n connection points corresponding to the m lines; structure recognition is performed on the target structure image to identify k graphic device units in the target structure image; matching is performed based on the m lines, the n connection points and the k graphic device units to obtain a connector restoration path of the target structure image. It can be seen that the n connection points can be matched with the m lines, and then the connection relationship between the m lines and the k graphic devices is determined based on the positional relationship between the n connection points and the k graphic devices, and then the path of the connector of the target structure image is restored based on the connection relationship to obtain a connector restoration path, thereby ensuring the accuracy and efficiency of restoration.

[0085] In view of the above embodiment, a method for restoring a connector of a structure diagram is provided. The embodiment of the present application also provides a device for restoring a connector of a structure diagram. Please refer to Figure 4 , the device comprises:

[0086] A line detection unit 401 is used to perform line detection on the target structure image, and obtain m lines and n connection points corresponding to the m lines, where m and n are both positive integers;

[0087] A structure recognition unit 402 is used to perform structure recognition on the target structure picture and identify k graphic units in the target structure picture, where k is a positive integer;

[0088] The matching unit 403 is used to match the m lines, the n connection points and the k graphics units to obtain a connector restoration path of the target structure image.

[0089] In an optional implementation, the line detection unit 401 is used to perform line recognition on the target structure image using a line detection method to identify the m lines; and perform connection point detection on the m lines to obtain the n connection points.

[0090] In an optional embodiment, the device further comprises:

[0091] The connection point classification unit is used to classify and detect the n connection points after obtaining the n connection points, so as to obtain the type of each connection point in the n connection points.

[0092] In an optional implementation, the structure recognition unit 402 is used to perform structure recognition on the target structure image through a pre-trained image recognition model to identify the k graphic unit, wherein each graphic unit includes a graphic shape and a graphic position.

[0093] In an optional embodiment, the device further comprises:

[0094] The model training unit is used to obtain a training sample set, wherein each training sample in the training sample set includes a training structure picture and graphic annotation information in the training structure picture, and the graphic annotation information includes a graphic device shape and a graphic device position; and model training is performed using each training structure picture and the graphic annotation information in each training structure picture to obtain the graphic device recognition model.

[0095] In an optional embodiment, the matching unit 403 is used to obtain the line-point connection relationship between the m lines and the n connection points based on the distance relationship between the m lines and the n connection points; obtain the graph-point connection relationship between the n connection points and the k graph devices based on the position relationship between the n connection points and the k graph devices; obtain the connection path composed of the m lines and the n connection points based on the type of each connection point, the line-point connection relationship and the graph-point connection relationship, and use the connection path as the connector restoration path.

[0096] In an optional embodiment, the matching unit 403 is used to obtain the undirected graph consisting of the m lines and the n connection points according to the type of each connection point, the line-point connection relationship and the graph-point connection relationship; perform path selection on the undirected graph through a path selection algorithm to obtain a processed undirected graph, and use the processed undirected graph as the connection path.

[0097] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0098] Figure 5 1 is a block diagram of an electronic device 800 for a connector restoration method for a structure diagram according to an exemplary embodiment. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0099] Reference Figure 5 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / display (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0100] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0101] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0102] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.

[0103] The multimedia component 808 includes a screen that provides a display interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0104] The audio component 810 is configured to present and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for presenting audio signals.

[0105] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0106] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0107] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0108] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0109] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by a processor 820 of an electronic device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0110] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of a mobile terminal, enables the mobile terminal to perform a connector restoration method of a structure diagram, the method comprising:

[0111] Perform line detection on the target structure image to obtain m lines and n connection points corresponding to the m lines, where m and n are both positive integers;

[0112] Performing structural recognition on the target structure picture to identify k graphic unit units in the target structure picture, where k is a positive integer;

[0113] The m lines, the n connection points and the k graphics units are matched to obtain a connector restoration path of the target structure image.

[0114] In addition, it should be noted that: the embodiment of the present application also provides a computer program product or a computer program, which may include computer instructions, and the computer instructions may be stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor may execute the computer instructions, so that the computer device executes the above Figure 1 and Figure 2 The description of the connector restoration method of the structure diagram in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer program product or computer program embodiment involved in this application, please refer to the description of the method embodiment of this application.

[0115] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.

[0116] It should be understood that the present invention is not limited to the precise structure described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

[0117] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A connector restoration method for a structure diagram, characterized in that: The method comprises: Perform line detection on the target structure image to obtain m lines and n connection points corresponding to the m lines, where m and n are both positive integers; Performing structural recognition on the target structure picture to identify k graphic unit units in the target structure picture, where k is a positive integer; Matching the m lines, the n connection points and the k graphic unit units to obtain a connector restoration path of the target structure image; The performing line detection on the target structure image to obtain m lines and n connection points corresponding to the m lines includes: Using a line detection method to perform line recognition on the target structure image, and recognize the m lines; Performing connection point detection on the m lines to obtain the n connection points; The n connection points are classified and detected to obtain the type of each connection point in the n connection points, and the connection point types include starting points, turning points, and direction points.

2. The method according to claim 1, characterized in that The step of performing structural recognition on the target structure picture to identify k graphic units in the target structure picture includes: The target structure image is subjected to structural recognition by using a pre-trained graphic device recognition model to identify the k graphic device units, wherein each graphic device unit includes a graphic device shape and a graphic device position.

3. The method according to claim 2, characterized in that The training steps of the graphic recognition model include: Acquire a training sample set, wherein each training sample in the training sample set includes a training structure picture and graphic annotation information in the training structure picture, wherein the graphic annotation information includes a graphic device shape and a graphic device position; Model training is performed using each training structure picture and the graphic annotation information in each training structure picture to obtain the graphic recognition model.

4. The method according to claim 3, characterized in that The matching of the m lines, the n connection points and the k graphics units to obtain a connector restoration path of the target structure image includes: According to the distance relationship between the m lines and the n connection points, obtaining a line-point connection relationship between the m lines and the n connection points; According to the positional relationship between the n connection points and the k graphic devices, obtaining a graph point connection relationship between the n connection points and the k graphic devices; According to the type of each connection point, the line-point connection relationship and the graph-point connection relationship, a connection path consisting of the m lines and the n connection points is obtained, and the connection path is used as the connector restoration path.

5. The method according to claim 4, characterized in that The acquiring, according to the type of each connection point, the line-point connection relationship and the graph-point connection relationship, a connection path consisting of the m lines and the n connection points comprises: According to the type of each connection point, the line-point connection relationship and the graph-point connection relationship, an undirected graph consisting of the m lines and the n connection points is obtained; A path selection algorithm is used to perform path selection on the undirected graph to obtain a processed undirected graph, and the processed undirected graph is used as the connection path.

6. A connector restoration device for a structural diagram, characterized in that: The device comprises: A line detection unit is used to perform line detection on the target structure image to obtain m lines and n connection points corresponding to the m lines, wherein m and n are both positive integers; The line detection unit is further used to use a line detection method to perform line recognition on the target structure image to identify the m lines; perform connection point detection on the m lines to obtain the n connection points; A connection point classification unit, for classifying and detecting the n connection points after obtaining the n connection points, and obtaining a type of each connection point in the n connection points, wherein the connection point types include a starting point, a turning point, and a direction point; A structure recognition unit, used to perform structure recognition on the target structure picture, and identify k graphic units in the target structure picture, where k is a positive integer; A matching unit is used to match the m lines, the n connection points and the k graphic units to obtain a connector restoration path of the target structure image.

7. An electronic device, characterized in that: The invention comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to execute the operation instructions corresponding to the method according to any one of claims 1 to 5 contained in the one or more programs.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps corresponding to the method according to any one of claims 1 to 5 are implemented.

9. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium and are suitable for being read and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Handmade graph conversion method, device and equipment and medium

    CN109858409A

  • Mind map image recognition and analysis reconstruction method and device

    CN113449734A