Hierarchical data collection method, device, equipment and storage medium
Through image collection and feature extraction of hierarchical data, the matching relationship between hierarchical structure and text structure is reconstructed, which solves the problems of cumbersome and low-precision hierarchical data collection in the existing technology, and achieves efficient, accurate and non-invasive collection.
Patent Information
- Application Number
- CN202311816792.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-27
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2043-12-27
AI Technical Summary
Under the complex hierarchical structure and huge data content, the existing non-invasive hierarchical data collection methods are cumbersome for user operations, prone to introduce human errors, and cannot accurately restore the structure and content of hierarchical data.
Through image acquisition and processing of hierarchical data to be collected, hierarchical structure and text structure diagrams are extracted, structural features and text features are extracted, and the matching relationship between hierarchical structure and text structure is reconstructed to achieve non-invasive collection.
It improves the efficiency and accuracy of hierarchical data collection, reduces human errors, and ensures data accuracy.
Smart Images

Figure CN118015645B
Abstract
Description
Technical Field
[0001] The present application relates to the field of data acquisition technology, and in particular to a hierarchical data acquisition method, device, equipment and storage medium. Background Art
[0002] Hierarchical data refers to data with a certain hierarchical structure or branching structure, usually represented in the form of a tree diagram, such as organizational structure, subject major, book classification, job classification and ethnic classification. At present, the non-invasive hierarchical data collection method usually displays the hierarchical data on the data collection interface for users to collect the hierarchical structure and data content of the hierarchical data.
[0003] However, hierarchical data generally have complex hierarchical structures and huge data content. The user operations required by non-invasive hierarchical data collection methods are relatively cumbersome, prone to human errors, and unable to accurately restore the hierarchical structure and data content of hierarchical data. Summary of the invention
[0004] The purpose of this application is to provide a hierarchical data collection method, device, equipment and storage medium, aiming to achieve non-invasive collection of hierarchical data and improve collection efficiency and collection accuracy.
[0005] The present application embodiment provides a hierarchical data collection method, including:
[0006] Perform image acquisition processing on the collected hierarchical data to obtain the original structure diagram;
[0007] In the hierarchical structure dimension and the text structure dimension, the original structure diagram is subjected to image information extraction processing to obtain a hierarchical structure diagram and a text structure diagram;
[0008] According to the shape, color and coordinates of the hierarchical structure in the hierarchical structure diagram, a structural feature extraction process is performed on the hierarchical structure to obtain a hierarchical structure extraction result;
[0009] According to the coordinates of the text structure in the text structure graph, a text feature extraction process is performed on the text structure to obtain a text structure extraction result;
[0010] Position matching processing is performed on the hierarchical structure extraction result and the text structure extraction result to reconstruct a hierarchical matching relationship between the hierarchical structure and the text structure.
[0011] In some embodiments, the image information extraction process is performed on the original structure diagram in the hierarchical structure dimension and the text structure dimension to obtain the hierarchical structure diagram and the text structure diagram, including:
[0012] Performing color recognition processing on the original structure diagram to obtain a first color recognition result;
[0013] According to the first color recognition result, a layer containing a hierarchical structure is extracted from the original structure diagram to obtain the hierarchical structure diagram, and a layer containing text content is extracted from the original structure diagram to obtain the text structure diagram.
[0014] In some embodiments, performing structural feature extraction processing on the hierarchical structure according to the shape, color and coordinates of the hierarchical structure in the hierarchical structure diagram to obtain a hierarchical structure extraction result includes:
[0015] Determining a root node of the hierarchical structure and coordinates of the root node;
[0016] Taking the root node as the starting point, identifying the connection line derived from the root node according to the pixel colors and pixel coordinates of the pixels after the root node;
[0017] Taking the connection line derived from the root node as a starting point, line tracing and pixel point type recognition are performed to identify the child nodes of each level of the hierarchical structure and the coordinates of the child nodes;
[0018] The root node, the child nodes, the coordinates of the root node and the coordinates of the child nodes are output to obtain the hierarchical structure extraction result.
[0019] In some embodiments, determining the root node of the hierarchical structure and the coordinates of the root node includes:
[0020] Performing color recognition processing on a first group of unrecognized pixel points of the hierarchical structure graph along a root node recognition direction to obtain a second color recognition result; the root node recognition direction is a direction from an edge of the hierarchical structure graph closest to the root node to the root node;
[0021] According to the second color recognition result, determining whether the pixel color of the currently recognized pixel point is within a preset root node color interval;
[0022] If not, determining that the currently identified pixel does not belong to the root node; returning to the step of performing color recognition processing on the first group of unidentified pixels of the hierarchical structure graph along the root node identification direction to obtain a second color recognition result;
[0023] If so, it is determined that the currently identified pixel point belongs to the root node, and the coordinates of the root node are determined according to the pixel points of the root node.
[0024] In some embodiments, the line tracing and pixel type identification are performed with the connection line derived from the root node as the starting point to identify the child nodes of each level of the hierarchical structure and the coordinates of the child nodes, including:
[0025] Performing color recognition processing on a first group of to-be-recognized pixel points of the connection line of the current level along a length direction of the connection line of the current level to obtain a third color recognition result;
[0026] According to the third color recognition result, determining whether the current pixel to be recognized is a branch;
[0027] If it is not a branch, it is determined that the child node of the next level has not been identified; returning along the length direction of the connection line of the current level, performing color recognition processing on the first group of pixels to be identified of the connection line of the current level, and obtaining a third color recognition result;
[0028] If it is a branch, color recognition processing is performed on the pixel points of the connection line of the current level in the direction of the current branch to identify the child nodes of the next level and the coordinates of the child nodes of the next level;
[0029] Determine whether the child node of the next level has a child node of a lower level;
[0030] If yes, use the connection line derived from the child node of the next level as the connection line of the current level; return along the length direction of the connection line of the current level, perform color recognition processing on the first group of pixels to be identified of the connection line of the current level, and obtain a third color recognition result;
[0031] If not, use the connection line of the previous level of the child node of the next level as the connection line of the current level; return along the length direction of the connection line of the current level, perform color recognition processing on the first group of pixel points to be identified of the connection line of the current level, and obtain a third color recognition result.
[0032] In some embodiments, performing text feature extraction processing on the text structure according to the coordinates of the text structure in the text structure graph to obtain a text structure extraction result includes:
[0033] Performing image segmentation processing on the text structure graph to obtain multiple groups of text structure subgraphs;
[0034] Performing text recognition processing on the text structure subgraph to obtain node text;
[0035] Determine the coordinates of the node text according to the coordinates of the node text in the text structure subgraph and the position of the text structure subgraph in the text structure graph;
[0036] The node text and the coordinates of the node text are output to obtain the text structure extraction result.
[0037] In some embodiments, performing position matching processing on the hierarchical structure extraction result and the text structure extraction result to reconstruct the hierarchical matching relationship between the hierarchical structure and the text structure includes:
[0038] The hierarchical structure extraction result and the text structure extraction result are imported into a preset acquisition template, so that the nodes in the hierarchical structure and the text content of the text structure are associated according to coordinates to obtain a hierarchical data acquisition result, and the hierarchical data acquisition result is stored in a database.
[0039] The present application also provides a hierarchical data collection device, including:
[0040] The first module is used to perform image acquisition processing on the hierarchical data to be acquired to obtain the original structure diagram;
[0041] The second module is used to perform image information extraction processing on the original structure diagram in the hierarchical structure dimension and the text structure dimension to obtain a hierarchical structure diagram and a text structure diagram;
[0042] The third module is used to perform structural feature extraction processing on the hierarchical structure according to the shape, color and coordinates of the hierarchical structure in the hierarchical structure diagram to obtain a hierarchical structure extraction result;
[0043] The fourth module is used to perform text feature extraction processing on the text structure according to the coordinates of the text structure in the text structure graph to obtain a text structure extraction result;
[0044] The fifth module is used to perform position matching processing on the hierarchical structure extraction result and the text structure extraction result to reconstruct the hierarchical matching relationship between the hierarchical structure and the text structure.
[0045] An embodiment of the present application further provides an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned hierarchical data acquisition method when executing the computer program.
[0046] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned hierarchical data acquisition method is implemented.
[0047] The beneficial effects of the present application are as follows: by performing image acquisition processing on the hierarchical data to be collected, image information extraction processing is performed on the collected original structure diagram in the hierarchy dimension and the text structure dimension to obtain a hierarchy diagram with a hierarchy structure and a text structure diagram with a text structure, feature extraction processing is performed on the hierarchy diagram and the text structure diagram respectively, and then the hierarchy and the text structure are re-associated and matched according to the coordinate features and color features of the extracted hierarchy and text structure, so as to realize non-invasive collection of complex hierarchical data and improve collection efficiency and collection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 It is an optional flowchart of the hierarchical data collection method provided in the embodiment of the present application.
[0049] Figure 2 It is a flowchart of the specific method of step S103 provided in an embodiment of the present application.
[0050] Figure 3 It is a flowchart of the specific method of step S201 provided in an embodiment of the present application.
[0051] Figure 4 It is a flowchart of the specific method of step S203 provided in an embodiment of the present application.
[0052] Figure 5 It is a flowchart of the specific method of step S104 provided in an embodiment of the present application.
[0053] Figure 6 It is an optional structural diagram of the hierarchical data acquisition device provided in an embodiment of the present application.
[0054] Figure 7 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0056] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0057] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0058] See also Figure 1 , Figure 1 is an optional flow chart of the hierarchical data collection method provided in the embodiments of the present application. In some embodiments of the present application, Figure 1 The method may specifically include but is not limited to steps S101 to S105. Figure 1 These five steps are introduced in detail.
[0059] Step S101, performing image acquisition processing on the hierarchical data to be acquired to obtain an original structure diagram.
[0060] It can be understood that hierarchical data is a data model with a hierarchical structure. The hierarchical structure of hierarchical data is a tree structure. Each node in the hierarchical structure represents an entity type. Each node can have multiple child nodes. The text structure of the hierarchical structure is used to describe the entity type of the node, usually set next to the node. In hierarchical data, each node can only have one parent node. Except for the root node, other nodes have one parent node. Nodes that are not at the lowest level can have multiple child nodes.
[0061] In step S101, image acquisition processing is performed on the hierarchical data to be collected, specifically, the hierarchical data to be collected is displayed in the display area of the terminal's visualization screen, each level of the hierarchical data is fully expanded for display, and then the display area of the visualization screen is photographed using an image acquisition device, or the display area of the visualization screen is captured by running image acquisition software on the terminal, thereby collecting the hierarchical data in image form, that is, obtaining the original structure diagram.
[0062] In actual applications, since the amount of hierarchical data is usually huge, the display area of the visualization screen cannot fully display the hierarchical data. The hierarchical data can be partially displayed and image acquisition processed to obtain multiple original structure sub-graphs showing local hierarchical data. After the interception is completed, the original structure sub-graphs are spliced to obtain the original structure graph.
[0063] Step S102 , performing image information extraction processing on the original structure diagram in the hierarchical structure dimension and the text structure dimension to obtain a hierarchical structure diagram and a text structure diagram.
[0064] In step S102, the original structure diagram is subjected to image information extraction processing, specifically, the original structure diagram is split using image processing software. In the image processing software, according to preset image information extraction rules, the hierarchical structure and text structure of the hierarchical data are respectively extracted from the original structure diagram, thereby generating a hierarchical structure diagram with a hierarchical structure and a text structure diagram with a text structure.
[0065] In some embodiments, when the terminal displays hierarchical data, the hierarchical structure and the text structure are displayed in different colors. The preset image information extraction rule can be based on the pixel color in the original structure diagram to extract image information, thereby extracting the hierarchical structure and the text structure from the original structure diagram.
[0066] More specifically, the above step S102 specifically includes:
[0067] Performing color recognition processing on the original structure image to obtain a first color recognition result;
[0068] According to the first color recognition result, a layer containing a hierarchical structure is extracted from the original structure diagram to obtain a hierarchical structure diagram, and a layer containing text content is extracted from the original structure diagram to obtain a text structure diagram.
[0069] The original structure diagram is subjected to color recognition processing, specifically, each pixel of the original structure diagram is subjected to color recognition processing, and the pixel color of the identified pixel is compared with the hierarchical structure color interval and the text structure color interval to determine whether the pixel color of the pixel is within the hierarchical structure color interval or the text structure color interval. If it is within the hierarchical structure color interval, it is determined that the pixel belongs to the hierarchical structure; if it is within the text structure color interval, it is determined that the pixel belongs to the text structure, thereby obtaining a first color recognition result. According to the first color recognition result, the pixel points belonging to the hierarchical structure are extracted to form a hierarchical structure diagram, and the pixel points belonging to the text structure are extracted to form a text structure diagram.
[0070] Step S103, performing structural feature extraction processing on the hierarchical structure according to the shape, color and coordinates of the hierarchical structure in the hierarchical structure diagram to obtain a hierarchical structure extraction result.
[0071] In step S103, structural feature extraction processing is performed on the hierarchical structure. Specifically, the hierarchical structure is analyzed hierarchically using preset hierarchical structure recognition rules to determine the shape structure, color difference and coordinate position of the connecting lines and nodes in the hierarchical structure, so as to identify the position of each node in the hierarchical structure and the hierarchical relationship between the nodes, and obtain the hierarchical structure extraction result.
[0072] like Figure 2As shown, in some embodiments, step S103 may specifically include but is not limited to steps S201 to S204. Figure 2 These four steps are introduced in detail.
[0073] Step S201, determining the root node of the hierarchical structure and the coordinates of the root node.
[0074] In step S201, the root node of the hierarchy and the coordinates of the root node are determined. Specifically, color recognition processing is performed on the pixels of the hierarchy image one by one starting from an edge position of the hierarchy image closest to the root node until a pixel point whose pixel color matches the root node color is identified, thereby determining the root node and the coordinates of the root node.
[0075] In some embodiments, the root node of the hierarchical structure and the coordinates of the root node may be determined by the user directly identifying the root node and the coordinates of the root node by operating on image processing software.
[0076] like Figure 3 As shown, in some embodiments, step S201 may specifically include but is not limited to steps S301 to S304. Figure 3 These four steps are introduced in detail.
[0077] Step S301, color recognition is performed on a first group of unrecognized pixels of the hierarchical structure graph along a root node recognition direction to obtain a second color recognition result, wherein the root node recognition direction is a direction from the edge of the hierarchical structure graph closest to the root node to the root node.
[0078] Step S302, judging whether the pixel color of the currently recognized pixel point is within the preset root node color interval according to the second color recognition result. If not, executing step S303; if yes, executing step S304.
[0079] Step S303: Determine whether the currently identified pixel point belongs to the root node. Return to step S301.
[0080] Step S304, determining whether the currently identified pixel point belongs to a root node, and determining the coordinates of the root node according to the pixel points of the root node.
[0081] It can be understood that the root node identification direction is set according to the position of the root node in the hierarchical graph. First, the edge of the hierarchical graph closest to the root node is determined according to the position of the root node, and then the priority order of identifying pixel points is set. The direction of traversing the pixel points of the hierarchical graph in the priority order is the root node identification direction.
[0082] Exemplarily, the root node is located near the upper left position of the hierarchical graph. The upper left edge of the hierarchical graph can be used as the starting point, and color recognition processing is performed on the leftmost and topmost pixel. The priority order of identifying the pixels is set to identify from top to bottom. After identifying the leftmost column of pixels, the pixels in the second column on the left are identified from top to bottom, and so on, to obtain a second color recognition result.
[0083] In step S301 to step S304, a sliding window algorithm is used to perform color recognition processing on the pixels of the hierarchical structure diagram. After determining the starting point of color recognition and the root node recognition direction, a color recognition processing is performed on the first group of unrecognized pixels in the hierarchical structure diagram (the first group of unrecognized pixels in the initial stage is the first group of pixels) to obtain a second color recognition result. Then, according to the second color recognition result, it is determined whether the pixel color of the currently recognized pixel (the currently recognized pixel in the initial stage is the first group of pixels) is within the preset root node color interval. If so, it is determined that the currently recognized pixel (the first group of pixels) belongs to the root node, and the process ends. Otherwise, it is determined that the currently recognized pixel (the first group of pixels) does not belong to the root node, and then Then, the first group of unrecognized pixels in the hierarchical structure diagram (the first group of unrecognized pixels in the second recognition stage is the second group of pixels) is subjected to color recognition processing to obtain a second color recognition result, and then, according to the second color recognition result, it is determined whether the pixel color of the currently recognized pixel (the currently recognized pixel in the second recognition stage is the second group of pixels) is within the preset root node color range. If so, it is determined that the currently recognized pixel (the second group of pixels) belongs to the root node, and the process ends. Otherwise, it is determined that the currently recognized pixel (the second group of pixels) does not belong to the root node, and then the third recognition is started, and so on. When it is determined that the currently recognized pixel belongs to the root node, the pixel coordinates of the pixel belonging to the root node are used as the coordinates of the root node.
[0084] Step S202, taking the root node as the starting point, identifying the connection line derived from the root node according to the pixel colors and pixel coordinates of the pixels after the root node.
[0085] In step S202, a sliding window algorithm is used to perform color recognition processing on the pixels after the root node, and the shape structure composed of the pixels is determined according to the pixel colors of the recognized pixels and the pixel coordinates of the pixels with the same pixel colors, thereby identifying the connecting lines leading from the root node.
[0086] Exemplarily, color recognition processing is performed on a group of pixels after the root node. When multiple pixels with the same color are identified, and the multiple pixels with the same color are arranged in a column or a row, and the colors of other pixels are different from the pixel colors of these pixels, it is determined that these pixels with the same color belong to the connecting line leading from the root node.
[0087] Step S203 , taking the connection line derived from the root node as the starting point, line tracking and pixel point type recognition are performed to identify the child nodes at each level of the hierarchical structure and the coordinates of the child nodes.
[0088] In step S203, after identifying the connecting line derived from the root node, line tracing is performed along the length direction and branch direction of the connecting line derived from the root node, and whether there is a child node under the root node is determined according to the line branch shape of the connecting line derived from the root node. Pixel point type recognition is performed along the line branch of the connecting line derived from the root node to identify the child node under the root node and the coordinates of the child node. After identifying the child node under the root node, it is identified whether the child node has a connecting line derived therefrom. If a connecting line derived from the child node is identified, the child node of the next level of the child node is identified. If the child node of the next level has a connecting line derived therefrom, the child node of the next level is further identified until the bottom level is reached. If the connecting line derived from the child node is not identified, it is determined that the child node has no child node of the next level, and the identification of the child node of the current level is returned.
[0089] like Figure 4 As shown, in some embodiments, step S203 may specifically include but is not limited to steps S401 to S407. Figure 4 These seven steps are introduced in detail.
[0090] Step S401 , performing color recognition processing on a first group of to-be-recognized pixel points of the connection lines of the current level along the length direction of the connection lines of the current level to obtain a third color recognition result.
[0091] Step S402, judging whether the current pixel to be identified is a branch according to the third color recognition result. If it is not a branch, executing step S403; if it is a branch, executing step S404.
[0092] Step S403: Determine that no child node at the next level is identified. Return to step S401.
[0093] Step S404 , performing color recognition processing on the pixel points of the connection line of the current level in the current branch direction to identify the child nodes of the next level and the coordinates of the child nodes of the next level.
[0094] Step S405, determine whether the child node of the next level has a child node of a lower level. If yes, execute step S406; if no, execute step S407.
[0095] Step S406: Use the connection lines drawn from the child nodes of the next level as the connection lines of the current level. Return to step S401.
[0096] Step S407: Use the connection line of the previous level of the child node of the next level as the connection line of the current level. Return to step S401.
[0097] In step S401 to step S407, a sliding window algorithm is used to perform color recognition processing on the pixel points of the connection lines of the hierarchical structure. After determining the connection lines derived from the root node, color recognition processing is performed on the first group of to-be-recognized pixel points of the connection lines of the current level along the length direction of the connection lines of the current level (the connection lines of the current level in the initial stage are the connection lines derived from the root node) to obtain a third color recognition result, and then it is determined whether the current to-be-recognized pixel point is a branch based on the third color recognition result. If it is determined to be a branch, the color recognition processing in the length direction of the connection lines of the current level is suspended, and the color recognition processing is performed one level down along the direction of the currently recognized branch instead, so as to identify the next level along the direction of the currently recognized branch. The process of identifying the child nodes of the next level is as follows: first, identifying the child nodes of the next level, and then identifying whether the child nodes have any connecting lines drawn out. If the connecting lines drawn out of the child nodes are identified, then identifying the child nodes of the next level of the child nodes. If the child nodes of the next level of the child nodes have connecting lines drawn out, then further identifying the child nodes of the next level is performed until the bottom level is reached. When it is identified that the current node has no child nodes of the next level, returning to the previous level of the most recently identified level to perform connecting line branch identification to identify the next node of the previous level of the most recently identified level, until there is no next node in the previous level of the most recently identified level, then returning one level forward to perform connecting line branch identification until each node and its coordinates are identified.
[0098] Step S204, output the root node, the child nodes, the coordinates of the root node and the coordinates of the child nodes to obtain the hierarchical structure extraction result.
[0099] In step S204, each identified node (including the root node and the child nodes of each level) is encoded, and then the encoded nodes and the coordinates of the nodes are imported into the preset acquisition template to obtain the hierarchical structure extraction result. For example, the levels can be separated by "-" or ".", and the sequence number of the node can be encoded by a number with a certain format, such as "000, 005, 010", etc.
[0100] Step S104, performing text feature extraction processing on the text structure according to the coordinates of the text structure in the text structure graph to obtain a text structure extraction result.
[0101] In step S104, text feature extraction is performed on the text structure according to the coordinates of the text structure in the text structure diagram. Specifically, a screenshot of the text structure diagram is taken using image processing software so that the captured images each contain several lines of text content. Then, text content recognition is performed on the captured images using text recognition technology to identify the text content in the images. Finally, based on the position of the captured image in the text structure diagram and the position of the identified text content in the captured image, the coordinates corresponding to the text content are determined to obtain a text structure extraction result.
[0102] like Figure 5 As shown, in some embodiments, step S104 may specifically include but is not limited to steps S501 to S504. Figure 5 These four steps are introduced in detail.
[0103] Step S501, performing image segmentation processing on the text structure graph to obtain multiple groups of text structure subgraphs.
[0104] Step S502: Perform text recognition processing on the text structure subgraph to obtain node text.
[0105] Step S503, determining the coordinates of the node text according to the coordinates of the node text in the text structure subgraph and the position of the text structure subgraph in the text structure graph.
[0106] Step S504, output the node text and the coordinates of the node text to obtain the text structure extraction result.
[0107] In step S501 to step S504, the text structure graph is screenshotted using image processing software to obtain multiple groups of text structure subgraphs, then the OCR program (optical character recognition program) is started, the text structure subgraph is input into the OCR program, the text information of the node text in the text structure subgraph is identified, the identified node text is sorted according to its position in the text structure subgraph, and while identifying the text information, the coordinates of the node text in the text structure subgraph are identified, and the position of each node text in the text structure graph is calculated in combination with the pixel size of the text structure subgraph and its position in the text structure graph, thereby obtaining the coordinates of the node text, and finally the identified node text is encoded, and then the encoded node text and the coordinates of the node text are imported into a preset acquisition template to obtain the node structure extraction result.
[0108] Step S105 , performing position matching processing on the hierarchical structure extraction result and the text structure extraction result to reconstruct the hierarchical matching relationship between the hierarchical structure and the text structure.
[0109] In some embodiments, step S105 specifically includes:
[0110] The hierarchical structure extraction results and the text structure extraction results are imported into the preset collection template, so that the nodes in the hierarchical structure and the text content of the text structure are associated according to the coordinates, and the hierarchical data collection results are obtained, and the hierarchical data collection results are stored in the database.
[0111] See also Figure 6 The embodiment of the present application also provides a hierarchical data collection device, which can implement the above hierarchical data collection method, and the device includes:
[0112] The first module 601 is used to perform image acquisition processing on the hierarchical data to be acquired to obtain an original structure diagram;
[0113] The second module 602 is used to perform image information extraction processing on the original structure diagram in the hierarchical structure dimension and the text structure dimension to obtain a hierarchical structure diagram and a text structure diagram;
[0114] The third module 603 is used to perform structural feature extraction processing on the hierarchical structure according to the shape, color and coordinates of the hierarchical structure in the hierarchical structure diagram to obtain a hierarchical structure extraction result;
[0115] The fourth module 604 is used to perform text feature extraction processing on the text structure according to the coordinates of the text structure in the text structure graph to obtain a text structure extraction result;
[0116] The fifth module 605 is used to perform position matching processing on the hierarchical structure extraction result and the text structure extraction result to reconstruct the hierarchical matching relationship between the hierarchical structure and the text structure.
[0117] The specific implementation of the hierarchical data acquisition device is substantially the same as the specific implementation of the hierarchical data acquisition method described above, and will not be described in detail herein.
[0118] Figure 7 It is a block diagram of an electronic device according to an exemplary embodiment.
[0119] Refer to the following Figure 7 An electronic device 700 according to this embodiment of the present disclosure is described. Figure 7 The electronic device 700 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0120] like Figure 7 As shown, the electronic device 700 is in the form of a general computing device. The components of the electronic device 700 may include, but are not limited to: at least one processing unit 710, at least one storage unit 720, a bus 730 connecting different system components (including the storage unit 720 and the processing unit 710), a display unit 740, etc.
[0121] The storage unit stores program codes, which can be executed by the processing unit 710, so that the processing unit 710 executes the steps described in the above hierarchical data acquisition method section of this specification according to various exemplary embodiments of the present disclosure.
[0122] The storage unit 720 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 7201 and / or a cache storage unit 7202 , and may further include a read-only storage unit (ROM) 7203 .
[0123] The storage unit 720 may also include a program / utility 7204 having a set (at least one) of program modules 7205, such program modules 7205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0124] Bus 730 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0125] The electronic device 700 may also communicate with one or more external devices 700' (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 700, and / or communicate with any device that enables the electronic device 700 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 750. Furthermore, the electronic device 700 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 760. The network adapter 760 may communicate with other modules of the electronic device 700 via a bus 730. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0126] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned hierarchical data collection method is implemented.
[0127] The hierarchical data acquisition method, apparatus, device and storage medium provided in the embodiments of the present application perform image acquisition processing on the hierarchical data to be collected, perform image information extraction processing on the collected original structure diagram in the hierarchical structure dimension and the text structure dimension to obtain a hierarchical structure diagram with a hierarchical structure and a text structure diagram with a text structure, perform feature extraction processing on the hierarchical structure diagram and the text structure diagram respectively, and then re-associate and match the hierarchical structure and the text structure according to the coordinate features and color features of the extracted hierarchical structure and text structure, thereby realizing non-invasive acquisition of complex hierarchical data and improving acquisition efficiency and acquisition accuracy.
[0128] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, or a network device, etc.) to execute the above method according to the implementation of the present disclosure.
[0129] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0130] Computer readable storage media may include data signals propagated in baseband or as part of a carrier wave, wherein readable program codes are carried. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program codes contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.
[0131] Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0132] Those skilled in the art will appreciate that the above modules can be distributed in the device according to the description of the embodiment, or can be changed accordingly and only used in one or more devices different from the embodiment. The modules of the above embodiments can be combined into one module, or further divided into multiple sub-modules.
[0133] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiment of the present disclosure.
[0134] The exemplary embodiments of the present disclosure are specifically shown and described above. It should be understood that the present disclosure is not limited to the detailed structures, configurations or implementations described herein; on the contrary, the present disclosure is intended to cover various modifications and equivalent configurations included in the spirit and scope of the appended claims.
Claims
1. A hierarchical data collection method, characterized in that: include: Performing image acquisition processing on the hierarchical data to be collected to obtain an original structure diagram; the hierarchical data is a data model with a hierarchical structure, the hierarchical structure of the hierarchical data is a tree structure, each node in the hierarchical structure represents an entity type, and the text structure of the hierarchical structure is used to describe the entity type of the node. In the hierarchical data, the node can only have one parent node, except for the root node, other nodes have one parent node, and nodes other than the lowest level have multiple child nodes; In the hierarchical structure dimension and the text structure dimension, the original structure diagram is subjected to image information extraction processing to obtain a hierarchical structure diagram and a text structure diagram; According to the shape, color and coordinates of the hierarchical structure in the hierarchical structure diagram, a structural feature extraction process is performed on the hierarchical structure to obtain a hierarchical structure extraction result; According to the coordinates of the text structure in the text structure graph, a text feature extraction process is performed on the text structure to obtain a text structure extraction result; Performing position matching processing on the hierarchical structure extraction result and the text structure extraction result to reconstruct a hierarchical matching relationship between the hierarchical structure and the text structure; The step of performing structural feature extraction processing on the hierarchical structure according to the shape, color and coordinates of the hierarchical structure in the hierarchical structure diagram to obtain a hierarchical structure extraction result includes: Determining a root node of the hierarchical structure and coordinates of the root node; Taking the root node as the starting point, identifying the connection line derived from the root node according to the pixel colors and pixel coordinates of the pixels after the root node; Taking the connection line derived from the root node as a starting point, line tracing and pixel point type recognition are performed to identify the child nodes of each level of the hierarchical structure and the coordinates of the child nodes; Outputting the root node, the child node, the coordinates of the root node and the coordinates of the child node to obtain the hierarchical structure extraction result; The line tracing and pixel type identification are performed with the connection line derived from the root node as the starting point to identify the child nodes of each level of the hierarchical structure and the coordinates of the child nodes, including: Performing color recognition processing on a first group of to-be-recognized pixel points of the connection line of the current level along a length direction of the connection line of the current level to obtain a third color recognition result; According to the third color recognition result, determining whether the current pixel to be recognized is a branch; If it is not a branch, it is determined that the child node of the next level has not been identified; returning along the length direction of the connection line of the current level, performing color recognition processing on the first group of pixels to be identified of the connection line of the current level, and obtaining a third color recognition result; If it is a branch, color recognition processing is performed on the pixel points of the connection line of the current level in the direction of the current branch to identify the child nodes of the next level and the coordinates of the child nodes of the next level; Determine whether the child node of the next level has a child node of a lower level; If yes, use the connection line derived from the child node of the next level as the connection line of the current level; return along the length direction of the connection line of the current level, perform color recognition processing on the first group of pixels to be identified of the connection line of the current level, and obtain a third color recognition result; If not, use the connection line of the previous level of the child node of the next level as the connection line of the current level; return along the length direction of the connection line of the current level, perform color recognition processing on the first group of pixel points to be identified of the connection line of the current level, and obtain a third color recognition result.
2. The hierarchical data collection method according to claim 1, characterized in that: The image information extraction process is performed on the original structure diagram in the hierarchical structure dimension and the text structure dimension to obtain the hierarchical structure diagram and the text structure diagram, including: Performing color recognition processing on the original structure diagram to obtain a first color recognition result; According to the first color recognition result, a layer containing a hierarchical structure is extracted from the original structure diagram to obtain the hierarchical structure diagram, and a layer containing text content is extracted from the original structure diagram to obtain the text structure diagram.
3. The hierarchical data collection method according to claim 1, characterized in that: The step of determining the root node of the hierarchical structure and the coordinates of the root node includes: Performing color recognition processing on a first group of unrecognized pixel points of the hierarchical structure graph along a root node recognition direction to obtain a second color recognition result; the root node recognition direction is a direction from an edge of the hierarchical structure graph closest to the root node to the root node; According to the second color recognition result, determining whether the pixel color of the currently recognized pixel point is within a preset root node color interval; If not, determining that the currently identified pixel does not belong to the root node; returning to the step of performing color recognition processing on the first group of unidentified pixels of the hierarchical structure graph along the root node identification direction to obtain a second color recognition result; If so, it is determined that the currently identified pixel point belongs to the root node, and the coordinates of the root node are determined according to the pixel points of the root node.
4. The hierarchical data collection method according to claim 1, characterized in that: The step of performing text feature extraction processing on the text structure according to the coordinates of the text structure in the text structure graph to obtain a text structure extraction result includes: Performing image segmentation processing on the text structure graph to obtain multiple groups of text structure subgraphs; Performing text recognition processing on the text structure subgraph to obtain node text; Determine the coordinates of the node text according to the coordinates of the node text in the text structure subgraph and the position of the text structure subgraph in the text structure graph; The node text and the coordinates of the node text are output to obtain the text structure extraction result.
5. The hierarchical data collection method according to claim 1, characterized in that: The performing position matching processing on the hierarchical structure extraction result and the text structure extraction result to reconstruct the hierarchical matching relationship between the hierarchical structure and the text structure includes: The hierarchical structure extraction result and the text structure extraction result are imported into a preset acquisition template, so that the nodes in the hierarchical structure and the text content of the text structure are associated according to coordinates to obtain a hierarchical data acquisition result, and the hierarchical data acquisition result is stored in a database.
6. A hierarchical data acquisition device, characterized in that: include: The first module is used to perform image acquisition processing on the hierarchical data to be collected to obtain an original structure diagram; the hierarchical data is a data model with a hierarchical structure, the hierarchical structure of the hierarchical data is a tree structure, each node in the hierarchical structure represents an entity type, and the text structure of the hierarchical structure is used to describe the entity type of the node. In the hierarchical data, the node can only have one parent node, except the root node, other nodes have one parent node, and nodes other than the lowest level have multiple child nodes; The second module is used to perform image information extraction processing on the original structure diagram in the hierarchical structure dimension and the text structure dimension to obtain a hierarchical structure diagram and a text structure diagram; The third module is used to perform structural feature extraction processing on the hierarchical structure according to the shape, color and coordinates of the hierarchical structure in the hierarchical structure diagram to obtain a hierarchical structure extraction result; The fourth module is used to perform text feature extraction processing on the text structure according to the coordinates of the text structure in the text structure graph to obtain a text structure extraction result; A fifth module is used to perform position matching processing on the hierarchical structure extraction result and the text structure extraction result to reconstruct the hierarchical matching relationship between the hierarchical structure and the text structure; The step of performing structural feature extraction processing on the hierarchical structure according to the shape, color and coordinates of the hierarchical structure in the hierarchical structure diagram to obtain a hierarchical structure extraction result includes: Determining a root node of the hierarchical structure and coordinates of the root node; Taking the root node as the starting point, identifying the connection line derived from the root node according to the pixel colors and pixel coordinates of the pixels after the root node; Taking the connection line derived from the root node as a starting point, line tracing and pixel point type recognition are performed to identify the child nodes of each level of the hierarchical structure and the coordinates of the child nodes; Outputting the root node, the child node, the coordinates of the root node and the coordinates of the child node to obtain the hierarchical structure extraction result; The line tracing and pixel type identification are performed with the connection line derived from the root node as the starting point to identify the child nodes of each level of the hierarchical structure and the coordinates of the child nodes, including: Performing color recognition processing on a first group of to-be-recognized pixel points of the connection line of the current level along a length direction of the connection line of the current level to obtain a third color recognition result; According to the third color recognition result, determining whether the current pixel to be recognized is a branch; If it is not a branch, it is determined that the child node of the next level has not been identified; returning along the length direction of the connection line of the current level, performing color recognition processing on the first group of pixels to be identified of the connection line of the current level, and obtaining a third color recognition result; If it is a branch, color recognition processing is performed on the pixel points of the connection line of the current level in the direction of the current branch to identify the child nodes of the next level and the coordinates of the child nodes of the next level; Determine whether the child node of the next level has a child node of a lower level; If yes, use the connection line derived from the child node of the next level as the connection line of the current level; return along the length direction of the connection line of the current level, perform color recognition processing on the first group of pixels to be identified of the connection line of the current level, and obtain a third color recognition result; If not, use the connection line of the previous level of the child node of the next level as the connection line of the current level; return along the length direction of the connection line of the current level, perform color recognition processing on the first group of pixel points to be identified of the connection line of the current level, and obtain a third color recognition result.
7. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the hierarchical data acquisition method according to any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the hierarchical data collection method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Image processing method and device, storage medium, and electronic equipment
CN107358241A
Document chapter segmentation method and device and storage medium
CN112329548A
Picture processing method and device, storage medium and electronic equipment
CN113850882A
Character recognition method for mapping skeleton information into image
CN114708654A
Epidemic wood identification method and device, computer equipment and computer readable storage medium
CN116152177A
