Fault determination method
Based on the method of comparing learning fault determination methods, extract and classify trigger, solve the problem of complex or blurred text failure recognition in the building environment, and achieve higher accuracy and a wider range of detection.
Patent Information
- Application Number
- PCT/CN2024/097337
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-07-24
- Filing Date
- 2024-06-04
- Publication Date
- 2025-01-30
AI Technical Summary
The prior art is difficult to accurately detect and identify complex or fuzzy building failures, and the detection range is limited, so it cannot be effectively applied to the building environment.
Use a comparison -based failure method to determine the method of learning, to identify the fault information in the complex or blurred text through fine samples, extract and classify triggers through fine samples.
The accuracy and accuracy of fault information in the building environment have been improved, and the scope of detection has been expanded, and it has high versatility and wide application.
Smart Images

Figure CN2024097337_30012025_PF_FP_ABST
Abstract
Description
Fault determination method
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application is based on the Chinese patent application with application number: 2023109066709 and application date of July 24, 2023, and claims the priority of the Chinese patent application. The entire content of the Chinese patent application is hereby introduced into this application as a reference. Technical Field
[0003] The present application relates to the field of building fault identification, and in particular, to a fault determination method. Background Art
[0004] With the development of intelligent buildings, building operation and maintenance are essential, and the demand for event extraction in the field of building faults is increasing. Related technologies mainly use general-purpose event extraction models for building fault detection. However, unlike other fields, building environments are more complex, involving large amounts of data that are complex and changeable. Conventional fault detection methods often cannot accurately detect building faults, and their detection scope is limited, making them difficult to apply to the building field.
[0005] Summary of the Invention
[0006] This application aims to solve at least one of the technical problems existing in the prior art. To this end, this application proposes a fault determination method that can effectively identify faults in complex or ambiguous text, improve the accuracy and precision of target fault information predicted in building environments, and has high versatility and universality.
[0007] In a first aspect, the present application provides a fault determination method for extracting fault events of smart buildings based on contrastive learning, the method comprising:
[0008] Inputting the text to be recognized into the trigger word extraction module of the target fault recognition model, and obtaining at least one golden trigger word output by the trigger word extraction module;
[0009] Inputting the at least one golden trigger word into the trigger word classification module of the target fault identification model, and obtaining target fault information output by the trigger word classification module;
[0010] The trigger word extraction module is trained based on a first training sample, wherein the first training sample includes a sample text and a sample golden trigger word and a sample candidate trigger word corresponding to the sample text;
[0011] The trigger word classification module is trained based on a second training sample, wherein the second training sample includes the sample golden trigger word and a sample fault definition text corresponding to the sample golden trigger word; the sample fault definition text includes a fault type and a description corresponding to the fault type.
[0012] According to the fault determination method for extracting fault events of smart buildings based on contrastive learning in this application, trigger word classification is performed through fine sample labeling and training, which can effectively identify faults in complex or fuzzy texts, thereby accurately identifying various types of faults in complex and changeable building environments, and has a wide detection range, significantly improving the accuracy and precision of the target fault information predicted in the building environment, and has high versatility and wide application.
[0013] According to one embodiment of the present application, the trigger word extraction module is trained based on the first training sample and includes:
[0014] The trigger word extraction module is trained based on the first training sample using a contrastive learning method.
[0015] According to one embodiment of the present application, the training of the trigger word extraction module based on the first training sample includes:
[0016] Constructing a loss function corresponding to the trigger word extraction module based on a linear function;
[0017] Training the trigger word extraction module with the goal of minimizing the loss function;
[0018] The loss function is:
[0019] Among them, L t is the loss function; k is the number of the sample candidate trigger words, f(Xt) is the weight value corresponding to the sample golden trigger word; f(Xt′) is the weight value corresponding to the sample candidate trigger word.
[0020] According to one embodiment of the present application, the linear function is determined based on the following steps:
[0021] Obtaining a semantic representation of the sample text based on the token representation corresponding to the sample text;
[0022] Concatenate the semantic representation of the sample text with the token representations of the sample golden trigger word and the sample candidate trigger word respectively to obtain the semantic representation of the sample golden trigger word and the semantic representation of the sample candidate trigger word;
[0023] The sample golden trigger word is used as a positive anchor point, the sample candidate trigger word is used as a negative sample, and the linear function is constructed based on the semantic representation of the sample golden trigger word and the semantic representation of the sample candidate trigger word.
[0024] According to one embodiment of the present application, the trigger word classification module is trained based on the second training sample and includes:
[0025] constructing an initial fault type representation matrix based on the fault type and the description corresponding to the fault type;
[0026] Randomly initializing the initial fault type representation matrix to obtain a first fault type representation matrix;
[0027] With the goal of matching the maximum first type score corresponding to the dot product of the sample golden trigger word and the first fault type representation matrix to the correct fault type, the first fault type representation matrix is trained to obtain the trigger word classification module.
[0028] According to one embodiment of the present application, constructing an initial fault type representation matrix based on the fault type and the description corresponding to the fault type includes:
[0029] Performing Bert encoding on the fault type and the description corresponding to the fault type to obtain a semantic representation of the fault type;
[0030] Based on the fault type semantic representation corresponding to each fault type, the initial fault type representation matrix is constructed; the size of the initial fault type representation matrix is N×H, where N is the number of fault types and H is the size of the Bert model [CLS] vector.
[0031] According to one embodiment of the present application, inputting the text to be recognized into the trigger word extraction module of the target fault recognition model and obtaining at least one golden trigger word output by the trigger word extraction module includes:
[0032] Perform keyword extraction on the text to be recognized to obtain multiple trigger words and weight values corresponding to each trigger word;
[0033] The trigger word corresponding to the largest first target number of weight values is determined as the at least one golden trigger word.
[0034] According to one embodiment of the present application, inputting the at least one golden trigger word into the trigger word classification module of the target fault identification model and obtaining the target fault information output by the trigger word classification module includes:
[0035] Performing a dot product between the golden trigger words and the trained first fault type representation matrix to obtain the first type score corresponding to each golden trigger word; the trigger word classification module is obtained based on the trained first fault type representation matrix;
[0036] A golden trigger word corresponding to a first type score greater than a first target threshold is determined as a final trigger word, and the target fault information is determined based on the fault type corresponding to the final trigger word.
[0037] According to an embodiment of the present application, after inputting the at least one golden trigger word into the trigger word classification module of the target fault identification model and obtaining target fault information output by the trigger word classification module, the method further includes:
[0038] Based on the dependency relationship between the golden trigger word and each object in the text to be recognized, a target candidate argument is determined from at least one object included in the text to be recognized.
[0039] According to one embodiment of the present application, determining a target candidate argument from at least one object included in the text to be recognized based on the dependency relationship between the golden trigger word and each object in the text to be recognized includes:
[0040] Segmenting and reorganizing the text to be recognized to obtain multiple vocabulary units;
[0041] Constructing a dependency analysis tree corresponding to the golden trigger word with the golden trigger word in the plurality of vocabulary units as a root node, wherein the dependency analysis tree includes at least one child node, and each child node corresponds to a vocabulary unit;
[0042] The vocabulary units corresponding to the child nodes except the root node in the dependency analysis tree are determined as target candidate arguments.
[0043] According to one embodiment of the present application, after determining a target candidate argument from at least one object included in the text to be recognized, the method further includes:
[0044] Inputting the target candidate argument into an argument classification module of a target fault identification model, and obtaining a target attribute type corresponding to the target candidate argument output by the argument classification module;
[0045] The argument classification module is trained based on a third training sample, and the third training sample includes a sample golden argument and a sample attribute definition text corresponding to the sample argument; the sample attribute definition text includes an attribute type and a description corresponding to the attribute type.
[0046] According to one embodiment of the present application, inputting the target candidate argument into an argument classification module of a target fault identification model and obtaining a target attribute type corresponding to the target candidate argument output by the argument classification module includes:
[0047] Performing a dot product of the target candidate argument and the trained first argument role representation matrix to obtain a second type score corresponding to each target candidate argument; the argument classification module is obtained based on the trained first argument role representation matrix;
[0048] The target candidate argument corresponding to the second type score greater than the second target threshold is determined as the final argument, and the attribute type corresponding to the final argument is determined as the target attribute type.
[0049] According to one embodiment of the present application, the argument classification module is trained based on the third training sample and includes:
[0050] Constructing an initial argument role representation matrix based on the attribute type and the description corresponding to the attribute type;
[0051] Randomly initializing the initial argument role representation matrix to obtain a first argument role representation matrix;
[0052] With the goal of corresponding the maximum value of the second type score corresponding to the dot product of the sample golden argument and the first argument role representation matrix to the correct attribute type, the first argument role representation matrix is trained to obtain the argument classification module.
[0053] In a second aspect, the present application provides a fault determination device for extracting fault events of smart buildings based on contrastive learning, the device comprising:
[0054] A first processing module is configured to input the text to be recognized into a trigger word extraction module of a target fault recognition model, and obtain at least one golden trigger word output by the trigger word extraction module;
[0055] A second processing module is configured to input the at least one golden trigger word into a trigger word classification module of the target fault identification model, and obtain target fault information output by the trigger word classification module;
[0056] The trigger word extraction module is trained based on a first training sample, wherein the first training sample includes a sample text and a sample golden trigger word and a sample candidate trigger word corresponding to the sample text;
[0057] The trigger word classification module is trained based on a second training sample, wherein the second training sample includes the sample golden trigger word and a sample fault definition text corresponding to the sample golden trigger word; the sample fault definition text includes a fault type and a description corresponding to the fault type.
[0058] According to the fault determination device for extracting fault events of smart buildings based on contrastive learning in this application, trigger word classification is performed through fine sample labeling and training, which can effectively identify faults in complex or fuzzy texts, thereby accurately identifying various types of faults in complex and changeable building environments, and has a wide detection range, significantly improving the accuracy and precision of the target fault information predicted in the building environment, and has high versatility and wide application.
[0059] In a third aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the method for extracting fault events of smart buildings based on comparative learning as described in the first aspect above is implemented.
[0060] In a fourth aspect, the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for extracting fault events of smart buildings based on comparative learning as described in the first aspect above is implemented.
[0061] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the fault determination method for extracting smart building fault events based on contrastive learning as described in the first aspect above.
[0062] The above one or more technical solutions in the embodiments of the present application have at least one of the following technical effects:
[0063] By extracting trigger words through comparative learning and classifying trigger words through fine sample annotation and training, it is possible to effectively identify faults in complex or ambiguous texts, thereby accurately identifying various types of faults in complex and changeable building environments. The detection range is wide, which significantly improves the accuracy and precision of the target fault information predicted in the building environment, and has high versatility and wide application.
[0064] Furthermore, through the contrastive learning method, positive and negative samples are trained with the goal of minimizing the loss function to obtain a linear function for measuring the weight value of the vocabulary as a trigger word, thereby obtaining a trained trigger word extraction module. The training process is simple and convenient, the training efficiency is high, and the training precision and accuracy are high.
[0065] Furthermore, by taking the "fault type name" and its "corresponding description" as fault type representation to construct the first fault type representation matrix, refined labeling can be achieved to improve the training accuracy of the module; on this basis, the trigger word classification module is trained based on the dot multiplication and maximum value algorithm, which is simple and fast to operate, suitable for the identification of fault categories in complex or ambiguous texts, and has high classification efficiency and classification accuracy.
[0066] Furthermore, by classifying the faults, the role types corresponding to the important arguments are further obtained based on the text to be identified, and the role types are used as a supplementary description of the fault types, thereby further improving the comprehensiveness and accuracy of the target fault information obtained, making it easier for users to understand various fault conditions in a timely and rapid manner.
[0067] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become obvious from the description below, or will be learned through practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0069] FIG1 is a flow chart of a method for extracting fault events of smart buildings based on contrastive learning according to an embodiment of the present application;
[0070] FIG2 is a second flow chart of a method for extracting fault events of a smart building based on contrastive learning according to an embodiment of the present application;
[0071] FIG3 is a third flow chart of a fault determination method for extracting fault events of a smart building based on contrastive learning provided in an embodiment of the present application;
[0072] FIG4 is a fourth flow chart of a fault determination method for extracting fault events of a smart building based on contrastive learning provided in an embodiment of the present application;
[0073] FIG5 is a fifth flow chart of a fault determination method for extracting fault events of a smart building based on contrastive learning provided in an embodiment of the present application;
[0074] FIG6 is a sixth flow chart of a method for extracting fault events of a smart building based on contrastive learning according to an embodiment of the present application;
[0075] FIG7 is a schematic structural diagram of a fault determination device for extracting fault events of a smart building based on contrastive learning according to an embodiment of the present application;
[0076] FIG8 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0077] The following will be combined with the accompanying drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field are within the scope of protection of this application.
[0078] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this application can be implemented in an order other than that illustrated or described herein, and that the objects distinguished by "first," "second," and the like are generally of the same type, and do not limit the number of objects; for example, the first object can be one or more. In addition, the term "and / or" in the specification and claims refers to at least one of the connected objects, and the character " / " generally indicates that the objects connected are in an "or" relationship.
[0079] Below, in combination with the accompanying drawings, the fault determination method for extracting fault events of smart buildings based on comparative learning, the fault determination device for extracting fault events of smart buildings based on comparative learning, the electronic device and the readable storage medium provided in the embodiments of the present application are described in detail through specific embodiments and their application scenarios.
[0080] Among them, the fault determination method for extracting fault events of smart buildings based on contrastive learning can be applied to the terminal, and can be specifically executed by the hardware or software in the terminal.
[0081] The terminal includes, but is not limited to, a portable communication device such as a mobile phone or tablet computer having a touch-sensitive surface (e.g., a touch screen display and / or a touch pad). It should also be understood that, in some embodiments, the terminal may not be a portable communication device, but a desktop computer having a touch-sensitive surface (e.g., a touch screen display and / or a touch pad).
[0082] In the following embodiments, a terminal including a display and a touch-sensitive surface is described. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, a mouse, and a joystick.
[0083] The embodiment of the present application provides a fault determination method for extracting smart building fault events based on comparative learning. The execution subject of the fault determination method for extracting smart building fault events based on comparative learning can be an electronic device or a functional module or functional entity in the electronic device that can implement the fault determination method for extracting smart building fault events based on comparative learning. The electronic devices mentioned in the embodiment of the present application include but are not limited to mobile phones, tablets, computers, cameras and wearable devices. The fault determination method for extracting smart building fault events based on comparative learning provided in the embodiment of the present application is explained below using electronic devices as the execution subject as an example.
[0084] As shown in FIG1 , the fault determination method for extracting fault events of a smart building based on contrastive learning includes: step 110 and step 120 .
[0085] Step 110: Input the text to be recognized into the trigger word extraction module of the target fault recognition model to obtain at least one golden trigger word output by the trigger word extraction module; wherein the trigger word extraction module is trained based on a first training sample, and the first training sample includes a sample text and a sample golden trigger word and a sample candidate trigger word corresponding to the sample text;
[0086] In this step, the target fault recognition model includes a trigger word extraction module and a trigger word classification module. The output of the trigger word extraction module is connected to the input of the trigger word classification module. During the application process, the trigger word extraction module is used to extract trigger words from the input text to be recognized.
[0087] Golden trigger words are words or phrases in the text to be identified that can effectively identify the fault category.
[0088] Candidate trigger words are words or phrases in the text to be recognized that are likely to confuse the fault recognition results.
[0089] For example, for the text to be recognized, "At vehicle access entrance No. 2 in area A, the vehicle recognition camera can start capturing the picture in time after receiving the signal. The picture is clear but the license plate cannot be captured, and the vehicle cannot be recognized normally", the golden trigger words may include: "unable to capture the license plate" etc.; and the candidate trigger words may include: "receive signal", "start capturing in time" and "clear picture" etc.
[0090] The first training sample is a sample used to train the trigger word extraction module.
[0091] The first training sample includes: a sample text and a sample golden trigger word and a sample candidate trigger word corresponding to the sample text, wherein the sample golden trigger word and the sample candidate trigger word corresponding to the sample text can be customized by the user.
[0092] Among them, the sample golden trigger word is a positive sample, and the sample candidate trigger word is a negative sample.
[0093] Taking the sample text "At vehicle access entrance No. 2 in area A, the vehicle recognition camera can start capturing the picture in time after receiving the signal. The picture is clear but the license plate cannot be captured, and the vehicle cannot be recognized normally" as an example, the positive samples in the sample text can be marked to obtain the sample golden trigger word "unable to capture the license plate"; the negative samples in the sample text can be marked to obtain the sample candidate trigger words: "receive signal", "start capturing in time" and "clear picture" etc.
[0094] In some embodiments, the trigger word extraction module may be a Bert model.
[0095] In the actual training process, a training method based on contrastive learning can be used for training. Only two types of judgments, yes and no, are required without separate labeling. The accuracy is high, the training process is simple, and the training efficiency is high.
[0096] The specific training process of the trigger word extraction module is described below.
[0097] In some embodiments, the trigger word extraction module is trained based on the first training sample, which may include: using a contrastive learning method to train the trigger word extraction module based on the first training sample.
[0098] In this embodiment, the trigger word extraction module is trained by contrastive learning. There is no need to label each first training sample separately. Only yes or no training is required. While effectively ensuring the accuracy of training, the amount of data used for training can be reduced to increase the training rate. It is suitable for any scenario, especially for complex feature extraction scenarios or those involving a large number of training samples.
[0099] In some embodiments, using a contrastive learning method to train a trigger word extraction module based on the first training sample may include:
[0100] Construct the loss function corresponding to the trigger word extraction module based on the linear function;
[0101] The trigger word extraction module is trained with the goal of minimizing the loss function;
[0102] The loss function is:
[0103] Among them, Lt is the loss function; k is the number of sample candidate trigger words, f(Xt) is the weight value corresponding to the sample golden trigger word; f(Xt′) is the weight value corresponding to the sample candidate trigger word.
[0104] In this embodiment, a linear function is used to represent the weight value corresponding to each trigger word.
[0105] As shown in Figure 2, during the training phase of the trigger word extraction module, an innovative contrastive learning approach can be employed based on the BERT model. With the goal of minimizing the hinge loss function, the parameters of the linear function are learned, resulting in a trigger word extraction module that accurately distinguishes positive and negative samples. In subsequent applications, the text to be recognized can be input, and the trained linear function can be used to select golden trigger words based on the weights corresponding to each candidate word. For example, the top m golden trigger words are detected, where m > 0 and m is a positive integer.
[0106] As shown in FIG3 , in some embodiments, the linear function may be determined based on the following steps:
[0107] Obtain the semantic representation of the sample text based on the token representation corresponding to the sample text;
[0108] Concatenate the semantic representation with the token representation of the sample golden trigger word and the sample candidate trigger word to obtain the semantic representation of the sample golden trigger word and the semantic representation of the sample candidate trigger word;
[0109] The sample golden trigger word is used as the positive anchor point, the sample candidate trigger word is used as the negative sample, and a linear function is constructed based on the semantic representation of the sample golden trigger word and the semantic representation of the sample candidate trigger word.
[0110] In this embodiment, the token representation can be obtained based on the Bert model.
[0111] The value of the linear function is used to represent the weight value corresponding to the trigger word.
[0112] For example, a linear function can be expressed as: f(Xt) = W·Xt+b or f(Xt′) = W·Xt′+b;
[0113] Among them, f(Xt) is the weight value corresponding to the sample golden trigger word; f(Xt′) is the weight value corresponding to the sample candidate trigger word; Xt is the vector formed by concatenating the sample golden trigger word and the BERT[CLS] vector of the sample text (i.e., the semantic representation of the sample golden trigger word); Xt′ is the vector formed by concatenating the sample candidate trigger word and the BERT[CLS] vector of the sample text (i.e., the semantic representation of the sample candidate trigger word); W and b are both learnable parameters.
[0114] For example, in an actual execution process, the training samples include: 5000 sample texts, of which the first 4000 are training texts and the last 1000 are test texts.
[0115] Assume that the total number of texts involved in training is N=4000, the total number of training iterations is n=120, the iteration counter i is set to an initial value of 0, and the text count counter j is set to an initial value of 0; read a line of text T from the training text and update the text count counter to j++.
[0116] Continuing with Figure 3, let's take the sample text "At the vehicle access control entrance No. 2 in Area A, the vehicle recognition camera can start capturing images in a timely manner after receiving the signal. The image is clear, but the license plate cannot be captured, and the vehicle cannot be recognized normally" as an example:
[0117] The sample text is input into the trigger word extraction module based on the Bert model to generate the token representation S = s1, s2, ..., sn of the sample text s. The BERT[CLS] vector of the sentence is taken as the semantic representation of the entire sentence, and it is concatenated with the sample golden trigger word st to obtain Xt = [S[CLS]; st]; the semantic representation of the entire sentence is concatenated with the token of the sample candidate trigger word st′ to obtain Xt′ = [S[CLS]; st′], where Xt, Xt′∈1×2H, H is the size of a token vector of the Bert model;
[0118] In this embodiment, st represents “unable to capture the license plate”, and st′ represents “receive signal”, “start capture in time”, and “image is clear”.
[0119] By adopting contrastive learning, the sample golden trigger word st is used as the positive anchor point, and the other k incorrect sample candidate trigger words st′ are used as negative samples. A special linear function f(Xt)=W·Xt+b or f(Xt′)=W·Xt′+b is designed to obtain the weight value f(Xt) of the sample golden trigger word and the weight value f(Xt′) of each sample candidate trigger word.
[0120] Use loss function:
[0121] Minimize to learn the learnable parameters W and b, and obtain the trained trigger word extraction module, where k is the number of negative samples, f(Xt) is the linear function corresponding to the sample golden trigger word; f(Xt′) is the linear function corresponding to the sample candidate trigger word.
[0122] For example, when the number of training iterations n is small, the weight value f(Xt) of st (unable to capture the license plate) is 2.1, the weight value f(Xt′) of st′ (received signal) is 0.8, the weight value f(Xt′) of st′ (start capturing in time) is 3.8, and the weight value f(Xt′) of st′ (clear picture) is 2.5, then Lt = max{0,1+0.8-2.1}+max{0,1+3.8-2.1}+max{0,1+2.5-2.1}=0+2.7+1.4=4.1. The difference in the weight values corresponding to positive and negative samples is small, and it can be considered that positive and negative samples cannot be accurately distinguished at this time.
[0123] Repeat the above training process to continue iterating. For example, at the end of n = 120 iterations, the weight value of st (unable to capture the license plate) is a large value, such as 5.7; while the weight values of st1′ (receiving the signal), st2′ (starting to capture in time), and st3′ (clear picture) are smaller values, such as 1.3, 1.8, and 1.6 respectively. At this time, Lt = max{0,1+1.3-5.7}+max{0,1+1.8-5.7}+max{0,1+1.6-5.7}=0+0+0=0; the difference between the weight values corresponding to the positive and negative samples is large. At this time, it can be approximately considered that the learnable parameters W and b have been fully learned, and the training of the trigger word extraction module is completed, which can be used to test the text to calculate the weight value of the trigger word.
[0124] The trained linear functions f(Xt) and f(Xt′) can be used to measure the weight value of the vocabulary as a trigger word.
[0125] According to the fault determination method for extracting fault events of smart buildings based on contrastive learning provided in the embodiment of the present application, positive and negative samples are trained with the goal of minimizing the loss function through the contrastive learning method to obtain a linear function for measuring the weight value of the vocabulary as a trigger word, thereby obtaining a trained trigger word extraction module. The training process is simple and convenient, the training efficiency is high, and the training precision and accuracy are high.
[0126] The actual application process of the trigger word extraction module is explained below.
[0127] Continuing with reference to FIG3 , in some embodiments, step 110 may include:
[0128] Perform keyword extraction on the text to be recognized, obtain multiple trigger words and the weight value corresponding to each trigger word;
[0129] The trigger word corresponding to the largest first target number of weight values is determined as at least one golden trigger word.
[0130] In this embodiment, the first target number can be user-defined, such as set to 1, 2, 3 or other any positive integer value, etc., which is not limited in this application.
[0131] It is understandable that in actual application, the trigger word extraction module is a pre-trained module. It only needs to input the text to be recognized and output multiple trigger words extracted from the text to be recognized, as well as the weight value corresponding to each trigger word.
[0132] In other embodiments, determining the trigger word corresponding to the weight value of the largest first target number as at least one golden trigger word may also include: determining the trigger word corresponding to the weight value greater than the third target threshold among the weight values of the largest first target number as at least one golden trigger word.
[0133] In this embodiment, the third target threshold is a larger value.
[0134] The third target threshold can be user-defined and is not limited in this application.
[0135] For example, continuing to refer to Figure 3, taking the text to be recognized as "On May 13, 2023, at vehicle access entrance No. 6 in Area B, the vehicle recognition camera was able to receive signals but could not capture images, and after observation, it was found that the lens was damaged" as an example, the text to be recognized is input into the trigger word extraction module to obtain the token representation S of the text to be recognized with a length of n and Xi = [S[CLS]; si], where si is the token of a word (for example: "observation") or phrase (for example: "receive signal", "lens is broken") in the text to be recognized S, and Xi is a trigger word. Each trigger word corresponds to a weight value.
[0136] The scores (i.e., weight values) of the linear function f(Xi) are used to sort and select the top-m most likely trigger words as golden trigger words, where m is a positive integer.
[0137] For example, in this embodiment, the weight value f(Xi) of the trigger word si="broken lens" is 5.5, the weight value f(Xi) of the trigger word si="unable to capture image" is 4.4, the weight value f(Xi) of the trigger word si="receive signal" is 1.9, and the weight value f(Xi) of the trigger word si="observe" is 0.6. Then, the top 3 trigger words si with f(Xi)>3.5 can be selected as golden trigger words, such as the golden trigger words: "broken lens" and "unable to capture image".
[0138] According to the fault determination method for extracting fault events of smart buildings based on contrastive learning provided in an embodiment of the present application, the text to be recognized is input into a trigger word extraction module obtained through contrastive learning training, and the trigger word extraction module outputs one or more trigger words with a high weight value or a large weight value as golden trigger words, so that the extraction accuracy is high and the extraction rate is fast.
[0139] Step 120: Input at least one golden trigger word into the trigger word classification module of the target fault identification model, and obtain target fault information output by the trigger word classification module;
[0140] Among them, the trigger word classification module is trained based on the second training sample, and the second training sample includes a sample golden trigger word and a sample fault definition text corresponding to the sample golden trigger word; the sample fault definition text includes a fault type and a description corresponding to the fault type.
[0141] In this step, the trigger word classification module is used to identify the fault category corresponding to the output trigger word based on the output trigger word.
[0142] The target fault information is information used to describe the fault situation, including but not limited to the fault category and fault description.
[0143] For example, the fault types may include but are not limited to: camera misalignment, lens damage, and fill light damage.
[0144] The second training sample is a sample used to train the trigger word classification module.
[0145] The second training sample includes: a sample golden trigger word and a sample fault definition text corresponding to the sample golden trigger word, wherein the sample golden trigger word can be a user-defined trigger word, or can also be a trigger word output by a trigger word extraction module.
[0146] The sample fault definition text corresponding to the sample golden trigger word is the real fault text corresponding to the sample golden trigger word marked by the user.
[0147] In this application, the sample fault definition text is a definition text manually defined by the user, including: a fault type and a description corresponding to the fault type.
[0148] The description corresponding to the fault type is used to describe the possible cause of the fault or the actual impact that the fault may cause.
[0149] For example, a sample fault definition text may be expressed as: [Fault Type] Camera Misalignment [Description] The installation position or direction of the surveillance camera deviates, resulting in the monitoring image not matching the actual monitoring area, making accurate monitoring impossible.
[0150] By describing the fault type, the fault type can be characterized more accurately so that the fault type and trigger word can be accurately matched, thereby improving the precision and accuracy of the fault identification results and reducing the risks of missed detection and false detection.
[0151] During the training process, any feasible neural network training method can be used for training, and this application does not limit it here.
[0152] In some embodiments, the trigger word classification module may be a Bert model.
[0153] During the research and development process, the inventors discovered that in the relevant technology, the conventional way to process training samples is mainly to simply label the fault type name. This labeling method makes the model obtained based on the labeling training only able to identify the categories corresponding to specific keywords, but cannot identify the categories corresponding to more complex or ambiguous keywords, and thus cannot be applied to fault identification in complex building scenarios.
[0154] In the present application, by combining the specific application scenarios of the building, the possible causes of each fault category and the possible consequences of this type of fault are obtained, and the fault category is further described based on the cause or result. Then, the association between the description and the fault type is established to obtain a sample fault definition text. The sample fault definition text is used to finely annotate the second training sample, which can achieve deep training of the training trigger word classification module, so that the training trigger word classification module finally trained can recognize the fault category under complex or ambiguous text, effectively improving the fault identification precision and accuracy.
[0155] The following describes the training process of the trigger word classification module from an implementation perspective.
[0156] In some embodiments, the trigger word classification module is trained based on the second training sample and may include:
[0157] Based on the fault types and their corresponding descriptions, an initial fault type representation matrix is constructed;
[0158] Randomly initialize an initial fault type representation matrix to obtain a first fault type representation matrix;
[0159] With the goal of matching the maximum first-type score corresponding to the dot product of the sample golden trigger word and the first fault type representation matrix to the correct fault type, the first fault type representation matrix is trained to obtain the trigger word classification module.
[0160] In this embodiment, the first type is used to indicate the fault type.
[0161] The larger the score of the first type, the higher the credibility of the representation.
[0162] Continuing with FIG4 , in some embodiments, constructing an initial fault type representation matrix based on the fault types and their corresponding descriptions may include:
[0163] Perform Bert encoding on the fault type and the description corresponding to the fault type to obtain the semantic representation of the fault type;
[0164] Based on the fault type semantic representation corresponding to each fault type, an initial fault type representation matrix is constructed.
[0165] In this embodiment, the size of the fault type representation matrix is N×H, where N is the number of fault types and H is the size of the Bert model [CLS] vector.
[0166] For example, the "fault type" and its "corresponding description" can be used as fault type representations and sent to the encoder based on the BERT model. The [CLS] vector is taken as the semantic representation of the fault type, and the initial fault type representation matrix is constructed. The matrix is randomly initialized to obtain the first fault type representation matrix WF, where WF∈N×H, N is the number of fault types, and H is the size of the Bert model [CLS] vector.
[0167] Then, the token st of the sample golden trigger word is used to learn the first fault type representation matrix WF, and Ft = softargmax(WF·st) is used for training. The goal is to enable the sample golden trigger word to be classified into the correct fault type based on the maximum value of the first type score, thereby obtaining the trained first fault type representation matrix WF.
[0168] Continuing to refer to Figure 2, a unique "fault name" (i.e., fault type) plus a "corresponding description" is used as the fault type representation. The fault type representation matrix is then randomly initialized to obtain the first fault type representation matrix WF. The goal is to correctly classify the sample golden trigger word according to the maximum fault type score after the dot product of the WF. The first fault type representation matrix WF is trained to obtain the trigger word classification module.
[0169] In this application, by randomly initializing the matrix, the parameters of the matrix can be flexibly adjusted when the sample golden trigger words are used for training in the future, thereby obtaining a larger score and improving the training precision and accuracy.
[0170] As shown in FIG4 , the sample fault definition text is continued as follows: “[Fault type] Camera misalignment [Description] The installation position or direction of the surveillance camera deviates, resulting in the monitoring image not matching the actual monitoring area, making accurate monitoring impossible” as an example for explanation.
[0171] The above sample fault definition text is fed into the encoder based on the Bert model, and its [CLS] vector is taken as the semantic representation of the fault type to obtain the first fault type representation matrix WF, WF∈N×H, where N is the number of fault types and H is the size of the BERT model [CLS] vector;
[0172] The WF is learned using the token st of the sample golden trigger word. For example, the sample golden trigger word st ("unable to capture license plate") corresponding to the sample text "At vehicle access entrance No. 2 in Area A, the vehicle recognition camera was able to start capturing images promptly after receiving the signal. The image was clear, but the license plate could not be captured, and the vehicle could not be recognized normally" is used. Ft = softargmax(WF·st) is used to train the first fault type representation matrix. The goal is to make the maximum first type score of the sample golden trigger word st ("unable to capture license plate") correspond to the correct fault type ("camera misalignment"), thereby obtaining a trained trigger word classification module.
[0173] According to the fault determination method for extracting fault events of smart buildings based on contrastive learning provided in the embodiment of the present application, by taking the "fault type name" and its "corresponding description" as the fault type representation to construct a first fault type representation matrix, refined labeling can be achieved to improve the training accuracy of the module; on this basis, the trigger word classification module is trained based on the dot multiplication and maximum value algorithm, which is simple and fast to operate, suitable for identifying fault categories in complex or ambiguous texts, and has high classification efficiency and classification accuracy.
[0174] The actual application process of the trigger word classification module is explained below.
[0175] In some embodiments, step 120 may include:
[0176] Perform dot multiplication of the golden trigger words and the trained first fault type representation matrix to obtain the first type score corresponding to each golden trigger word; the trigger word classification module is obtained based on the trained first fault type representation matrix;
[0177] A golden trigger word corresponding to a first type score greater than a first target threshold is determined as a final trigger word, and target fault information is determined based on the fault type corresponding to the final trigger word.
[0178] In this embodiment, the first type score is the value obtained by performing a dot product of the golden trigger word and the fault type representation matrix.
[0179] It should be noted that the size of the fault type representation matrix is N*H, where N is the number of fault types, H is the size of the BERT model [CLS] vector, and the size of the golden trigger word vector is h*1, where h>0. By performing a dot product between each golden trigger word and the fault type representation matrix, at least one dot product score (i.e., the first type score) corresponding to each golden trigger word can be obtained.
[0180] The first type score is used to represent the credibility of the fault type corresponding to the golden trigger word and the first type score.
[0181] The first target threshold is a larger value and can be customized based on the user, such as setting the first target threshold to 0.5 or 0.6, etc., which is not limited in this application.
[0182] Continuing with reference to FIG2 , the golden trigger words of the obtained text to be recognized can be multiplied by the WF matrix, and the golden trigger words whose probability (i.e., the first type score) is greater than the first target threshold of 0.5 are taken as the final trigger words, and the fault type corresponding to the final trigger words is taken.
[0183] Of course, in other embodiments, determining the golden trigger word corresponding to the first type score greater than the first target threshold as the final trigger word may include: determining the golden trigger words before the second target number among the golden trigger words corresponding to the first type score greater than the first target threshold as the final trigger word.
[0184] In this embodiment, the second target quantity may be based on user customization.
[0185] After obtaining the golden trigger words corresponding to the first type of scores greater than the first target threshold, a second target number of golden trigger words can be further obtained from the golden trigger words corresponding to the first type of scores greater than the first target threshold as final trigger words to further reduce the number of final trigger words and improve accuracy.
[0186] Continuing to refer to Figure 4, in the actual execution process, Fti = softargmax(WF·sti) of the m golden trigger words T1, T2, ..., Tm obtained in step 110 can be calculated respectively, i = 1, 2, ..., m, and the golden trigger words with Fti>0.5 are taken as the final trigger words and the corresponding fault type, and the trigger words with Fti≤0.5 are discarded.
[0187] For example, taking the text to be recognized as "On May 13, 2023, at the vehicle access control entrance No. 6 in Area B, the vehicle recognition camera was able to receive signals but could not capture images, and upon observation, the lens was found to be broken" as an example, based on step 110, multiple golden trigger words can be obtained: st1 = "lens broken", st2 = "cannot capture images";
[0188] Calculate the first type score of the possible fault corresponding to each golden trigger word Fti = softargmax(WF·sti) to obtain multiple first type scores;
[0189] The golden trigger words with Fti>0.5 and their corresponding fault types are taken as the final trigger words and target fault information; the trigger words with Fti≤0.5 are discarded.
[0190] For example, the golden trigger word st1 = "lens damage" achieves the maximum value Ft1 = 0.95 when corresponding to the fault type "lens damage", and the golden trigger word st2 = "unable to capture image" achieves the maximum value Ft2 = 0.62 when corresponding to the fault types "lens damage" and "fill light damage". Comprehensive judgment shows that the most likely fault type for this description text is "lens damage", and it is less likely to be "fill light damage", so "lens damage" can be determined as the target fault information.
[0191] According to the fault determination method for extracting fault events of smart buildings based on contrastive learning provided in the embodiment of the present application, by obtaining the dot product score of the golden trigger word and the trained first fault type representation matrix, and obtaining the golden trigger word corresponding to the higher score as the final trigger word, the calculation rate is high and the classification accuracy is high.
[0192] In this application, by combining the specific application scenarios of the building, the possible causes of each fault category and the possible consequences of this type of fault are obtained, and the fault category is further described based on the cause or result. Then, the association between the description and the fault type is established to obtain a sample fault definition text. The sample fault definition text is used to finely annotate the second training sample, which can achieve deep training of the training trigger word classification module, so that the training trigger word classification module finally trained can recognize the fault category under complex or ambiguous text, effectively improving the fault identification precision and accuracy.
[0193] In addition, by training the trigger word extraction module through comparative learning, there is no need to label each first training sample separately. Only yes or no training is required. While effectively ensuring the training accuracy, it can also reduce the amount of data used for training to increase the training rate. It is suitable for any scenario, especially for complex feature extraction scenarios or those involving a large number of training samples.
[0194] According to the fault determination method for extracting smart building fault events based on contrastive learning provided in the embodiment of the present application, trigger word classification is performed through fine sample labeling and training, which can effectively identify faults in complex or fuzzy texts, thereby accurately identifying various types of faults in complex and changeable building environments, and has a wide detection range, significantly improving the accuracy and precision of the target fault information predicted in the building environment, and has high versatility and wide application.
[0195] As shown in FIG5 , in some embodiments, after step 120 , the method may further include: determining a target candidate argument from at least one object included in the text to be recognized based on a dependency relationship between the golden trigger word and each object in the text to be recognized.
[0196] In this embodiment, the object may be any word or phrase in the text to be recognized.
[0197] The argument is a noun-like word in a sentence.
[0198] Dependency relationships are used to represent the association between golden trigger words and other objects, such as the time and location of the occurrence of the event corresponding to the golden trigger word.
[0199] In some embodiments, determining a target candidate argument from at least one object included in the text to be recognized based on the dependency relationship between the golden trigger word and each object in the text to be recognized may include:
[0200] Segment and reorganize the text to be recognized to obtain multiple vocabulary units;
[0201] Constructing a dependency analysis tree corresponding to the golden trigger word with the golden trigger word in the plurality of vocabulary units as a root node, wherein the dependency analysis tree includes at least one child node, and each child node corresponds to a vocabulary unit;
[0202] The vocabulary units corresponding to the child nodes except the root node in the dependency analysis tree are determined as the target candidate arguments.
[0203] In this embodiment, the argument is a noun-like word in a sentence.
[0204] Lexical units include reorganized participles and some unreorganized participles.
[0205] During the actual execution process, the dependency analysis tool can be used to perform word segmentation and subword merging on the text to be recognized, decompose the text to be recognized into a series of vocabulary units, and merge some subwords to obtain multiple vocabulary units; on this basis, with the golden trigger word determined based on step 110 as the root node, establish a dependency analysis tree about the trigger word; then, the vocabulary units of other nodes in the dependency analysis tree excluding the root node are used as preliminary candidate arguments Aj (i.e., target candidate arguments).
[0206] Take the text to be recognized as "On May 13, 2023, at vehicle access entrance No. 6 in Area B, the vehicle recognition camera was able to receive signals but could not capture images, and after observation, it was found that the lens was damaged" as an example for explanation.
[0207] For the above text to be identified, the word segmentation results are: [('2023','DATE'),('May','DATE'),('13th','DATE'),('in','O'),('B','ORDINAL'),('district','O'),('6','NUMBER'),('number','O'),('vehicle','O'),('access control','O'),('entrance','O'),(',','O'),('vehicle','O'),('identification', 'O'),('camera','O'),('able to','O'),('receive','O'),('signal','O'),(',','O'),('but','O'),('cannot','O'),('capture','O'),('image','O'),(',','O'),('and','O'),('passed','O'),('observed','O'),('discovered','O'),('lens','O'),('damaged','O'),('。','O')].
[0208] After obtaining the above multiple segmentations, some segmentation subwords are merged, such as merging the trigger word segmentation subwords ('unable', 'O'), ('capture', 'O'), and ('image', 'O') into ('unable to capture image', 'T'), and merging ('lens', 'O'), and ('broken', 'O') into ('lens broken', 'T'), where 'T' indicates that it belongs to the trigger word; in addition, date subwords can also be merged, such as merging ('2023 year', 'DATE'), ('May', 'DATE'), and ('13th day', 'DATE') into ('2023 May 13th', 'DATE'); thereby obtaining multiple vocabulary units.
[0209] Then, taking the golden trigger word "broken lens" as the root node, a dependency analysis tree about the trigger word is established, and its corresponding child nodes are: 'May 13, 2023', 'Area B', 'No. 6', and 'Vehicle Recognition Camera'. Each child node corresponds to a vocabulary unit.
[0210] Finally, the lexical units of the nodes other than the root node in the dependency analysis tree are taken as the target candidate arguments Aj, and multiple target candidate arguments are obtained: 'May 13, 2023', 'Area B', 'No. 6' and 'Vehicle Recognition Camera'.
[0211] According to the fault determination method for extracting fault events of smart buildings based on contrastive learning provided in the embodiment of the present application, a dependency analysis tree is constructed with the trigger word as the root node to extract candidate arguments. When the trigger word is known, relevant arguments can be quickly extracted. This method is simple and effective, and can extract arguments related to the trigger word as much as possible to reduce omissions.
[0212] In some embodiments, after determining a target candidate argument from at least one object included in the text to be recognized, the method may further include:
[0213] Input the target candidate argument into the argument classification module of the target fault identification model, and obtain the target attribute type corresponding to the target candidate argument output by the argument classification module;
[0214] The argument classification module is trained based on the third training sample. The third training sample includes a sample golden argument and a sample attribute definition text corresponding to the sample argument. The sample attribute definition text includes an attribute type and a description corresponding to the attribute type.
[0215] In this embodiment, the target attribute type is the most likely attribute category corresponding to the target candidate argument.
[0216] Among them, the attribute type represents the role type of the argument.
[0217] Attribute types may include, but are not limited to, date, location, house number, and facility.
[0218] During actual implementation, the target attribute type may also be added to the target fault information as a supplementary description of the fault category.
[0219] The target fault identification model may also include an argument extraction module and an argument classification module.
[0220] Among them, the argument extraction module is used to extract target candidate arguments from the text to be recognized. The specific implementation method has been described in the above embodiment and will not be repeated here.
[0221] The output end of the argument extraction module is connected to the input end of the argument classification module. The argument classification module is used to classify the input target candidate arguments and determine the attribute type corresponding to each target candidate argument.
[0222] For example, for the text to be recognized, "On May 13, 2023, at vehicle access entrance No. 6 in Area B, the vehicle recognition camera was able to receive signals but could not capture images, and after observation, it was found that the lens was damaged", its corresponding target candidate arguments may include: sA1 = 'May 13, 2023', sA2 = 'Area B', sA3 = 'No. 6', sA4 = 'Vehicle Recognition Camera'; the attribute type corresponding to sA1 = 'May 13, 2023' is "date", and the attribute type corresponding to sA2 = 'Area B' is "location".
[0223] The third training sample is a sample used to train the argument classification module.
[0224] The third training sample may include: a sample golden argument and a sample attribute definition text corresponding to the sample argument.
[0225] The sample attribute definition text is user-defined text and may include: attribute type and description corresponding to the attribute type.
[0226] In the actual execution process, the argument classification module can be any realizable neural network model, and this application does not limit it here.
[0227] According to the fault determination method for extracting smart building fault events based on contrastive learning provided in the embodiment of the present application, on the basis of classifying the faults, the role type corresponding to the important argument is further obtained based on the text to be identified, and the role type is used as a supplementary description of the fault type, thereby further improving the comprehensiveness and accuracy of the obtained target fault information, making it convenient for users to understand various fault situations in a timely and rapid manner.
[0228] The following describes the training method of the argument classification module.
[0229] As shown in FIG6 , in some embodiments, the argument classification module is trained based on the third training sample and may include:
[0230] Based on the attribute types and the descriptions corresponding to the attribute types, an initial argument role representation matrix is constructed;
[0231] Randomly initialize the initial argument role representation matrix to obtain the first argument role representation matrix;
[0232] With the goal of matching the maximum second-type score corresponding to the dot product of the sample golden argument and the first-argument role representation matrix to the correct attribute type, the first-argument role representation matrix is trained to obtain the argument classification module.
[0233] In this embodiment, the training method of the argument classification module is similar to the training method of the trigger word classification module.
[0234] In some embodiments, constructing an initial argument role representation matrix based on the attribute types and the descriptions corresponding to the attribute types may include:
[0235] Perform Bert encoding on the attribute type and the description corresponding to the attribute type to obtain the semantic representation of the attribute type;
[0236] Based on the attribute type semantic representation corresponding to each attribute type, an initial argument role representation matrix is constructed.
[0237] In this embodiment, the size of the initial argument role representation matrix is N×H, where N is the number of attribute types and H is the size of the Bert model [CLS] vector.
[0238] For example, the "argument role name" and its "corresponding description" are fed into the encoder based on the Bert model as sample attribute definition text to obtain the randomly initialized first argument role representation matrix WE;
[0239] The same method as training the first fault type representation matrix WF is used to learn the first argument role representation matrix WE using the token sA of the sample golden argument. The goal is to enable the sample golden argument to be classified into the correct role type according to the maximum value of the second type score.
[0240] Among them, the second type is used to represent the role type.
[0241] The higher the second type score, the higher the credibility.
[0242] According to the fault determination method for extracting fault events of smart buildings based on contrastive learning provided in the embodiment of the present application, the learnable representation of the first argument role representation matrix is used to classify the arguments, and training is performed based on the dot multiplication and maximum value algorithm. The training method is simple and convenient, and the training accuracy is high.
[0243] Continuing with FIG6 , in some embodiments, inputting the target candidate argument into the argument classification module of the target fault identification model and obtaining the target attribute type corresponding to the target candidate argument output by the argument classification module may include:
[0244] Perform dot multiplication of the target candidate argument and the trained first argument role representation matrix to obtain the second type score corresponding to each target candidate argument; the argument classification module is obtained based on the trained first argument role representation matrix;
[0245] The target candidate argument corresponding to the second type score greater than the second target threshold is determined as the final argument, and the attribute type corresponding to the final argument is determined as the target attribute type.
[0246] In this embodiment, the second target threshold is a larger value. The second target threshold can be customized based on the user, such as being set to 0.5 or 0.8, etc., which is not limited in this application.
[0247] Of course, in other embodiments, the first third target number of target candidate arguments among the target candidate arguments corresponding to the second type scores that are greater than the second target threshold may also be determined as final arguments.
[0248] The target attribute type may be obtained in a manner similar to step 120 .
[0249] Continuing with the example of the text to be recognized, "On May 13, 2023, at vehicle access entrance No. 6 in Area B, the vehicle recognition camera was able to receive signals but could not capture images, and after observation, it was found that the lens was damaged," the explanation is provided.
[0250] First, k target candidate arguments are obtained based on the argument extraction module:
[0251] sA1 = 'May 13, 2023', sA2 = 'Area B', sA3 = 'No. 6', sA4 = 'Vehicle Recognition Camera';
[0252] The above k target candidate arguments are input into the argument classification module respectively, and the tokens of the k target candidate arguments are multiplied by the trained first argument role representation matrix to calculate the second type score EAj = softargmax(WE·sAj), j = 1, 2, ..., k corresponding to each target candidate argument.
[0253] Then, the target candidate argument with the second type score EAj>0.5 is taken as the final argument, and the role type corresponding to the final argument is obtained; and the target candidate argument with EAj≤0.5 is discarded.
[0254] For example, sA1 = 'May 13, 2023' achieves the maximum value EA1 = 0.99 when the corresponding role type is 'Date'; sA2 = 'Area B' achieves the maximum value EA2 = 0.92 when the corresponding role type is 'Location'; sA3 = 'No. 6' achieves the maximum value EA3 = 0.70 when the corresponding role type is 'House Number'; sA4 = 'Vehicle Recognition Camera' achieves the maximum value EA4 = 0.83 when the corresponding role type is 'Facility'.
[0255] According to the fault determination method for extracting fault events of smart buildings based on contrastive learning provided in the embodiment of the present application, after obtaining the target candidate arguments, the candidate arguments can be further eliminated, screened and classified according to the prediction threshold after matrix dot multiplication. This is simple and effective, and can extract arguments related to trigger words as much as possible to reduce omissions.
[0256] The fault determination method for extracting fault events for smart buildings based on contrastive learning provided in the embodiments of the present application may be executed by a fault determination device for extracting fault events for smart buildings based on contrastive learning. In the embodiments of the present application, the fault determination method for extracting fault events for smart buildings based on contrastive learning is executed by a fault determination device for extracting fault events for smart buildings based on contrastive learning as an example to illustrate the fault determination device for extracting fault events for smart buildings based on contrastive learning provided in the embodiments of the present application.
[0257] An embodiment of the present application also provides a fault determination device for extracting smart building fault events based on comparative learning.
[0258] As shown in FIG7 , the fault determination device for extracting fault events of a smart building based on contrastive learning includes: a first processing module 710 and a second processing module 720 .
[0259] A first processing module 710 is configured to input the text to be recognized into a trigger word extraction module of a target fault recognition model, and obtain at least one golden trigger word output by the trigger word extraction module;
[0260] The second processing module 720 is configured to input at least one golden trigger word into the trigger word classification module of the target fault identification model, and obtain target fault information output by the trigger word classification module;
[0261] The trigger word extraction module is trained based on a first training sample, wherein the first training sample includes a sample text and a sample golden trigger word and a sample candidate trigger word corresponding to the sample text;
[0262] The trigger word classification module is trained based on the second training sample, which includes a sample golden trigger word and a sample fault definition text corresponding to the sample golden trigger word; the sample fault definition text includes a fault type and a description corresponding to the fault type.
[0263] According to the fault determination device for extracting smart building fault events based on contrastive learning provided in the embodiment of the present application, trigger word classification is performed through fine sample labeling and training, and it is possible to effectively identify faults in complex or ambiguous texts, thereby accurately identifying various types of faults in complex and changeable building environments, and having a wide detection range, significantly improving the accuracy and precision of the target fault information predicted in the building environment, and having high versatility and wide application.
[0264] In some embodiments, the apparatus may further include a third processing module configured to: train the trigger word extraction module based on the first training sample using a contrastive learning method.
[0265] In some embodiments, the third processing module may further be configured to: construct a loss function corresponding to the trigger word extraction module based on a linear function;
[0266] The trigger word extraction module is trained with the goal of minimizing the loss function;
[0267] The loss function is:
[0268] Among them, Lt is the loss function; k is the number of sample candidate trigger words, f(Xt) is the weight value corresponding to the sample golden trigger word; f(Xt′) is the weight value corresponding to the sample candidate trigger word.
[0269] In some embodiments, the third processing module may also be used to:
[0270] Obtain the semantic representation of the sample text based on the token representation corresponding to the sample text;
[0271] Concatenate the semantic representation of the sample text with the token representation of the sample golden trigger word and the sample candidate trigger word to obtain the semantic representation of the sample golden trigger word and the semantic representation of the sample candidate trigger word;
[0272] The sample golden trigger word is used as the positive anchor point, the sample candidate trigger word is used as the negative sample, and a linear function is constructed based on the semantic representation of the sample golden trigger word and the semantic representation of the sample candidate trigger word.
[0273] In some embodiments, the apparatus may further include a fourth processing module configured to:
[0274] Based on the fault types and their corresponding descriptions, an initial fault type representation matrix is constructed;
[0275] Randomly initialize an initial fault type representation matrix to obtain a first fault type representation matrix;
[0276] With the goal of matching the maximum first-type score corresponding to the dot product of the sample golden trigger word and the first fault type representation matrix to the correct fault type, the first fault type representation matrix is trained to obtain the trigger word classification module.
[0277] In some embodiments, the fourth processing module may further be configured to:
[0278] Perform Bert encoding on the fault type and the description corresponding to the fault type to obtain the semantic representation of the fault type;
[0279] Based on the fault type semantic representation corresponding to each fault type, an initial fault type representation matrix is constructed; the size of the initial fault type representation matrix is N×H, where N is the number of fault types and H is the size of the Bert model [CLS] vector.
[0280] In some embodiments, the first processing module 710 may also be used to:
[0281] Perform keyword extraction on the text to be recognized, obtain multiple trigger words and the weight value corresponding to each trigger word;
[0282] The trigger word corresponding to the largest first target number of weight values is determined as at least one golden trigger word.
[0283] In some embodiments, the second processing module 720 may also be used to:
[0284] Perform dot multiplication of the golden trigger words and the trained first fault type representation matrix to obtain the first type score corresponding to each golden trigger word; the trigger word classification module is obtained based on the trained first fault type representation matrix;
[0285] A golden trigger word corresponding to a first type score greater than a first target threshold is determined as a final trigger word, and target fault information is determined based on the fault type corresponding to the final trigger word.
[0286] In some embodiments, the apparatus may further include a fifth processing module configured to:
[0287] After inputting at least one golden trigger word into the trigger word classification module of the target fault recognition model and obtaining the target fault information output by the trigger word classification module, a target candidate argument is determined from at least one object included in the text to be recognized based on the dependency relationship between the golden trigger word and each object in the text to be recognized.
[0288] In some embodiments, the fifth processing module may further be configured to:
[0289] Segment and reorganize the text to be recognized to obtain multiple vocabulary units;
[0290] Constructing a dependency analysis tree corresponding to the golden trigger word with the golden trigger word in the plurality of vocabulary units as a root node, wherein the dependency analysis tree includes at least one child node, and each child node corresponds to a vocabulary unit;
[0291] The lexical units corresponding to the child nodes except the root node in the dependency analysis tree are determined as target candidate arguments.
[0292] In some embodiments, the apparatus may further include a sixth processing module configured to:
[0293] After determining the target candidate argument from at least one object included in the text to be identified, the target candidate argument is input into the argument classification module of the target fault identification model to obtain the target attribute type corresponding to the target candidate argument output by the argument classification module; the argument classification module is trained based on the third training sample, and the third training sample includes a sample golden argument and a sample attribute definition text corresponding to the sample argument; the sample attribute definition text includes an attribute type and a description corresponding to the attribute type.
[0294] In some embodiments, the sixth processing module may further be configured to:
[0295] Perform dot multiplication of the target candidate argument and the trained first argument role representation matrix to obtain the second type score corresponding to each target candidate argument; the argument classification module is obtained based on the trained first argument role representation matrix;
[0296] The target candidate argument corresponding to the second type score greater than the second target threshold is determined as the final argument, and the attribute type corresponding to the final argument is determined as the target attribute type.
[0297] In some embodiments, the apparatus may further include a seventh processing module configured to:
[0298] Based on the attribute types and the descriptions corresponding to the attribute types, an initial argument role representation matrix is constructed;
[0299] Randomly initialize the initial argument role representation matrix to obtain the first argument role representation matrix;
[0300] With the goal of matching the maximum second-type score corresponding to the dot product of the sample golden argument and the first-argument role representation matrix to the correct attribute type, the first-argument role representation matrix is trained to obtain the argument classification module.
[0301] The fault determination device for extracting smart building fault events based on contrastive learning in the embodiment of the present application can be an electronic device or a component in an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices other than a terminal. For example, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a car-mounted electronic device, a mobile Internet device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc. It can also be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), an ATM or a self-service machine, etc., and the embodiment of the present application does not specifically limit it.
[0302] The fault determination device for extracting smart building fault events based on contrastive learning in the embodiments of the present application can be a device having an operating system. The operating system can be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiments of the present application.
[0303] The fault determination device for extracting fault events of smart buildings based on comparative learning provided in the embodiment of the present application can implement each process implemented in the method embodiments of Figures 1 to 6. To avoid repetition, they will not be described here.
[0304] In some embodiments, as shown in Figure 8, an embodiment of the present application also provides an electronic device 800, including a processor 801, a memory 802, and a computer program stored on the memory 802 and executable on the processor 801. When the program is executed by the processor 801, each process of the above-mentioned fault determination method embodiment for extracting fault events of smart buildings based on comparative learning is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0305] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0306] An embodiment of the present application also provides a non-transitory computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the various processes of the above-mentioned fault determination method embodiment for extracting smart building fault events based on comparative learning, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0307] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0308] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the above-mentioned fault determination method for extracting smart building fault events based on comparative learning.
[0309] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0310] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned fault determination method embodiment for extracting fault events of smart buildings based on comparative learning, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0311] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0312] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element. In addition, it should be noted that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the opposite order according to the functions involved. For example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0313] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0314] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
[0315] Throughout this specification, reference to terms such as "one embodiment," "some embodiments," "illustrative embodiments," "examples," "specific examples," or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
[0316] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions, and variations may be made to the embodiments without departing from the principles and intent of the present application, and that the scope of the present application is defined by the claims and their equivalents.
Claims
1. A fault determination method for extracting fault events of smart buildings based on contrastive learning, characterized in that: include: Inputting the text to be recognized into the trigger word extraction module of the target fault recognition model, and obtaining at least one golden trigger word output by the trigger word extraction module; Inputting the at least one golden trigger word into the trigger word classification module of the target fault identification model, and obtaining the target fault information output by the trigger word classification module; The trigger word extraction module is trained based on a first training sample, wherein the first training sample includes a sample text and a sample golden trigger word and a sample candidate trigger word corresponding to the sample text; The trigger word classification module is trained based on a second training sample, wherein the second training sample includes the sample golden trigger word and a sample fault definition text corresponding to the sample golden trigger word; the sample fault definition text includes a fault type and a description corresponding to the fault type.
2. The fault determination method for extracting fault events of smart buildings based on contrastive learning according to claim 1 is characterized in that: The trigger word extraction module is trained based on the first training sample and includes: The trigger word extraction module is trained based on the first training sample using a contrastive learning method.
3. The fault determination method for extracting fault events of smart buildings based on contrastive learning according to claim 2 is characterized in that: The method of using contrastive learning to train the trigger word extraction module based on the first training sample includes: Constructing a loss function corresponding to the trigger word extraction module based on a linear function; the linear function is used to characterize the weight value corresponding to each trigger word; Training the trigger word extraction module with the goal of minimizing the loss function; The loss function is: Among them, L t is the loss function; k is the number of the sample candidate trigger words, f(Xt) is the weight value corresponding to the sample golden trigger word; f(Xt′) is the weight value corresponding to the sample candidate trigger word.
4. The fault determination method for extracting fault events of smart buildings based on contrastive learning according to claim 3 is characterized in that: The linear function is determined based on the following steps: Based on the token representation corresponding to the sample text, obtaining the semantic representation of the sample text; Concatenate the semantic representation of the sample text with the token representations of the sample golden trigger word and the sample candidate trigger word respectively, to obtain the semantic representation of the sample golden trigger word and the semantic representation of the sample candidate trigger word; The sample golden trigger word is used as a positive anchor point, the sample candidate trigger word is used as a negative sample, and the linear function is constructed based on the semantic representation of the sample golden trigger word and the semantic representation of the sample candidate trigger word.
5. The fault determination method for extracting fault events of smart buildings based on contrastive learning according to any one of claims 1 to 4, characterized in that: The trigger word classification module is trained based on the second training sample and includes: Based on the fault types and descriptions corresponding to the fault types, construct an initial fault type representation matrix; Randomly initializing the initial fault type representation matrix to obtain a first fault type representation matrix; With the goal of corresponding the maximum first type score corresponding to the dot product of the sample golden trigger word and the first fault type representation matrix to the correct fault type, the first fault type representation matrix is trained to obtain the trigger word classification module.
6. The fault determination method for extracting fault events of smart buildings based on contrastive learning according to claim 5 is characterized in that: The constructing an initial fault type representation matrix based on the fault type and the description corresponding to the fault type includes: Performing Bert encoding on the fault type and the description corresponding to the fault type to obtain a semantic representation of the fault type; Based on the fault type semantic representation corresponding to each fault type, the initial fault type representation matrix is constructed; the size of the initial fault type representation matrix is N×H, where N is the number of fault types and H is the size of the Bert model [CLS] vector.
7. The fault determination method for extracting fault events of smart buildings based on contrastive learning according to any one of claims 1 to 6, characterized in that: The step of inputting the text to be recognized into a trigger word extraction module of a target fault recognition model and obtaining at least one golden trigger word output by the trigger word extraction module comprises: Extract keywords from the text to be recognized, and obtain multiple trigger words and weight values corresponding to each of the trigger words; The trigger word corresponding to the weight value of the largest first target quantity is determined as the at least one golden trigger word.
8. The fault determination method for extracting fault events of smart buildings based on contrastive learning according to any one of claims 1 to 7, characterized in that: The step of inputting the at least one golden trigger word into the trigger word classification module of the target fault identification model and obtaining the target fault information output by the trigger word classification module includes: The golden trigger words are multiplied by the trained first fault type representation matrix to obtain the first type score corresponding to each golden trigger word; the trigger word classification module is obtained according to the trained first fault type representation matrix; A golden trigger word corresponding to a first type score greater than a first target threshold is determined as a final trigger word, and the target fault information is determined based on the fault type corresponding to the final trigger word.
9. The fault determination method for extracting fault events of smart buildings based on contrastive learning according to any one of claims 1 to 8, characterized in that: After inputting the at least one golden trigger word into the trigger word classification module of the target fault identification model and acquiring the target fault information output by the trigger word classification module, the method further includes: Based on the dependency relationship between the golden trigger word and each object in the text to be recognized, a target candidate argument is determined from at least one object included in the text to be recognized.
10. The fault determination method for extracting fault events of smart buildings based on contrastive learning according to claim 9 is characterized in that: The step of determining a target candidate argument from at least one object included in the text to be recognized based on the dependency relationship between the golden trigger word and each object in the text to be recognized comprises: Segmenting and reorganizing the text to be recognized to obtain multiple vocabulary units; Taking the golden trigger word in the multiple vocabulary units as a root node, constructing a dependency analysis tree corresponding to the golden trigger word, wherein the dependency analysis tree includes at least one child node, and each child node corresponds to a vocabulary unit; The vocabulary units corresponding to the child nodes except the root node in the dependency analysis tree are determined as target candidate arguments.
11. The fault determination method for extracting fault events of smart buildings based on contrastive learning according to claim 9, characterized in that: After determining a target candidate argument from at least one object included in the text to be recognized, the method further includes: Inputting the target candidate argument into an argument classification module of a target fault identification model, and obtaining a target attribute type corresponding to the target candidate argument output by the argument classification module; The argument classification module is trained based on a third training sample, wherein the third training sample includes a sample golden argument and a sample attribute definition text corresponding to the sample argument; the sample attribute definition text includes an attribute type and a description corresponding to the attribute type.
12. The fault determination method for extracting fault events of smart buildings based on contrastive learning according to claim 11, characterized in that: The step of inputting the target candidate argument into an argument classification module of a target fault identification model and obtaining a target attribute type corresponding to the target candidate argument output by the argument classification module includes: Performing a dot product of the target candidate argument and the trained first argument role representation matrix to obtain a second type score corresponding to each target candidate argument; the argument classification module is obtained according to the trained first argument role representation matrix; The target candidate argument corresponding to the second type score greater than the second target threshold is determined as the final argument, and the The attribute type corresponding to the final argument determines the target attribute type.
13. The fault determination method for extracting fault events of smart buildings based on contrastive learning according to claim 11, characterized in that: The argument classification module is obtained by training based on the third training sample, and includes: Based on the attribute type and the description corresponding to the attribute type, construct an initial argument role representation matrix; Randomly initialize the initial argument role representation matrix to obtain a first argument role representation matrix; With the goal of corresponding the maximum value of the second type score corresponding to the dot product of the sample golden argument and the first argument role representation matrix to the correct attribute type, the first argument role representation matrix is trained to obtain the argument classification module.
14. A fault determination device for extracting fault events of smart buildings based on contrastive learning, characterized in that: include: A first processing module, configured to input the text to be recognized into a trigger word extraction module of a target fault recognition model, and obtain at least one golden trigger word output by the trigger word extraction module; A second processing module, configured to input the at least one golden trigger word into a trigger word classification module of the target fault identification model, and obtain target fault information output by the trigger word classification module; The trigger word extraction module is trained based on a first training sample, wherein the first training sample includes a sample text and a sample golden trigger word and a sample candidate trigger word corresponding to the sample text; The trigger word classification module is trained based on a second training sample, wherein the second training sample includes the sample golden trigger word and a sample fault definition text corresponding to the sample golden trigger word; the sample fault definition text includes a fault type and a description corresponding to the fault type.
15. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, it implements the fault determination method for extracting fault events of smart buildings based on contrastive learning as described in any one of claims 1-13.
16. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the fault determination method for extracting fault events of smart buildings based on contrastive learning as described in any one of claims 1 to 13.
17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the fault determination method for extracting fault events of smart buildings based on contrastive learning as described in any one of claims 1 to 13 is implemented.
Citation Information
Patent Citations
Statement information extraction method and device and readable storage medium
CN110704598A
Electric power fault event extraction method combining deep learning and concept map
CN111079430A
Target event extraction data processing system
CN113704476A
Fault determination method for extracting intelligent building fault event based on comparative learning
CN116628210A
Unsupervised event extraction
US20210365306A1
Cited By
Robot cable fault classification method and system based on deep tree learning
CN120217126A