Component classification model training method and apparatus
By constructing a component classification model, the identification and classification of components can be completed automatically, solving the problem of low efficiency of manual identification in existing technologies and improving the efficiency of component library management.
Patent Information
- Application Number
- CN202310409354.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-17
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2043-04-17
AI Technical Summary
In existing technologies, component identification and classification mainly rely on manual labor, which is inefficient and consumes a lot of human resources. There is an urgent need for an efficient automated solution.
By constructing a component classification model, obtaining the component structure tree, reconstructing it into a component table and embedding it, and training the initial component classification model until a model that meets the training stopping condition is obtained, the automatic identification and classification of components is achieved.
It improves the efficiency of component identification and classification, reduces the consumption of human resources, and facilitates the management of the component library and its use in downstream businesses.
Smart Images

Figure CN116383660B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present specification relates to the technical field of machine learning, and particularly relates to a component classification model training method and device. BACKGROUND
[0002] With the development of Internet technology, more and more businesses begin to be online, and with the online business, various application programs and web pages as the bridge to carry out interaction with users are designed more beautiful and convenient by the business providers; when designing components in the application program or web page, the designer needs to uniformly build a component library in order to maintain design consistency, improve production efficiency and manage the design system during the UI design process, and the component library can be shared with other designers, so as to improve the component design efficiency and more conveniently manage the designed components. However, when the designed components are stored in the library, the components need to be identified and classified before being stored. In the prior art, identification and classification are mostly manually performed by artificial, which is not only low in efficiency, but also consumes more time and human resources, and therefore an effective solution is urgently needed to solve the above problems. SUMMARY
[0003] Therefore, the embodiment of the present specification provides a component classification model training method. The present specification simultaneously relates to a component classification model training device, a component classification method, a component classification device, a computing device, and a computer readable storage medium, to solve the technical defects existing in the prior art.
[0004] According to a first aspect of the embodiment of the present specification, a component classification model training method is provided, comprising:
[0005] obtaining a component structure tree, wherein a component node in the component structure tree contains component attribute information;
[0006] reconstructing the component structure tree to obtain a component table recording the component attribute information, and performing embedding processing on the component attribute information recorded in the component table to obtain a component embedding vector;
[0007] inputting the component embedding vector into an initial component classification model for processing to obtain predicted component classification information corresponding to the component node in the component structure tree;
[0008] based on the reference component classification information and the predicted component classification information corresponding to the component node in the component structure tree, adjusting parameters of the initial component classification model until a component classification model meeting a training stop condition is obtained.
[0009] Optionally, the obtaining of the component structure tree comprises:
[0010] obtain an initial component structure tree corresponding to the sample object;
[0011] perform structure detection on the initial component structure tree according to a training strategy of the initial component classification model;
[0012] in a case where the structure detection result meets a preset structure detection condition, take the initial component structure tree as the component structure tree;
[0013] in a case where the structure detection result does not meet the preset structure detection condition, split the initial component structure tree, and determine the component structure tree according to a splitting result.
[0014] Optionally, the reconstruction is performed on the component structure tree to obtain a component table recording component attribute information, including:
[0015] determine a node attribute type corresponding to each component node in the component structure tree according to component attribute information contained in the component node;
[0016] select an update strategy for each component node in the component structure tree according to the node attribute type, and update component attribute information contained in each component node by using the update strategy;
[0017] perform traversal on the updated component attribute information contained in each component node in the component structure tree, and generate a component table recording the updated component attribute information according to a traversal result.
[0018] Optionally, the generating of the component table recording the updated component attribute information according to the traversal result includes:
[0019] generate an initial component table recording the updated component attribute information according to the traversal result;
[0020] insert columns recording component node hierarchical information and component node sequence information into the initial component table according to a model training strategy of the initial component classification model;
[0021] generate the component table recording the updated component attribute information according to an insertion result.
[0022] Optionally, the embedding processing is performed on the component attribute information recorded in the component table to obtain a component embedding vector, including:
[0023] perform embedding processing on component attribute information corresponding to each row table in the component table respectively to obtain a sub-component embedding vector corresponding to each row table respectively;
[0024] merge the sub-component embedding vectors corresponding to each row table to obtain the component embedding vector.
[0025] Optionally, the determination of the sub-component embedding vector corresponding to the target row table in the component table comprises:
[0026] determining target component attribute information corresponding to the target row table in the component table, and reading sequence identification information, hierarchical identification information, text information and feature information in the target component attribute information;
[0027] obtaining a sequence identification vector, a hierarchical identification vector, a text vector and a feature vector by embedding processing on the sequence identification information, the hierarchical identification information, the text information and the feature information, respectively;
[0028] splicing the sequence identification vector, the hierarchical identification vector, the text vector and the feature vector to obtain the sub-component embedding vector corresponding to the target row table.
[0029] Optionally, the inputting of the component embedding vector into the initial component classification model for processing to obtain the predicted component classification information corresponding to the component node in the component structure tree comprises:
[0030] inputting the component embedding vector into the initial component classification model, and performing encoding processing on the component embedding vector by an encoder in the initial component classification model to obtain a component encoding vector;
[0031] determining a hidden state vector based on the component encoding vector, and taking the hidden state vector as a component classification vector;
[0032] performing decoding processing on the component classification vector by a decoder in the initial component classification model to obtain the predicted component classification information corresponding to the component node in the component structure tree.
[0033] Optionally, the encoding processing on the component embedding vector by the encoder in the initial component classification model to obtain the component encoding vector comprises:
[0034] calculating the embedding encoding vector and a weight matrix by the encoder in the initial component classification model to obtain a query vector, a key vector and a value vector;
[0035] performing similarity score calculation according to the query vector, the key vector and the value vector, and determining a component encoding vector containing hierarchical dependency and node dependency according to the calculation result.
[0036] Optionally, the initial component classification model is adjusted based on the reference component classification information corresponding to the component nodes in the component structure tree and the predicted component classification information until a component classification model satisfying a training stop condition is obtained, including:
[0037] The reference component classification information corresponding to the component nodes in the component structure tree is obtained.
[0038] The reference component classification information and the predicted component classification information are calculated according to a cross-entropy loss function to obtain a target loss value.
[0039] The initial component classification model is adjusted using the target loss value until a component classification model satisfying a training stop condition is obtained.
[0040] According to a second aspect of the embodiments of the present specification, a component classification method is provided, including:
[0041] A target component structure tree corresponding to a target object is obtained.
[0042] The target component structure tree is input into the component classification model in the above method for processing to obtain component type information corresponding to each target component node in the target component structure tree.
[0043] The target components contained in the target object are classified according to the component type information, and a component processing task is performed according to the classification result.
[0044] According to a third aspect of the embodiments of the present specification, a component classification model training device is provided, including:
[0045] An obtaining module is configured to obtain a component structure tree, wherein a component node in the component structure tree contains component attribute information.
[0046] A reconstruction module is configured to reconstruct the component structure tree to obtain a component table recording component attribute information, and perform embedding processing on the component attribute information recorded in the component table to obtain a component embedding vector.
[0047] A processing module is configured to input the component embedding vector into an initial component classification model for processing to obtain predicted component classification information corresponding to the component nodes in the component structure tree.
[0048] An adjustment module is configured to adjust the initial component classification model based on the reference component classification information corresponding to the component nodes in the component structure tree and the predicted component classification information until a component classification model satisfying a training stop condition is obtained.
[0049] According to a fourth aspect of the embodiments of the present specification, an assembly classification device is provided, comprising:
[0050] An acquisition structure tree module configured to acquire a target assembly structure tree corresponding to a target object;
[0051] An input model module configured to input the target assembly structure tree into the assembly classification model in the above method for processing to obtain assembly type information corresponding to each target assembly node in the target assembly structure tree;
[0052] A classified assembly module configured to classify target assemblies contained in the target object according to the assembly type information, and perform an assembly processing task according to the classification result.
[0053] According to a fifth aspect of the embodiments of the present specification, a computing device is provided, comprising:
[0054] A memory and a processor;
[0055] The memory is configured to store computer executable instructions, and the processor is configured to execute the computer executable instructions to implement the steps of the assembly classification model training method or the assembly classification method.
[0056] According to a sixth aspect of the embodiments of the present specification, a computer readable storage medium is provided, which stores computer executable instructions, and the instructions are executed by a processor to implement the steps of the assembly classification model training method or the assembly classification method.
[0057] The assembly classification model training method provided by the present specification can improve the efficiency of assembly classification. An initial assembly classification model capable of identifying and classifying assemblies can be constructed. Then, an assembly structure tree can be acquired, and the assembly nodes in the assembly structure tree contain assembly attribute information. At this time, the assembly structure tree can be reconstructed to obtain an assembly table recording the assembly attribute information. At this time, the assembly attribute information recorded in the assembly table is embedded to obtain the assembly embedding vector corresponding to the assembly structure tree. Further, the assembly embedding vector is input into the initial assembly classification model for processing to obtain the predicted assembly classification information corresponding to the assembly nodes in the assembly structure tree. Based on the reference assembly classification information and the predicted assembly classification information corresponding to the assembly nodes in the assembly structure tree, the initial assembly classification model is adjusted to complete one training. This process is repeated until the assembly classification model that meets the training stop condition is obtained. The assemblies are classified by modeling, which can effectively improve the efficiency of assembly identification and classification, thereby facilitating the use of downstream businesses. BRIEF DESCRIPTION OF DRAWINGS
[0058] Figure 1is a schematic diagram of a component classification model training method provided by an embodiment of the present specification;
[0059] Figure 2 is a flowchart of a component classification model training method provided by an embodiment of the present specification;
[0060] Figure 3 is a schematic diagram of a component structure tree in a component classification model training method provided by an embodiment of the present specification;
[0061] Figure 4 is a flowchart of a component classification method provided by an embodiment of the present specification;
[0062] Figure 5 is a processing flowchart of a component classification method provided by an embodiment of the present specification;
[0063] Figure 6 is a structural schematic diagram of a component classification model training device provided by an embodiment of the present specification;
[0064] Figure 7 is a structural schematic diagram of a component classification device provided by an embodiment of the present specification;
[0065] Figure 8 is a structural block diagram of a computing device provided by an embodiment of the present specification. DETAILED DESCRIPTION
[0066] 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 in the examples, and it is understood that the scope of the present specification is not limited to the details below.
[0067] 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 accompanying 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.
[0068] It should be understood that, although the terms first, second, etc. can be employed in describing various information in one or more embodiments of the present specification, the information should not be limited to these terms. These terms are only used to distinguish one type of information from another type of information. For example, without departing from the scope of one or more embodiments of the present specification, first can also be referred to as second, and similarly, second can also be referred to as first. Depending on the context, the word "if" as used herein can be interpreted as "when" or "upon" or "in response to determining".
[0069] Firstly, the noun terms related to one or more embodiments of the present specification are explained.
[0070] Transformer model: a deep learning model that adopts attention mechanism to differentially weight the importance of each part of the input data, and is widely used in various natural language processing tasks.
[0071] In the present specification, a component classification model training method is provided, and the present specification also relates to a component classification model training device, a component classification method, a component classification device, a computing device, and a computer-readable storage medium, which are explained one by one in the following embodiments.
[0072] Referring to Figure 1 As shown in the schematic diagram, the component classification model training method provided by the present specification can be used to improve the component classification efficiency. An initial component classification model capable of identifying and classifying components can be constructed. Then, a component structure tree can be acquired, and the component nodes in the component structure tree contain component attribute information. At this time, the component structure tree can be reconstructed to obtain a component table recording the component attribute information. At this time, the component attribute information recorded in the component table is embedded to obtain the component embedding vector corresponding to the component structure tree. Further, the component embedding vector is input into the initial component classification model for processing to obtain the predicted component classification information corresponding to the component nodes in the component structure tree. Then, the initial component classification model is adjusted based on the benchmark component classification information and the predicted component classification information corresponding to the component nodes in the component structure tree. Once training is completed, the training is repeated until the component classification model that meets the training stop condition is obtained. The components are classified by modeling, which can effectively improve the component identification and classification efficiency, thereby facilitating the use of downstream businesses.
[0073] Figure 2 A flowchart of a component classification model training method according to an embodiment of the present specification is shown, which specifically includes the following steps:
[0074] In step S202, a component structure tree is acquired, wherein the component nodes in the component structure tree contain component attribute information.
[0075] The component classification model training method provided in the embodiment trains a component classification model, which can identify the types of any completed component design, so as to facilitate writing the component of the identified type into a component library, and facilitate selecting and using the associated component according to the type in the application stage. The component refers to a reusable element for insertion and use in a user interaction page, including but not limited to various design elements such as text boxes, shapes, icons, and touchable buttons, which are not limited in the embodiment.
[0076] In actual application, a designer usually completes the design of a component on a component design draft, and writes the component into a component library after the design is completed, so as to facilitate reuse in user interaction page design. In the design stage, a design draft may include multiple designed components, and the designed components generally have embedding or association relationship, that is, multiple components may be components that need to be used together, such as a page design for adding a product to a shopping cart. The designer usually designs a product information display component, a product price display component, an add-to-cart component, a purchase component, and the like at the same time. These components have hierarchical relationship. In order to facilitate selection and use of one or more components in the application, it is necessary to construct a structure tree according to the hierarchical relationship of the designed components, and then write the structure tree into the component library for persistence according to the structure information of the structure tree. However, after the structure tree is constructed, the determination of the component category usually needs to be completed by manual operation, which consumes a large amount of human resources. In order to save human resources and improve the classification efficiency of the components, the component classification model training method provided in the embodiment realizes modeling for the component classification task, and uses the modeled and trained component classification model to replace manual operation for component classification, which can effectively improve the component identification and classification efficiency, thereby facilitating the use of downstream business.
[0077] Specifically, the component structure tree specifically refers to a sample for training an initial component classification model, which is constructed according to the hierarchical relationship of the components included in the design draft. Each component node is a node constructed by a component corresponding to a layer, and each component node includes component attribute information for recording the attributes of the component corresponding to the component node. Correspondingly, the component attribute information specifically refers to attribute description information of the component corresponding to the component node, including component type, component attribute value, component hierarchical relationship, and the like.
[0078] Based on this, in the model training stage, in order to improve the model identification accuracy and simultaneously complete the type identification of all components included in the design draft, the component structure tree as a sample can be acquired first, and the component nodes in the component structure tree include the component attribute information of the components, which facilitates subsequent model training based on the component attribute information.
[0079] Further, considering that the component structure tree obtained in the model training stage may not be a directly applicable structure tree, the obtained initial component structure tree can be split to obtain a component structure tree that meets the condition; in this embodiment, the specific implementation is as follows:
[0080] obtain an initial component structure tree corresponding to the sample object; perform structure detection on the initial component structure tree according to a training strategy of the initial component classification model; in a case where a structure detection result meets a preset structure detection condition, use the initial component structure tree as the component structure tree; in a case where the structure detection result does not meet the preset structure detection condition, split the initial component structure tree, and determine the component structure tree according to a splitting result.
[0081] Specifically, the sample object specifically refers to a sample component design draft, and correspondingly, the initial component structure tree specifically refers to a component structure tree generated based on the sample component design draft; correspondingly, the training strategy specifically refers to a strategy that needs to be followed in the initial component classification model training stage, which is used to limit the size of the model input content. Correspondingly, the prediction structure detection condition specifically refers to a condition for detecting whether the initial component structure tree can be directly used for model training, so as to avoid the problem that the initial structure tree has too many levels and exceeds the upper limit of model prediction, and cannot be used.
[0082] Based on this, after obtaining the initial component structure tree corresponding to the sample object, in order to avoid the problem that the initial component structure tree cannot be used, the initial component structure tree can be first subjected to structure detection according to the training strategy of the initial component classification model; in a case where a structure detection result meets a preset structure detection condition, it is indicated that the initial component structure tree can be directly used, and thus the initial component structure tree can be used as the component structure tree; in a case where the structure detection result does not meet the preset structure detection condition, it is indicated that the initial component structure tree is too large and cannot be directly used, and thus the initial component structure tree can be first split to determine the component structure tree according to a splitting result. In actual application, when the initial component structure tree is split, a splitting point can be selected according to actual needs, which is not limited in this embodiment.
[0083] For example, referring to the component structure tree shown in (a) of Figure 3 The root node of the component structure tree is root, and there are three child nodes under the root node, which are C1_1, C1_2, and C1_3. The C1_3 node has a C2_1 node under it, and the C2_1 node has a C3_1 node under it. When it is determined that the size of the component structure tree is too large, the C1_3 node can be selected as the splitting point, and then the component structure tree is split to obtain a new component structure tree, in which the C1_3 node is the root node, the child node of the C1_3 node is the C2_1 node, and the child node of the C2_1 node is the C3_1 node, which is used for downstream business.
[0084] In summary, after obtaining the initial component structure tree, in order to facilitate downstream business use, the component structure tree can be divided according to actual needs, so as to obtain a component structure tree that can be used for training a model, thereby improving the model training accuracy.
[0085] In step S204, the component structure tree is reconstructed to obtain a component table recording component attribute information, and the component attribute information recorded in the component table is embedded to obtain a component embedding vector.
[0086] Specifically, after obtaining the component structure tree and the component nodes in the component structure tree containing component attribute information, further, in order to enable the model to learn the hierarchical relationship between the component nodes in the component structure tree to complete component classification in the model training stage, the component structure tree can be reconstructed first to obtain a component table recording component attribute information, so that the component attribute information of the component nodes corresponding to the components is recorded in the component table. Thereafter, based on the table, the component attribute information recorded in the table is embedded to obtain a component embedding vector corresponding to the component structure tree, so as to facilitate downstream business to use the component embedding vector of the component structure tree to train an initial component classification model, so that the model can learn the hierarchical relationship of the components and the dependency relationship between the components, thereby improving the component classification accuracy of the component classification model.
[0087] Specifically, the component table refers to a table in which each row corresponds to each component node, and each column in each row records component attribute information. Correspondingly, the embedding processing specifically refers to the processing of converting the component attribute information in the component table into a low-dimensional vector, which can be input into the model for subsequent prediction.
[0088] Further, in the reconstruction of the component structure tree, different types of component attribute information are updated to obtain component attribute information that can be recorded in the table. In this embodiment, the specific implementation is as follows:
[0089] According to the component attribute information contained in the component nodes in the component structure tree, determine the node attribute type corresponding to each component node in the component structure tree; select an update strategy for each component node in the component structure tree according to the node attribute type, and update the component attribute information contained in each component node using the update strategy; traverse the updated component attribute information contained in the component nodes in the component structure tree, and generate a component table recording the updated component attribute information according to the traversal result.
[0090] Specifically, the node attribute type specifically refers to the type corresponding to the component node, including but not limited to text type, number type and enumeration type; correspondingly, the selected update strategy specifically refers to the strategy selected in combination with the node attribute type, used to convert the enumeration type into the number type, and the number type and the text type remain unchanged.
[0091] Based on this, after obtaining the component structure tree, in order to be able to use it to train the initial component classification model, the node attribute type corresponding to each component node in the component structure tree can be determined according to the component attribute information contained in the component node in the component structure tree; then the update strategy is selected for each component node in the component structure tree according to the node attribute type, which is used to realize the unchanged strategy for the component nodes of the text type and the number type, and the strategy of changing the component nodes of the enumeration type into the number type, and then the component attribute information contained in each component node is updated by using the update strategy; that is, the types of the component nodes are all converted into the text type and the number type, avoiding the problem of recording more complex information caused by the enumeration type, and then the updated component attribute information contained in the component nodes in the component structure tree is traversed, and the component table recording the updated component attribute information can be generated according to the traversal result.
[0092] In summary, by unifying the types of the component nodes into types convenient for recording, it is convenient to record the component attribute information corresponding to each component node in each row when generating the component table, so as to facilitate the generation of the embedding vector for subsequent use.
[0093] Further, after the traversal is completed, in order to be able to fuse the component hierarchical relationship and the component dependency relationship in the model training stage, fully enable the model to learn this ability, thereby improving the model training precision, a new column can be inserted in the table; in the embodiment, the specific implementation manner is as follows:
[0094] According to the traversal result, an initial component table recording the updated component attribute information is generated; according to the model training strategy of the initial component classification model, a column recording the component node hierarchical information and the component node order information is inserted in the initial component table; according to the insertion result, a component table recording the updated component attribute information is generated.
[0095] Specifically, the initial component table specifically refers to a component table generated according to the updated component attribute information, which only records the self attributes of each table and does not record the hierarchical relationship between nodes; correspondingly, the model training strategy specifically refers to the information strategy required when training the model, which is used to process the sample into a component table that meets the model training requirements in the sample preprocessing stage; correspondingly, the component node hierarchical information specifically refers to the information recording the hierarchical relationship between the component nodes in the component structure tree; correspondingly, the component node sequence information specifically refers to the information used to record the traversal order of the component nodes in the component structure tree.
[0096] Based on this, after traversing the updated component attribute information contained in the component nodes in the component structure tree, an initial component table recording the updated component attribute information can be generated according to the traversal result; At this time, considering that the hierarchical relationship and the order relationship between the nodes are not recorded in the table, and this relationship is the basis for the model to complete the component classification combined with the context, therefore, according to the model training strategy of the initial component classification model, the columns recording the component node hierarchical information and the component node sequence information can be inserted in the initial component table; and a component table recording the updated component attribute information is generated according to the insertion result.
[0097] Following the above example, after obtaining the component structure tree as shown in (a) of Figure 3 , it can be determined that the root node in the component structure tree is the root node, and the root node has three child nodes, C1_1, C1_2, and C1_3, and C1_3 has a C2_1 node, and C2_1 has a C3_1 node, each component node corresponds to its own attribute list, and it is determined that the component nodes involve three types, namely text type, number type and enumeration type. Among them, the attribute information of the text type can be directly retained in the text attribute field, and similarly, the attribute information of the number type can also be directly retained. While the attribute information of the enumeration type needs to be mapped to the number type, when the value of the original attribute attr_t is one of (min, middle, max), after one-to-one correspondence with the number, the attribute map = {min:1, middle:2, max:3} can be obtained, and the enumeration type is changed to the number type.
[0098] At this time, each component node will have a corresponding attribute list, and the naming rule of each child node can be completed according to C{level}_{order}, that is, the naming and attribute list of each component node are as shown in (a) of Figure 3 , wherein C1_2 represents the 2nd node in the first level (level) of the component structure tree, and similarly, the explanation of other nodes can be referred to the explanation of C1_2, which is not limited in this embodiment.
[0099] Further, after obtaining the component structure tree with processed attribute information, a breadth-first traversal algorithm can be used to convert the component structure tree into a component table in a breadth-first traversal order, which is used to implement the embedding of the component table, and the embedding vector of the component structure tree is obtained. Figure 3 After traversing the component structure tree shown in (a), the component table shown in Table (1) is obtained, where each row in the component table corresponds to a component node, and each column corresponds to attribute information of one dimension.
[0100]
[0101] (1)
[0103] The nid column records the component node identifier, the pid column records the level of the component node in the component structure tree, the oid column records the unique global order id of the component node, and the pid and oid can preserve the level information in the original component structure tree. The text column records the text content in the component node attribute list, and the attr_1-attr_N columns record the component node attribute information in different dimensions, which is convenient for subsequent embedding processing of the component table shown in Table (1) and training of the component classification model.
[0104] In summary, by reconstructing the component structure tree into a component table, the hierarchical information and global order information between component nodes can be recorded in the component table, which facilitates the recording of this information after the subsequent construction of the embedding vector, and the model training phase can learn to improve the prediction accuracy of the model.
[0105] After obtaining the component table, the embedding processing is performed on each row of the component table to obtain the component embedding vector corresponding to the component structure tree. In this embodiment, the specific implementation is as follows:
[0106] The component attribute information corresponding to each row of the component table is embedded to obtain a sub-component embedding vector corresponding to each row of the component table. The sub-component embedding vectors corresponding to each row of the component table are merged to obtain the component embedding vector.
[0107] Specifically, the sub-component embedding vector refers to the vector expression obtained by embedding the component attribute information corresponding to each row of the component table. Based on this, after obtaining the component table recording the component attribute information, the embedding processing can be performed on the component attribute information corresponding to each row of the component table to obtain a sub-component embedding vector corresponding to each row of the component table. Then, the sub-component embedding vectors corresponding to each row of the component table are merged to obtain the component embedding vector corresponding to the component structure tree, which is convenient for downstream business use.
[0108] The determination of the sub-component embedding vector corresponding to the target row table in the component table comprises: determining target component attribute information corresponding to the target row table in the component table, and reading sequence identification information, hierarchical identification information, text information, and feature information in the target component attribute information; obtaining a sequence identification vector, a hierarchical identification vector, a text vector, and a feature vector by embedding processing the sequence identification information, the hierarchical identification information, the text information, and the feature information respectively; and obtaining the sub-component embedding vector corresponding to the target row table by splicing the sequence identification vector, the hierarchical identification information vector, the text vector, and the feature vector.
[0109] Specifically, the target row table specifically refers to a row table corresponding to any component node in the component table. This embodiment only takes one target row table as an example to describe the sub-embedding vector, and the same or corresponding description in this embodiment can be referred to for other embodiments, which will not be described in detail here. Correspondingly, the sequence identification information specifically refers to the globally unique sequence identification of the component node corresponding to the target row table; correspondingly, the hierarchical identification information specifically refers to the identification of the level to which the component node belongs in the component structure tree; correspondingly, the text information specifically refers to the text characters in the component attribute information; and correspondingly, the feature vector specifically refers to the attribute features corresponding to the component node in different dimensions.
[0110] Based on this, first, the target component attribute information corresponding to the target row table in the component table can be determined, and second, the sequence identification information, the hierarchical identification information, the text information, and the feature information in the target component attribute information can be read. Third, the sequence identification information, the hierarchical identification information, the text information, and the feature information are embedded processed respectively, so as to obtain the sequence identification vector corresponding to the sequence identification information, the hierarchical identification vector corresponding to the hierarchical identification information, the text vector corresponding to the text information, and the feature vector corresponding to the feature information. Finally, the sequence identification vector, the hierarchical identification vector, the text vector, and the feature vector are spliced, so as to obtain the sub-component embedding vector corresponding to the target row table.
[0111] Following the above example, after obtaining the component table as shown in Table (1), the sequence identification information, the hierarchical identification information, the text information, and the feature information in the target component attribute information corresponding to the target row table can be read according to the following steps: Figure 3The embedding processing mode shown in (b) is used for embedding processing operation. That is, the pid corresponding to each component node in the component table is selected, and then the pid value corresponding to each component node is vector mapped using a set function in the L_E stage to obtain the vector LevelEmbed corresponding to each component node in the L_E stage and having a length of 768. Then, the oid corresponding to each component node in the component table is selected, and then the Oid value corresponding to each component node is vector mapped using a set function in the O_E stage to obtain the vector OrderEmbed corresponding to each component node in the O_E stage and having a length of 768. The text corresponding to each component in the component table is selected, and then the text is encoded using the BERT model in the T_E stage, and the hidden state vector of the last layer of the BERT model is averaged to obtain the vector TextEmbed corresponding to each component node in the T_E stage and having a length of 768. The attr_1-attr_N corresponding to each component node in the component table is selected, and then the attr_1-attr_N value corresponding to each component node is vector mapped using a fully connected layer in the A_E stage to obtain the vector AttributeEmbed corresponding to each component node in the A_E stage and having a length of 768.
[0112] At this time, through the mapping function, the text information text of each component node is encoded into a vector TextEmbed with a length of 768; the level information pid and oid are encoded into two OrderEmbed and LevelEmbed with a length of 768; the attribute information attr_1-attr_N is encoded into an AttributeEmbed with a length of 768; and finally, the TextEmbed, OrderEmbed, LevelEmbed and AttributeEmbed corresponding to each component node are spliced to obtain the embedding vector InputEmbedding corresponding to the component table, to facilitate subsequent use of the initial component classification model for training. In actual application, when converting oid into a vector using a set function, it is actually a function that converts information into 768 dimensions.
[0113] In summary, by combining the component attribute information of different component nodes in the component table for embedding processing, and fusing the sub-component embedding vectors obtained by embedding processing, the generation of embedding vectors can be realized by fusing the component attribute information, component level information and component order information. In subsequent model training, the model can learn the context information to complete component classification by combining the information, which can ensure higher component classification accuracy.
[0114] In step S206, the component embedding vector is input into the initial component classification model for processing to obtain the predicted component classification information corresponding to the component nodes in the component structure tree.
[0115] Specifically, after obtaining the component embedding vector corresponding to the component structure tree, the component embedding vector can be input into the initial component classification model for processing. The initial component classification model is used as a classifier to classify the components corresponding to the component nodes in the component structure tree to obtain the predicted component classification information predicted by the initial component classification model, which facilitates subsequent parameter tuning of the model in combination with the labels corresponding to the component structure tree.
[0116] The initial component classification model specifically refers to a model capable of classifying the components corresponding to the component nodes in the component structure tree, and the model is implemented using Transformers. Correspondingly, the predicted component classification information specifically refers to the category information obtained after category recognition of the components corresponding to the component nodes in the component structure tree, which includes but is not limited to text box category information, shape category information, icon category information, button category information, etc.
[0117] Further, the initial component classification model identifies the category of the components corresponding to the component nodes in the component structure tree by a model with an encoding and decoding structure. In this embodiment, the specific implementation is as follows:
[0118] The component embedding vector is input into the initial component classification model, the component embedding vector is encoded by the encoder in the initial component classification model to obtain a component encoding vector, a hidden state vector is determined based on the component encoding vector and the hidden state vector is used as a component classification vector, and the component classification vector is decoded by the decoder in the initial component classification model to obtain the predicted component classification information corresponding to the component nodes in the component structure tree.
[0119] Specifically, the component encoding vector is a vector expression obtained by encoding the component embedding vector using the encoder in the initial component classification model, which is used to extract the features of the components corresponding to each component node. Correspondingly, the hidden state vector is a vector expression composed of the first dimension elements in the component encoding vector, which integrates the upper and lower hierarchical relationships of the component nodes and the dependency relationships between the nodes.
[0120] Based on this, after obtaining the component embedding vector corresponding to the component structure tree, the component embedding vector can be first input into the initial component classification model to perform encoding processing on the component embedding vector by the encoder in the initial component classification model, at which time the component encoding vector can be obtained. In order to be able to classify the components corresponding to each component node in the component structure tree, the hidden state vector can be determined based on the component encoding vector, and the hidden state vector is taken as the component classification vector. Finally, the component classification vector is decoded by the decoder in the initial component classification model, and the predicted component classification information corresponding to the component node in the component structure tree can be obtained.
[0121] Furthermore, in the encoding process, the multi-head attention mechanism is used. In this embodiment, the implementation is as follows:
[0122] The encoder in the initial component classification model is used to calculate the embedding encoding vector and the weight matrix to obtain the query vector, the key vector and the value vector. Similarity score calculation is performed according to the query vector, the key vector and the value vector, and the component encoding vector containing hierarchical dependency and node dependency is determined according to the calculation result.
[0123] Based on this, in the encoding stage using the encoder in the initial component classification model, the encoder in the initial component classification model can be used to calculate the embedding encoding vector and the weight matrix to obtain the query vector, the key vector and the value vector. Then, similarity score calculation is performed according to the query vector, the key vector and the value vector, and the component encoding vector containing hierarchical dependency and node dependency is determined according to the calculation result.
[0124] That is, using the Transformers model as the component classification model, the core module self-attention module of the Transformers model can be used. The self-attention (multi-head attention mechanism) mechanism can regard each element (such as each word) in the input sequence as a query, a key and a value, and calculate the similarity scores between them. Then, the weighted sum of all values is calculated using these scores to obtain the output result, i.e., the component encoding vector.
[0125] In the implementation process, the input sequence can be represented as a matrix X (component embedding vector), where each row represents an element (such as a word), and each column represents a dimension of the input vector. Then, the vector representations of query, key and value are calculated by multiplying the matrix X by three weight matrices (representing query, key and value respectively), i.e.: Q = XW Q , K = XW K , V = XWv where W^Q, W^K and W^V are all learned parameter matrices.
[0126] On this basis, the similarity score between the query vector and the key vector can be calculated by calculating the dot product between the query vector and the key vector, and then dividing the result by a scalar. Specifically, assuming that there is a query vector q and a key vector k, the dot product of which is: score(q, k) = q*k. The subsequent calculation can be carried out in the same way. The self-attention mechanism of the Transformer can capture long dependencies, can deal with dependencies between different positions, and can better model the hierarchical relationship and the information of parent and child nodes.
[0127] Following the above example, after obtaining the embedding vector InputEmbedding, the embedding vector InputEmbedding corresponding to the component structure tree can be input into the Transformers model for processing, and it is determined that the component type corresponding to the C1_1 component node in the component structure tree is a text box, the component type corresponding to the C1_2 component node is a text box; the component type corresponding to the C1_3 component node is an icon, the component type corresponding to the C2_1 component node is a button, and the component type corresponding to the C3_1 component node is a button, which are used for subsequent parameter tuning of the Transformers model combined with sample labels.
[0128] In summary, by using the Transformers model with the encoding-decoding structure as the component classification model, the hierarchical relationship and the dependency relationship between the component nodes can be fused in the component classification stage, so that the model can learn to complete the component classification combined with the hierarchical relationship, thereby effectively improving the classification accuracy of the model.
[0129] Step S208, based on the reference component classification information and the predicted component classification information corresponding to the component nodes in the component structure tree, the initial component classification model is tuned until a component classification model that meets the training stopping condition is obtained.
[0130] Specifically, after obtaining the predicted component classification information corresponding to each component node in the component structure tree, further, in order to train a model that meets the use requirements, the initial component classification model can be tuned based on the reference component classification information and the predicted component classification information corresponding to the component nodes in the component structure tree, until a component classification model that meets the training stopping condition is obtained.
[0131] The reference component classification information specifically refers to the real component classification information corresponding to the component node in the component structure tree, and the corresponding training stop condition specifically refers to a condition for stopping training of the initial component classification model, including but not limited to a loss value comparison condition, an iteration number condition, or a verification condition, etc., which are not limited in the embodiment.
[0132] Further, in the parameter adjustment stage, the loss value can be calculated in combination with the prediction result and the label to adjust the model. In the embodiment, the specific implementation is as follows:
[0133] The reference component classification information corresponding to the component node in the component structure tree is obtained. The reference component classification information and the predicted component classification information are calculated according to the cross-entropy loss function to obtain a target loss value. The initial component classification model is adjusted using the target loss value until a component classification model satisfying the training stop condition is obtained.
[0134] Based on this, in the parameter adjustment stage, the reference component classification information corresponding to the component node in the component structure tree can be obtained first. Then, the reference component classification information and the predicted component classification information are calculated according to the cross-entropy loss function to obtain a target loss value. At this time, the initial component classification model can be adjusted using the target loss value. If the adjusted model does not satisfy the training stop condition, new samples can be selected for further training until a component classification model satisfying the training stop condition is obtained.
[0135] That is, for the last layer of the Transformers model, the hidden state vector of the component encoding vector can be taken as the classification vector first. Then, the classification vector is processed through the softmax layer to obtain the predicted component classification information corresponding to the component node in the component structure tree. At this time, the reference component classification information corresponding to the component node in the component structure tree and the predicted component classification information corresponding to the component node in the component structure tree are used to calculate the cross-entropy loss function. The model is adjusted according to the calculated loss value until a component classification model satisfying the training stop condition is obtained.
[0136] In the above example, after obtaining the predicted classification information corresponding to each component node in the component structure tree, the reference classification information corresponding to each component node in the component structure tree can be read. Then, the loss value is calculated in combination with the cross-entropy loss function. The model is adjusted using the calculated loss value to obtain an intermediate component classification model. Thereafter, new samples can be selected for further training until a model with a loss value less than a loss value threshold is obtained as a component classification model.
[0137] The component classification model training method provided in the specification can improve the component classification efficiency. An initial component classification model capable of identifying and classifying components can be constructed. Then, a component structure tree can be acquired, and the component nodes in the component structure tree contain component attribute information. At this time, the component structure tree can be reconstructed to obtain a component table recording the component attribute information. At this time, the component attribute information recorded in the component table is embedded to obtain the component embedding vector corresponding to the component structure tree. Further, the component embedding vector is input into the initial component classification model for processing to obtain the predicted component classification information corresponding to the component nodes in the component structure tree. Based on the reference component classification information and the predicted component classification information corresponding to the component nodes in the component structure tree, the initial component classification model is adjusted to complete one training. In this way, the training is repeated until the component classification model meeting the training stop condition is obtained. The components are classified by modeling, which can effectively improve the component identification and classification efficiency, thereby facilitating the use of downstream businesses.
[0138] Corresponding to the above method embodiments, the specification also provides component classification method embodiments, Figure 4 A flowchart of a component classification method provided by an embodiment of the specification is shown. As shown in Figure 4 The method includes:
[0139] Step S402, acquiring a target component structure tree corresponding to a target object;
[0140] Step S404, inputting the target component structure tree into the component classification model in the above method for processing to obtain the component type information corresponding to each target component node in the target component structure tree;
[0141] Step S406, classifying the target components contained in the target object according to the component type information, and executing a component processing task according to the classification result.
[0142] The contents not described in detail in the component classification method provided in this embodiment can be referred to the same or corresponding description in the above embodiments. This embodiment will not be described in detail here.
[0143] Specifically, the target object specifically refers to a component design draft, and the component processing task specifically refers to a task of processing the target components contained in the target object, including but not limited to a task of storing to data.
[0144] Based on this, after the designer completes the component design, the target object can be submitted to the server, and the server can first obtain the target component structure tree corresponding to the target object at this time; then input the target component structure tree into the component classification model in the above method for processing, so as to obtain the component type information corresponding to each target component node in the target component structure tree; thereafter, according to the component type information, the target components contained in the target object are classified, and the component processing task is executed according to the classification result.
[0145] For example, after user A submits a design draft to the server, the server will first generate a component structure tree corresponding to the design draft, and then input the component structure tree into the component classification model for processing. After processing, the component type information corresponding to each component node in the component structure tree is determined, and then the component type information can be assigned to each component corresponding to the component node. Thereafter, according to the category information of the components, the components can be written into the component library, realizing writing the components into the component library according to the type.
[0146] In summary, by using the trained component classification model for component classification processing, the component classification efficiency and accuracy can be effectively improved, thereby saving more human resources.
[0147] The following is a combination of the accompanying Figure 5 The application of the component classification method provided in the specification in the component identification scene in the application program is taken as an example to further illustrate the component classification method. Among them, Figure 5 A processing flowchart of a component classification method provided by an embodiment of the specification is shown, which specifically includes the following steps:
[0148] Step S502, obtaining an initial component structure tree corresponding to a sample object, and performing structure detection on the initial component structure tree according to a training strategy of an initial component classification model.
[0149] Step S504, in the case that the structure detection result does not satisfy a preset structure detection condition, performing segmentation on the initial component structure tree, and determining a component structure tree according to the segmentation result; wherein the component nodes in the component structure tree contain component attribute information.
[0150] Step S506, determining the node attribute type corresponding to each component node in the component structure tree according to the component attribute information contained in the component nodes in the component structure tree.
[0151] Step S508, selecting an update strategy for each component node in the component structure tree according to the node attribute type, and updating the component attribute information contained in each component node by using the update strategy.
[0152] Step S510, the updated component attribute information contained in the component node in the component structure tree is traversed, and a component table recording the updated component attribute information is generated according to the traversal result.
[0153] Specifically, an initial component table recording the updated component attribute information is generated according to the traversal result; columns recording the component node hierarchical information and the component node sequence information are inserted in the initial component table according to the model training strategy of the initial component classification model; and the component table recording the updated component attribute information is generated according to the insertion result.
[0154] Step S512, the embedding processing is respectively performed on the component attribute information corresponding to each row table in the component table, and the sub-component embedding vector corresponding to each row table is obtained.
[0155] Step S514, the sub-component embedding vectors corresponding to each row table are merged to obtain a component embedding vector.
[0156] Specifically, the determination of the sub-component embedding vector corresponding to any target row table in the component table includes: determining the target component attribute information corresponding to the target row table in the component table, and reading the sequence identification information, the hierarchical identification information, the text information and the feature information in the target component attribute information; the sequence identification vector, the hierarchical identification vector, the text vector and the feature vector are obtained by respectively performing embedding processing on the sequence identification information, the hierarchical identification information, the text information and the feature information; and the sub-component embedding vector corresponding to the target row table is obtained by splicing the sequence identification vector, the hierarchical identification vector, the text vector and the feature vector.
[0157] Step S516, the component embedding vector is input into the initial component classification model, the encoder in the initial component classification model is used to perform encoding processing on the component embedding vector to obtain a component encoding vector.
[0158] Specifically, the encoder in the initial component classification model is used to calculate the embedding encoding vector and the weight matrix to obtain a query vector, a key vector and a value vector; similarity score calculation is performed according to the query vector, the key vector and the value vector, and the component encoding vector containing the hierarchical dependency relationship and the node dependency relationship is determined according to the calculation result.
[0159] Step S518, a hidden state vector is determined based on the component encoding vector, and the hidden state vector is taken as a component classification vector.
[0160] Step S520, the decoder in the initial component classification model is used to perform decoding processing on the component classification vector to obtain the predicted component classification information corresponding to the component node in the component structure tree.
[0161] Step S522, the reference component classification information corresponding to the component node in the component structure tree is obtained.
[0162] In step S524, the benchmark component classification information and the predicted component classification information are calculated according to the cross-entropy loss function to obtain a target loss value.
[0163] In step S526, the initial component classification model is adjusted using the target loss value until a component classification model that meets the training stop condition is obtained.
[0164] In step S528, a target component structure tree corresponding to the target object is obtained.
[0165] In step S530, the target component structure tree is input into the component classification model for processing to obtain component type information corresponding to each target component node in the target component structure tree.
[0166] In step S532, the target components contained in the target object are classified according to the component type information, and a component processing task is performed according to the classification result.
[0167] The component classification model training method provided in the specification can improve the component classification efficiency. An initial component classification model capable of identifying and classifying components can be constructed. Then, a component structure tree can be obtained, and the component nodes in the component structure tree contain component attribute information. At this time, the component structure tree can be reconstructed to obtain a component table recording the component attribute information. At this time, the component attribute information recorded in the component table is embedded to obtain a component embedding vector corresponding to the component structure tree. Further, the component embedding vector is input into the initial component classification model for processing to obtain predicted component classification information corresponding to the component nodes in the component structure tree. The initial component classification model is adjusted based on the benchmark component classification information and the predicted component classification information corresponding to the component nodes in the component structure tree. Once training is completed, the component classification model that meets the training stop condition can be obtained. The components are classified by modeling, which can effectively improve the component identification and classification efficiency, thereby facilitating the use of downstream businesses.
[0168] Corresponding to the above method embodiment, the specification also provides a component classification model training device embodiment, Figure 6 A structural schematic diagram of a component classification model training device according to an embodiment of the specification is shown. As shown in the figure, Figure 6 The device comprises:
[0169] The acquisition module 602 is configured to obtain a component structure tree, wherein the component nodes in the component structure tree contain component attribute information.
[0170] The reconstruction module 604 is configured to reconstruct the component structure tree, obtain a component table recording component attribute information, and embed the component attribute information recorded in the component table to obtain a component embedding vector.
[0171] The processing module 606 is configured to input the component embedding vector into an initial component classification model for processing to obtain predicted component classification information corresponding to a component node in the component structure tree.
[0172] The parameter adjustment module 608 is configured to adjust the initial component classification model based on the reference component classification information corresponding to the component node in the component structure tree and the predicted component classification information until a component classification model satisfying a training stop condition is obtained.
[0173] In an optional embodiment, the acquisition module 602 is further configured to:
[0174] acquire an initial component structure tree corresponding to the sample object, perform structure detection on the initial component structure tree according to a training strategy of the initial component classification model, in a case where a structure detection result satisfies a preset structure detection condition, take the initial component structure tree as the component structure tree, and in a case where the structure detection result does not satisfy the preset structure detection condition, split the initial component structure tree and determine the component structure tree according to a splitting result.
[0175] In an optional embodiment, the reconstruction module 604 is further configured to:
[0176] determine a node attribute type corresponding to each component node in the component structure tree according to component attribute information contained in the component node, select an update strategy for each component node in the component structure tree according to the node attribute type, and update the component attribute information contained in each component node by using the update strategy, and traverse the updated component attribute information contained in each component node in the component structure tree, and generate a component table recording the updated component attribute information according to a traversal result.
[0177] In an optional embodiment, the reconstruction module 604 is further configured to:
[0178] generate an initial component table recording the updated component attribute information according to the traversal result, insert columns recording component node hierarchical information and component node sequence information into the initial component table according to a model training strategy of the initial component classification model, and generate a component table recording the updated component attribute information according to an insertion result.
[0179] In an optional embodiment, the reconstruction module 604 is further configured to:
[0180] The component attribute information corresponding to each row of the component table is embedded respectively to obtain a sub-component embedding vector corresponding to each row of the component table; and the sub-component embedding vectors corresponding to each row of the component table are merged to obtain the component embedding vector.
[0181] In an optional embodiment, the determination of the sub-component embedding vector corresponding to the target row of the component table comprises:
[0182] The target component attribute information corresponding to the target row of the component table is determined in the component table, and the sequence identification information, the hierarchical identification information, the text information and the feature information are read in the target component attribute information; the sequence identification vector, the hierarchical identification vector, the text vector and the feature vector are obtained by embedding the sequence identification information, the hierarchical identification information, the text information and the feature information respectively; and the sub-component embedding vector corresponding to the target row of the component table is obtained by splicing the sequence identification vector, the hierarchical identification vector, the text vector and the feature vector.
[0183] In an optional embodiment, the processing module 606 is further configured to:
[0184] The component embedding vector is input into the initial component classification model, the component embedding vector is encoded by the encoder in the initial component classification model to obtain a component encoding vector; the hidden state vector is determined based on the component encoding vector, and the hidden state vector is taken as a component classification vector; and the component classification vector is decoded by the decoder in the initial component classification model to obtain the predicted component classification information corresponding to the component node in the component structure tree.
[0185] In an optional embodiment, the processing module 606 is further configured to:
[0186] The encoder in the initial component classification model is used to calculate the embedding encoding vector and the weight matrix to obtain a query vector, a key vector and a value vector; similarity score calculation is performed according to the query vector, the key vector and the value vector, and the component encoding vector containing hierarchical dependency and node dependency is determined according to the calculation result.
[0187] In an optional embodiment, the parameter adjustment module 608 is further configured to:
[0188] obtaining reference component classification information corresponding to a component node in the component structure tree; calculating the reference component classification information and the predicted component classification information according to a cross-entropy loss function to obtain a target loss value; and adjusting the initial component classification model using the target loss value until a component classification model that meets a training stop condition is obtained.
[0189] The component classification model training apparatus provided by the present specification can improve the component classification efficiency. An initial component classification model capable of identifying and classifying components can be constructed. Then, a component structure tree can be obtained, and the component nodes in the component structure tree contain component attribute information. The component structure tree can be reconstructed to obtain a component table recording the component attribute information. The component attribute information recorded in the component table is embedded to obtain a component embedding vector corresponding to the component structure tree. The component embedding vector is input into the initial component classification model for processing to obtain predicted component classification information corresponding to the component nodes in the component structure tree. The initial component classification model is adjusted based on the reference component classification information and the predicted component classification information corresponding to the component nodes in the component structure tree. One training is completed. The component classification model that meets the training stop condition can be obtained through the above process. The components are classified through modeling, which can effectively improve the component identification and classification efficiency and facilitate the use of downstream businesses.
[0190] The above is a schematic solution of the component classification model training apparatus of the present embodiment. It should be noted that the technical solution of the component classification model training apparatus belongs to the same concept as the technical solution of the component classification model training method described above. The details of the technical solution of the component classification model training apparatus that are not described in detail can be referred to the description of the technical solution of the component classification model training method.
[0191] Corresponding to the method embodiments described above, the present specification also provides component classification apparatus embodiments, Figure 7 A structural schematic diagram of a component classification apparatus provided by an embodiment of the present specification is shown. As shown in the figure, Figure 7 The apparatus includes:
[0192] The component structure tree obtaining module 702 is configured to obtain a target component structure tree corresponding to a target object.
[0193] The input model module 704 is configured to input the target component structure tree into the component classification model in the above method for processing to obtain component type information corresponding to each target component node in the target component structure tree.
[0194] The classification component module 706 is configured to classify the target components contained in the target object according to the component type information, and perform a component processing task according to the classification result.
[0195] The above is a schematic scheme of the component classification device according to the embodiment. It should be noted that the technical scheme of the component classification device belongs to the same concept as the technical scheme of the component classification method described above, and the details of the technical scheme of the component classification device that are not described in detail can be referred to the description of the technical scheme of the component classification method.
[0196] Figure 8 A structural block diagram of a computing device 800 according to an embodiment of the present specification is shown. The components of the computing device 800 include, but are not limited to, a memory 810 and a processor 820. The processor 820 is connected to the memory 810 through a bus 830, and a database 850 is used to save data.
[0197] The computing device 800 also includes an access device 840, which enables the computing device 800 to communicate via one or more networks 860. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 840 can include one or more of any type of network interface (e.g., a network interface card (NIC)), wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave 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, etc.
[0198] In an embodiment of the present application, the above-mentioned components of the computing device 800 and other components not shown in the Figure 8 may be connected to each other, for example, through a bus. It should be understood that Figure 8The illustrated computing device architecture diagram is for the purpose of example only and is not intended to limit the scope of the present application. Other components can be added or substituted as desired by those skilled in the art.
[0199] The computing device 800 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 800 can also be a mobile or stationary server.
[0200] The processor 820 is configured to implement methods, steps, or procedures of the component classification model training method or the component classification method when the processor 820 executes the computer executable instructions.
[0201] The above describes a schematic scheme of a computing device according to an embodiment of the present application. It should be noted that the technical scheme of the computing device and the technical scheme of the component classification model training method or the component classification method 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 classification model training method or the component classification method.
[0202] An embodiment of the present specification also provides a computer readable storage medium storing computer instructions, which are executed by a processor to implement the steps of the component classification model training method or the component classification method.
[0203] The above describes a schematic scheme of a computer readable storage medium according to an embodiment of the present application. It should be noted that the technical scheme of the storage medium and the technical scheme of the component classification model training method or the component classification method belong to the same concept, and the details of the technical scheme of the storage medium that are not described in detail can be referred to the description of the technical scheme of the component classification model training method or the component classification method.
[0204] 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 a different order and still achieve desirable results. Additionally, 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.
[0205] 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, software distribution medium, etc. It should be noted that the computer readable medium can include appropriate additions or subtractions according to the requirements of patent practice. For example, according to the patent practice in some regions, the computer readable medium does not include electrical carrier signals and telecommunication signals.
[0206] It should be noted that, for the foregoing method embodiments, in order to facilitate description, they are all described 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 described actions, because according to the present specification, certain steps can be performed in other orders or at the same time. Secondly, those skilled in the art should know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily all necessary for the present specification.
[0207] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0208] The preferred embodiments of the present specification disclosed above are only used to help explain the present specification. The alternative embodiments do not describe all the details and do not limit the present invention to the specific embodiments described. Obviously, according to the content of the present specification, many modifications and changes can be made. 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 use the present specification. The present specification is limited only by the claims and their entire scope and equivalents.
Claims
1. A method for training a component classification model, characterized in that, The method comprises the following steps: obtaining a component structure tree, wherein the component nodes in the component structure tree contain component attribute information; reconstructing the component structure tree to obtain a component table recording the component attribute information, and performing embedding processing on the component attribute information recorded in the component table to obtain a component embedding vector; inputting the component embedding vector into an initial component classification model for processing to obtain predicted component classification information corresponding to the component nodes in the component structure tree; based on the reference component classification information corresponding to the component nodes in the component structure tree and the predicted component classification information, adjusting the initial component classification model until a component classification model satisfying a training stop condition is obtained.
2. The method of claim 1, wherein, The method comprises the following steps: obtaining an initial component structure tree corresponding to a sample object; performing structure detection on the initial component structure tree according to the training strategy of the initial component classification model; in the case that the structure detection result meets a preset structure detection condition, taking the initial component structure tree as the component structure tree; in the case that the structure detection result does not meet the preset structure detection condition, splitting the initial component structure tree and determining the component structure tree according to the splitting result.
3. The method of claim 1, wherein, The method comprises the following steps: determining the node attribute type corresponding to each component node in the component structure tree according to the component attribute information contained in the component nodes in the component structure tree; selecting an update strategy for each component node in the component structure tree according to the node attribute type, and updating the component attribute information contained in each component node by using the update strategy; traversing the updated component attribute information contained in the component nodes in the component structure tree, and generating a component table recording the updated component attribute information according to the traversal result.
4. The method of claim 3, wherein, The method comprises the following steps: generating an initial component table recording the updated component attribute information according to the traversal result; inserting columns recording component node hierarchical information and component node sequence information into the initial component table according to the model training strategy of the initial component classification model; generating a component table recording the updated component attribute information according to the insertion result.
5. The method of claim 1, wherein, The method comprises the following steps: performing embedding processing on the component attribute information corresponding to each row table in the component table respectively to obtain a sub-component embedding vector corresponding to each row table respectively; merging the sub-component embedding vectors corresponding to each row table to obtain the component embedding vector.
6. The method of claim 5, wherein, The method comprises the following steps: determining the target component attribute information corresponding to the target row table in the component table, and reading sequence identification information, hierarchical identification information, text information and feature information in the target component attribute information; The sequence identification information, the hierarchical identification information, the text information and the feature information are respectively subjected to embedding processing to obtain a sequence identification vector, a hierarchical identification vector, a text vector and a feature vector; The sequence identification vector, the hierarchical identification vector, the text vector and the feature vector are spliced to obtain a sub-component embedding vector corresponding to the target row table.
7. The method of claim 1, wherein, The component embedding vector is input into the initial component classification model for processing to obtain predicted component classification information corresponding to a component node in the component structure tree, including: The component embedding vector is input into the initial component classification model, and the component embedding vector is encoded by an encoder in the initial component classification model to obtain a component encoding vector; A hidden state vector is determined based on the component encoding vector, and the hidden state vector is taken as a component classification vector; The component classification vector is decoded by a decoder in the initial component classification model to obtain predicted component classification information corresponding to a component node in the component structure tree.
8. The method of claim 7, wherein, The component embedding vector is encoded by an encoder in the initial component classification model to obtain a component encoding vector, including: The embedding encoding vector and a weight matrix are calculated by the encoder in the initial component classification model to obtain a query vector, a key vector and a value vector; Similarity score calculation is performed according to the query vector, the key vector and the value vector, and a component encoding vector containing hierarchical dependency and node dependency is determined according to the calculation result.
9. The method according to any one of claims 1 to 8, characterized in that, The initial component classification model is parameterized based on the reference component classification information and the predicted component classification information corresponding to the component node in the component structure tree until a component classification model satisfying a training stop condition is obtained, including: Reference component classification information corresponding to a component node in the component structure tree is obtained; The reference component classification information and the predicted component classification information are calculated according to a cross-entropy loss function to obtain a target loss value; The initial component classification model is parameterized using the target loss value until a component classification model satisfying a training stop condition is obtained.
10. An assembly classification method characterized by, It includes: A target component structure tree corresponding to a target object is obtained; The target component structure tree is input into the component classification model in the method of any one of claims 1-9 for processing to obtain component type information corresponding to each target component node in the target component structure tree; The target components contained in the target object are classified according to the component type information, and a component processing task is performed according to the classification result. 11.A component classification model training apparatus, characterized by comprising: It includes: An acquisition module is configured to acquire a component structure tree, wherein a component node in the component structure tree contains component attribute information; A reconstruction module is configured to reconstruct the component structure tree to obtain a component table recording component attribute information, and to perform embedding processing on the component attribute information recorded in the component table to obtain a component embedding vector; The processing module is configured to embed the component into a vector input into an initial component classification model for processing to obtain predicted component classification information corresponding to a component node in the component structure tree. The parameter adjustment module is configured to adjust the initial component classification model based on the benchmark component classification information and the predicted component classification information corresponding to the component node in the component structure tree until a component classification model satisfying a training stop condition is obtained.
12. An assembly classification device characterized by, The method comprises: The acquisition structure tree module is configured to acquire a target component structure tree corresponding to a target object; The input model module is configured to input the target component structure tree into a component classification model in the method of any one of claims 1-9 for processing to obtain component type information corresponding to each target component node in the target component structure tree; The classified component module is configured to classify target components contained in the target object according to the component type information and execute a component processing task according to a classification result.
13. A computing device, comprising: The computer readable storage medium comprises a memory and a processor; the memory is used to store computer executable instructions; and the processor is used to execute the computer executable instructions to implement the steps of the method of any one of claims 1-10.
14. A computer-readable storage medium storing computer instructions, wherein, The instructions are executed by the processor to implement the steps of the method of any one of claims 1-10.
Citation Information
Patent Citations
Intention recognition model training method and device
CN115827831A
Navigation through the hierarchical structure of a three-dimensional modeled assembly of parts
EP2985708A1