A 3D printed concrete pore detection and classification method based on YOLOv5
By using the YOLOv5 algorithm in 3D printed concrete to build a data set and optimize the anchor frame, combined with the ShuffleNetv2 and PSA polarization modules, the problem of poor generalization performance of the pore detection method was solved, more efficient pore detection and classification were achieved, and the detection precision and classification accuracy were improved.
Patent Information
- Application Number
- CN202310865691.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-14
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2043-07-14
AI Technical Summary
The existing technology for pore detection in 3D printed concrete has weak generalization performance and poor robustness, cannot effectively classify pores, consumes a lot of resources, and cannot directly classify the detected concrete pores.
Using the YOLOv5 algorithm as a benchmark, we built our own target detection dataset, combined it with the K-means++ clustering algorithm to optimize the anchor boxes, used ShuffleNetv2 to replace the feature extraction network, and integrated the PSA polarized self-attention module to enhance the focus on small targets and achieve pore detection and classification.
The accuracy of pore detection and classification effect are improved, with mAP@.5 increasing by 11.4%, mAP@.5:.95 increasing by 4.7%, and F1 value increasing by 7.6%, effectively guiding the molding quality of 3D printed concrete components.
Smart Images

Figure CN116863236B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of 3D printed concrete pore identification and target detection, and in particular relates to a 3D printed concrete pore detection and classification method based on YOLOv5. Background Art
[0002] 3D printing concrete technology is a new application technology that combines 3D printing technology with technologies in the field of commercial concrete. Although the building does not require internal steel structure reinforcement after the construction of 3D printed concrete, its texture is similar to that of materials such as marble. In addition, current 3D printed concrete buildings still have problems such as geometric deformation and uneven pore distribution. The pore structure on the surface and inside of concrete is an important basis for analyzing the state of concrete and guiding the use of reinforcement materials. Therefore, higher requirements are put forward for the performance of concrete to meet the needs of 3D printing construction technology.
[0003] A method for detecting pores in concrete 3D printing interfaces has been proposed (publication number: CN114638813A). This algorithm uses traditional image processing methods and threshold segmentation methods, but has poor generalization performance, poor robustness, and high resource consumption. It is also unable to directly classify the detected concrete pores. Summary of the Invention
[0004] In order to overcome the shortcomings of the above-mentioned prior art, the object of the present invention is to provide a pore detection and classification method for 3D printed concrete. This method takes YOLOv5, a well-known algorithm in single-stage target detection with a high detection rate, as a benchmark. According to actual engineering applications, a self-built target detection dataset (3D printed concrete pore dataset) is constructed. Detection is performed on this dataset, the anchor boxes are optimized using the K-means++ clustering algorithm, and the original feature extraction network is replaced by the ShuffleNetv2 algorithm. Finally, the PSA polarization self-attention module is integrated into the backbone network to enhance the attention to small targets and realize pore detection and classification of 3D printed concrete.
[0005] In order to achieve the above object, the technical solution adopted by the present invention is:
[0006] A 3D printed concrete pore detection and classification method based on YOLOv5, comprising the following steps:
[0007] Step 1): Create a pore dataset for 3D printed concrete. Based on the characteristics of the pore dataset in step 1), pores are divided into two categories according to pore size: ① <3mm; ② 3mm-10mm;
[0008] Step 2): Optimize the initial target prediction frame to more accurately detect small pores with a pore diameter of <3 mm in the pore dataset in step 1);
[0009] Step 3): Preliminarily build the backbone network in the 3D printed concrete pore detection and classification network to extract and learn the features of the two types of pores in the pore dataset in step 1);
[0010] Step 4): Based on the network in step 3), a recognition network in the 3D printed concrete pore detection and classification network is constructed to further detect and classify the features extracted in step 3);
[0011] Step 5): Use the pore dataset prepared in step 1) to train the 3D printed concrete pore detection and classification network built in step 4);
[0012] Step 6): Test and compare the 3D printed concrete pore detection and classification network.
[0013] The images collected in step 1) are from a 3D printing concrete laboratory. Data enhancement is performed on the collected 3D printed concrete component images, including rotation, cropping, and segmentation. The pores are labeled using labelImg and divided into two categories: irre-hole (pores with a pore diameter of 3mm-10mm) and sml-hole (pores with a pore diameter of <3mm). The labeled concrete pore images are divided into three categories: train (training set), val (validation set), and test (test set). The samples in the train file are used to train the model, the samples in the val file are used to validate the model, and the samples in the test file are used to test the model.
[0014] The 3D printed concrete pore dataset used in step 2) is mainly composed of small targets. Therefore, the K-means++ clustering algorithm is used to realize the size of the initial target prediction box of the samples in the pore dataset.
[0015] In the step 3), the backbone network is built based on the YOLOv5 algorithm, using the lighter ShuffleNetV2 algorithm, and adding two PSA polarization self-attention modules to the algorithm to ensure low parameter count while maintaining high resolution. The backbone network in the 3D printed concrete pore detection and classification network has a total of 9 layers, the first layer is a convolutional pooling layer for modifying the number of channels, the second to fifth layers are shufflenetv2 layers for extracting pore features; the sixth layer is a PSA layer for weakening useless information in the extracted pore features and enhancing useful information, and the normalization function is a softmax function; the seventh to eighth layers are shufflenetv2 layers; the ninth layer is a PSA layer for weakening useless information in the extracted pore features and enhancing useful information, and the normalization function is a softmax function.
[0016] In the step 4), the recognition network consists of two parts: the neck network Neck and the head network Detect_head. The Neck part is used to fuse the pore feature maps extracted by the third, fifth and ninth layers of the backbone network, and uses the FPN feature pyramid structure and the feature fusion module PANet to generate a multi-scale feature pyramid through upsampling and downsampling operations; the Detect_head part is used to perform multi-scale target detection on the feature pyramid, and then perform feature prediction on the last three layers in YOLOv5 to output the final pore detection result; the recognition network has a total of 15 layers, the first layer is a convolutional layer, which is connected to the ninth layer of the backbone network; the second layer is upsampling, which uses the nearest collar interpolation method to double the size of the feature map, and the number of output channels remains unchanged; the third layer is a connection layer, which connects the fifth layer of the backbone network and the second layer of the recognition network, and merges the outputs; the fourth layer is a C3 module, which is used to increase the depth and receptive field of the network and improve the ability to extract pore features. The module consists of three convolution blocks, and between each convolution block, The BN layer and LeakyReLU activation function are introduced to improve the stability and generalization performance of the pore detection model; the fifth layer is a convolutional layer; the sixth layer is upsampling, using the nearest collar interpolation method to double the size of the feature map, while keeping the number of output channels unchanged; the seventh layer is a connection layer, connecting the third layer of the backbone network and the sixth layer of the recognition network, and merging the outputs; the eighth layer is a C3 module, which has the same function as above; the ninth layer is a convolutional layer, used for downsampling, reducing the pore feature image, and filtering out small and redundant features; the tenth layer is a connection layer, connecting the fifth and eighth layers of the recognition network, and merging the outputs; the eleventh layer is a C3 module, which has the same function as above; the twelfth layer is a convolutional layer, used for downsampling, reducing the pore feature image, and filtering out small and redundant features; the thirteenth layer is a connection layer, connecting the first and twelfth layers of the recognition network, and merging the outputs; the fourteenth layer is a C3 module, which has the same function as above; the fifteenth layer is the detection layer, and the detection inputs are the eighth, eleventh, and fourteenth layers of the recognition network respectively, and a convolutional layer is added after each layer to adjust the number of channels.
[0017] The training process in step 5) is as follows: when performing the pore detection task, the pore detection algorithm may detect the same pore multiple times. The NMS algorithm is used to ensure that the algorithm only obtains one detection frame for each pore. When the training is completed, an optimal weight file is obtained, which stores important parameters for pore detection.
[0018] The test analysis indicators in step 6) are:
[0019] (1) Precision: Defined from the perspective of prediction results, it refers to the probability of detecting the correct target among all detected targets;
[0020] (2) Recall: Defined from the perspective of samples, it refers to the probability of correct identification among all positive samples;
[0021] (3) mAP: AP represents the average value of the detector under various recall conditions. It is a recognizer for a single category. mAP is the average of AP from the category dimension to evaluate the performance of multiple classifiers. The value is in the range of [0, 1], and the larger the better.
[0022] (4) F Score: F Score is the harmonic mean of Precision and Recall.
[0023] Beneficial effects of the present invention:
[0024] This invention proposes a 3D printed concrete pore detection and classification method based on YOLOv5, which aims to solve the problem of detecting geometric deformation and uneven pore distribution in concrete when printing complex concrete components. This method uses a self-built target detection dataset (3D printed concrete pore dataset) based on actual engineering applications, and uses the well-known algorithm YOLOv5 in single-stage target detection with a high detection rate as a benchmark to improve the detection effect. Among them, mAP@.5 increased by 11.4%, mAP@.5:.95 increased by 4.7%, and the F1 value increased by 7.6%. By applying this pore detection and classification method, the molding quality of components during 3D printing of concrete can be effectively guided. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 This is a network flow chart for pore detection and classification in 3D printed concrete.
[0026] Figure 2 This is the flowchart of the backbone network shufflenetv2 module and Kmeans++ algorithm.
[0027] Figure 3 It is the PSA polarization attention module in the backbone network and the C3 module in the recognition network.
[0028] Figure 4 A pore dataset for 3D printed concrete.
[0029] Figure 5 This is the result of pore detection and classification of 3D printed concrete. DETAILED DESCRIPTION
[0030] The present invention is further described in detail below with reference to the embodiments.
[0031] Reference Figure 1-Figure 5 , the specific steps of the present invention are described in detail.
[0032] Step 1: Prepare a pore dataset for 3D printed concrete. Based on the characteristics of the pore dataset in step 1), pores are divided into two categories according to their pore size: ① < 3mm ② 3mm-10mm, refer to Figure 4 .
[0033] Step 1: The collected images are from the 3D printing concrete laboratory. The collected 3D printed concrete component images are data enhanced, including rotation, cropping and segmentation. The pores are labeled using labelImg and divided into two categories: irre-hole (pores with a pore diameter of 3mm-10mm) and sml-hole (pores with a pore diameter <3mm). The labeled concrete pore images are divided into three categories: train (training set), val (validation set) and test (test set) in an 8:1:1 ratio. The samples in the train file are used to train the model, the samples in the val file are used to verify the model, and the samples in the test file are used to test the model. Figure 4 .
[0034] Step 2: Optimize the pore prediction frame to more accurately detect small pores (pores with a diameter of <3 mm) in the pore dataset in step 1).
[0035] In step 2, the original pore anchor frame algorithm is the K-means algorithm. The original anchor frame size of YOLOv5 is obtained by clustering the algorithm on the COCO dataset. The number of large and medium-sized targets in the dataset is the majority. However, the 3D printed concrete pore dataset used in this article is mainly composed of small targets. Therefore, the K-means++ clustering algorithm is used to realize the size of the anchor frame of the samples in the pore dataset.
[0036] The K-means++ clustering algorithm is based on the K-means algorithm and optimizes the selection of initial points, which reduces the error of the classification results to a certain extent. Figure 2 The algorithm steps are as follows:
[0037] (1) Randomly select a pore annotation frame from all pore annotation frame data X as the first cluster center c i ;
[0038] (2) Calculate the shortest distance D(x) between each pore annotation box and the current cluster center;
[0039] (3) Calculate the probability P(x) that each pore annotation box is selected as the next cluster center;
[0040]
[0041] (4) Select the pore annotation box corresponding to the maximum probability value P(x) as the next cluster center. The farther the pore annotation box is from the existing cluster center, the higher the probability of being selected.
[0042] (5) Repeat steps (2) to (4) until k cluster centers, i.e., k pore annotation boxes, are selected.
[0043] Step 3: Preliminary construction of the backbone network in the 3D printing concrete pore detection and classification network, which is used to extract and learn the features of the two types of pores in the pore dataset in step 1), referring to Figure 1 and Figure 2 ;
[0044] Step 3: The backbone network is constructed based on the YOLOv5 algorithm. The original YOLOv5 backbone feature extraction network uses a C3 structure, which has a large number of parameters and a slow detection speed, limiting its application. In order to achieve lightweight network model, the lighter ShuffleNetV2 algorithm is used, and two PSA polarization self-attention modules are added to the algorithm to ensure low parameter count while maintaining high resolution. The backbone network in the 3D printed concrete pore detection and classification network has a total of 9 layers. The input image size is 512*512 and the number of channels is 3. The first layer is a convolutional pooling layer, which is used to modify the number of channels. The number of input channels is 3 and the number of output channels is 8. The convolution kernel size is 3*3, the step size is 2, and the padding size is 1. The second to fifth layers are shufflenetv2 layers, which are used to extract pore features. The parameters of the second layer are as follows: the number of input channels is 8, the number of output channels is 64, the sizes of the two convolution kernels are 3*3 and 1*1 respectively, and the step size is 2, which is used to expand the number of output channels; the parameters of the third layer are as follows: the number of input channels is 64, the number of output channels is 64, the sizes of the two convolution kernels are 3*3 and 1*1 respectively, and the step size is 1, which is used to reduce the amount of calculation; the parameters of the fourth layer are as follows: the number of input channels is 64, the number of output channels is 128, the sizes of the two convolution kernels are 3*3 and 1*1 respectively, and the step size is 2, which is used to expand the number of output channels; the parameters of the fifth layer are as follows: the number of input channels is 128, the number of output channels is 128, the sizes of the two convolution kernels are 3*3 and 1*1 respectively, and the step size is 1, which is used to reduce the amount of calculation. The sixth layer is the PSA layer, which is used to reduce useless information in the extracted pore features and enhance useful information. The input and output channels are 128, the convolution kernel size is 1*1, and the normalization function is the softmax function. The seventh and eighth layers are ShuffleNetV2 layers. The parameters for the seventh layer are as follows: the input channels are 128, the output channels are 256, the convolution kernel sizes are 3*3 and 1*1, and the stride size is 2 to increase the number of output channels. The parameters for the eighth layer are as follows: the input channels are 256, the output channels are 256, the convolution kernel sizes are 3*3 and 1*1, and the stride size is 1 to reduce computational complexity. The ninth layer is the PSA layer, which is used to reduce useless information in the extracted pore features and enhance useful information. The input channels are 256, the output channels are 256, the convolution kernel size is 1*1, and the normalization function is the softmax function.
[0045] Step 4: Based on the network in step 3), build the recognition network in the 3D printing concrete pore detection and classification network to further detect and classify the features extracted in step 3). Figure 1 and Figure 3 .
[0046] Step 4: The recognition network consists of two parts: the neck network (Neck) and the head network (Detect_head). The Neck part is used to fuse the feature maps extracted from the third, fifth, and ninth layers of the backbone network. It uses the FPN feature pyramid structure and the feature fusion module PANet to generate a multi-scale feature pyramid through upsampling and downsampling operations. The Detect_head part is used to perform multi-scale object detection on the feature pyramid and then perform feature prediction on the last three layers in YOLOv5. The three feature layers are located in the middle layer, lower middle layer, and bottom layer, respectively. The recognition network has 15 layers. The first layer is a convolutional layer with 256 input channels, 256 output channels, a convolution kernel size of 1*1, a step size of 1, and is connected to the ninth layer of the backbone network. The second layer is upsampling, which uses the nearest neighbor interpolation method to double the size of the feature map while keeping the number of output channels unchanged. The third layer is a connection layer, which connects the fifth layer of the backbone network and the second layer of the recognition network and merges the outputs. The fourth layer is the C3 module, which is used to increase the depth and receptive field of the network and improve the ability to extract pore features. This module consists of three convolution blocks. The stride of the first convolution block is 2, which can halve the size of the feature map. The stride of the second and third convolution blocks is 1, and the convolution kernel size is 3*3. Between each convolution block, a BN layer and a LeakyReLU activation function are added to improve the stability and generalization performance of the pore detection model. The fifth layer is a convolution layer with 256 input channels, 128 output channels, a convolution kernel size of 1*1, and a stride size of 1. The sixth layer is upsampling, which uses the nearest collar interpolation method to enlarge the size of the feature map. The seventh layer is the connection layer, which connects the third layer of the backbone network and the sixth layer of the recognition network, and merges the output; the eighth layer is the C3 module, which has the same function as above; the ninth layer is the convolution layer, which is used for downsampling, reducing the pore feature image, filtering small and redundant features, with 128 input channels, 128 output channels, a convolution kernel size of 3*3, and a step size of 2; the tenth layer is the connection layer, which connects the fifth and eighth layers of the recognition network, and merges the output; the eleventh layer is the C3 module, which has the same function as above; the twelfth layer is the convolution layer, which uses The downsampling is used to reduce the pore feature image and filter out small and redundant features. The number of input channels is 256, the number of output channels is 256, the convolution kernel size is 3*3, and the step size is 2; the thirteenth layer is the connection layer, which connects the first and twelfth layers of the recognition network and merges the outputs; the fourteenth layer is the C3 module, which has the same function as above; the fifteenth layer is the detection layer, and the detection inputs are the eighth, eleventh and fourteenth layers of the recognition network respectively, and a convolution layer is added after each layer to adjust the number of channels. The convolution kernel size is 1*1 and the step size is 1.
[0047] Step 5: Use the pore data set prepared in step 1) to train the pore detection and classification network built in step 4).
[0048] Step 5: Training process: The total number of training rounds is 300, each round is divided into 125 batches, and the number of pore images selected in each batch is 8; the confidence threshold is set to 0.001, which is the network's trust in the detected pores. If it exceeds the set value, the pores will be framed out; the intersection over union ratio of the pore prediction frame and the true frame, i.e., IoU, is set to 0.6. When performing the pore detection task, the pore detection algorithm detects the same pore multiple times, and the NMS algorithm is used so that the algorithm only obtains one detection frame for each pore. When the training is completed, an optimal weight file is obtained, which stores the important parameters for pore detection. The steps of the NMS algorithm are as follows:
[0049] (2) Sort the pore bounding boxes (BBoxes) of each round by confidence and select the BBox with the highest confidence;
[0050] (3) Calculate the IoU of the remaining BBox and the selected BBox, and eliminate the BBox whose IoU is greater than the set threshold;
[0051] (4) Repeat the above two steps until all BBoxes are processed. At this time, the BBox selected in each round is the final result.
[0052] Step 6: Test and compare the 3D printed concrete pore detection and classification network.
[0053] Step 6: Test and analyze indicators:
[0054] (1) Precision P: Defined from the perspective of prediction results, it refers to the probability of correct detection among all detected targets. The calculation formula is as follows:
[0055]
[0056] (2) Recall R (Recall): Defined from the perspective of samples, it refers to the probability of correct recognition among all positive samples. The calculation formula is as follows:
[0057]
[0058] (3) mAP: AP represents the average value of the detector under various recall conditions. It is a recognizer for a single category. mAP is the average of AP from the category dimension to evaluate the performance of multiple classifiers. The value is in the range of [0, 1], the larger the better. The calculation formula is as follows:
[0059]
[0060] (4) F Score: F Score is the harmonic mean of Precision and Recall, and is calculated as follows:
[0061]
[0062] The TP and FP in step (1) are explained as follows:
[0063] ①TP (True Positives): The number of instances that are correctly classified as positive examples, that is, the number of instances (number of samples) that are actually positive examples and are classified as positive examples by the classifier;
[0064] ②FP (False Positives): The number of instances that are mistakenly classified as positive examples, that is, the number of instances that are actually negative examples but are classified as positive examples by the classifier.
[0065] FN (False Negatives) in step (2) is the number of instances that are mistakenly classified as negative examples, that is, the number of instances that are actually positive examples but are classified as negative examples by the classifier.
[0066] The mAP in step (3) uses mAP@.5 and mAP@.5:.95 as evaluation indicators. Some parameters are explained as follows:
[0067] ①Precision-Recall curve: With recall as the horizontal axis and precision as the vertical axis, different thresholds are used to calculate the precision and recall rates under different thresholds;
[0068] ②IoU (Intersection-over-Union): This is a measure of the accuracy of detecting objects in a specific dataset. IoU represents the overlap between the candidate bounding box and the groundtruth bounding box, representing the ratio of their intersection to their union. The higher the correlation, the higher the value. Ideally, IoU is perfect overlap, with a ratio of 1.
[0069] ③AP (Average Precision): The area under the PR curve, which comprehensively considers the influence of P and R, and reflects the quality of the model's recognition of a certain category;
[0070]
[0071] ④num_classes: the number of sample classification categories.
[0072] ⑤mAP@.5: When IoU is set to 0.5, calculate the AP of all images in each category, and then average all categories, that is, mAP.
[0073] ⑥mAP@.5:.95: represents the average value at different IoU thresholds (from 0.5 to 0.95, with a step size of 0.05)
[0074] Average mAP on (0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95).
[0075] In step (4), B is a weight used to adjust the weight relationship between P and R. This paper uses F1Score as the evaluation standard, that is, B is set to 1.
[0076] The algorithm used in the present invention was tested using Python 3.8 on the Ubuntu operating platform. The specific software and hardware environment is shown in Table 1:
[0077] Table 1. Software and hardware environment parameters
[0078] Environmental parameters illustrate Memory 128.00GB CPU Intel(R)Xeon(R)Gold 5218CPU@2.30GHz GPU Tesla T4: 16GB*2+CUDA: 11.8 Operating platform Ubuntu Test platform Python3.8+pytorch2.0+yolov5
[0079] Table 2. Experimental results
[0080]
[0081]
[0082] The present invention first builds a target detection dataset (3D printed concrete pore dataset) based on actual engineering applications. Secondly, based on the well-known algorithm YOLOv5 in single-stage target detection with high detection rate, a pore detection and classification network suitable for 3D printed concrete is built to achieve pore detection and classification of 3D printed concrete. There are three improvements: ① Using the K-means++ clustering algorithm to achieve more accurate small target anchor frame size; ② Replacing the backbone network with the lightweight network ShuffleNetv2; ③ Integrating the PSA polarization self-attention module into the new algorithm to improve the network's ability to detect concrete pores. Through comparative experiments, the results are shown in Table 2. The mAP@.5 increased by 11.4%, the mAP@.5:.95 increased by 4.7%, and the F1 value increased by 7.6%. By applying this pore detection and classification method, the molding quality of components during 3D printing of concrete can be effectively guided.
Claims
1. A 3D printed concrete pore detection and classification method based on YOLOv5, characterized in that: The following steps are included: Step 1): Create a pore dataset for 3D printed concrete. Based on the characteristics of the pore dataset in step 1), pores are divided into two categories according to pore size: ① <3mm; ② 3mm-10mm; Step 2): Optimize the initial target prediction frame to more accurately detect small pores with a pore diameter of <3 mm in the pore dataset in step 1); Step 3): Preliminarily build the backbone network in the 3D printed concrete pore detection and classification network to extract and learn the features of the two types of pores in the pore dataset in step 1); Step 4): Based on the network in step 3), a recognition network is built in the 3D printing concrete pore detection and classification network to further detect and classify the features extracted in step 3); Step 5): Use the pore dataset prepared in step 1) to train the 3D printed concrete pore detection and classification network built in step 4); Step 6): Test and compare the 3D printed concrete pore detection and classification network; The backbone network in step 3) is built based on the YOLOv5 algorithm, using the lighter ShuffleNetV2 algorithm, and adding two PSA polarization self-attention modules to the algorithm. The backbone network in the 3D printed concrete pore detection and classification network has a total of 9 layers. The first layer is a convolutional pooling layer, which is used to modify the number of channels. The second to fifth layers are shufflenetv2 layers, and the sixth layer is a PSA layer; the seventh to eighth layers are shufflenetv2 layers; and the ninth layer is a PSA layer. The recognition network in step 4) consists of two parts: the neck network Neck and the head network Detect_head. The Neck part is used to fuse the pore feature maps extracted from the third, fifth, and ninth layers of the backbone network. It uses the FPN feature pyramid structure and the feature fusion module PANet to generate a multi-scale feature pyramid through upsampling and downsampling operations. The Detect_head part is used to perform multi-scale target detection on the feature pyramid, and then perform feature prediction on the last three layers in YOLOv5 to output the final pore detection results. The recognition network has a total of 15 layers. The first layer is a convolutional layer connected to the ninth layer of the backbone network; the second layer is an upsampling layer. The third layer is the connection layer, which connects the fifth layer of the backbone network and the second layer of the recognition network, and merges the outputs; the fourth layer is the C3 module, which consists of three convolution blocks. Between each convolution block, a BN layer and a LeakyReLU activation function are added; the fifth layer is the convolution layer; the sixth layer is the upsampling layer; the seventh layer is the connection layer, which connects the third layer of the backbone network and the sixth layer of the recognition network, and merges the outputs; the eighth layer is the C3 module; the ninth layer is the convolution layer; the tenth layer is the connection layer, which connects the fifth and eighth layers of the recognition network, and merges the outputs; the eleventh layer is the C3 module; the twelfth layer is the convolution layer; The thirteenth layer is the connection layer, which connects the first and twelfth layers of the recognition network and merges the outputs; the fourteenth layer is the C3 module; the fifteenth layer is the detection layer, and the detection inputs are the eighth, eleventh, and fourteenth layers of the recognition network respectively. A convolutional layer is added after each layer to adjust the number of channels.
2. A 3D printed concrete pore detection and classification method based on YOLOv5 according to claim 1, characterized in that: The images collected in step 1) are from a 3D printing concrete laboratory. Data enhancement is performed on the collected 3D printed concrete component images, including rotation, cropping, and segmentation. Pores are labeled using labelImg and classified into two categories: pores with a pore diameter of 3mm-10mm (irre-hole) and pores with a pore diameter of less than 3mm (sml-hole). The labeled concrete pore images are divided into three categories: a training set (train), a validation set (val), and a test set. The samples in the train file are used to train the model, the samples in the val file are used to verify the model, and the samples in the test file are used to test the model.
3. A 3D printing concrete pore detection and classification method based on YOLOv5 according to claim 1, characterized in that, The 3D printed concrete pore dataset used in step 2) is mainly composed of small targets, and the K-means++ clustering algorithm is used to realize the size of the initial target prediction box of the samples in the pore dataset.
4. A 3D printing concrete pore detection and classification method based on YOLOv5 according to claim 1, characterized in that, The training process in step 5) is as follows: when performing pore detection tasks, the pore detection algorithm may detect the same pore multiple times. The NMS algorithm is used to ensure that the algorithm only obtains one detection frame for each pore. When the training is completed, an optimal weight file is obtained, which stores important parameters for pore detection.
5. A 3D printing concrete pore detection and classification method based on YOLOv5 according to claim 1, characterized in that, The test analysis indicators in step 6) are: (1) Precision: Defined from the perspective of prediction results, it refers to the probability of detecting the correct target among all detected targets; (2) Recall: Defined from the perspective of samples, it refers to the probability of correct identification among all positive samples; (3) mAP: AP represents the average value of the detector under various recall conditions. It is a recognizer for a single category. mAP is the average of AP from the category dimension to evaluate the performance of multiple classifiers. The value is in the range of [0, 1], and the larger the better. (4) F Score: F Score is the harmonic mean of Precision and Recall.
Citation Information
Patent Citations
Concrete 3D printing interface pore detection method
CN114638813A