# US 2021/0334587 A1 · Method and apparatus for training a convolutional neural network to detect defects

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0334587 A1
- Document ID: US20210334587A1
- Status: Published application
- Kind: A1
- Application number: 16/486,025
- Filed: 2019-04-02
- Published: 2021-10-28
- Earliest claimed: 2018-09-04
- Assignees: Boe Technology Group Co., Ltd.
- Applicants: BOE Technology Group Co., Ltd.
- Inventors: Tingting Wang
- Web page: https://patentgrep.com/patent/US20210334587A1

## CPC

- G06T 7/001: {using an image reference approach}
- G01N 21/95684: {Patterns showing highly reflecting parts, e.g. metallic elements}
- G01N 23/04: and forming images of the material
- G01N 23/18: Investigating the presence of flaws defects or foreign matter
- G06F 18/214: Generating training patterns; Bootstrap methods, e.g. bagging or boosting
- G06F 18/2431: Multiple classes
- G06N 3/04: Architecture, e.g. interconnection topology
- G06N 3/045: Combinations of networks
- G06N 3/0464: Convolutional networks [CNN, ConvNet]
- G06N 3/08: Learning methods
- G06N 3/09: Supervised learning
- G06T 5/70: Denoising; Smoothing
- G06T 5/92: based on global image properties
- G06T 7/136: involving thresholding
- G01N 2021/8883: {involving the calculation of gauges, generating models}
- G01N 2021/8887: {based on image processing techniques}
- G01N 2021/95646: {Soldering}
- G01N 2223/401: image processing
- G01N 2223/646: flaws, defects
- G06T 2207/10116: X-ray image
- G06T 2207/20081: Training; Learning
- G06T 2207/20084: Artificial neural networks [ANN]
- G06T 2207/30141: Printed circuit board [PCB]
- G06T 2207/30152: Solder
- G06T: IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G01N: INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES (measuring or testing apparatus or processes other than immunoassay, involving enzymes or microorganisms C12M, C12Q)
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

The present application discloses a method of training a convolutional neural network for defect inspection. The method includes collecting a training sample set including multiple solder joint images. A respective one of the multiple solder joint images includes at least one solder joint having one of different types of solder joint defects. The at least one solder joint is located substantially in a pre-defined region of interest (ROI) in a center of the image. The method further includes inputting the training sample set to a convolutional neural network to obtain target feature vectors respectively associated with the multiple solder joint images. Additionally, the method includes adjusting network parameters characterizing the convolutional neural network through a training loss function based on the target feature vectors and pre-labeled defect labels corresponding to different types of solder joint defects. The training loss function includes at least two different loss functions.

## Claims

### Claim 1

A method of training a convolutional neural network through deep learning for defect inspection, the method comprising:
collecting a training sample set including multiple solder joint images, a respective one of the multiple solder joint images comprising at least one of multiple solder joints having different types of solder joint defects, the at least one of multiple solder joints being located substantially in a pre-defined region of interest (ROI) in a center of the respective one of the multiple solder joint images;
inputting the training sample set to a convolutional neural network to obtain target feature vectors respectively associated with the multiple solder joint images; and
adjusting network parameters characterizing the convolutional neural network through a training loss function associated with a classification layer based on the target feature vectors and pre-labeled defect labels corresponding to different types of solder joint defects.

### Claim 2 (depends on 1)

The method of claim 1, wherein the convolutional neural network comprises one or more stages, a respective one stage comprising one or more convolutional layers and one max-pooling layer, a respective one convolutional layer being followed by a feature-enhancement network.

### Claim 3 (depends on 1)

The method of claim 1, wherein adjusting network parameters comprises:
converting a respective one of the defect labels to a first K-dimension feature vector corresponding to a respective one of different types of solder joint defects;
transposing the first K-dimension feature vector to a transposed K-dimension feature vector;
reducing dimensionality of a respective one of the target feature vectors corresponding to a respective one of the multiple solder joint images to a second K-dimension feature vector;
determining a target prediction probability of the respective one of multiple solder joint images corresponding to the respective one of the defect labels; and
adjusting network parameters through the training loss function based on the target prediction probability of the respective one of multiple solder joint images corresponding to the respective one of the defect labels, the transposed K-dimension feature vector of the respective one of defect labels, and the second K-dimension feature vector of the respective one of multiple solder joint images.

### Claim 4 (depends on 3)

The method of claim 3, wherein the training loss function is a Sigmoid cross entropy loss function Ls=−Σm=1M[ym log ŷm+(1−ym)log(1−ŷm)]associated with the classification layer, wherein M represents a total number of different types of defect labels, m is an integer varying from 1 to M, ŷm represents a target prediction probability of the respective one of the multiple solder joint images having a m-th type defect label, ym represents a preset true probability value of the respective one of multiple solder joint images having the m-th type defect label.

### Claim 5 (depends on 3)

The method of claim 3, wherein the training loss function is a Rank loss function Lr=Σt∈MΣj∈M[1−Q(i,j)]max(0,m0−ViTZ+VjTZ) associated with the classification layer, wherein Q(i, j) represents a predetermined occurrence probability of a solder joint image having both an i-th type of defect label and a j-th type of defect label, i and j are integers varying from 1 to M and not equal, m0 represents a predetermined parameter, ViT represents one of the transposed K-dimension feature vector corresponding to the i-th type of defect label, VjT represents one of the transposed K-dimension feature vector corresponding to the j-th type of defect label, Z represents one of the second K-dimension feature vector corresponding to a respective one of multiple solder joint images.

### Claim 6 (depends on 3)

The method of claim 3, wherein the training loss function is a linear combination of a Sigmoid cross entropy loss function Ls and a Rank loss function Lr with a weight factor λ; wherein,
L
s
=
-
∑
m
=
1
M
⁢
[
y
m
⁢
log
⁢
⁢
y
^
m
+
(
1
-
y
m
)
⁢
log
⁡
(
1
-
y
^
m
)
]
,
M represents a total number of different types of defect labels, m is an integer varying from 1 to M, ŷm represents a target prediction probability of the respective one of the multiple solder joint images having a m-th type defect label, ym represents a preset true probability value of the respective one of multiple solder joint images having the m-th type defect label;
L
r
=
∑
t
∈
M
⁢
⁢
∑
j
∈
M
⁢
[
1
-
Q
⁡
(
t
,
f
)
]
⁢
max
⁡
(
0
,
m
0
-
V
t
T
⁢
Z
+
V
j
T
⁢
Z
)
,
Q(i, j) represents a predetermined occurrence probability of a solder joint image having both an i-th type of defect label and a j-th type of defect label, i and j are integers varying from 1 to M and not equal, m0 represents a predetermined parameter, ViT represents one of the transposed K-dimension feature vector corresponding to the i-th type of defect label, VjT represents one of the transposed K-dimension feature vector corresponding to the j-th type of defect label, Z represents one of the second K-dimension feature vector corresponding to a respective one of multiple solder joint images.

### Claim 7 (depends on 6)

The method of claim 6, wherein adjusting network parameters comprises:
fixing parameters associated with one of the Sigmoid cross entropy loss function Ls and the Rank loss function Lr;
adjusting network parameters through varying parameters associated with another one of the Sigmoid cross entropy loss function Ls and the Rank loss function Lr;
obtaining the target feature vectors respectively associated with the multiple solder joint images from the convolutional neural network based on adjusted network parameters;
iterating a preset number of steps of fixing parameters and adjusting network parameters to obtain the target feature vectors;
fixing parameters associated with one of the Sigmoid cross entropy loss function Ls and the Rank loss function Lr which was used for adjusting network parameters at a latest iteration step; and
adjusting network parameters through varying parameters associated with the another one of the Sigmoid cross entropy loss function Ls and the Rank loss function Lr which was fixed at the latest iteration step.

### Claim 8 (depends on 3)

The method of claim 3, wherein determining the target prediction probability of the respective one of multiple solder joint images corresponding to the respective one of the defect labels comprising:
determining an initial prediction probability of the respective one of multiple solder joint images corresponding to the respective one of the defect labels based on the respective one of the target feature vectors; and
determining the target prediction probability based on the initial prediction probability and a preset occurrence probability of a solder joint image in the training sample set having the respective one of the defect labels.

### Claim 9 (depends on 2)

The method of claim 2, wherein inputting the training sample set to a convolutional neural network to obtain target feature vectors respectively associated with the multiple solder joint images comprises:
obtaining a respective one of initial feature vectors corresponding to the respective one of the multiple solder joint images outputted from a respective convolutional layer of the convolutional neural network based on the training sample set; and
inputting at least an initial feature vector outputted from a last convolutional layer one-by-one through the feature-enhancement network to a first fully connected layer and a second fully connected layer to obtain the target feature vectors respectively associated with the multiple solder joint images, wherein the first fully connected layer uses at least two different activation functions to perform a convolution operation and the second fully connected layer uses one activation function to perform a convolution operation.

### Claim 10 (depends on 9)

The method of claim 9, wherein the first fully connected layer uses Sigmoid function and tanh function as activation functions, the second fully connected layer uses Sigmoid function or Relu function as activation function.

### Claim 11 (depends on 9)

The method of claim 9, further comprises inputting a respective one of initial feature vectors outputted from a respective one of different convolutional layers one-by-one to the first fully connected layer and the second fully connected layer to obtain the target feature vectors associated with the multiple solder joint images.

### Claim 12 (depends on 1)

A method of detecting solder joint defect comprising:
obtaining a solder joint image of an electronic device having a solder joint, the solder joint image including one solder joint located in a region of interest in a center thereof;
extracting a target feature vector associated with the solder joint using a convolutional neural network trained according to the method of claim 1,
determining initial prediction probabilities of the solder joint image corresponding to all defect labels based on the target feature vector;
determining that the solder joint of the electronic device has no defect only if none of initial prediction probabilities of the solder joint image corresponding to all defect labels is greater than a threshold value; and
determining that the solder joint of the electronic device has a defect if one of initial prediction probabilities of the solder joint image corresponding to all defect labels is greater than the threshold value.

### Claim 13 (depends on 12)

The method of claim 12, wherein obtaining a solder joint image of an electronic device having a solder joint comprises:
capturing an initial image of the electronic device based on radiography;
locating a solder joint region for a respective one of all solder joints in a region of interest of the initial image of the electronic device; and
determining an enclosing box of a respective one of all solder joints after binarization of the initial image in the solder joint region by threshold segmentation, wherein the enclosing box forms a solder joint image.

### Claim 14 (depends on 13)

The method of claim 13, further comprising using a Median filtering or Gaussian filtering to reduce noises in the initial image; using grayscale linear transformation and unsharp mask image to adjust a display contrast of the initial image.

### Claim 15 (depends on 1)

An inspection apparatus comprising:
an imaging system configured to capture an initial image of an electronic device having a feature element; and
a computer system comprising an interface device, a memory device, and a processor, the interface device being configured to electronically couple with the imaging system, the memory device being configured to store image data, control program, image process program, task programs, and network parameters based on which a convolution neural network is built and trained according to the method of claim 1, the processor being configured to execute the control program to send control instruction via the interface device to the imaging system and receive image data converted from the initial image captured by the imaging system, to execute the image process program to convert the initial image to a feature image using region-of-interest (ROI) location method and store the feature image having a feature element in a center position to the memory device, and to execute at least a first task program to extract a target feature vector corresponding to the feature image using the convolutional neural network, at least a second task program to determine an initial prediction probability of the feature image corresponding to a respective one of all defect labels based on the target feature vector, at least a third task program to determine that no defect exists in the feature element of the electronic device only if none of the initial prediction probability of the feature image corresponding to the respective one of all defect labels is greater than a predetermined threshold value, or otherwise, to determine that a defect exists in the feature element of the electronic device.

### Claim 16 (depends on 15)

The inspection apparatus of claim 15, wherein the imaging system comprises a radiography imager including a radiation source, a sample desk, and a detector device, wherein the radiation source comprises one selected from X-ray source, γ-ray source, e-beam source.

### Claim 17 (depends on 15)

The inspection apparatus of claim 15, wherein the feature image comprises an image within an enclosing box that substantially enclosing one feature element of the electronic device in a center of the enclosing box.

### Claim 18 (depends on 15)

The inspection apparatus of claim 15, wherein the electronic device comprises a BGA chip, the feature element comprises a solder joint.
