Embedded parts detection method, device, system and storage medium

By replacing the C2F module with the MBCA module in the YOLOv8 model, and introducing the GSConv and AVCStem modules into the neck network, the problem of insufficient detection accuracy and efficiency of embedded parts in the existing technology has been solved, and high-precision and high-efficiency prediction has been achieved. Embedded parts detection, especially in small target detection, has excellent performance.

CN118447023BActive Publication Date: 2024-10-29HEFEI UNIV OF TECH
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410905469.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-08
Publication Date
2024-10-29
Estimated Expiration
2044-07-08

AI Technical Summary

Technical Problem

There is a lack of high-precision and efficient embedded parts detection algorithms in the existing technology. While the YOLOv8 model improves detection efficiency, the model accuracy decreases, making it difficult to meet the dual requirements of detection accuracy and speed in construction projects.

Method used

By replacing the C2F module in YOLOv8 with the MBCA module, and introducing GSConv and AVCStem modules into the neck network, the CA attention mechanism and feature fusion circuit are added, the convolution kernel is dynamically adjusted to adapt to the characteristics of embedded parts, and the model detection accuracy and efficiency.

Benefits of technology

On the premise of keeping the model lightweight, the accuracy and efficiency of embedded parts detection are significantly improved, the accuracy of small target detection is improved, and the number of model parameters and inference time are reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118447023B_ABST
    Figure CN118447023B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of embedded parts detection and image recognition model, and in particular to an embedded parts detection method, device, system and storage medium. The embedded parts detection method proposed in the present invention makes targeted improvements to the backbone network of the original YOLOv8 model. In order to enhance the detection capability of the model and keep the model lightweight, part of the C2f module is replaced with the MBCA module on the backbone network. The module introduces the CA attention mechanism under the premise of reducing the number of parameters to increase the position information paid attention to by the network, avoid the loss of position information in global pooling, and can better extract the position information of embedded parts in prefabricated floor slabs, thereby improving the detection accuracy of embedded parts.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of embedded part detection and image recognition model, in particular to an embedded part detection method, device, system and storage medium. Background Art

[0002] Embedded parts are a widely used technology in modern construction projects. Embedded parts include structural parts such as steel plates, bolts, junction boxes, and embedded pipes such as wiring pipes and drainage pipes. The construction quality of embedded parts directly affects the construction progress and structural safety of the construction project, so it must be firmly controlled. In actual factories, embedded parts detection not only requires a certain degree of detection accuracy, but also requires the model to occupy less memory and high detection efficiency.

[0003] At present, the target detection algorithms based on deep learning are gaining more and more attention. Such algorithms mostly use the data and labels in the data set to train the convolutional neural networks (CNNs), which can be divided into two categories: the first category is the target detection algorithms based on regions, such as RCNN (Regions with CNN), Faster R-CNN (Faster Regions with CNN), etc. This type of algorithm pre-extracts the candidate regions for the location of the target object, with high detection accuracy, but slow detection speed; the second category is the target detection algorithms based on end-to-end learning, such as YOLO (You Only Look Once), SSD (Single Shot MultiBox Detector), etc. This type of algorithm omits the candidate region generation step, and implements feature extraction, target classification and target regression in the same convolutional neural network, which greatly improves the target detection speed. However, the neural network structure of the target detection algorithm based on deep learning is large and complex, so the detection speed is slow. The existing Yolov8 model has made improvements to this, improving the detection efficiency, but the model accuracy has also decreased.

[0004] Reference Figure 1 , Figure 2 , the existing Yolov8 model, including the torso network, neck network and head network.

[0005] The trunk network includes a sequentially connected input layer, a first convolutional layer, a second convolutional layer, a first C2F module, a third convolutional layer, a second C2F module, a fourth convolutional layer, a third C2F module, a fifth convolutional layer, a fourth C2F module and an SPPF module;

[0006] The neck network includes sequentially connected: a first sampling layer, a first splicing module, a second sampling layer, a second splicing module, a sixth convolutional layer, a third splicing module, a seventh convolutional layer and a fourth splicing module;

[0007] The head network includes three output modules, which are respectively connected to the output of the second splicing module, the output of the third splicing module and the output of the fourth splicing module. The output module predicts the annotation box based on the output of the corresponding splicing module.

[0008] The output of the SPPF module is the output of the trunk network and is connected to the input of the neck network. The input of the first sampling layer and the input of the fourth splicing module are both connected to the input of the neck network.

[0009] The first splicing module, the second splicing module, the third splicing module and the fourth splicing module have the same structure and are collectively referred to as splicing modules. The splicing module is composed of a connected Concat splicing network and a C2f module. The input of the Concat splicing network is the input of the splicing module, the output of the Concat splicing network is connected to the input of the C2f module, and the output of the C2f module is the output of the splicing module.

[0010] The input of the first splicing module is also connected to the output of the third C2F module, the input of the second splicing module is also connected to the output of the second C2F module, the input of the third splicing module is also connected to the output of the first splicing module; the input of the fourth splicing module is also connected to the output of the SPPF module.

[0011] The output module includes two parallel convolution processing branches, both of which are composed of a connected Conv convolutional network and a Conv2d convolutional network. In the output module, one convolutional processing branch predicts the concrete crack annotation box based on the input, and the other convolutional processing branch predicts the concrete crack category. Summary of the invention

[0012] In order to overcome the defect of the above-mentioned prior art that there is a lack of high-precision and high-efficiency embedded parts detection algorithm, the present invention proposes an embedded parts detection method, improves YOLOv8, and provides a high-precision and high-efficiency embedded parts intelligent detection.

[0013] The present invention provides a method for detecting embedded parts, comprising the following steps:

[0014] Construct learning samples and divide them into training set and validation set. The learning samples are image samples with labeled embedded parts. The labeled information includes the category and location of the embedded parts.

[0015] The networks with the same name in the YOLOv8 model are named sequentially, and the first C2F module and the second C2F module in the YOLOv8 model are replaced by MBCA modules to form an improved model; the improved model is trained on the training set until the improved model reaches the convergence condition on the validation set;

[0016] Obtain the image to be inspected and input the converged improved model. The improved model recognizes the image to be inspected and marks the embedded parts.

[0017] The MBCA module includes a first Conv network, a first activation layer, a first batch of normalization layers, a first DWConv network, a second activation layer, a second batch of normalization layers, a CA module, a second Conv network, a third batch of normalization layers, a random dropout layer, and a dimension stacking network connected sequentially;

[0018] The input of the first Conv network is the input of the MBCA module; the input of the dimensional superposition network is also connected to the input of the MBCA module, and the output of the dimensional superposition network is the output of the MBCA module.

[0019] Preferably, the neck network of the model YOLOv8 includes a first sampling layer, a first splicing module, a second sampling layer, a second splicing module, a sixth convolutional layer, a third splicing module, a seventh convolutional layer and a fourth splicing module connected in sequence; relative to the model YOLOv8, the improved model also replaces the sixth convolutional layer and the seventh convolutional layer with a GSConv network; and replaces the C2f modules in the first splicing module, the second splicing module, the third splicing module and the fourth splicing module with AVCStem modules;

[0020] The AVCStem module includes: a first CBS network, a GSBottleneck module, a second CBS network, a splicing network and an AKConv module; wherein the second CBS network, the splicing network and the AKConv module are connected in sequence, the output of the first CBS network is connected to the input of the GSBottleneck module, and the output of the GSBottleneck module is connected to the input of the splicing network; the inputs of the first CBS network and the second CBS network are both connected to the input of the AVCStem module, and the output of the AKConv module is the output of the AVCStem module.

[0021] Preferably, the first activation layer adopts the Swish activation function, the ReLU activation function, the Softmax activation function or the Sigmoid activation function, and the second activation layer adopts the Swish activation function, the ReLU activation function, the Softmax activation function or the Sigmoid activation function.

[0022] Preferably, the first activation layer and the second activation layer use the same activation function.

[0023] Preferably, in the improved model, the first convolutional layer, the second convolutional layer, the third convolutional layer, the fourth convolutional layer and the fifth convolutional layer all adopt a Conv network or a CBS module.

[0024] Preferably, the improved model is trained on the training set until the improved model reaches a convergence condition on the validation set, comprising the following steps:

[0025] S21, selecting multiple training samples from the training set, and allowing the improved model to learn the training samples to train model parameters;

[0026] S22, select multiple verification samples from the verification set, let the improved model identify the verification samples, and calculate the model loss;

[0027] S23, judging whether the improved model has reached the convergence condition; if not, returning to step S21; if yes, fixing the improved model.

[0028] Preferably, in S2, the convergence condition of the improved model is: the accuracy of the improved model on the validation set converges, or the model loss converges, or the number of model updates reaches a set number.

[0029] The present invention provides an embedded parts detection device, comprising a memory and a processor, wherein the memory stores a computer program and an improved model, and the processor is connected to the memory, and the processor is used to execute the computer program to implement the embedded parts detection method.

[0030] The present invention provides an embedded part detection system, comprising: a camera device and an embedded part detection device; the camera device is used to shoot a detection object, and the embedded part detection device recognizes the shot image through an improved model and outputs the recognition result of the shot image.

[0031] The present invention provides a storage medium storing a computer program, which is used to implement the embedded parts detection method when executed.

[0032] The advantages of the present invention are:

[0033] (1) The embedded parts detection method proposed in this invention makes targeted improvements to the backbone network of the original YOLOv8 model. In order to enhance the detection capability of the model and keep the model lightweight, some C2f modules are replaced with MBCA modules on the backbone network. This module introduces the CA attention mechanism under the premise of reducing the number of parameters to increase the position information paid attention to by the network, avoid the loss of position information in global pooling, and can better extract the position information of embedded parts in prefabricated floor slabs, thereby improving the detection accuracy of embedded parts.

[0034] (2) In the present invention, the improved model takes into account the large span of target size in the data set on the neck network, adds a new network feature fusion line, balances the lost information caused by the difference in target size, improves the detection accuracy of small targets in embedded parts, introduces GSConv and constructs the AVCStem module, which reduces the number of model parameters while improving the model accuracy.

[0035] (3) After the splicing operation of the AVCStem module, the AKConv module convolution is used to dynamically extract the feature map information after fusion; the AKConv module dynamically adjusts the convolution kernel according to the size and number of the input embedded parts feature map to better adapt to the characteristics of the input data and has a higher feature extraction capability.

[0036] (4) The embedded parts detection method proposed in the present invention further improves the recognition accuracy while ensuring the reasoning efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 This is the model structure diagram of the existing YOLOv8;

[0038] Figure 2 It is the head network structure;

[0039] Figure 3 This is the model structure diagram of the first improved model MBCA_YOLOv8;

[0040] Figure 4 It is the framework diagram of MBCA module;

[0041] Figure 5 This is the model structure diagram of the second improved model MBCA_AVCS_YOLOv8;

[0042] Figure 6 This is the framework diagram of the AVCStem module;

[0043] Figure 7 This is a flow chart of the embedded parts detection method;

[0044] Figure 8(a) shows the classification loss change curve of the second improved model MBCA_AVCS_YOLOv8 on the training set;

[0045] Figure 8(b) shows the target detection loss change curve of the second improved model MBCA_AVCS_YOLOv8 on the training set;

[0046] Figure 8(c) shows the classification loss change curve of the second improved model MBCA_AVCS_YOLOv8 on the validation set;

[0047] Figure 8(d) shows the target detection loss change curve of the second improved model MBCA_AVCS_YOLOv8 on the validation set;

[0048] Figure 8(e) is the accuracy change curve of the second improved model MBCA_AVCS_YOLOv8 on the test set;

[0049] Figure 8(f) shows the recall rate change curve of the second improved model MBCA_AVCS_YOLOv8 on the test set;

[0050] Figure 8(g) shows the mAP50 change curve of the second improved model MBCA_AVCS_YOLOv8 on the test set;

[0051] Figure 8(h) shows the mAP50-95 change curve of the second improved model MBCA_AVCS_YOLOv8 on the test set;

[0052] Fig. 9 PR curve of model YOLOv8 in each category and total category;

[0053] Fig.10 It is the PR curve of the first improved model MBCA_YOLOv8 in each category and the total category;

[0054] Fig.11 This is the PR curve of the second improved model MBCA_AVCS_YOLOv8 in each category and the total category;

[0055] Figures 9 to 11 In the figure, ALLC represents the PR trend calculated on the total category when the average accuracy indicator takes mAP50. DETAILED DESCRIPTION

[0056] 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 only 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.

[0057] In this implementation, two improved models are proposed, which are respectively denoted as: MBCA_YOLOv8 and MBCA_AVCS_YOLOv8.

[0058] Reference Figure 3 , Figure 4 , the improved model MBCA_YOLOv8 replaces the first C2F module and the second C2F module with MBCA modules relative to the model YOLOv8.

[0059] The MBCA module includes the first Conv network, the first activation layer, the first normalization layer, the first DWConv network, the second activation layer, the second normalization layer, the CA module, the second Conv network, the third normalization layer, the random dropout layer (Dropout) and the dimensional superposition network connected sequentially; the input of the first Conv network is the input of the MBCA module; the input of the dimensional superposition network is also connected to the input of the MBCA module, and the output of the dimensional superposition network is the output of the MBCA module.

[0060] In the improved model MBCA_YOLOv8, the first activation layer adopts the Swish activation function, the ReLU activation function, the Softmax activation function or the Sigmoid activation function, and the second activation layer adopts the Swish activation function, the ReLU activation function, the Softmax activation function or the Sigmoid activation function.

[0061] Reference Figure 5 , Figure 6 Compared with the improved model MBCA_YOLOv8, the sixth convolution layer and the seventh convolution layer of the improved model MBCA_AVCS_YOLOv8 are replaced by GSConv (Group Shuffle Convolution) networks; and the C2f modules in the first splicing module, the second splicing module, the third splicing module and the fourth splicing module are replaced by AVCStem modules.

[0062] The AVCStem module includes: a first CBS network, a GSBottleneck module, a second CBS network, a splicing network and an AKConv module; wherein the second CBS network, the splicing network and the AKConv module are connected in sequence, the output of the first CBS network is connected to the input of the GSBottleneck module, and the output of the GSBottleneck module is connected to the input of the splicing network; the inputs of the first CBS network and the second CBS network are both connected to the input of the AVCStem module, and the output of the AKConv module is the output of the AVCStem module.

[0063] Specifically, in the AVCStem module, the splicing network performs dimensional sampling and splicing according to the weight parameters W1 and W2. The splicing network extracts data on M1 dimensions from the output data of the GSBottleneck module, and the splicing network extracts data on M2 dimensions from the output data of the second CBS network. The splicing network then splices and outputs the extracted data.

[0064] M1=W1×N1; M2=W2×N2; W1+W2=1; wherein N1 is the number of dimensions of the output data of the GSBottleneck module, and N2 is the number of dimensions of the output data of the second CBS network.

[0065] The following is a comparative verification of the above three models in conjunction with specific embodiments.

[0066] In this embodiment, the prefabricated floor slabs are first photographed before pouring concrete in the prefabricated component factory, and the relevant embedded parts such as truss steel bars (TB), plastic junction boxes (PJB), metal junction boxes (MJB), reinforcement bars (RR), reserved holes (RH) in the floor slabs are annotated to obtain the original image samples; the annotation of the original image samples belongs to target detection annotation, and the annotation software used is labelimg-1.8.6 under Windows 11. Due to site limitations and each photo containing multiple embedded parts, this data set takes a total of 307 prefabricated floor slab photos. After data enhancement by darkness, exposure, noise, and sharpening, there are a total of 1535 photos. Then the photos are annotated for target detection, and finally a total of 2315 reinforcement bars, 250 plastic junction boxes, 70 metal junction boxes, 1195 truss steel bars, and 115 reserved holes are annotated.

[0067] In this embodiment, a data set including 1535 photos with labeled embedded parts is divided into a training set, a validation set, and a test set in a ratio of 7:2:1.

[0068] Reference Figure 7 In this embodiment, three models are first trained on the training set until the model training times reaches 300 times; then the performance of each model is tested on the test set.

[0069] The experimental environment in this embodiment is: hardware environment NVIDIA GeForce RTX 4090, 24215MiB, training software environment is Python-3.8.0 torch-1.11.0. Training hyperparameter settings: batchsize=32, epoch=300.

[0070] In the three models, the first convolutional layer, the second convolutional layer, the third convolutional layer, the fourth convolutional layer and the fifth convolutional layer all use CBS modules; in the YOLOv8 and MBCA_YOLOv8 models, the sixth and seventh convolutional layers all use CBS modules; in the MBCA_YOLOv8 and MBCA_AVCStem_YOLOv8 models, the first activation layer and the second activation layer all use Swish activation function.

[0071] The model training process is as follows:

[0072] S21, select 32 training samples from the training set, and let the model learn the training samples to train the model parameters;

[0073] S22, select multiple verification samples from the verification set, let the model recognize the verification samples, and calculate the model loss;

[0074] S23, judging whether the model has reached the convergence condition; the convergence condition set in this embodiment is: the model is iterated 300 times;

[0075] If not, return to step S21; if yes, fix the model.

[0076] Specifically, in this embodiment, in S22, the number of validation samples selected is 305, and the model loss adopts classification loss.

[0077] During the model training process, the changing trends of various indicators are as follows: Figure 8(a) to Figure 8(h) The PR curves of the three models are shown as follows: Figure 9~Figure 11 shown.

[0078] In this embodiment, the performance tests of the three models on the test set after training are shown in the following table.

[0079] Table 1: Model performance test

[0080] ;

[0081] In the table, P stands for precision, R stands for recall, mAP50 and mAP50-95 are both average accuracy indicators, Params stands for the number of parameters, GFLOPS stands for giga floating-point operations per second, Size stands for model size, FPS stands for frames per second, and Time stands for model inference time.

[0082] From the above table, we can see that the accuracy of the MBCA_YOLOv8 model is improved by 2.38%, the recall rate is improved by 0.72%, and the mAP is improved by about 1.5% compared with YOLOv8. It can be seen that the accuracy indicators of the model have been improved. Under the premise of these training accuracy improvements, the amount of FPS reduction can be ignored.

[0083] Compared with YOLOv8, the accuracy of the MBCA_AVCStem_YOLOv8 model is improved by 3.14%, the mAP is improved by 2.94%~6.27%, and the number of model parameters is further reduced, which reduces the memory usage of the model.

[0084] Of course, it is obvious to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, but also includes the same or similar structures that can be implemented in other specific forms without departing from the spirit or essential features of the present invention. Therefore, no matter from which point of view, the embodiments should be regarded as exemplary and non-limiting, and the scope of the present invention is defined by the appended claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any reference numerals in the claims should not be regarded as limiting the claims involved.

[0085] In addition, it should be understood that although the present specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.

[0086] The techniques, shapes, and structural parts not described in detail in the present invention are all well-known techniques.

Claims

1. A method for detecting embedded parts, characterized in that: The steps include: Construct learning samples and divide them into training set and validation set. The learning samples are image samples with labeled embedded parts. The labeled information includes the category and location of the embedded parts. The networks with the same name in the YOLOv8 model are named sequentially, and the first C2F module and the second C2F module in the trunk network of the YOLOv8 model are replaced with MBCA modules to form an improved model; the improved model is trained on the training set until the improved model reaches the convergence condition on the validation set; Obtain the image to be inspected and input the converged improved model. The improved model recognizes the image to be inspected and marks the embedded parts. The MBCA module includes a first Conv network, a first activation layer, a first batch of normalization layers, a first DWConv network, a second activation layer, a second batch of normalization layers, a CA module, a second Conv network, a third batch of normalization layers, a random dropout layer, and a dimension stacking network connected sequentially; The input of the first Conv network is the input of the MBCA module; the input of the dimensional superposition network is also connected to the input of the MBCA module, and the output of the dimensional superposition network is the output of the MBCA module.

2. The embedded parts detection method according to claim 1, characterized in that: The neck network of the model YOLOv8 includes a first sampling layer, a first splicing module, a second sampling layer, a second splicing module, a sixth convolutional layer, a third splicing module, a seventh convolutional layer and a fourth splicing module connected sequentially; relative to the model YOLOv8, the improved model also replaces the sixth convolutional layer and the seventh convolutional layer with a GSConv network; and replaces the C2f modules in the first splicing module, the second splicing module, the third splicing module and the fourth splicing module with AVCStem modules; The AVCStem module includes: a first CBS network, a GSBottleneck module, a second CBS network, a splicing network and an AKConv module; wherein the second CBS network, the splicing network and the AKConv module are connected in sequence, the output of the first CBS network is connected to the input of the GSBottleneck module, and the output of the GSBottleneck module is connected to the input of the splicing network; the inputs of the first CBS network and the second CBS network are both connected to the input of the AVCStem module, and the output of the AKConv module is the output of the AVCStem module.

3. The embedded parts detection method according to claim 1, characterized in that: The first activation layer adopts the Swish activation function, the ReLU activation function, the Softmax activation function or the Sigmoid activation function, and the second activation layer adopts the Swish activation function, the ReLU activation function, the Softmax activation function or the Sigmoid activation function.

4. The embedded parts detection method according to claim 3, characterized in that: The first activation layer and the second activation layer use the same activation function.

5. The embedded parts detection method according to claim 1, characterized in that: In the trunk network of the improved model, the first convolutional layer, the second convolutional layer, the third convolutional layer, the fourth convolutional layer and the fifth convolutional layer all use Conv networks or CBS modules.

6. The embedded parts detection method according to claim 1, characterized in that: The improved model is trained on the training set until the improved model reaches convergence conditions on the validation set, including the following steps: S21, selecting multiple training samples from the training set, and allowing the improved model to learn the training samples to train model parameters; S22, select multiple verification samples from the verification set, let the improved model identify the verification samples, and calculate the model loss; S23, judging whether the improved model has reached the convergence condition; if not, returning to step S21; if yes, fixing the improved model.

7. The embedded parts detection method according to claim 6, characterized in that: In S2, the convergence conditions of the improved model are: the accuracy of the improved model on the validation set converges, or the model loss converges, or the number of model updates reaches the set number.

8. An embedded parts detection device, characterized in that: It comprises a memory and a processor, wherein the memory stores a computer program and an improved model, the processor is connected to the memory, and the processor is used to execute the computer program to implement the embedded parts detection method as described in any one of claims 1-7.

9. An embedded parts detection system, characterized in that: include: A camera device and an embedded parts detection device as claimed in claim 8; The camera device is used to photograph the inspection object, and the embedded parts inspection device recognizes the photographed image through the improved model and outputs the recognition result of the photographed image.

10. A storage medium, characterized in that: A computer program is stored, and when the computer program is executed, it is used to implement the embedded parts detection method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Insulator detection method based on target detection algorithm and attention mechanism

    CN116895030A

  • Endoscope image polyp detection method based on multi-scale feature fusion and attention mechanism

    CN117635487A

  • Pulmonary nodule image detection method based on YOLOv8

    CN117764917A

  • Paper diaper image detection method based on improved YOLOv7 network model

    CN117953350A

  • Dense pedestrian detection method and system

    CN118115934A