Bridge bearing fault identification method based on space attention
Technical Field
The invention relates to a bridge bearing fault identification method based on space attention, and belongs to the technical field of civil engineering and artificial intelligence interaction.
Background
With the rapid development of infrastructure construction, the civil engineering industry develops rapidly, and after a large number of bridges are constructed, the bridge support is an important stressed component of the bridge, and diseases such as aging, cracking and the like can occur in the long-term service process, so that the normal use function of the bridge support is influenced. People always rely on means such as daily and periodic inspection, sampling and temporary inspection and the like to acquire relevant information of the structure. However, the existing bridge appearance detection mainly depends on manual detection, the method is low in efficiency, long in time consumption and high in cost, the manual detection method is greatly influenced by factors such as environment, professional technical literacy of detection personnel and the like, and the detection result is uncertain.
The image processing technology based on deep learning is rapidly developed and widely applied to various industries, however, a deep learning model usually needs a large amount of labeled data to be trained so as to achieve higher precision. In actual engineering, some disease image data are difficult to obtain, and the support is used as a connecting member of a bridge, so that other members and some background information are included in the image acquisition engineering, which is difficult to avoid, and the identification result of the model is influenced. Therefore, a method for improving the identification precision of the model under the conditions of limited data set and complex scene is urgently needed.
Disclosure of Invention
The invention aims to solve the technical problem of providing a bridge support fault identification method based on space attention, which is used for improving the training efficiency and the precision of a neural network for identifying bridge support faults.
The invention adopts the following technical scheme for solving the technical problems: the invention designs a bridge support fault identification method based on space attention, which is characterized in that a target neural network based on a space attention system for identifying bridge support faults is trained and obtained by applying the following steps A to E based on a plurality of sample images respectively only containing one bridge support; the target neural network comprises a space coordinate generation network and a classification network; then, sequentially applying the space coordinates to generate a network and a classification network aiming at a target image to be detected, so as to obtain a classification result of the bridge bearing contained in the target image;
a, respectively associating each sample image with a preset classification label type of a bridge support contained in the sample image to construct a bridge support sample image database;
b, defining a minimum rectangular area where a bridge support is located in a sample image as a spatial attention area, and constructing a spatial coordinate generation network by taking the sample image as input and four spatial coordinates of the spatial attention area in the sample image as output based on a bridge support sample image database, wherein the four spatial coordinates of the spatial attention area are xmin,ymin,xmax,ymaxWherein x ismin,yminThe abscissa and ordinate, x, of the upper left corner of the spatial attention areamax,ymaxThe horizontal coordinate and the vertical coordinate of the right lower corner point of the spatial attention area are shown;
step C, aiming at each sample image, according to four space coordinates of a space attention area in the sample image, applying a lattice point generating function to obtain coordinates of each lattice point under the corresponding preset proportion grid division in the space attention area in the sample image, and then entering the step D;
step D, aiming at each sample image, obtaining the pixel value of each lattice point in a space attention area in the sample image through a preset interpolation method, and obtaining a processed image which corresponds to each sample image and is based on an attention mechanism;
and E, constructing a classification network which takes the pictures of the sample images based on the attention mechanism as input and the classes of the support images in the corresponding sample images as output based on the labels in the bridge support sample image database and the pictures of the sample images based on the attention mechanism, taking the difference between the output classes of the classification network and the label classes in the step A as a target of network optimization, and performing end-to-end iterative training on the spatial coordinates to generate a network and the classification network to obtain a target neural network.
As a preferred technical scheme of the invention, in the step a, the different states of the bridge support included in the constructed bridge support sample image database include both a normal support state and states of various support diseases preset in the service process of the bridge.
In a preferred embodiment of the present invention, in step a, the resolution of the image in the constructed bridge support sample image database is above 800 × 600.
As a preferred technical solution of the present invention, the spatial coordinate generation network in step B includes a convolutional layer, a pooling layer, and a full connection layer.
As a preferred embodiment of the present invention, in step C, the lattice point generating function generates image lattice points according to a proportional relationship between 4 image coordinates generated by the attention mechanism and the original image, and the lattice point generating function is described as follows:
wherein, x'ijIs the corresponding abscissa, y 'of the grid point i, j in the original image'ijIs the corresponding ordinate of the grid point i, j in the original image, w 'is the width of the preset grid point image, h' is the height of the corresponding preset grid point image, xijIs the abscissa, y, of the grid point i, j in the preset grid point imageijIs the ordinate of the grid point i, j in the preset grid point image.
As a preferred embodiment of the present invention, in step D, the preset interpolation method is a differentiable interpolation method to meet the requirement of error back propagation.
As a preferred technical solution of the present invention, in step E, the classification network is a neural network that satisfies the preset specified feature characterization capability.
As a preferred technical solution of the present invention, the neural network with the preset designated feature characterization capability is VGG or ResNet.
As a preferred technical solution of the present invention, in step E, a gradient descent method is selected for iterative training of the target neural network.
Compared with the prior art, the bridge bearing disease identification method based on space attention has the following technical effects:
according to the method, under a limited data set, a target neural network consisting of a spatial attention mechanism is obtained through a combined training spatial coordinate generation network and a classification network, aiming at a bridge support image to be detected, an interested area in the bridge support image is firstly identified, and then whether the bridge support is damaged or not and the type of the damage are obtained through the classification network.
Drawings
FIG. 1 is a flow chart of the present invention;
FIG. 2 is a schematic diagram of a spatial coordinate generation network in accordance with the present invention;
FIG. 3 is a schematic flow chart of the method for obtaining attention area according to the present invention;
fig. 4 is a schematic diagram of a VGG-16 classification network used in the present invention.
Detailed Description
The following description will explain embodiments of the present invention in further detail with reference to the accompanying drawings.
The hardware conditions for training the convolutional neural network of the present embodiment are: the amazon AWS cloud computing service is enabled to configure an amazon EC2P2.xlarge instance, the instance is configured with 1 GPU, 4 vCPUs, 61GB random access memories, the system adopts an ubuntu system, the programming language adopts python, and the deep learning platform uses pytorch.
As shown in the flowchart of fig. 1, in the method for identifying a bridge bearer fault based on spatial attention implemented in this embodiment, 5000 sample images with a resolution of more than 800 × 600 are selected, each sample image respectively includes different states of the bridge bearer, including a normal bearer state and states of various bearer faults preset in the bridge service process, where the bridge bearer states in the sample images in this embodiment include three types of a normal bearer, a cracked bearer, and a shear deformation bearer.
Based on the sample image, the following steps A to E are applied, and a target neural network which is used for identifying the bridge support diseases and is based on a space attention mechanism is trained and obtained; the target neural network comprises a space coordinate generation network and a classification network.
And A, respectively associating each sample image with a preset classification label type of the bridge support contained in the sample image to construct a bridge support sample image database, wherein the classification label in the embodiment contains three types of bridge supports, namely a normal support, a cracking support and a shearing deformation support.
Step B, as shown in FIG. 2, defining a minimum rectangular area where a bridge support is located in a sample image as a spatial attention area, constructing a spatial coordinate generation network based on a bridge support sample image database, wherein the spatial coordinate generation network takes the sample image as input and four spatial coordinates of the spatial attention area in the sample image as output, and comprises a convolution layer, a pooling layer and a full-connection layer, wherein the four spatial coordinates of the spatial attention area are xmin,ymin,xmax,ymaxWherein x ismin,yminThe abscissa and ordinate, x, of the upper left corner of the spatial attention areamax,ymaxThe abscissa and the ordinate of the lower right corner of the spatial attention area.
And step C, as shown in FIG. 3, applying a grid point generating function according to the four spatial coordinates of the spatial attention area in the sample image respectively for each sample image, and obtaining the coordinates of each grid point under the corresponding preset proportion grid division in the spatial attention area in the sample image.
The lattice point generating function generates image lattice points according to the proportional relation between 4 image coordinates generated by the attention mechanism and the original image, and the lattice point generating function is described as follows:
wherein, x'ijIs the corresponding abscissa, y 'of the grid point i, j in the original image'ijIs the corresponding ordinate of the grid point i, j in the original image, w 'is the width of the preset grid point image, h' is the height of the corresponding preset grid point image, xijIs the abscissa, y, of the grid point i, j in the preset grid point imageijIs the ordinate of the grid point i, j in the preset grid point image.
And D, aiming at each sample image, obtaining the pixel value of each lattice point in a spatial attention area in the sample image by a differentiable interpolation method meeting the requirement of error back propagation, wherein a bilinear interpolation method is specifically selected in the embodiment, and obtaining a processed image corresponding to each sample image based on an attention mechanism.
Step e, as shown in fig. 4, based on the tags in the bridge support sample image database and the attention-based pictures of each sample image, constructing a classification network that uses the attention-based pictures of each sample image as input and uses the category of the support image in the corresponding sample image as output and satisfies the preset specified feature characterization capability, specifically selecting a VGG network in a classical convolutional neural network in the present embodiment, then using the difference between the output category of the classification network and the category marked in step a as a target of network optimization, and performing joint training on the space coordinate generation network and the classification network by using a gradient descent method to obtain a target neural network.
And then, sequentially applying the space coordinates to generate a network and a classification network aiming at the target image to be detected, so as to obtain a classification result of the bridge bearing included in the target image.
The embodiments of the present invention have been described in detail with reference to the drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge of those skilled in the art without departing from the gist of the present invention.