CN117893475A - High-precision PCB micro defect detection algorithm based on multidimensional attention mechanism - Google Patents
High-precision PCB micro defect detection algorithm based on multidimensional attention mechanism Download PDFInfo
- Publication number
- CN117893475A CN117893475A CN202311725185.8A CN202311725185A CN117893475A CN 117893475 A CN117893475 A CN 117893475A CN 202311725185 A CN202311725185 A CN 202311725185A CN 117893475 A CN117893475 A CN 117893475A
- Authority
- CN
- China
- Prior art keywords
- detection algorithm
- yolov7
- attention mechanism
- siou
- cost
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 72
- 230000007547 defect Effects 0.000 title claims abstract description 56
- 230000007246 mechanism Effects 0.000 title claims abstract description 32
- 238000012549 training Methods 0.000 claims abstract description 4
- 230000006870 function Effects 0.000 claims description 30
- 238000004364 calculation method Methods 0.000 claims description 14
- 230000004913 activation Effects 0.000 claims description 9
- 238000013507 mapping Methods 0.000 claims description 6
- 238000012935 Averaging Methods 0.000 claims description 3
- 238000013459 approach Methods 0.000 claims description 3
- 238000012886 linear function Methods 0.000 claims description 3
- 238000011176 pooling Methods 0.000 claims description 3
- 230000009466 transformation Effects 0.000 claims description 3
- 238000000034 method Methods 0.000 abstract description 14
- 238000013473 artificial intelligence Methods 0.000 abstract description 2
- 238000000605 extraction Methods 0.000 description 5
- 238000004519 manufacturing process Methods 0.000 description 4
- 150000003071 polychlorinated biphenyls Chemical class 0.000 description 3
- RYGMFSIKBFXOCR-UHFFFAOYSA-N Copper Chemical compound [Cu] RYGMFSIKBFXOCR-UHFFFAOYSA-N 0.000 description 2
- 229910052802 copper Inorganic materials 0.000 description 2
- 239000010949 copper Substances 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 101000863875 Mus musculus Tyrosine-protein phosphatase non-receptor type substrate 1 Proteins 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000007796 conventional method Methods 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 230000008439 repair process Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0004—Industrial image inspection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0464—Convolutional networks [CNN, ConvNet]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/766—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using regression, e.g. by projecting features on hyperplanes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/82—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10004—Still image; Photographic image
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10016—Video; Image sequence
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20081—Training; Learning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20084—Artificial neural networks [ANN]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
- G06T2207/30141—Printed circuit board [PCB]
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02T—CLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
- Y02T10/00—Road transport of goods or passengers
- Y02T10/10—Internal combustion engine [ICE] based vehicles
- Y02T10/40—Engine management systems
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Software Systems (AREA)
- Computing Systems (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Biomedical Technology (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- Computational Linguistics (AREA)
- Mathematical Physics (AREA)
- Biophysics (AREA)
- Molecular Biology (AREA)
- Life Sciences & Earth Sciences (AREA)
- Databases & Information Systems (AREA)
- Medical Informatics (AREA)
- Multimedia (AREA)
- Quality & Reliability (AREA)
- Image Analysis (AREA)
Abstract
The invention relates to the technical field of artificial intelligence, and discloses a high-precision PCB micro defect detection algorithm based on a multidimensional attention mechanism, which comprises the following steps: step S1, optimizing a network structure of a YOLOv7 algorithm through full-dimensional dynamic convolution to obtain an improved YOLOv7 target detection algorithm; s2, training and optimizing an improved target detection algorithm of the Yolov7 through an Alpha-SIoU loss function; and S3, detecting the PCB video or picture by using the improved YOLOv7 target detection algorithm, and outputting the detected video or picture. The accuracy of the number and the position of the defect target in the PCB defect detection is improved, and the method can be better suitable for the microminiaturization and the position non-stationarity of the PCB defect.
Description
Technical Field
The invention relates to the technical field of artificial intelligence, in particular to a high-precision PCB micro defect detection algorithm based on a multidimensional attention mechanism.
Background
In recent years, with rapid development and wide application of electronic devices, PCBs as key components of electronic products play a critical role in the electronic manufacturing industry. However, during the manufacturing process of PCBs, minute defects such as leakage holes, rat bites, open circuits, short circuits, burrs, and residual copper, etc., often occur due to various reasons such as manufacturing equipment, material quality, and environmental factors. Therefore, the detection of the PCB defect becomes an important link in the production of electronic products, and the detection capability of a small target is very important for the detection of the PCB defect. Due to the excellent process, precise wiring and rapid development of integrated circuits, PCBs are becoming increasingly integrated and miniaturized. These minor defects, although hardly noticeable by the naked eye, may lead to reduced performance or even failure of the electronic product, severely affecting the quality and reliability of the product. In order to discover and repair these tiny defects in time, efficient and accurate defect detection algorithms become an unprecedented need.
The traditional PCB defect detection adopts an artificial vision detection method and a machine detection method. Common PCB defect detection methods include rules and feature extraction based methods. Rule-based methods typically use predefined rules or thresholds to determine if a defect is present, but such methods have limited detection effectiveness for complex defects. Another class of methods is based on feature extraction, which uses machine learning algorithms for classification and detection by extracting features such as texture, shape, and color of an image. However, since the conventional method is highly dependent on the experience of the field expert for the design and selection of image features, and it is often difficult to sufficiently express complex features of small defects of the PCB, the detection performance thereof is limited.
The conventional YOLOv7 algorithm has some disadvantages in detecting small defects of the PCB. First, YOLOv7 has a weak perceptibility of the micro defect, and often cannot accurately detect the micro defect. Secondly, the YOLOv7 has insufficient adaptability in the aspect of processing PCB defects, and the problems of false detection, omission detection and the like are easy to occur. For the detection of the defects of the PCB, the mAP50 has realized extremely high accuracy in detection precision by a method based on deep learning in recent years, but experimental tests show that the precision of only considering the index is unreasonable. The size of the defect in the PCB, which is a small part of the whole image, belongs to small target detection. Although the one-stage detection framework of the main stream can reach very high indexes on mAP50, the indexes (such as mAP50:95 and mAP 75) are still very low, which indicates that there is still a great room for improvement.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provide a high-precision PCB micro defect detection algorithm based on a multidimensional attention mechanism, which improves the accuracy of detecting the number and the position of defect targets in the defect detection of a PCB (collectively: printed Circuit Board, printed circuit board) and can better adapt to the microminiaturization and the position unfixed property of the PCB defects.
The technical scheme for achieving the purpose is as follows:
a high-precision PCB micro defect detection algorithm based on a multidimensional attention mechanism, comprising:
step S1, optimizing a network structure of a YOLOv7 (Single rod detector) algorithm through full-dimensional dynamic convolution to obtain an improved YOLOv7 target detection algorithm;
s2, training and optimizing an improved target detection algorithm of the Yolov7 through an Alpha-SIoU loss function;
and S3, detecting the PCB video or picture by using the improved YOLOv7 target detection algorithm, and outputting the detected video or picture.
Preferably, in the step S1, the multi-dimensional dynamic convolution optimizes the network structure of the YOLOv7 algorithm by using a multi-dimensional attention mechanism, and specifically includes:
step S11, learning different attentions of the convolution kernels in parallel through four dimensions of a kernel space, and gradually applying the attentions to the convolution kernels corresponding to the Yolov7 algorithm;
step S12, compressing the input x into a feature vector with the length of c_in through global averaging pooling, and reducing the complexity of a Yolov7 algorithm through a FC (fully connected) layer and a ReLU activation function at a mapping rate of r=1/16;
step S13, mapping to four attention branch heads respectively, wherein each branch is provided with an FC layer and a Sigmoid or Softmax activation function to respectively generate an input channel weight, a convolution kernel weight, a kernel space weight and an output channel weight;
wherein the four dimensions include: the number of convolution kernels, the spatial size of the convolution kernels, the number of input channels and the number of output channels.
Preferably, in said step S1, for a full-dimensional dynamic convolution, it uses a linear combination of n convolution kernels, different inputs passing weightsAnd bias->The dynamic weighting of the attention mechanism is realized by continuous transformation, and the dynamic convolution y operation formula is as follows:
where g () represents an activation function;
four-dimensional weighting of kernel spaceAnd bias->Calculated by the following formula,
wherein pi (n) wk (x) Pi is a softmax function fk (x),Π ck (x) And pi sk (x) N is a sigmod function k Kth linear functionW, f, c, s represent four different dimensions.
Preferably, in the step S2, the improved YOLOv7 target detection algorithm is trained and optimized by an Alpha-SIoU (Alpha modulation-frame regression loss function) loss function, where the SIoU loss function considers the mismatching of the direction between the distance, overlapping area and aspect ratio of the prediction frame and the real frame, redefines the multiplication term, and the SIoU loss function includes an angle cost, a distance cost, a shape cost and a IoU (cross-correlation ratio) cost, and adds the Alpha modulation on the basis of the SIoU.
Preferably, the calculation formula of the angle cost Λ is as follows:
wherein,sine value representing angle alpha +>And->The coordinates of the center points of the detection frame and the real frame are respectively; sigma is the distance between two centers, c h For the vertical distance between the two centers, c represents the center point and x and y represent the x and y axes in the coordinate system, respectively.
Preferably, the distance cost delta is calculated as:
wherein ρ is x And ρ y Respectively the square of the distance loss, w crepresentative ofThe horizontal distance between the two center points,when the angle α approaches 0, it is degraded into a distance loss; conversely when angle alpha is close toIn this case, the angular loss increases.
Preferably, the shape cost calculation formula is:
wherein w, h is the width and height of the prediction frame, and w gt ,h gt The width and the height of the real frame; omega w ,ω h And θ defines the cost of the shape, θ is set to 4 by default.
Preferably, ioU cost defines the SIoU loss, ioU cost Lbox calculation formula is:
wherein B represents the largest area occupied by the prediction frame, B GT Representing the occupied area of a real frame;
and Alpha modulation is added on the basis of SIoU, namely the final Alpha-SIoU calculation formula is:
preferably, the loss and gradient of the IoU subject is increased by increasing the size of α, and when α is 1, the formula degenerates to a SIoU loss.
The beneficial effects of the invention are as follows: according to the invention, the network structure of the YOLOv7 algorithm is optimized through full-dimensional dynamic convolution, and the improved YOLOv7 target detection algorithm is trained and optimized through an Alpha-SIoU loss function; the multidimensional attention mechanism is used in the YOLOv7 algorithm, the characteristic learning capacity of the network is improved on the premise of reducing network parameters, the small target defect characteristic extraction is more friendly, the detection precision can be effectively improved, and the detection precision of six defects of the PCB is improved; meanwhile, the accuracy of detecting the number and the positions of the defect targets in the PCB defect detection is improved, and the method can be better suitable for the microminiaturization and the position non-stationarity of the PCB defects.
Drawings
FIG. 1 is a flow chart of the high precision PCB micro defect detection algorithm based on the multidimensional attention mechanism of the present invention;
FIG. 2 is a specific flow chart of the improved YOLOv7 target detection algorithm of the present invention;
FIG. 3 is a schematic diagram of the structure of the full-dimensional attention mechanism of the present invention;
FIG. 4 is a graph of average accuracy versus six defects in the present invention.
Detailed Description
The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. In the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. are based on the directions or positional relationships shown in the drawings, are merely for convenience of describing the present invention and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a specific orientation, be configured and operated in a specific orientation, and thus should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying positive importance.
The invention will be further described with reference to the accompanying drawings.
Since the defects in the PCB are minor defects, it is difficult to extract these features accurately in the network using common convolution means; the common solution is to introduce different attention mechanisms into the network, and although the detection accuracy can be improved by the methods, the methods have certain limitations; the spatial attention mechanism is widely applied in object detection, is used for carrying out weighting processing on the spatial dimension of an image or a feature map, so that a model can focus on a specific area or position in the image more intensively, is very useful for positioning the position of an object and suppressing background interference, can realize the detection of a multi-scale object, and the channel attention mechanism is used for adjusting the weight of input data among different channels so as to focus on important channel information more intensively, can help the model learn more differentiated channel representations, thereby improving the performance of object classification and detection and further introducing a multi-dimensional attention mechanism.
As shown in fig. 1, the high-precision PCB micro defect detection algorithm based on the multidimensional attention mechanism includes:
and S1, optimizing a network structure of the YOLOv7 algorithm through full-dimensional dynamic convolution to obtain an improved YOLOv7 target detection algorithm.
In the embodiment, the full-dimensional dynamic convolution is a new dynamic convolution design, which compensates the limitation of a single convolution kernel dimension, and by learning different attentions of the convolution kernels in parallel along four dimensions of a kernel space, namely the convolution kernel number, the space size of the convolution kernel, the input channel number and the output channel number, and gradually applying the attentions to corresponding convolution kernels, the feature extraction capability of convolution operation in the YOLOv7 algorithm can be greatly enhanced, the full-dimensional attention mechanism of small target detection is effectively improved, and the structure of the full-dimensional attention mechanism is shown in fig. 3.
As shown in fig. 2, the multidimensional dynamic convolution optimizes the network structure of the YOLOv7 algorithm by using a multidimensional attention mechanism, and specifically includes:
step S11, learning different notices of the convolution kernels in parallel through four dimensions of the kernel space, and gradually applying the notices to the convolution kernels corresponding to the Yolov7 algorithm.
In step S12, the complexity of YOLOv7 algorithm is reduced by compressing the input x into a feature vector with length c_in by global averaging pooling, and then by mapping the FC layer and ReLU activation function at r=1/16.
Step S13, mapping to the four attention branch heads, each branch has an FC layer and Sigmoid or Softmax activation function to generate input channel weight, convolution kernel weight, kernel space weight and output channel weight.
In the embodiment, for full-dimensional dynamic convolution, the linear combination of n convolution kernels is used, and the attention of the input dependence of the linear combination is weighted, so that the reasoning accuracy can be effectively improved, and different inputs pass through weightsAnd bias->The dynamic weighting of the attention mechanism is realized by continuous transformation, and the dynamic convolution y operation formula is as follows:
where g () represents an activation function;
four-dimensional weighting of kernel spaceAnd bias->Calculated by the following formula,
wherein pi (n) wk (x) Pi is a softmax function fk (x),Π ck (x) And pi sk (x) N is a sigmod function k Kth linear functionW, f, c, s represent four different dimensions.
In an embodiment, the total weightAnd bias->Is a function of the input and shares the same focus; wherein four different weights pi k (x) Not fixed, but varying with the input x, they represent the linear model +.>Is a set of the optimal set of (a) is a set of the optimal set of (b). Thus, dynamic perceptrons from four dimensions have a stronger feature representation capability than static perceptrons; the multidimensional attention mechanism is used in the YOLOv7 algorithm, the characteristic learning capacity of the network is improved on the premise of reducing network parameters, the small target defect characteristic extraction is more friendly, and the detection precision can be effectively improved.
And S2, training and optimizing an improved target detection algorithm of the Yolov7 through an Alpha-SIoU loss function.
In an embodiment, the improved YOLOv7 target detection algorithm is trained and optimized by means of an Alpha-SIoU loss function, wherein the SIoU loss function considers the direction mismatch between the distance, the overlapping area and the aspect ratio of the prediction frame and the real frame, redefines the multiplication term, the SIoU loss function comprises an angle cost, a distance cost, a shape cost and a IoU cost, and Alpha modulation is added on the basis of the SIoU.
In an embodiment, the calculation formula of the angle cost Λ is:
wherein,sine value representing angle alpha +>And->The coordinates of the center points of the detection frame and the real frame are respectively; sigma is the distance between two centers, c h For the vertical distance between the two centers, c represents the center point and x and y represent the x and y axes in the coordinate system, respectively.
In an embodiment, the distance cost Δ calculation formula is:
wherein ρ is x And ρ y Respectively the square of the distance loss, w crepresentative ofThe horizontal distance between the two center points,when the angle α approaches 0, it is degraded into a distance loss; conversely when angle alpha is close toIn this case, the angular loss increases.
In an embodiment, the shape cost calculation formula is:
wherein w, h is the width and height of the prediction frame, and w gt ,h gt The width and the height of the real frame; omega w ,ω h And θ defines the cost of the shape, θ is set to 4 by default.
In an embodiment, ioU cost defines the SIoU loss, and IoU cost Lbox has a calculation formula:
wherein B represents the largest area occupied by the prediction frame, B GT Representing the occupied area of a real frame;
and Alpha modulation is added on the basis of SIoU, so as to pursue higher detection precision, namely a final Alpha-SIoU calculation formula is as follows:
in an embodiment, the regression accuracy of the bounding box can be improved by increasing the magnitude of α to increase the loss and gradient of the IoU object, and when α is 1, the formula is degenerated to the SIoU loss.
And S3, detecting the PCB video or picture by using the improved YOLOv7 target detection algorithm, and outputting the detected video or picture.
The invention counts the average precision of the improved YOLOv7 target detection algorithm (namely YOLOv-POD in the figure) on six defect types, compares the average precision with the original YOLOv7, and the experimental comparison result is shown in fig. 4, and the average precision values of the detection of six defects of the PCB by the improved method are respectively: the leak hole (MISS_hole) is 99.91%, the mouse bite (mouse_bit) is 98.42%, the open circuit (open_circuit) is 98.15%, the short circuit (short) is 99.48%, the burr (spike) is 96.7%, and the residual copper (spike_cap) is 98.73%, compared with the original YOLOv7 method, the detection precision of each type of defect is improved to a certain extent, wherein the detection precision of the burr defect is improved to the greatest extent, and the average precision value is improved by 5.2%. Therefore, compared with the original YOLOv7 method, the method provided by the invention can well solve the problems of microminiaturization and non-stationarity of defects such as PCB and easy occurrence of missed detection in detection of six defects of PCB.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the invention.
Claims (9)
1. The high-precision PCB micro defect detection algorithm based on the multidimensional attention mechanism is characterized by comprising the following steps of:
step S1, optimizing a network structure of a YOLOv7 algorithm through full-dimensional dynamic convolution to obtain an improved YOLOv7 target detection algorithm;
s2, training and optimizing an improved target detection algorithm of the Yolov7 through an Alpha-SIoU loss function;
and S3, detecting the PCB video or picture by using the improved YOLOv7 target detection algorithm, and outputting the detected video or picture.
2. The high-precision PCB micro defect detection algorithm based on the multidimensional attention mechanism according to claim 1, wherein in the step S1, the multidimensional dynamic convolution optimizes the network structure of the YOLOv7 algorithm by using a multidimensional attention mechanism, and specifically includes:
step S11, learning different attentions of the convolution kernels in parallel through four dimensions of a kernel space, and gradually applying the attentions to the convolution kernels corresponding to the Yolov7 algorithm;
step S12, compressing the input x into a feature vector with the length of c_in through global averaging pooling, and reducing the complexity of a YOLOv7 algorithm through an FC layer and a ReLU activation function at a mapping rate of r=1/16;
step S13, mapping to four attention branch heads respectively, wherein each branch is provided with an FC layer and a Sigmoi d or Softmax activation function to respectively generate an input channel weight, a convolution kernel weight, a kernel space weight and an output channel weight;
wherein the four dimensions include: the number of convolution kernels, the spatial size of the convolution kernels, the number of input channels and the number of output channels.
3. The high-precision PCB micro defect detection algorithm based on multi-dimensional attention mechanism according to claim 2, wherein in step S1, for full-dimensional dynamic convolution, it uses a linear combination of n convolution kernels, different inputs passing weightsAnd bias->The dynamic weighting of the attention mechanism is realized by continuous transformation, and the dynamic convolution y operation formula is as follows:
where g () represents an activation function;
four-dimensional weighting of kernel spaceAnd bias->Calculated by the following formula,
wherein pi (n) wk (x) Pi is a softmax function fk (x),Π ck (x) And pi sk (x) N is a sigmod function k Kth linear functionW, f, c, s represent four different dimensions.
4. The multi-dimensional attention mechanism based high precision PCB micro defect detection algorithm according to claim 1, wherein in step S2, the improved YOLOv7 object detection algorithm is optimized by means of an Alpha-SIoU loss function, wherein the SIoU loss function considers the direction mismatch between the distance, overlapping area and aspect ratio of the prediction frame and the real frame, redefines the multiplication term, the SIoU loss function includes the angle cost, the distance cost, the shape cost and the IoU cost, and the Alpha modulation is added on the basis of the SIoU.
5. The multi-dimensional attention mechanism based high precision PCB micro defect detection algorithm of claim 4, wherein the angle cost Λ calculation formula is:
wherein,sine value representing angle alpha +>And->The coordinates of the center points of the detection frame and the real frame are respectively; sigma is the distance between two centers, ch is the vertical distance between two centers, c represents the center point, and x and y represent the x and y axes in the coordinate system, respectively.
6. The multi-dimensional attention mechanism based high precision PCB micro defect detection algorithm of claim 5, wherein the distance cost delta calculation formula is:
wherein ρ is x And ρ y Respectively the square of the distance loss, w crepresentative ofThe horizontal distance between the two center points,when the angle α approaches 0, it is degraded into a distance loss; conversely when angle alpha is close toIn this case, the angular loss increases.
7. The multi-dimensional attention mechanism based high precision PCB micro defect detection algorithm of claim 6, wherein the shape cost calculation formula is:
wherein w, h is the width and height of the prediction frame, and w gt ,h gt The width and the height of the real frame; omega w ,ω h And θ defines the cost of the shape, θ is set to 4 by default.
8. The high-precision PCB micro defect detection algorithm based on multi-dimensional attention mechanism of claim 7, wherein IoU cost defines SIoU loss, ioU cost L box The calculation formula is as follows:
wherein B represents the largest area occupied by the prediction frame, B GT Representing the occupied area of a real frame;
and Alpha modulation is added on the basis of SIoU, namely the final Alpha-SIoU calculation formula is:
9. the multi-dimensional attention mechanism based high precision PCB micro defect detection algorithm of claim 8, wherein the loss and gradient of IoU objects is increased by increasing the size of α, and when α is 1, the formula is degenerated to SIoU loss.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311725185.8A CN117893475A (en) | 2023-12-15 | 2023-12-15 | High-precision PCB micro defect detection algorithm based on multidimensional attention mechanism |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311725185.8A CN117893475A (en) | 2023-12-15 | 2023-12-15 | High-precision PCB micro defect detection algorithm based on multidimensional attention mechanism |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117893475A true CN117893475A (en) | 2024-04-16 |
Family
ID=90645960
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311725185.8A Pending CN117893475A (en) | 2023-12-15 | 2023-12-15 | High-precision PCB micro defect detection algorithm based on multidimensional attention mechanism |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117893475A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118135334A (en) * | 2024-04-30 | 2024-06-04 | 华东交通大学 | Method and system for identifying faults of catenary hanger |
-
2023
- 2023-12-15 CN CN202311725185.8A patent/CN117893475A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118135334A (en) * | 2024-04-30 | 2024-06-04 | 华东交通大学 | Method and system for identifying faults of catenary hanger |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Adibhatla et al. | Applying deep learning to defect detection in printed circuit boards via a newest model of you-only-look-once | |
CN112199993B (en) | Method for identifying transformer substation insulator infrared image detection model in any direction based on artificial intelligence | |
CN117893475A (en) | High-precision PCB micro defect detection algorithm based on multidimensional attention mechanism | |
TW202239281A (en) | Electronic substrate defect detection | |
CN114240939B (en) | Method, system, equipment and medium for detecting appearance defects of mainboard components | |
CN111681235A (en) | IC welding spot defect detection method based on learning mechanism | |
CN113763364B (en) | Image defect detection method based on convolutional neural network | |
CN117557784B (en) | Target detection method, target detection device, electronic equipment and storage medium | |
Sun et al. | Cascaded detection method for surface defects of lead frame based on high-resolution detection images | |
CN112837281B (en) | Pin defect identification method, device and equipment based on cascade convolution neural network | |
CN113673515A (en) | Computer vision target detection algorithm | |
CN117593264A (en) | Improved detection method for inner wall of cylinder hole of automobile engine by combining YOLOv5 with knowledge distillation | |
CN116934696A (en) | Industrial PCB defect detection method and device based on YOLOv7-Tiny model improvement | |
Huang et al. | Neighborhood correlation enhancement network for PCB defect classification | |
CN116682030A (en) | Training method and storage medium for power inspection image recognition model | |
Lyu et al. | High reliability pipeline leakage detection based on machine vision in complex industrial environment | |
CN115358981A (en) | Glue defect determining method, device, equipment and storage medium | |
Chen et al. | IC solder joints inspection via an optimized statistical modeling method | |
CN115100098A (en) | Printed circuit board AOI intelligent detection equipment based on deep learning algorithm | |
Lakshmi et al. | A Survey of PCB Defect Detection Algorithms | |
CN113989793A (en) | Graphite electrode embossed seal character recognition method | |
Yang et al. | Methods for location and recognition of chess pieces based on machine vision | |
Lei et al. | A precise convolutional neural network-based classification and pose prediction method for PCB component quality control | |
CN111797925B (en) | Visual image classification method and device for power system | |
Liang et al. | Aluminum Surface Defect Detection Algorithm Based on Improved YOLOv5 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |