[go: up one dir, main page]

CN119831936A - Chip surface defect detection method and system based on improvement YOLOv8 - Google Patents

Chip surface defect detection method and system based on improvement YOLOv8 Download PDF

Info

Publication number
CN119831936A
CN119831936A CN202411824367.5A CN202411824367A CN119831936A CN 119831936 A CN119831936 A CN 119831936A CN 202411824367 A CN202411824367 A CN 202411824367A CN 119831936 A CN119831936 A CN 119831936A
Authority
CN
China
Prior art keywords
yolov8
improved
surface defect
chip surface
model
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
Application number
CN202411824367.5A
Other languages
Chinese (zh)
Inventor
唐武海
陈华
夏红杰
贾玉博
吴文豪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanhu Research Institute Of Electronic Technology Of China
Original Assignee
Nanhu Research Institute Of Electronic Technology Of China
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Nanhu Research Institute Of Electronic Technology Of China filed Critical Nanhu Research Institute Of Electronic Technology Of China
Priority to CN202411824367.5A priority Critical patent/CN119831936A/en
Publication of CN119831936A publication Critical patent/CN119831936A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

本发明提供一种基于改进YOLOv8的芯片表面缺陷检测方法及系统。其方法包括以下步骤:(1)构建芯片表面缺陷图片数据集;(2)将得到的数据集划分成训练集、验证集和测试集;(3)构建改进的YOLOv8网络模型;(4)将数据集输入到改进后的YOLOv8网络模型进行训练和预测,得到包含表面缺陷的芯片图像。本发明改进后的YOLOv8模型通过DCNv4可变卷积能够识别不同形状和尺寸的缺陷,增强了网络的特征提取能力;使用Dysample上采样算子减少了缺陷边缘和细节信息的丢失,保留了更多的特征信息;使用MPDIOU边界损失函数替换原损失函数,加快网络训练的收敛速度,提高模型对缺陷的定位能力。相较于原模型,本发明的检测效果得到了改善,能够更好地应用于芯片表面缺陷检测任务中。

The present invention provides a chip surface defect detection method and system based on improved YOLOv8. The method comprises the following steps: (1) constructing a chip surface defect image data set; (2) dividing the obtained data set into a training set, a verification set and a test set; (3) constructing an improved YOLOv8 network model; (4) inputting the data set into the improved YOLOv8 network model for training and prediction to obtain a chip image containing surface defects. The improved YOLOv8 model of the present invention can identify defects of different shapes and sizes through DCNv4 variable convolution, thereby enhancing the feature extraction capability of the network; using the Dysample upsampling operator to reduce the loss of defect edges and detail information, thereby retaining more feature information; using the MPDIOU boundary loss function to replace the original loss function, thereby accelerating the convergence speed of network training and improving the model's defect positioning capability. Compared with the original model, the detection effect of the present invention is improved, and can be better applied to chip surface defect detection tasks.

Description

Chip surface defect detection method and system based on improvement YOLOv8
Technical Field
The invention relates to the field of target detection, in particular to a chip defect detection method and system based on improvement YOLOv (automatic repeat request) 8.
Background
In the process of mass production of chips, because the chip manufacturing process is quite complex, each link may cause defects on the surface of the chip, such as edge breakage, scratches and other small defects, which often exceed the direct observation range of human eyes and are not easy to detect, so that the detection is very difficult, and the quality of the chip is seriously affected to a certain extent.
The traditional chip defect detection method utilizes manpower to carry out quality inspection, and the mode is time-consuming and labor-consuming, and has poor detection effect. With the increasing maturity of computer vision and neural network technology, defect detection systems have widely adopted target detection algorithms. Currently, the target detection algorithms based on deep learning can be divided into two types, two-stage algorithms and single-stage algorithms. Two-stage algorithms (e.g., R-CNN, fast R-CNN, and Fast R-CNN) first generate candidate regions, and then classify and regress the objects. The single-stage algorithm, represented by the SSD and YOLO series, uses only convolutional neural networks to extract features and immediately classify and locate objects. Compared with a two-stage algorithm, the single-stage algorithm has simpler structure, omits the step of generating candidate regions, directly predicts the position and the category of the target from the image, realizes faster detection speed while maintaining high precision, and is suitable for real-time detection application.
YOLOv8 as one of the most excellent single-stage target detection algorithms, is excellent in detection speed and accuracy, and can effectively identify various defects on the surface of the chip. However, there are some limitations in identifying complex fine features, such as poor effect of identifying the blocked defects and poor positioning capability of the target defects, so that the phenomena of missing detection and false detection are easy to occur, and the requirement of high-precision detection is difficult to meet.
Disclosure of Invention
The invention aims to provide the chip surface defect detection method and the chip surface defect detection system based on the improvement YOLOv, so that the detection accuracy and the detection speed are higher on industrial chip defect detection equipment, the chip surface defect detection method and the chip surface defect detection system can be more easily deployed in a defect diagnosis analysis system, and an inspector can rapidly identify a chip containing defects according to detection results.
The invention provides a chip surface defect detection method based on an improvement YOLOv, which comprises the following specific steps:
s1, constructing a chip surface defect picture data set;
s2, dividing the obtained data set into a training set, a verification set and a test set;
S3, improving based on YOLOv model, fusing DCN and C2f to form a new C2f-DCN variable feature fusion module, extracting features, introducing a dynamic upsampling operator Dysample, and constructing an improved chip surface defect detection model by adopting a MPDIOU boundary loss function, wherein the improved chip surface defect detection model is an improved YOLOv model;
S4, inputting the chip surface defect dataset into the improved YOLov model for training, and optimizing and improving the detection precision and generalization capability of the YOLov model by improving the capability of extracting the chip surface defect characteristics, reducing the loss of detail characteristic information in an up-sampling stage, enhancing the positioning of target defects;
S5, testing YOLOv and the improved YOLOv8 model by using a test set, comparing experimental results, and verifying the accuracy and efficiency of the test set and the improved YOLOv model in chip surface defect detection, wherein the accuracy and efficiency comprise defect positions, defect types and confidence.
In step S1, a chip surface defect picture dataset is constructed, comprising:
(1.1) obtaining a chip surface defect image, namely obtaining a chip image with defects in the process of producing the chip, and dividing the chip image into three types of pin missing, surface scratch and pin bending according to types;
(1.2) image data enhancement, which is to expand the original data set and enhance it by using the image enhancement method
A diversity;
and (1.3) marking the image, namely marking the defect area by using a LabelImg image marking tool, and marking the defect area by using a frame.
In step S3, an improved chip surface defect detection model is constructed, comprising:
(3.1) configuring an environment, namely establishing a virtual environment by using Anaconda, and debugging YOLov source codes of a model;
Inputting YOLOv a constructed chip surface defect data set into a network structure model of YOLOv, wherein the data input comprises the steps of obtaining chip surface defect images, chip surface defect image labels, YOLOv network structure configuration files and YOLOv model pre-training weights;
(3.3) configuring super parameters, namely setting the size, learning rate, batch processing number and iteration times of the network input image;
(3.4) adopting a YOLOv original model, and improving the YOLOv network structure model.
In step (3.4), the improvement of YOLOv network architecture model includes:
(3.4.1) fusing DCN and C2f to form a novel C2f-DCN variable characteristic fusion Module
Extracting row characteristics;
(3.4.2) modifying the original upsampling module to Dysample;
(3.4.3) replacing the original loss function with MPDIoU boundary loss functions.
In the step (3.4.1), the DCN and the C2f are fused to form a new C2f-DCN variable feature fusion module for feature extraction. DCNv4_net generates a mask (mask) by depth-wise calculation and calculates an offset (offset) using a point-wise operation. Finally, the network is able to output for each pixel its displacement in the horizontal and vertical directions as well as the shape variation parameters. The parameter weights can be adaptively adjusted to better match the feature locations in the input data, thereby significantly improving the detection performance of the model for irregular defects.
Further, the step of calculating the offset and the shape change parameter of the pixel point in the step (3.4.1) is as follows:
Two convolution kernels are arranged in a C2f module Bottleneck of (3.4.1.1) YOLOv8, the sizes of the two convolution kernels are 3*3, the size of a feature diagram output by the two convolution kernels is unchanged, 3*3 convolution kernels also exist in a DCNv4_Net structure, required offset and change parameters can be calculated under the condition that the size of the feature diagram is not changed, and two 3*3 convolutions in the C2f module are replaced by DCNv4_Net to obtain C2f-DCNv4;
(3.4.1.2) inputting features into C2f-DCNv4, wherein the features are firstly divided into two parts according to the number of channels by a layer 1*1 convolution kernel, a layer Split feature segmentation layer is used for splitting the features into two parts according to the number of channels, a part waits for feature splicing Concat, and the other part is input into a DCNv structure, wherein the features pass through two DCNv4 convolution layers, the DCNv4 convolution layer is a separable convolution formed by combining 3*3 convolution and a linear projection, the original convolution weight wk is separated into a depth part and a point-by-point part, the depth part is responsible for an original position sensing modulation scalar mk, the point-by-point part is a projection weight w shared between sampling points, and the features pass through the separable convolution to obtain an abscissa offset and an offset adjustment scale of the sampling points:
In the formula, G is the number of aggregation groups, wg epsilon RC×C ,C =C/G is the projection weight of different positions for the G group, K is the number of sampling points, m gk epsilon R is the modulation factor of the kth sampling point, and the model operation speed is accelerated by discarding softmax normalization operation by DCNv, unlike DCNv 3.
(3.4.1.3) Normalized BatchNorm d operation after feature output containing offset and scale of adjustment obtained by DCNv4 _net:
In the formula, x is input characteristic value, ex represents mean value, var x represents variance, two parameters can be directly calculated in forward propagation, gamma and beta are adjustment variance and adjustment mean value, initial value is 1 and 0 respectively, the two parameters are continuously learned and updated in backward propagation of model, epsilon is used for ensuring calculation stability, avoiding 0 occurrence of denominator, and defaulting to 1E-5.
(3.4.1.4) Using RELU function to activate the output result, and completely outputting the input value greater than 0 and the input value smaller than 0 to be 0.
In step (3.4.2), the original upsampling module is modified to Dysample, and the linear projection is used for upsampling Dysample to generate s 2 offset sets, new sampling points are constructed, and the input feature map is resampled by bilinear interpolation.
Further, the processing of the Dysample upsampling module in step (3.4.2) includes:
Firstly, given an up-sampling scale factor S and a feature map X with the size of C×H×W, carrying out bilinear interpolation on the input feature map X, generating an offset O with the size of 2S 2 ×H×W by using a linear layer with an input channel of C and an output channel of 2S 2, controlling the offset O by a dynamic range factor, then reshaping the size of the offset O into 2×sH×sW by pixel transformation, adding the offset O with an original sampling grid G to output a sampling set S, resampling the feature map X by the position of the sampling set S by a grid sampling function, and generating the up-sampling feature map X with the size of C×sH×sW.
In step (3.4.3), the original loss function is replaced with MPDIoU boundary loss functions. The MPDIoU loss function comprehensively considers the intersection ratio, the center point distance and the width-height deviation of the prediction frame and the real frame, takes the left lower corner and the right lower corner coordinates of the prediction frame as input, defines a rectangle in a specific mode, enables the distance between two points in the prediction frame and the real frame to be minimum, and can accelerate regression convergence of a network to the prediction frame, so that a more accurate prediction result is obtained. The calculation of MPDIoU loss functions is defined by the following formula:
Wherein B pre denotes the coordinates of the prediction bounding box, B gt denotes the coordinates of the actual labeling bounding box, x 1,y1 denotes the upper left-hand corner coordinates of the box, x 2,y2 denotes the lower right-hand corner coordinates of the box, For the distance between the top left corner and the bottom right corner between the prediction bounding box and the actual labeling bounding box, w, h is the width and height of the chip picture.
In another aspect, the present invention further provides a chip surface defect detection system based on the improvement YOLOv, which is characterized by comprising the following modules:
(1) The data set establishing module is used for establishing a chip surface defect picture data set;
(2) The data set dividing module is used for dividing the obtained data set into a training set, a verification set and a test set;
(3) The model building module is used for building an improved YOLOv network model;
(4) And the training and predicting module is used for inputting the data set into the improved YOLO network model to perform training and predicting to obtain a chip image containing the surface defects.
The invention also provides computer equipment, which comprises a camera, a memory and a processor, wherein the camera acquires chip images with surface defects, the internal memory provides an operating environment for an operating system and application programs, the external memory is used for storing the operating system and the computer programs, and the processor is used for running the computer programs in the steps S1-S5.
Compared with the prior art, the method has the remarkable advantages that the improved YOLOv model can identify defects of different shapes and sizes through DCNv variable convolution, the characteristic extraction capacity of a network is enhanced, the loss of defect edges and detail information is reduced by using a Dysample up-sampling operator, more characteristic information is reserved, the original loss function is replaced by using a MPDIOU boundary loss function, the convergence speed of network training is increased, and the positioning capacity of the model on the defects is improved. Compared with the original model, the method has the advantages that the detection effect is improved, and the method can be better applied to chip surface defect detection tasks.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions and advantages of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are only some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a method for detecting a chip surface defect based on a modification YOLOv according to an embodiment of the present invention;
FIG. 2 is a diagram of YOLOv network architecture used in an embodiment of the present invention;
FIG. 3 is a schematic diagram of a network structure of DCNv to 4 in an embodiment of the present invention;
FIG. 4 is a schematic diagram of a network structure of Dysample in an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
So that the manner in which the above recited objects, features and advantages of the present invention can be understood in detail, a more particular description of the invention, briefly summarized below, may be had by reference to the appended drawings. In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention. The invention may be embodied in many different forms and modifications may be made by one skilled in the art without departing from the spirit or essential characteristics thereof, and it is therefore not limited to the specific embodiments disclosed herein.
As shown in fig. 1, the chip surface defect detection method based on the improvement YOLOv according to the embodiment of the present invention includes:
step 1, constructing a chip surface defect picture data set, which comprises the following specific steps:
(1.1) acquiring a chip surface defect image. The chip surface defect image used in the invention is chip surface defect image data obtained by shooting in the chip production process of a certain chip enterprise. The dataset contains 9880 images in total, with a resolution of 1280 x 1080, in RGB format. These images contain three types of defects in total, pin missing, surface scratches, and pin bending.
(1.2) Image data enhancement to enhance the robustness of the model and to enhance the generalization ability of the model, image inversion, random scaling and Mosaic data enhancement techniques are applied to expand the original data set, enhancing its diversity. The data enhancement technology can help the model learn wider characteristic representation, reduce the over-fitting phenomenon, and improve the capability of the model for detecting the surface defects of the chip in different scenes, thereby improving the industrial production efficiency and quality.
And (1.3) marking the image, namely marking the image by using a LabelImg image marking tool, calibrating an actual defect area picture frame, and calibrating a defect area by using a plurality of anchor frames for the image containing a plurality of defects. The missing pin label is 0 (queshi), the surface scratched label is 1 (huaheng), and the bent pin label is 2 (wanqu). And after the labeling is completed, the generated json format data is stored, and the generated json format data is converted into txt format data which can be processed by the YOLO network.
And 2, dividing the data set, namely dividing the chip surface defect image data amplified by the sample and enhanced by the data and the corresponding label file into a training set, a testing set and a verification set according to the proportion of 8:1:1.
And 3, constructing a chip surface defect detection model based on the improved YOLOv model.
(3.1) Environment configuration, downloading the official source code of YOLOv model from Github of Ultralytics official, building virtual environment by using Anaconda, installing the following libraries according to the requirement file in YOLOv source code :matplotlib>=3.3.0、numpy>=1.22.2、opencv-python>=4.6.0、pillow>=7.1.2、pyyaml>=5.3.1、requests>=2.23.0、scipy>=1.4.1、tqdm>=4.64.0、torch>=1.8.0、torchvision>=0.9.0.
And (3.2) inputting data, namely inputting the divided chip surface defect training set and test set into YOLOv network models, wherein the data comprise chip surface defect images, corresponding labels, YOLOv network model pre-training weights and YOLOv network structure configuration files. The network structure of YOLOv is shown in fig. 2.
(3.3) Setting super parameters, namely setting a learning rate, the number of batch samples, the number of iterations, the number of image channels, the picture input size and an optimizer, wherein the initial learning rate is 0.01, the minimum learning rate is 0.001, the weight attenuation is 0.0005, the number of batch samples batchsize is 16, the number of iterations is 300, the number of image channels is 3, the picture input size is 640 x 640, and the optimizer is AdamW.
(3.4) Model improvement, wherein the original model adopted by the invention is YOLOv8, and the YOLOv network structure model is particularly improved in the following three ways.
(3.4.1) Feature extraction is performed by fusing DCN and C2f to form a new C2f-DCN variable feature fusion module:
(3.4.1.1) introducing DCNv4 variable convolution into Bottleneck in the C2f module to replace the original common convolution to form C2f-DCNv4;
(3.4.1.2) As shown in FIG. 3, a schematic representation of the structure of C2f-DCN formed by the fusion of DCNv and C2f is shown. Features in DCNv4 structures are first convolved through a layer 1*1, then Split feature segmentation layers divide the features into two parts according to channel numbers, one part is transferred into DCNv structures and then waits for feature stitching Concat, the other part is transferred into DCNv structures, in the structures, the features are convolved through a layer 3*3 and a DCNv4 convolution layer, the DCNv convolution layer is separable convolution formed by combining 3*3 convolutions and a linear projection, original convolution weights wk are separated into depth parts and point-by-point parts, the depth parts are responsible for original position perception modulation scalar mk, the point-by-point parts are projection weights w shared between sampling points, and feature pixels p 0 can be output through the separable convolution:
In the formula, G is the number of aggregation groups, for the G group, wg epsilon RC×C ,C =C/G is the projection weight of different positions, K is the sampling point number, mgk epsilon R is the modulation factor of the kth sampling point, and the method is different from DCNv3 in that DCNv4 cancels the last softmax normalization, reduces unnecessary calculation and accelerates the calculation speed of the model;
(3.4.1.3) normalized BatchNorm2d operation on the feature output from DCNv 4:
In the formula, x represents the characteristic value of the input, ex represents the mean value thereof, and Var x represents the variance. The two parameters can be directly calculated in the forward propagation process, gamma and beta are used for adjusting variance and mean, initial values of the gamma and beta are 1 and 0 respectively, the two parameters are continuously learned and updated in the training reverse propagation process, epsilon is used for guaranteeing the stability of calculation, the situation that 0 occurs in denominator is avoided, and the default is 1e-5.
(3.4.2) Modifying the original upsampling Module to Dysample
In order to improve the capturing capability of the chip surface defect detection model to target defect characteristics and details, as shown in fig. 4, the invention generates s 2 offset sets by using linear projection through efficient Dysample up-sampling, constructs new sampling points, and resamples an input characteristic diagram by using a bilinear interpolation method, thereby improving the capturing capability of the chip surface defect detection model to target defect characteristics and details, reducing reasoning cost and improving the reliability of the up-sampling process.
The processing procedure of the Dysample up-sampling module comprises:
In the grid sampling process, a feature map X of size c×h 1×W1 and a sample set S of size 2×h 2×W2 are first given, where the subscripts of H and W denote the coordinates of X and y. The grid sampling function resamples the hypothetical bilinear interpolation X to X and the size C X H 2×W2 using the position of the sample set S, where the sampling function is defined as follows:
X=grid_sample(X,S),
In specific implementation, the up-sampling scale factor S and the feature map X with the size of c×h×w are given first, the linear layer with the number of input and output channels of C and 2gs 2 is used to generate the offset O with the size of 2gs 2 ×h×w, the offset O is controlled by the dynamic range factor, then the size of the offset O is remodeled into 2×sh×sw by pixel transformation, the offset O is added with the original sampling grid G to output a sampling set S, and the position of the sampling set S is resampled on the feature map X by the network sampling function to generate the up-sampling feature map X with the size of c×sh×sw.
Dysample up-sampling generates a 'dynamic range factor' point by point through linear projection input features, and controls the dynamic scope within the size range of [0, 5] by introducing a sigmoid function and a static factor of 0.5, so that the flexibility of offset is further increased, and the offset is calculated by the following formula:
O=0.5sigmoid(linear1(X))*linear2(X)
In the present invention, instead of reconstructing the input features with upsampling kernels that generate content perception, dysample upsampling is performed in a manner that generates sample point locations, one point is acquired at each location and divided into s 2 sample points, so long as s 2 sample points can continue to be dynamically segmented, then only one point needs to be acquired for the entire upsampling process. In addition, the kernel weight of Dysample up-sampling is based on x and y as position conditions, only 2 channels of feature graphs are needed, and the sampling is more efficient.
(3.4.3) Substituting MPDIoU boundary loss functions for original loss functions
The MPDIoU loss function comprehensively considers the intersection ratio, the center point distance and the width-height deviation of the prediction frame and the real frame, takes the left lower corner and the right lower corner coordinates of the prediction frame as input, defines a rectangle in a specific mode, enables the distance between two points in the prediction frame and the real frame to be minimum, and can accelerate regression convergence of a network to the prediction frame, so that a more accurate prediction result is obtained. The calculation of MPDIoU loss functions is defined by the following formula:
Wherein B pre denotes the coordinates of the prediction bounding box, B gt denotes the coordinates of the actual labeling bounding box, x 1,y1 denotes the upper left-hand corner coordinates of the box, x 2,y2 denotes the lower right-hand corner coordinates of the box, For the distance between the top left corner and the bottom right corner between the prediction bounding box and the actual labeling bounding box, w, h is the width and height of the chip picture.
Step 4, training using the modified YOLOv model, comprising:
(5.1) the hardware environment used by the invention is configured to be CPU, intel Core i9-12900K, CPU main frequency 3.2GHz, memory 64G,GPU:NVIDIA GeForce RTX 3080, video memory GDDR6X24G and software environment is configured to be deep learning Pytorch 1.12.1,Python 3.8,Cuda 11.3. The super parameters are set to be that the initial learning rate is 0.01, the minimum learning rate is set to be 0.001, the weight attenuation is 0.0005, the number of batch samples batchsize is 16, the iteration number is 300, the number of image channels is 3, the image input size is 640 x 640, and the optimizer is AdamW.
(5.2) In the model training process, to increase the network training speed, YOLOv pre-training weights are used for training, and the authorities provide several pre-training weights, and different versions can be selected for training according to different requirements. In the present invention, the pre-training weight selected is yolov8s.pt. The model is then validated for a validation set every 50 iterations. And secondly, the learning rate is adjusted, and the learning rate is dynamically adjusted according to the verification result so as to prevent over fitting and under fitting. The learning rate is gradually reduced using a learning rate decay strategy (LEARNING RATE DECAY). And finally, training until the preset iteration times are reached or the performance of the verification set is not improved, and completing the training of the network model.
And 5, testing and evaluating the improved YOLOv model.
Model test and evaluation, namely loading a weight file generated after model training into a test file to perform model test, obtaining a test result of the improved chip surface defect detection model on a test set, wherein the test result comprises defect positions, defect types and confidence coefficient, and comparing the test result with a YOLOv model.
The improved chip surface defect detection model is improved based on YOLOv model, a novel C2f-DCN variable feature fusion module is formed by fusion of DCN and C2f to conduct feature extraction, an original up-sampling module is modified to Dysample, and a MPDIOU boundary loss function is used for replacing an original loss function to construct the improved chip surface defect detection model.
The improved algorithm not only has better performance on the whole detection precision, but also obviously improves the identification capability of fine defects in a complex background, strengthens the detection capability of irregular target defects by introducing a DCN operator, and strengthens the positioning of target defects by using MPDIoU.
The embodiment of the invention also provides a chip surface defect detection system based on the improvement YOLOv, which comprises the following modules:
(1) The data set establishing module is used for establishing a chip surface defect picture data set;
(2) The data set dividing module is used for dividing the obtained data set into a training set, a verification set and a test set;
(3) The model building module is used for building an improved YOLOv network model;
(4) And the training and predicting module is used for inputting the dataset into the improved YOLOv network model for training and predicting to obtain a chip image containing the surface defects.
In this embodiment, a computer device is provided, which may be a terminal, and the internal structure of which may be as shown in fig. 5. The computer device includes a processor, an internal memory, an external memory, and a camera connected by a system bus. The processor is used for providing computing and control capability, the internal memory provides an operating environment for an operating system and application programs, and the external memory is a nonvolatile storage medium for storing the operating system and the computer programs. The camera of the computer device is responsible for collecting chip images with surface defects and displaying the processed results on a display screen. The communication interface of the computer equipment and the external terminal can realize communication through a WIFI technology, and the display screen can be a liquid crystal display screen.
It should be noted that the architecture depicted in fig. 5 is merely representative of some examples of hardware architectures associated with the subject matter of this patent application, and is not intended to limit the particular type or configuration of computer device to which the invention may be applied. In fact, in the practical application process, according to different requirements, the above components can be increased or decreased, or the components can be combined in different ways, or even different layout designs can be adopted. It will thus be appreciated that many variations are possible to those skilled in the art and are not limited to the specific examples described herein.
Description of related words:
The foregoing description has only expressed preferred embodiments of the invention and is not intended to limit the invention in any way. Modifications and variations of the disclosed embodiments are possible in light of the above teachings, as would be recognized by those of skill in the art. However, any simple modification, equivalent variation and adaptation of the above embodiments according to the technical substance of the present invention, which are intended to deviate from the technical substance of the present invention, still fall within the scope of the technical solution of the present invention.

Claims (10)

1.一种基于改进YOLOv8的芯片表面缺陷检测方法,其特征在于,该方法包括:1. A chip surface defect detection method based on improved YOLOv8, characterized in that the method comprises: S1,构建芯片表面缺陷图片数据集;S1, build a chip surface defect image dataset; S2,将得到的数据集划分成训练集、验证集和测试集;S2, divide the obtained data set into training set, validation set and test set; S3,基于YOLOv8网络模型进行改进,将DCNv4和C2f融合形成新的C2f-DCN可变融合模块进行特征提取、引入动态上采样算子Dysample,且使用MPDIoU边界损失函数,构建改进的芯片表面缺陷检测模型,所述改进的芯片表面缺陷检测模型为改进的YOLOv8模型;S3, based on the YOLOv8 network model, DCNv4 and C2f are fused to form a new C2f-DCN variable fusion module for feature extraction, a dynamic upsampling operator Dysample is introduced, and the MPDIoU boundary loss function is used to build an improved chip surface defect detection model, where the improved chip surface defect detection model is an improved YOLOv8 model; S4,将芯片表面缺陷数据集输入改进后的YOLov8模型中进行训练;S4, input the chip surface defect dataset into the improved YOLov8 model for training; S5,使用测试集对YOLOv8和改进后的YOLOv8模型进行测试。S5, use the test set to test the YOLOv8 and improved YOLOv8 models. 2.根据权利要求1所述的基于改进YOLOv8的芯片表面缺陷检测方法,其特征在于,所述步骤S1中具体包括步骤:2. The chip surface defect detection method based on improved YOLOv8 according to claim 1, characterized in that the step S1 specifically includes the steps of: (1.1)获取芯片表面缺陷图像:在生产芯片过程中获取带有缺陷的芯片图像,按照芯片缺陷的种类进行划分;(1.1) Obtaining chip surface defect images: Obtaining chip images with defects during chip production and classifying them according to the types of chip defects; (1.2)图像数据增强:采用数据图像增强的方法扩展原始数据集,增强其多样性;(1.2) Image data enhancement: Use data image enhancement methods to expand the original dataset and enhance its diversity; (1.3)图像标注:利用LabelImg图像标注工具进行标注,将缺陷区域进行画框标定。(1.3) Image annotation: Use the LabelImg image annotation tool to mark the defect area with a frame. 3.根据要求1所述的基于改进YOLOv8的芯片表面缺陷检测方法,其特征在于,所述步骤S2中按照一定的比例将芯片表面缺陷数据集划分为训练集、验证集和测试集。3. The chip surface defect detection method based on improved YOLOv8 according to claim 1 is characterized in that in step S2, the chip surface defect data set is divided into a training set, a verification set and a test set according to a certain ratio. 4.根据权利要求1所述的基于改进YOLOv8的芯片表面缺陷检测方法,其特征在于,在步骤S3中,构建改进的芯片表面缺陷检测模型,包括:4. The chip surface defect detection method based on improved YOLOv8 according to claim 1 is characterized in that, in step S3, an improved chip surface defect detection model is constructed, comprising: (3.1)配置环境:使用Anaconda建立虚拟环境,调试YOLOv8模型的源码;(3.1) Configure the environment: Use Anaconda to create a virtual environment and debug the source code of the YOLOv8 model; (3.2)输入数据:将构建好的芯片表面缺陷数据集输入YOLOv8网络结构模型中,包括获取芯片表面缺陷图像、表面缺陷图像标签、YOLOv8网络结构配置文件、YOLOv8模型预训练权重;(3.2) Input data: Input the constructed chip surface defect dataset into the YOLOv8 network structure model, including obtaining chip surface defect images, surface defect image labels, YOLOv8 network structure configuration files, and YOLOv8 model pre-training weights; (3.3)配置超参数:设定网络输入图像的尺寸、学习率、批处理数量、迭代次数;(3.3) Configure hyperparameters: set the size of the network input image, learning rate, batch size, and number of iterations; (3.4)采用的原始模型为YOLOv8,对YOLOv8网络结构模型进行改进。(3.4) The original model used is YOLOv8, and the YOLOv8 network structure model is improved. 5.根据权利要求4所述的基于改进YOLOv8的芯片表面缺陷检测方法,其特征在于,在步骤(3.4)中,对YOLOv8网络结构模型进行改进,包括:5. The chip surface defect detection method based on improved YOLOv8 according to claim 4, characterized in that, in step (3.4), the YOLOv8 network structure model is improved, including: (3.4.1)将DCN和C2f融合形成新的C2f-DCN可变特征融合模块进行特征提取;(3.4.1) Fusing DCN and C2f to form a new C2f-DCN variable feature fusion module for feature extraction; DCNv4_Net采用了一种与可分离卷积相似的方法,通过depth-wise计算来生成掩码(mask),并利用point-wise操作计算偏移量(offset)。最终,该网络能够针对每个像素输出其水平和垂直方向上的位移以及形状变化参数。DCNv4_Net uses a method similar to separable convolution to generate a mask through depth-wise calculation and calculate the offset using point-wise operation. Finally, the network can output the horizontal and vertical displacement and shape change parameters for each pixel. (3.4.2)将原有的上采样模块修改为Dysample,减少在上采样阶段细节特征信息的丢失;(3.4.2) Modify the original upsampling module to Dysample to reduce the loss of detail feature information in the upsampling stage; Dysample上采样使用线性投影生成了s2个偏移集,构建新的采样点,并利用双线性插值法对输入特征图进行重新采样;Dysample upsampling uses linear projection to generate s2 offset sets, constructs new sampling points, and resamples the input feature map using bilinear interpolation; (3.4.3)采用MPDIoU边界损失函数替换原损失函数,加强目标缺陷的定位。(3.4.3) The MPDIoU boundary loss function is used to replace the original loss function to enhance the localization of target defects. 6.根据权利要求5所述的基于改进YOLOv8的芯片表面缺陷检测方法,其特征在于,步骤(3.4.1)中所述的计算像素点的偏移量和形状变化参数步骤为:6. The chip surface defect detection method based on improved YOLOv8 according to claim 5, characterized in that the step of calculating the offset and shape change parameters of the pixel points described in step (3.4.1) is: (3.4.1.1)YOLOv8的C2f模块Bottleneck中有两个卷积核,这两个卷积核大小都是3*3的,经过两个卷积核输出的特征图尺寸大小不变,DCNv4_Net结构中同样存在3*3卷积核可以在不改变特征图尺寸的大小下计算出所需要的偏移量和变化参数,将C2f模块中的两个3*3卷积替换为DCNv4_Net,得到C2f-DCNv4;(3.4.1.1) There are two convolution kernels in the C2f module Bottleneck of YOLOv8. The size of these two convolution kernels is 3*3. The size of the feature map output by the two convolution kernels remains unchanged. There is also a 3*3 convolution kernel in the DCNv4_Net structure, which can calculate the required offset and change parameters without changing the size of the feature map. Replace the two 3*3 convolutions in the C2f module with DCNv4_Net to obtain C2f-DCNv4; (3.4.1.2)输入特征传入到C2f-DCNv4中,特征首先通过一层1*1卷积核,一层Split特征分割层将特征按照通道数一分为二,一部分等待特征拼接Concat,另外一部分传入DCNv4结构,在该结构中特征经过两个DCNv4卷积层,DCNv4卷积层是一个3*3卷积和一个线性投影组合成的可分离卷积,将原始卷积权重wk分离为深度部分和逐点部分,其中深度部分由原始位置感知调制标量mk负责,逐点部分是采样点之间共享的投影权重w,特征像素p0经过这个可分离卷积得到输出如下:(3.4.1.2) Input features are passed into C2f-DCNv4. The features first pass through a layer of 1*1 convolution kernel. A Split feature segmentation layer divides the features into two according to the number of channels. One part waits for feature concatenation Concat, and the other part is passed to the DCNv4 structure. In this structure, the features pass through two DCNv4 convolution layers. The DCNv4 convolution layer is a separable convolution composed of a 3*3 convolution and a linear projection. The original convolution weight wk is separated into a depth part and a point-by-point part. The depth part is responsible for the original position-aware modulation scalar mk, and the point-by-point part is the projection weight w shared between sampling points. The feature pixel p0 is output after this separable convolution as follows: 式中,G为聚合组数量;对于第g组,wg∈RC×C,C=C/G为不同位置投影权值:K为采样点数;mgk∈R为第k个采样点的调制因子,并且与DCNv3不同的是,DCNv4取消了最后的softmax归一化,减少了不必要的计算加快了模型的计算速度;Where G is the number of aggregation groups; for the g-th group, wg∈RC×C , C =C/G is the projection weight at different positions: K is the number of sampling points; mgk∈R is the modulation factor of the k-th sampling point, and unlike DCNv3, DCNv4 cancels the final softmax normalization, reducing unnecessary calculations and speeding up the calculation of the model; (3.4.1.3)对由DCNv4_Net得到的特征输出后进行标准化BatchNorm2d操作:(3.4.1.3) Perform a BatchNorm2d operation on the feature output obtained by DCNv4_Net: 式中:x为输入特征值,E[x]表示均值,Var[x]表示方差,这两个参数在正向传播中可以直接计算得到,γ和β是调整方差和调整均值,初始值分别为1和0,这两个参数是模型在反向传播中不断学习更新的,ε是为了保证计算的稳定性,避免分母出现0的情况,默认为1e-5。Where: x is the input eigenvalue, E[x] represents the mean, Var[x] represents the variance. These two parameters can be directly calculated in forward propagation. γ and β are the adjusted variance and adjusted mean, with initial values of 1 and 0 respectively. These two parameters are continuously learned and updated by the model in back propagation. ε is to ensure the stability of the calculation and avoid the denominator being 0. The default value is 1e-5. (3.4.1.4)使用RELU函数对输出结果进行激化操作,将大于0的输入值完整输出,小于0的输入值赋值为0。(3.4.1.4) Use the RELU function to perform an activation operation on the output result, outputting all input values greater than 0 and setting the input values less than 0 to 0. 7.根据权利要求5所述的基于改进YOLOv8的芯片表面缺陷检测方法,其特征在于,步骤(3.4.2)中引入Dysample进行上采样,包括:首先给定上采样比例因子s和大小为C×H×W的特征映射X,对输入特征映射X进行双线性插值,利用输入通道为C和输出通道为2s2的线性层生成大小为2s2×H×W的偏移量O,通过动态范围因子控制偏移量O,然后通过像素变换将偏移量O大小重塑为2×sH×sW,将偏移量O与原始采样网格G相加输出得到采样集S,通过网格采样函数将采样集S的位置对特征映射X重新采样,生成大小为C×sH×sW的上采样特征图X。7. According to the chip surface defect detection method based on improved YOLOv8 in claim 5, it is characterized in that Dysample is introduced in step (3.4.2) for upsampling, comprising: firstly giving an upsampling scale factor s and a feature map X of size C×H×W, performing bilinear interpolation on the input feature map X, using a linear layer with an input channel of C and an output channel of 2s 2 to generate an offset O of size 2s 2 ×H×W, controlling the offset O by a dynamic range factor, and then reshaping the offset O to 2×sH×sW by pixel transformation, adding the offset O to the original sampling grid G to output a sampling set S, resampling the feature map X by the position of the sampling set S through a grid sampling function, and generating an upsampled feature map X of size C×sH×sW. 8.根据权利要求5所述的基于改进YOLOv8的芯片表面缺陷检测方法,其特征在于,步骤(3.4.3)中采用MPDIoU边界损失函数替换原损失函数,其定义为:8. The chip surface defect detection method based on improved YOLOv8 according to claim 5, characterized in that the MPDIoU boundary loss function is used to replace the original loss function in step (3.4.3), which is defined as: 其中:Bpre表示预测边界框的坐标,Bgt表示实际标注边界框的坐标,x1,y1表示框的左上角坐标,x2,y2表示框的右下角坐标,为预测边界框与实际标注边界框之间的左上角和右下角的距离,w,h为芯片图片的宽度和高度。Where: Bpre represents the coordinates of the predicted bounding box, Bgt represents the coordinates of the actual labeled bounding box, x1 , y1 represents the coordinates of the upper left corner of the box, x2 , y2 represents the coordinates of the lower right corner of the box, is the distance between the upper left corner and the lower right corner of the predicted bounding box and the actual labeled bounding box, and w and h are the width and height of the chip image. 9.一种基于改进YOLOv8的芯片表面缺陷检测系统,其特征在于,包括以下模块:9. A chip surface defect detection system based on improved YOLOv8, characterized by comprising the following modules: (1)数据集建立模块:用于构建芯片表面缺陷图片数据集;(1) Dataset building module: used to build a chip surface defect image dataset; (2)数据集划分模块:用于将得到的数据集划分为训练集、验证集和测试集;(2) Dataset partitioning module: used to partition the obtained dataset into training set, validation set and test set; (3)模型构建模块:用于构建改进的YOLOv8网络模型;(3) Model building module: used to build an improved YOLOv8 network model; (4)训练和预测模块:用于将数据集输入到改进后的YOLOv8网络模型进行训练和预测,得到包含表面缺陷的芯片图像。(4) Training and prediction module: used to input the data set into the improved YOLOv8 network model for training and prediction to obtain chip images containing surface defects. 10.一种计算机设备,包括摄像头、内存储器、外存储器和处理器,所述摄像头负责采集图像,获取带有表面缺陷的芯片图像;所述内部存储器为操作系统及应用程序提供了运行环境;所述外部存储器则是一种非易失性存储介质,其特征在于,用于保存操作系统和计算机程序,所述处理器执行所述计算机程序时实现权利要求1到8中任一项所述的方法。10. A computer device, comprising a camera, an internal memory, an external memory and a processor, wherein the camera is responsible for collecting images and obtaining images of chips with surface defects; the internal memory provides an operating environment for an operating system and application programs; the external memory is a non-volatile storage medium, characterized in that it is used to store an operating system and a computer program, and the processor implements any one of the methods of claims 1 to 8 when executing the computer program.
CN202411824367.5A 2024-12-11 2024-12-11 Chip surface defect detection method and system based on improvement YOLOv8 Pending CN119831936A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411824367.5A CN119831936A (en) 2024-12-11 2024-12-11 Chip surface defect detection method and system based on improvement YOLOv8

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411824367.5A CN119831936A (en) 2024-12-11 2024-12-11 Chip surface defect detection method and system based on improvement YOLOv8

Publications (1)

Publication Number Publication Date
CN119831936A true CN119831936A (en) 2025-04-15

Family

ID=95302775

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411824367.5A Pending CN119831936A (en) 2024-12-11 2024-12-11 Chip surface defect detection method and system based on improvement YOLOv8

Country Status (1)

Country Link
CN (1) CN119831936A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120107252A (en) * 2025-05-07 2025-06-06 深圳联宇华电子有限公司 Chip placement detection method and system based on machine vision
CN120495286A (en) * 2025-07-15 2025-08-15 南京师范大学 A PCB image defect assessment method based on multi-scale feature fusion

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120107252A (en) * 2025-05-07 2025-06-06 深圳联宇华电子有限公司 Chip placement detection method and system based on machine vision
CN120107252B (en) * 2025-05-07 2025-09-05 深圳联宇华电子有限公司 Chip placement detection method and system based on machine vision
CN120495286A (en) * 2025-07-15 2025-08-15 南京师范大学 A PCB image defect assessment method based on multi-scale feature fusion
CN120495286B (en) * 2025-07-15 2025-09-19 南京师范大学 A PCB image defect assessment method based on multi-scale feature fusion

Similar Documents

Publication Publication Date Title
CN112734641B (en) Training method and device for target detection model, computer equipment and medium
CN119831936A (en) Chip surface defect detection method and system based on improvement YOLOv8
EP3745339A1 (en) Method for implanting advertisements in video, and computer device
CN113192040A (en) Fabric flaw detection method based on YOLO v4 improved algorithm
CN116420159A (en) Defect detection method, device and system
CN110659692A (en) Pathological image automatic labeling method based on reinforcement learning and deep neural network
CN111680695A (en) A Semantic Segmentation Method Based on Reverse Attention Model
WO2017215622A1 (en) Object segmentation method and apparatus and computing device
CN113378812A (en) Digital dial plate identification method based on Mask R-CNN and CRNN
CN111461113B (en) A large-angle license plate detection method based on deformed planar object detection network
CN117877034B (en) Remote sensing image instance segmentation method and model based on dynamic convolution enhancement
CN116645592B (en) A crack detection method and storage medium based on image processing
CN110913205A (en) Video special effect verification method and device
US20250037255A1 (en) Method for training defective-spot detection model, method for detecting defective-spot, and method for restoring defective-spot
Shaziya et al. Pulmonary CT images segmentation using CNN and UNet models of deep learning
CN118570207B (en) Liquid crystal display defect detection method, system, equipment and medium
CN114331985A (en) Electronic component scratch defect detection method and device and computer equipment
CN114581723A (en) Defect classification method, apparatus, storage medium, apparatus and computer program product
CN116843690B (en) Image quality evaluation method, device and system
CN117781661B (en) A silicon wafer drying improvement method and device based on D-LKA network model
CN112989768A (en) Method and device for correcting connection questions, electronic equipment and storage medium
CN112966757A (en) Method and device for expanding training sample, storage medium and equipment
CN111507135A (en) Face detection method and device, computer equipment and storage medium
CN114723649B (en) Panel defect detection method, storage medium and terminal device
CN119379631A (en) Improved chip small target defect detection method and system based on YOLOv5 and Swin Transformer fusion

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