Page processing method and apparatus
By determining the element set and iteratively segmenting it in the design draft, a tree structure for the page layout is constructed, solving the problem of relying on manual annotation for the layout segmentation of the design draft and realizing the efficient automated acquisition of the hierarchical structure of the design draft.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING FLYING ELEPHANT PLANET TECH CO LTD
- Filing Date
- 2022-06-29
- Publication Date
- 2026-06-26
AI Technical Summary
In existing technologies, the layout and segmentation of design drafts rely on a large amount of manual annotation, resulting in high labor costs and difficulty in data collection, making it difficult to quickly obtain the hierarchical structure of the design drafts.
By determining the set of elements based on the layout diagram of the target page, drawing the element block distribution diagram, and performing iterative segmentation, a tree structure of page layout is constructed, reducing manual intervention.
It automates the layout and segmentation of design drafts, improves segmentation efficiency, reduces labor costs, and simplifies the acquisition of the hierarchical structure of design drafts.
Smart Images

Figure CN115129314B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of page design technology, and in particular to page processing methods. This application also relates to a page processing apparatus, a computing device, and a computer-readable storage medium. Background Technology
[0002] With the development and application of internet technology, the visual design of products is receiving increasing attention. During product development, designers create a visual draft, known as a design draft. However, many designers tend to focus too much on the visual experience of the design draft while neglecting its hierarchical structure, making it more difficult to segment and arrange the elements in the design draft later.
[0003] Current technologies rely on manually annotating massive amounts of data and using deep learning to segment design drafts using big data analytics. This method is extremely costly due to its reliance on large datasets and the significant manpower required for annotation. Therefore, finding a convenient and efficient way to segment design drafts and obtain their hierarchical structure is a pressing issue that needs to be addressed. Summary of the Invention
[0004] In view of this, embodiments of this application provide a page processing method. This application also relates to a page processing apparatus, a computing device, and a computer-readable storage medium, to solve the problem in the prior art where design draft layout segmentation consumes a large amount of manpower and time.
[0005] According to a first aspect of the embodiments of this application, a page processing method is provided, including:
[0006] Based on the layout diagram of the target page, determine the set of elements corresponding to the target page;
[0007] Draw the element block corresponding to each element based on the attribute information of each element in the element set, and generate an element block distribution map based on the element block corresponding to each element;
[0008] The element block distribution map is iteratively segmented to determine the target segmentation region generated by the segmentation process in each iterative segmentation cycle.
[0009] Based on the generation order of each target segmentation region, construct the page layout tree structure of the target page.
[0010] According to a second aspect of the embodiments of this application, a page processing apparatus is provided, comprising:
[0011] The determination module is configured to determine the set of elements corresponding to the target page based on the layout diagram of the target page;
[0012] The drawing module is configured to draw the element block corresponding to each element based on the attribute information of each element in the element set, and generate an element block distribution map based on the element block corresponding to each element.
[0013] The segmentation module is configured to perform iterative segmentation processing on the element block distribution map and determine the target segmentation region generated by the segmentation processing result of each iterative segmentation cycle.
[0014] The building module is configured to construct a page layout tree structure for the target page based on the generation order of each target segmentation region.
[0015] According to a third aspect of the present application, a computing device is provided, including a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor executes the computer instructions to implement the steps of the page processing method.
[0016] According to a fourth aspect of the embodiments of this application, a computer-readable storage medium is provided that stores computer instructions, which, when executed by a processor, implement the steps of the page processing method.
[0017] The page processing method provided in this application determines the element set corresponding to the target page based on the layout diagram of the target page; draws the element block corresponding to each element based on the attribute information of each element in the element set, and generates an element block distribution map based on the element block corresponding to each element; performs iterative segmentation processing on the element block distribution map, and determines the target segmentation region generated by the segmentation processing result of each iterative segmentation cycle; and constructs the page layout tree structure of the target page according to the generation order of each target segmentation region.
[0018] One embodiment of this application draws a corresponding element block distribution map based on the layout diagram of the target page, and then performs iterative segmentation processing on the element block distribution map to obtain the target segmentation region corresponding to each iterative segmentation cycle. Thus, based on the generation order of each target segmentation region, a page layout tree structure of the target page is constructed, which eliminates the need for manual segmentation of the target page and improves segmentation efficiency. Attached Figure Description
[0019] Figure 1 This is a flowchart of a page processing method provided in an embodiment of this application;
[0020] Figure 2 This is a schematic diagram of an element block distribution provided in an embodiment of this application;
[0021] Figure 3 This is a schematic diagram of the distribution of deduplicated element blocks provided in an embodiment of this application;
[0022] Figure 4 This is a schematic diagram of the segmentation of a deduplication element block distribution map provided in an embodiment of this application;
[0023] Figure 5 This is a schematic diagram of a page layout tree structure provided in one embodiment of this application;
[0024] Figure 6 This is a flowchart of a page processing method applied to page segmentation provided in an embodiment of this application;
[0025] Figure 7 This is a schematic diagram of the structure of a page processing device provided in an embodiment of this application;
[0026] Figure 8 This is a structural block diagram of a computing device provided in one embodiment of this application. Detailed Implementation
[0027] Many specific details are set forth in the following description to provide a full understanding of this application. However, this application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this application; therefore, this application is not limited to the specific embodiments disclosed below.
[0028] The terminology used in one or more embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the scope of one or more embodiments of this application. The singular forms “a,” “the,” and “the” used in one or more embodiments of this application and in the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” used in one or more embodiments of this application refers to and includes any or all possible combinations of one or more associated listed items.
[0029] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this application, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this application, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0030] First, the terms and concepts involved in one or more embodiments of this application will be explained.
[0031] Design draft: During the product development process, the visual drafts designed by the designer for the product consist of a series of different components arranged in a custom layout.
[0032] Basic elements: The elements that form the basis of the design draft, such as rectangles and text.
[0033] Layout tree: When designing a page, designers group elements according to the relationships between them. For example, they group product name text and product price text into product items. Based on the grouping relationship, the design draft or component can be abstracted into a multi-branch tree.
[0034] In existing technologies, designers group elements based on relationships when designing web pages, such as grouping product name text and product price text into a product item. Element grouping is crucial for standardizing the hierarchical structure of the design draft; for example, generating code from the design draft heavily relies on its hierarchical structure. However, because element grouping in the design draft only implicitly constrains the relationships between elements and is visually invisible, designers often focus more on visual experience and neglect the hierarchical structure, making subsequent code generation difficult. To address this issue, a trained model is typically used to segment the design draft layout, obtaining a layout tree to determine the corresponding hierarchical structure. However, this method requires manually labeling massive amounts of data, resulting in high training costs and significant data collection challenges.
[0035] Based on this, a page processing method is provided in this application. This application also relates to a page processing apparatus, a computing device, and a computer-readable storage medium, which will be described in detail in the following embodiments.
[0036] Figure 1 A flowchart of a page processing method according to an embodiment of this application is shown, which specifically includes the following steps:
[0037] Step 102: Determine the set of elements corresponding to the target page based on the layout diagram of the target page.
[0038] The target page can be understood as a web design draft or poster design draft, etc. The layout diagram of the target page can be understood as a layout diagram of the elements generated when designing the target page. The layout diagram includes the specific position of each element on the target page. Therefore, the set of elements corresponding to the target page can be determined based on the layout diagram of the target page.
[0039] In practical applications, the layout diagram can carry corresponding element information. The element set corresponding to the target page can be determined based on the element information. Since the layout diagram has already generated a corresponding hierarchical structure during the design process, the page processing method provided in this application will discard the original hierarchical structure when obtaining the layout diagram and integrate the elements in the layout diagram to obtain a basic element list, i.e., an element set. The element set includes all the elements contained in the layout diagram of the target page, and there is no relationship between each element in the element set.
[0040] In a specific embodiment of this application, a layout diagram of the target page is obtained, which carries corresponding element information, and the element set corresponding to the target page is determined based on the element information.
[0041] In another possible approach, the set of elements corresponding to the target page can be determined by performing image recognition on the layout diagram to identify the elements in the layout diagram.
[0042] Specifically, based on the layout diagram of the target page, the set of elements corresponding to the target page is determined, including:
[0043] By identifying the layout diagram of the target page, a set of elements corresponding to the target page is generated based on the identification results.
[0044] In practical applications, image recognition technology can be implemented based on a pre-trained image recognition model. By inputting a layout diagram into the image recognition model, each element in the layout diagram output by the image recognition model is obtained, thereby generating the set of elements corresponding to the target page.
[0045] In one specific embodiment of this application, a layout diagram of the target page is obtained, image recognition is performed on the layout diagram, and the set of elements corresponding to the target page is determined based on the recognition result.
[0046] In summary, using image recognition technology to obtain elements in a layout diagram can improve the accuracy and efficiency of element acquisition.
[0047] Step 104: Draw the element block corresponding to each element according to the attribute information of each element in the element set, and generate an element block distribution map according to the element block corresponding to each element.
[0048] Specifically, after obtaining the element set, in order to show the positional relationship of each element in the element set in the layout diagram, an element block distribution diagram corresponding to the layout diagram can be drawn based on each element in the element set and the attribute information corresponding to each element.
[0049] The attribute information for each element can include its position in the layout diagram, its size, and in practical applications, its coordinates in the layout diagram, its area, and its side length coordinate range. The element block corresponding to each element can be understood as a region block drawn based on the element's attribute information. See [link to relevant documentation]. Figure 2 , Figure 2 This is a schematic diagram of an element block distribution provided in one embodiment of this application. Figure 2 The diagram includes four element blocks. It can be seen that, based on the coordinates and size of each element in the layout diagram, the corresponding element block can be drawn. In practical applications, the position of each element block in the element block distribution diagram is related to the position of each element in the layout diagram.
[0050] In a specific embodiment of this application, an element block corresponding to each element is drawn based on the coordinate information and side length information of each element in the element set, and an element block distribution map is generated based on the combination of the element blocks corresponding to each element.
[0051] In summary, based on the coordinates and size of each element in the layout diagram, the element block corresponding to each element can be accurately drawn, and an element block distribution map corresponding to the layout diagram can be generated based on each element block. This facilitates the subsequent segmentation of the element block distribution map to achieve layout segmentation of the layout diagram.
[0052] Step 106: Perform iterative segmentation processing on the element block distribution map to determine the target segmentation region generated by the segmentation processing result of each iterative segmentation cycle.
[0053] Specifically, after obtaining the element block distribution map corresponding to the layout diagram through the above method, iterative segmentation processing can be performed on the element block distribution map, and the target segmentation region generated by the segmentation processing result of each iterative segmentation cycle can be determined. The target segmentation region includes an element block.
[0054] The iterative segmentation process can be understood as segmenting the element block distribution map to obtain two segmented regions corresponding to the first segmentation result. If the two segmented regions can still be segmented, a second segmentation process is performed to obtain two segmented regions corresponding to the second segmentation result. It is then determined whether a next segmentation can be performed until the target segmented region is obtained, i.e., the target segmented region cannot be segmented again.
[0055] In practical applications, after each iteration of the segmentation process, a corresponding segmented region can be obtained. If a segmented region contains only one element block, it is considered that the segmented region cannot be further segmented, and this segmented region is called the target segmented region. By iteratively segmenting the element block distribution map, the target segmented region corresponding to the segmentation result of each iteration can be obtained. After the segmentation process of the last iteration, the element block distribution map is divided into multiple segmented regions containing only one element block each. This segmentation process can be understood as the root node in the page layout tree diagram being continuously branched until it branches to the leaf node, thereby realizing the layout segmentation of the target page's layout diagram and constructing the page layout tree structure.
[0056] In a specific embodiment of this application, the element block distribution map is subjected to iterative segmentation. After each segmentation process of this iterative segmentation cycle, the number of element blocks in the segmented region obtained by the segmentation process is judged. If the segmented region includes at least two element blocks, the segmented region is further iteratively segmented. If the segmented region includes one element block, the segmented region is taken as the target segmented region.
[0057] In practical applications, to reduce the number of iterative segmentations, redundant element blocks in the element block distribution map can be deleted before iterative segmentation. Specifically, before iterative segmentation of the element block distribution map, the method further includes:
[0058] By deleting redundant element blocks from the element block distribution map, the target element block distribution map is obtained based on the deletion result.
[0059] Accordingly, the iterative segmentation process of the element block distribution map, determining the target segmentation region generated by the segmentation process in each iterative segmentation cycle, includes:
[0060] The target element block distribution map is iteratively segmented to determine the target segmentation region generated by the segmentation process in each iterative segmentation cycle.
[0061] Redundant element blocks can be understood as element blocks that can be simplified in advance in the element block distribution diagram. For example, if element block 1 and element block 2 are the same size in the element distribution diagram and are parallel in the vertical or horizontal direction, then element block 2 can be deleted as a redundant element block, and only element block 1 needs to be kept.
[0062] In practical applications, the element block distribution map after redundant element block deletion is structurally simpler, which can reduce the number of segmentations and improve segmentation efficiency during subsequent segmentation processing.
[0063] In a specific embodiment of this application, redundant element blocks are deleted from the element block distribution map. The target element block distribution map is obtained based on the deletion result. Subsequently, the target element blocks are iteratively segmented, and the target segmented region generated by the segmentation result of each iterative segmentation cycle is determined.
[0064] In another alternative approach, redundant element block deletion can be omitted, and the element block distribution map can be directly iteratively segmented. However, in this approach, deduplication is included in each iteration segmentation cycle. Based on the deduplication results, a deduplicated element block distribution map is obtained, and this map is then segmented. Specifically, the target segmentation region for any iteration segmentation cycle is obtained through the following methods:
[0065] Determine the target iteration segmentation period, perform iterative deduplication processing on the element block distribution map within the target iteration segmentation period, and obtain the deduplicated element block distribution map based on the iterative deduplication processing result;
[0066] The deduplication element block distribution map is segmented, and the target segmentation region corresponding to the target iteration segmentation period is obtained based on the segmentation result.
[0067] The target iterative segmentation period can be understood as an iterative segmentation period determined among multiple iterative segmentation periods. The segmentation steps in each iterative segmentation period are the same, including deduplication and segmentation. The deduplicated element block distribution map can be understood as the element block distribution map after deduplication. See [link to relevant documentation]. Figure 3 , Figure 3 This is a schematic diagram of the distribution of deduplicated element blocks provided in an embodiment of this application, wherein, Figure 3 (a) is the initial element block distribution map. Figure 3 (b) shows the distribution of duplicate element blocks after deduplication. Figure 3 In (b), the element block indicated by the dashed line is the element block to be deleted after deduplication. It should be noted that... Figure 3 (b) is a diagram showing the distribution of deduplicated element blocks after vertical deduplication. Figure 3 (c) is a distribution diagram of the deduplicated element blocks after deduplication in the horizontal direction.
[0068] In practical applications, the rule for deduplication can be for any pair of elements (e i ,e j If e is satisfied i Completely includes e in the vertical / horizontal direction j Then discard e jIn each iterative segmentation cycle, the element block distribution map is subjected to iterative deduplication. Iterative deduplication can be understood as deduplicating the element block distribution map to obtain the initial element block distribution map after deduplication. If the element blocks in the initial element block distribution map can still be deduplicated, the deduplication process will proceed to the next iterative deduplication cycle until the final deduplicated element block distribution map can no longer be deduplicated.
[0069] In a specific embodiment of this application, the target iterative segmentation period is determined as the first iterative segmentation period. During the target iterative segmentation period, the element block distribution map is iteratively deduplicated to obtain a deduplicated element block distribution map. The element blocks in the deduplicated element block distribution map can no longer be deduplicated. At this time, the deduplicated element block distribution map is segmented, and the target segmentation region corresponding to the target iterative segmentation period is obtained based on the segmentation result.
[0070] By adding iterative deduplication processing in each iterative segmentation cycle, fewer segmentation points are processed in each iterative segmentation cycle, improving the accuracy of each segmentation, reducing the iterative segmentation cycle, and improving segmentation efficiency.
[0071] In practical applications, during the iterative segmentation process, deduplication can be performed according to a preset deduplication strategy. Specifically, during the target iterative segmentation cycle, the element block distribution map is iteratively deduplicated, and a deduplicated element block distribution map is obtained based on the iterative deduplication results, including:
[0072] The coordinate information of each element block in the element block distribution map is determined according to a preset deduplication strategy;
[0073] Based on the coordinate information of each element block, the element blocks contained in the element block distribution map are iteratively deduplicated, and the deduplicated element block distribution map is obtained based on the iterative deduplication results.
[0074] The preset deduplication strategy can be understood as a deduplication rule. This includes vertical and horizontal deduplication strategies. Different strategies are used to deduplicate element blocks in the element block distribution map, and a different strategy can be selected for each iteration segmentation cycle. For example, a vertical deduplication strategy can be selected in the first iteration segmentation cycle, and a horizontal deduplication strategy can be selected in the second iteration segmentation cycle.
[0075] In practical applications, two deduplication strategies can be implemented, and segmentation processing can be performed based on each strategy. The final deduplication strategy is determined based on the segmentation results. After selecting a preset deduplication strategy, the coordinate information corresponding to each element block can be obtained according to the preset strategy. Deduplication is then performed based on the coordinate information of each element block. The coordinate information of each element block can be understood as the coordinate range of the element block's side length. For example, the coordinates of the length of an element block in the element block distribution map, or the coordinates of the width of an element block in the element block distribution map. Based on the coordinate information of the element blocks, it is determined whether the element blocks contain each other, thereby achieving the deduplication processing of the element blocks.
[0076] In one possible implementation, the preset deduplication strategy includes a vertical deduplication strategy;
[0077] The coordinate information of each element block in the element block distribution map is determined according to a preset deduplication strategy, including:
[0078] When the preset deduplication strategy is a vertical deduplication strategy, the vertical coordinate information of each element block in the element block distribution map is determined according to the vertical deduplication strategy.
[0079] In practical applications, when the preset deduplication strategy is set to vertical deduplication, it is necessary to determine the vertical coordinate information of each element block. The vertical coordinate information can be understood as the coordinate range of the element block's width in the element distribution map. By comparing the vertical coordinate information of each element block, the element blocks that need to be deduplicated can be determined. See also... Figure 3 , Figure 3 (b) is a schematic diagram of vertical deduplication. The vertical coordinate information of the lower left element block completely includes the vertical coordinate information of the lower right dashed element block, so it can be determined that the dashed element block can be deduplicated.
[0080] In another possible implementation, the preset deduplication strategy includes a horizontal deduplication strategy;
[0081] The coordinate information of each element block in the element block distribution map is determined according to a preset deduplication strategy, including:
[0082] When the preset deduplication strategy is a horizontal deduplication strategy, the horizontal coordinate information of each element block in the element block distribution map is determined according to the horizontal deduplication strategy.
[0083] In practical applications, when the preset deduplication strategy is horizontal deduplication, it is necessary to determine the horizontal coordinate information of each element block. The horizontal coordinate information can be understood as the coordinate range of the element block's length in the element distribution map. By comparing the horizontal coordinate information of each element block, the element blocks that need to be deduplicated can be determined. (See also...) Figure 3 , Figure 3(c) is a schematic diagram of deduplication in the horizontal direction. The horizontal coordinate information of the lower left element block completely includes the horizontal coordinate information of the two upper left dashed element blocks, so it can be determined that these two dashed element blocks can be deduplicated in the horizontal direction.
[0084] The deduplication process in each preset deduplication strategy can be performed in the following ways. Specifically, the distribution map of deduplicated element blocks in any iteration deduplication cycle can be obtained in the following ways, including:
[0085] Determine the first element block and the second element block in the element block distribution map;
[0086] Compare the coordinate information of the first element block and the second element block;
[0087] If the coordinate information of the first element block is greater than or equal to the coordinate information of the second element block, retain the first element block and delete the second element block, and obtain a deduplicated element block distribution map;
[0088] If the coordinate information of the first element block is less than that of the second element block, retain both the first element block and the second element block, and obtain a deduplicated element block distribution map.
[0089] Here, the first and second element blocks can be understood as the element blocks that need to be compared. Based on the comparison result, the element blocks that need to be deduplicated are determined. The coordinate information can be understood as the coordinate range information of the element blocks in the element distribution map. When the preset deduplication strategy is a vertical deduplication strategy, the vertical coordinate information of the element blocks is compared. When the preset deduplication strategy is a horizontal deduplication strategy, the horizontal coordinate information of the element blocks is compared.
[0090] In practical applications, when the coordinates of the first element block are greater than or equal to the coordinates of the second element block (meaning the coordinate range of the first element block completely encompasses the coordinate range of the second element block in the vertical or horizontal direction), the second element block is identified as the element block to be deduplicated. It is not considered in the current segmentation processing cycle, which can be understood as deleting the second element block in this cycle. Conversely, when the coordinates of the first element block are less than the coordinates of the second element block (meaning the coordinate range of the first element block does not completely encompass the coordinate range of the second element block), neither element block can be deduplicated, and both element blocks are retained.
[0091] In a specific embodiment of this application, a first element block and a second element block are determined. The preset deduplication strategy is a vertical deduplication strategy. The vertical coordinate information of the first element block and the second element block are compared. The vertical coordinate information of the first element block is [1,10], and the vertical coordinate information of the second element block is [2,5]. Since the coordinate information of the first element block is greater than that of the second element block, the first element block is retained and the second element block is deleted to obtain the deduplicated element block distribution map.
[0092] In each iterative segmentation cycle, deduplication processing is added to obtain a deduplicated element block distribution map, which reduces the number of segmentation points and improves segmentation efficiency when segmenting the deduplicated element block distribution map in subsequent steps.
[0093] Specifically, the element block distribution map is iteratively segmented to determine the target segmented region generated by the segmentation results of each iterative segmentation cycle, including:
[0094] In the i-th segmentation cycle, the element block distribution map is segmented to obtain at least two initial segmentation regions;
[0095] Determine whether each initial segmentation region in the at least two target segmentation regions contains at least two element blocks;
[0096] If so, i is incremented by 1, the initial segmentation region containing at least two element blocks is taken as the element block distribution map, and the element block distribution map is segmented in the i-th segmentation cycle.
[0097] If not, determine the target segmentation region generated by the segmentation processing result of each iterative segmentation cycle.
[0098] The iterative segmentation process includes segmenting the element distribution map over multiple cycles. For example, after the first iterative segmentation cycle, a first segmented region is obtained. If the first segmented region can still be segmented, the second iterative segmentation cycle can segment the first segmented region again until each segmented region obtained in the end cannot be segmented.
[0099] In practical applications, when a segmented region contains at least two element blocks, it can still be segmented. Only when a segmented region contains only one element block can it be further segmented. It's important to note that when a segmented region contains two element blocks and is used as the element block distribution map in the next iteration, this distribution map can be deduplicated and then segmented again in the next iteration. Through iterative segmentation of the element block distribution map, the resulting target segmented region will contain only one element block, achieving automatic downward iterative cutting of the element block distribution map.
[0100] In a specific embodiment of this application, the target iterative segmentation period is determined as the first segmentation period. The distribution map of deduplicated element blocks is segmented to obtain at least two initial segmentation regions. See [link to relevant documentation]. Figure 4 , Figure 4 This is a schematic diagram of the segmentation of a deduplication element block distribution map provided in an embodiment of this application, wherein, Figure 4 (a) is a schematic diagram of vertical segmentation under the vertical deduplication strategy. Figure 4 (b) is a schematic diagram of horizontal segmentation under the horizontal deduplication strategy. Figure 4 In (a), the vertical deduplication element block distribution map is vertically segmented to obtain three initial segmentation regions. The top two initial segmentation regions contain only one element block, so they can be used as target segmentation regions. The bottom initial segmentation region contains two element blocks, so it can be used as the deduplication element block distribution map for the second iteration segmentation cycle and segmented accordingly. Figure 4 In (b), the horizontal deduplication element block distribution map is horizontally divided to obtain two initial segmentation regions. The initial segmentation region on the left contains three element blocks, so this initial segmentation region can be used as the deduplication element block distribution map for the next iteration segmentation cycle. The initial segmentation region on the right contains only one element block, so this initial segmentation region can be used as the target segmentation region.
[0101] When deduplication is performed based on different preset deduplication strategies, subsequent segmentation processing must also be carried out according to the deduplication direction of the preset deduplication strategy. Specifically, the distribution map of the deduplicated element blocks is segmented to obtain at least two initial segmentation regions, including:
[0102] When the preset deduplication strategy is a vertical deduplication strategy, the deduplication element block distribution map is vertically segmented, and at least two initial vertical segmentation regions are obtained based on the vertical segmentation result.
[0103] When the preset deduplication strategy is a horizontal deduplication strategy, the deduplication element block distribution map is horizontally segmented, and at least two initial horizontal segmentation regions are obtained based on the horizontal segmentation result.
[0104] The at least two initial vertical segmentation regions are used as the at least two initial segmentation regions, or the at least two initial horizontal segmentation regions are used as the at least two initial segmentation regions.
[0105] In practical applications, when the preset deduplication strategy is vertical, subsequent segmentation should also be performed in the vertical direction. When the preset deduplication strategy is horizontal, subsequent segmentation should also be performed in the horizontal direction to obtain the element block distribution map after segmentation in both directions. In specific implementation, it is also necessary to calculate the segmentation weights according to the two different segmentation directions and select the method with the best segmentation effect as the final segmentation result.
[0106] Specifically, selecting from the at least two initial vertical segmentation regions and the at least two initial horizontal segmentation regions, and determining the at least two initial segmentation regions based on the selection results, including:
[0107] Calculate the vertical segmentation weight based on the element blocks in the at least two initial vertical segmentation regions, and calculate the horizontal segmentation weight based on the element blocks in the at least two initial horizontal segmentation regions;
[0108] Compare the vertical segmentation weights and the horizontal segmentation weights;
[0109] If the vertical segmentation weight is greater than the horizontal segmentation weight, then the at least two initial vertical segmentation regions are determined as the at least two initial segmentation regions.
[0110] If the vertical segmentation weight is less than the segmentation weight, the at least two initial horizontal segmentation regions are determined as the at least two initial segmentation regions.
[0111] The vertical segmentation weight can be understood as the weight value for segmentation in the vertical direction, and the horizontal segmentation weight can be understood as the weight value for segmentation in the horizontal direction. In practical terms, the segmentation weight is the alignment score of the element blocks in the segmented region obtained according to the segmentation direction. The higher the segmentation weight, the higher the alignment score of the element blocks in the segmented region, indicating that the segmentation effect according to the segmentation direction is better. Therefore, the segmentation direction with a higher segmentation weight should be selected for segmentation.
[0112] In practical applications, after segmenting according to the segmentation direction, segmented regions are obtained. Each segmented region contains at least one basic element. The alignment score, i.e., the segmentation weight, is calculated based on the boundaries of these elements. Suppose that segmentation is performed vertically, resulting in m segmented regions. The alignment score is calculated using the upper boundary coordinates T = {t1, t2, ...} and the lower boundary coordinates B = {b1, b2, ...} of these elements. The vertical alignment score can be calculated using Formula 1, as follows:
[0113]
[0114] Among them, score VThe vertical alignment score is the vertical segmentation weight; T is the upper boundary coordinate of the element block in the segmentation region, B is the lower boundary coordinate of the element block in the segmentation region, and std is the standard deviation of the coordinates.
[0115] Suppose we divide the data horizontally to obtain n segmented regions. Then, we calculate the alignment score using the left boundary coordinates L = {l1, l2, ...} and the right boundary coordinates R = {r1, r2, ...} of these elements. The horizontal alignment score can be calculated using Formula 2, as follows:
[0116]
[0117] Among them, score H is the horizontal alignment score, i.e., the horizontal segmentation weight; L is the left boundary coordinate of the element block, R is the right boundary coordinate of the element block, and std is the standard deviation of the coordinates.
[0118] The segmentation weights corresponding to vertical and horizontal segmentation are calculated using the two formulas above, and the initial segmentation region is selected based on the segmentation weights. This allows for the selection of a segmentation direction with better segmentation results, and the next iteration of segmentation processing can then be performed.
[0119] In a specific embodiment of this application, the vertical segmentation weight is calculated to be 0.6 based on the element blocks in the initial vertical segmentation region, and the horizontal segmentation weight is calculated to be 0.5 based on the element blocks in the horizontal segmentation region. This determines that the vertical segmentation effect is better. The segmentation region under the vertical segmentation is used as the initial segmentation region, and subsequent iterative segmentation processing is continued.
[0120] Step 108: Construct a tree structure for the page layout of the target page according to the generation order of each target segmentation region.
[0121] After completing the iterative segmentation process, multiple target segmentation regions are obtained. Each target segmentation region is generated in a different order. Therefore, based on the generation order of each target segmentation region, a page layout tree structure for the target page can be constructed. Specifically, the page layout tree structure for the target page is constructed according to the generation order of each target segmentation region, including:
[0122] Create corresponding tree nodes for each target segmentation region;
[0123] The parent node of each tree node is determined according to the generation order of each target segmentation region;
[0124] The connection relationship of each tree node is determined based on the tree parent node corresponding to each tree node;
[0125] The page layout tree structure of the target page is constructed based on the connection relationship of each tree node.
[0126] In this context, tree nodes can be understood as the representation of each target segmentation region in the page layout's tree structure. Based on the generation order of each target segmentation region, the parent node corresponding to each tree node can be determined. For example, if target segmentation region a is obtained by segmenting target segmentation region b, and target segmentation region c is obtained by segmenting target segmentation region a, then target segmentation region b is the parent node of target segmentation region a, and target segmentation region a is the parent node of target segmentation region c. Once the parent node corresponding to each tree node is determined, the connection relationships between each tree node can be determined, thereby constructing the page layout's tree structure. See also... Figure 5 , Figure 5 This is a schematic diagram of a page layout tree structure provided in one embodiment of this application, wherein each leaf node represents a target segmentation region, for example... Figure 5 The 'c' node in the page layout tree structure clearly shows the hierarchical structure of the target page, making it easier for designers to generate code for the target page based on this layout tree structure.
[0127] This application provides a page processing method, comprising: determining an element set corresponding to the target page based on a layout diagram of the target page; drawing an element block corresponding to each element based on the attribute information of each element in the element set, and generating an element block distribution map based on the element blocks corresponding to each element; performing iterative segmentation processing on the element block distribution map to determine the target segmentation region generated by the segmentation processing result of each iterative segmentation cycle; and constructing a page layout tree structure of the target page according to the generation order of each target segmentation region. By drawing the corresponding element block distribution map based on the layout diagram of the target page, and then performing iterative segmentation processing on the element block distribution map to obtain the target segmentation region corresponding to each iterative segmentation cycle, the page layout tree structure of the target page can be constructed according to the generation order of each target segmentation region, eliminating the need for manual segmentation of the target page and improving segmentation efficiency. Furthermore, the obtained page layout tree structure can also be used as training data for a layout segmentation model, expanding the training data.
[0128] The following is in conjunction with the appendix Figure 6 Taking the application of the page processing method provided in this application in page segmentation as an example, the page processing method will be further explained. Among them, Figure 6 This application provides a flowchart of a page processing method for segmented pages, which includes the following steps:
[0129] Step 602: By recognizing the layout diagram of the target page, generate the element set corresponding to the target page based on the recognition result.
[0130] Step 604: Draw the element block corresponding to each element based on the attribute information of each element in the element set.
[0131] Each element's attribute information includes its coordinates and side length.
[0132] Step 606: Generate an element block distribution map based on the element blocks corresponding to each element.
[0133] Step 608: Determine the vertical coordinate information of each element block in the element block distribution map according to the vertical deduplication strategy, iterate the deduplication of the element blocks contained in the element block distribution map according to the vertical coordinate information of each element block, and obtain the vertical deduplication element block distribution map according to the iterative deduplication result.
[0134] Step 610: Determine the horizontal coordinate information of each element block in the element block distribution map according to the horizontal deduplication strategy, iterate the deduplication of the element blocks contained in the element block distribution map according to the horizontal coordinate information of each element block, and obtain the horizontal deduplication element block distribution map according to the iterative deduplication result.
[0135] Step 612: Perform vertical segmentation on the vertical deduplication element block distribution map, and obtain two initial vertical segmentation regions based on the vertical segmentation results.
[0136] Step 614: Perform horizontal segmentation on the horizontal deduplication element block distribution map, and obtain two initial horizontal segmentation regions based on the horizontal segmentation results.
[0137] Step 616: Calculate the vertical segmentation weight based on the element blocks in the two initial vertical segmentation regions, and calculate the horizontal segmentation weight based on the element blocks in the two initial horizontal segmentation regions.
[0138] The vertical segmentation weight is 0.8, and the horizontal segmentation weight is 0.3.
[0139] Step 618: Compare the vertical segmentation weight and the horizontal segmentation weight, determine the target segmentation region based on the comparison result, and continue to perform iterative segmentation processing until each segmentation region contains only one element block.
[0140] The target segmentation region is a vertical segmentation region.
[0141] Step 620: Construct a tree structure for the page layout of the target page according to the generation order of each target segmentation region.
[0142] This application provides a page processing method for layout segmentation. It involves drawing a corresponding element block distribution map based on the layout diagram of the target page, then iteratively segmenting the element block distribution map. In each iteration, vertical and horizontal segmentation are performed separately. Based on the calculation of segmentation weights, the segmentation direction with better segmentation effect is selected. Subsequently, based on the generation order of each target segmented region, a page layout tree structure of the target page is constructed, achieving automatic layout segmentation of the target page and improving the efficiency of layout segmentation.
[0143] Corresponding to the above method embodiments, this application also provides page processing apparatus embodiments. Figure 7 A schematic diagram of the structure of a page processing apparatus according to an embodiment of this application is shown. Figure 7 As shown, the device includes:
[0144] The determining module 702 is configured to determine the set of elements corresponding to the target page based on the layout diagram of the target page;
[0145] The drawing module 704 is configured to draw the element block corresponding to each element according to the attribute information of each element in the element set, and generate an element block distribution map according to the element block corresponding to each element.
[0146] The segmentation module 706 is configured to perform iterative segmentation processing on the element block distribution map and determine the target segmentation region generated by the segmentation processing result of each iterative segmentation cycle.
[0147] The construction module 708 is configured to construct a page layout tree structure of the target page according to the generation order of each target segmentation region.
[0148] Optionally, the determining module 702 is further configured to:
[0149] By identifying the layout diagram of the target page, a set of elements corresponding to the target page is generated based on the identification results.
[0150] Optionally, the segmentation module 706 is further configured to:
[0151] Determine the target iteration segmentation period, perform iterative deduplication processing on the element block distribution map within the target iteration segmentation period, and obtain the deduplicated element block distribution map based on the iterative deduplication processing result;
[0152] The deduplication element block distribution map is segmented, and the target segmentation region corresponding to the target iteration segmentation period is obtained based on the segmentation result.
[0153] Optionally, the segmentation module 706 is further configured to:
[0154] The coordinate information of each element block in the element block distribution map is determined according to a preset deduplication strategy;
[0155] Based on the coordinate information of each element block, the element blocks contained in the element block distribution map are iteratively deduplicated, and the deduplicated element block distribution map is obtained based on the iterative deduplication results.
[0156] Optionally, the segmentation module 706 is further configured to:
[0157] When the preset deduplication strategy is a vertical deduplication strategy, the vertical coordinate information of each element block in the element block distribution map is determined according to the vertical deduplication strategy;
[0158] When the preset deduplication strategy is a horizontal deduplication strategy, the horizontal coordinate information of each element block in the element block distribution map is determined according to the horizontal deduplication strategy.
[0159] Optionally, the segmentation module 706 is further configured to:
[0160] Determine the first element block and the second element block in the element block distribution map;
[0161] Compare the coordinate information of the first element block and the second element block;
[0162] If the coordinate information of the first element block is greater than or equal to the coordinate information of the second element block, retain the first element block and delete the second element block, and obtain a deduplicated element block distribution map;
[0163] If the coordinate information of the first element block is less than that of the second element block, retain both the first element block and the second element block, and obtain a deduplicated element block distribution map.
[0164] Optionally, the segmentation module 706 is further configured to:
[0165] In the i-th segmentation cycle, the element block distribution map is segmented to obtain at least two initial segmentation regions;
[0166] Determine whether each initial segmentation region in the at least two target segmentation regions contains at least two element blocks;
[0167] If so, i is incremented by 1, the initial segmentation region containing at least two element blocks is taken as the element block distribution map, and the element block distribution map is segmented in the i-th segmentation cycle.
[0168] If not, determine the target segmentation region generated by the segmentation processing result of each iterative segmentation cycle.
[0169] Optionally, the segmentation module 706 is further configured to:
[0170] When the preset deduplication strategy is a vertical deduplication strategy, the deduplication element block distribution map is vertically segmented, and at least two initial vertical segmentation regions are obtained based on the vertical segmentation result.
[0171] When the preset deduplication strategy is a horizontal deduplication strategy, the deduplication element block distribution map is horizontally segmented, and at least two initial horizontal segmentation regions are obtained based on the horizontal segmentation result.
[0172] The at least two initial vertical segmentation regions are used as the at least two initial segmentation regions, or the at least two initial horizontal segmentation regions are used as the at least two initial segmentation regions.
[0173] Optionally, the segmentation module 706 is further configured to:
[0174] Calculate the vertical segmentation weight based on the element blocks in the at least two initial vertical segmentation regions, and calculate the horizontal segmentation weight based on the element blocks in the at least two initial horizontal segmentation regions;
[0175] Compare the vertical segmentation weights and the horizontal segmentation weights;
[0176] If the vertical segmentation weight is greater than the horizontal segmentation weight, then the at least two initial vertical segmentation regions are determined as the at least two initial segmentation regions.
[0177] If the vertical segmentation weight is less than the segmentation weight, the at least two initial horizontal segmentation regions are determined as the at least two initial segmentation regions.
[0178] Optionally, the building module 708 is further configured to:
[0179] Create corresponding tree nodes for each target segmentation region;
[0180] The parent node of each tree node is determined according to the generation order of each target segmentation region;
[0181] The connection relationship of each tree node is determined based on the tree parent node corresponding to each tree node;
[0182] The page layout tree structure of the target page is constructed based on the connection relationship of each tree node.
[0183] Optionally, the device further includes a deletion module configured to:
[0184] By deleting redundant element blocks from the element block distribution map, the target element block distribution map is obtained based on the deletion results.
[0185] This application provides a page processing apparatus, comprising: a determining module configured to determine an element set corresponding to the target page based on a layout diagram of the target page; a drawing module configured to draw an element block corresponding to each element based on the attribute information of each element in the element set, and generate an element block distribution map based on the element blocks corresponding to each element; a segmentation module configured to perform iterative segmentation processing on the element block distribution map, and determine the target segmentation region generated by the segmentation processing result of each iterative segmentation cycle; and a construction module configured to construct a page layout tree structure of the target page according to the generation order of each target segmentation region. By drawing the corresponding element block distribution map based on the layout diagram of the target page, and then performing iterative segmentation processing on the element block distribution map to obtain the target segmentation region corresponding to each iterative segmentation cycle, the page layout tree structure of the target page can be constructed according to the generation order of each target segmentation region, eliminating the need for manual segmentation of the target page and improving segmentation efficiency.
[0186] The above is an illustrative scheme of a page processing apparatus according to this embodiment. It should be noted that the technical solution of this page processing apparatus and the technical solution of the page processing method described above belong to the same concept. For details not described in detail in the technical solution of the page processing apparatus, please refer to the description of the technical solution of the page processing method described above.
[0187] Figure 8 A structural block diagram of a computing device 800 according to an embodiment of this application is shown. The components of the computing device 800 include, but are not limited to, a memory 810 and a processor 820. The processor 820 is connected to the memory 810 via a bus 830, and a database 850 is used to store data.
[0188] The computing device 800 also includes an access device 840, which enables the computing device 800 to communicate via one or more networks 860. Examples of these networks include a Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 840 may include one or more of any type of wired or wireless network interface (e.g., a Network Interface Card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) interface, a Wi-MAX interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.
[0189] In one embodiment of this application, the aforementioned components of the computing device 800 and Figure 8 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 8 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this application. Those skilled in the art can add or replace other components as needed.
[0190] The computing device 800 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or PCs. The computing device 800 can also be a mobile or stationary server.
[0191] The processor 820 implements the page processing method when executing the computer instructions.
[0192] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the page processing method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the page processing method described above.
[0193] An embodiment of this application also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the steps of the page processing method described above.
[0194] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the page processing method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the page processing method described above.
[0195] The foregoing has described specific embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0196] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.
[0197] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0198] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0199] The preferred embodiments disclosed above are merely illustrative of this application. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this application. These embodiments are selected and specifically described in this application to better explain the principles and practical applications of this application, thereby enabling those skilled in the art to better understand and utilize this application. This application is limited only by the claims and their full scope and equivalents.
Claims
1. A page processing method, characterized in that, include: The layout diagram of the target page is input into the image recognition model, the hierarchical structure is discarded, and the element set corresponding to the target page is determined; the target page includes the page design draft, and the element set includes all elements contained in the layout diagram of the target page; The element block corresponding to each element is drawn according to the attribute information of each element in the element set, and the element block distribution map is generated according to the element block corresponding to each element. The attribute information includes the coordinate information of the element in the layout diagram, the area information of each element, and the coordinate range of the side length. The element block distribution map is iteratively segmented to determine the target segmentation region generated by the segmentation process in each iterative segmentation cycle. The process of iteratively segmenting the element block distribution map includes: determining a target iterative segmentation period; performing iterative deduplication on the element block distribution map within the target iterative segmentation period according to a preset deduplication strategy; obtaining a deduplicated element block distribution map based on the iterative deduplication results; segmenting the deduplicated element block distribution map according to the deduplication direction of the preset deduplication strategy; calculating the segmentation weights for segmentation according to two different segmentation directions; selecting the segmentation method with the higher segmentation weight as the final segmentation result; and obtaining the target segmentation region corresponding to the target iterative segmentation period based on the segmentation results. The preset deduplication strategy includes a vertical deduplication strategy and a horizontal deduplication strategy. The calculation method of the segmentation weight includes segmenting according to the segmentation direction to obtain a segmentation region, the segmentation region containing at least one basic element; calculating the segmentation weight based on the boundary of the element; the segmentation weight includes a vertical segmentation weight and a horizontal segmentation weight; and the calculation formula for the vertical segmentation weight is as follows: in, is the vertical segmentation weight; T is the upper boundary coordinate of the element block in the segmentation region, B is the lower boundary coordinate of the element block in the segmentation region, and std is the standard deviation of the coordinates; The connection relationship of each tree node is determined according to the generation order of each target segmentation region, and the page layout tree structure of the target page is constructed based on the connection relationship of each tree node.
2. The method as described in claim 1, characterized in that, The layout diagram of the target page is input into the image recognition model to determine the set of elements corresponding to the target page, including: By identifying the layout diagram of the target page, a set of elements corresponding to the target page is generated based on the identification results.
3. The method as described in claim 1, characterized in that, The target segmentation region for any given iterative segmentation cycle is obtained through the following methods: Determine the target iteration segmentation period, perform iterative deduplication processing on the element block distribution map within the target iteration segmentation period, and obtain the deduplicated element block distribution map based on the iterative deduplication processing result; The deduplication element block distribution map is segmented, and the target segmentation region corresponding to the target iteration segmentation period is obtained based on the segmentation result.
4. The method as described in claim 3, characterized in that, In the target iterative segmentation cycle, the element block distribution map is iteratively deduplicated, and a deduplicated element block distribution map is obtained based on the iterative deduplication result, including: The coordinate information of each element block in the element block distribution map is determined according to a preset deduplication strategy; Based on the coordinate information of each element block, the element blocks contained in the element block distribution map are iteratively deduplicated, and the deduplicated element block distribution map is obtained based on the iterative deduplication results.
5. The method as described in claim 4, characterized in that, The coordinate information of each element block in the element block distribution map is determined according to a preset deduplication strategy, including: When the preset deduplication strategy is a vertical deduplication strategy, the vertical coordinate information of each element block in the element block distribution map is determined according to the vertical deduplication strategy; When the preset deduplication strategy is a horizontal deduplication strategy, the horizontal coordinate information of each element block in the element block distribution map is determined according to the horizontal deduplication strategy.
6. The method as described in claim 4, characterized in that, The distribution map of deduplication elements corresponding to any iteration deduplication cycle can be obtained in the following ways: Determine the first element block and the second element block in the element block distribution map; Compare the coordinate information of the first element block and the second element block; If the coordinate information of the first element block is greater than or equal to the coordinate information of the second element block, retain the first element block and delete the second element block, and obtain a deduplicated element block distribution map; If the coordinate information of the first element block is less than that of the second element block, retain both the first element block and the second element block, and obtain a deduplicated element block distribution map.
7. The method as described in claim 1, characterized in that, The element block distribution map is iteratively segmented to determine the target segmented region generated by the segmentation result of each iterative segmentation cycle, including: In the i-th segmentation cycle, the element block distribution map is segmented to obtain at least two initial segmentation regions; Determine whether each initial segmentation region in the at least two target segmentation regions contains at least two element blocks; If so, i is incremented by 1, the initial segmentation region containing at least two element blocks is taken as the element block distribution map, and the element block distribution map is segmented in the i-th segmentation cycle. If not, determine the target segmentation region generated by the segmentation processing result of each iterative segmentation cycle.
8. The method as described in claim 4, characterized in that, The deduplication element block distribution map is segmented to obtain at least two initial segmentation regions, including: When the preset deduplication strategy is a vertical deduplication strategy, the deduplication element block distribution map is vertically segmented, and at least two initial vertical segmentation regions are obtained based on the vertical segmentation result. When the preset deduplication strategy is a horizontal deduplication strategy, the deduplication element block distribution map is horizontally segmented, and at least two initial horizontal segmentation regions are obtained based on the horizontal segmentation result. The at least two initial vertical segmentation regions are used as the at least two initial segmentation regions, or the at least two initial horizontal segmentation regions are used as the at least two initial segmentation regions.
9. The method as described in claim 8, characterized in that, The method further includes: Calculate the vertical segmentation weight based on the element blocks in the at least two initial vertical segmentation regions, and calculate the horizontal segmentation weight based on the element blocks in the at least two initial horizontal segmentation regions; Compare the vertical segmentation weights and the horizontal segmentation weights; If the vertical segmentation weight is greater than the horizontal segmentation weight, then the at least two initial vertical segmentation regions are determined as the at least two initial segmentation regions. If the vertical segmentation weight is less than the segmentation weight, the at least two initial horizontal segmentation regions are determined as the at least two initial segmentation regions.
10. The method as described in claim 1, characterized in that, Based on the generation order of each target segmentation region, a tree structure for the page layout of the target page is constructed, including: Create corresponding tree nodes for each target segmentation region; The parent node of each tree node is determined according to the generation order of each target segmentation region; The connection relationship of each tree node is determined based on the tree parent node corresponding to each tree node; The page layout tree structure of the target page is constructed based on the connection relationship of each tree node.
11. The method as described in claim 1, characterized in that, Before performing iterative segmentation on the element block distribution map, the method further includes: By deleting redundant element blocks from the element block distribution map, the target element block distribution map is obtained based on the deletion result. Accordingly, the iterative segmentation process of the element block distribution map, determining the target segmentation region generated by the segmentation process in each iterative segmentation cycle, includes: The target element block distribution map is iteratively segmented to determine the target segmentation region generated by the segmentation process in each iterative segmentation cycle.
12. A page processing apparatus, characterized in that, include: The determination module is configured to input the layout diagram of the target page into the image recognition model, discard the hierarchical structure, and determine the element set corresponding to the target page; the target page includes the page design draft, and the element set includes all elements contained in the layout diagram of the target page; The drawing module is configured to draw the element block corresponding to each element according to the attribute information of each element in the element set, and generate an element block distribution map according to the element block corresponding to each element. The attribute information includes the coordinate information of the element in the layout diagram, the area information of each element, and the side length coordinate range. The segmentation module is configured to perform iterative segmentation processing on the element block distribution map and determine the target segmentation region generated by the segmentation processing result of each iterative segmentation cycle. The process of iteratively segmenting the element block distribution map includes: determining a target iterative segmentation period; performing iterative deduplication on the element block distribution map within the target iterative segmentation period according to a preset deduplication strategy; obtaining a deduplicated element block distribution map based on the iterative deduplication results; segmenting the deduplicated element block distribution map according to the deduplication direction of the preset deduplication strategy; calculating the segmentation weights for segmentation according to two different segmentation directions; selecting the segmentation method with the higher segmentation weight as the final segmentation result; and obtaining the target segmentation region corresponding to the target iterative segmentation period based on the segmentation results. The preset deduplication strategy includes a vertical deduplication strategy and a horizontal deduplication strategy. The calculation method of the segmentation weight includes segmenting according to the segmentation direction to obtain a segmentation region, the segmentation region containing at least one basic element; calculating the segmentation weight based on the boundary of the element; the segmentation weight includes a vertical segmentation weight and a horizontal segmentation weight; and the calculation formula for the vertical segmentation weight is as follows: in, is the vertical segmentation weight; T is the upper boundary coordinate of the element block in the segmentation region, B is the lower boundary coordinate of the element block in the segmentation region, and std is the standard deviation of the coordinates; The building module is configured to determine the connection relationship of each tree node according to the generation order of each target segmentation region, and build the page layout tree structure of the target page based on the connection relationship of each tree node.
13. A computing device, comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, characterized in that, When the processor executes the computer instructions, it implements the steps of the method according to any one of claims 1-11.
14. A computer-readable storage medium storing computer instructions, characterized in that, When executed by a processor, the computer instructions implement the steps of the method according to any one of claims 1-11.