Three-stage cascade type target defect detection method and device and medium
Through the three-level cascade target defect detection method, the cascade network of the two-classification module, the positioning module and the result output module is used, combined with the specific activation function and pooling layer, to solve the data redundancy problem and improve the efficiency of target detection. and accuracy.
Patent Information
- Application Number
- CN202410844571.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-09-17
AI Technical Summary
There are data redundancy problems in existing target detection technology, which leads to reduced model training efficiency, slowed down detection accuracy and speed, and affects the generalization ability of detection results.
A three-level cascade target defect detection method is used to preprocess and screen the target samples layer by layer through a cascade network composed of a two-class classification module, a positioning module and a result output module, combined with the BN layer, ReLU activation function and maximum pooling optimization layer to optimize model performance and reduce the generation of redundant data.
It effectively reduces data redundancy, improves model running speed and detection accuracy, and improves target positioning accuracy and training efficiency.
Smart Images

Figure CN118658049A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image recognition, and in particular to a three-stage cascade target defect detection method, device and medium. Background Art
[0002] With the rapid advancement of computer vision and deep learning technologies, object detection technology has been widely used in fields such as autonomous driving, intelligent monitoring, industrial detection, and medical image analysis. In recent years, object detection methods based on deep learning have significantly improved detection accuracy and efficiency, especially the widespread application of convolutional neural networks (CNN), which has further promoted the development of this field.
[0003] In target detection, data redundancy occurs in model training, data storage and transmission, etc. Data redundancy will reduce the efficiency of model training because redundant data increases computing and storage requirements, and may cause the model to overfit, reducing its generalization ability on new data, and ultimately affecting detection accuracy and speed.
[0004] Therefore, it is necessary to study how to eliminate data redundancy in the target detection process for target defect detection. Summary of the invention
[0005] The purpose of the present invention is to provide a three-stage cascade target defect detection method, device and medium in order to overcome the defects of poor accuracy and slow speed in the above-mentioned prior art.
[0006] The purpose of the present invention can be achieved by the following technical solutions:
[0007] A three-stage cascade target defect detection method comprises the following steps:
[0008] Obtain target samples, establish and train a cascade target detection network, input the target samples into the cascade target detection network after preprocessing, and obtain defect detection results;
[0009] The cascaded target detection network includes a binary classification module, a positioning module and a result output module connected in sequence. The output of the binary classification module includes a target class and a non-target class. The target class is input into the positioning module. The output of the positioning module includes a target box and an invalid area. The target box is input into the result output module to obtain the defect detection result.
[0010] Furthermore, the structure of the binary classification module includes: inputting the target samples into the continuous, equal and alternating convolution modules and maximum pooling layers, flattening them and obtaining the binary classification output results through the fully connected layer and activation function.
[0011] Furthermore, the activation function is a Sigmod function.
[0012] Furthermore, the structure of the positioning module includes: upsampling the input after passing through the first convolution structure, the second convolution structure and the third convolution structure in sequence, splicing the upsampled output with the output of the second convolution structure, and then splicing it with the output of the first convolution structure, and obtaining the output of the positioning module through a non-maximum suppression algorithm. The first convolution structure, the second convolution structure and the third convolution structure all include a CBR module and a maximum pooling operation, and the CBR module includes a conv convolution layer, a BN layer and a ReLU activation function.
[0013] Furthermore, the structure of the result output module includes a backbone network, a feature pyramid network and an output prediction network. The backbone network contains a Focus module, a convolution module, a RES module and a CRC module. The Focus module in the backbone network is connected to the first convolution module, and the convolution module and the CRC module are alternately connected in sequence. The CRC module includes a conv convolution layer, a CBR module, a RES module and a set prediction unit. The output prediction network includes several convolution modules and is connected to the feature pyramid network.
[0014] Furthermore, the preprocessing includes: performing scale change, Mixup operation and normalization processing on the target image.
[0015] Furthermore, the loss function of the binary classification module is calculated as:
[0016] BCE(p,y)=-[ylog(p)+(1-y)log(1-p)]
[0017] In the formula, BCE(p,y) represents the loss function, y is a binary variable, and p is the model prediction probability.
[0018] Furthermore, the calculation expression of the loss function of the positioning module is:
[0019]
[0020] Where D is the loss function value, ρ represents the distance between the center of the predicted box and the labeled box, b and g are the center points of the two boxes, c represents the diagonal length of the minimum enclosing rectangle of the two boxes, and IoU is the intersection-over-union ratio of the predicted box and the labeled box, that is:
[0021]
[0022] Where X is the predicted box and Y is the labeled box.
[0023] A second aspect of the present invention is a three-stage cascade target defect detection device, comprising a memory, a processor, and a program stored in the memory, wherein when the processor executes the program, it implements any one of the above three-stage cascade target defect detection methods.
[0024] A third aspect of the present invention is a storage medium having a program stored thereon, which, when executed, implements any of the above three-stage cascade target defect detection methods.
[0025] Compared with the prior art, the present invention has the following beneficial effects:
[0026] 1) The present invention adopts a three-level cascade network consisting of a binary classification module, a positioning module and a result output module to screen the interim results generated in the target detection process of large quantities of data layer by layer, filter out data redundancy that may affect target defect detection, reduce storage difficulty, and improve the running speed and detection accuracy of the model.
[0027] 2) The present invention optimizes the model performance, accelerates the training process, reduces the generation of redundant data in the positioning detection process, and further improves the accuracy of target positioning by combining technologies such as BN layer, ReLU activation function, maximum pooling layer and NMS. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 A schematic diagram showing a flow chart of a three-stage cascade target defect detection method proposed in an embodiment of the present invention;
[0029] Figure 2 A schematic diagram showing the structure of a binary classification convolutional neural network module proposed in an embodiment of the present invention;
[0030] Figure 3 A schematic diagram showing the structure of a positioning detection module proposed in an embodiment of the present invention;
[0031] Figure 4 A schematic diagram of the structure of a target detection module proposed in an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0032] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.
[0033] Example 1
[0034] The present invention is a three-stage cascade target defect detection method, device and medium, such as Figure 1 As shown, the method comprises the following steps:
[0035] Obtain target samples, establish and train a cascade target detection network, input the target samples into the cascade target detection network after preprocessing, and obtain defect detection results;
[0036] The cascaded target detection network includes a binary classification module, a positioning module and a result output module connected in sequence. The output of the binary classification module includes a target class and a non-target class. The target class is input into the positioning module. The output of the positioning module includes a target box and an invalid area. The target box is input into the result output module to obtain the defect detection result.
[0037] In this embodiment, the defect detection of insulators is taken as an example to explain the specific contents of the present invention in detail.
[0038] The insulator images were acquired through the camera, and a total of 70k images were collected, of which 50k images were used as training sets and 20k images were used as validation sets for subsequent model training. At this time, the insulator defects were divided into five categories: normal, surface contamination, damage, breakdown, and crack.
[0039] The preprocessing of the insulator image includes: resizing the insulator image, performing a Mixup operation and normalizing. In this embodiment, the original image is first rescaled to a uniform size of 640 pixels, and then a Mixup operation is performed on the image after the uniform size for data enhancement, and finally the image data is normalized.
[0040] like Figure 2 As shown in the figure, the first level of the three-level cascade insulator defect detection method is a binary classification convolutional neural network module, which identifies whether there is an insulator in the image to be identified; the image to be identified is used as the input image to enter the binary classification convolutional neural network module, passes through the i-layer 3*3 convolution module, the i-layer 2*2 maximum pooling layer for feature extraction, and then flattened, the fully connected layer uses 128 neurons, and the activation function uses the Sigmod function, which is expressed as:
[0041]
[0042] σ(x) is the value of the Sigmod function. The Sigmod function is used to ensure that the output value is compressed between 0 and 1, indicating the probability that the sample belongs to the positive category. The Output Layer uses 1 neuron and finally outputs 0 (no insulator) or 1 (with insulator). The loss function uses BCE loss, and the expression is:
[0043] BCE(p,y)=-[ylog(p)+(1-y)log(1-p)]
[0044] In the formula, the true label y is a binary variable with a value of 0 or 1, and the probability p predicted by the model is between 0 and 1. The result with an output of 1 (there is an insulator) is input into the second-level network.
[0045] like Figure 3As shown in the figure, the second level of the three-level cascade insulator defect detection method is a positioning module, which performs insulator positioning processing on the image containing the identification target (insulator); the identification image is passed through three convolution structures composed of two CBR modules and 2*2 maximum pooling operations, which are respectively recorded as the first convolution structure, the second convolution structure and the third convolution structure, and then an upsampling operation is performed. The connection set prediction unit Concat splices the upsampling output with the output of the second convolution structure, and then splices it with the output of the first convolution structure to improve the target detection accuracy; the CBR module includes a conv convolution layer, a BN layer and a ReLU activation function to improve the performance and training speed of the model; the role of maximum pooling is to reduce the spatial dimension of the feature map after convolution and retain the most important feature information; the positioning image of the insulator is output to the third-level neural network after removing part of the detection frame through the non-maximum suppression algorithm (NMS).
[0046] The calculation expression of the loss function of the positioning module is:
[0047]
[0048] Where D is the loss function value, ρ represents the distance between the center of the predicted box and the labeled box, b and g are the center points of the two boxes, c represents the diagonal length of the minimum enclosing rectangle of the two boxes, and IoU is the intersection-over-union ratio of the predicted box and the labeled box, that is:
[0049]
[0050] Where X is the predicted box and Y is the labeled box.
[0051] like Figure 4 As shown in the figure, the third level of the three-level cascade insulator defect detection method is a result output module, which performs defect detection on the insulator located by the positioning module; the third-level neural network module includes a backbone network for extracting insulator image features, a feature pyramid network and an output prediction network, the backbone network includes a Focus module, a 3*3 convolution module, a RES module and a CRC module, the Focus module in the backbone network is connected to the first 3*3 convolution module, and the 3*3 convolution module and the CRC module are alternately connected in sequence; the CRC module includes a conv convolution module, a CBR module, a RES module and a set prediction unit Concat; the feature extraction network receives the insulator defect features of different scales extracted by the backbone network and fuses the target defect image features of different scales, the output prediction network includes several 3*3 convolution modules, and is connected to the feature pyramid network to output the results of insulator defect detection.
[0052] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0053] In the context of the present invention, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0054] The preferred specific embodiments of the present invention are described in detail above. It should be understood that a person skilled in the art can make many modifications and changes based on the concept of the present invention without creative work. Therefore, any technical solution that can be obtained by a person skilled in the art through logical analysis, reasoning or limited experiments based on the concept of the present invention on the basis of the prior art should be within the scope of protection determined by the claims.
Claims
1. A three-stage cascade target defect detection method, characterized in that: The following steps are involved: Obtain target samples, establish and train a cascade target detection network, input the target samples into the cascade target detection network after preprocessing, and obtain defect detection results; The cascaded target detection network includes a binary classification module, a positioning module and a result output module connected in sequence. The output of the binary classification module includes a target class and a non-target class. The target class is input into the positioning module. The output of the positioning module includes a target box and an invalid area. The target box is input into the result output module to obtain a defect detection result.
2. A three-stage cascade target defect detection method according to claim 1, characterized in that: The structure of the binary classification module includes: inputting the target samples into the continuous, equal and alternating convolution modules and maximum pooling layers, flattening them and obtaining the binary classification output results through the fully connected layer and activation function.
3. A three-stage cascade target defect detection method according to claim 2, characterized in that: The activation function is a Sigmod function.
4. A three-stage cascade target defect detection method according to claim 1, characterized in that: The structure of the positioning module includes: upsampling the input after passing through the first convolution structure, the second convolution structure and the third convolution structure in sequence, splicing the upsampled output with the output of the second convolution structure, and then splicing it with the output of the first convolution structure, and obtaining the output of the positioning module through a non-maximum suppression algorithm. The first convolution structure, the second convolution structure and the third convolution structure all include a CBR module and a maximum pooling operation, and the CBR module includes a conv convolution layer, a BN layer and a ReLU activation function.
5. A three-stage cascade target defect detection method according to claim 1, characterized in that: The structure of the result output module includes a backbone network, a feature pyramid network and an output prediction network. The backbone network includes a Focus module, a convolution module, a RES module and a CRC module. The Focus module in the backbone network is connected to the first convolution module, and the convolution module and the CRC module are alternately connected in sequence. The CRC module includes a conv convolution layer, a CBR module, a RES module and a set prediction unit. The output prediction network includes several convolution modules and is connected to the feature pyramid network.
6. A three-stage cascade target defect detection method according to claim 1, characterized in that: The preprocessing includes: performing scale change, Mixup operation and normalization processing on the target image.
7. A three-stage cascade target defect detection method according to claim 1, characterized in that: The calculation expression of the loss function of the binary classification module is: BCE(p,y)=-[ylog(p)+(1-y)log(1-p)] In the formula, BCE(p,y) represents the loss function, y is a binary variable, and p is the model prediction probability.
8. A three-stage cascade target defect detection method according to claim 1, characterized in that: The calculation expression of the loss function of the positioning module is: Where D is the loss function value, ρ represents the distance between the center of the predicted box and the labeled box, b and g are the center points of the two boxes, c represents the diagonal length of the minimum enclosing rectangle of the two boxes, and IoU is the intersection-over-union ratio of the predicted box and the labeled box, that is: Where X is the predicted box and Y is the labeled box.
9. A three-stage cascade target defect detection device, comprising a memory, a processor, and a program stored in the memory, characterized in that: When the processor executes the program, a three-stage cascade target defect detection method as described in any one of claims 1-8 is implemented.
10. A storage medium having a program stored thereon, characterized in that: When the program is executed, a three-stage cascade target defect detection method as described in any one of claims 1-8 is implemented.
