Artificial intelligence-based PCB defect detection model training method

By mapping high-dimensional feature vectors in a two-dimensional coordinate system and generating decision boundary lines, the problem of excessively long training time for PCB defect detection models is solved, enabling rapid construction and updating, and improving production efficiency and adaptability.

CN122265244APending Publication Date: 2026-06-23ZHUHAI TALIAN TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHUHAI TALIAN TECHNOLOGY CO LTD
Filing Date
2026-03-30
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

Existing PCB defect detection models have excessively long training times and struggle to quickly adapt to complex and diverse PCB design changes, leading to low production efficiency and increased costs.

Method used

By employing a method based on convex hull algorithm and geometric modeling, high-dimensional feature vectors are mapped through a two-dimensional coordinate system to generate decision boundary lines, thereby quickly determining the PCB defect status and replacing the traditional complex parameter iterative optimization process.

Benefits of technology

It enables the rapid construction and updating of PCB defect detection models within minutes, improving production efficiency and possessing high timeliness and strong adaptability, making it suitable for the rapidly iterating electronics manufacturing industry.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122265244A_ABST
    Figure CN122265244A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of defect detection, and particularly discloses a PCB defect detection model training method based on artificial intelligence, which comprises the following steps: S1: high-dimensional features of normal and defective PCB samples are extracted respectively and are reduced to two-dimensional space; S2: a convex hull is constructed by using normal sample points, and a core normal area is defined; S3: defective sample points falling outside the normal area are screened out as key defective points; S4: a dynamic decision boundary line is generated on the basis of the normal area boundary and in combination with the distribution of the key defective points; and S5: a sample to be detected is mapped to the two-dimensional space, and the positional relationship between the sample and the decision boundary line is judged; the method replaces complex model training with efficient geometric calculation, and the detection efficiency is significantly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of defect detection technology, and more specifically to a method for training a PCB defect detection model based on artificial intelligence. Background Technology

[0002] In today's electronics manufacturing industry, the quality control of PCB boards is of paramount importance, and artificial intelligence-based defect detection models have become a key means to ensure their quality.

[0003] However, in existing technologies, defect detection on PCB boards often relies on defect detection models, which are extremely time-consuming to train. This is primarily because deep learning algorithms require processing massive amounts of image data and involve complex neural network structures and numerous parameter adjustments. Achieving high accuracy necessitates iterative calculations to optimize model parameters, a process that is highly time-consuming. Furthermore, as PCB designs become increasingly complex and defect types become more diverse, the complexity and scale of training data further increase, multiplying the training time. This lengthy training period not only reduces production efficiency and increases costs but may also prevent the model from adapting promptly to new production demands or process changes, limiting its widespread application in the rapidly iterating electronics manufacturing industry. Summary of the Invention

[0004] The purpose of this invention is to provide a training method for PCB defect detection models based on artificial intelligence, and to solve the following technical problems.

[0005] The objective of this invention can be achieved through the following technical solutions: The training method for PCB defect detection model based on artificial intelligence, S1: Obtain the normal sample image set and the defect sample image set of the PCB board, extract image features from the normal sample image set and the defect sample image set respectively, and obtain the high-dimensional normal feature vector set and the high-dimensional defect feature vector set respectively. S2: Establish a two-dimensional coordinate system, map all high-dimensional normal feature vector sets to the two-dimensional coordinate system to obtain a normal feature point set, and determine the normal region of the normal feature point set based on the convex hull algorithm; obtain the edge line of the normal region, and obtain all normal feature points on the edge line to obtain the edge feature point set; S3: Map all high-dimensional defect feature vector sets to the two-dimensional coordinate system to obtain a defect feature point set; and in the two-dimensional coordinate system, filter out the defect feature points that are not in the normal region and record them as key defect feature points; S4: Based on the edge line of the normal area, and according to the distribution of the key defect feature points, generate a decision boundary line in the two-dimensional coordinate system; S5: Obtain an image of the PCB board to be tested, denoted as the image to be tested, obtain the high-dimensional feature vector of the image to be tested, and map it to the two-dimensional coordinate system to obtain the feature points to be tested. Based on the positional relationship between the feature points to be tested and the decision boundary line, determine the defect status of the PCB board to be tested.

[0006] As a further aspect of the present invention: the process of obtaining the high-dimensional normal feature vector set and the high-dimensional defect feature vector set includes: Image features are extracted sequentially from the images in the normal sample image set to obtain all high-dimensional feature vectors, which are denoted as high-dimensional normal feature vectors. After normalization of all high-dimensional normal feature vectors, a high-dimensional normal feature vector set is formed. Image features are extracted sequentially from the images in the defect sample image set to obtain all high-dimensional feature vectors, which are denoted as high-dimensional defect feature vectors. After normalizing all high-dimensional defect feature vectors, a high-dimensional defect feature vector set is formed.

[0007] As a further aspect of the present invention: the extraction process of the high-dimensional feature vector includes: The convolutional neural network model is pre-trained to obtain a feature extraction network. For any image in the normal sample image set or the defective sample image set, the image is input into the feature extraction network to extract the feature map output by the last pooling layer or convolutional layer in the feature extraction network. A global average pooling operation is performed on the feature map with a preset dimension n to obtain an n-dimensional feature vector, denoted as the high-dimensional feature vector.

[0008] As a further aspect of the present invention: the process of mapping all high-dimensional normal feature vectors to the two-dimensional coordinate system includes: Arrange all high-dimensional feature vectors in the high-dimensional normal feature vector set into rows to form a first feature matrix; perform principal component analysis on the first feature matrix to obtain several principal component vectors, and select the two principal component vectors with the largest eigenvalues, both of which are recorded as key principal components; perform matrix multiplication operation between the first feature matrix and each key principal component to obtain all normal feature points, thus obtaining the normal feature point set.

[0009] As a further aspect of the present invention: the process of determining the normal region of the normal feature point set based on the convex hull algorithm includes: In the two-dimensional coordinate system, all normal feature points located on the outermost edge of the normal feature point set are obtained and recorded as boundary points. The boundary points are connected in a preset order to obtain a boundary line. The area enclosed by the boundary line is recorded as the initial convex hull region. The center point of the convex hull region is obtained. Based on the center point, the convex hull region is geometrically shrunken according to a preset shrinkage ratio to obtain a polygonal region, which is recorded as the normal region.

[0010] As a further aspect of the present invention: the process of mapping the entire high-dimensional defect feature vector set to the two-dimensional coordinate system includes: Arrange all high-dimensional feature vectors in the high-dimensional defect feature vector set into rows to form a second feature matrix; perform principal component analysis on the second feature matrix to obtain several new principal component vectors, and select the two new principal component vectors with the largest eigenvalues, both of which are denoted as key new principal components; perform matrix multiplication operation between the second feature matrix and each key new principal component to obtain all defect feature points, thus obtaining the defect feature point set.

[0011] As a further aspect of the present invention: the process of generating the decision boundary line includes: Obtain each edge of the normal region. For any edge, translate the edge along its normal direction by a preset distance based on the polygon offset algorithm, and extend the translated edge so that each edge is connected to the other to obtain the expansion boundary line. For any critical defect feature point, obtain the shortest distance from the critical defect feature point to the expansion boundary line. If the shortest distance is less than a preset attraction distance threshold, then the critical defect feature point is recorded as an effective attraction point. Each effective attraction point is considered as a virtual gravitational point; several reference points are selected at preset intervals on the expansion boundary line; for any reference point, the gravitational vectors of each gravitational point are obtained based on predefined gravitational rules; the combined gravitational vectors of each reference point are obtained; the moving distance d is determined according to the combined gravitational vector; the reference points are translated by a distance d along the direction of the combined gravitational vector; all the translated reference points are connected sequentially with a smooth curve to obtain the decision boundary line.

[0012] As a further aspect of the present invention: the process of determining the defect state of the PCB board under test includes: The coordinates of the feature point to be measured are obtained in the two-dimensional coordinate system and denoted as Q(x). q y q And, at equal intervals along the decision boundary line, select several decision points to obtain a decision point set {B1, B2, ... B...}. N}, where B N Let N represent the Nth decision point, where N is the total number of decision points; on the decision boundary line, several boundary line segments B are obtained based on every two adjacent decision points. e B e+1 , where e∈[1,N-1] and e is a positive integer; and with the feature point to be measured Q as the starting point, construct a horizontal ray parallel to the horizontal coordinate axis and pointing in the positive direction; For any boundary line segment, if the horizontal ray and the boundary line segment satisfy (y q -yBe )(y q -y Be+1 )≤0, and when y Be ≠y Be+1 Timely satisfaction Then, let the intersection of the horizontal ray and the boundary line segment be denoted as (x). Be y Be () is the judgment point B e The coordinates; Obtain the total number of all boundary line segments intersecting with the horizontal ray, denoted as C; if C is odd, the feature point Q to be tested is inside the decision boundary line; if C is even or C=0, the feature point Q to be tested is outside the decision boundary line; when the feature point Q to be tested is inside the decision boundary line, continue to determine whether the feature point Q to be tested is inside the normal area. If yes, the PCB board to be tested is defect-free; if no, it is indicated that there may be a defect, and manual re-inspection is recommended; when the feature point Q to be tested is outside the decision boundary line, directly record that the PCB board to be tested has a defect.

[0013] The beneficial effects of this invention are: This invention is based on a novel paradigm of feature space geometric modeling, abandoning the complex process of iterative parameter optimization. It transforms model building into rapid geometric analysis and boundary generation of the distribution of normal and defective samples in a low-dimensional space. First, normal samples are used to determine the core region to describe the health status benchmark. Then, key defect points are selected and used to drive the generation of a dynamic decision boundary. This method effectively solves the core problems of traditional deep learning models, such as excessively long training time and difficulty in quickly adapting to new defects. This invention replaces time-consuming neural network training and inference, realizing minute-level rapid model building and updating, and providing PCB manufacturing with an online defect detection solution that combines high timeliness, strong adaptability, and high reliability. Attached Figure Description

[0014] The invention will now be further described with reference to the accompanying drawings.

[0015] Figure 1 This is a schematic diagram illustrating the steps of the PCB defect detection model training method based on artificial intelligence according to the present invention. Detailed Implementation

[0016] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0017] Please see Figure 1 As shown, this invention is a method for training a PCB defect detection model based on artificial intelligence, comprising the following steps: S1: Obtain the normal sample image set and the defect sample image set of the PCB board, extract image features from the normal sample image set and the defect sample image set respectively, and obtain the high-dimensional normal feature vector set and the high-dimensional defect feature vector set respectively.

[0018] In a preferred embodiment of the present invention, the process of obtaining the high-dimensional normal feature vector set and the high-dimensional defect feature vector set includes: Image features are extracted sequentially from the images in the normal sample image set to obtain all high-dimensional feature vectors, which are denoted as high-dimensional normal feature vectors. After normalization of all high-dimensional normal feature vectors, a high-dimensional normal feature vector set is formed. Image features are extracted sequentially from the images in the defect sample image set to obtain all high-dimensional feature vectors, which are denoted as high-dimensional defect feature vectors. After normalizing all high-dimensional defect feature vectors, a high-dimensional defect feature vector set is formed.

[0019] In a preferred embodiment of the present invention, the extraction process of the high-dimensional feature vector includes: The convolutional neural network model is pre-trained to obtain a feature extraction network. For any image in the normal sample image set or the defective sample image set, the image is input into the feature extraction network to extract the feature map output by the last pooling layer or convolutional layer in the feature extraction network. A global average pooling operation is performed on the feature map with a preset dimension n to obtain an n-dimensional feature vector, denoted as the high-dimensional feature vector.

[0020] It should be noted that the feature extraction network uses a ResNet-50 model pre-trained on a large general-purpose image dataset (such as ImageNet) as its basic architecture, specifically including: The backbone of the feature extraction network includes all the convolutional and pooling layers of ResNet-50, specifically including an initial 7×7 convolutional layer and a subsequent max pooling layer, as well as four consecutive stages; the four consecutive stages consist of 3, 4, 6, and 3 residual blocks respectively, containing a total of 49 convolutional layers. The feature extraction network's feature output layer is formed by removing the global average pooling layer at the top of the original ResNet-50 model and the subsequent fully connected classification layer. The output of the last residual block (i.e., the third residual block in the fourth stage) is taken as the final output of this feature extraction network. The final output is a three-dimensional feature map with a size of [H, W, T] = [7, 7, 2048], where H and W are the spatial height and width of the three-dimensional feature map, respectively, and T is the number of channels. In this example, T is denoted as 2048. The feature vectorization process of the feature extraction network includes: for any input PCB image, inputting it into the feature extraction network and obtaining its three-dimensional feature map; performing a global average pooling operation on the three-dimensional feature map, that is, calculating the average value of all 7×7=49 spatial locations in each channel to obtain a one-dimensional vector containing 2048 scalar values, denoted as a 2048-dimensional (i.e., n=2048) high-dimensional feature vector.

[0021] S2: Establish a two-dimensional coordinate system, map all high-dimensional normal feature vector sets to the two-dimensional coordinate system to obtain a normal feature point set, and determine the normal region of the normal feature point set based on the convex hull algorithm; obtain the edge line of the normal region, and obtain all normal feature points on the edge line to obtain the edge feature point set.

[0022] In a preferred embodiment of the present invention, the process of mapping all high-dimensional normal feature vectors to the two-dimensional coordinate system includes: Arrange all high-dimensional feature vectors in the high-dimensional normal feature vector set into rows to form a first feature matrix; perform principal component analysis on the first feature matrix to obtain several principal component vectors, and select the two principal component vectors with the largest eigenvalues, both of which are recorded as key principal components; perform matrix multiplication operation between the first feature matrix and each key principal component to obtain all normal feature points, thus obtaining the normal feature point set.

[0023] In a preferred embodiment of the present invention, the process of determining the normal region of the normal feature point set based on the convex hull algorithm includes: In the two-dimensional coordinate system, all normal feature points located on the outermost edge of the normal feature point set are obtained and recorded as boundary points. The boundary points are connected in a preset order to obtain a boundary line. The area enclosed by the boundary line is recorded as the initial convex hull region. The center point of the convex hull region is obtained. Based on the center point, the convex hull region is geometrically shrunken according to a preset shrinkage ratio to obtain a polygonal region, which is recorded as the normal region. The process of determining the normal region of the normal feature point set based on the convex hull algorithm also includes, in the two-dimensional coordinate system, recording several normal feature points outside the normal region as abnormal points, and removing all abnormal points.

[0024] S3: Map all high-dimensional defect feature vector sets to the two-dimensional coordinate system to obtain a defect feature point set; and in the two-dimensional coordinate system, filter out the defect feature points that are not in the normal region, and record them as key defect feature points.

[0025] In a preferred embodiment of the present invention, the process of mapping the entire high-dimensional defect feature vector set to the two-dimensional coordinate system includes: Arrange all high-dimensional feature vectors in the high-dimensional defect feature vector set into rows to form a second feature matrix; perform principal component analysis on the second feature matrix to obtain several new principal component vectors, and select the two new principal component vectors with the largest eigenvalues, both of which are denoted as key new principal components; perform matrix multiplication operation between the second feature matrix and each key new principal component to obtain all defect feature points, thus obtaining the defect feature point set.

[0026] S4: Based on the edge line of the normal area, and according to the distribution of the key defect feature points, generate a decision boundary line in the two-dimensional coordinate system.

[0027] In a preferred embodiment of the present invention, the process of generating the decision boundary line includes: Obtain each edge of the normal region. For any edge, translate the edge along its normal direction by a preset distance based on the polygon offset algorithm, and extend the translated edge so that each edge is connected to the other to obtain the expansion boundary line. For any critical defect feature point, obtain the shortest distance from the critical defect feature point to the expansion boundary line. If the shortest distance is less than a preset attraction distance threshold, then the critical defect feature point is recorded as an effective attraction point. Each effective attraction point is considered as a virtual gravitational point; several reference points are selected at preset intervals on the expansion boundary line; for any reference point, the gravitational vectors of each gravitational point are obtained based on predefined gravitational rules; the combined gravitational vectors of each reference point are obtained; the moving distance d is determined according to the combined gravitational vector; the reference points are translated by a distance d along the direction of the combined gravitational vector; all the translated reference points are connected sequentially with a smooth curve to obtain the decision boundary line.

[0028] The process of setting the preset distance includes: Obtain the coordinates of all normal feature points within the normal region, resulting in a coordinate set {(x1, y1), (x2, y2), ..., (x...}. m y m)}, where x m The x-coordinate of the m-th normal feature point is represented by y. m Represent the ordinate of the m-th normal feature point; establish the covariance matrix based on the coordinate set. , where σ xx σ represents the variance of all x-coordinates in the coordinate set. yy σ represents the variance of all ordinates in the coordinate set. xy =σ yx The covariance between x and y is represented; all eigenvalues ​​of the covariance matrix are obtained, the largest eigenvalue is selected and denoted as the principal dispersion radius R; and a preset expansion coefficient k is set to obtain a preset distance kR.

[0029] Specifically, the largest eigenvalue is the standard deviation of the coordinate set in the direction of maximum variance, the scatter radius R is used to reflect the extension length of the edge feature point set, and the expansion coefficient k is a constant set according to the actual detection strictness requirements; The predefined gravitational rule is that the closer the reference point is to the gravitational point, the stronger the gravitational force it experiences; the farther the reference point is from the gravitational point, the weaker the gravitational force it experiences.

[0030] The process of determining the gravity vector includes: A standard gravitational value F is preset. In the two-dimensional coordinate system, a standard gravitational value corresponds to a unit distance. The distance between the reference point and the gravitational point is obtained and denoted as D, where D = zd0, d0 is the unit distance, and z is a multiple of the unit distance. The modulus is then zF. The gravitational vector is obtained based on the modulus, with the direction from the gravitational point to the reference point. The process of determining the movement distance d based on the comprehensive gravity vector includes: Let A denote the gravitational vector of the j-th gravitational point acting on the reference point. j P, then the composite displacement vector of the reference point is obtained. , where M is the total number of gravitational points, j∈[1,m] and j is a positive integer, C is a preset global displacement constant, r is a preset effective gravitational radius, and ε is a preset minimal constant used to prevent division by zero; then the moving distance is the modulus of the comprehensive displacement vector.

[0031] Specifically The attenuation weight represents the exponential decrease in gravitational force with the square of the distance, i.e., stronger closer and weaker farther away; r is the effective radius of gravity, representing the maximum range of gravitational energy influence at a gravitational point; for gravitational points beyond r, the attenuation weight is close to 0, having virtually no effect on P; ε is a very small constant, typically set to 10. -6 To prevent when P and A jThe closer the distance, the denominator is 0; C is used to control the amplitude of the overall deformation, ensuring that the deformation is smooth and fine-tuned, rather than abrupt and drastic.

[0032] S5: Obtain an image of the PCB board to be tested, denoted as the image to be tested, obtain the high-dimensional feature vector of the image to be tested, and map it to the two-dimensional coordinate system to obtain the feature points to be tested. Based on the positional relationship between the feature points to be tested and the decision boundary line, determine the defect status of the PCB board to be tested.

[0033] In a preferred embodiment of the present invention, the process of determining the defect status of the PCB board under test includes: The coordinates of the feature point to be measured are obtained in the two-dimensional coordinate system and denoted as Q(x). q y q And, at equal intervals along the decision boundary line, select several decision points to obtain a decision point set {B1, B2, ... B...}. N}, where B N Let N represent the Nth decision point, where N is the total number of decision points; on the decision boundary line, several boundary line segments B are obtained based on every two adjacent decision points. e B e+1 , where e∈[1,N-1] and e is a positive integer; and with the feature point to be measured Q as the starting point, construct a horizontal ray parallel to the horizontal coordinate axis and pointing in the positive direction; For any boundary line segment, if the horizontal ray and the boundary line segment satisfy (y q -y Be )(y q -y Be+1 )≤0, and when y Be ≠y Be+1 Timely satisfaction Then, let the intersection of the horizontal ray and the boundary line segment be denoted as (x). Be y Be () is the judgment point B e The coordinates; Obtain the total number of all boundary line segments intersecting with the horizontal ray, denoted as C; if C is odd, the feature point Q to be tested is inside the decision boundary line; if C is even or C=0, the feature point Q to be tested is outside the decision boundary line; when the feature point Q to be tested is inside the decision boundary line, continue to determine whether the feature point Q to be tested is inside the normal area. If yes, the PCB board to be tested is defect-free; if no, it is indicated that there may be a defect, and manual re-inspection is recommended; when the feature point Q to be tested is outside the decision boundary line, directly record that the PCB board to be tested has a defect.

[0034] It is worth noting that the process of determining whether the feature point Q to be tested is inside the normal region is the same as the method of determining whether the feature point Q to be tested is inside the decision boundary line.

[0035] Specifically, (y q -y Be )(y q -y Be+1 The step ≤ 0 is used to quickly eliminate boundary segments that are completely above or completely below Q in the vertical direction, as these boundary segments cannot intersect with the horizontal ray; if (y q -y Be )(y q -y Be+1 If ) > 0, it means that the ordinate value of Q is simultaneously greater than or simultaneously less than the two endpoints of the boundary line segment. In this case, the entire boundary line segment is above or below Q and cannot be passed through by the horizontal ray. When y Be ≠y Be+1 Timely satisfaction This step is used to satisfy (y q -y Be )(y q -y Be+1 After )≤0, further determine whether the intersection point is to the right of Q. The intersection point refers to the intersection point of the horizontal ray and the decision boundary line.

[0036] It is worth noting that we only consider the intersection point to the right of Q. If we consider the intersection points to the left and right at the same time, the number of crossings to the left and right will be odd for the internal intersection points, and the sum will be even, which will cause the odd-even determination rule to fail. Therefore, we must fix one direction.

[0037] It is worth noting that if y Be =y Be+1 If the horizontal rays are either parallel with no intersection points, or coincident with countless intersection points, then this case must be excluded. It's important to note that when Q is odd, Q must cross the boundary line an odd number of times to leave the polygon from any direction; when Q is even or C=0, Q is already outside. To enter a closed region and then exit, it needs to cross the boundary line an even number of times; if it's completely outside, it doesn't need to cross it even once.

[0038] The foregoing has provided a detailed description of one embodiment of the present invention, but this description is merely a preferred embodiment and should not be construed as limiting the scope of the invention. All equivalent variations and modifications made within the scope of the present invention should still fall within the scope of the present invention.

Claims

1. A method for training a PCB defect detection model based on artificial intelligence, characterized in that, Includes the following steps: S1: Obtain the normal sample image set and the defect sample image set of the PCB board, extract image features from the normal sample image set and the defect sample image set respectively, and obtain the high-dimensional normal feature vector set and the high-dimensional defect feature vector set respectively; S2: Establish a two-dimensional coordinate system, map all high-dimensional normal feature vector sets to the two-dimensional coordinate system to obtain a normal feature point set, and determine the normal region of the normal feature point set based on the convex hull algorithm; obtain the edge line of the normal region, and obtain all normal feature points on the edge line to obtain the edge feature point set; S3: Map the entire set of high-dimensional defect feature vectors to the two-dimensional coordinate system to obtain the set of defect feature points; In the two-dimensional coordinate system, defect feature points that are not located in the normal area are selected and recorded as key defect feature points; S4: Based on the edge line of the normal area, and according to the distribution of the key defect feature points, generate a decision boundary line in the two-dimensional coordinate system; S5: Obtain an image of the PCB board to be tested, denoted as the image to be tested, obtain the high-dimensional feature vector of the image to be tested, and map it to the two-dimensional coordinate system to obtain the feature points to be tested. Based on the positional relationship between the feature points to be tested and the decision boundary line, determine the defect status of the PCB board to be tested.

2. The PCB defect detection model training method based on artificial intelligence according to claim 1, characterized in that, In S1, the process of obtaining the high-dimensional normal feature vector set and the high-dimensional defect feature vector set includes: Image features are extracted sequentially from the images in the normal sample image set to obtain all high-dimensional feature vectors, which are denoted as high-dimensional normal feature vectors. After normalization of all high-dimensional normal feature vectors, a high-dimensional normal feature vector set is formed. Image features are extracted sequentially from the images in the defect sample image set to obtain all high-dimensional feature vectors, which are denoted as high-dimensional defect feature vectors. After normalizing all high-dimensional defect feature vectors, a high-dimensional defect feature vector set is formed.

3. The PCB defect detection model training method based on artificial intelligence according to claim 2, characterized in that, In S1, the extraction process of the high-dimensional feature vector includes: The convolutional neural network model is pre-trained to obtain a feature extraction network. For any image in the normal sample image set or the defective sample image set, the image is input into the feature extraction network to extract the feature map output by the last pooling layer or convolutional layer in the feature extraction network. A global average pooling operation is performed on the feature map with a preset dimension n to obtain an n-dimensional feature vector, denoted as the high-dimensional feature vector.

4. The PCB defect detection model training method based on artificial intelligence according to claim 1, characterized in that, In S2, the process of mapping all high-dimensional normal feature vectors to the two-dimensional coordinate system includes: Arrange all high-dimensional feature vectors in the high-dimensional normal feature vector set into rows to form a first feature matrix; perform principal component analysis on the first feature matrix to obtain several principal component vectors, and select the two principal component vectors with the largest eigenvalues, both of which are recorded as key principal components; perform matrix multiplication operation between the first feature matrix and each key principal component to obtain all normal feature points, thus obtaining the normal feature point set.

5. The PCB defect detection model training method based on artificial intelligence according to claim 1, characterized in that, In S2, the process of determining the normal region of the normal feature point set based on the convex hull algorithm includes: In the two-dimensional coordinate system, all normal feature points located on the outermost edge of the normal feature point set are obtained and recorded as boundary points. The boundary points are connected in a preset order to obtain a boundary line. The area enclosed by the boundary line is recorded as the initial convex hull region. The center point of the convex hull region is obtained. Based on the center point, the convex hull region is geometrically shrunken according to a preset shrinkage ratio to obtain a polygonal region, which is recorded as the normal region.

6. The PCB defect detection model training method based on artificial intelligence according to claim 1, characterized in that, In S3, the process of mapping the entire set of high-dimensional defect feature vectors to the two-dimensional coordinate system includes: Arrange all high-dimensional feature vectors in the high-dimensional defect feature vector set into rows to form a second feature matrix; perform principal component analysis on the second feature matrix to obtain several new principal component vectors, and select the two new principal component vectors with the largest eigenvalues, both of which are denoted as key new principal components; perform matrix multiplication operation between the second feature matrix and each key new principal component to obtain all defect feature points, thus obtaining the defect feature point set.

7. The PCB defect detection model training method based on artificial intelligence according to claim 1, characterized in that, In S4, the process of generating the decision boundary line includes: Obtain each edge of the normal region. For any edge, translate the edge along its normal direction by a preset distance based on the polygon offset algorithm, and extend the translated edge so that each edge is connected to the other to obtain the expansion boundary line. For any critical defect feature point, obtain the shortest distance from the critical defect feature point to the expansion boundary line. If the shortest distance is less than a preset attraction distance threshold, then the critical defect feature point is recorded as an effective attraction point. Each effective attraction point is considered as a virtual gravitational point; several reference points are selected at preset intervals on the expansion boundary line; for any reference point, the gravitational vectors of each gravitational point are obtained based on predefined gravitational rules; the combined gravitational vectors of each reference point are obtained; the moving distance d is determined according to the combined gravitational vector; the reference points are translated by a distance d along the direction of the combined gravitational vector; all the translated reference points are connected sequentially with a smooth curve to obtain the decision boundary line.

8. The PCB defect detection model training method based on artificial intelligence according to claim 1, characterized in that, In S5, the process of determining the defect status of the PCB board under test includes: The coordinates of the feature point to be measured are obtained in the two-dimensional coordinate system and denoted as Q(x). q y q And, at equal intervals along the decision boundary line, select several decision points to obtain a decision point set {B1, B2, ... B...}. N }, where B N Let N represent the Nth decision point, where N is the total number of decision points; on the decision boundary line, several boundary line segments B are obtained based on every two adjacent decision points. e B e+1 , where e∈[1,N-1] and e is a positive integer; and with the feature point to be measured Q as the starting point, construct a horizontal ray parallel to the horizontal coordinate axis and pointing in the positive direction; For any boundary line segment, if the horizontal ray and the boundary line segment satisfy (y q -y Be )(y q -y Be+1 )≤0, and when y Be ≠y Be+1 Timely satisfaction Then, let the intersection of the horizontal ray and the boundary line segment be denoted as (x). Be y Be () is the judgment point B e The coordinates; Obtain the total number of all boundary line segments intersecting with the horizontal ray, denoted as C; if C is odd, the feature point Q to be tested is inside the decision boundary line; if C is even or C=0, the feature point Q to be tested is outside the decision boundary line; when the feature point Q to be tested is inside the decision boundary line, continue to determine whether the feature point Q to be tested is inside the normal area. If yes, the PCB board to be tested is defect-free; if no, it is indicated that there may be a defect, and manual re-inspection is recommended; when the feature point Q to be tested is outside the decision boundary line, directly record that the PCB board to be tested has a defect.