Road crack detection method and device, computer equipment and storage medium

Through the improved YOLOv8 model and feature fusion layer, the defects in the robustness and efficiency of road crack detection methods in the existing technology are solved, and more efficient and lightweight road crack detection is achieved, which is suitable for complex environments and mobile devices.

CN118570131APending Publication Date: 2024-08-30ZHUHAI WANWAN CLOUD TECH CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410603189.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-15
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Existing road crack detection methods have flaws in robustness and efficiency, making it difficult to effectively detect road cracks in complex environments and difficult to apply on mobile devices.

Method used

The improved YOLOv8 model is used for road crack detection, the training images are trained through image processing and feature fusion layers, a crack detection model is constructed, and the detection head is used to generate alarm information.

Benefits of technology

The accuracy, efficiency and lightweight of road crack detection are improved, making the detection method more suitable for application on mobile devices and enhancing the robustness to complex scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570131A
    Figure CN118570131A
Patent Text Reader

Abstract

The invention discloses a road crack detection method and device and a related medium, and the method comprises the steps: obtaining a road training image, and carrying out the image processing of the road training image, and obtaining a training image; inputting the training image into an improved YOLOv8 model to carry out crack detection training so as to construct a crack detection model; performing road crack detection on a specified road image through the crack detection model; and when the road crack is detected, marking the corresponding road image and generating corresponding alarm information. According to the road crack detection method, the training image is input into the improved YOLOv8 model for crack detection training, so that the crack detection model is constructed and obtained, road crack detection is performed on the specified road image by using the crack detection model, and the precision, efficiency and lightweight degree of the road crack detection method can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision technology, and in particular to a road crack detection method, device, computer equipment and storage medium. Background Art

[0002] Among the common road damages, road cracks are the most prone to occur. The existence of road cracks not only endangers the safety of pedestrians, but also affects the aesthetics of the road and the comfort of driving. If not repaired in time, the road cracks may even cause serious damage to the road due to further expansion, shortening the service life of the road. Therefore, timely detection and discovery of road cracks can effectively promote the timely repair of road damage, thereby ensuring the traffic safety of pedestrians and vehicles.

[0003] In the prior art, the commonly used road detection method is to extract features from road images through target detection algorithms, thereby identifying road cracks in images. The traditional target detection algorithm is easy to implement, but has poor robustness. When faced with complex and changing environments, it is difficult to effectively extract the features of road cracks. On this basis, the target detection algorithm based on deep learning has become a better solution for road crack detection. For example, some technicians have proposed a road crack detection method based on Faster R-CNN target detection. Compared with traditional target detection algorithms, this detection method is more robust and can handle more complex scenes. However, this detection method also has some defects, such as low detection efficiency, long training time, and high memory usage. These defects make the detection method more difficult to implement and difficult to apply on mobile devices, which affects the application flexibility of the detection method.

[0004] Therefore, how to provide a road crack detection method that has both detection accuracy and efficiency and is more lightweight is a problem to be solved by those skilled in the art. Summary of the invention

[0005] The embodiments of the present invention provide a road crack detection method, an apparatus, a computer device and a storage medium, aiming to improve the accuracy, efficiency and lightness of the road crack detection method.

[0006] In a first aspect, an embodiment of the present invention provides a road crack detection method, comprising:

[0007] Acquiring a road training image, and performing image processing on the road training image to obtain a training image;

[0008] Inputting the training image into the improved YOLOv8 model for crack detection training to construct a crack detection model;

[0009] Performing road crack detection on a specified road image using the crack detection model;

[0010] When a road crack is detected, the corresponding road image is annotated and corresponding warning information is generated.

[0011] In a second aspect, an embodiment of the present invention provides a road crack detection device, comprising:

[0012] An image processing unit, used for acquiring a road training image and performing image processing on the road training image to obtain a training image;

[0013] A model building unit, used for inputting the training image into an improved YOLOv8 model for crack detection training to build a crack detection model;

[0014] a crack detection unit, configured to perform road crack detection on a specified road image using the crack detection model;

[0015] The marking and warning unit is used to mark the corresponding road image and generate corresponding warning information when a road crack is detected.

[0016] In a third aspect, an embodiment of the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the road crack detection method as described in the first aspect when executing the computer program.

[0017] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the road crack detection method as described in the first aspect is implemented.

[0018] The embodiment of the present invention discloses a road crack detection method, device and related medium, the method comprising: obtaining a road training image, and performing image processing on the road training image to obtain a training image; inputting the training image into an improved YOLOv8 model for crack detection training to construct a crack detection model; performing road crack detection on a specified road image by using the crack detection model; when a road crack is detected, annotating the corresponding road image and generating corresponding warning information. The embodiment of the present invention inputs the training image into the improved YOLOv8 model for crack detection training to construct a crack detection model, thereby using the crack detection model to perform road crack detection on a specified road image, which can improve the accuracy, efficiency and lightweight of the road crack detection method. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0020] Figure 1 A schematic diagram of a process flow of a road crack detection method provided by an embodiment of the present invention;

[0021] Figure 2 A schematic diagram of a sub-process of a road crack detection method provided by an embodiment of the present invention;

[0022] Figure 3 A schematic diagram of a model training of a road crack detection method provided by an embodiment of the present invention;

[0023] Figure 4 A schematic diagram of training a BoT module in a road crack detection method provided by an embodiment of the present invention;

[0024] Figure 5 A schematic diagram of BoTNet training in a road crack detection method provided by an embodiment of the present invention;

[0025] Figure 6 A schematic diagram of training a multi-head self-attention layer in a road crack detection method provided by an embodiment of the present invention;

[0026] Figure 7 A schematic diagram of training of part of the convolutional layers in a road crack detection method provided by an embodiment of the present invention;

[0027] Figure 8 A schematic diagram of training a coordinate attention module in a road crack detection method provided by an embodiment of the present invention;

[0028] Fig. 9 A schematic block diagram of a road crack detection device provided by an embodiment of the present invention;

[0029] Fig.10 A sub-schematic block diagram of a road crack detection device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0030] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0031] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0032] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0033] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0034] See below Figure 1 , Figure 1 A schematic flow chart of a road crack detection method provided by an embodiment of the present invention specifically includes: steps S101 to S104.

[0035] S101, acquiring a road training image, and performing image processing on the road training image to obtain a training image;

[0036] S102, inputting the training image into an improved YOLOv8 model for crack detection training to construct a crack detection model;

[0037] S103, performing road crack detection on a specified road image using the crack detection model;

[0038] S104: When a road crack is detected, the corresponding road image is marked and corresponding warning information is generated.

[0039] In this embodiment, a crack detection model for road crack detection is constructed by inputting training images into an improved YOLOv8 model for crack detection training. The crack detection model is used to perform road crack detection on a specified road image, which can improve the accuracy, efficiency and lightweight of the road crack detection method.

[0040] Combination Figure 2 As shown, in one embodiment, step S102 includes: steps S201 to S203.

[0041] S201, inputting the training image into the backbone network of the improved YOLOv8 model, and outputting a plurality of sub-feature graphs of the training image by the backbone network;

[0042] S202, performing feature fusion on the plurality of sub-feature maps through a feature fusion layer of an improved YOLOv8 model to obtain a plurality of fused feature maps;

[0043] S203, using the detection head of the improved YOLOv8 model to train and learn the fusion feature map, and output the corresponding prediction result, so as to construct the crack detection model.

[0044] In this embodiment, after the training image is input into the improved YOLOv8 model, the training image is first trained through the backbone network of the improved YOLOv8 model to obtain a plurality of sub-feature maps, and then the plurality of sub-feature maps are input into the feature fusion layer of the improved YOLOv8 model, and the feature fusion layer is used to perform feature fusion on the plurality of sub-feature maps to obtain a plurality of fused feature maps, and finally the plurality of fused feature maps are input into the detection head of the improved YOLOv8 model, and the fused feature maps are trained and learned by the detection head, so that the prediction result corresponding to the training image is outputted through the detection head, and thereby a crack detection model for road crack detection is constructed.

[0045] Combination Figure 3 As shown, in one embodiment, step S201 includes:

[0046] Using the first CBS modules at different levels in the backbone network to extract features from the training image; wherein the first CBS module includes a basic convolution layer, a batch normalization layer and an activation function layer;

[0047] The multi-level C2f module in the backbone network is used to perform gradient information enrichment processing on the output results of the first CBS modules at different levels to obtain candidate sub-feature graphs at multiple levels; wherein the C2f module includes an input layer, a convolutional layer, a pooling layer, a fully connected layer and an output layer;

[0048] Outputting the candidate sub-feature maps of other levels except the candidate sub-feature map of the last level as sub-feature maps, and inputting the candidate sub-feature map of the last level into the SPPF module in the backbone network for receptive field expansion;

[0049] The candidate sub-feature map after the expanded receptive field is input into the BoT module, and the BoT module outputs the corresponding intermediate sub-feature map; wherein the BoT module includes a second CBS module, a Split layer, a Bottleneck Transformer network, a Concat fusion layer and a third CBS module;

[0050] The intermediate sub-feature map is input into the first coordinate attention module, and the output result of the first coordinate attention module is output as the sub-feature map of the last level.

[0051] In this embodiment, first, the training image is input into the backbone network of the improved YOLOv8 model, and the first CBS modules at different levels in the backbone network are used to extract features from the training image, thereby obtaining output results at different levels. The first CBS module in this embodiment includes a basic convolutional layer (Conv), a batch normalization layer (BN), and an activation function layer (SiLU), wherein the basic convolutional layer is the module mainly responsible for feature extraction, the batch normalization layer is used to control the complexity of the model and accelerate the convergence speed of the deep network, and the activation function layer is used to introduce nonlinear characteristics so that the neural network can learn and represent complex patterns and data relationships.

[0052] Secondly, this embodiment sets corresponding multi-level C2f modules between the first CBS modules at different levels, and uses the multi-level C2f modules to perform gradient information enrichment processing on the output results of the first CBS modules at different levels, obtains and corresponds to multiple levels of candidate sub-feature graphs, and uses the candidate sub-feature graphs of other levels except the candidate sub-feature graph of the last level as sub-feature graphs to output to the feature fusion layer of the improved YOLOv8 model for the next step of processing. Figure 3As shown, in this embodiment, the first CBS modules and multi-level C2f modules of different levels are alternately arranged until the C2f module of the last level. For example, the output result of the first CBS module of the first level enters the C2f module of the first level for gradient information enrichment processing to obtain the candidate sub-feature map of the first level, and the candidate sub-feature map of the first level enters the first CBS module of the second level, and the output result of the first CBS module of the second level enters the C2f module of the second level for gradient information enrichment processing to obtain the candidate sub-feature map of the second level, until the C2f module of the last level outputs the candidate sub-feature map of the last level. The C2f module in this embodiment adopts a multi-branch shunt design, so that it can provide richer gradient information for the model, thereby enhancing the feature fusion capability of the convolutional network. In addition, in a specific application scenario, since the image size corresponding to the output result of the first CBS module in the backbone network is relatively large, if the output result is directly input into the C2f module for processing, the complexity and amount of calculation are relatively large. Therefore, the C2f module may not be set after the first CBS module, and the C2f module may be set after the second CBS module. In this way, the output result with a smaller image size can be output through the second CBS module to the C2f module for processing, thereby reducing the calculation complexity and amount to a certain extent. It should be noted that at this time, the first CBS module is not the first CBS module of the first level, and the second CBS module is the first CBS module of the first level.

[0053] Then, the candidate sub-feature maps of other levels except the candidate sub-feature map of the last level are used as sub-feature maps to be output to the feature fusion layer of the improved YOLOv8 model for the next step of processing. At the same time, the candidate sub-feature map of the last level is input into the SPPF (spatial pyramid pooling layer) module of the backbone network to expand the receptive field of the candidate sub-feature map of the last level to enrich the feature information of the candidate sub-feature map, and the candidate sub-feature map after the expanded receptive field is input into the BoT module, so as to use the BoT module to improve the model's ability to capture long-distance dependencies, thereby more fully extracting the local feature information and global feature information in the candidate sub-feature map, enhancing the feature information processing capability, and the BoT module outputs the corresponding intermediate sub-feature map to the first coordinate attention (CA) module.

[0054] Finally, the first coordinate attention module is used to highlight the key information of road cracks to enhance feature extraction, thereby improving the model's ability to recognize road cracks, and the output result of the first coordinate attention module is output as the sub-feature map of the last level.

[0055] In this embodiment, the candidate sub-feature maps of each level will present different sizes due to the different number of convolutions. For example, when the size of the feature map of a certain level is S*S*C1, if the downsampling ratio is specified to be 2, this feature map will be divided into 4 feature maps of size S / 2*S / 2*4C1, and then the number of convolution channels with a step size of 1 is compressed to obtain the feature map of the next level, so that the purpose of downsampling can be achieved by the method of segmenting the feature map and combining it with convolution. This embodiment can fully utilize the multi-scale information of the training image and realize multi-scale prediction by outputting multiple sub-feature maps of different sizes from the backbone network to the subsequent feature fusion layer for further processing, thereby effectively improving the model's detection ability for targets of different sizes.

[0056] In specific application scenarios, considering factors such as the amount of model calculation and the speed of model calculation, in the backbone network, only the candidate sub-feature maps of some levels including the last level can be selected as sub-feature maps, and these sub-feature maps can be processed in the subsequent feature fusion layer. For example, the candidate sub-feature maps output by the C2f of two levels and the candidate sub-feature maps output by the first coordinate attention module (i.e., the candidate sub-feature maps of the last level) can be selected as sub-feature maps.

[0057] Combination Figure 4 As shown, in a specific embodiment, the BoT module includes a second CBS module, a Split splitting layer, a Bottleneck Transformer network (BOTNet), a Concat fusion layer and a third CBS module. After the candidate sub-feature map after the expanded receptive field is input into the BoT module, it first enters the second CBS module. The second CBS module improves the feature extraction capability and performance of the model by combining the basic convolution layer, the batch normalization layer and the activation function layer, and outputs the corresponding feature map to the Split splitting layer. Then, the feature map output by the second CBS module is split in half according to the number of channels through the Split splitting layer to obtain two split feature maps, one of which is input into BOTNet. BOTNet reduces the amount of model calculation and improves the model running speed. Then, the output result of BOTNet is input into the Concat fusion layer, and it is connected with the other split feature map along the channel dimension, and the spliced ​​result is input into the third CBS module, and the third CBS module is used to output the intermediate sub-feature map. It should be noted that the second CBS module and the third CBS module have the same structure and are named separately only for the convenience of distinction. Similarly, the structures of other CBS modules with different names (such as the first CBS module) are also the same.

[0058] Further, combined with Figure 5As shown, the Bottleneck Transformer network includes a fourth CBS module, a multi-head self-attention layer (Multi-Head Self-Attention, MHSA) and a residual addition module.

[0059] Among them, the structure of the multi-head self-attention layer is as follows Figure 6 shown. Figure 6 The content-position part on the left represents the two-dimensional position encoding applied to the feature map, R with size H×1×d h and R with dimensions of 1×W×d w They represent the row position encoding and column position encoding of the feature map respectively. These two position encodings can enhance the model's understanding and processing capabilities of the spatial information of the input data. The two position encodings are summed element by element through the matrix to obtain a content position vector r of size H×W×d. The content position vector r contains the position information of the feature map. Figure 6 The content-content part on the right represents the relationship between the content of the feature map itself, and the features of the multi-head self-attention layer are input. Figure X The query weight matrix (W Q ), key weight matrix (W K ) and the value weight matrix (W V ) is linearly transformed, and the corresponding query vector q, key vector k and value vector v are obtained. The query vector q is matrix multiplied with the content position vector r and the key vector k respectively to obtain two calculation results qr of size H*W×H*W T and qk T , where T represents the transpose operation. Then, the two calculation results are summed element by element, and the summation result is input into the softmax function for vector conversion. Finally, the vector conversion result is matrix multiplied with the value vector v to obtain the final output Z of the multi-head self-attention layer.

[0060] Road cracks are usually distributed in an elongated shape, making them more difficult to detect. To address this problem, the present embodiment introduces a BoT module into the backbone network. The BoTNet of the BoT module replaces the standard 3×3 convolutional layer with the multi-head self-attention layer of Transformer, thereby achieving an effective combination of a convolutional neural network (the YOLOv8 model in this embodiment) and an attention mechanism. This allows the advantages of the convolutional neural network in extracting multi-level features and the advantages of the attention mechanism in acquiring contextual information to complement each other, better adapt to the elongated features of road cracks, and better extract the global and local feature information of road crack images. This increases the amount of model computation and reduces the running speed without stacking more standard 3×3 convolutional layers, thereby achieving better road crack detection effects.

[0061] In one embodiment, the step S202 includes:

[0062] Inputting the plurality of sub-feature maps into the feature fusion layer for feature fusion to obtain a candidate fused feature map;

[0063] Using some convolutional layers to extract spatial features from some channels of the candidate fusion feature map to obtain an intermediate fusion feature map;

[0064] The intermediate fused feature map is input into a second coordinate attention module, and the output result of the second coordinate attention module is output as the fused feature map.

[0065] In this embodiment, multiple sub-feature maps of the input feature fusion layer are subjected to feature fusion processing (Concat) to obtain a candidate fusion feature map, and then the partial convolution layer (PConv) is used to extract spatial features of some channels of the candidate fusion feature map to obtain the corresponding intermediate fusion feature map, and finally the intermediate fusion feature map is input into the second coordinate attention module, and the coordinate attention module is used to enhance the attention to the position information in the feature map, and then the output result of the second coordinate attention module is output as the fusion feature map. In actual application scenarios, the backbone network inputs multiple sub-feature maps of different sizes into the feature fusion layer, and the feature fusion layer performs feature fusion processing on multiple sub-feature maps of different sizes, which can make full use of the multi-scale information of the training image, realize multi-scale prediction, and improve the model's detection ability for targets of different sizes.

[0066] In a specific embodiment, after a plurality of sub-feature maps of different sizes are input into the feature fusion layer, a multi-level feature fusion process is performed. For example, when there are three sub-feature maps in the backbone network input feature fusion layer, the three sub-feature maps can be represented as a first-level sub-feature map, a second-level sub-feature map, and a third-level sub-feature map, where the third-level sub-feature map is the sub-feature map of the last level. In this case, after the third-level sub-feature map is input into the feature fusion layer, it is first upsampled (Upsample). This is because the resolution of the deep sub-feature map is lower than that of the shallow sub-feature map. Therefore, it is necessary to improve the resolution of the deep sub-feature map through upsampling to match the resolution of the shallow sub-feature map. Then, the result of the first upsampling process and the second-level sub-feature map are subjected to feature fusion processing to obtain a first candidate fused feature map. Subsequently, a partial convolution layer is used to perform spatial feature extraction on the first candidate fused feature map to obtain a first intermediate fused feature map. The first intermediate fused feature map is input into the first-level second coordinate attention module, and the output result of the first-level second coordinate attention module is subjected to a second upsampling process. Then, the result of the second upsampling process and the first-level sub-feature map are subjected to feature fusion processing to obtain a second candidate fused feature map. Subsequently, a partial convolution layer is used to perform spatial feature extraction on the first candidate fused feature map to obtain a first intermediate fused feature map. The first intermediate fused feature map is input into the first-level second coordinate attention module, and the output result of the first-level second coordinate attention module is subjected to a second upsampling process. Then, the result of the second upsampling process and the first-level sub-feature map are subjected to feature fusion processing to obtain a second candidate fused feature map. Subsequently, a partial convolution layer is used to perform spatial feature extraction on the first candidate fused feature map to obtain a To the second intermediate fusion feature map, the second intermediate fusion feature map is input into the second-level second coordinate attention module, and then the output result of the second-level second coordinate attention module is input into the fifth CBS module for the first basic convolution processing, and the result of the first basic convolution processing and the output result of the first-level second coordinate attention module are subjected to feature fusion processing to obtain the third candidate fusion feature map, and then the third candidate fusion feature map is extracted by using the partial convolution layer to obtain the third intermediate fusion feature map, and then the third intermediate fusion feature map is input into the third-level second coordinate attention module, and the output result of the third-level second coordinate attention module is input into the fifth CBS module for the second basic convolution processing, and then the result of the second basic convolution processing and the third-level sub-feature map are subjected to feature fusion processing to obtain the fourth candidate fusion feature map, and then the fourth candidate fusion feature map is input into the partial convolution layer to obtain the fourth intermediate fusion feature map, and the fourth intermediate fusion feature map is input into the fourth-level second coordinate attention module. Finally, the output results of the second-level second coordinate attention module, the third-level second coordinate attention module and the fourth-level second coordinate attention module are used as fusion feature maps and output to the detection head for road crack prediction. Of course, in other application scenarios, the processing level of the feature fusion layer can be adjusted according to actual needs, that is, the number of some convolutional layers, the second coordinate attention module and other parts can be adjusted according to needs, and the number of fused feature maps finally output to the detection head can also be adjusted according to actual conditions, not limited to three fused feature maps.

[0067] In the traditional YOLOv8 model, its feature fusion layer uses a multi-branch C2f module to improve the model's extraction capability, but this also increases the number of channels and parameters of the module, resulting in a decrease in the model's detection speed. In response to this, this embodiment replaces the traditional C2f module with some convolutional layers in the feature fusion layer to reduce floating-point calculations, reduce the number of model parameters, achieve model compression, and speed up feature fusion, thereby improving the model's operational efficiency. Figure 7 As shown in the figure, some convolutional layers only process some channels (h, w, c) of the input feature map. p The conventional convolution is applied to extract spatial features and the remaining channels are kept unchanged. Assuming that the size of the input feature map is [H, W], the floating point calculation amount of the partial convolution layer is where c p Indicates the ratio of the number of channels involved in the convolution operation. When k = 3, c p =4, the floating-point calculation amount of the partial convolution layer is only 1 / 16 of that of the conventional convolution, that is, only the part corresponding to the first 1 / 4 number of channels of the input feature map is convolved, and the remaining 3 / 4 channels of the feature map are kept unchanged, and then these two parts are spliced ​​to obtain the final output of the partial convolution layer. This embodiment can greatly reduce redundant calculations and memory accesses by applying partial convolution layers, thereby improving the number of floating-point operations per second of the model, achieving more effective extraction of image spatial features while improving the model's computing performance, and can also make the trained road detection model more lightweight, thereby improving its application flexibility and enabling it to be better applied on mobile devices.

[0068] In one embodiment, the step S203 includes:

[0069] Inputting the fused feature map into the detection head of the improved YOLOv8 model, and obtaining the predicted target box corresponding to the fused feature map and the confidence score corresponding to the predicted target box by the output of the detection head;

[0070] It is determined whether the predicted target frame contains road cracks according to the confidence score, so as to obtain the prediction result.

[0071] In this embodiment, the fused feature map is first input into the detection head (Detect, Detection Head) of the improved YOLOv8 model, and then the detection head is used to predict the predicted target box corresponding to the fused feature map and the confidence score corresponding to the predicted target box. Then, according to the confidence score, it is determined whether the predicted target box contains road cracks, thereby obtaining the final road crack detection result.

[0072] In a specific embodiment, the detection head processes the fused feature map to obtain the center coordinates, width, height and confidence score corresponding to the predicted target box that may contain the road crack, and compares the confidence score with the score threshold. If the confidence score is greater than the score threshold, it is determined that there is a road crack in the predicted target box, and then the predicted target box is drawn on the image according to the center coordinates, width and height. In this way, the area corresponding to the road crack can be displayed. In actual application scenarios, the detection head will output multiple predicted target boxes. At this time, the confidence scores of each predicted target box can be compared, and the predicted target box with the highest confidence score is selected as the final output road crack target box. Furthermore, multiple detection heads can be set in the improved YOLOv8 model, and the multiple detection heads can be used to process the multiple fused feature maps output by the feature fusion layer respectively. Each detection head outputs multiple predicted target frames, and then the final road crack target frame is selected from all the predicted target frames according to the confidence score. For example, three detection heads are set in the improved YOLOv8 model to process the fused feature maps output by the second-level second coordinate attention module, the third-level second coordinate attention module and the fourth-level second coordinate attention module respectively, and multiple predicted target frames are obtained respectively.

[0073] After obtaining the road crack target frame containing the road cracks, it can also be marked with a prominent color, and the coordinate position information of the corresponding training image can be obtained. Then, an alarm message is generated by combining the image with the coordinate position information and the road crack target frame, and pushed to the relevant management department, so that the management department can repair the road cracks in time to ensure road traffic safety.

[0074] Combination Figure 8 As shown, in one embodiment, the inputting of the intermediate sub-feature map into the first coordinate attention module, and outputting the output result of the first coordinate attention module as the sub-feature map of the last level, includes:

[0075] Performing global average pooling processing on the intermediate sub-feature map in the horizontal and vertical coordinate directions respectively, and obtaining a horizontal sub-feature map and a vertical sub-feature map correspondingly;

[0076] Transposing the horizontal axis sub-feature map and the vertical axis sub-feature map to the same dimension, and stacking the horizontal axis sub-feature map and the vertical axis sub-feature map to form a stacked sub-feature map;

[0077] The stacked sub-feature maps are sequentially subjected to 1×1 convolution processing, batch normalization processing, and nonlinear ReLU activation processing, and then the stacked sub-feature maps are separated according to the spatial dimension to obtain a first separated sub-feature map and a second separated sub-feature map;

[0078] Transpose the first separated sub-feature map, and perform feature conversion on the second separated sub-feature map and the transposed first separated sub-feature map through 1×1 convolution;

[0079] Performing a nonlinear transformation on the first separated sub-feature map and the second separated sub-feature map after feature conversion by a sigmoid activation function to obtain the attention weights of the intermediate sub-feature map in two dimensions of width and height;

[0080] The intermediate sub-feature map and the attention weight are combined and multiplied to obtain the output result of the first coordinate attention module.

[0081] In this embodiment, first, the intermediate sub-feature map input to the attention module is subjected to global average pooling processing in the horizontal and vertical coordinate directions, and the corresponding horizontal axis sub-feature map and vertical axis sub-feature map are obtained. For example, the size of the intermediate sub-feature map input to the attention module is [C, H, W], where C, H and W represent the number of channels of the intermediate sub-feature map and the height and width of the intermediate sub-feature map, respectively. Then, after global average pooling processing in the horizontal direction (horizontal axis) and the vertical direction (vertical axis), a horizontal axis sub-feature map with a size of [C, H, 1] and a vertical axis sub-feature map with a size of [C, 1, W] are obtained;

[0082] Secondly, the dimensions of the horizontal axis sub-feature map and the vertical axis sub-feature map are made the same by transposition processing, and the stacked sub-feature map is obtained by stacking the horizontal axis sub-feature map and the vertical axis sub-feature map. For example, the horizontal axis sub-feature map with a size of [C, H, 1] and the vertical axis sub-feature map with a size of [C, 1, W] are stacked to obtain a stacked sub-feature map with a size of [C, 1, H+W].

[0083] Next, the stacked sub-feature maps are sequentially subjected to 1×1 convolution processing, batch normalization processing, and nonlinear ReLU activation processing, and are separated according to the spatial dimensions (width and height, corresponding to the horizontal axis and the vertical axis, respectively) of the feature maps to obtain a first separated sub-feature map and a second separated sub-feature map of different dimensions, and the first separated sub-feature map is transposed. For example, the stacked sub-feature map of size [C, 1, H+W] is separated according to the spatial dimensions to obtain a first separated sub-feature map of size [C, 1, H] and a second separated sub-feature map of size [C, 1, W]. The size of the transposed first separated sub-feature map is [C, H, 1];

[0084] Then, a 1×1 convolution is performed on the transposed first and second separated sub-feature maps to perform feature conversion, so that the number of channels of the first and second separated sub-feature maps is equal to the number of channels of the intermediate sub-feature map input to the attention module. Then, a nonlinear transformation is performed on the first and second separated sub-feature maps after feature conversion through a sigmoid activation function to obtain the attention weights of the intermediate sub-feature map in the width and height dimensions.

[0085] Finally, the middle sub-feature map and the attention weights in these two dimensions are combined and multiplied to obtain the final output result of the coordinate attention module. For example, the middle sub-feature map is represented by f, and its attention weights in the width and height dimensions are represented by g respectively. h and g w The final output of the coordinate attention module is f c =f×g h ×g w .

[0086] This embodiment processes the feature map through the coordinate attention module to enhance the model's attention to the key areas of the edge positions of road cracks and suppress the interference of irrelevant background information, thereby improving the model's ability to detect road cracks. At the same time, the coordinate attention can not only capture the cross-channel information in the feature map, but also obtain direction perception and position perception, and use the spatial information of the feature map as part of the attention, and simultaneously maintain long-distance dependence in two directions, thereby helping the model to more accurately locate road cracks and improve the ability to recognize road cracks. In addition, the setting of the coordinate attention module is highly flexible and can be placed in multiple positions of the model without increasing too much model calculation, thereby avoiding the excessive model calculation affecting the detection speed of road cracks.

[0087] In one embodiment, the acquiring of the road training image and performing image processing on the road training image to obtain the training image includes:

[0088] Performing Gaussian smoothing filtering on the road training image to eliminate noise in the road training image;

[0089] According to the following formula, the road training image after noise elimination is converted into a logarithmic space to obtain a logarithmic image, and the logarithmic image is subjected to Gaussian filtering to obtain an illumination image according to the logarithmic image after Gaussian filtering:

[0090] I log =log 10 (I+1)

[0091] L=G*I log

[0092] Where I represents the road training image, log 10 Indicates the logarithmic operation with base 10, I log represents the logarithmic image, G represents the Gaussian filter kernel, and L represents the illumination image;

[0093] According to the following formula, the difference between the logarithmic image and the illuminance image is calculated to obtain a reflection image, and the reflection image is converted into a linear space:

[0094] R=I log -L

[0095] R exp =exp(R)-1

[0096] Wherein, R represents the reflected image, R exp represents the reflected image in linear space;

[0097] According to the following formula, the brightness of the reflection image in the linear space is adjusted to obtain a candidate training image:

[0098]

[0099] Among them, max(R exp ) represents the maximum pixel value of the reflection image in the linear space, O represents the candidate training image;

[0100] The candidate training image is expanded to obtain the training image; wherein the expansion process includes any one or more of random angle rotation, horizontal flipping and vertical flipping.

[0101] In this embodiment, first, a Gaussian smoothing filter is performed on the road training image by Gaussian filtering to eliminate noise in the road training image, thereby improving the image quality; then, the road training image with noise eliminated is converted to a logarithmic space to obtain a corresponding logarithmic image, and the logarithmic image is processed by Gaussian filtering to obtain a corresponding illumination image; then, a reflection image is obtained by calculating the difference between the logarithmic image and the illumination image, and the brightness of the reflection image is adjusted. By normalizing the reflection image to 1 and then amplifying it, the contrast and details of the reflection image are enhanced, thereby obtaining a candidate training image; finally, the number of candidate training images is expanded by dilation processing, thereby obtaining a training image for subsequent training models.

[0102] In actual application scenarios, the training images can be randomly divided according to a certain ratio to obtain the corresponding training set, validation set and test set, so as to train the model with the training set, adjust the model parameters with the validation set, and evaluate the final performance of the model with the test set. In addition, road training images can be obtained by taking pictures with road cameras, road patrol cars and other equipment, and the corresponding position information of each image can be recorded when taking pictures, so that the corresponding road crack position can be found more quickly according to the corresponding position information when the road crack is detected later, thereby improving the efficiency of repairing road cracks.

[0103] Fig. 9 A schematic block diagram of a road crack detection device 900 provided in an embodiment of the present invention, the device 900 includes:

[0104] The image processing unit 901 is used to obtain a road training image and perform image processing on the road training image to obtain a training image;

[0105] A model building unit 902 is used to input the training image into the improved YOLOv8 model for crack detection training to build a crack detection model;

[0106] A crack detection unit 903, configured to perform road crack detection on a specified road image using the crack detection model;

[0107] The marking and warning unit 904 is used to mark the corresponding road image and generate corresponding warning information when a road crack is detected.

[0108] Combination Fig.10 As shown, in one embodiment, the model building unit 902 includes:

[0109] The sub-feature unit 1001 is used to input the training image into the backbone network of the improved YOLOv8 model, and the backbone network outputs a plurality of sub-feature graphs of the training image;

[0110] A feature fusion unit 1002 is used to perform feature fusion on the plurality of sub-feature graphs through a feature fusion layer of an improved YOLOv8 model to obtain a plurality of fused feature graphs;

[0111] The result prediction unit 1003 is used to train and learn the fusion feature map using the detection head of the improved YOLOv8 model, and output the corresponding prediction result, so as to construct the crack detection model.

[0112] In one embodiment, the sub-feature map output unit 1001 includes:

[0113] A feature extraction unit, configured to extract features from the training image using first CBS modules at different levels in the backbone network; wherein the first CBS module comprises a basic convolution layer, a batch normalization layer, and an activation function layer;

[0114] A gradient information enrichment unit, used to use the multi-level C2f module in the backbone network to perform gradient information enrichment processing on the output results of the first CBS modules at different levels to obtain candidate sub-feature maps at multiple levels; wherein the C2f module includes an input layer, a convolution layer, a pooling layer, a fully connected layer and an output layer;

[0115] A receptive field expansion unit, used to output the candidate sub-feature maps of other levels except the candidate sub-feature map of the last level as sub-feature maps, and input the candidate sub-feature map of the last level into the SPPF module in the backbone network for receptive field expansion;

[0116] The intermediate sub-feature unit is used to input the candidate sub-feature map after the expanded receptive field into the BoT module, and the BoT module outputs the corresponding intermediate sub-feature map; wherein the BoT module includes a second CBS module, a Split layer, a Bottleneck Transformer network, a Concat fusion layer and a third CBS module;

[0117] A sub-feature output unit is used to input the intermediate sub-feature map into the first coordinate attention module, and output the output result of the first coordinate attention module as the sub-feature map of the last level.

[0118] In one embodiment, the feature fusion unit 1002 includes:

[0119] A candidate fusion feature unit, used for inputting the plurality of sub-feature maps into the feature fusion layer for feature fusion to obtain a candidate fusion feature map;

[0120] An intermediate fusion feature unit uses a partial convolution layer to extract spatial features from some channels of the candidate fusion feature map to obtain an intermediate fusion feature map;

[0121] A fusion feature output unit is used to input the intermediate fusion feature map into a second coordinate attention module, and output the output result of the second coordinate attention module as the fusion feature map.

[0122] In one embodiment, the result prediction unit 1003 includes:

[0123] A sub-result prediction unit, used for inputting the fused feature map into the detection head of the improved YOLOv8 model, and obtaining the predicted target box corresponding to the fused feature map output by the detection head, and obtaining the confidence score corresponding to the predicted target box;

[0124] The crack judgment unit is used to judge whether the predicted target frame contains road cracks according to the confidence score, so as to obtain the prediction result.

[0125] In one embodiment, the sub-feature output unit includes:

[0126] A global average pooling unit, used to perform global average pooling processing on the intermediate sub-feature map in the horizontal and vertical coordinate directions respectively, to obtain a horizontal sub-feature map and a vertical sub-feature map respectively;

[0127] A feature stacking unit, used for transposing the horizontal axis sub-feature map and the vertical axis sub-feature map into the same dimension, and stacking the horizontal axis sub-feature map and the vertical axis sub-feature map into a stacked sub-feature map;

[0128] A feature separation unit, used to sequentially perform 1×1 convolution processing, batch normalization processing, and nonlinear ReLU activation processing on the stacked sub-feature maps, and then separate the stacked sub-feature maps according to the spatial dimension to obtain a first separated sub-feature map and a second separated sub-feature map;

[0129] a feature conversion unit, configured to perform a transposition process on the first separation sub-feature map, and perform feature conversion on the second separation sub-feature map and the transposed first separation sub-feature map through a 1×1 convolution;

[0130] A nonlinear transformation unit, used for performing a nonlinear transformation on the first separated sub-feature map and the second separated sub-feature map after feature conversion through a sigmoid activation function to obtain attention weights of the intermediate sub-feature map in two dimensions of width and height;

[0131] A merging and multiplication unit is used to merge and multiply the intermediate sub-feature map and the attention weight to obtain the output result of the first coordinate attention module.

[0132] In one embodiment, the image processing unit 901 includes:

[0133] A noise elimination unit, used for performing Gaussian smoothing filtering on the road training image to eliminate noise in the road training image;

[0134] The image conversion unit is used to convert the road training image after noise elimination into a logarithmic space according to the following formula to obtain a logarithmic image, and perform Gaussian filtering on the logarithmic image to obtain an illumination image according to the logarithmic image after Gaussian filtering:

[0135] I log =log 10 (I+1)

[0136] L=G*I log

[0137] Where I represents the road training image, log 10 Indicates the logarithmic operation with base 10, I log represents the logarithmic image, G represents the Gaussian filter kernel, and L represents the illumination image;

[0138] The difference calculation unit is used to calculate the difference between the logarithmic image and the illumination image according to the following formula to obtain a reflection image, and convert the reflection image into a linear space:

[0139] R=I log -L

[0140] R exp =exp(R)-1

[0141] Wherein, R represents the reflected image, R exp represents the reflection image in linear space;

[0142] The brightness adjustment unit is used to adjust the brightness of the reflection image in the linear space according to the following formula to obtain a candidate training image:

[0143]

[0144] Among them, max(R exp ) represents the maximum pixel value of the reflection image in the linear space, O represents the candidate training image;

[0145] The expansion processing unit is used to perform expansion processing on the candidate training image to obtain the training image; wherein the expansion processing includes any one or more of random angle rotation, horizontal flipping and vertical flipping.

[0146] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.

[0147] The embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed, the steps provided in the above embodiment can be implemented. The storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0148] The embodiment of the present invention also provides a computer device, which may include a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps provided in the above embodiment may be implemented. Of course, the computer device may also include various network interfaces, power supplies and other components.

[0149] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of this application.

[0150] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A road crack detection method, It is characterized in that include: Acquiring a road training image, and performing image processing on the road training image to obtain a training image; Inputting the training image into the improved YOLOv8 model for crack detection training to construct a crack detection model; Performing road crack detection on a specified road image using the crack detection model; When a road crack is detected, the corresponding road image is annotated and corresponding warning information is generated.

2. The road crack detection method according to claim 1, It is characterized in that The step of inputting the training image into the improved YOLOv8 model for crack detection training to construct a crack detection model includes: Inputting the training image into the backbone network of the improved YOLOv8 model, and outputting a plurality of sub-feature graphs of the training image by the backbone network; Performing feature fusion on the plurality of sub-feature maps through a feature fusion layer of an improved YOLOv8 model to obtain a plurality of fused feature maps; The detection head of the improved YOLOv8 model is used to train and learn the fusion feature map, and the corresponding prediction results are output to construct the crack detection model.

3. The road crack detection method according to claim 1, It is characterized in that The step of inputting the training image into the backbone network of the improved YOLOv8 model, and outputting a plurality of sub-feature graphs of the training image by the backbone network, comprises: Using the first CBS modules at different levels in the backbone network to extract features from the training image; wherein the first CBS module includes a basic convolution layer, a batch normalization layer and an activation function layer; The multi-level C2f module in the backbone network is used to perform gradient information enrichment processing on the output results of the first CBS modules at different levels to obtain candidate sub-feature graphs at multiple levels; wherein the C2f module includes an input layer, a convolutional layer, a pooling layer, a fully connected layer and an output layer; Outputting the candidate sub-feature maps of other levels except the candidate sub-feature map of the last level as sub-feature maps, and inputting the candidate sub-feature map of the last level into the SPPF module in the backbone network for receptive field expansion; The candidate sub-feature map after the expanded receptive field is input into the BoT module, and the BoT module outputs the corresponding intermediate sub-feature map; wherein the BoT module includes a second CBS module, a Split layer, a Bottleneck Transformer network, a Concat fusion layer and a third CBS module; The intermediate sub-feature map is input into the first coordinate attention module, and the output result of the first coordinate attention module is output as the sub-feature map of the last level.

4. The road crack detection method according to claim 3, It is characterized in that The feature fusion layer of the improved YOLOv8 model performs feature fusion on the multiple sub-feature maps to obtain multiple fused feature maps, including: Inputting the plurality of sub-feature maps into the feature fusion layer for feature fusion to obtain a candidate fused feature map; Using some convolutional layers to extract spatial features from some channels of the candidate fusion feature map to obtain an intermediate fusion feature map; The intermediate fused feature map is input into a second coordinate attention module, and the output result of the second coordinate attention module is output as the fused feature map.

5. The road crack detection method according to claim 2, It is characterized in that The detection head using the improved YOLOv8 model trains and learns the fusion feature map and outputs the corresponding prediction results to construct the crack detection model, including: Inputting the fused feature map into the detection head of the improved YOLOv8 model, and obtaining the predicted target box corresponding to the fused feature map and the confidence score corresponding to the predicted target box by the output of the detection head; It is determined whether the predicted target frame contains road cracks according to the confidence score, so as to obtain the prediction result.

6. The road crack detection method according to claim 3, It is characterized in that The step of inputting the intermediate sub-feature map into a first coordinate attention module, and outputting an output result of the first coordinate attention module as a sub-feature map of the last level, comprises: Performing global average pooling processing on the intermediate sub-feature map in the horizontal and vertical coordinate directions respectively, and obtaining a horizontal sub-feature map and a vertical sub-feature map correspondingly; Transposing the horizontal axis sub-feature map and the vertical axis sub-feature map to the same dimension, and stacking the horizontal axis sub-feature map and the vertical axis sub-feature map to form a stacked sub-feature map; The stacked sub-feature maps are sequentially subjected to 1×1 convolution processing, batch normalization processing, and nonlinear ReLU activation processing, and then the stacked sub-feature maps are separated according to the spatial dimension to obtain a first separated sub-feature map and a second separated sub-feature map; Transpose the first separated sub-feature map, and perform feature conversion on the second separated sub-feature map and the transposed first separated sub-feature map through 1×1 convolution; Performing a nonlinear transformation on the first separated sub-feature map and the second separated sub-feature map after feature conversion by a sigmoid activation function to obtain the attention weights of the intermediate sub-feature map in two dimensions of width and height; The intermediate sub-feature map and the attention weight are combined and multiplied to obtain the output result of the first coordinate attention module.

7. The road crack detection method according to claim 1, It is characterized in that The step of acquiring a road training image and performing image processing on the road training image to obtain a training image includes: Performing Gaussian smoothing filtering on the road training image to eliminate noise in the road training image; According to the following formula, the road training image after noise elimination is converted into a logarithmic space to obtain a logarithmic image, and the logarithmic image is subjected to Gaussian filtering to obtain an illumination image according to the logarithmic image after Gaussian filtering: I log =log 10 (I+1) L=G*I log Where I represents the road training image, log 10 Indicates the logarithmic operation with base 10, I log represents the logarithmic image, G represents the Gaussian filter kernel, and L represents the illumination image; According to the following formula, the difference between the logarithmic image and the illuminance image is calculated to obtain a reflection image, and the reflection image is converted into a linear space: R=I log -L R exp =exp(R)-1 Wherein, R represents the reflected image, R exp represents the reflected image in linear space; According to the following formula, the brightness of the reflection image in the linear space is adjusted to obtain a candidate training image: Among them, max(R exp ) represents the maximum pixel value of the reflection image in the linear space, O represents the candidate training image; The candidate training image is expanded to obtain the training image; wherein the expansion process includes any one or more of random angle rotation, horizontal flipping and vertical flipping.

8. A road crack detection device, It is characterized in that include: An image processing unit, used for acquiring a road training image and performing image processing on the road training image to obtain a training image; A model building unit, used for inputting the training image into an improved YOLOv8 model for crack detection training to build a crack detection model; a crack detection unit, configured to perform road crack detection on a specified road image using the crack detection model; The marking and warning unit is used to mark the corresponding road image and generate corresponding warning information when a road crack is detected.

9. A computer device, It is characterized in that The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the road crack detection method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the road crack detection method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Pavement crack identification method, device and system, and storage medium

    CN119131553A

  • Maneuvering weak multi-target track-before-detect method based on echo energy space-time distribution characteristics, program, equipment and storage medium

    CN119228839A

  • Flow dividing and converging lane detection method and device

    CN121708339A