Bridge technical condition text mapping rating prediction method based on HAN model
Through the dynamic mask and hierarchical attention mechanism of the HAN model, the problems of low accuracy and strong subjectivity of text analysis in bridge technology detection are solved, the accuracy and security of bridge ratings are improved, and more objective rating results are provided.
Patent Information
- Application Number
- CN202411182654.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-12-06
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing bridge technical inspection methods are insufficient when processing text context information, resulting in low detection accuracy and strong subjectivity and empirical rating results, resulting in untimely bridge maintenance and safety hazards.
The bridge technology status text mapping rating prediction method based on HAN model is adopted, and the adaptability and expression ability of the model are improved through dynamic mask operation and hierarchical attention mechanism, vocabulary relationships are analyzed, subjective bias is reduced, and detection accuracy is improved.
It improves the accuracy and context understanding of bridge rating prediction, reduces the influence of human factors, improves the accuracy of bridge technology detection, and provides more objective rating results.
Smart Images

Figure CN119090071A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of bridge technical condition prediction, and in particular to a bridge technical condition text mapping rating prediction method based on a HAN model. Background Art
[0002] According to data, by the end of 2023, there will be 1,079,300 highway bridges in China with a total length of 95,288,200 meters. The number of bridges will increase by about 72,000 per year, including 10,239 super-large bridges and 177,700 large bridges. As bridges are put into use and eroded by nature, their condition will be damaged, so they need to be inspected regularly.
[0003] At present, the technical condition of bridges is rated and corresponding repair measures are taken based on the rating results. Most of the information required for technical rating is obtained through field investigations by professional technicians. As the number of bridges is increasing, the workload of rating the technical condition of bridges is also increasing. Moreover, the technical condition rating of bridges is often directly obtained by professional technicians, and the results contain strong subjectivity and experience. Therefore, there will be errors in the technical condition rating of bridges. Errors in the technical condition rating of bridges will lead to untimely bridge maintenance, which will lead to hidden dangers to the safety of bridges.
[0004] With the advancement of deep learning technology, the accuracy of bridge technology detection has been continuously improved. At present, bridge technology mutual detection is mainly based on convolutional neural networks, Transformer networks or Yolo networks. However, these methods still have shortcomings in processing text context information, especially in parsing the relationship between different words, which will lead to low accuracy of text analysis and low accuracy of bridge technology detection. Summary of the invention
[0005] The purpose of the present invention is to solve the problem of low detection accuracy in existing bridge technical detection methods, and propose a bridge technical condition text mapping rating prediction method based on the HAN model.
[0006] A text mapping rating prediction method for bridge technical condition based on HAN model, the specific process is as follows:
[0007] S1. Obtaining a test report of the bridge to be tested, preprocessing the test report of the bridge to be tested, and obtaining a digital matrix to be tested;
[0008] The test report of the bridge to be tested is preprocessed to obtain the digital matrix to be tested, specifically:
[0009] Encode each sentence in the bridge inspection report to be tested into a digital representation, use the digital representation corresponding to each sentence as a row of the matrix, and then fill the vacant positions of the matrix with zeros, so as to obtain the digital matrix to be tested corresponding to the bridge inspection report to be tested;
[0010] S2, input the digital matrix to be tested into the trained HAN model to obtain the technical rating of the bridge to be tested;
[0011] The higher the technical level of the bridge to be tested is, the worse the technical condition of the bridge to be tested is;
[0012] The trained HAN model is obtained in the following way:
[0013] Step 1: Obtain a bridge inspection report data set, preprocess the bridge inspection report data set, and obtain a digital matrix;
[0014] Step 2: Use the bridge inspection report ratings as labels of the digital matrix to form a training set, and use the training set to train the HAN model to obtain a trained HAN model.
[0015] Furthermore, in the step 1, a bridge inspection report data set is obtained, and the bridge inspection report data set is preprocessed to obtain a digital matrix, specifically:
[0016] Step 1. Obtain bridge inspection report and bridge inspection report rating;
[0017] Step 1 and 2: Preprocess the bridge inspection report data set to obtain a digital matrix:
[0018] Encode each sentence in the bridge inspection report into a digital representation, and use the encoded representation of each sentence as a row of the matrix. Then fill the vacant positions with zeros to obtain the digital matrix M corresponding to the bridge inspection report. s .
[0019] Furthermore, the HAN model includes: a mask module, a first encoding module, a first attention mechanism module, a second encoding module, a second attention mechanism module and a rating module;
[0020] The mask module is used to s Perform dynamic mask processing to obtain a mask matrix, and then perform softmax processing on the mask matrix to obtain a data sequence for each row of the mask matrix;
[0021] The first encoding module is a bidirectional GRU sequence encoder; the first encoding module is used to encode each data in each row of the mask matrix data sequence to obtain a word-level context encoding representation;
[0022] The first attention mechanism module is used to assign attention weights to word-level context encoding representations;
[0023] The second encoding module is a bidirectional GRU sequence encoder; the second encoding module encodes each row of data sequence in the mask matrix using the attention weight represented by the word-level context encoding to obtain a sentence-level context encoding representation;
[0024] The second attention mechanism module is used to assign attention weights to the sentence-level context encoding representation, and obtain the bridge inspection report document vector d using the sentence-level context encoding representation;
[0025] The rating module is used to rate the bridge inspection report document vector d to obtain the rating of the bridge inspection report;
[0026] The rating of the bridge inspection report is the bridge technical rating.
[0027] Furthermore, the mask module is used to s Perform dynamic mask processing to obtain the mask matrix, and then perform softmax processing on the mask matrix to obtain the data sequence of each row of the mask matrix, specifically:
[0028] A1. For the digital matrix M s Perform dynamic Mask processing to obtain the digital matrix M after Mask operation s :
[0029] Get the digital matrix M s δ% of the characters in the matrix η are taken, which is the matrix η; γ% of the characters in the matrix η are taken and the characters are hidden; γ'% of the characters in the matrix η are taken and the characters remain unchanged; γ"% of the characters in the matrix η are taken and the characters are replaced with the digital codes of other words in the current sentence;
[0030] Among them, the sum of γ'%, γ"% and γ% is 100%, and δ, γ, γ', γ" are random numbers;
[0031] A2. The digital matrix M after the Mask operation s The hidden characters are set to 0 and the non-hidden characters are set to 1, thus obtaining the same digital matrix M s Boolean matrices of the same size, and then use the Boolean matrix as a mask matrix;
[0032] A3. Perform softmax processing on the mask matrix to obtain the data sequence of each row of the mask matrix.
[0033] Furthermore, the first encoding module is used to encode each data in each row of the data sequence of the mask matrix to obtain a word-level context encoding representation, specifically:
[0034]
[0035] Among them, h i,t' is the word-level context encoding representation corresponding to the t'th element in the i-th row in the mask matrix, is the positive word-level context encoding representation, is the reverse word-level context encoding representation, It is the forward encoding operation of the GRU sequence encoder. is the reverse encoding operation of the GRU sequence encoder, t' is the word label, T i is the total number of words in the i-th row of the mask matrix.
[0036] Furthermore, the first attention mechanism module is used to assign attention weights to the word-level context encoding representation, specifically:
[0037]
[0038] u it’ =tanh(W w h it’ +b w )
[0039] Among them, α it’ Yes it' The attention weight, u it’ Yes it’ The hidden representation of W w is the weight matrix of the fully connected layer, b w is the bias of the fully connected layer, u w is the word-level context vector.
[0040] Furthermore, the second encoding module encodes each row of data sequence in the mask matrix using the attention weight of the word-level context encoding representation to obtain the sentence-level context encoding representation, specifically:
[0041]
[0042]
[0043] Among them, h i is the sentence-level context encoding representation of the i-th row of data in the mask matrix, s i is the i-th row data of the mask matrix, is the positive sentence-level context encoding representation, is the reverse sentence-level context encoding representation, and L is the total number of rows in the mask matrix.
[0044] Furthermore, the second attention mechanism module is used to assign attention weights to the sentence-level context encoding representation, and obtain the bridge inspection report document vector d using the sentence-level context encoding representation, specifically:
[0045]
[0046] u i =tanh(W s h i +b s )
[0047] Among them, d is the bridge inspection report document vector, α i Yes i The attention weight, u i Yes i The hidden representation of u s is the sentence-level context vector, W s is the weight matrix of the fully connected layer, b s is the bias of the fully connected layer.
[0048] Furthermore, the rating module is used to rate the bridge inspection report document vector d to obtain the rating of the bridge inspection report, specifically:
[0049] First, obtain the softmax probability score of the current bridge inspection report rating k:
[0050]
[0051] q=W d d+b d
[0052] Among them, p k is the softmax probability score of the rating k of the current bridge inspection report, K is the total number of levels of the bridge inspection report, q is the conditional rating feature matrix, q k is the kth element in the conditional rating feature matrix, q k′ is the k'th element in the conditional rating feature matrix, W d is the weight matrix of the fully connected layer, b d is the bias of the fully connected layer;
[0053] Then, the rating corresponding to the maximum rating probability of the current bridge inspection report is used as the rating of the current bridge inspection report, that is, the technical rating of the bridge.
[0054] Furthermore, the HAN model is trained using a cross entropy loss function.
[0055] The beneficial effects of the present invention are:
[0056] The present invention is based on the Hierarchical Attention Network (HAN) model, and adopts dynamic masking operations and classification rating methods to improve the adaptability and flexibility of the HAN model. The main features of the present invention include: 1) By preprocessing the data set, the data is organized into multiple categories of raw data, so that the technical condition of the bridge can be effectively rated; 2) In the text prediction stage, the expression ability of the HAN model is significantly enhanced by introducing dynamic masking operations, so that the bridge rating prediction can more effectively capture the key information in the text, thereby improving the overall performance of the bridge rating prediction and context understanding ability; 3) The present invention adopts a classification rating method to provide accurate and objective ratings for bridge technical status reports, thereby reducing the subjective and empirical biases caused by human factors; The present invention analyzes the relationship between different words by dynamically masking, word encoding, and sentence encoding in sequence, thereby improving the accuracy of parsing the relationship between words, improving the accuracy of text analysis, and thus improving the accuracy of bridge technical detection, BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 This is the network structure diagram of the HAN model;
[0058] Figure 2 It is a schematic diagram of dynamic mask operation;
[0059] Figure 3 This is a schematic diagram of the classification rating operation. DETAILED DESCRIPTION
[0060] The present invention adopts the HAN network architecture of Encoder+Attention+Mask, in which the Encoder part adopts the GRU sequence encoder, which makes the model better at processing long sequence data in the bridge analysis report; the Attention part adopts the hierarchical attention mechanism, which aims to provide interpretability of which sentences and words are emphasized when assigning condition ratings through the hierarchical attention mechanism; the mask module (Mask) adopts dynamic Mask operation to enable the model to learn more comprehensive language features and reduce the risk of model overfitting. Next, the present invention is explained in conjunction with specific embodiments.
[0061] Specific implementation method 1: This implementation method is a bridge technical condition text mapping rating prediction method based on the HAN model. The specific process is as follows:
[0062] S1. Obtaining a test report of the bridge to be tested, preprocessing the test report of the bridge to be tested, and obtaining a digital matrix to be tested;
[0063] The test report of the bridge to be tested is preprocessed to obtain the digital matrix to be tested, specifically:
[0064] Encode each sentence in the bridge inspection report to be tested into a digital representation, use the number of each sentence as a row of the matrix, and fill the vacant positions of the matrix with zeros, so as to obtain the digital matrix M' corresponding to the bridge inspection report to be tested s ;
[0065] S2, input the digital matrix to be tested into the trained HAN model to obtain the technical rating of the bridge to be tested;
[0066] The technical rating of the bridge to be tested is 1-5, and the higher the rating, the worse the technical condition of the bridge to be tested;
[0067] The trained HAN model is obtained in the following way:
[0068] Step 1: Obtain the bridge inspection report dataset, preprocess the bridge inspection report dataset, and obtain a digital matrix:
[0069] Step 1. Obtain the bridge inspection report and bridge inspection report rating in the Bridge Inspection Report;
[0070] The Bridge Inspection Report contains real report information of 42 bridges in Harbin and other places, and the bridge reports are classified and rated into 5 categories. The classification levels and data processing examples are shown in Table 1. Among them, the classification rating is based on the "Highway Bridge Technical Condition Assessment Standard" in the "Announcement of the Ministry of Transport of the People's Republic of China"; the present invention predicts the category of the text content in the report, and can give professional inspectors objective suggestions such as minor repairs, medium repairs, reinforcement, and reconstruction through the obtained prediction results.
[0071] Table 1
[0072]
[0073] Step 1 and 2: Preprocess the bridge inspection report data set to obtain a digital matrix:
[0074] Encode each sentence in the bridge inspection report into a digital representation, then use the digital encoding representation of each sentence as a row of the matrix, and fill the vacant positions with zeros to obtain the digital matrix M corresponding to the bridge inspection report s ;
[0075] Step 2: Use the bridge inspection report rating as the label of the digital matrix to form a training set, and use the training set to train the HAN model to obtain the trained HAN model, specifically:
[0076] Step 21: Use the bridge inspection report ratings as labels of the digital matrix to form a training set;
[0077] Step 22: Use the training set to train the HAN model to obtain a trained HAN model;
[0078] like Figure 1 As shown, the HAN model includes: a mask module, a first encoding module, a first attention mechanism module, a second encoding module, a second attention mechanism module, and a rating module;
[0079] The mask module is used to s Perform dynamic mask processing to obtain a mask matrix, and then perform softmax processing on the mask matrix to obtain a data sequence for each row of the mask matrix;
[0080] The first encoding module is a bidirectional GRU sequence encoder, and the first encoding module is used to encode each data in each row of the mask matrix data sequence to obtain a word-level context encoding representation;
[0081] The first attention module is a hierarchical attention mechanism; the first attention module is used to assign attention weights to word-level context encoding representations;
[0082] The second encoding module is a bidirectional GRU sequence encoder; the second encoding module encodes each row of data sequence in the mask matrix using the attention weight represented by the word-level context encoding to obtain a sentence-level context encoding representation;
[0083] The second attention module is a hierarchical attention mechanism; the second attention module is used to assign attention weights to the sentence-level context encoding representation, and obtain the bridge inspection report document vector d using the sentence-level context encoding representation;
[0084] The rating module is used to rate the bridge inspection report document vector d to obtain the rating of the bridge inspection report.
[0085] Specific implementation method 2: The mask module is used to s Perform dynamic mask processing to obtain the mask matrix, and then perform softmax processing on the mask matrix to obtain the data sequence of each row of the mask matrix, specifically:
[0086] A1. For the digital matrix M s Perform dynamic Mask processing to obtain the digital matrix M after Mask operation s :
[0087] For the digital matrix M s Randomly replace 15% of the characters, hide 80% of the replaced characters, keep 10% as the original characters, and replace 10% with other words in the sentence;
[0088] A2. The digital matrix M after the Mask operation s The hidden part is set to 0, and the hidden part is set to 1, so as to obtain the same digital matrix M s Boolean matrices of the same size, and then use the Boolean matrix as a mask matrix;
[0089] A3. The mask matrix is processed by softmax, and the attention score of the mask matrix is assigned to negative infinity, so as to obtain the data sequence of each row of the mask matrix.
[0090] In this embodiment, the mask module (Mask) uses a dynamic Mask operation to enable the model to learn more comprehensive language features and reduce the risk of model overfitting. In current text analysis methods, multi-head attention mechanisms or self-attention mechanisms are usually used to perform text analysis and extract contextual information. These mechanisms enable the model to effectively capture long-distance dependencies and have the ability to process text information in parallel. However, for the text analysis of the technical status of bridges, the multi-head attention mechanism and the self-attention mechanism cannot capture the internal context of the text very well. The present invention processes the content of the data set in a hierarchical manner, and uses a hierarchical attention mechanism to process the text information of the technical status of bridges. The hierarchical attention mechanism can enhance the ability to understand context, more effectively capture information at different levels in the text, highlight key information within the text, and improve the interpretability of the model. In order to better improve the accuracy of the model and its predictive ability for text, the present invention performs Mask processing before word-level encoding to improve the predictive ability of the model, such as Figure 2 As shown, when calculating the attention weight at the word level, a dynamic Mask is used to filter out invalid padding parts, and the encoding of each word level is used in the encoding input part of the sentence level to generate a context vector. When calculating the sentence level attention weight, a dynamic Mask is used to filter out sentences that do not need to be paid attention to. In order to avoid the influence of the masked sentence part, the present invention assigns negative infinity to the attention score in the matrix processed by the Mask in the final softmax function normalization process, ensuring that these sentences will not be selected in the subsequent softmax operation.
[0091] Specific implementation method three: The first encoding module is used to encode each data in each row of the mask matrix data sequence to obtain a word-level context encoding representation, specifically:
[0092]
[0093] Among them, w i,t' is the t'th data in the ith row of the mask matrix (i.e. the t'th word in the ith sentence), is the positive word-level context encoding representation, is the reverse word-level context encoding representation, It is the forward encoding operation of the GRU sequence encoder. is the reverse encoding operation of the GRU sequence encoder, h i,t' is the word-level context encoding representation corresponding to the t'th element in the i-th row of the mask matrix, t' is the word label, T i is the total number of words in the i-th row of the mask matrix;
[0094] This step is for word w it’ , using the bidirectional GRU sequence encoder to exploit the dependencies within the sequence, the context information from both directions is encoded into a new representation sequence, namely the forward word-level context encoding representation With reverse word-level context encoding representation Connect to get h i,t' ;
[0095] The forward encoding operation of the GRU sequence encoder and the reverse encoding operation of the GRU sequence encoder are specifically:
[0096] h t =(1-u t )⊙w t-1 +u t ⊙tanh(W hh (r t ⊙h t-1 )+W hx w t +b h )
[0097] Update Gate t It is used to determine how much sequence information of the previous output is saved and how much information is reset at the reset gate r. t After adding more sequence information, the update gate is calculated by the following formula:
[0098] u t =σ(W uh h t-1 +W ux w t +b u )
[0099] The reset gate is used to control the t-1 The information of the current h t Contribution, the reset gate is calculated by the following formula:
[0100] r t =σ(W rh h t-1 +W rx w t +b r )
[0101] The Logistic Sigmoid function is obtained by multiplying σ element by element. The function calculation formula is:
[0102]
[0103] Among them, w t is the input data at time step t, h t is the data output by the GRU sequence encoding at time step t, h t-1 is the GRU sequence encoding output data at time step t-1, u t is the update gate output, W hh W represents the hidden state matrix in the GRU gating mechanism, which is mainly used to control the retention and forgetting of information; hx Represents the input weight matrix in the GRU gating mechanism, which is mainly used to control the introduction of new information. ,b h They are the bias of the GRU gating mechanism, r t is the output of the reset gate, σ() is the sigmoid() function, and W uh , W ux They are respectively the update gate h t-1 、w t The weight matrix, b u is the bias of the update gate, W rh , W rx They are h in the reset gate t-1 、w t The weight matrix, b r is the bias of the reset gate, x is a variable, and ⊙ represents element-by-element multiplication;
[0104] For the first encoding module, the input data at time step t is the t'th data w in the i-th row of the mask matrix i,t' ; For the second encoding module, the input data at time step t is the i-th row data s of the mask matrix i ;
[0105] The first attention module is used to assign attention weights to the word-level context encoding representation, specifically:
[0106] In a sentence, the importance of each word in conveying meaning is not the same, and some words should be given more attention. For example, in the sentence "the weeds on the slope of the platform are growing, and the masonry joints are falling off", for the classification and rating of bridge technology, a higher weight ratio should be set for the words "fall off" and "fall off". The word-level context encoding represents the allocation of attention weights using the word-level attention calculation formula:
[0107]
[0108] u it’ =tanh(Ww h it’ +b w )
[0109] Among them, α it’ Yes it' The attention weight, u it’ Yes it’ The hidden representation of W w is the weight matrix of the fully connected layer, b w is the bias of the fully connected layer, u w is the word-level context vector (a randomly initialized vector);
[0110] Word it’ The weight of u it’ The similarity between the word-level context vector u2 is evaluated, and then the normalized word attention weight α is calculated using the softmax function it’ In this formula, the attention weight of each word is based on the current word and u w The similarity of u is calculated. w is a random initialization vector, which is learned during model training along with other parameters included in the attention mechanism.
[0111] The second encoding module encodes each row of data sequence in the mask matrix using the attention weight represented by the word-level context encoding to obtain the sentence-level context encoding representation, specifically:
[0112]
[0113] Among them, h i is the sentence-level context encoding representation of the i-th row of data in the mask matrix, s i is the i-th row data of the mask matrix, is the positive sentence-level context encoding representation, is the reverse sentence-level context encoding representation, L is the total number of rows in the mask matrix (i.e., the total number of sentences in a bridge inspection report);
[0114] Forward sentence-level context encoding representation With reverse sentence-level context encoding Indicates that the connection is obtained i ;
[0115] The second encoding module The operation is the same as that in the first encoding module. The same applies to operations;
[0116] The second attention module is used to assign attention weights to the sentence-level context encoding representation, and obtain the bridge inspection report document vector d using the sentence-level context encoding representation, specifically:
[0117]
[0118] u i =tanh(W s h i +b s )
[0119] Among them, d is the bridge inspection report document vector, α i Yes i The attention weight, u i Yes i The hidden representation of u s is the sentence-level context vector (a randomly initialized vector), W s is the weight matrix of the fully connected layer, b s is the bias of the fully connected layer;
[0120] Sentence attention transforms the encoded sentence representation h into a i Aggregated into document-level representation, sentence attention weight α i Calculate the normalized sentence weight, which is u i and the sentence-level context vector u s The context vector u s The vectors are also learned and randomly initialized during the training process. The final bridge inspection report document vector d provides a high-level representation of the information within the technical report on the bridge condition and is used as a feature to map to the condition rating.
[0121] In this implementation, the HAN network architecture of Encoder+Attention+Mask is adopted, in which the Encoder part (the first encoding module and the second encoding module) adopts the GRU sequence encoder, which makes the model better at processing long sequence data in the bridge analysis report; the Attention part adopts the hierarchical attention mechanism, which aims to provide interpretability of which sentences and words are emphasized when assigning condition ratings through the hierarchical attention mechanism; in actual application scenarios, the model first uses the GRU sequence encoder, which encodes the word-level and sentence-level representation sequences through text context information, and the GRU node uses a gating mechanism to control the information flow between the input sequence (a row in the mask matrix). There are two types of gates in this gating mechanism, including a reset gate r t and update gate u t The reset gate in GRU is used to control the reset gate from the previous hidden state h t-1 The information of the current h t Contribute. Update the gate tIt is used to determine how much sequence information of the previous output is saved and how much information is reset at the reset gate r. t How much sequence information is added afterwards. The present invention uses a bidirectional GRU sequence encoder to exploit the dependencies within the sequence and encode context information from two directions into a new representation sequence.
[0122] Specific implementation method three: Figure 3 As shown, the rating module is used to rate the bridge inspection report document vector d to obtain the rating of the bridge inspection report, specifically:
[0123] First, obtain the softmax probability score of the current bridge inspection report with a rating of k:
[0124]
[0125] q=W d d+b d
[0126] Where K is the total number of levels of bridge inspection reports, k, k' is the rating number of bridge inspection reports, and p∈R K , p is p k The matrix composed of k is the softmax probability score of the current bridge inspection report with a rating of k, q k is the k'th element in the conditional rating feature matrix, q∈R K , q is the conditional rating feature matrix, W d is the weight matrix of the fully connected layer, b d is the bias of the fully connected layer;
[0127] Then, the rating corresponding to the maximum rating probability of the current bridge inspection report is used as the rating of the current bridge inspection report.
[0128]
[0129] The theory of the rating standard in this implementation method comes from the bridge technical condition evaluation formula in the "Highway Bridge Technical Condition Evaluation Standard", and its calculation formula is as follows:
[0130]
[0131] When n=1, U n =U1=DP i'1 ;
[0132] When n ≥ 2,
[0133] Among them, DP i’j =100, PMCI lor BMCI l or DMCI l =0;
[0134] In the above formula, PMCI l Represents the score of the i'th category l member of the bridge superstructure, BMCI l Represents the score of the i'th category l component of the bridge substructure, DMCI l Represents the score of the bridge deck component of the i'th category, PMCI l BMCI l DMCI l ∈[0,100], k* represents the number of indicators for which the i'th type of component l component has deductions, n is the number of indicators for which the i'th type of component l component has deductions, DP i'j is the deduction value of the jth type of inspection index of the i'th type component l, m∈[1,n-1], U m is the score value of the mth deduction indicator;
[0135] Specific implementation method 4: The HAN model is trained using a cross entropy loss function, specifically:
[0136] L(p,y)=-log(p y )
[0137] Where p is p k The matrix is composed of y, which is the rating of the bridge rating report, p y is the predicted probability of having a rating of y;
[0138] Example: In order to verify the accuracy of the present invention, the present invention uses the following indicators to evaluate the HAN model, specifically:
[0139] (1) Accuracy (ACC0 and ACC1)
[0140]
[0141] Among them, N is the total number of samples, that is, the number of samples involved in the calculation, is the predicted target level of the j'th sample, y j' is the correct rating of the j'th sample;
[0142] (2) Mean Square Error (MSE):
[0143]
[0144] (3) Mean absolute error (MAE):
[0145]
[0146] Based on the above indicators, it can be proved that the HAN model proposed in the present invention has better effect.
Claims
1. A text mapping rating prediction method for bridge technical condition based on HAN model, characterized by The specific process of the method is: S1. Obtaining a test report of the bridge to be tested, preprocessing the test report of the bridge to be tested, and obtaining a digital matrix to be tested; The test report of the bridge to be tested is preprocessed to obtain the digital matrix to be tested, specifically: Encode each sentence in the bridge inspection report to be tested into a digital representation, use the digital representation corresponding to each sentence as a row of the matrix, and then fill the vacant positions of the matrix with zeros, so as to obtain the digital matrix to be tested corresponding to the bridge inspection report to be tested; S2, input the digital matrix to be tested into the trained HAN model to obtain the technical rating of the bridge to be tested; The higher the technical level of the bridge to be tested is, the worse the technical condition of the bridge to be tested is; The trained HAN model is obtained in the following way: Step 1: Obtain a bridge inspection report data set, preprocess the bridge inspection report data set, and obtain a digital matrix; Step 2: Use the bridge inspection report ratings as labels of the digital matrix to form a training set, and use the training set to train the HAN model to obtain a trained HAN model.
2. According to claim 1, a bridge technical condition text mapping rating prediction method based on the HAN model is characterized by: In the step 1, a bridge inspection report data set is obtained, and the bridge inspection report data set is preprocessed to obtain a digital matrix, which is specifically: Step 1. Obtain bridge inspection report and bridge inspection report rating; Step 1 and 2: Preprocess the bridge inspection report data set to obtain a digital matrix: Encode each sentence in the bridge inspection report into a digital representation, and use the encoded representation of each sentence as a row of the matrix. Then fill the vacant positions with zeros to obtain the digital matrix M corresponding to the bridge inspection report. s .
3. The method for predicting bridge technical condition text mapping rating based on HAN model according to claim 2 is characterized by: The HAN model includes: a mask module, a first encoding module, a first attention mechanism module, a second encoding module, a second attention mechanism module and a rating module; The mask module is used to s Perform dynamic mask processing to obtain a mask matrix, and then perform softmax processing on the mask matrix to obtain a data sequence for each row of the mask matrix; The first encoding module is a bidirectional GRU sequence encoder; the first encoding module is used to encode each data in each row of the mask matrix data sequence to obtain a word-level context encoding representation; The first attention mechanism module is used to assign attention weights to word-level context encoding representations; The second encoding module is a bidirectional GRU sequence encoder; the second encoding module encodes each row of data sequence in the mask matrix using the attention weight represented by the word-level context encoding to obtain a sentence-level context encoding representation; The second attention mechanism module is used to assign attention weights to the sentence-level context encoding representation, and obtain the bridge inspection report document vector d using the sentence-level context encoding representation; The rating module is used to rate the bridge inspection report document vector d to obtain the rating of the bridge inspection report; The rating of the bridge inspection report is the bridge technical rating.
4. The method for predicting bridge technical condition text mapping rating based on HAN model according to claim 3 is characterized by: The mask module is used to s Perform dynamic mask processing to obtain the mask matrix, and then perform softmax processing on the mask matrix to obtain the data sequence of each row of the mask matrix, specifically: A1. For the digital matrix M s Perform dynamic Mask processing to obtain the digital matrix M after Mask operation s : Get the digital matrix M s δ% of the characters in the matrix η are taken, which is the matrix η; γ% of the characters in the matrix η are taken and the characters are hidden; γ'% of the characters in the matrix η are taken and the characters remain unchanged; γ"% of the characters in the matrix η are taken and the characters are replaced with the digital codes of other words in the current sentence; Among them, the sum of γ'%, γ"% and γ% is 100%, and δ, γ, γ', γ" are random numbers; A2. The digital matrix M after the Mask operation s The hidden characters are set to 0 and the non-hidden characters are set to 1, thus obtaining the same digital matrix M s Boolean matrices of the same size, and then use the Boolean matrix as a mask matrix; A3. Perform softmax processing on the mask matrix to obtain the data sequence of each row of the mask matrix.
5. The method for predicting bridge technical condition text mapping rating based on HAN model according to claim 4 is characterized by: The first encoding module is used to encode each data in each row of the mask matrix data sequence to obtain a word-level context encoding representation, specifically: Among them, h i,t' is the word-level context encoding representation corresponding to the t'th element in the i-th row in the mask matrix, is the positive word-level context encoding representation, is the reverse word-level context encoding representation, It is the forward encoding operation of the GRU sequence encoder. is the reverse encoding operation of the GRU sequence encoder, t' is the word label, T i is the total number of words in the i-th row of the mask matrix.
6. The method for predicting bridge technical condition text mapping rating based on HAN model according to claim 5 is characterized by: The first attention mechanism module is used to assign attention weights to the word-level context encoding representation, specifically: u it’ =tanh(W w h it’ +b w ) Among them, α it’ Yes it' The attention weight, u it’ Yes it’ The hidden representation of W w is the weight matrix of the fully connected layer, b w is the bias of the fully connected layer, u w is the word-level context vector.
7. The method for predicting bridge technical condition text mapping rating based on HAN model according to claim 6 is characterized by: The second encoding module encodes each row of data sequence in the mask matrix using the attention weight represented by the word-level context encoding to obtain the sentence-level context encoding representation, specifically: Among them, h i is the sentence-level context encoding representation of the i-th row of data in the mask matrix, s i is the i-th row data of the mask matrix, is the positive sentence-level context encoding representation, is the reverse sentence-level context encoding representation, and L is the total number of rows in the mask matrix.
8. The method for predicting bridge technical condition text mapping rating based on HAN model according to claim 7 is characterized by: The second attention mechanism module is used to assign attention weights to the sentence-level context encoding representation, and use the sentence-level context encoding representation to obtain the bridge inspection report document vector d, specifically: u i =tanh(W s h i +b s ) Among them, d is the bridge inspection report document vector, α i Yes i The attention weight, u i Yes i The hidden representation of u s is the sentence-level context vector, W s is the weight matrix of the fully connected layer, b s is the bias of the fully connected layer.
9. The method for predicting bridge technical condition text mapping rating based on HAN model according to claim 8 is characterized by: The rating module is used to rate the bridge inspection report document vector d to obtain the rating of the bridge inspection report, specifically: First, obtain the softmax probability score of the current bridge inspection report rating k: q=W d d+b d Among them, p k is the softmax probability score of the rating k of the current bridge inspection report, K is the total number of levels of the bridge inspection report, q is the conditional rating feature matrix, q k is the kth element in the conditional rating feature matrix, q k′ is the k'th element in the conditional rating feature matrix, W d is the weight matrix of the fully connected layer, b d is the bias of the fully connected layer; Then, the rating corresponding to the maximum rating probability of the current bridge inspection report is used as the rating of the current bridge inspection report, that is, the technical rating of the bridge.
10. The method for predicting bridge technical condition text mapping rating based on HAN model according to claim 9 is characterized by: The HAN model is trained using a cross entropy loss function.
Citation Information
Patent Citations
Method and system for applying metadata to data sets of file objects
CA2668306A1
Bridge health evaluation method
CN108629144A
Document vector generation method
CN110852070A
Bridge technical condition grade rapid identification method based on natural language processing
CN114036258A
