Component similarity determination method and apparatus
By calculating the element outlines and layout information of components, the similarity of components is determined, which solves the problems of low efficiency and inconsistent standards in the manual classification of components in the existing technology, and realizes more efficient and accurate component classification and storage.
Patent Information
- Application Number
- CN202310409334.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-17
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2043-04-17
AI Technical Summary
In existing technologies, due to different naming methods for components by page creators, the classification of similar components can only be done manually, which is inefficient and lacks standardized criteria, resulting in inaccurate classification.
By determining the element outline and layout information of the target component and related components, the similarity in visual and layout dimensions is calculated to determine the component similarity, which is then used for component classification and storage.
It improves the efficiency and accuracy of component similarity calculation and enhances the efficiency of component classification and storage.
Smart Images

Figure CN116383674B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present specification relates to the technical field of computer, and particularly relates to a component similarity determination method. The present specification also relates to a component similarity determination device, a computing device and a computer readable storage medium. BACKGROUND
[0002] With the development of computer technology, design software emerges as the times require. By means of various design software, page drawing is carried out, which can provide more standardized and clearer pages for users and can also classify and store components in the pages so as to reuse the components in subsequent page drawing. However, in the prior art, due to different naming methods of components by page drawers, the classification of similar components can only be manually carried out by the page drawers according to the similarity between the components, which is low in classification efficiency and the classification standard cannot be unified, thus leading to inaccurate classification. Therefore, there is an urgent need for a relatively effective component similarity determination method to solve the above problems. SUMMARY
[0003] Therefore, the embodiment of the present specification provides a component similarity determination method. The present specification also relates to a component similarity determination device, a computing device and a computer readable storage medium to solve the technical defects in the prior art.
[0004] According to a first aspect of the embodiment of the present specification, a component similarity determination method is provided, comprising:
[0005] determining target element contour information and target element layout information of a target element in a target component and associated element contour information and associated element layout information of an associated element in an associated component, wherein the target component and the associated component belong to a target object;
[0006] based on the target element contour information and the associated element contour information, calculating contour similarity of the target component and the associated component in a visual dimension, and based on the target element layout information and the associated element layout information, calculating layout similarity of the target component and the associated component in a layout dimension;
[0007] based on the contour similarity and the layout similarity, determining component similarity between the target component and the associated component, wherein the component similarity is used for classifying and storing components in the target object.
[0008] Optionally, the determining target element contour information and target element layout information of a target element in a target component and associated element contour information and associated element layout information of an associated element in an associated component comprises:
[0009] selecting a target component in the target object, and determining a target element contained in the target component;
[0010] determining target element contour information and target element layout information associated with the type of the target element;
[0011] selecting an associated component in the target object, and determining an associated element contained in the associated component;
[0012] determining associated element contour information and associated element layout information associated with the type of the associated element.
[0013] Optionally, the determining the target element contour information and the target element layout information associated with the type of the target element comprises:
[0014] in a case where the type of the target element is a text type, taking target text font information of the target element as the target element contour information of the target element; or in a case where the type of the target element is an icon type, taking target icon information of the target element as the target element contour information of the target element;
[0015] determining a target bounding rectangle of the target element, and a target rectangle associated with the target component;
[0016] calculating target layout information of the target element in the target component as the target element layout information based on target bounding rectangle coordinate information and target bounding rectangle side length information of the target bounding rectangle, and target rectangle coordinate information and target rectangle side length information of the target rectangle.
[0017] Optionally, the determining the associated element contour information and the associated element layout information associated with the type of the associated element comprises:
[0018] in a case where the type of the associated element is a text type, taking associated text font information of the associated element as the associated element contour information of the associated element; or in a case where the type of the associated element is an icon type, taking associated icon information of the associated element as the associated element contour information of the associated element;
[0019] determining an associated bounding rectangle of the associated element, and an associated rectangle of the associated component;
[0020] calculating associated layout information of the associated element in the associated component as the associated element layout information based on associated bounding rectangle coordinate information and associated bounding rectangle side length information of the associated bounding rectangle, and associated rectangle coordinate information and associated rectangle side length information of the associated rectangle.
[0021] Optionally, before the step of determining the target element contour information and the target element layout information of the target element in the target component and the associated element contour information and the associated element layout information of the associated element in the associated component, the method further comprises:
[0022] selecting the target component and the associated component in the target object, and selecting the target element in the target component and the associated element in the associated component;
[0023] determining whether the type of the target element is the same as the type of the associated element;
[0024] if yes, performing the step of determining the target element contour information and the target element layout information of the target element in the target component;
[0025] if no, determining whether there is an unselected element in the associated component; if yes, selecting a reference element in the associated component, taking the reference element as the associated element, and performing the step of determining whether the type of the target element is the same as the type of the associated element; if no, selecting a reference component in the target object, taking the reference component as the associated component, and performing the step of determining the target element contour information and the target element layout information of the target element in the target component.
[0026] Optionally, in the case that the target element and the associated element are at least one, the step of calculating the contour similarity of the target component and the associated component in the visual dimension based on the target element contour information and the associated element contour information comprises:
[0027] generating at least one contour element pair based on the at least one target element and the at least one associated element;
[0028] calculating the element contour similarity of each contour element pair corresponding to each target element and each associated element;
[0029] dividing the at least one contour element pair into a contour element pair set corresponding to the object element;
[0030] determining the element contour similarity of the contour element pair contained in the contour element pair set corresponding to each object element based on the element contour similarity of each contour element pair;
[0031] constructing a contour similarity set corresponding to each object element according to the element contour similarity of the contour element pair contained in the contour element pair set corresponding to each object element;
[0032] The profile similarity of the target component and the associated component in the visual dimension is calculated based on the target element profile similarity selected from the profile similarity set corresponding to each object element.
[0033] Optionally, when the target element and the associated element are at least one respectively, the layout similarity of the target component and the associated component in the layout dimension is calculated based on the target element layout information and the associated element layout information, including:
[0034] At least one layout element pair is generated based on at least one target element and at least one associated element.
[0035] The element layout similarity corresponding to each layout element pair is calculated according to the target element layout information of each target element and the associated element layout information of each associated element.
[0036] The at least one layout element pair is divided into a layout element pair set corresponding to the object element.
[0037] The element layout similarity of the layout element pair contained in the layout element pair set corresponding to each object element is determined based on the element layout similarity corresponding to each layout element pair.
[0038] The layout similarity set corresponding to each object element is constructed according to the element layout similarity of the layout element pair contained in the layout element pair set corresponding to each object element.
[0039] The layout similarity of the target component and the associated component in the layout dimension is calculated based on the target element layout similarity selected from the layout similarity set corresponding to each object element.
[0040] Optionally, when the target element type of the target element is a text type and the associated element type of the associated element is a text type, the calculation of the element profile similarity between any one target element and any one associated element includes:
[0041] The font size similarity between the target element and the associated element is calculated based on the target font size information contained in the target element profile information and the associated font size information contained in the associated element profile information.
[0042] The line similarity between the target element and the associated element is calculated based on the target line information contained in the target element profile information and the associated line information contained in the associated element profile information.
[0043] The element profile similarity between the target element and the associated element is calculated based on the font size similarity and the line similarity.
[0044] Optionally, in the case that the target element type of the target element is a text type and the associated element type of the associated element is a text type, the calculation of the element layout similarity between any one target element and any one associated element comprises:
[0045] calculating a text vertical similarity between the target element and the associated element based on the target upper distance information and the target lower distance information contained in the target element layout information, and the associated upper distance information and the associated lower distance information contained in the associated element layout information;
[0046] calculating a text horizontal similarity between the target element and the associated element based on the target left distance information, the target right distance information and the target center distance information contained in the target element layout information, and the associated left distance information, the associated right distance information and the associated center distance information contained in the associated element layout information;
[0047] calculating the element layout similarity between the target element and the associated element based on the text vertical similarity and the text horizontal similarity.
[0048] Optionally, in the case that the target element type of the target element is an icon type and the associated element type of the associated element is an icon type, the calculation of the element contour similarity between any one target element and any one associated element comprises:
[0049] calculating an icon height similarity between the target element and the associated element based on the target icon height information contained in the target element contour information, and the associated icon height information contained in the associated element contour information;
[0050] calculating an icon width similarity between the target element and the associated element based on the target icon width information contained in the target element contour information, and the associated icon width information contained in the associated element contour information;
[0051] calculating the element contour similarity between the target element and the associated element based on the icon height similarity and the icon width similarity.
[0052] Optionally, in the case that the target element type of the target element is an icon type and the associated element type of the associated element is an icon type, the calculation of the element layout similarity between any one target element and any one associated element comprises:
[0053] calculate an icon vertical similarity between the target element and the associated element based on target upper distance information and target lower distance information contained in the target element layout information and associated upper distance information and associated lower distance information contained in the associated element layout information;
[0054] calculate an icon horizontal similarity between the target element and the associated element based on target left distance information and target right distance information contained in the target element layout information and associated left distance information and associated right distance information contained in the associated element layout information;
[0055] calculate an element layout similarity between the target element and the associated element based on the icon vertical similarity and the icon horizontal similarity.
[0056] Optionally, the determining the component similarity between the target component and the associated component based on the contour similarity and the layout similarity comprises:
[0057] in a case where the contour similarity is greater than or equal to a preset similarity threshold, taking the layout similarity as the component similarity between the target component and the associated component;
[0058] in a case where the contour similarity is less than the preset similarity threshold, the component similarity between the target component and the associated component is zero.
[0059] According to a second aspect of an embodiment of the present specification, a component similarity determination apparatus is provided, comprising:
[0060] an information determination module configured to determine target element contour information and target element layout information of a target element in a target component and associated element contour information and associated element layout information of an associated element in an associated component, wherein the target component and the associated component belong to a target object;
[0061] a calculation module configured to calculate a contour similarity of the target component and the associated component in a visual dimension based on the target element contour information and the associated element contour information, and calculate a layout similarity of the target component and the associated component in a layout dimension based on the target element layout information and the associated element layout information;
[0062] a similarity determination module configured to determine a component similarity between the target component and the associated component based on the contour similarity and the layout similarity, wherein the component similarity is used for classifying and storing components in the target object.
[0063] According to a third aspect of an embodiment of the present specification, a computing device is provided, comprising:
[0064] a memory and a detector;
[0065] The memory is configured to store computer-executable instructions, and the detector is configured to execute the computer-executable instructions, which, when executed by the detector, implement the steps of the component similarity determination method.
[0066] According to a fourth aspect of an embodiment of the present specification, a computer-readable storage medium is provided, which stores computer-executable instructions, which, when executed by a detector, implement the steps of the component similarity determination method.
[0067] The component similarity determination method provided by the present specification determines target element contour information and target element layout information of a target element in a target component, and associated element contour information and associated element layout information of an associated element in an associated component, wherein the target component and the associated component belong to a target object; based on the target element contour information and the associated element contour information, contour similarity of the target component and the associated component in a visual dimension is calculated, and based on the target element layout information and the associated element layout information, layout similarity of the target component and the associated component in a layout dimension is calculated; based on the contour similarity and the layout similarity, component similarity between the target component and the associated component is determined, wherein the component similarity is used for classifying and storing components in the target object.
[0068] An embodiment of the present specification calculates component similarity between a target component and an associated component in a target object according to target element contour information and target element layout information of a target element in the target component, and associated element contour information and associated element layout information of an associated element in the associated component, thereby improving calculation efficiency and calculation accuracy of the component similarity; and classifies and stores the target component and the associated component according to the component similarity between the target component and the associated component, thereby improving efficiency of classifying and storing the target component and the associated component in the target object. BRIEF DESCRIPTION OF DRAWINGS
[0069] Figure 1 is a structural schematic diagram of a component similarity determination method provided by an embodiment of the present specification;
[0070] Figure 2 is a flowchart of a component similarity determination method provided by an embodiment of the present specification;
[0071] Figure 3 is a component schematic diagram of a component similarity determination method provided by an embodiment of the present specification;
[0072] Figure 4 is a similarity calculation schematic diagram of a component similarity determination method provided by an embodiment of the present specification;
[0073] Figure 5 is a detection flowchart of a component similarity determination method applied to design draft component similarity calculation provided by an embodiment of the present specification;
[0074] Figure 6 is a structural schematic diagram of a component similarity determination device provided by an embodiment of the present specification;
[0075] Figure 7 is a structural block diagram of a computing device provided by an embodiment of the present specification. DETAILED DESCRIPTION
[0076] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present specification. However, the present specification can be practiced without the specific details, other than those described herein, and it is understood that the scope of the present specification is not limited to the details of the description.
[0077] The terminology used in one or more embodiments of the present specification is for the purpose of describing particular embodiments only and is not intended to be limiting of one or more embodiments of the present specification. As used in one or more embodiments of the present specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in one or more embodiments of the present specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0078] It will be understood that, although the terms first, second, etc. can be employed in describing various information, such information should not be limited to these terms. These terms are only used to differentiate one piece of information from another. For example, a first can be termed a second, and, similarly, a second can be termed a first, without departing from the scope of one or more embodiments of the present specification. Depending on the context, the word "if' as used herein can be interpreted to mean "when" or "in response to determining" or "in response to a determination."
[0079] Maximum matching algorithm (Maximum Matching): mainly includes forward maximum matching algorithm, reverse maximum matching algorithm, bidirectional matching algorithm, etc. The main principle is to split the single string, and then compare with the word library, if it is a word, it is recorded, otherwise by increasing or decreasing a single word, continue to compare, if there is still one single word, terminate, if the single string cannot be split, it is treated as an unregistered word.
[0080] First, the noun terms related to one or more embodiments of the present specification are explained.
[0081] Hungarian algorithm: an algorithm in graph theory that finds the maximum matching in a bipartite graph.
[0082] With the development of computer technology, design software emerges as the times require. By means of various design software, page drawing is carried out, and more standardized and clearer pages are provided for users. At the same time, components in the pages can be classified and stored, so as to facilitate the reuse of components in subsequent page drawing. However, in the prior art, due to different naming methods of components by page drawers, the classification of similar components can only be manually classified by the page drawers according to the similarity between the components, the classification efficiency is low, the classification standard cannot be unified, and thus the classification is inaccurate.
[0083] Figure 1 is a structural schematic diagram of a component similarity determination method provided by an embodiment of the present specification, as shown in Figure 1 The target component and the associated component are determined in the target object. The target element in the target component is determined, as well as the target element contour information and the target element layout information of the target element. The associated component is determined in the target object. The associated element in the associated component is determined, as well as the associated element contour information and the associated element layout information of the associated element. The contour similarity of the target component and the associated component in the visual dimension is calculated based on the target element contour information and the associated element contour information, the layout similarity of the target component and the associated component in the layout dimension is calculated based on the target element layout information and the associated element layout information; the component similarity between the target component and the associated component is determined based on the contour similarity and the layout similarity, and the component similarity is used for classifying and storing the components in the target object.
[0084] In summary, according to the target element contour information and the target element layout information of the target element in the target component, and the associated element contour information and the associated element layout information of the associated element in the associated component, the component similarity between the target component and the associated component in the target object is calculated, so as to improve the calculation efficiency and the calculation accuracy of the component similarity; and the target component and the associated component are classified and stored according to the component similarity between the target component and the associated component, so as to improve the efficiency of classifying and storing the target component and the associated component in the target object.
[0085] In the present specification, a component similarity determination method is provided, and the present specification also relates to a component similarity determination device, a computing device, and a computer readable storage medium, which are described in detail one by one in the following embodiments.
[0086] Figure 2A flowchart of a component similarity determination method according to an embodiment of the present specification is shown, which specifically includes the following steps:
[0087] In step S202, target element contour information and target element layout information of a target element in a target component, and associated element contour information and associated element layout information of an associated element in an associated component are determined, wherein the target component and the associated component belong to a target object.
[0088] Specifically, the target object can be a webpage, a design draft, and the like containing graphics and / or text; the target object can be a page of various application programs such as games, shopping, and the like, or a website page, a forum page, a poster, a leaflet, a design draft, and the like; the target component and the associated component both refer to images in the target object, including but not limited to rectangular, triangular, circular, trapezoidal, rounded rectangular, and the like planar graphics, as well as cubic, conical, cylindrical, and the like solid graphics; correspondingly, the target element refers to text, graphics, and the like elements contained in the target component, and the graphics include but are not limited to check marks, cross marks, circles, and the like shapes.
[0089] The associated element refers to text, graphics, and the like elements contained in the associated component, and the graphics include but are not limited to check marks, cross marks, circles, and the like shapes; the target element contour information refers to font size information, font line information, icon length and width, and the like information of the target element; the target element layout information refers to layout position information of the target element in the target component; the associated element contour information refers to font size information, font line information, icon length and width, and the like information of the associated element; and the associated element layout information refers to layout position information of the associated element in the associated component.
[0090] Based on this, a target object is determined, a component in the target object is selected as a target component, and an element in the target component is selected as a target element. Target element contour information and target element layout information of the target element are determined. A component in the target object is selected as an associated component, and an element in the associated component is selected as an associated element. Associated element contour information and associated element layout information of the associated element are determined.
[0091] In actual application, the target object contains at least two components, and each component contains at least one element. When the target component and the associated component are selected in the target object, random selection can be performed; when the target element is selected in the target component and the associated element is selected in the associated component, random selection can also be performed. In addition, the target component and the associated component can also come from different target objects, so as to realize calculation of component similarity of components contained in different target objects.
[0092] Further, in determining the target element contour information and the target element layout information of the target element, and determining the associated element contour information and the associated element layout information of the associated element, it is considered that the target element can be an element of text type or an element of icon type, and the associated element can be an element of text type or an element of icon type, thus the determined target element contour information, target element layout information, element contour information and associated element layout information are different when the element types are different, and the specific implementation is as follows:
[0093] selecting a target component in the target object, and determining a target element contained in the target component; determining target element contour information and target element layout information associated with the type of the target element; selecting an associated component in the target object, and determining an associated element contained in the associated component; and determining associated element contour information and associated element layout information associated with the type of the associated element.
[0094] Based on this, a component in the target object is selected as a target component, and a target element contained in the target component is determined. Target element contour information and target element layout information associated with the type of the target element are determined. A component other than the target component in the target object is selected as an associated component, and an associated element contained in the associated component is determined. Associated element contour information and associated element layout information associated with the type of the associated element are determined. The type of the target element can be of text type or of icon type, and the type of the associated element can be of text type or of icon type.
[0095] For example, in the case of a target object being a web page, the target component and the associated component can both be an operable control in the web page, or can both be an icon in the web page, or can both be a character-containing graphic. Component A in the web page is selected as the target component, and component B other than the target component in the web page is selected as the associated component. The elements such as text or icons contained in component A in the web page and the elements such as text or icons contained in component B in the web page are determined. Element a in component A is selected as the target element, and element b in component B is selected as the associated element. The contour information and the layout information of element a in component A, and the contour information and the layout information of element b in component B are determined.
[0096] In summary, by determining the type of the target element, and then determining the target element contour information and the target element layout information associated with the type of the target element, and by determining the type of the associated element, and then determining the associated element contour information and the associated element layout information associated with the type of the associated element, the accuracy of the determination of the target element contour information, the target element layout information, the element contour information and the associated element layout information is improved, so that the target element contour information and the target element layout information match the type of the target element, and the associated element contour information and the associated element layout information match the type of the associated element.
[0097] Further, considering that the type of the target element can be a text type or an icon type, the target element contour information and the target element layout information of the target element are different when the type of the target element is different, and in the case where the type of the target element is a text type, the target element contour information and the target element layout information of the target element are determined as follows:
[0098] In the case where the type of the target element is a text type, the target text font information of the target element is taken as the target element contour information of the target element; or in the case where the type of the target element is an icon type, the target icon information of the target element is taken as the target element contour information of the target element; the target bounding rectangle of the target element and the target rectangle associated with the target component are determined; based on the target bounding rectangle coordinate information and the target bounding rectangle side length information of the target bounding rectangle, and the target rectangle coordinate information and the target rectangle side length information of the target rectangle, the target layout information of the target element in the target component is calculated as the target element layout information.
[0099] Specifically, the target text font information can be the font size, font type, font thickness, font inclination degree and the like of the text when the type of the target element is a text type; correspondingly, the target icon information refers to the length information and the width information of the bounding rectangle of the target element when the target element is an icon type.
[0100] Based on this, in the case that the type of the target element is a text type, the font size, font type, font weight, and font slant of the text of the target element are determined as target text font information of the target element, and the target text font information is used as target element contour information of the target element; or in the case that the type of the target element is an icon type, target icon information of the target element is used as the target element contour information of the target element. A target bounding rectangle of the target element is determined, and a target rectangle associated with the target component is determined. Based on target bounding rectangle coordinate information and target bounding rectangle side length information of the target bounding rectangle and target rectangle coordinate information and target rectangle side length information of the target rectangle, target layout information of the target element in the target component is calculated as target element layout information.
[0101] In the above example, Figure 3 is a component schematic diagram of a component similarity determination method provided by an embodiment of the present specification. As shown in (a) of Figure 3 , the target object can include multiple components, the elements included in the components can be text or icons, and the components include at least one element. When the target element is of a text type, the font size of the target element is target text font information of the target element; the font weight of the target element is target element contour information of the target element; when the target element is of an icon type, the height and width of the bounding rectangle of the target element are target icon information of the target element. As shown in (b) of Figure 3 , the rectangle with a length of wa and a width of ha is the bounding rectangle of the “confirm” element in the target component. The rectangle with a length of wA and a width of hA is the target rectangle of the target component. The coordinates (xA, yA) of point A are target rectangle coordinate information of the target rectangle of the target component; the coordinates (xa, ya) of point a are target bounding rectangle coordinate information of the “confirm” element. Then, the target layout information of the target element “confirm” in the target component is calculated as target element layout information.
[0102] In summary, when the type of the target element is a text type or an icon type, different target element contour information is determined, the target element layout information of the target element is determined according to the target bounding rectangle, and the accuracy of the determination of the target element contour information and the target element layout information is improved.
[0103] Further, considering that the type of the associated element can be a text type or an icon type, the associated element contour information and the associated element layout information of the associated element are different when the type of the associated element is different. In the case that the type of the associated element is a text type, the associated element contour information and the associated element layout information of the associated element are determined, and the implementation is as follows:
[0104] In a case where the type of the associated element is a text type, the associated text font information of the associated element is taken as the associated element outline information of the associated element; or in a case where the type of the associated element is an icon type, the associated icon information of the associated element is taken as the associated element outline information of the associated element; the associated bounding rectangle of the associated element and the associated rectangle of the associated component are determined; and the associated layout information of the associated element in the associated component is calculated as the associated element layout information based on the associated bounding rectangle coordinate information and the associated bounding rectangle side length information of the associated bounding rectangle and the associated rectangle coordinate information and the associated rectangle side length information of the associated rectangle.
[0105] Specifically, the associated text font information can be the font size, the font type, the font thickness, the font oblique degree and the like of the text in a case where the type of the associated element is a text type; and correspondingly, the associated icon information refers to the length information and the width information of the bounding rectangle of the associated element in a case where the type of the associated element is an icon type.
[0106] Based on this, in a case where the type of the associated element is a text type, the font size, the font type, the font thickness, the font oblique degree and the like of the text of the associated element are determined, the font size, the font type, the font thickness, the font oblique degree and the like of the text are taken as the associated text font information of the associated element, and the associated text font information is taken as the associated element outline information of the associated element; or in a case where the type of the associated element is an icon type, the associated icon information of the associated element is taken as the associated element outline information of the associated element. The associated bounding rectangle of the associated element and the associated rectangle of the associated component are determined, and the associated layout information of the associated element in the associated component is calculated as the associated element layout information based on the associated bounding rectangle coordinate information and the associated bounding rectangle side length information of the associated bounding rectangle and the associated rectangle coordinate information and the associated rectangle side length information of the associated rectangle.
[0107] In the above example, in a case where the type of the associated element is a text type, the font size of the associated element is the associated text font information of the associated element, and the font thickness of the associated element is the associated element outline information of the associated element; and in a case where the type of the associated element is an icon type, the height and the width of the bounding rectangle of the associated element are the associated icon information of the associated element. For example, Figure 3As shown in (b), the rectangle with the length and width of wb and hb is the bounding rectangle of the "click to login" element in the associated component. The rectangle with the length and width of wB and hB is the associated rectangle of the associated component. The coordinates (xB, yB) of point B are the associated rectangle coordinate information of the associated rectangle of the associated component; the coordinates (xb, yb) of point b are the associated bounding rectangle coordinate information of the "confirm" element. Then the associated layout information of the associated element "click to login" in the associated component is calculated as the associated element layout information.
[0108] In summary, when the type of the associated element is the text type or the icon type, different associated element contour information is determined, and the associated element layout information of the associated element is determined according to the associated bounding rectangle of the associated element, thereby improving the accuracy of the determination of the associated element contour information and the associated element layout information.
[0109] Further, considering that the target object includes multiple components, each component can include multiple elements, and since the types of the elements are different, the similarity is zero, when the type of the target element is different from the type of the associated element, other elements in the associated component can be selected as the associated element, and the specific implementation is as follows:
[0110] The target component and the associated component are selected in the target object, and the target element is selected in the target component and the associated element is selected in the associated component. It is judged whether the type of the target element is the same as the type of the associated element. If yes, the target element contour information and the target element layout information of the target element in the target component are determined. If not, it is judged whether there is an unselected element in the associated component. If yes, a reference element is selected in the associated component, the reference element is taken as the associated element, and the step of judging whether the type of the target element is the same as the type of the associated element is executed. If not, a reference component is selected in the target object and taken as the associated component, and the step of determining the target element contour information and the target element layout information of the target element in the target component is executed.
[0111] In actual application, the target component and the associated component are selected in the target object, and the target element and the associated element are selected in the target component and the associated component respectively. It is determined whether the type of the target element is same as the type of the associated element; if the type of the target element and the type of the associated element are both text type or both icon type, the target element contour information and the target element layout information of the target element in the target component can be determined; if the type of the target element is not same as the type of the associated element, it is determined that the target element and the associated element are not similar. It is determined whether there is other element not selected in the associated component; if yes, a reference element is selected in the associated component, and the reference element is taken as the associated element, and it is determined whether the type of the target element is same as the type of the associated element; if no, a reference component is selected in the target object and taken as the associated component, and the target element contour information and the target element layout information of the target element in the target component are determined, and then the component similarity between the target component and the associated component is calculated.
[0112] In summary, when the type of the target element and the type of the associated element are determined to be different, other element in the associated component can be selected as the associated element, or when the associated component does not contain other element, other component in the target object can be selected as the associated component, so that the calculation efficiency of the component similarity is improved, and the waste of calculation resources is avoided.
[0113] In the step S204, the contour similarity of the target component and the associated component in the visual dimension is calculated based on the target element contour information and the associated element contour information, and the layout similarity of the target component and the associated component in the layout dimension is calculated based on the target element layout information and the associated element layout information.
[0114] Specifically, after the target element contour information and the target element layout information of the target element in the target component and the associated element contour information and the associated element layout information of the associated element in the associated component are determined, the contour similarity of the target component and the associated component in the visual dimension can be calculated based on the target element contour information and the associated element contour information, and the layout similarity of the target component and the associated component in the layout dimension can be calculated based on the target element layout information and the associated element layout information, wherein the contour similarity refers to the similarity of the target element and the associated element in the visual dimension, and the layout similarity refers to the position similarity between the position of the target element in the target component and the position of the associated element in the associated component.
[0115] Based on this, after determining the target element contour information and the target element layout information of the target element in the target component, and the associated element contour information and the associated element layout information of the associated element in the associated component, the element contour similarity between the target element and the associated element is calculated based on the target element contour information and the associated element contour information, and the contour similarity of the target component and the associated component in the visual dimension is determined based on the element contour similarity; the element layout similarity between the target element and the associated element is calculated based on the target element layout information and the associated element layout information, and the layout similarity of the target component and the associated component in the layout dimension is determined based on the element layout similarity.
[0116] In practical applications, the target element can be a character element or an icon element; in the case of a character element, the target element contour information is the font size information and the font line information of the target element; in the case of an icon element, the target element contour information is the icon length and width information of the target element; correspondingly, the associated element can be a character element or an icon element; in the case of a character element, the associated element contour information is the font size information and the font line information of the associated element; in the case of an icon element, the associated element contour information is the icon length and width information of the associated element.
[0117] Further, considering that there is no comparability between the target element and the associated element when the type of the target element and the type of the associated element are different, and the contour similarity cannot be calculated, therefore, when the type of the target element and the type of the associated element are both text types, the contour similarity between the target element and the associated element can be calculated, and the specific implementation is as follows:
[0118] Based on the target font size information contained in the target element contour information, and the associated font size information contained in the associated element contour information, the font size similarity between the target element and the associated element is calculated; based on the target line information contained in the target element contour information, and the associated line information contained in the associated element contour information, the line similarity between the target element and the associated element is calculated; based on the font size similarity and the line similarity, the element contour similarity between the target element and the associated element is calculated.
[0119] Specifically, the target font size information refers to the font size of the text when the target element is a text type; the associated font size information refers to the font size of the text when the associated element is a text type; the font size similarity refers to the similarity of the font size between the target element and the associated element; the target line information refers to the font thickness of the text when the target element is a text type; the associated line information refers to the font thickness of the text when the associated element is a text type; the line similarity refers to the similarity of the font thickness between the target element and the associated element.
[0120] Based on this, the target font size information contained in the target element's outline information and the associated font size information contained in the associated element's outline information are determined. The font size similarity between the target element and the associated elements is calculated based on the target font size information and the associated font size information. The target line information contained in the target element's outline information and the associated line information contained in the associated element's outline information are determined. The line similarity between the target element and the associated elements is calculated based on the target line information and the associated line information. Finally, the element outline similarity between the target element and the associated elements is calculated based on the font size similarity and the line similarity.
[0121] Continuing with the previous example, such as Figure 3 As shown in (b), when the target element is "Confirm" and the associated element is "Click to Log In", determine the font size information of the target element "Confirm". fs : Number 3; Determine the font size information of the associated element "Click to Log In" (b) fs Number 4. Determine the line information for the target element "Confirmed" (a). fw : 3 points; Determine the font size information for the associated element "Click to Log In" (b) fw One pound.
[0122] The element contour similarity M between the target element and related elements is calculated based on the following formula (1). ab1 :
[0123]
[0124] Based on the above formula (1), the element contour similarity between the target element and the associated element is determined to be 0.5*(4 / 3)+0.5*(1 / 3)=4 / 6+1 / 6=0.83.
[0125] In summary, when both the target element and the associated element are of text type, calculating the contour similarity between the target element and the associated element improves the accuracy and usability of contour similarity calculation.
[0126] Furthermore, considering that when the target element and the associated element have different types, there is no comparability between them, and contour similarity cannot be calculated, when both the target element and the associated element are icon types, contour similarity between them can be calculated. The specific implementation is as follows:
[0127] Based on the target icon height information contained in the target element outline information and the associated icon height information contained in the associated element outline information, the icon height similarity between the target element and the associated element is calculated; based on the target icon width information contained in the target element outline information and the associated icon width information contained in the associated element outline information, the icon width similarity between the target element and the associated element is calculated; based on the icon height similarity and the icon width similarity, the element outline similarity between the target element and the associated element is calculated.
[0128] Specifically, target icon height information refers to the height of the bounding rectangle of the target element when the target element is an icon type; associated icon height information refers to the height of the bounding rectangle of the associated element when the associated element is an icon type; icon height similarity refers to the similarity of the bounding rectangle heights between the target element and the associated element; target icon width information refers to the width of the bounding rectangle of the target element when the target element is an icon type; associated icon width information refers to the width of the bounding rectangle of the associated element when the associated element is an icon type; icon width similarity refers to the similarity of the bounding rectangle widths between the target element and the associated element.
[0129] Based on this, when both the target element and its associated elements are of icon type, the target icon height information contained in the target element's outline information and the associated icon height information contained in the associated element's outline information are determined. The icon height similarity between the target element and the associated element is calculated based on these two information. Next, the target icon width information contained in the target element's outline information and the associated icon width information contained in the associated element's outline information are determined. The icon width similarity between the target element and the associated element is calculated based on these two information. Finally, the element outline similarity between the target element and the associated element is calculated based on both the icon height and icon width similarities.
[0130] Continuing with the previous example, such as Figure 3 As shown in (a), when the target element is "√" and the associated element is "×", determine the height information a of the target element "√". h 3; Determine the height information of the associated element "×" (b) h 3. Determine the width information of the target element "√" a w 3.2; Determine the width information of the associated element "×" (b) w 3.
[0131] The element contour similarity M between the target element and related elements is calculated based on the following formula (2). ab2 :
[0132]
[0133] Based on the above formula (1), the element contour similarity between the target element and the associated element is determined as 0.5*(3 / 3)+0.5*(3 / 3.2)=0.97.
[0134] In summary, when the type of the target element and the type of the associated element are both icon types, the contour similarity between the target element and the associated element is calculated, thereby improving the accuracy of the contour similarity calculation and the availability of the contour similarity.
[0135] Further, considering that when the type of the target element and the type of the associated element are different, there is no comparability between the target element and the associated element, and the layout similarity cannot be calculated, therefore, when the type of the target element and the type of the associated element are both text types, the layout similarity between the target element and the associated element can be calculated, and the specific implementation is as follows:
[0136] Based on the target upper distance information and the target lower distance information contained in the target element layout information, and the associated upper distance information and the associated lower distance information contained in the associated element layout information, the text longitudinal similarity between the target element and the associated element is calculated; based on the target left distance information, the target right distance information and the target center distance information contained in the target element layout information, and the associated left distance information, the associated right distance information and the associated center distance information contained in the associated element layout information, the text horizontal similarity between the target element and the associated element is calculated; based on the text longitudinal similarity and the text horizontal similarity, the element layout similarity between the target element and the associated element is calculated.
[0137] Specifically, the target top distance information refers to the normalized distance between the top boundary of the target element's outer rectangle and the top boundary of the target component's target rectangle; the target bottom distance information refers to the normalized distance between the bottom boundary of the target element's outer rectangle and the top and bottom boundaries of the target component's target rectangle; the target left distance information refers to the normalized distance between the left boundary of the target element's outer rectangle and the left boundary of the target component's target rectangle; the target right distance information refers to the normalized distance between the right boundary of the target element's outer rectangle and the right boundary of the target component's target rectangle; the target center distance information refers to the normalized distance between the center line of the target element's outer rectangle and the center line of the target component's target rectangle; text vertical similarity refers to the similarity between the target element and the associated element in the vertical direction when both the target element and the associated element are text types; text horizontal similarity refers to the similarity between the target element and the associated element in the horizontal direction when both the target element and the associated element are text types.
[0138] Based on this, the target element's layout information includes the target's top and bottom distances, and the associated element's layout information includes the associated top and bottom distances. The vertical text similarity between the target element and associated elements is calculated based on these distances. The target element's layout information includes the target's left, right, and center distances, and the associated element's layout information includes the associated left, right, and center distances. The horizontal text similarity between the target element and associated elements is calculated based on these distances. Finally, based on the vertical and horizontal text similarities, the element layout similarity between the target element and associated elements is calculated.
[0139] Continuing with the previous example, such as Figure 3 As shown in (b), with the target element being "Confirm" and the associated element being "Click to Log In": The outer rectangle of the target element "Confirm" is determined as follows: The outer rectangle of the associated element "Click to Log In" is determined as follows: The outer rectangle of the associated element "Click to Log In" is determined as follows: The outer rectangle of the associated element "Click to Log In" is determined as follows: The outer rectangle of the associated element "Confirm" is determined as follows: The outer rectangle of the associated element "Click to Log In ...
[0140] The target left distance information I is calculated based on the following formula (3) a The target right distance information r is calculated based on the following formula (4) a The target top distance information t is calculated based on the following formula (5) a The target bottom distance information b is calculated based on the following formula (6) a The target center distance information c is calculated based on the following formula (7) a ;
[0141]
[0142]
[0143]
[0144]
[0145]
[0146] xA, yA = 10, 10, hA = 28, wA = 82, xa, ya = 37, 17, wa = 28, ha = 14, and based on the above formulas (3)-(7), it is known that l a = (xa - xA) / wA = (37 - 10) / 82 = 0.32; r a = (xA + wA - xa - wa) / wA = (10 + 82 - 37 - 28) / 82 = 0.32; c a = (xA + 0.5 * wA - xa - 0.5 * wa) / wA = (10 + 0.5 * 82 - 37 - 0.5 * 28) / 82 = 0; t a = (ya - yA) / hA = (17 - 10) / 28 = 0.25; b a = (yA + hA - ya - ha) / hA = (10 + 28 - 17 - 14) / 28 = 0.25.
[0147] The associated left distance information I is calculated based on the following formula (8) b The associated right distance information r is calculated based on the following formula (9) b The associated top distance information t is calculated based on the following formula (10) b The associated bottom distance information b is calculated based on the following formula (11) b The associated center distance information c is calculated based on the following formula (12) h ;
[0148]
[0149]
[0150]
[0151]
[0152]
[0153] xB, yB = 8, 8, hB = 28, wB = 102, xb, yb = 27, 17, wb = 18, hb = 4, then based on the above formulas (8)-(12), it can be known that, l b = (xb-xB) / wB = (27-8) / 102 = 0.19; r b = (xB+wB-xb-wb) / wB = (8+102-27-18) / 102 = 0.64; c b = (xB+0.5*wB-xb-0.5*wb) / wB = (8+0.5*102-27-0.5*18) / 102 = 0.23; t b = (yb-yB) / hB = (17-8) / 28 = 0.32; b b = (yB+hB-yb-hb) / hB = (8+28-27-4) / 28 = 0.18.
[0154] The text horizontal similarity S x1 is calculated based on the following formula (13); the text vertical similarity S y1 is calculated based on the following formula (14); and the element layout similarity L ab1 between the target element and the associated element is calculated based on the following formula (15):
[0155] S x1 = max(abs(b a -b b ), abs(t a -t b )) (13)
[0156] S y1 = min(abs(l a -l b ), abs(r d -r b ), abs(c a -c b )) (14)
[0157] L ab1 = min(1-S x1 , 1-S y1 ) (15)
[0158] The text horizontal similarity S x1= max(abs(0.25-0.18), abs(0.25-0.32)) = 0.07; text vertical similarity S y1 = min(abs(0.32-0.19), abs(0.32-0.64), abs(0-0.23)) = 0.13; element layout similarity L between the target element and the associated element ab1 = min(1-0.07, 1-0.13) = 0.87.
[0159] In summary, when the type of the target element and the type of the associated element are both text types, the layout similarity between the target element and the associated element is calculated, thereby improving the accuracy of the layout similarity calculation and the availability of the layout similarity.
[0160] Further, considering that when the type of the target element and the type of the associated element are different, there is no comparability between the target element and the associated element, and the layout similarity cannot be calculated, when the type of the target element and the type of the associated element are both icon types, the layout similarity between the target element and the associated element can be calculated, and the specific implementation is as follows:
[0161] Based on the target upper distance information and the target lower distance information contained in the target element layout information, and the associated upper distance information and the associated lower distance information contained in the associated element layout information, the icon vertical similarity between the target element and the associated element is calculated; based on the target left distance information and the target right distance information contained in the target element layout information, and the associated left distance information and the associated right distance information contained in the associated element layout information, the icon horizontal similarity between the target element and the associated element is calculated; based on the icon vertical similarity and the icon horizontal similarity, the element layout similarity between the target element and the associated element is calculated.
[0162] Specifically, the target upper distance information refers to the normalized distance information between the upper boundary of the target outer rectangle of the target element and the upper boundary of the target rectangle of the target component; the target lower distance information refers to the normalized distance information between the lower boundary of the target outer rectangle of the target element and the upper and lower boundaries of the target rectangle of the target component; the target left distance information refers to the normalized distance information between the left boundary of the target outer rectangle of the target element and the left boundary of the target rectangle of the target component; the target right distance information refers to the normalized distance information between the right boundary of the target outer rectangle of the target element and the right boundary of the target rectangle of the target component; the icon vertical similarity refers to the similarity between the target element and the associated element in the vertical direction when the target element and the associated element are both icon types; the icon horizontal similarity refers to the similarity between the target element and the associated element in the horizontal direction when the target element and the associated element are both icon types.
[0163] Based on this, the target upper distance information and the target lower distance information contained in the target element layout information and the associated upper distance information and the associated lower distance information contained in the associated element layout information are determined, and the icon vertical similarity between the target element and the associated element is calculated based on the target upper distance information, the target lower distance information, the associated upper distance information and the associated lower distance information. The target left distance information and the target right distance information contained in the target element layout information and the associated left distance information and the associated right distance information contained in the associated element layout information are determined, and the icon horizontal similarity between the target element and the associated element is calculated based on the target left distance information, the target right distance information, the associated left distance information and the associated right distance information. Based on the icon vertical similarity and the icon horizontal similarity, the element layout similarity between the target element and the associated element is calculated.
[0164] In the above example, the icon horizontal similarity S is calculated based on the following formula (16) x2 ; the icon vertical similarity S is calculated based on the following formula (17) y2 ; and the element layout similarity L between the target element and the associated element is calculated based on the following formula (18) ab2 .
[0165] S x2 = max(abs(b a -b b ), abs(t a -t b )) (16)
[0166] S y2 = max(abs(l a -l b ), abs(r a -r b )) (17)
[0167] L ab2 = 1 - max(S x2 , S y2 ) (18)
[0168] The icon horizontal similarity S x2 = max(abs(0.25-0.18), abs(0.25-0.32)) = 0.07; the icon vertical similarity S y2 = max(abs(0.32-0.19), abs(0.32-0.64)) = 0.32; and the element layout similarity L ab2 = 1 - max(0.07, 0.32) = 0.68.
[0169] In summary, when the type of the target element and the type of the associated element are both icon types, the layout similarity between the target element and the associated element is calculated, thereby improving the accuracy of the layout similarity calculation and the availability of the layout similarity.
[0170] Further, considering that the target component can include multiple target elements and the associated component can also include multiple associated elements, when calculating the similarity between the target component and the associated component, the target elements in the target component and the associated elements in the associated component need to be combined two by two, the contour similarity between the target elements and the associated elements is calculated, and then the similarity between the target component and the associated component is calculated, which is implemented as follows:
[0171] At least one contour element pair is generated based on at least one target element and at least one associated element; the element contour similarity corresponding to each contour element pair is calculated according to the target element contour information of each target element and the associated element contour information of each associated element; at least one contour element pair is divided into a contour element pair set corresponding to the object element; the element contour similarity of the contour element pair contained in the contour element pair set corresponding to each object element is determined based on the element contour similarity corresponding to each contour element pair; the contour similarity set corresponding to each object element is constructed according to the element contour similarity of the contour element pair contained in the contour element pair set corresponding to each object element; the contour similarity of the target component and the associated component in the visual dimension is calculated based on the target element contour similarity selected in the contour similarity set corresponding to each object element.
[0172] Specifically, the contour element pair refers to selecting a target element in the target component and an associated element in the associated component, and the element pair composed of the target element and the associated element; accordingly, the element contour similarity is the similarity corresponding to the element pair composed of the target element and the associated element; the object element can be a target element or an associated element, and when the number of target elements contained in the target component is less than the number of associated elements in the associated component, the object element is the target element.
[0173] Based on this, in each of the at least one target element, respectively combined with each of the at least one associated element, a contour element pair is generated. According to the target element contour information of each target element and the associated element contour information of each associated element, the element contour similarity respectively corresponding to each contour element pair is calculated. The number of target elements is compared with the number of associated elements, and the element with fewer number is taken as the object element. The at least one contour element pair is divided into a contour element pair set corresponding to the object element. Based on the element contour similarity of the contour element pair contained in each contour element pair set respectively corresponding to each object element, the element contour similarity of the contour element pair contained in each contour element pair set respectively corresponding to each object element is determined. According to the element contour similarity of the contour element pair contained in each contour element pair set respectively corresponding to each object element, a contour similarity set corresponding to each object element is constructed. The target element contour similarity selected in the contour similarity set corresponding to each object element is based on the target element contour similarity corresponding to each contour similarity set to calculate the contour similarity of the target component and the associated component in the visual dimension.
[0174] In the above example, Figure 4 is a similarity calculation diagram of a component similarity determination method provided by an embodiment of the present specification. In the case that the number of target elements in the target component is m=4 and the number of associated elements in the associated component is n=3, based on the element contour similarity between the target elements and the associated elements, the target elements and the associated elements, a diagram as shown in Figure 4 (a) is constructed. Based on the maximum matching algorithm (Hungarian algorithm), the contour similarity of the target component and the associated component in the visual dimension is calculated. That is, based on the diagram as shown in Figure 4 (a), the greater similarity value is selected from the element contour similarity between the associated elements and each target element, and then the contour similarity of the target component and the associated component in the visual dimension is determined as shown in Figure 4 (b). When the similarity value corresponding to each associated element is S11: 0.8, S12: 0.92 and S13: 0.7 respectively, the contour similarity M of the target component and the associated component in the visual dimension is calculated based on the following formula (19) AB = 0.30 + 0.40 = 0.70.
[0175]
[0176] In summary, the target component can contain multiple target elements, and the associated component can also contain multiple associated elements. When calculating the similarity between the target component and the associated component, the target elements in the target component and the associated elements in the associated component are combined two by two, and the contour similarity is calculated, so as to calculate the component similarity between the target component and the associated component, and improve the accuracy and comprehensiveness of the component similarity calculation.
[0177] Further, considering that the target component can include multiple target elements and the association component can also include multiple association elements, when calculating the similarity between the target component and the association component, the target elements in the target component and the association elements in the association component need to be combined two by two to calculate the layout similarity between the target elements and the association elements, and then the similarity between the target component and the association component is calculated. The specific implementation is as follows:
[0178] At least one layout element pair is generated based on at least one target element and at least one association element; the element layout similarity corresponding to each layout element pair is calculated according to the target element layout information of each target element and the association element layout information of each association element; at least one layout element pair is divided into a layout element pair set corresponding to the object element; the element layout similarity of the layout element pair contained in each object element corresponding layout element pair set is determined based on the element layout similarity corresponding to each layout element pair; a layout similarity set corresponding to each object element is constructed according to the element layout similarity of the layout element pair contained in each object element corresponding layout element pair set; the layout similarity of the target component and the association component in the layout dimension is calculated based on the target element layout similarity selected in each object element corresponding layout similarity set.
[0179] Specifically, the layout element pair refers to selecting a target element in the target component, selecting an association element in the association component, and forming an element pair composed of the target element and the association element; correspondingly, the element layout similarity is the similarity corresponding to the element pair composed of the target element and the association element; the object element can be a target element or an association element. When the number of target elements contained in the target component is less than the number of association elements in the association component, the object element is the target element.
[0180] According to the target element layout information of each target element and the associated element layout information of each associated element, element layout similarities respectively corresponding to each layout element pair are calculated. The number of target elements is compared with the number of associated elements, and the element with fewer number is taken as an object element. The at least one layout element pair is divided into a layout element pair set corresponding to the object element. Based on the element layout similarities respectively corresponding to each layout element pair, element layout similarities of the layout element pairs contained in the layout element pair set respectively corresponding to each object element are determined. According to the element layout similarities of the layout element pairs contained in the layout element pair set corresponding to each object element, a layout similarity set corresponding to each object element is constructed. A target element layout similarity is selected from the layout similarity set corresponding to each object element, and based on the target element layout similarity corresponding to each layout similarity set, a layout similarity of the target component and the associated component in the layout dimension is calculated.
[0181] In the above example, in the case that the number of target elements in the target component is m=4 and the number of associated elements in the associated component is n=3, the layout similarity of the target component and the associated component in the visual dimension is calculated based on the element layout similarities between the target elements and the associated elements, the target elements, the associated elements, and the maximum matching algorithm (Hunary algorithm). The greater similarity value is selected from the element layout similarities between the associated elements and each target element, and when the similarity values respectively corresponding to each associated element are S21: 0.82, S22: 0.83, and S23: 0.92, the layout similarity L of the target component and the associated component in the visual dimension is calculated based on the following formula (20). AB = 0.32 + 0.43 = 0.75.
[0182]
[0183] In summary, the target component can contain multiple target elements, and the associated component can also contain multiple associated elements. When calculating the similarity between the target component and the associated component, the target elements in the target component and the associated elements in the associated component are combined two by two, the layout similarity is calculated, and then the component similarity between the target component and the associated component is calculated, thereby improving the accuracy and comprehensiveness of the component similarity calculation.
[0184] In step S206, based on the contour similarity and the layout similarity, a component similarity between the target component and the associated component is determined, wherein the component similarity is used for classifying and storing the components in the target object.
[0185] Specifically, after the profile similarity of the target component and the associated component in the visual dimension is calculated based on the target element profile information and the associated element profile information, and the layout similarity of the target component and the associated component in the layout dimension is calculated based on the target element layout information and the associated element layout information, the component similarity between the target component and the associated component can be determined based on the profile similarity and the layout similarity, wherein the component similarity refers to the similarity between the target component and the associated component, and is used to represent the similarity between the elements and the element layout contained in the target component and the elements and the element layout contained in the associated component.
[0186] Based on this, after the profile similarity of the target component and the associated component in the visual dimension is calculated based on the target element profile information and the associated element profile information, and the layout similarity of the target component and the associated component in the layout dimension is calculated based on the target element layout information and the associated element layout information, the profile similarity and the layout similarity are analyzed, and the component similarity between the target component and the associated component is determined according to the analysis result.
[0187] In actual application, the component similarity between the target component and the associated component can be determined by comparing the profile similarity with a preset threshold. In the case where the profile similarity is greater than or equal to the preset threshold, the layout similarity is taken as the component similarity between the target component and the associated component, and in the case where the profile similarity is less than the preset threshold, the component similarity between the target component and the associated component is determined to be zero, i.e., the target component and the associated component are not similar.
[0188] Further, after the profile similarity of the target component and the associated component in the visual dimension is determined, and the layout similarity of the target component and the associated component in the layout dimension is determined, the component similarity between the target component and the associated component can be determined according to the profile similarity and the layout similarity, and the specific implementation is as follows:
[0189] In the case where the profile similarity is greater than or equal to a preset similarity threshold, the layout similarity is taken as the component similarity between the target component and the associated component; in the case where the profile similarity is less than the preset similarity threshold, the component similarity between the target component and the associated component is zero.
[0190] Therefore, the similarity threshold refers to the similarity value determined according to the similarity calculation requirements, and this similarity value is used as the benchmark for similarity comparison. When the contour similarity is greater than or equal to the preset similarity threshold, it indicates that the contour similarity between the target component and the associated component is high, and the layout similarity can be used as the component similarity between the target component and the associated component. When the contour similarity is less than the preset similarity threshold, it indicates that the contour similarity between the target component and the associated component is low, and the component similarity between the target component and the associated component is zero, meaning that the target component and the associated component are determined to be dissimilar.
[0191] For example, the contour similarity M between the target component and related components is determined by calculation. AB Layout similarity L AB Then, the component similarity S between the target component and the associated component can be determined using the following formula (21). AB The similarity threshold can be set to 0.9, or as needed.
[0192]
[0193] The outline similarity is compared with a similarity threshold. If the outline similarity is 0.91, and the outline similarity is greater than or equal to the similarity threshold, then the layout similarity of 0.8 is taken as the component similarity S between component A and component B. AB When the contour similarity is 0.8, which is less than the similarity threshold, the component similarity S between component A and component B is... AB It is zero.
[0194] In summary, based on the target element outline and layout information of the target element in the target component, and the related element outline and layout information of the related element in the related component, the component similarity between the target component and related components in the target object is calculated, thereby improving the calculation efficiency and accuracy of component similarity. Furthermore, the target component and related components are categorized and stored based on the component similarity between them, thereby improving the efficiency of categorizing and storing target components and related components in the target object.
[0195] The following is in conjunction with the appendix Figure 5 Taking the application of the component similarity determination method provided in this specification in the calculation of component similarity in design drafts as an example, the component similarity determination method will be further explained. Among them, Figure 5 This specification illustrates a flowchart of a component similarity determination method applied to component similarity calculation in design drafts, according to an embodiment of this specification. The method specifically includes the following steps:
[0196] Step S502, selecting a target component and an associated component in a target object.
[0197] The target object can be a design draft, a webpage, or the like. When the target object is a design draft, components contained in the design draft can be classified. There are three types of basic elements: text, rectangular frame, and icon. A button is usually composed of a text and a rectangular frame, and a check box is usually composed of a rounded rectangular frame and an icon. A design draft can contain multiple components, and each component can contain multiple elements.
[0198] Step S504, selecting a target element in the target component and an associated element in the associated component.
[0199] A component A is selected as the target component and a component B is selected as the associated component in the design draft. An element a is selected in the component A and an element b is selected in the component B.
[0200] Step S504, determining whether the type of the target element is the same as the type of the associated element.
[0201] It is determined whether the types of the element a and the element b are the same. When the element a and the element b are both of the text type or both of the icon type, the similarity between the element a and the element b is calculated. When the type of the element a is different from the type of the element b, the similarity is zero.
[0202] If yes, step S508 is executed; if no, step S510 is executed.
[0203] Step S508, determining target element contour information and target element layout information associated with the type of the target element, and determining associated element contour information and associated element layout information associated with the type of the associated element.
[0204] When the element a and the element b are both of the text type, the font size and the font weight of the element a and the font size and the font weight of the element b are determined. When the element a and the element b are both of the icon type, the height and the width of the icon of the element a and the height and the width of the icon of the element b are determined.
[0205] Step S510, determining whether there is an unselected element in the associated component; if yes, step S512 is executed; if no, step S514 is executed.
[0206] Step S512, selecting a reference element in the associated component, taking the reference element as the associated element, and executing step S506.
[0207] Step S514, selecting a reference component in the target object as the associated component, and executing step S504.
[0208] Step S516, in the case that the target element type of the target element is a text type and the associated element type of the associated element is a text type, calculating a font size similarity between the target element and the associated element based on the target element contour information and the associated element contour information; calculating a line similarity between the target element and the associated element based on the target element contour information and the associated element contour information; and calculating an element contour similarity between the target element and the associated element based on the font size similarity and the line similarity.
[0209] In the case that the element a and the element b are both text types, determining a font size and a font thickness of the element a and a font size and a font thickness of the element b; and calculating the contour similarity between the element a and the element b by the above formula (1).
[0210] Step S518, calculating a text vertical similarity between the target element and the associated element based on the target element layout information and the associated element layout information; calculating a text horizontal similarity between the target element and the associated element based on the target element layout information and the associated element layout information; and calculating an element layout similarity between the target element and the associated element based on the text vertical similarity and the text horizontal similarity.
[0211] In the case that the element a and the element b are both text types, determining a rectangle A (xA, yA, wA, hA) corresponding to the target component, a rectangle a (xa, ya, wa, ha) corresponding to the element a; a rectangle B (xB, yB, wB, hB) corresponding to the associated component, and a rectangle b (xb, yb, wb, hb) corresponding to the element b. The target left distance information l a , the target right distance information r a , the target top distance information t a , the target bottom distance information b a , and the target center distance information c a are calculated by the above formulas (3)-(7) respectively. The text horizontal similarity S x1 is calculated based on the above formula (13); the text vertical similarity S y1 is calculated based on the above formula (14); and the element layout similarity L ab1 between the target element and the associated element is calculated based on the above formula (15).
[0212] In step S520, in a case where the target element type of the target element is an icon type and the associated element type of the associated element is an icon type, an icon height similarity between the target element and the associated element is calculated based on the target element contour information and the associated element contour information; an icon width similarity between the target element and the associated element is calculated based on the target element contour information and the associated element contour information; and an element contour similarity between the target element and the associated element is calculated based on the icon height similarity and the icon width similarity.
[0213] In a case where the element a and the element b are both icon types, the height and the width of the icon of the element a are determined, and the height and the width of the icon of the element b are determined. The contour similarity between the element a and the element b is calculated by the above formula (2).
[0214] In step S522, an icon vertical similarity between the target element and the associated element is calculated based on the target element layout information and the associated element layout information; an icon horizontal similarity between the target element and the associated element is calculated based on the target element layout information and the associated element layout information; and an element layout similarity between the target element and the associated element is calculated based on the icon vertical similarity and the icon horizontal similarity.
[0215] In a case where the element a and the element b are both icon types, the rectangle A (xA, yA, wA, hA) corresponding to the target component, the rectangle a (xa, ya, wa, ha) corresponding to the element a, the rectangle B (xB, yB, wB, hB) corresponding to the associated component, and the rectangle b (xb, yb, wb, hb) corresponding to the element b are determined. The associated left distance information l a , the associated right distance information r a , the associated top distance information t a , the associated bottom distance information b a , and the associated center distance information c a are calculated by the above formulas (8)-(12), respectively. The icon horizontal similarity S x2 is calculated based on the above formula (16); the icon vertical similarity S y2 is calculated based on the above formula (17); and the element layout similarity L ab2 between the target element and the associated element is calculated based on the above formula (18).
[0216] In step S524, the contour similarity of the target component and the associated component in the visual dimension is calculated based on the maximum matching strategy and the element contour similarity, and the layout similarity of the target component and the associated component in the layout dimension is calculated based on the maximum matching strategy and the element layout similarity.
[0217] In step S526, if the contour similarity is greater than or equal to a preset similarity threshold, the layout similarity is taken as the component similarity between the target component and the associated component; if the contour similarity is less than the preset similarity threshold, the component similarity between the target component and the associated component is zero.
[0218] In summary, according to the target element contour information and the target element layout information of the target element in the target component, and the associated element contour information and the associated element layout information of the associated element in the associated component, the component similarity between the target component and the associated component in the target object is calculated, so as to improve the calculation efficiency and the calculation accuracy of the component similarity; and according to the component similarity between the target component and the associated component, the target component and the associated component are classified and stored, so as to improve the efficiency of classifying and storing the target component and the associated component in the target object.
[0219] Corresponding to the method embodiments, the specification also provides component similarity determination device embodiments, Figure 6 A structure diagram of a component similarity determination device is shown. As shown in the figure, Figure 6 The device comprises:
[0220] An information determination module 602 is configured to determine target element contour information and target element layout information of a target element in a target component, and associated element contour information and associated element layout information of an associated element in an associated component, wherein the target component and the associated component belong to a target object;
[0221] A calculation module 604 is configured to calculate a contour similarity of the target component and the associated component in a visual dimension based on the target element contour information and the associated element contour information, and calculate a layout similarity of the target component and the associated component in a layout dimension based on the target element layout information and the associated element layout information.
[0222] A component similarity determination module 606 is configured to determine a component similarity between the target component and the associated component based on the contour similarity and the layout similarity, wherein the component similarity is used for classifying and storing components in the target object.
[0223] In an optional embodiment, the information determination module 602 is further configured to:
[0224] selecting a target component in the target object and determining a target element contained in the target component; determining target element contour information and target element layout information associated with a type of the target element; selecting an associated component in the target object and determining an associated element contained in the associated component; and determining associated element contour information and associated element layout information associated with a type of the associated element.
[0225] In an optional embodiment, the information determining module 602 is further configured to:
[0226] In a case where the type of the target element is a text type, taking target text font information of the target element as the target element contour information of the target element; or in a case where the type of the target element is an icon type, taking target icon information of the target element as the target element contour information of the target element; determining a target bounding rectangle of the target element and a target rectangle associated with the target component; and calculating target layout information of the target element in the target component as the target element layout information based on target bounding rectangle coordinate information and target bounding rectangle side length information of the target bounding rectangle and target rectangle coordinate information and target rectangle side length information of the target rectangle.
[0227] In an optional embodiment, the information determining module 602 is further configured to:
[0228] In a case where the type of the associated element is a text type, taking associated text font information of the associated element as the associated element contour information of the associated element; or in a case where the type of the associated element is an icon type, taking associated icon information of the associated element as the associated element contour information of the associated element; determining an associated bounding rectangle of the associated element and an associated rectangle of the associated component; and calculating associated layout information of the associated element in the associated component as the associated element layout information based on associated bounding rectangle coordinate information and associated bounding rectangle side length information of the associated bounding rectangle and associated rectangle coordinate information and associated rectangle side length information of the associated rectangle.
[0229] In an optional embodiment, the information determining module 602 is further configured to:
[0230] selecting a target component and an associated component in the target object and selecting a target element in the target component and an associated element in the associated component;
[0231] determining whether the type of the target element is the same as the type of the associated element; if yes, performing the step of determining the target element contour information and the target element layout information of the target element in the target component; if no, determining whether there is an unselected element in the associated component; if yes, selecting a reference element in the associated component, taking the reference element as the associated element, and performing the step of determining whether the type of the target element is the same as the type of the associated element; if no, selecting a reference component in the target object and taking the reference component as the associated component, and performing the step of determining the target element contour information and the target element layout information of the target element in the target component.
[0232] In an optional embodiment, the information calculation module 604 is further configured to:
[0233] generating at least one contour element pair based on the at least one target element and the at least one associated element; calculating an element contour similarity corresponding to each contour element pair based on the target element contour information of each target element and the associated element contour information of each associated element; dividing the at least one contour element pair into a contour element pair set corresponding to an object element; determining an element contour similarity of the contour element pair contained in the contour element pair set corresponding to each object element based on the element contour similarity corresponding to each contour element pair; constructing a contour similarity set corresponding to each object element based on the element contour similarity of the contour element pair contained in the contour element pair set corresponding to each object element; and calculating the contour similarity in the visual dimension between the target component and the associated component based on the target element contour similarity selected from the contour similarity set corresponding to each object element.
[0234] In an optional embodiment, the information calculation module 604 is further configured to:
[0235] generating at least one layout element pair based on the at least one target element and the at least one associated element; calculating an element layout similarity corresponding to each layout element pair based on the target element layout information of each target element and the associated element layout information of each associated element; dividing the at least one layout element pair into a layout element pair set corresponding to an object element; determining an element layout similarity of the layout element pair contained in the layout element pair set corresponding to each object element based on the element layout similarity corresponding to each layout element pair; constructing a layout similarity set corresponding to each object element based on the element layout similarity of the layout element pair contained in the layout element pair set corresponding to each object element; and calculating the layout similarity in the layout dimension between the target component and the associated component based on the target element layout similarity selected from the layout similarity set corresponding to each object element.
[0236] In an optional embodiment, the information computing module 604 is further configured to:
[0237] calculate a font size similarity between the target element and the associated element based on target font size information contained in the target element contour information and associated font size information contained in the associated element contour information; calculate a line similarity between the target element and the associated element based on target line information contained in the target element contour information and associated line information contained in the associated element contour information; and calculate an element contour similarity between the target element and the associated element based on the font size similarity and the line similarity.
[0238] In an optional embodiment, the information computing module 604 is further configured to:
[0239] calculate a text vertical similarity between the target element and the associated element based on target upper distance information and target lower distance information contained in the target element layout information and associated upper distance information and associated lower distance information contained in the associated element layout information; calculate a text horizontal similarity between the target element and the associated element based on target left distance information, target right distance information and target center distance information contained in the target element layout information and associated left distance information, associated right distance information and associated center distance information contained in the associated element layout information; and calculate an element layout similarity between the target element and the associated element based on the text vertical similarity and the text horizontal similarity.
[0240] In an optional embodiment, the information computing module 604 is further configured to:
[0241] calculate an icon height similarity between the target element and the associated element based on target icon height information contained in the target element contour information and associated icon height information contained in the associated element contour information; calculate an icon width similarity between the target element and the associated element based on target icon width information contained in the target element contour information and associated icon width information contained in the associated element contour information; and calculate an element contour similarity between the target element and the associated element based on the icon height similarity and the icon width similarity.
[0242] In an optional embodiment, the information computing module 604 is further configured to:
[0243] The icon vertical similarity between the target element and the associated element is calculated based on target upper distance information and target lower distance information contained in the target element layout information and associated upper distance information and associated lower distance information contained in the associated element layout information; the icon horizontal similarity between the target element and the associated element is calculated based on target left distance information and target right distance information contained in the target element layout information and associated left distance information and associated right distance information contained in the associated element layout information; and the element layout similarity between the target element and the associated element is calculated based on the icon vertical similarity and the icon horizontal similarity.
[0244] In an optional embodiment, the component similarity determination module 606 is further configured to:
[0245] When the contour similarity is greater than or equal to a preset similarity threshold, the layout similarity is taken as the component similarity between the target component and the associated component; and when the contour similarity is less than the preset similarity threshold, the component similarity between the target component and the associated component is zero.
[0246] In summary, according to the target element contour information and the target element layout information of the target element in the target component and the associated element contour information and the associated element layout information of the associated element in the associated component, the component similarity between the target component and the associated component in the target object is calculated, thereby improving the calculation efficiency and the calculation accuracy of the component similarity; and the target component and the associated component are classified and stored according to the component similarity between the target component and the associated component, thereby improving the efficiency of classifying and storing the target component and the associated component in the target object.
[0247] The above is a schematic scheme of the component similarity determination apparatus according to the embodiment. It should be noted that the technical scheme of the component similarity determination apparatus belongs to the same concept as the technical scheme of the component similarity determination method described above, and the details of the technical scheme of the component similarity determination apparatus that are not described in detail can be referred to the description of the technical scheme of the component similarity determination method.
[0248] Figure 7 A structural block diagram of a computing device 700 according to an embodiment of the present specification is shown. The components of the computing device 700 include but are not limited to a memory 710 and a detector 720. The detector 720 is connected to the memory 710 through a bus 730, and a database 750 is used to save data.
[0249] The computing device 700 also includes an access device 740 that enables the computing device 700 to communicate via one or more networks 760. Examples of such networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or combinations of such networks, such as the Internet. The access device 740 can include one or more of any type of network interface (for example, a network interface card (NIC)), such as an IEEE 802.11 wireless local area network (wLAN) wireless interface, a global microwave interconnection access (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.
[0250] In one embodiment of the present specification, the above-mentioned components of the computing device 700 and other components not shown in the Figure 7 may be connected to each other, such as through a bus. It should be understood that Figure 7 The computing device structure diagram shown is only for the purpose of example, and is not a limitation on the scope of the present specification. Other components can be added or replaced as needed by those skilled in the art.
[0251] The computing device 700 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (for example, a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, and so on), a mobile phone (for example, a smartphone), a wearable computing device (for example, a smart watch, smart glasses, and so on), or other types of mobile devices, or a stationary computing device such as a desktop computer or a PC. The computing device 700 can also be a mobile or stationary server.
[0252] The detector 720 is configured to execute the computer executable instructions to implement the steps of the component similarity determination method.
[0253] The above is a schematic scheme of a computing device according to the present embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the component similarity determination method described above belong to the same concept, and the details of the technical scheme of the computing device that are not described in detail can be referred to the description of the technical scheme of the component similarity determination method.
[0254] The present embodiment of the present specification also provides a computer readable storage medium storing computer instructions, which when executed by a detector, implement the steps of the component similarity determination method.
[0255] The above is a schematic solution of the computer readable storage medium of the embodiment. It should be noted that the technical solution of the storage medium and the technical solution of the component similarity determination method described above belong to the same concept, and the technical solution of the storage medium which is not described in detail can be seen from the description of the technical solution of the component similarity determination method.
[0256] The above describes specific embodiments of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different than the order in which they are recited in the embodiments and still achieve desirable results. In addition, the processes depicted in the figures do not necessarily require the particular order shown, or sequential order, to achieve the desired results. In certain implementations, multitasking and parallel processing can be advantageous.
[0257] The computer instructions include computer program code, which can be in the form of source code, object code, executable code, or some intermediate form. The computer readable medium can include any entity or apparatus capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content contained in the computer readable medium can be appropriately increased or decreased according to the requirements of patent practice, for example, in some regions, according to the patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
[0258] It should be noted that for the foregoing method embodiments, in order to facilitate description, they are all expressed as a combination of a series of actions, but those skilled in the art should know that the present specification is not limited by the order of the actions described, because according to the present specification, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily all necessary for the present specification.
[0259] In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described in detail in a certain embodiment can be seen from the related description of other embodiments.
[0260] The preferred embodiments of the present specification disclosed above are only used to help illustrate the present specification. Alternative embodiments do not describe all the details and limit the present application to the specific embodiments described. Obviously, many modifications and changes can be made according to the content of the present specification. The present specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present specification, so that those skilled in the art can well understand and utilize the present specification. The present specification is limited only by the claims and their full scope and equivalents.
Claims
1. An assembly similarity determination method, characterized by, The method comprises: selecting a component in a target object as a target component and determining a target element contained in the target component; selecting a component other than the target component in the target object as an associated component and determining an associated element contained in the associated component; if the target element and the associated element are of different types, selecting another element in the associated component as the associated element, or selecting another component in the target object as the associated component if the associated component does not contain another element; determining target element contour information and target element layout information of the target element in the target component, and associated element contour information and associated element layout information of the associated element in the associated component, wherein the target component and the associated component belong to the target object; calculating contour similarity of the target component and the associated component in a visual dimension based on the target element contour information and the associated element contour information, and calculating layout similarity of the target component and the associated component in a layout dimension based on the target element layout information and the associated element layout information; determining component similarity between the target component and the associated component based on the contour similarity and the layout similarity, wherein the component similarity is used for classifying and storing the components in the target object.
2. The method of claim 1, wherein, The method comprises: selecting a target component in the target object and determining a target element contained in the target component; determining target element contour information and target element layout information associated with the type of the target element; selecting an associated component in the target object and determining an associated element contained in the associated component; determining associated element contour information and associated element layout information associated with the type of the associated element.
3. The method of claim 2, wherein, The method comprises: in a case where the type of the target element is a text type, taking target text font information of the target element as the target element contour information of the target element; or in a case where the type of the target element is an icon type, taking target icon information of the target element as the target element contour information of the target element; determining a target bounding rectangle of the target element and a target rectangle associated with the target component; based on target bounding rectangle coordinate information and target bounding rectangle side length information of the target bounding rectangle, and target rectangle coordinate information and target rectangle side length information of the target rectangle, calculating target layout information of the target element in the target component as the target element layout information.
4. The method of claim 2, wherein, The method comprises: In a case where the type of the associated element is a text type, the associated text font information of the associated element is taken as the associated element contour information of the associated element; or in a case where the type of the associated element is an icon type, the associated icon information of the associated element is taken as the associated element contour information of the associated element; determining the associated bounding rectangle of the associated element, and the associated rectangle of the associated component; based on the associated bounding rectangle coordinate information and the associated bounding rectangle side length information of the associated bounding rectangle, and the associated rectangle coordinate information and the associated rectangle side length information of the associated rectangle, calculating the associated layout information of the associated element in the associated component as the associated element layout information.
5. The method of claim 1, wherein, After the step of selecting one component other than the target component in the target object as the associated component, and determining the associated element contained in the associated component, the method further comprises: if the type of the target element is the same as the type of the associated element; performing the step of determining the target element contour information and the target element layout information of the target element in the target component; the step of selecting other elements in the associated component as the associated element, or in a case where the associated component does not contain other elements, selecting other components in the target object as the associated component, comprises: determining whether there are unselected elements in the associated component; if there are, selecting a reference element in the associated component, taking the reference element as the associated element, and performing the step of determining whether the type of the target element is the same as the type of the associated element; if there are not, selecting a reference component in the target object as the associated component, and performing the step of determining the target element contour information and the target element layout information of the target element in the target component.
6. The method of claim 1, wherein, In a case where the target element and the associated element are at least one, the step of calculating the contour similarity of the target component and the associated component in the visual dimension based on the target element contour information and the associated element contour information, comprises: generating at least one contour element pair based on at least one target element and at least one associated element; calculating the element contour similarity of each contour element pair corresponding to each target element and each associated element based on the target element contour information of each target element and the associated element contour information of each associated element; dividing at least one contour element pair into a contour element pair set corresponding to an object element; determining the element contour similarity of the contour element pair in the contour element pair set corresponding to each object element based on the element contour similarity of each contour element pair corresponding to each object element; constructing a contour similarity set corresponding to each object element based on the element contour similarity of the contour element pair in the contour element pair set corresponding to each object element; calculating the contour similarity of the target component and the associated component in the visual dimension based on the target element contour similarity selected in the contour similarity set corresponding to each object element.
7. The method of claim 1, wherein, In the case that the target elements and the associated elements are at least one respectively, the calculation of the layout similarity of the target component and the associated component in the layout dimension based on the target element layout information and the associated element layout information comprises: generating at least one layout element pair based on at least one target element and at least one associated element; calculating the element layout similarity corresponding to each layout element pair respectively according to the target element layout information of each target element and the associated element layout information of each associated element; dividing the at least one layout element pair into a layout element pair set corresponding to the object element; determining the element layout similarity of the layout element pair contained in the layout element pair set corresponding to each object element respectively based on the element layout similarity corresponding to each layout element pair respectively; constructing the layout similarity set corresponding to each object element according to the element layout similarity of the layout element pair contained in the layout element pair set corresponding to each object element; calculating the layout similarity of the target component and the associated component in the layout dimension based on the target element layout similarity selected in the layout similarity set corresponding to each object element.
8. The method of claim 6, wherein, In the case that the target element type of the target element is a text type and the associated element type of the associated element is a text type, the calculation of the element contour similarity between any one target element and any one associated element comprises: calculating the font size similarity between the target element and the associated element based on the target font size information contained in the target element contour information and the associated font size information contained in the associated element contour information; calculating the line similarity between the target element and the associated element based on the target line information contained in the target element contour information and the associated line information contained in the associated element contour information; calculating the element contour similarity between the target element and the associated element based on the font size similarity and the line similarity.
9. The method of claim 7, wherein, In the case that the target element type of the target element is a text type and the associated element type of the associated element is a text type, the calculation of the element layout similarity between any one target element and any one associated element comprises: calculating the text longitudinal similarity between the target element and the associated element based on the target upper distance information and the target lower distance information contained in the target element layout information and the associated upper distance information and the associated lower distance information contained in the associated element layout information; calculating the text transverse similarity between the target element and the associated element based on the target left distance information, the target right distance information and the target center distance information contained in the target element layout information and the associated left distance information, the associated right distance information and the associated center distance information contained in the associated element layout information; calculating the element layout similarity between the target element and the associated element based on the text longitudinal similarity and the text transverse similarity.
10. The method of claim 6, wherein, In a case where the target element type of the target element is an icon type and the associated element type of the associated element is an icon type, the calculation of the element contour similarity between any one target element and any one associated element comprises: calculating an icon height similarity between the target element and the associated element based on target icon height information contained in the target element contour information and associated icon height information contained in the associated element contour information; calculating an icon width similarity between the target element and the associated element based on target icon width information contained in the target element contour information and associated icon width information contained in the associated element contour information; calculating the element contour similarity between the target element and the associated element based on the icon height similarity and the icon width similarity.
11. The method of claim 7, wherein, In a case where the target element type of the target element is an icon type and the associated element type of the associated element is an icon type, the calculation of the element layout similarity between any one target element and any one associated element comprises: calculating an icon vertical similarity between the target element and the associated element based on target upper distance information and target lower distance information contained in the target element layout information and associated upper distance information and associated lower distance information contained in the associated element layout information; calculating an icon horizontal similarity between the target element and the associated element based on target left distance information and target right distance information contained in the target element layout information and associated left distance information and associated right distance information contained in the associated element layout information; calculating the element layout similarity between the target element and the associated element based on the icon vertical similarity and the icon horizontal similarity.
12. The method according to any one of claims 1 to 11, characterized in that, The determination of the component similarity between the target component and the associated component based on the contour similarity and the layout similarity comprises: in a case where the contour similarity is greater than or equal to a preset similarity threshold, taking the layout similarity as the component similarity between the target component and the associated component; in a case where the contour similarity is less than the preset similarity threshold, the component similarity between the target component and the associated component is zero.
13. An assembly similarity determination apparatus, comprising: comprise: an information determination module configured to select one component in a target object as a target component and determine a target element contained in the target component, select one component other than the target component in the target object as an associated component and determine an associated element contained in the associated component, select other elements in the associated component as the associated element if the type of the target element is different from that of the associated element, or select other components in the target object as the associated component in a case where no other element is contained in the associated component, determine target element contour information and target element layout information of the target element in the target component and associated element contour information and associated element layout information of the associated element in the associated component, wherein the target component and the associated component belong to the target object; a calculating module configured to calculate a contour similarity of the target component and the related component in a visual dimension based on the target element contour information and the related element contour information, and calculate a layout similarity of the target component and the related component in a layout dimension based on the target element layout information and the related element layout information; a component similarity determining module configured to determine a component similarity between the target component and the related component based on the contour similarity and the layout similarity, wherein the component similarity is used for classifying and storing components in the target object.
14. A computing device, comprising: comprising a memory and a detector; the memory is used to store computer executable instructions, and the detector is used to execute the computer executable instructions to implement the steps of the component similarity determining method in any one of claims 1 to 12.
15. A computer-readable storage medium storing computer instructions, wherein, The instructions are executed by the detector to implement the steps of the component similarity determining method in any one of claims 1 to 12.
Citation Information
Patent Citations
Graphical interface processing method and device
CN115033945A