Semantic segmentation method for quantifying bubble defects on surface of bare concrete based on YOLOv5 model

Through the semantic segmentation method based on the YOLOv5 model, combined with the SPD-Conv module and SENet attention mechanism, the subjectivity and automatic identification problems of bubble defect detection on the surface of fair-faced concrete are solved, and the maximum diameter and area of ​​bubble defects are accurately quantified, improving Improve detection efficiency and accuracy.

CN118691822APending Publication Date: 2024-09-24FUJIAN AGRI & FORESTRY UNIV
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202410901154.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

The existing technology relies on human observation and manual calculation, is highly subjective, and cannot automatically identify the maximum diameter and area of ​​bubble defects on the surface of fair-faced concrete, making it difficult to achieve accurate and efficient detection.

Method used

Using the semantic segmentation method based on the YOLOv5 model, by establishing a semantic segmentation data set, marking and dividing the data set, and constructing an improved YOLOv5 model, the SPD-Conv module and the SENet attention mechanism are used to realize the automatic identification and detection of bubble defects on the surface of fair-faced concrete. Quantify.

Benefits of technology

It achieves accurate identification of bubble defects on the surface of fair-faced concrete, improves detection efficiency and objectivity, enhances the model's detection performance for low-resolution images and small objects, and improves recognition accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118691822A
    Figure CN118691822A
Patent Text Reader

Abstract

The invention discloses a semantic segmentation method for quantifying surface bubble defects of bare concrete based on an improved YOLOv5 model. The semantic segmentation method specifically comprises the following steps: establishing a semantic segmentation data set of the surface bubble defects of the bare concrete; marking a semantic segmentation data set, and dividing the data set into a training set and a verification set; constructing a deep learning semantic segmentation model for surface bubble defect identification of the bare concrete structure; training and verifying the constructed semantic segmentation model; the verified semantic segmentation model is adopted to carry out quantitative recognition on bubble defects; and extracting and identifying the maximum diameter and area of the bubble defect in the image. The method does not need expensive detection equipment, and the model can quantify the degree of bubble defects on the surface of the bare concrete in real time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of deep learning network technology and engineering technology, and in particular to a semantic segmentation method for quantifying bubble defects on the surface of plain concrete based on a YOLOv5 model. Background Art

[0002] At present, the method for detecting the appearance quality defects of plain concrete mainly relies on observing the bubbles on the concrete surface with human eyes, then manually counting the number of bubbles and measuring the bubble diameter, or evaluating by comparing with the bubble control scale recommended by the International Concrete Committee. However, this method relies too much on visual evaluation by human eyes and has the problem of great subjective influence. Therefore, it is necessary to introduce an automated detection method based on quantitative analysis of the maximum diameter and area of ​​bubbles to overcome the limitations of traditional methods.

[0003] With the popularity of deep learning due to its automated technical features and wide range of applications, it has become a very popular research hotspot in the field of artificial intelligence. Research on semantic segmentation based on deep learning has made significant progress since 2012. Semantic segmentation is an image processing technology that aims to classify each pixel in an image into different semantic categories, such as surgical instruments, physiological tissues, etc. Compared with traditional image segmentation technology, its advantage is that it can better enable computers to recognize and understand the content in the image. Therefore, how to automatically identify the maximum diameter and area of ​​air bubble defects on the surface of plain concrete through the YOLOv5 model while ensuring recognition accuracy is still a problem that needs further research. Summary of the invention

[0004] In view of this, the purpose of the present invention is to propose a semantic segmentation method for quantifying bubble defects on the surface of plain concrete based on the YOLOv5 model, which is reliable in implementation, flexible in application, and can combine semantic segmentation with YOLOv5. This scheme can accurately and quickly identify bubble defects in images so as to obtain their maximum diameter and area.

[0005] In order to achieve the above technical objectives, the technical solution adopted by the present invention is:

[0006] A semantic segmentation method for quantifying bubble defects on the surface of plain concrete based on the YOLOv5 model, comprising:

[0007] Step 1: Establish a semantic segmentation dataset of bubble defects on the surface of plain concrete;

[0008] Step 2: Mark the data in the semantic segmentation dataset one by one, and then divide the marked data in the semantic segmentation dataset into a training set and a validation set;

[0009] Step 3: Build a deep learning semantic segmentation model based on the YOLOv5 model for identifying bubble defects on the surface of plain concrete structures;

[0010] Step 4: Importing the training set and the verification set into the deep learning semantic segmentation model for training and verification, so as to construct a semantic segmentation model that meets the preset verification requirements;

[0011] Step 5: Use the verified semantic segmentation model to quantitatively identify bubble defects and generate recognition results;

[0012] Step 6: Based on the recognition results, extract and identify the maximum diameter and area of ​​the bubble defects in the image.

[0013] As a possible implementation, further, in step 1 of this solution, the data in the semantic segmentation data set is image data, which is obtained through collection, and the collected images are sorted and format-converted according to preset name numbers and formats.

[0014] As an example, step 1 of this solution may include:

[0015] Step 1.1: Go to the construction site of Xiamen New Convention and Exhibition Center in Xiang'an District, Xiamen City, Fujian Province to collect images on site. Use the ZP-CK102 crack width meter to collect images of the bare concrete wall and column structure at different times, distances and illumination angles.

[0016] Step 1.2: Convert the above collected images into different formats according to the style and sequence of "000001.jpg" to "001246.jpg", and aggregate them to form a semantic segmentation dataset of bubble defects on the surface of plain concrete.

[0017] As a possible implementation, further, in step 2 of this solution, the image annotation tool Labelme is used to classify the data in the semantic segmentation dataset to generate a corresponding .json format label file, in which the label categories are bubble and irregular bubble; then a Python script is used to convert the .json format label file into a .txt format label file.

[0018] As an example, step 2 of this solution may include:

[0019] Step 2.1: Use Labelme to label the semantic segmentation dataset and generate the corresponding .json file, labeling the categories as bubble and irregular bubble;

[0020] Step 2.2: Use Python script to convert the label file in .json format into a label file in .txt format, and finally obtain a new data set to be tested;

[0021] Step 2.3: Divide the above-mentioned data set to be tested into a training set and a validation set in a ratio of 8:2 for the subsequent training of the improved YOLOv5 semantic segmentation model.

[0022] As a possible implementation, further, the YOLOv5 model described in this solution includes an Input module, a Backbone module, a Neck module, a Head module and an Output module that transmit data in sequence, the Backbone module includes an SPD-Conv module and a pooling layer, and the Neck module includes a SENet attention mechanism layer.

[0023] As an example, step 3 of this solution may include:

[0024] Step 3.1: Replace the strided convolution in the backbone network of the original YOLOv5 model with the SPD-Conv module (Space-to-depth Convolution, SPD-Conv), and add a pooling layer to the module to avoid the loss of detail information. The SPD-Conv module is a convolution module that improves the poor processing performance of small objects and low-resolution images in traditional convolutional neural networks. Introducing this module at the input end improves the model's ability to detect low-resolution objects;

[0025] Step 3.2: Add the SE attention mechanism (Squeeze-and-Excitation Networks, SENet) to the Neck of the original YOLOv5 model. The advantage of the SE attention mechanism is that it automatically learns feature weights through a fully connected network and according to the loss function, improves the accuracy of the model network under limited resources, and adds more weights to improve the recognition accuracy. To this end, the model's perception of the maximum diameter and area characteristics of bubble defects is enhanced.

[0026] As a preferred implementation option, preferably, the SPD-Conv module described in this solution includes a space-to-depth layer (space-to-depth, SPD) and a non-strided convolution layer (Non-strided Convolution, Non-Conv);

[0027] The spatial depth layer can slice any input feature map of size S×S×C according to a preset rule, and the slicing operation is controlled by the parameter scale factor scale;

[0028] The non-strided convolution layer is a convolution operation with no stride, i.e., stride=0, which is added after each spatial depth layer to reduce the number of channels using learnable parameters in the added convolution layer.

[0029] As a better implementation option, preferably, the SENet attention mechanism layer of this scheme includes a squeeze operation, an excitation operation, and a scale operation;

[0030] The squeezing operation is used to perform global average pooling on the input feature map, reducing the feature value of each channel into a global vector, which is intended to capture the global information of each channel;

[0031] The excitation operation is composed of two full connections, a ReLU activation function, and a Softmax activation function; specifically, the dimensionality is first reduced and then increased, and finally a weight vector is generated through a Sigmoid function to ensure that the final sum is 1;

[0032] The slicing operation is to multiply the channel attention weight obtained in the previous step by the original feature map of the input. This step is used to adjust the feature value of each channel, emphasize the information of important channels, and suppress the information of unimportant channels.

[0033] As a better implementation option, preferably, in step 4 of this solution, pixel accuracy (PA), mean pixel accuracy (MPA), mean intersection over Union (MIoU) and frequency weight intersection over Union (FWIoU) are used as evaluation indicators to verify the accuracy improvement of the semantic segmentation model based on the YOLOv5 model in the semantic segmentation task of quantifying bubble defects on the surface of plain concrete.

[0034] As a preferred implementation option, preferably, the pixel accuracy rate used in this solution refers to the ratio of the number of pixels with the correct prediction category to the total number of pixels. The specific calculation formula is shown in (1):

[0035]

[0036] In the formula, k = 2, k represents the two pixel categories of bubbles and irregular bubbles, which are represented by i and j respectively, P ij P represents the number of pixels whose pixel category i is predicted to be pixel category j, i.e., false positives. ii It represents the number of pixels correctly identified as pixel category i, i.e. true positives;

[0037] The average pixel accuracy of each category is the ratio of the number of correctly classified pixels in each category, that is, the average pixel accuracy of each category is calculated by accumulating the average. The specific calculation formula is shown in (2):

[0038]

[0039] In the formula, k = 2, k represents the two pixel categories of bubbles and irregular bubbles, which are represented by i and j respectively, P ij P represents the number of pixels whose pixel category i is predicted to be pixel category j, i.e., false positives. ii It represents the number of pixels correctly identified as pixel category i, i.e. true positives;

[0040] The average intersection-to-union ratio is the ratio of the intersection and union of the model's prediction results for each category and the true value, and the result of summing and averaging. This evaluation index can be used to judge the degree of target capture, so that the predicted label and the annotation are as close as possible, and can also be used to judge the accuracy of the model, so that the union is as close as possible. The specific calculation formula is shown in (3):

[0041]

[0042] In the formula, k = 2, k represents the two pixel categories of bubbles and irregular bubbles, that is, i and j represent them respectively, P ij P represents the number of pixels whose pixel category i is predicted to be pixel category j, i.e., false positives. ii It represents the number of pixels correctly identified as pixel category i, that is, true positives, P ji It represents the number of pixels of pixel category j that are mistakenly identified as pixel category i, i.e., false negatives;

[0043] The weighted frequency intersection ratio shown in the figure refers to the frequency of occurrence of each category as the weight. The specific calculation formula is shown in (4):

[0044]

[0045] In the formula, k = 2, k represents the two pixel categories of bubbles and irregular bubbles, which are represented by i and j respectively, P ij P represents the number of pixels whose pixel category i is predicted to be pixel category j, i.e., false positives. ii It represents the number of pixels correctly identified as pixel category i, i.e. true positives, P ji It represents the number of pixels of pixel category j that are mistakenly identified as pixel category i, that is, false negatives.

[0046] As an example, step 4 of this solution may include:

[0047] Step 4.1: Configure the model training environment;

[0048] Step 4.2: Use the training set divided in step 2 to train the improved YOLOv5 model in step 3, and use the trained model to verify the validation set images. When the accuracy and loss function of the validation set tend to remain unchanged, the trained model is obtained;

[0049] Step 4.3: By comparing various evaluation indicators with the original YOLOv5 model, including PA, MPA, MIoU and other indicators, the performance evaluation indicators of the improved model are obtained, which is the final detection result. In addition, FWIoU is used as the region-based accuracy indicator, which is defined as the ratio of the intersection and union of the predicted bubble and the real bubble.

[0050] As an example, steps 5 and 6 of this solution may include:

[0051] Step 5: Input the image to be tested into the trained semantic segmentation model of bubble defects on the surface of plain concrete for training. In the detection results, the detection accuracy value is proportional to the detection effect.

[0052] Step 6: Extract and identify the maximum diameter and area of ​​the bubble defects in the bubble defect image on the surface of the plain concrete to be detected, and form the final Excel bubble defect detection file.

[0053] Based on the above, the present invention also provides a semantic segmentation system for quantifying bubble defects on the surface of plain concrete based on the YOLOv5 model, which includes:

[0054] The acquisition module is used to collect bubble defect images and organize them into a semantic segmentation dataset of bubble defects on the surface of plain concrete;

[0055] A labeling module labels a semantic segmentation dataset and divides the semantic segmentation dataset into a training set and a validation set;

[0056] The construction module uses the YOLOv5 network as the basic model, improves the basic model to perform semantic segmentation tasks, and builds an improved model that can quantify the maximum diameter and area of ​​bubble defects on the surface of plain concrete;

[0057] The training module uses the training set and the validation set to train and adjust the parameters of the improved model until the loss function of the model converges, thus obtaining a trained semantic segmentation model of bubble defects on the surface of plain concrete;

[0058] The testing module inputs the image to be tested into the trained semantic segmentation model of bubble defects on the surface of plain concrete for training, and outputs the maximum diameter and area of ​​the bubble defects in the image.

[0059] By adopting the above technical solution, the present invention has the following beneficial effects compared with the prior art:

[0060] (1) The present invention proposes an automated detection method for quantitatively detecting bubble defects on the surface of plain concrete, which can identify the maximum diameter and area of ​​bubble defects in an image in real time, and then evaluate the appearance quality of plain concrete through quantitative information. While ensuring the accuracy of recognition, this method can more objectively and automatically extract and identify quantitative information of bubble defects on the surface of plain concrete, thereby improving the detection efficiency of acceptance personnel in detecting bubble defects on the surface of plain concrete;

[0061] (2) The use of the SPD-Conv module in the solution of the present invention can reduce the size of the spatial dimension without losing information, while retaining the information in the channel, which helps to improve the model's detection performance for low-resolution images and small objects. By introducing the SPD-Conv module, the improved model downsamples the feature information while retaining the dimensional information, enhances the feature information fusion capability, and improves the accuracy of small target low-resolution image detection.

[0062] (3) The SE attention mechanism used in the scheme of the present invention can enhance the improved model's ability to perceive the characteristics of bubble defects in the image. The SE attention mechanism is able to mine effective features in the image and suppress invalid features, thereby improving the model's ability to represent the image and accuracy. By introducing the SE attention mechanism, the improved model can more accurately identify features related to bubble defects and improve detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0064] Figure 1 This is a flow chart of a semantic segmentation method for quantifying bubble defects on the surface of plain concrete based on the YOLOv5 model in the present invention;

[0065] Figure 2 This is a schematic diagram of the operation of the ZP-CK102 crack width measuring instrument, a data acquisition device in the solution of the present invention;

[0066] Figure 3 It is a schematic diagram of the structure of the improved YOLOv5 network model in the solution of the present invention;

[0067] Figure 4 Schematic diagram of the structure of the SPD-Conv module in the solution of the present invention;

[0068] Figure 5 Schematic diagram of the structure of the SE attention mechanism in the solution of the present invention. DETAILED DESCRIPTION

[0069] The present invention will be further described in detail below in conjunction with the accompanying drawings and examples. It is particularly noted that the following examples are only used to illustrate the present invention, but are not intended to limit the scope of the present invention. Similarly, the following examples are only partial embodiments of the present invention rather than all embodiments, and all other embodiments obtained by those of ordinary skill in the art without creative work are within the scope of protection of the present invention.

[0070] This embodiment provides a semantic segmentation method for quantifying bubble defects on the surface of plain concrete based on the YOLOv5 model, which includes:

[0071] Step 1: Establish a semantic segmentation dataset of bubble defects on the surface of plain concrete;

[0072] Step 2: Mark the data in the semantic segmentation dataset one by one, and then divide the marked data in the semantic segmentation dataset into a training set and a validation set;

[0073] Step 3: Build a deep learning semantic segmentation model based on the YOLOv5 model for identifying bubble defects on the surface of plain concrete structures;

[0074] Step 4: Importing the training set and the verification set into the deep learning semantic segmentation model for training and verification, so as to construct a semantic segmentation model that meets the preset verification requirements;

[0075] Step 5: Use the verified semantic segmentation model to quantitatively identify bubble defects and generate recognition results;

[0076] Step 6: Based on the recognition results, extract and identify the maximum diameter and area of ​​the bubble defects in the image.

[0077] Among them, in step 1 of this solution, the data in the semantic segmentation data set is image data, which is obtained through collection, and the collected images are sorted and format converted according to preset name numbers and formats.

[0078] Furthermore, in step 2 of this solution, the image annotation tool Labelme is used to classify the data in the semantic segmentation dataset to generate a corresponding .json format label file, in which the label categories are bubble and irregular bubble; then a Python script is used to convert the .json format label file into a .txt format label file.

[0079] As a possible implementation, further, the YOLOv5 model described in this solution includes an Input module, a Backbone module, a Neck module, a Head module and an Output module that transmit data in sequence, the Backbone module includes an SPD-Conv module and a pooling layer, and the Neck module includes a SENet attention mechanism layer.

[0080] As a preferred implementation option, preferably, the SPD-Conv module described in this solution includes a space-to-depth layer (space-to-depth, SPD) and a non-strided convolution layer (Non-strided Convolution, Non-Conv);

[0081] The spatial depth layer can slice any input feature map of size S×S×C according to a preset rule, and the slicing operation is controlled by the parameter scale factor scale;

[0082] The non-strided convolution layer is a convolution operation with no stride, i.e., stride=0, which is added after each spatial depth layer to reduce the number of channels using learnable parameters in the added convolution layer.

[0083] As a better implementation option, preferably, the SENet attention mechanism layer of this scheme includes a squeeze operation, an excitation operation, and a scale operation;

[0084] Among them, the squeezing operation is used to perform global average pooling on the input feature map, reducing the eigenvalue of each channel to a global vector, which aims to capture the global information of each channel; the excitation operation is composed of two full connections and a ReLU activation function, and a Softmax activation function; specifically, it first reduces the dimension and then increases the dimension, and finally generates a weight vector through the Sigmoid function to ensure that the final sum is 1; the slicing operation is to multiply the channel attention weight obtained in the previous step by the original input feature map. This step is used to adjust the eigenvalue of each channel, emphasize the information of important channels, and suppress the information of unimportant channels.

[0085] As a better implementation option, preferably, in step 4 of this solution, pixel accuracy (PA), mean pixel accuracy (MPA), mean intersection over Union (MIoU) and frequency weight intersection over Union (FWIoU) are used as evaluation indicators to verify the accuracy improvement of the semantic segmentation model based on the YOLOv5 model in the semantic segmentation task of quantifying bubble defects on the surface of plain concrete.

[0086] As a preferred implementation option, preferably, the pixel accuracy rate used in this solution refers to the ratio of the number of pixels with the correct prediction category to the total number of pixels. The specific calculation formula is shown in (1):

[0087]

[0088] In the formula, k = 2, k represents the two pixel categories of bubbles and irregular bubbles, which are represented by i and j respectively, P ij P represents the number of pixels whose pixel category i is predicted to be pixel category j, i.e., false positives. ii It represents the number of pixels correctly identified as pixel category i, i.e. true positives;

[0089] The average pixel accuracy of each category is the ratio of the number of correctly classified pixels in each category, that is, the average pixel accuracy of each category is calculated by accumulating the average. The specific calculation formula is shown in (2):

[0090]

[0091] In the formula, k = 2, k represents the two pixel categories of bubbles and irregular bubbles, which are represented by i and j respectively, P ij P represents the number of pixels whose pixel category i is predicted to be pixel category j, i.e., false positives. ii It represents the number of pixels correctly identified as pixel category i, i.e. true positives;

[0092] The average intersection-to-union ratio is the ratio of the intersection and union of the model's prediction results for each category and the true value, and the result of summing and averaging. This evaluation index can be used to judge the degree of target capture, so that the predicted label and the annotation are as close as possible, and can also be used to judge the accuracy of the model, so that the union is as close as possible. The specific calculation formula is shown in (3):

[0093]

[0094] In the formula, k = 2, k represents the two pixel categories of bubbles and irregular bubbles, that is, i and j represent them respectively, P ij P represents the number of pixels whose pixel category i is predicted to be pixel category j, i.e., false positives. ii It represents the number of pixels correctly identified as pixel category i, that is, true positives, P ji It represents the number of pixels of pixel category j that are mistakenly identified as pixel category i, i.e., false negatives;

[0095] The weighted frequency intersection ratio shown in the figure refers to the frequency of occurrence of each category as the weight. The specific calculation formula is shown in (4):

[0096]

[0097] In the formula, k = 2, k represents the two pixel categories of bubbles and irregular bubbles, which are represented by i and j respectively, P ij P represents the number of pixels whose pixel category i is predicted to be pixel category j, i.e., false positives. ii It represents the number of pixels correctly identified as pixel category i, i.e. true positives, P ji It represents the number of pixels of pixel category j that are mistakenly identified as pixel category i, that is, false negatives.

[0098] Combination Figure 1 Based on the above, this embodiment also provides a semantic segmentation system for quantifying bubble defects on the surface of plain concrete based on the YOLOv5 model, which includes:

[0099] The acquisition module is used to collect bubble defect images and organize them into a semantic segmentation dataset of bubble defects on the surface of plain concrete;

[0100] A labeling module labels a semantic segmentation dataset and divides the semantic segmentation dataset into a training set and a validation set;

[0101] The construction module uses the YOLOv5 network as the basic model, improves the basic model to perform semantic segmentation tasks, and builds an improved model that can quantify the maximum diameter and area of ​​bubble defects on the surface of plain concrete;

[0102] The training module uses the training set and the validation set to train and adjust the parameters of the improved model until the loss function of the model converges, thus obtaining a trained semantic segmentation model of bubble defects on the surface of plain concrete;

[0103] The testing module inputs the image to be tested into the trained semantic segmentation model of bubble defects on the surface of plain concrete for training, and outputs the maximum diameter and area of ​​the bubble defects in the image.

[0104] As a specific implementation example, this embodiment provides a semantic segmentation method for quantifying bubble defects on the surface of plain concrete based on the YOLOv5 model, and the steps are as follows: Figure 1 Briefly, it includes:

[0105] Step 1: Establish a semantic segmentation dataset of bubble defects on the surface of plain concrete. First, we went to the construction site of the Xiamen New Convention and Exhibition Center in Xiang'an District, Xiamen City, Fujian Province to collect images on the spot, and used the ZP-CK102 crack width meter to collect images of plain concrete walls and column structures at different times, distances, and illumination angles; secondly, the above collected images were converted into formats in the style and order of "000001.jpg" to "001246.jpg", and then summarized to form a semantic segmentation dataset of bubble defects on the surface of plain concrete.

[0106] In this step, the image acquisition device used is the ZP-CK102 crack width gauge, which consists of a tablet computer and a microscope camera. Its specific technical specifications are detailed in Table 1. The width gauge is connected via a wireless WiFi network, and the images taken by the microscope camera are stored in the tablet computer. The images are then transferred to the computer via a USB flash drive, and then the images are analyzed using Windows software. The operation process is as follows: Figure 2 In the actual acquisition process, it is ensured that each close-up image contains a single bubble, so a total of 1246 valid bubble images are acquired by the ZP-CK102 crack width gauge.

[0107] Table 1: Technical specifications of ZP-CK102 crack width meter

[0108]

[0109] Step 2: First, use Labelme to label the semantic segmentation dataset and generate the corresponding .json file with the label categories as bubble and irregular bubble; secondly, use Python script to convert the .json label file into a .txt label file, and finally get the new dataset to be tested; finally, divide the above dataset to be tested into training set and validation set in a ratio of 8:2 for the subsequent training of the improved YOLOv5 semantic segmentation model.

[0110] This solution targets the semantic segmentation dataset of bubble defects on the surface of plain concrete. Labelme software will be used for annotation. The output label file is .json, but Python scripts need to be used to convert the format into .txt file format to conform to the commonly used standard format of the YOLOv5 model.

[0111] Before you start using Labelme, you need to create a new virtual environment in Anaconda and make sure to activate the required Anaconda environment before installing the software. After the installation is complete, enter "Labelme" in the terminal cmd command line to start the application, select the folder where the dataset is located and the path where the annotated files are stored, and make sure the original files and the annotated files correspond.

[0112] The labeling step is to draw marking boxes of various shapes (such as rectangles, polygons, circles, etc.) according to the bubble defect graphics on the picture, then select the category name to which the bubble belongs, and finally save the file in .json format for subsequent conversion to .txt file format.

[0113] Step 3: Using the YOLOv5 model as the base model, the YOLOv5 model is improved to build a semantic segmentation model for bubble defects on the surface of plain concrete. The improved YOLOv5 model includes: (1) replacing the strided convolution in the Backbone of the original YOLOv5 model with the SPD-Conv module, and adding a pooling layer to the module to avoid the loss of detail information; (2) adding the SE attention mechanism to the Neck of the original YOLOv5 model. The structure of the improved model is shown in the figure below: Figure 3 shown.

[0114] The replaced SPD-Conv module structure is as follows Figure 4 As shown in the figure, the module contains a space-to-depth layer (SPD) and a non-strided convolution layer (Non-Conv), and a pooling layer is added to the module to avoid the loss of detail information. The SPD-Conv module downsamples the features in the image to retain the required information in the channel, and then performs a stepless convolution to streamline the number of channels that can use the learnable parameters in the newly added convolution layer.

[0115] Assuming that the initial feature map has a size of S×S, which contains the details of small objects, after applying the SPD layer (when scale=2), the spatial resolution of the feature map is reduced to At the same time, this part of the reduced spatial information is transferred to the channel dimension, so that the number of channels increases but no information is lost. Therefore, after the introduction of the SPD layer, the detail information originally scattered on the S×S feature map is now compressed and retained in deeper channels.

[0116] Assuming that scale = 2, four sub-maps f will be obtained 0,0 、f 0,1 、f 1,0 、f 1,0, their shape is S×S×C and X is downsampled by 2 times. The specific calculation process of the SPD module is shown in formula (5):

[0117]

[0118] Where X represents the intermediate feature map, S represents the length and width of the input feature map, and scale represents the slice parameter scale factor.

[0119] After SPD layer processing, the size of the feature map is reduced to half of the original size. But the number of channels increases. Assuming that the original number of channels is C, and a Non-Conv layer is applied after the SPD layer, the number of channels will increase to 4 times the original number. Such a convolutional layer does not reduce the spatial size of the feature map, but extracts important features by learning the information in these increased channels. Therefore, even at a smaller spatial resolution, the model can effectively capture the details of small objects.

[0120] By combining the SPD layer and the Non-Conv layer, the model can better handle the challenges of small objects and low-resolution images, improving the performance and robustness of the model in these complex scenes.

[0121] Adding the SE attention mechanism is a channel attention mechanism, which aims to give different weights to different positions of the image from the perspective of the channel domain through a weight matrix to obtain more important feature information. The SE attention mechanism mainly consists of the following three operations, as shown in the structure Figure 5 shown.

[0122] The squeeze operation aims to capture the global information of each channel. Specifically, the two-dimensional feature H×W of each channel is compressed into 1 real number through global average pooling, and the feature map is changed from H×W×C to 1×1×C to obtain the channel-level global feature.

[0123] The Excitation operation generates a weight value for each feature channel. It consists of two fully connected functions, a ReLU activation function, and a Softmax activation function. It first reduces the dimension and then increases the dimension. Finally, it generates a weight vector through the sigmoid function to ensure that their sum is 1. It ensures that the number of output weight values ​​is the same as the number of channels of the input feature map, that is, it learns the relationship between each channel and obtains the weights of different channels.

[0124] The Scale operation is to add the normalized weight obtained above to the features of each channel, which is used to adjust the feature value of each channel, emphasize the information of important channels, and suppress the information of unimportant channels. Specifically, H×W×C is obtained by multiplying the channel attention weight obtained in the previous step by the original input feature map, that is, [H×W×C]*[1×1×C].

[0125] Using the SE attention mechanism allows the model to pay more attention to the features of a specific channel by learning the weight of each channel. This helps the network better distinguish the importance of different channels during the learning process, thereby improving the model's ability to represent input data.

[0126] Step 4: Use the training set and the validation set to train and adjust the semantic segmentation model of bubble defects on the surface of plain concrete, respectively, until the loss function of the model converges. The experimental environment of the semantic segmentation method for quantifying bubble defects on the surface of plain concrete based on the YOLOv5 model of the present invention is Python 3.7, and the graphics card NVIDIA GeForce RTX 4070. The specific configuration is shown in Table 2.

[0127] Table 2: Experimental environment configuration table

[0128]

[0129] In this experimental environment configuration, the training set divided in step 2 is used to train the improved YOLOv5 model in step 3. The network is trained in GPU mode, the network model training parameters are set, and the training round is 200 batches. During the training process, the validation set images are verified using the training model. When the accuracy and loss function of the validation set tend to remain unchanged, the trained model is obtained.

[0130] In order to verify that the detection accuracy of the improved YOLOv5 model for quantitative identification of bubble defects on the surface of plain concrete has been improved, various evaluation indicators, including PA, MPA, MIoU, etc., are compared with the original YOLOv5 model to obtain the performance evaluation indicators of the improved model, which is the final detection result. In addition, FWIoU is used as the region-based accuracy indicator, which is defined as the ratio of the intersection and union of predicted bubbles to real bubbles.

[0131] Step 5: Input the image to be tested into the trained semantic segmentation model of bubble defects on the surface of plain concrete for training. In the detection results, the detection accuracy value is proportional to the detection effect.

[0132] Step 6: Extract and identify the maximum diameter and area of ​​the bubble defects in the bubble defect image on the surface of the plain concrete to be detected, and form the final Excel bubble defect detection file.

[0133] The above descriptions are only some embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Any equivalent device or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A semantic segmentation method for quantifying bubble defects on the surface of plain concrete based on the YOLOv5 model, characterized in that: It includes: Step 1: Establish a semantic segmentation dataset of bubble defects on the surface of plain concrete; Step 2: Mark the data in the semantic segmentation dataset one by one, and then divide the marked data in the semantic segmentation dataset into a training set and a validation set; Step 3: Build a deep learning semantic segmentation model based on the YOLOv5 model for identifying bubble defects on the surface of plain concrete structures; Step 4: Importing the training set and the verification set into the deep learning semantic segmentation model for training and verification, so as to construct a semantic segmentation model that meets the preset verification requirements; Step 5: Use the verified semantic segmentation model to quantitatively identify bubble defects and generate recognition results; Step 6: Based on the recognition results, extract and identify the maximum diameter and area of ​​the bubble defects in the image.

2. The semantic segmentation method for quantifying bubble defects on the surface of plain concrete based on the YOLOv5 model as claimed in claim 1, characterized in that: In step 1, the data in the semantic segmentation data set is image data, which is obtained through collection, and the collected images are sorted and format converted according to preset name numbers and formats.

3. The semantic segmentation method for quantifying bubble defects on the surface of plain concrete based on the YOLOv5 model as claimed in claim 1, characterized in that: In step 2, the image annotation tool Labelme is used to classify the data in the semantic segmentation dataset and generate a corresponding .json format label file, where the label categories are bubble and irregularbubble; then a Python script is used to convert the .json format label file into a .txt format label file.

4. The semantic segmentation method for quantifying bubble defects on the surface of plain concrete based on the YOLOv5 model as claimed in claim 1, characterized in that: The YOLOv5 model includes an Input module, a Backbone module, a Neck module, a Head module and an Output module for sequentially transmitting data, the Backbone module includes an SPD-Conv module and a pooling layer, and the Neck module includes a SENet attention mechanism layer.

5. The semantic segmentation method for quantifying bubble defects on the surface of plain concrete based on the YOLOv5 model as claimed in claim 4, characterized in that: The SPD-Conv module includes a spatial depth layer and a non-strided convolution layer; The spatial depth layer can slice any input feature map of size S×S×C according to a preset rule, and the slicing operation is controlled by the parameter scale factor scale; The non-strided convolution layer is a convolution operation with no stride, i.e., stride=0, which is added after each spatial depth layer to reduce the number of channels using learnable parameters in the added convolution layer.

6. The semantic segmentation method for quantifying bubble defects on the surface of plain concrete based on the YOLOv5 model as claimed in claim 5, characterized in that: The SENet attention mechanism layer includes squeeze operation, excitation operation and slice operation; The squeezing operation is used to perform global average pooling on the input feature map, reducing the feature value of each channel into a global vector, which is intended to capture the global information of each channel; The excitation operation is composed of two full connections, a ReLU activation function, and a Softmax activation function; specifically, the dimensionality is first reduced and then increased, and finally a weight vector is generated through a Sigmoid function to ensure that the final sum is 1; The slicing operation is to multiply the channel attention weight obtained in the previous step by the original feature map of the input. This step is used to adjust the feature value of each channel, emphasize the information of important channels, and suppress the information of unimportant channels.

7. The semantic segmentation method for quantifying bubble defects on the surface of plain concrete based on the YOLOv5 model according to any one of claims 1 to 6, characterized in that: In step 4, pixel accuracy, category average pixel accuracy, average intersection-over-union ratio, and weighted frequency intersection-over-union ratio are used as evaluation indicators to verify the accuracy improvement of the semantic segmentation model based on the YOLOv5 model in the semantic segmentation task of quantifying bubble defects on the surface of plain concrete.

8. The semantic segmentation method for quantifying bubble defects on the surface of plain concrete based on the YOLOv5 model as claimed in claim 7, characterized in that: The pixel accuracy rate refers to the ratio of the number of pixels with the correct prediction category to the total number of pixels. The specific calculation formula is shown in (1): In the formula, k = 2, k represents the two pixel categories of bubbles and irregular bubbles, which are represented by i and j respectively, P ij P represents the number of pixels whose pixel category i is predicted to be pixel category j, i.e., false positives. ii It represents the number of pixels correctly identified as pixel category i, i.e. true positives; The average pixel accuracy of each category is the ratio of the number of correctly classified pixels in each category, that is, the average pixel accuracy of each category is calculated by accumulating the average. The specific calculation formula is shown in (2): In the formula, k = 2, k represents the two pixel categories of bubbles and irregular bubbles, which are represented by i and j respectively, P ij P represents the number of pixels whose pixel category i is predicted to be pixel category j, i.e., false positives. ii It represents the number of pixels correctly identified as pixel category i, i.e. true positives; The average intersection-to-union ratio is the ratio of the intersection and union of the model's prediction results for each category and the true value, and the result of summing and averaging. This evaluation index can be used to judge the degree of target capture, so that the predicted label and the annotation are as close as possible, and can also be used to judge the accuracy of the model, so that the union is as close as possible. The specific calculation formula is shown in (3): In the formula, k = 2, k represents the two pixel categories of bubbles and irregular bubbles, that is, i and j represent them respectively, P ij P represents the number of pixels whose pixel category i is predicted to be pixel category j, i.e., false positives. ii It represents the number of pixels correctly identified as pixel category i, that is, true positives, P ji It represents the number of pixels of pixel category j that are mistakenly identified as pixel category i, i.e., false negatives; The weighted frequency intersection ratio shown in the figure refers to the frequency of occurrence of each category as the weight. The specific calculation formula is shown in (4): In the formula, k = 2, k represents the two pixel categories of bubbles and irregular bubbles, which are represented by i and j respectively, P ij P represents the number of pixels whose pixel category i is predicted to be pixel category j, i.e., false positives. ii It represents the number of pixels correctly identified as pixel category i, i.e. true positives, P ji It represents the number of pixels of pixel category j that are mistakenly identified as pixel category i, that is, false negatives.

9. A semantic segmentation system for quantifying bubble defects on the surface of plain concrete based on the YOLOv5 model, characterized in that: It includes: The acquisition module is used to collect bubble defect images and organize them into a semantic segmentation dataset of bubble defects on the surface of plain concrete; A labeling module labels a semantic segmentation dataset and divides the semantic segmentation dataset into a training set and a validation set; The construction module uses the YOLOv5 network as the basic model, improves the basic model to perform semantic segmentation tasks, and builds an improved model that can quantify the maximum diameter and area of ​​bubble defects on the surface of plain concrete; The training module uses the training set and the validation set to train and adjust the parameters of the improved model until the loss function of the model converges, thus obtaining a trained semantic segmentation model of bubble defects on the surface of plain concrete; The testing module inputs the image to be tested into the trained semantic segmentation model of bubble defects on the surface of plain concrete for training, and outputs the maximum diameter and area of ​​the bubble defects in the image.

Citation Information

Cited By

  • Concrete phase segmentation method based on lightweight deep learning and SE attention mechanism

    CN119919429A

  • Quantitative analysis method and system for apparent bubble defects of concrete

    CN122115540A

  • Concrete member surface bubble detection method based on machine vision and deep learning

    CN122368071A

  • Concrete member surface bubble detection method based on machine vision and deep learning

    CN122368071B