Improved YOLOv4 underwater turbid crack detection method and system
By improving the YOLOv4 model, using GhostNet and Focal loss loss functions and CBAM attention mechanism, combined with the underwater turbid fracture data set, the problem of accuracy and low efficiency of underwater crack detection in different turbid environments is solved, and the problem of underwater crack detection is achieved is achieved. High detection accuracy and speed.
Patent Information
- Application Number
- CN202411116062.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2024-12-06
AI Technical Summary
The existing underwater crack detection technology has problems such as low identification accuracy, low efficiency, high calculation cost and lack of images of different turbidity gradients, especially in underwater turbid environments that are difficult to effectively detect.
The YOLOv4 model is improved by introducing GhostNet to replace the backbone feature extraction network, combining the Focal loss loss function and CBAM attention mechanism, and constructing an underwater turbid fracture dataset for model training, optimizing the feature extraction and prediction process.
It improves the mAP, recall and accuracy of underwater crack detection, reduces the amount of model parameters, and improves the detection speed, which is suitable for underwater environments under different turbidities.
Smart Images

Figure CN119091285A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of underwater image recognition, and in particular to an underwater turbid crack detection method and system that improves YOLOv4. Background Art
[0002] Currently, there are few examples of underwater structural inspection, and the technical solutions in this field are not well prepared. Many tools and methods that work well on land are difficult to use underwater. Traditional underwater inspection relies on professional divers to visually inspect and record the size of underwater defects. However, this method is prone to subjective bias, resulting in inaccurate records and incomplete information, and it is inefficient and labor-intensive. Underwater sonar and acoustic technologies are used to scan and assess the condition of underwater structures. However, the strict operating requirements of these instruments, coupled with the limitations of acoustic technology, result in low accuracy in identifying cracks in underwater structures. With the advancement and widespread application of computer technology, vision-based non-contact inspection methods have become a research hotspot in the field of crack detection due to their high accuracy and efficiency. However, image processing methods are greatly affected by factors such as illumination, resolution, and distortion, which complicates effective crack detection.
[0003] Many studies have focused on the detection of underwater structural damage, but there are still some limitations: (1) Unsupervised learning for underwater crack detection: This method does not require manual annotation, thereby reducing the cost and time of data preparation. However, without labeled data as a reference, it becomes challenging to interpret and verify the results, which may affect the accuracy and effectiveness compared with supervised learning. (2) Multi-level networks for underwater crack detection: Although this method can achieve high accuracy. However, it requires multiple models for training and inference, resulting in high computational and time costs. This makes it difficult to deploy on mobile platforms with limited computing power (such as underwater robots). (3) YOLO series for underwater crack detection: This method is designed for underwater robots and minimizes energy and storage requirements while taking into account real-time detection, high efficiency and high accuracy. Although some datasets currently contain turbid cracks, there is a lack of underwater crack images with different turbidity gradients. Therefore, the effectiveness of deep learning methods in detecting underwater cracks under different turbidity gradients remains to be studied. Summary of the invention
[0004] In order to overcome the above-mentioned deficiencies of the prior art, the present invention provides an underwater turbidity crack detection method and system based on an improved YOLOv4. Through the improved YOLOv4 model, underwater cracks under different turbidities can be identified with high precision.
[0005] According to one aspect of the present invention, there is provided an underwater turbid crack detection method for improving YOLOv4, comprising: Acquire the image to be detected; Inputting the image to be detected into the trained crack detection model, and outputting the crack detection result; wherein the training of the crack detection model further includes: An initial crack detection model is constructed based on the YOLOv4 framework, including a backbone feature extraction network, a reinforced feature extraction network, and a prediction head. For the constructed initial crack detection model, a lightweight network GhostNet is introduced to replace the backbone feature extraction network, a Focal loss function is introduced to improve the cross entropy loss of the YOLOv4 model, and a CBAM attention mechanism is introduced and inserted between the enhanced feature extraction network and the prediction head to obtain an improved crack detection model; An underwater turbidity crack dataset is constructed, and the improved crack detection model is trained using the constructed dataset to obtain a trained crack detection model.
[0006] As a further technical solution, the training of the crack detection model further includes: Based on the improved crack detection model, the ordinary convolution in the enhanced feature extraction network is replaced with a depthwise separable convolution to obtain an optimized crack detection model; The constructed data set is used to train the optimized crack detection model to obtain a trained crack detection model.
[0007] As a further technical solution, an underwater turbidity fracture dataset is constructed, including: Simulate actual engineering conditions to obtain concrete cracks; A concrete sample with cracks is placed in a container, and water is poured into the container to form an underwater environment; Add different volumes of milk into the container to simulate underwater turbidity environments with different turbidity; Fracture images with different turbidities and clear images without turbidity were taken to form an underwater turbid fracture dataset.
[0008] As a further technical solution, the method further includes: dividing the underwater turbid fracture data set into a training set, a test set and a validation set according to a preset ratio.
[0009] As a further technical solution, after acquiring the image to be detected, image preprocessing is also included.
[0010] According to one aspect of the present invention, there is provided an underwater turbid crack detection system for improving YOLOv4, comprising: An input module, used for acquiring an image to be detected; The detection module is used to input the image to be detected into the trained crack detection model and output the crack detection result; wherein the training of the crack detection model further includes: An initial crack detection model is constructed based on the YOLOv4 framework, including a backbone feature extraction network, a reinforced feature extraction network, and a prediction head. For the constructed initial crack detection model, a lightweight network GhostNet is introduced to replace the backbone feature extraction network, a Focal loss function is introduced to improve the cross entropy loss of the YOLOv4 model, and a CBAM attention mechanism is introduced and inserted between the enhanced feature extraction network and the prediction head to obtain an improved crack detection model; An underwater turbidity crack dataset is constructed, and the improved crack detection model is trained using the constructed dataset to obtain a trained crack detection model.
[0011] As a further technical solution, the training of the crack detection model further includes: Based on the improved crack detection model, the ordinary convolution in the enhanced feature extraction network is replaced with a depthwise separable convolution to obtain an optimized crack detection model; The constructed data set is used to train the optimized crack detection model to obtain a trained crack detection model.
[0012] As a further technical solution, an underwater turbidity fracture dataset is constructed, including: Simulate actual engineering conditions to obtain concrete cracks; A concrete sample with cracks is placed in a container, and water is poured into the container to form an underwater environment; Add different volumes of milk into the container to simulate underwater turbidity environments with different turbidity; Fracture images with different turbidities and clear images without turbidity were taken to form an underwater turbid fracture dataset.
[0013] According to one aspect of the present invention specification, there is provided an electronic device, comprising: at least one processor, at least one memory and a communication interface; wherein the processor, memory and communication interface communicate with each other; the memory stores program instructions executed by the processor, and the processor calls the program instructions to execute the described method.
[0014] According to one aspect of the present specification, a non-transitory computer-readable storage medium is provided, wherein the non-transitory computer-readable storage medium stores computer instructions, wherein the computer instructions enable the computer to execute the method described above.
[0015] Compared with the prior art, the present invention has the following beneficial effects: The invention aims at identifying underwater cracks under different turbidities. Based on the YOLOv4 model, a lightweight network GhostNet is introduced to replace the backbone feature extraction network, a Focal loss loss function is introduced to improve the cross entropy loss of the YOLOv4 model, and a CBAM attention mechanism is introduced and inserted between the enhanced feature extraction network and the prediction head to obtain an improved crack detection model. The underwater turbidity crack database constructed by the invention is used for model training, so that the crack detection model obtained by training has higher mAP (mean Average Precision), recall rate and precision rate than the prior art when performing underwater crack detection, and the model parameters are smaller and the detection speed is faster.
[0016] The present invention simulates the formation process of underwater cracks to generate cracks close to actual engineering scenarios, simulates different underwater turbidity conditions to obtain images of cracks under different turbidities, and constructs underwater crack data sets under different turbidities. The crack detection model is trained and verified through crack data close to real application scenarios, thereby improving the crack detection accuracy of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, a brief introduction is given below to the drawings used in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 A schematic diagram of a flow chart of an underwater turbid crack detection method based on an improved YOLOv4 provided in an embodiment of the present invention.
[0019] Figure 2 A schematic diagram of the architecture of a crack detection model provided in an embodiment of the present invention.
[0020] Figure 3 (a)-(b) are diagrams of a concrete sample fracturing experiment provided by an embodiment of the present invention.
[0021] Figure 4 A schematic diagram of underwater shooting provided by an embodiment of the present invention.
[0022] Figure 5 A schematic diagram of training an underwater fracture model provided in an embodiment of the present invention.
[0023] Figure 6 A schematic diagram of training an optimized underwater fracture model provided in an embodiment of the present invention.
[0024] Figure 7A schematic diagram of detection results of an underwater crack model provided in an embodiment of the present invention.
[0025] Figure 8 A schematic diagram of detection results of an optimized underwater crack model provided in an embodiment of the present invention.
[0026] Fig. 9 A schematic diagram of the structure of an underwater turbid crack detection system based on an improved YOLOv4 provided in an embodiment of the present invention.
[0027] Fig.10 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0028] The terms "including" and "having" and any variations thereof in the specification and claims of the present invention and the above-mentioned drawings are intended to cover non-exclusive inclusions, for example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to the steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products or apparatuses.
[0029] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices. The flowcharts shown in the accompanying drawings are merely exemplary and do not necessarily include all the contents and operations / steps, nor do they necessarily have to be executed in the order described. For example, some operations / steps may be further decomposed, while some operations / steps may be combined or partially combined, so the actual execution order may change according to the actual situation.
[0030] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings 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 in 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. In addition, the technical features in the various embodiments or single embodiments provided by the present invention are arbitrarily combined with each other to form a new technical solution. This combination is not restricted by the sequence of steps and / or the structural composition mode, but must be based on the ability of ordinary technicians in this field to achieve. When the combination of technical solutions is contradictory or cannot be achieved, it should be considered that this combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0031] The embodiment of the present invention provides an underwater turbid crack detection method that improves YOLOv4. Figure 1 As shown, it includes: acquiring an image to be detected; inputting the image to be detected into a trained crack detection model, and outputting a crack detection result.
[0032] In the embodiment of the present invention, after acquiring the image to be detected, image preprocessing is also included, specifically: Image resizing: resize the input image to the fixed size required by YOLOv4 (usually 416x416, but can be adjusted depending on the specific configuration); Normalization: normalize the pixel values of the image to the interval [0, 1]; Batch dimension addition: Resize the image to include the batch dimension so that it can be easily fed into the neural network for processing.
[0033] Wherein, the training of the crack detection model further includes: An initial crack detection model is constructed based on the YOLOv4 framework, including a backbone feature extraction network, a reinforced feature extraction network, and a prediction head. For the constructed initial crack detection model, a lightweight network GhostNet is introduced to replace the backbone feature extraction network, a Focal loss function is introduced to improve the cross entropy loss of the YOLOv4 model, and a CBAM attention mechanism is introduced and inserted between the enhanced feature extraction network and the prediction head to obtain an improved crack detection model; An underwater turbidity crack dataset is constructed, and the improved crack detection model is trained using the constructed dataset to obtain a trained crack detection model.
[0034] Furthermore, the training of the crack detection model further includes: Based on the improved crack detection model, the ordinary convolution in the enhanced feature extraction network is replaced with a depthwise separable convolution to obtain an optimized crack detection model; The constructed data set is used to train the optimized crack detection model to obtain a trained crack detection model.
[0035] As a preferred embodiment, Figure 2 As shown, the underwater turbid crack detection method improved by YOLOv4 provided in the embodiment of the present invention has the following specific steps: Step 1: Based on the YOLOv4 model, replace its backbone feature extraction network to obtain the model YOLOv4-G; Step 2, introduce Focal loss to improve the original cross entropy loss and obtain the model YOLOv4-GF; Step 3, introduce the CBAM attention mechanism and insert it between the enhanced feature extraction network and the prediction head to obtain the model YOLOv4-GFC; Step 4: Replace the 3×3 ordinary convolution in the enhanced feature extraction network (SPP+PANet) with 3×3 depth-separable convolution to obtain the model YOLOv4-GPFC; Step 5: Intelligent identification and detection are performed in the underwater turbid fracture database built by the present invention.
[0036] The embodiment of the present invention is based on YOLOv4, replaces the backbone feature extraction network CSPDarkNet with GhostNet; introduces Focal loss to improve the cross entropy loss function; introduces the CBAM attention mechanism; and obtains the model YOLOv4-GFC. Based on the above model, the 3×3 ordinary convolution in the enhanced feature extraction network (SPP+PANet) is replaced with a 3×3 depth-separable convolution to reduce the number of parameters and obtain the model YOLOv4-GPFC. The embodiment of the present invention obtains crack images under different turbidities, and trains and verifies the model YOLOv4-GPFC. The embodiment of the present invention provides a lightweight approach for underwater turbid crack image detection, which makes up for the deficiency that existing studies do not consider cracks of different turbidities, and can identify underwater cracks under different turbidities with high precision.
[0037] Specifically, in the underwater turbid crack detection method of the improved YOLOv4 provided in the embodiment of the present invention, in step 1, the original backbone feature extraction network CSPDarkNet is replaced with GhostNet, aiming to improve the computational efficiency while maintaining high accuracy and reducing the number of parameters.
[0038] like Figure 2 As shown, in the backbone feature extraction network provided by the embodiment of the present invention, the input image 416x416x3 (416 is the image size, 3 is the number of channels, i.e., RGB three-color channels) is converted to 416x416x32 after the initial convolution layer (CBL). The GhostBN1 module includes an ordinary convolution layer and a series of linear transformations. The ordinary convolution layer generates a small number of basic feature maps, such as 208x208x16, and the linear transformation generates more similar feature maps, such as 208x208x48. These feature maps are spliced together to form a complete feature map output, such as 208x208x64; after the GhostBN2 module, the output feature map is 104x104x128; after the first GhostBN8 module, the output feature map is 52x52x256; after the second GhostBN8 module, the output feature map is 26x26x512; after the GhostBN4 module, the output feature map is 13x13x1024.
[0039] Specifically, in the underwater turbid crack detection method for improving YOLOv4 provided by the embodiment of the present invention, in step 2, Focal loss is introduced to improve its original cross entropy loss; the cross entropy loss of YOLOv4 is:
[0040] in, is a negative sample, is a positive sample, is the output of the activation function; Focal loss can improve it as follows:
[0041] Among them, the balance factor α is used to adjust the imbalance between positive and negative samples, control the weight of positive samples, and reduce the influence of negative samples. The balance factor β is used to reduce the loss of easy-to-classify samples and increase the attention to difficult-to-classify samples. Compared with simple samples, the loss value ratio of difficult-to-classify samples will increase; in this case, α is set to 0.25 and β is set to 2. The two factors are adjusted together to achieve a relative balance and improve detection performance.
[0042] Specifically, in the underwater turbid crack detection method of improving YOLOv4 provided by the embodiment of the present invention, in step 3, the CBAM attention mechanism is introduced and inserted between the enhanced feature extraction network and the prediction head. The mechanism of focusing on key information enables the model to better identify the basic features of the target object, thereby enhancing crack extraction and improving performance and efficiency. After integrating the CBAM attention mechanism, the model can more effectively select the key parts of the input data, thereby improving the overall performance and strengthening the feature representation.
[0043] Specifically, in the underwater turbid crack detection method of the improved YOLOv4 provided by the embodiment of the present invention, in step 4, the 3×3 ordinary convolution in the enhanced feature extraction network (SPP+PANet) is replaced with a 3×3 depth-separable convolution; the size of the crack feature map is X × Y × N, the required derived crack feature map is X × Y × M, and the total computational complexity of the 3×3 ordinary convolution is:
[0044] The total computational effort of a 3×3 depthwise separable convolution is:
[0045] The ratio of the two convolution calculation methods:
[0046] The overall computational complexity of depthwise separable convolution is about one-ninth of that of ordinary convolution, which greatly reduces the computational complexity of the convolution process.
[0047] SPP performs pooling operations of different scales on the input feature map (13x13x1024), and then concatenates these pooled feature maps to form a multi-scale feature representation. SPP can capture feature information under different receptive fields, so as to better handle objects of different sizes.
[0048] In PANet, upsampling, lateral connection and feature fusion are performed through the feature pyramid network, and top-down and bottom-up path and feature aggregation are performed through the path aggregation network.
[0049] Specifically, the detection head includes anchor frame generation, classification and regression, and loss calculation. It should be noted that the contents not described in the embodiments of the present invention can be regarded as the prior art under the YOLOv4 framework.
[0050] Specifically, in the improved underwater turbid crack detection method of YOLOv4 provided by the embodiment of the present invention, in step 5, the cracks are obtained by fracturing concrete samples, presenting irregular morphology, which is more in line with natural conditions. Figure 3 (a)-(b) show the concrete sample fracturing experiment diagram involved in the embodiment of the present invention, which shows the pressurization process. The sample is subjected to continuous pressure from six hydraulic drive plates, and uniform pressure is applied in three axial directions; cracks gradually form and expand in the sample until they finally break; these cracks show natural, random and irregular characteristics, reflecting the typical complexity of actual engineering scenarios; through this experimental device and method, the concrete cracks generated under actual engineering conditions can be more realistically simulated.
[0051] Specifically, in the improved underwater turbid crack detection method of YOLOv4 provided by the embodiment of the present invention, in step 5, different volumes of milk are added to the water to simulate the underwater turbid environment. Figure 4 The figure shows an underwater shooting experiment involved in an embodiment of the present invention, which includes a cylindrical water tank with a diameter of 900 mm and a height of 900 mm. In the water tank, an underwater camera and a cracked concrete sample are placed at the bottom along the central axis, with a distance of 300 mm between them. The concrete sample is a cube with a size of 200 mm. The water depth is 600 mm to ensure the safety of the experiment.
[0052] Specifically, in the underwater turbid crack detection method of the improved YOLOv4 provided by an embodiment of the present invention, in step 5, the number of crack images with different turbidity taken is: 1000 (clear), 1000 (10 ml of milk is added to the water), 1000 (20 ml of milk is added to the water), 1000 (30 ml of milk is added to the water), 976 (40 ml of milk is added to the water), 856 (50 ml of milk is added to the water), 584 (60 ml of milk is added to the water), totaling 6416 crack images.
[0053] Specifically, in the underwater turbid crack detection method of improving YOLOv4 provided by the embodiment of the present invention, in step 5, the crack image is resized to a size of 416×416 to facilitate neural network training.
[0054] Specifically, in the improved YOLOv4 underwater turbid crack detection method provided by the embodiment of the present invention, in step 5, the method is divided into training set: test set: validation set = 8:1:1; in the final detection, the original image is used instead of the resized 416×416 crack image.
[0055] Specifically, intelligent identification and detection are performed in the underwater turbid fracture database built by the embodiment of the present invention.
[0056] Figure 5 This is a diagram of the YOLOv4-GFC training process involved in an embodiment of the present invention, in which the loss functions of the model training set and the validation set converge at about 10 Epochs; as the Epoch increases, the training and validation loss curves gradually decrease, and the values at convergence are almost the same; the convergence values of the training set and the validation set are very low, 0.031 and 0.049 respectively.
[0057] Figure 6 This is a diagram of the YOLOv4-GPFC training process involved in the present invention, in which the loss functions of the model training set and validation set converge at around 10 Epochs. As the Epoch increases, the training and validation loss curves gradually decrease, and the values at convergence are almost the same; the convergence values of the training set and validation set are very low, 0.029 and 0.048 respectively.
[0058] Figure 7 This is a detection result diagram of YOLOv4-GFC involved in the present invention, in which turbid cracks can be accurately detected, thereby realizing intelligent recognition; the prediction accuracy decreases with the increase of turbidity, and cracks in some areas are difficult to detect, but the overall recognition accuracy remains at a high level; the size of the input image is different from that of the training set, but the cracks can still be accurately detected, which shows that the overall generalization performance of YOLOv4-GFC is good.
[0059] Figure 8 This is a detection result diagram of YOLOv4-GPFC involved in the present invention, in which turbid cracks can be accurately detected, thereby realizing intelligent recognition; the prediction accuracy decreases with the increase of turbidity; cracks in some areas are difficult to detect, and the overall recognition accuracy remains at a high level, but lower than YOLOv4-GFC; the size of the input image is different from that of the training set, but the cracks can still be accurately detected, which shows that the overall generalization performance of YOLOv4-GPFC is good.
[0060] Underwater crack detection is performed using the method provided by the embodiment of the present invention and the prior art processing method, and the detection results are compared. The methods involved include (a) YOLOv4; (b) YOLOv4-tiny; (c) YOLOv4-M; (d) YOLOv4-G; (e) YOLOv4-GF; (f) YOLOv4-GFC; (g) YOLOv4-MP; (h) YOLOv4-GP; (i) YOLOv4-GPF; and (j) YOLOv4-GPFC.
[0061] Method (a) YOLOv4 has an mAP of 77.24%, a recall rate of 65.23%, an accuracy of 78.52%, a parameter size of 245.53MB, and a detection frame rate of 21 frames per second.
[0062] Method (b) YOLOv4-tiny has an mAP of 69.20%, a recall rate of 54.93%, an accuracy of 73.69%, a parameter size of 23.1MB, and a detection frame rate of 49 frames per second.
[0063] Method (c) YOLOv4-M (replacing the backbone feature extraction network with MobileNetv3) has an mAP of 84.76%, a recall rate of 67.98%, a precision rate of 86.36%, a parameter number of 152.55MB, and a frame rate of 22 frames per second.
[0064] Method (g) YOLOv4-MP (based on the above YOLOv4-M, replacing the 3×3 ordinary convolution with 3×3 depth-wise separable convolution) has an mAP of 78.25%, a recall rate of 64.92%, a precision rate of 82.9%, a parameter number of 44.74MB, and a frame rate of 24 frames per second.
[0065] Method (d) YOLOv4-G has an mAP of 84.96%, a recall rate of 68.22%, a precision rate of 87.37%, a parameter number of 151.4MB, and a frame rate of 26 frames per second; it is better than method (c).
[0066] Method (h) YOLOv4-GP (based on the above YOLOv4-G, the 3×3 ordinary convolution is replaced by 3×3 depth-wise separable convolution) has an mAP of 78.91%, a recall rate of 65.64%, a precision rate of 81.55%, a parameter number of 43.6MB, and a frame rate of 29 frames per second; it is better than method (g).
[0067] Focal loss is introduced based on method (d) and method (h), resulting in method (e) YOLOv4-GF and method (i) YOLOv4-GPF.
[0068] Method (e) YOLOv4-GF has an mAP of 86.89%, a recall rate of 69.00%, a precision rate of 88.87%, a parameter size of 151.4MB, and a detection frame rate of 26 frames per second; it is better than method (d).
[0069] Method (i) YOLOv4-GPF has an mAP of 80.42%, a recall rate of 66.69%, a precision rate of 84.24%, a parameter size of 43.6MB, and a detection frame rate of 29 frames per second; it is better than method (h).
[0070] On the basis of method (e) and method (i), CBAM is introduced and inserted between the enhanced feature extraction network and the prediction head to obtain two models YOLOv4-GFC (f) and YOLOv4-GPFC (j) of the embodiment of the present invention. The mAP of YOLOv4-GFC is 87.86%, the recall rate is 71.04%, the precision rate is 89.47%, the parameter volume is 152.06MB, and the number of detection frames per second is 26. The mAP of YOLOv4-GPFC is 80.74%, the recall rate is 67.13%, the precision rate is 84.26%, the parameter volume is 44.26MB, and the number of detection frames per second is 29.
[0071] Specifically, the two models provided in the embodiment of the present invention meet different requirements: Model 1 (YOLOv4-GFC) prioritizes accuracy, but the detection speed is slightly slower; Model 2 (YOLOv4-GPFC) has slightly lower accuracy, but the detection speed is faster. Both models can meet the different requirements for crack detection and identification in turbid underwater environments.
[0072] The implementation basis of each embodiment of the present invention is to implement programmed processing through a device with a processor function. Therefore, in engineering practice, the technical solutions and functions of each embodiment of the present invention are encapsulated into various modules. Based on this reality, on the basis of the above embodiments, an embodiment of the present invention provides an underwater turbid crack detection system of an improved YOLOv4, which is used to execute the underwater turbid crack detection method of the improved YOLOv4 in the above method embodiment.
[0073] See also Fig. 9 The system includes: an input module for acquiring an image to be detected; a detection module for inputting the image to be detected into a trained crack detection model and outputting a crack detection result; wherein the training of the crack detection model further includes: constructing an initial crack detection model based on a YOLOv4 framework, including a backbone feature extraction network, an enhanced feature extraction network and a prediction head; for the constructed initial crack detection model, introducing a lightweight network GhostNet to replace the backbone feature extraction network, introducing a Focal loss function to improve the cross entropy loss of the YOLOv4 model, and introducing a CBAM attention mechanism and inserting it between the enhanced feature extraction network and the prediction head to obtain an improved crack detection model; constructing an underwater turbid crack dataset, and using the constructed dataset to train the improved crack detection model to obtain a trained crack detection model.
[0074] The underwater turbidity crack detection system improved by YOLOv4 provided by the embodiment of the present invention is aimed at the underwater turbidity crack detection scene. Fig. 9 The invention discloses a method for improving the crack detection model of an underwater crack detection system, and proposes a method for improving the crack detection model of an underwater crack detection system. The method introduces a lightweight network GhostNet to replace the backbone feature extraction network, introduces a Focal loss function to improve the cross entropy loss of the YOLOv4 model, and introduces a CBAM attention mechanism and inserts it between the enhanced feature extraction network and the prediction head to obtain an improved crack detection model. The underwater turbid crack database constructed by the invention is used for model training, so that the crack detection model obtained by training has higher mAP (mean Average Precision), recall rate and precision rate than the prior art when performing underwater crack detection, and has smaller model parameters and faster detection speed.
[0075] It should be noted that the system embodiment provided by the present invention is used to implement the method in the above method embodiment as well as the method in other method embodiments provided by the present invention. The only difference is that the corresponding functional modules are set. The principle is basically the same as the principle of the above system embodiment provided by the present invention. As long as the technical personnel in this field refer to the specific technical solutions in other method embodiments on the basis of the above system embodiment, obtain the corresponding technical means and the technical solutions composed of these technical means by combining the technical features, and on the premise of ensuring the practicality of the technical solutions, they can improve the system in the above system embodiment to obtain the corresponding system class embodiment, which is used to implement the methods in other method class embodiments. For example: Based on the content of the above system embodiment, as a preferred embodiment, in the underwater turbidity crack detection system of the improved YOLOv4 provided in the embodiment of the present invention, the training of the crack detection model further includes: Based on the improved crack detection model, the ordinary convolution in the enhanced feature extraction network is replaced with a depthwise separable convolution to obtain an optimized crack detection model; The constructed data set is used to train the optimized crack detection model to obtain a trained crack detection model.
[0076] Based on the content of the above system embodiment, as a preferred embodiment, the underwater turbid crack detection system of the improved YOLOv4 provided in the embodiment of the present invention, constructing the underwater turbid crack data set also includes: Simulate actual engineering conditions to obtain concrete cracks; A concrete sample with cracks is placed in a container, and water is poured into the container to form an underwater environment; Add different volumes of milk into the container to simulate underwater turbidity environments with different turbidity; Fracture images with different turbidities and clear images without turbidity were taken to form an underwater turbid fracture dataset.
[0077] The method of the embodiment of the present invention is implemented by relying on electronic devices, so it is necessary to introduce the relevant electronic devices. Based on this purpose, the embodiment of the present invention provides an electronic device, such as Fig.10 As shown, the electronic device includes: at least one processor, a communication interface, at least one memory, and a communication bus, wherein at least one processor, the communication interface, and at least one memory communicate with each other through the communication bus. At least one processor calls the logic instructions in at least one memory to execute all or part of the steps of the method provided by the aforementioned various method embodiments.
[0078] In addition, when the logic instructions in the above-mentioned at least one memory are implemented in the form of a software functional unit and sold or used as an independent product, they are stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or partly in other words, the part that contributes to the prior art or part of the technical solution is embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for enabling a computer device (a personal computer, a server, or a network device) to perform all or part of the steps of the method described in each method embodiment of the present invention. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk, and various media for storing program codes.
[0079] The system embodiments described above are merely illustrative, wherein the units described as separate components are or are not physically separated, and the components shown as units are or are not physical units, located in one place, or distributed on multiple network units. Some or all of the modules are selected according to actual conditions to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement without creative effort.
[0080] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0081] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0082] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0083] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0084] In summary, the underwater turbid crack detection method of the improved YOLOv4 involved in the present invention proposes for the first time to identify underwater cracks under different turbidities, replace the backbone feature extraction network to obtain the model YOLOv4-G; introduce Focalloss to obtain the model YOLOv4-GF; introduce the CBAM attention mechanism to obtain the model YOLOv4-GFC; replace the 3×3 ordinary convolution in the enhanced feature extraction network (SPP+PANet) with 3×3 depth-separable convolution to obtain the model YOLOv4-GPFC; and perform intelligent recognition and detection in the underwater turbid crack database built by the present invention. Compared with the prior art processing method, the present invention has higher mAP (mean Average Precision), recall rate, and precision rate for underwater turbid crack image detection, smaller model parameters, and faster detection speed.
[0085] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the technical solutions of the embodiments of the present invention.
Claims
1. Improved underwater turbid crack detection method of YOLOv4, characterized in that: include: Acquire the image to be detected; Inputting the image to be detected into the trained crack detection model, and outputting the crack detection result; wherein the training of the crack detection model further includes: An initial crack detection model is constructed based on the YOLOv4 framework, including a backbone feature extraction network, a reinforced feature extraction network, and a prediction head. For the constructed initial crack detection model, a lightweight network GhostNet is introduced to replace the backbone feature extraction network, a Focal loss function is introduced to improve the cross entropy loss of the YOLOv4 model, and a CBAM attention mechanism is introduced and inserted between the enhanced feature extraction network and the prediction head to obtain an improved crack detection model; An underwater turbidity crack dataset is constructed, and the improved crack detection model is trained using the constructed dataset to obtain a trained crack detection model.
2. The underwater turbid crack detection method according to claim 1, characterized in that: The training of the crack detection model also includes: Based on the improved crack detection model, the ordinary convolution in the enhanced feature extraction network is replaced with a depthwise separable convolution to obtain an optimized crack detection model; The constructed data set is used to train the optimized crack detection model to obtain a trained crack detection model.
3. The underwater turbid crack detection method according to claim 1 or 2, characterized in that: Construct an underwater turbid fracture dataset, including: Simulate actual engineering conditions to obtain concrete cracks; A concrete sample with cracks is placed in a container, and water is poured into the container to form an underwater environment; Add different volumes of milk into the container to simulate underwater turbidity environments with different turbidity; Fracture images with different turbidities and clear images without turbidity were taken to form an underwater turbid fracture dataset.
4. The underwater turbid crack detection method according to claim 3, characterized in that: The method further includes: dividing the underwater turbid fracture data set into a training set, a test set and a validation set according to a preset ratio.
5. The underwater turbid crack detection method according to claim 1, characterized in that: After acquiring the image to be detected, image preprocessing is also included.
6. Improved YOLOv4 underwater turbidity crack detection system, characterized in that: include: An input module, used for acquiring an image to be detected; The detection module is used to input the image to be detected into the trained crack detection model and output the crack detection result; wherein the training of the crack detection model further includes: An initial crack detection model is constructed based on the YOLOv4 framework, including a backbone feature extraction network, a reinforced feature extraction network, and a prediction head. For the constructed initial crack detection model, a lightweight network GhostNet is introduced to replace the backbone feature extraction network, a Focal loss function is introduced to improve the cross entropy loss of the YOLOv4 model, and a CBAM attention mechanism is introduced and inserted between the enhanced feature extraction network and the prediction head to obtain an improved crack detection model; An underwater turbidity crack dataset is constructed, and the improved crack detection model is trained using the constructed dataset to obtain a trained crack detection model.
7. The underwater turbid crack detection system according to claim 6, characterized in that: The training of the crack detection model also includes: Based on the improved crack detection model, the ordinary convolution in the enhanced feature extraction network is replaced with a depthwise separable convolution to obtain an optimized crack detection model; The constructed data set is used to train the optimized crack detection model to obtain a trained crack detection model.
8. The underwater turbid crack detection system according to claim 6, characterized in that: Construct an underwater turbid fracture dataset, including: Simulate actual engineering conditions to obtain concrete cracks; A concrete sample with cracks is placed in a container, and water is poured into the container to form an underwater environment; Add different volumes of milk into the container to simulate underwater turbidity environments with different turbidity; Fracture images with different turbidities and clear images without turbidity were taken to form an underwater turbid fracture dataset.
9. An electronic device, characterized in that: include: At least one processor, at least one memory and a communication interface; wherein the processor, memory and communication interface communicate with each other; The memory stores program instructions executed by the processor, and the processor calls the program instructions to execute the method according to any one of claims 1 to 5.
10. A non-transitory computer readable storage medium, characterized in that: The non-transitory computer-readable storage medium stores computer instructions, which cause the computer to execute the method of any one of claims 1 to 5.
Citation Information
Patent Citations
Underwater gray polarization image restoration method based on generative adversarial network
CN113487504A
Method for detecting defects of small pluggable light receiving and emitting module base
CN115409785A
Bridge underwater structure crack identification method based on yoV7 improved algorithm
CN117392077A
Cited By
Underwater structure crack intelligent quantification method and system
CN120564020A
Turbid sensing and morphological continuity crack detection method, system, equipment and medium
CN122550479A
