Fabric relationship evaluation method and storage medium based on hybrid expert attention mechanism
By constructing a fabric evaluation database and utilizing a hybrid expert attention mechanism model, the accuracy problem of fabric evaluation relationship extraction was solved, the accurate extraction and understanding of fabric relationships were achieved, and the model's diversified relationship perception capability was improved.
Patent Information
- Application Number
- CN202411799347.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2044-12-09
AI Technical Summary
Existing technologies are unable to accurately extract relationships related to fabric evaluation. Fabric description vocabulary is extensive and the feature descriptions in different texts vary greatly. Existing methods ignore the mutual influence of relationships on learning parameters.
A method based on hybrid expert attention mechanism is adopted to construct a fabric evaluation database. The BERT pre-training model is used to locate and tag text encoding. The hybrid expert attention mechanism model is combined with the hybrid expert attention mechanism model to extract multi-dimensional feature tensors. The focus loss function of weighted cross entropy is used to enhance the model to achieve accurate extraction of fabric relationship triplets.
The model's ability to understand diverse relationships has been improved, and the extraction of fabric evaluation-related relationships has been accurately achieved, thereby enhancing the data support capabilities for fabric recommendations and quality inspections.
Smart Images

Figure CN119621997B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of the textile industry, and in particular to a fabric evaluation relationship extraction method based on a hybrid expert attention mechanism, a computer storage medium, and an electronic device. Background Art
[0002] With the continuous development of the textile industry, fabric quality evaluation and selection play a vital role in areas such as clothing and home furnishings. Because fabric images contain semantic information that is almost impossible to extract through image processing, text labels are a crucial data dimension. In the fabric evaluation field, relationship extraction can be used to mine associations between fabric properties, performance, and user reviews from massive amounts of text data, providing data support for downstream fabric recommendations and quality inspections. However, due to the complex semantics of fabric evaluation and the diverse data sources, fabric evaluation relationship extraction technology faces significant challenges. For example, there are numerous descriptive terms and performance indicators for fabrics, and descriptions of the same fabric properties vary across different texts. Current extraction methods use the same network layer for different relationships, ignoring the mutual influence of various relationships on learning parameters. For each relationship, different expert networks can more effectively extract relationship features. However, relationship extraction methods for fabric evaluation are relatively rare. Furthermore, existing technologies are still not accurate enough in automatically extracting evaluation characteristics such as fabric quality, comfort, and wear resistance.
[0003] Therefore, how to accurately extract the relationship related to fabric evaluation has become a technical problem that needs to be solved urgently by those skilled in the art. Summary of the Invention
[0004] The present invention provides a fabric evaluation relationship extraction method based on a hybrid expert attention mechanism, a computer storage medium, and an electronic device, which solves the problem in related technologies that it is impossible to accurately extract relationships related to fabric evaluation.
[0005] As a first aspect of the present invention, a fabric evaluation relationship extraction method based on a hybrid expert attention mechanism is provided, which includes:
[0006] At least build a fabric evaluation database based on textile enterprise evaluation data information;
[0007] Extracting evaluation text information from the fabric evaluation database and performing positioning mark processing on the evaluation text information to obtain positioning mark text, wherein the evaluation text information includes at least a subject entity, a relationship, and an object entity, and the positioning mark text includes a one-dimensional mark group generated by positioning the subject entity and a two-dimensional mark group generated by jointly positioning the relationship-object entity;
[0008] Uniquely encode the positioning mark text according to the BERT pre-training model, and jointly train the unique code and its corresponding mask to obtain a multi-dimensional feature tensor corresponding to the evaluation text information;
[0009] Identifying a multidimensional feature tensor corresponding to the evaluation text information according to a hybrid expert attention mechanism model to obtain subject features and potential relationship guide words, wherein the hybrid expert attention mechanism model is obtained by fusing a hybrid expert model with a self-attention mechanism;
[0010] Inputting the subject features and potential relationship guide words into a hybrid expert attention mechanism model for hybrid expert joint learning to obtain a multi-dimensional tensor group;
[0011] Performing weighted fusion on the multidimensional feature tensor corresponding to the evaluation text information and the multidimensional tensor group to obtain an evaluation text information tensor with subject features and potential guiding relationships;
[0012] According to the hybrid expert attention mechanism model, the subject correspondence relationship and object entity are extracted from the evaluation text information tensor with subject features and potential guiding relationships, and the hybrid expert attention model is enhanced by the focus loss function of weighted cross entropy to obtain a set of fabric relationship triples.
[0013] Furthermore, the positioning mark text is uniquely encoded according to the BERT pre-trained model, including:
[0014] Convert the positioning mark text into a one-dimensional code according to a preset unique vocabulary to obtain a one-dimensional code group;
[0015] The one-dimensional code group and the mask corresponding to the one-dimensional code group are input into the BERT model for joint training to obtain a multidimensional feature tensor corresponding to the evaluation text information.
[0016] Furthermore, the expression for obtaining the multidimensional feature tensor corresponding to the evaluation text information is:
[0017] ,
[0018] Among them, X represents the one-dimensional vector encoding representation of the positioning mark text, M represents the mask corresponding to X, and H represents the multidimensional feature tensor corresponding to the evaluation text information.
[0019] Furthermore, the multidimensional feature tensor corresponding to the evaluation text information is identified according to the hybrid expert attention mechanism model to obtain subject features and potential relationship guide words, including:
[0020] The multidimensional feature tensor corresponding to the evaluation text information is input into the first starting linear perceptron and the first ending linear perceptron respectively to obtain two subject feature codes, which are expressed as follows:
[0021] ,
[0022] ,
[0023] Wherein, H represents the multidimensional feature tensor corresponding to the evaluation text information, represents the subject feature encoding of the first starting linear perceptron, represents the weight matrix of the first starting linear perceptron, represents the bias vector of the first starting linear perceptron, represents the subject feature encoding of the first end linear perceptron, represents the weight matrix of the first-end linear perceptron, Represents the bias vector of the first end linear perceptron;
[0024] The multidimensional feature vector corresponding to the evaluation text information is self-attentionally fused with the subject feature code, and the expression is:
[0025] ,
[0026] ,
[0027] ,
[0028] in, Indicates the result of encoding the first self-attention fusion, e indicates the degree of fusion relationship, represents the attention weight, W a represents the fusion weight matrix, i represents the i-th text, and n represents the total number of characters;
[0029] The self-attention fusion results are input into the second starting linear perceptron and the second ending linear perceptron respectively to obtain the potential relationship guide word encoding, which is expressed as:
[0030] ,
[0031] ,
[0032] in, represents the potential relation guide word encoding of the second starting linear perceptron, represents the weight matrix of the second starting linear perceptron, represents the bias vector of the second starting linear perceptron, represents the potential relation-guided word encoding of the second-end linear perceptron, represents the weight matrix of the second-end linear perceptron, Represents the bias vector of the second-end linear perceptron.
[0033] Furthermore, the subject features and potential relationship guide words are input into the hybrid expert attention mechanism model for hybrid expert joint learning to obtain a multidimensional tensor group, including:
[0034] The subject features and potential relationship guide words are combined with each expert network to obtain feature representation, which is expressed as follows:
[0035] ,
[0036] in, represents the feature representation result of the i-th expert layer, i represents the i-th expert layer, represents the expert network weight matrix, represents the expert network bias vector;
[0037] Get the weight coefficient of each layer of experts, the expression is:
[0038] ,
[0039] Among them, W g represents the expert weight matrix of each layer, b g Represents the expert bias vector of each layer;
[0040] The feature representation results of each expert layer are combined with the corresponding expert weight coefficient to obtain the hybrid expert learning feature representation, which is expressed as:
[0041] ,
[0042] in, represents the result of hybrid expert learning feature representation, and m represents the number of experts.
[0043] Furthermore, the multidimensional feature tensor corresponding to the evaluation text information and the multidimensional tensor group are weightedly fused to obtain the evaluation text information tensor with subject features and potential guiding relationships, including:
[0044] The hybrid expert learning feature representation results are fused with the multidimensional feature tensor corresponding to the evaluation text information, and the fusion results are input into the hybrid expert attention mechanism model to obtain the representation relationship of the fabric entity relationship pairs, where the hybrid expert learning feature representation results include the subject entity feature representation results and the potential relationship feature representation results.
[0045] Furthermore, the hybrid expert learning feature representation result is fused with the multi-dimensional feature tensor corresponding to the evaluation text information, including:
[0046] The hybrid expert learning feature representation result and the feature encoding of the evaluation text information are weightedly fused, and the expression is:
[0047] ,
[0048] in, represents the second mixed expert fusion result, Indicates subject entity features, The weight matrix representing the subject entity features, Represents the potential relationship characteristics, The weight matrix representing the potential relationship features, Represents the multidimensional feature tensor corresponding to the evaluation text information, The weight matrix representing the multidimensional feature tensor corresponding to the evaluation text information;
[0049] The fusion results are input into the hybrid expert attention mechanism model to obtain the representation relationship of the fabric entity relationship pair, including:
[0050] The fusion results are input into the third starting linear perceptron and the third ending linear perceptron respectively to obtain relation-object entity pairs, expressed as:
[0051] ,
[0052] ,
[0053] in, Represents the relation-object entity pair of the third starting linear perceptron, represents the weight matrix of the third starting linear perceptron, represents the bias vector of the third starting linear perceptron, Represents the relation-object entity pair of the third-ended linear perceptron, represents the weight matrix of the third-end linear perceptron, represents the bias vector of the third-end linear perceptron, Represents the sigmoid activation function.
[0054] Furthermore, the expression of the focal loss function of the weighted cross entropy is:
[0055] ,
[0056] ,
[0057] ,
[0058] ,
[0059] ,
[0060] Among them, P represents the predicted value, M represents the mask, and L represents the true value. Indicates the balance factor for adjusting the influence rate of positive and negative samples, express The influence coefficient of represents the focus weight, represents the binary cross entropy, represents the focal loss, represents the sum of focal losses.
[0061] As another aspect of the present invention, a computer storage medium is provided, which is used to store a computer program, and the computer program is executed by a processor to implement the fabric evaluation relationship extraction method based on the hybrid expert attention mechanism as described above.
[0062] As another aspect of the present invention, an electronic device is provided, comprising a memory and a processor, wherein the processor is communicatively connected to the memory, the memory is used to store a computer program, and the processor is used to load and execute the computer program to implement the fabric evaluation relationship extraction method based on the hybrid expert attention mechanism described above.
[0063] The present invention provides a fabric evaluation relationship extraction method based on a hybrid expert attention mechanism. The method constructs a textile fabric evaluation database, extracts evaluation text information from the database, and then performs location tagging. The location-tagged text is encoded based on a BERT pre-trained model. Subject features and potential relationship guide words are extracted from the encoded multidimensional feature tensor using a hybrid expert attention mechanism model. The features are jointly learned using hybrid experts, and the learning results and text encoding are weightedly fused. The model is enhanced using a focus function based on weighted cross-entropy, and the hybrid expert attention mechanism model is used to obtain the final relationship triple. The fabric evaluation relationship extraction method based on the hybrid expert attention mechanism proposes a hybrid expert network based on data features of different relationship categories, which weakens the mutual influence between relationships and improves the model's understanding of diverse relationships. End-to-end learning is performed to address the complexity of textile fabric text data, improving the model's perception of such relationships, thereby accurately extracting relationships related to fabric evaluation. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present invention, but do not constitute a limitation of the present invention.
[0065] Figure 1 This is a flowchart of the fabric evaluation relationship extraction method based on the hybrid expert attention mechanism provided by the present invention.
[0066] Figure 2 Schematic diagram of the architecture of the hybrid expert attention mechanism model provided by the present invention.
[0067] Figure 3 This is a flowchart of encoding based on the BERT pre-training model provided by the present invention.
[0068] Figure 4 This is a structural block diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0069] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments of the present invention may be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0070] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0071] It should be noted that the terms "first," "second," and the like in the specification and claims of the present invention and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate for the embodiments of the present invention described herein. In addition, the terms "including," "having," and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or apparatuses.
[0072] In this embodiment, a fabric evaluation relationship extraction method based on a hybrid expert attention mechanism is provided. Figure 1 is a flowchart of a fabric evaluation relationship extraction method based on a hybrid expert attention mechanism according to an embodiment of the present invention. Figure 1 Shown, including:
[0073] S100, constructing a fabric evaluation database based on at least textile enterprise evaluation data information;
[0074] In the embodiment of the present invention, a fabric evaluation database may be constructed based on textile enterprise evaluation data information, data science standards (eg, GB / T 24734.3-2009), and textile network evaluation data information.
[0075] S200, extracting evaluation text information from the fabric evaluation database, and performing positioning marking processing on the evaluation text information to obtain positioning marked text, wherein the evaluation text information includes at least a subject entity, a relationship, and an object entity, and the positioning marked text includes a one-dimensional mark group generated by positioning the subject entity, and a two-dimensional mark group generated by jointly positioning the relationship-object entity;
[0076] In this embodiment of the present invention, the evaluation text information in the fabric evaluation database is processed by positioning and labeling, mainly including triple binary labels of subject entities, relations, and object entities. A positioning method can be used for model learning. The subject entity is positioned to generate a one-dimensional label group, and the relation and object entities are jointly positioned to generate a two-dimensional label group.
[0077] S300: Uniquely encode the positioning mark text according to a BERT (Bidirectional Encoder Representations from Transformers, a deep learning model based on Transformers) pre-trained model, and jointly train the unique code and its corresponding mask to obtain a multi-dimensional feature tensor corresponding to the evaluation text information;
[0078] In an embodiment of the present invention, the BERT pre-trained model can be used to uniquely encode the positioning markup text. By jointly training the mask and the encoding, the text semantic information is represented as a set of 768-dimensional feature tensors.
[0079] S400, identifying a multidimensional feature tensor corresponding to the evaluation text information according to a hybrid expert attention mechanism model, and obtaining subject features and potential relationship guide words, wherein the hybrid expert attention mechanism model is obtained by fusing a hybrid expert model with a self-attention mechanism;
[0080] In an embodiment of the present invention, the multidimensional feature tensor obtained in step S300 may be specifically identified through a hybrid expert attention mechanism model to obtain subject features and potential relationship guide words.
[0081] It should be noted that the architecture of the hybrid expert attention mechanism model of the embodiment of the present invention is as follows Figure 2 As shown, it can specifically include text description, BERT pre-training model, part-of-speech awareness module, hybrid expert fusion module and relation-object extraction module.
[0082] S500, inputting the subject features and potential relationship guide words into a hybrid expert attention mechanism model to perform hybrid expert joint learning to obtain a multidimensional tensor group;
[0083] In an embodiment of the present invention, the result of step S400 is used as the input of the hybrid expert attention mechanism model to perform hybrid expert joint learning, and the dynamic weights of each layer of the expert network are calculated through gated fusion, and a 768-dimensional tensor group is obtained after linear calculation.
[0084] S600: performing weighted fusion on the multidimensional feature tensor corresponding to the evaluation text information and the multidimensional tensor group to obtain an evaluation text information tensor with subject features and potential guiding relationships;
[0085] In the embodiment of the present invention, the result of step S300 and the result of step S500 are weightedly fused to obtain a final text information tensor with subject features and potential relationship guidance.
[0086] S700. Extract the subject correspondence relationship and object entity from the evaluation text information tensor with subject features and potential guiding relationships according to the hybrid expert attention mechanism model, and enhance the hybrid expert attention model through the focus loss function of weighted cross entropy to obtain a set of fabric relationship triples.
[0087] In an embodiment of the present invention, the result of step S600 is used to obtain the subject correspondence relationship-object entity extraction through a hybrid expert attention mechanism model, and the focus loss function based on weighted cross entropy is used to enhance the model to generate the final relationship triple set.
[0088] The present invention provides a fabric evaluation relationship extraction method based on a hybrid expert attention mechanism. This method constructs a textile fabric evaluation database, extracts evaluation text from the database, and then performs location tagging. The tagged text is then encoded using a BERT pre-trained model. Subject features and potential relationship guides are extracted from the encoded multidimensional feature tensor using a hybrid expert attention mechanism model. The features are then jointly learned using hybrid experts, and the learning results and text encodings are weighted and fused. The model is enhanced using a focus function based on weighted cross-entropy, and the hybrid expert attention mechanism model is used to obtain the final relationship triples. This fabric evaluation relationship extraction method based on the hybrid expert attention mechanism proposes a hybrid expert network based on data features of different relationship categories, which weakens the mutual influence between relationships and improves the model's understanding of diverse relationships. End-to-end learning is performed to address the complexity of textile fabric text data, improving the model's ability to perceive such relationships, thereby accurately extracting relationships related to fabric evaluation.
[0089] In an embodiment of the present invention, the positioning mark text is uniquely encoded according to the BERT pre-training model, such as Figure 3 Shown, including:
[0090] S310, performing one-dimensional encoding conversion on the positioning mark text according to a preset unique vocabulary to obtain a one-dimensional code group;
[0091] S320. Input the one-dimensional code group and the mask corresponding to the one-dimensional code group into the BERT model for joint training to obtain a multidimensional feature tensor corresponding to the evaluation text information.
[0092] Specifically, the expression for obtaining the multidimensional feature tensor corresponding to the evaluation text information is:
[0093] ,
[0094] Among them, X represents the one-dimensional vector encoding representation of the positioning mark text, M represents the mask corresponding to X, and H represents the multidimensional feature tensor corresponding to the evaluation text information.
[0095] In an embodiment of the present invention, the multidimensional feature tensor corresponding to the evaluation text information is identified according to the hybrid expert attention mechanism model to obtain subject features and potential relationship guide words, including:
[0096] The multidimensional feature tensor corresponding to the evaluation text information is input into the first starting linear perceptron and the first ending linear perceptron respectively to obtain two subject feature codes, which are expressed as follows:
[0097] ,
[0098] ,
[0099] Wherein, H represents the multidimensional feature tensor corresponding to the evaluation text information, represents the subject feature encoding of the first starting linear perceptron, represents the weight matrix of the first starting linear perceptron, represents the bias vector of the first starting linear perceptron, represents the subject feature encoding of the first end linear perceptron, represents the weight matrix of the first-end linear perceptron, Represents the bias vector of the first end linear perceptron;
[0100] The multidimensional feature vector corresponding to the evaluation text information is self-attentionally fused with the subject feature code, and the expression is:
[0101] ,
[0102] ,
[0103] ,
[0104] in, Indicates the result of encoding the first self-attention fusion, e indicates the degree of fusion relationship, represents the attention weight, W a represents the fusion weight matrix, i represents the i-th text, and n represents the total number of characters;
[0105] The self-attention fusion results are input into the second starting linear perceptron and the second ending linear perceptron respectively to obtain the potential relationship guide word encoding, which is expressed as:
[0106] ,
[0107] ,
[0108] in, represents the potential relation guide word encoding of the second starting linear perceptron, represents the weight matrix of the second starting linear perceptron, represents the bias vector of the second starting linear perceptron, represents the potential relation-guided word encoding of the second-end linear perceptron, represents the weight matrix of the second-end linear perceptron, Represents the bias vector of the second-end linear perceptron.
[0109] In an embodiment of the present invention, the subject features and potential relationship guide words are input into a hybrid expert attention mechanism model for hybrid expert joint learning to obtain a multidimensional tensor group, including:
[0110] The subject features and potential relationship guide words are combined with each expert network to obtain feature representation, which is expressed as follows:
[0111] ,
[0112] in, represents the feature representation result of the i-th expert layer, i represents the i-th expert layer, represents the expert network weight matrix, represents the expert network bias vector;
[0113] Get the weight coefficient of each layer of experts, the expression is:
[0114] ,
[0115] Among them, Wg represents the expert weight matrix of each layer, b g Represents the expert bias vector of each layer;
[0116] The feature representation results of each expert layer are combined with the corresponding expert weight coefficient to obtain the hybrid expert learning feature representation, which is expressed as:
[0117] ,
[0118] in, represents the result of hybrid expert learning feature representation, and m represents the number of experts.
[0119] In an embodiment of the present invention, the multidimensional feature tensor corresponding to the evaluation text information and the multidimensional tensor group are weightedly fused to obtain the evaluation text information tensor with subject features and potential guiding relationships, including:
[0120] The hybrid expert learning feature representation results are fused with the multidimensional feature tensor corresponding to the evaluation text information, and the fusion results are input into the hybrid expert attention mechanism model to obtain the representation relationship of the fabric entity relationship pairs, where the hybrid expert learning feature representation results include the subject entity feature representation results and the potential relationship feature representation results.
[0121] More specifically, the hybrid expert learning feature representation result is fused with the multi-dimensional feature tensor corresponding to the evaluation text information, including:
[0122] The hybrid expert learning feature representation result and the feature encoding of the evaluation text information are weightedly fused, and the expression is:
[0123] ,
[0124] in, represents the second mixed expert fusion result, Indicates subject entity features, The weight matrix representing the subject entity features, Represents the potential relationship characteristics, The weight matrix representing the potential relationship features, Represents the multidimensional feature tensor corresponding to the evaluation text information, The weight matrix representing the multidimensional feature tensor corresponding to the evaluation text information;
[0125] The fusion results are input into the hybrid expert attention mechanism model to obtain the representation relationship of the fabric entity relationship pair, including:
[0126] The fusion results are input into the third starting linear perceptron and the third ending linear perceptron respectively to obtain relation-object entity pairs, expressed as:
[0127] ,
[0128] ,
[0129] in, Represents the relation-object entity pair of the third starting linear perceptron, represents the weight matrix of the third starting linear perceptron, represents the bias vector of the third starting linear perceptron, Represents the relation-object entity pair of the third-ended linear perceptron, represents the weight matrix of the third-end linear perceptron, represents the bias vector of the third-end linear perceptron, Represents the sigmoid activation function.
[0130] In an embodiment of the present invention, the expression of the focal loss function of the weighted cross entropy is:
[0131] ,
[0132] ,
[0133] ,
[0134] ,
[0135] ,
[0136] Among them, P represents the predicted value, M represents the mask, and L represents the true value. Indicates the balance factor for adjusting the influence rate of positive and negative samples, express The influence coefficient of represents the focus weight, represents the binary cross entropy, represents the focal loss, represents the sum of focal losses.
[0137] The fabric evaluation relation extraction method based on a hybrid expert attention mechanism, provided in this embodiment of the present invention, uses evaluation metrics including precision (Precision, Prec.), recall (Rec.), and the harmonic mean (F1) of the two. To verify the effectiveness of the corresponding model for this fabric evaluation relation extraction method based on a hybrid expert attention mechanism, experiments were conducted on common relation extraction datasets such as NYT and WebNLG. The data was also processed using a fabric evaluation dataset (TED), generated from production data collected from textile companies through expert and data science processing. The dataset information is shown in Table 1.
[0138] Table 1 Dataset information display table
[0139]
[0140] The proposed model was compared with three models, CasRel, PARE, and ERGM, on the dataset. CasRel is a joint entity relationship extraction model based on parameter sharing and cascaded pointer networks, proposed in 2020; PARE is a joint extraction model based on position-aware attention and relationship embedding, proposed in 2022; and ERGM is a matrix mapping relationship extraction model based on global entity matching, proposed in 2023. The experimental results are shown in Table 2.
[0141] Table 2 Comparison of experimental results
[0142]
[0143] From the experimental results in Table 2, it can be seen that the F1 value of the model proposed in the present invention is improved by at least 0.2% on the NYT dataset, at least 0.5% on WebNLG, and at least 2.0% on TED. This shows that the model proposed in the present invention has the versatility to cope with different data types and has a good effect on processing textile fabric evaluation datasets.
[0144] In summary, the fabric evaluation relationship extraction method based on a hybrid expert attention mechanism, provided by this invention, employs a hybrid expert network based on data features from different relationship categories to weaken the mutual influence between relationships and improve the model's understanding of diverse relationships. It also performs end-to-end learning tailored to the complexity of textile fabric text data, improving the model's ability to perceive the dimensionality of relationship features. This method achieves good results on both a test set of a general text prediction dataset and a textile fabric evaluation dataset.
[0145] As another embodiment of the present invention, a computer storage medium is provided, which is used to store a computer program, and the computer program is executed by a processor to implement the fabric evaluation relationship extraction method based on the hybrid expert attention mechanism described above.
[0146] In an embodiment of the present invention, a non-transitory computer-readable storage medium is provided, the computer-readable storage medium storing computer-executable instructions capable of executing the fabric evaluation relationship extraction method based on a hybrid expert attention mechanism in any of the above-described method embodiments. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD); the storage medium may also include a combination of the above-mentioned types of memory.
[0147] As another embodiment of the present invention, an electronic device is provided, which includes a memory and a processor, the processor being communicatively connected to the memory, the memory being used to store a computer program, and the processor being used to load and execute the computer program to implement the fabric evaluation relationship extraction method based on the hybrid expert attention mechanism described above.
[0148] like Figure 4 As shown, the electronic device 40 may include: at least one processor 41, such as a CPU (Central Processing Unit), at least one communication interface 43, a memory 44, and at least one communication bus 42. The communication bus 42 is used to achieve connection and communication between these components. The communication interface 43 may include a display screen (Display) and a keyboard (Keyboard). The optional communication interface 43 may also include a standard wired interface and a wireless interface. The memory 44 may be a high-speed RAM memory (Random Access Memory, volatile random access memory) or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 44 may optionally be at least one storage device located away from the aforementioned processor 41. The memory 44 stores application programs, and the processor 41 calls the program code stored in the memory 44 to execute any of the above-mentioned method steps.
[0149] The communication bus 42 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The communication bus 42 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0150] The memory 44 may include volatile memory, such as random-access memory (RAM); the memory may also include non-volatile memory, such as flash memory, a hard disk drive (HDD), or a solid-state drive (SSD); the memory 44 may also include a combination of the above-mentioned types of memory.
[0151] The processor 41 may be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and a NP.
[0152] The processor 41 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0153] Optionally, the memory 44 is also used to store program instructions. The processor 41 can call the program instructions to implement the present invention. Figure 1The fabric evaluation relationship extraction method based on the hybrid expert attention mechanism shown in the embodiment.
[0154] It will be understood that the above embodiments are merely exemplary embodiments for illustrating the principles of the present invention, and the present invention is not limited thereto. Those skilled in the art will appreciate that various modifications and improvements can be made without departing from the spirit and substance of the present invention, and such modifications and improvements are also considered to be within the scope of protection of the present invention.
Claims
1. A fabric evaluation relationship extraction method based on a hybrid expert attention mechanism, characterized by: include: At least build a fabric evaluation database based on textile enterprise evaluation data information; Extracting evaluation text information from the fabric evaluation database and performing positioning mark processing on the evaluation text information to obtain positioning mark text, wherein the evaluation text information includes at least a subject entity, a relationship, and an object entity, and the positioning mark text includes a one-dimensional mark group generated by positioning the subject entity and a two-dimensional mark group generated by jointly positioning the relationship-object entity; Uniquely encode the positioning mark text according to the BERT pre-training model, and jointly train the unique code and its corresponding mask to obtain a multi-dimensional feature tensor corresponding to the evaluation text information; Identifying a multidimensional feature tensor corresponding to the evaluation text information according to a hybrid expert attention mechanism model to obtain subject features and potential relationship guide words, wherein the hybrid expert attention mechanism model is obtained by fusing a hybrid expert model with a self-attention mechanism; Inputting the subject features and potential relationship guide words into a hybrid expert attention mechanism model for hybrid expert joint learning to obtain a multi-dimensional tensor group; Performing weighted fusion on the multidimensional feature tensor corresponding to the evaluation text information and the multidimensional tensor group to obtain an evaluation text information tensor with subject features and potential guiding relationships; According to the hybrid expert attention mechanism model, the subject correspondence relationship and object entity are extracted from the evaluation text information tensor with subject features and potential guiding relationships, and the hybrid expert attention model is enhanced by the focus loss function of weighted cross entropy to obtain a set of fabric relationship triples.
2. The fabric evaluation relationship extraction method based on hybrid expert attention mechanism according to claim 1 is characterized in that: Uniquely encoding the positioning mark text according to the BERT pre-trained model includes: Convert the positioning mark text into a one-dimensional code according to a preset unique vocabulary to obtain a one-dimensional code group; The one-dimensional code group and the mask corresponding to the one-dimensional code group are input into the BERT model for joint training to obtain a multidimensional feature tensor corresponding to the evaluation text information.
3. The fabric evaluation relationship extraction method based on hybrid expert attention mechanism according to claim 2 is characterized in that: The expression for obtaining the multidimensional feature tensor corresponding to the evaluation text information is: , Among them, X represents the one-dimensional vector encoding representation of the positioning mark text, M represents the mask corresponding to X, and H represents the multidimensional feature tensor corresponding to the evaluation text information.
4. The fabric evaluation relationship extraction method based on hybrid expert attention mechanism according to claim 1 is characterized in that: Identify the multidimensional feature tensor corresponding to the evaluation text information according to the hybrid expert attention mechanism model to obtain subject features and potential relationship guide words, including: The multidimensional feature tensor corresponding to the evaluation text information is input into the first starting linear perceptron and the first ending linear perceptron respectively to obtain two subject feature codes, which are expressed as follows: , , Wherein, H represents the multidimensional feature tensor corresponding to the evaluation text information, represents the subject feature encoding of the first starting linear perceptron, represents the weight matrix of the first starting linear perceptron, represents the bias vector of the first starting linear perceptron, represents the subject feature encoding of the first end linear perceptron, represents the weight matrix of the first-end linear perceptron, Represents the bias vector of the first end linear perceptron; The multidimensional feature vector corresponding to the evaluation text information is self-attentionally fused with the subject feature code, and the expression is: , , , in, Indicates the result of encoding the first self-attention fusion, e indicates the degree of fusion relationship, represents the attention weight, W a represents the fusion weight matrix, i represents the i-th text, and n represents the total number of characters; The self-attention fusion results are input into the second starting linear perceptron and the second ending linear perceptron respectively to obtain the potential relationship guide word encoding, which is expressed as: , , in, represents the potential relation guide word encoding of the second starting linear perceptron, represents the weight matrix of the second starting linear perceptron, represents the bias vector of the second starting linear perceptron, represents the potential relation-guided word encoding of the second-end linear perceptron, represents the weight matrix of the second-end linear perceptron, Represents the bias vector of the second-end linear perceptron.
5. The fabric evaluation relationship extraction method based on hybrid expert attention mechanism according to claim 1 is characterized in that: The subject features and potential relationship guide words are input into the hybrid expert attention mechanism model for hybrid expert joint learning to obtain a multi-dimensional tensor group, including: The subject features and potential relationship guide words are combined with each expert network to obtain feature representation, which is expressed as follows: , in, represents the feature representation result of the i-th expert layer, i represents the i-th expert layer, represents the expert network weight matrix, represents the expert network bias vector; Get the weight coefficient of each layer of experts, the expression is: , Among them, W g represents the expert weight matrix of each layer, b g Represents the expert bias vector of each layer; The feature representation results of each expert layer are combined with the corresponding expert weight coefficient to obtain the hybrid expert learning feature representation, which is expressed as: , in, represents the result of hybrid expert learning feature representation, and m represents the number of experts.
6. The fabric evaluation relationship extraction method based on hybrid expert attention mechanism according to claim 1 is characterized in that: The multidimensional feature tensor corresponding to the evaluation text information and the multidimensional tensor group are weightedly fused to obtain an evaluation text information tensor with subject features and potential guiding relationships, including: The hybrid expert learning feature representation results are fused with the multidimensional feature tensor corresponding to the evaluation text information, and the fusion results are input into the hybrid expert attention mechanism model to obtain the representation relationship of the fabric entity relationship pair, where the hybrid expert learning feature representation results include the subject entity feature representation results and the potential relationship feature representation results.
7. The fabric evaluation relationship extraction method based on hybrid expert attention mechanism according to claim 6 is characterized in that: The hybrid expert learning feature representation result is fused with the multi-dimensional feature tensor corresponding to the evaluation text information, including: The hybrid expert learning feature representation result and the feature encoding of the evaluation text information are weightedly fused, and the expression is: , in, represents the second mixed expert fusion result, Indicates subject entity features, The weight matrix representing the subject entity features, Represents the potential relationship characteristics, The weight matrix representing the features of the potential relationship, Represents the multidimensional feature tensor corresponding to the evaluation text information, The weight matrix representing the multidimensional feature tensor corresponding to the evaluation text information; The fusion results are input into the hybrid expert attention mechanism model to obtain the representation relationship of the fabric entity relationship pair, including: The fusion results are input into the third starting linear perceptron and the third ending linear perceptron respectively to obtain relation-object entity pairs, expressed as: , , in, represents the relation-object entity pair of the third starting linear perceptron, represents the weight matrix of the third starting linear perceptron, represents the bias vector of the third starting linear perceptron, Represents the relation-object entity pair of the third-ended linear perceptron, represents the weight matrix of the third-end linear perceptron, represents the bias vector of the third-end linear perceptron, Represents the sigmoid activation function.
8. The fabric evaluation relationship extraction method based on hybrid expert attention mechanism according to claim 1 is characterized in that: The expression of the focal loss function of the weighted cross entropy is: , , , , , Among them, P represents the predicted value, M represents the mask, and L represents the true value. Indicates the balance factor for adjusting the influence rate of positive and negative samples, express The influence coefficient of represents the focus weight, represents the binary cross entropy, represents the focal loss, represents the sum of focal losses.
9. A computer storage medium, characterized in that Used to store a computer program, which is executed by a processor to implement the fabric evaluation relationship extraction method based on a hybrid expert attention mechanism as described in any one of claims 1 to 8.
10. An electronic device, characterized in that: The invention comprises a memory and a processor, wherein the processor is communicatively connected to the memory, the memory is used to store a computer program, and the processor is used to load and execute the computer program to implement the fabric evaluation relationship extraction method based on the hybrid expert attention mechanism as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Textile e-commerce recommendation method and device based on balanced perception attention network
CN115587875A
Entity relation joint extraction method and system based on poultry BERT model and multi-label pointer network
CN118886496A