Mobile phone screen glass defect detection method based on improved YOLOv8
By improving the YOLOv8 model and semantic segmentation technology, the problems of low recognition rate and inaccurate area measurement in mobile phone screen glass defect detection have been solved, achieving efficient and accurate defect detection and measurement.
Patent Information
- Application Number
- CN202411451240.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-01-07
AI Technical Summary
Existing technologies have low defect detection and recognition rates for mobile phone screen glass, cannot accurately identify the area of various defects, and traditional methods are inefficient and cannot meet the needs of large-scale production.
By employing an improved YOLOv8 model, and adding an attention module and dynamic serpentine convolution to the detection network, combined with semantic segmentation technology, we can achieve accurate localization and area measurement of defects in mobile phone screen glass.
It improves the accuracy and efficiency of defect identification, can accurately locate different types of defects, and accurately measure their actual area. It can adapt to complex backgrounds and noise interference, thus improving the reliability and efficiency of detection.
Smart Images

Figure CN119273992A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of mobile phone screen glass cover quality detection, and in particular to a mobile phone screen glass defect detection method based on improved YOLOv8. Background Art
[0002] Mobile phone screen glass is a key component of modern mobile phone electronic products, and is also an important commodity part and strategic industrial material. The supply stability and quality safety of mobile phone screen glass have an important impact on the performance and market stability of mobile phone electronic products. In order to ensure product quality, it is necessary to pay attention to each link of the mobile phone screen glass production chain. Glass defects are one of the important indicators of quality inspection in the production process of mobile phone screens. Therefore, the inspection of the appearance quality of mobile phone screen glass is of great research significance.
[0003] According to relevant industry standards, glass defects refer to damage to the glass, including scratches, bubbles, cracks, impurities and edge damage. Traditional quality inspection methods, such as manual visual inspection, manual picking and physical inspection, are time-consuming, costly and highly subjective, and cannot meet the needs of fast and accurate inspection of screen glass in large-scale production.
[0004] In recent years, artificial intelligence technology has had a huge impact in the manufacturing industry, and machine learning-based methods have gradually been applied to the field of glass quality inspection. At present, through the analysis and processing of mobile phone screen glass images, effective feature parameters (such as bubbles, scratches, and edge damage, etc.) are extracted, and detection is achieved through model training. This method overcomes the shortcomings of manual detection and has the advantages of fast detection speed and non-destructive testing. However, machine learning-based detection methods usually require manual feature extraction and combination testing to select the optimal feature combination. The process is cumbersome and the model robustness is low.
[0005] Deep learning methods can automatically extract target features through convolutional neural networks. Researchers have applied deep learning methods to the field of electronic manufacturing and have achieved many research results. In recent years, deep learning-based detection methods have made good progress in the field of screen glass appearance inspection, among which convolutional neural network (CNN) is a commonly used model. By training a large number of mobile phone screen defect image data sets, these models can identify different defects. However, existing research has failed to achieve good recognition results, has not focused on the specific semantic segmentation of defective images, and has ignored the specific requirements of actual inspection reports for defective areas.
[0006] In order to solve the above problems, the present invention proposes a method for detecting mobile phone screen glass defects and measuring the actual defect area based on improved YOLOv8. Summary of the invention
[0007] The purpose of the present invention is to provide a mobile phone screen glass defect detection and defect area measurement method based on improved YOLOv8 to solve the problems of low recognition rate of mobile phone screen glass defect detection in the prior art and inability to simultaneously detect various defect areas, etc. The present invention improves the accuracy of defect recognition by optimizing the detection network model, and obtains a defect area measurement formula by fitting pixel values and actual areas through segmentation results, thereby providing an integrated service for quality inspection tasks in the mobile phone screen glass production chain.
[0008] To achieve the above object, the present invention adopts the following technical solutions:
[0009] The mobile phone screen glass defect detection method based on improved YOLOv8 includes the following steps:
[0010] S1. Build a data set: collect mobile phone screen glass images taken in a simulated industrial production environment to build a data set;
[0011] S2. Improve and optimize the YOLOv8 target detection network model: Based on the YOLOv8 network model, add an attention module, use DySnakeConv convolution to replace the original convolution of the YOLOv8 network, and improve the C2f module to obtain the improved YOLOv8 model;
[0012] S3. Training an improved YOLOv8 model: Based on the mobile phone screen glass image dataset constructed in S1, the improved YOLOv8 model is trained and verified, and the learning parameters of the improved YOLOv8 model are adjusted;
[0013] S4, semantic segmentation of mobile phone screen glass defect categories: segment the mobile phone screen glass defect image to be identified based on the improved YOLOv8 model trained in S3, and obtain the classification result of the mobile phone screen glass defect to be identified;
[0014] S5. Measurement of actual damage range of different defects in mobile phone screen glass: Based on the detection results of mobile phone screen glass defects, the counting results and pixel values of each category of mobile phone screen glass defects are obtained, and the relationship between the pixel area occupied by different categories of mobile phone screen glass defects in the picture and the area in the actual three-dimensional space is established. The focal length, shooting distance and other parameters of the camera used for collecting the data set are determined, and a mathematical mapping relationship model is established to achieve measurement of the damage range of various categories of mobile phone screen glass defects.
[0015] Preferably, the S1 specifically includes the following contents:
[0016] S101. Build a data image acquisition platform: set up a shooting darkroom, place an industrial camera on the top of the darkroom, place a mobile phone screen glass sample on a transparent support table, illuminate the left and right sides with a strip light source, and collect several mobile phone screen glass images as original image data;
[0017] S102, data preprocessing: performing data cleaning, data conversion and data enhancement on the original image data to obtain a mobile phone screen glass defect data set;
[0018] S103, training image annotation: use Labelimg software to mark different defects of mobile phone screen glass in the mobile phone screen glass defect dataset, and the defects include four categories: scratches, bubbles, chipped edges, and pits.
[0019] Preferably, S2 specifically includes the following contents:
[0020] Based on the YOLOv8 model, an MCA attention module is added to the top layer of its Head detection head. The MCA attention module uses a three-branch architecture to simultaneously infer the channel, height, and width dimensions;
[0021] DySnakeConv (DSConv) is integrated into Bottleneck to form Bottleneck_DySnakeConv, and then used as the convolution unit of C2f to form C2f_DySnakeConv (C2f_DSConv); the C2f convolution is the main convolution module of the YOLOv8 model, and the C2f of the Backbone network layer is replaced by C2f_DySna keConv. The optimized C2F_DySnakeConv module integrates dynamic snake convolution, so that it has the ability to emphasize the recognition of small and linear defects.
[0022] Preferably, S3 specifically includes the following contents:
[0023] S301, dividing the mobile phone screen glass data set into a training set and a validation set according to a ratio of 9:1;
[0024] S302, use the weights of the pre-trained model as the initial weights, and train the number of images in each batch as 16; input image size imgsz:640; freeze the backbone network of the first 50 epochs, and perform fine-tuning, setting the learning rate to 1e-4 and the decay rate to 0.96; after unfreezing, set the learning rate to 1e-5 and the decay rate to 0.96; use the training set for training;
[0025] S303. Verify the mobile phone screen glass defect detection model based on the improved YOLOv8 through the verification set and obtain the best training file.
[0026] Preferably, the S4 includes the following contents:
[0027] S401, image acquisition: acquiring the glass image of the mobile phone screen to be identified;
[0028] S402, image annotation: Labelme annotation software is used to annotate the contours of the mobile phone screen glass defects, and the annotated Json format file is converted into a txt format file to form a segmentation training data set;
[0029] S403, image semantic segmentation: Use the improved YOLOv8-segment model to train the segmentation training data set, and then obtain the best semantic segmentation training file through verification; use the best semantic segmentation training file to perform defect detection on the mobile phone screen glass, and the results include the pixel value of the defect, the location, category, and confidence of the target box.
[0030] Preferably, the improved YOLOv8-segment model in S403 detects the image, specifically including the following contents:
[0031] S4031. Introduce feature extractor: Use depthwise separable convolution to replace the traditional convolution operation, split the convolution operation into depthwise convolution and point-by-point convolution, reduce the amount of calculation while maintaining the feature extraction capability, so as to improve the computational efficiency of the model;
[0032] S4032. Replace the backbone network; combine with the latest backbone network, such as EfficientNet, and use the advantages of the backbone network in feature extraction to enhance the feature expression capability of YOLOv8.
[0033] Preferably, the S5 specifically includes the following contents:
[0034] S501, determining the number, pixel value and target frame area of each category of defects based on the detection results of different defects of the mobile phone screen glass;
[0035] S502, determining the focal length and shooting distance parameters of the camera used to collect the data set;
[0036] S503: Determine the relationship between the pixel area occupied by different types of mobile phone screen glass defects in the image and the area in the actual three-dimensional space:
[0037] The range of irregular segmentation is calculated by selecting the range of the segmented target box. The relationship between the rectangular target detection box and the area of the actual three-dimensional space is as follows:
[0038] W1 i =(d*p j) / fi=1,2,...,6;j=1,2,3,...
[0039]
[0040] Among them, i represents different categories; d represents the distance between the camera and the screen glass of the mobile phone to be tested; p represents the width and length pixel value of the target frame of the mobile phone screen glass defect; f represents the focal length of the camera;
[0041] The relationship formula for determining the actual three-dimensional space area of the irregular defect pattern is as follows:
[0042]
[0043] Among them, S1 represents the actual area of the segmentation defect rectangular target box; p1 represents the total pixels of the irregular segmentation defect; p2 represents the total pixel value of the segmentation defect rectangular target box;
[0044] S504, evaluate the fitting effect:
[0045] The evaluation is performed by comparing the results of the defect range inspection model with the actual measured data. The evaluation methods include root mean square error, mean absolute error, determination coefficient and residual analysis method.
[0046] The mobile phone screen glass defect detection system based on improved YOLOv8 applied in the above method includes:
[0047] The mobile phone screen glass defect image acquisition platform includes a shooting darkroom and a transparent load-bearing platform. The industrial camera is placed on the top of the darkroom, the transparent load-bearing platform is set inside the darkroom, and strip light sources are installed on the left and right sides of the transparent load-bearing platform.
[0048] Image processing module, used for image cleaning, data enhancement and data expansion;
[0049] Mobile phone glass defect detection module, which uses an optimized YOLOv8 model by optimizing convolution and adding an attention mechanism to identify and detect mobile phone screen glass defects;
[0050] The mobile phone screen glass defect category semantic segmentation module uses an improved YOLOv8-segment network model to perform semantic segmentation on defects to obtain a more accurate defect recognition range;
[0051] The actual damage range measurement module of mobile phone screen glass can accurately measure the damage area of defects in actual space based on defect segmentation.
[0052] A computer device is further proposed, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set or instruction set, and the instruction, program, code set or instruction set is loaded and executed by the processor to implement the above-mentioned mobile phone screen glass defect detection method based on improved YOLOv8.
[0053] A computer-readable storage medium is further proposed, in which at least one instruction, at least one program, code set or instruction set is stored, and the instruction, program, code set or instruction set is loaded and executed by a processor to implement the above-mentioned mobile phone screen glass defect detection method based on improved YOLOv8.
[0054] Compared with the prior art, the present invention has the following beneficial effects:
[0055] (1) The present invention proposes a mobile phone screen glass defect detection method based on YOLOv8, which selects YOLOv8 as the framework basis. By using a three-branch architecture to simultaneously infer the channel, height and width dimensions, there is almost no additional computing performance overhead, which effectively improves the model's ability to capture multi-dimensional features. In addition, the present invention integrates DySnakeConv into the Bottleneck structure to form Bottleneck_DySnakeConv, and further forms C2F_DySnakeConv in the C2f convolution unit. As the core convolution module of the YOLOv8 model, after the C2f of the Backbone network layer is replaced with C2F_DySnakeConv, the optimized convolution unit incorporates dynamic snake convolution, and the recognition ability of small and linear defects is significantly enhanced; the above improvements not only improve the detection accuracy while maintaining efficient computing performance, but also have stronger adaptability and generalization ability for small targets and complex shape defects, further improving the performance of the model in the actual application of mobile phone screen glass quality inspection.
[0056] (2) The optimized semantic segmentation model in the present invention has significant advantages in mobile phone screen glass defect detection; by classifying each pixel, semantic segmentation can accurately locate and distinguish different types of defects on the glass surface, such as pits, bubbles and scratches, to achieve fine-grained defect detection; compared with traditional target detection methods, semantic segmentation can capture more complex and irregular defect shapes, and is particularly suitable for detecting subtle defects with unclear edges or variable shapes; in addition, semantic segmentation can effectively process large-scale high-resolution images, while ensuring accuracy, reducing false detections and missed detections, and significantly improving the quality inspection efficiency and reliability of mobile phone screen glass.
[0057] (3) The present invention further realizes the measurement of defect damage area based on the model output results. The deep learning method has significant advantages in the measurement of defect damage area of mobile phone screen glass. Through automated feature extraction and learning, the present invention can accurately identify and quantify various defect forms on the glass surface, whether it is pitting, scratches or small damage such as bubbles. Compared with traditional image processing methods, deep learning can more accurately segment and detect irregularly shaped defect areas and measure their areas in real time, greatly improving the detection efficiency. In addition, this method shows stronger robustness and stability when dealing with complex background and noise interference, ensuring the consistency and accuracy of the measurement results, and providing strong technical support for efficient and intelligent glass quality detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 This is a flow chart of the mobile phone screen glass defect detection method based on improved YOLOv8 mentioned in Example 1 of the present invention;
[0059] Figure 2 This is a network structure diagram of the improved YOLOv8 model mentioned in Example 1 of the present invention;
[0060] Figure 3 This is a schematic diagram of different defect categories of the mobile phone screen glass mentioned in Example 1 of the present invention;
[0061] Figure 4 This is the detection result of the improved YOLOv8 model mentioned in Example 1 of the present invention on the mobile phone screen glass to be detected. DETAILED DESCRIPTION
[0062] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0063] Embodiment 1:
[0064] In view of the problem that the defect categories detected by the mobile phone screen glass surface in existing research are not accurate enough, the mobile phone screen glass defects are taken as the research object, and the glass surface data set is randomly collected. The accuracy of glass defect detection is improved by optimizing the target detection model. At the same time, the segmentation model is used to identify and quantify various defect forms on the glass surface, providing a feasible solution for estimating the defect area and damage degree of the mobile phone screen glass.
[0065] See also Figure 1The present invention proposes a mobile phone screen glass defect detection method based on improved YOLOv8, comprising the following steps:
[0066] S1. Simulate the actual industrial environment to build a mobile phone screen glass dataset.
[0067] S1.1. Build a mobile phone screen glass image acquisition platform; prepare an industrial camera, a transparent stage, a clamp, an LED light source, and a darkroom. Use the clamp to place the industrial camera on the top of the darkroom. Set the camera resolution to 1920×1080 and debug the light source. Connect the industrial camera to the computer to complete the construction, and use the S-EYE software to collect images of mobile phone screen glass.
[0068] S1.2. Data preprocessing and enhancement: filter, enhance and expand the original collected data to obtain a rich data set.
[0069] S1.3, make a data set; defect categories such as Figure 3 The images shown include scratches, bubbles, pits, and edge collapse. Labelimg software was used to manually annotate each image, and the 1,000 images were divided into a training set and a validation set at a ratio of 9:1. Another 100 images were taken as the test set.
[0070] S2. Improve and optimize the YOLOv8 target detection network model.
[0071] YOLOv8 adopts the classic three-part structure: Backbone, Neck and Head, which are responsible for feature extraction, feature fusion and target detection respectively.
[0072] Backbone is mainly used to extract features from input images. YOLOv8 uses optimized convolutional networks, such as CSPNet (Cross Stage Partial Network), to reduce redundant calculations, speed up feature extraction, and improve network performance. At the same time, lightweight modules such as C2f (Cross Stage Feature Fusion) are added to optimize the feature extraction process, enabling the network to process large-scale image data more efficiently, while reducing the amount of calculation and adapting to real-time applications.
[0073] The neck part is usually used for multi-scale fusion of features. Common feature fusion methods used in YOLOv8 include PANet (Path Aggregation Network) or FPN (Feature Pyramid Network). By fusing feature maps from different scales, the model can better handle targets of different sizes and improve the detection ability of small targets.
[0074] The Head part is used to predict the category, location and bounding box of the target. In YOLOv8, the Head provides different levels of output for detecting targets of different sizes to improve the generalization ability and detection accuracy of the network. YOLOv8 introduces a new loss function and an improved detection head structure to improve the accuracy of bounding box regression and classification.
[0075] YOLOv8 adopts an Anchor-free target detection mechanism, which eliminates the Anchor setting step, reduces the complexity of the model, and improves the training and reasoning speed of the model. At the same time, this design makes the model more flexible and better adaptable to different types of data sets.
[0076] Please refer to the network model constructed in this embodiment. Figure 2 . To address the problem of poor detection accuracy of highly reflective and highly transmissive objects, an MCA attention module is added to the top layer of the Head detection head, and DySnakeConv is integrated into Bottleneck to form Bottleneck_DySnakeConv, and C2f_DySnakeConv is formed as a convolution unit of C2f. C2f convolution is the main convolution module of the YOLOv8 model. The C2f of the Backbone network layer is replaced with C2F_DySnakeConv. The optimized C2F_DySnakeConv module integrates dynamic snake convolution and can have a strong recognition ability for small and linear defects. The MCA (Multi-Channel Attention) attention mechanism module is a new type of attention mechanism, specially designed to enhance the ability of deep learning models to pay attention to features of different dimensions in images. The MCA module simultaneously processes the channel dimension, height dimension, and width dimension of the input image through a multi-branch architecture. Each branch focuses on a different feature dimension, thereby fully capturing multi-dimensional information and effectively improving the model's ability to capture important features, especially in multi-scale object detection tasks.
[0077] Dynamic Snake Convolution (DySnakeConv) is an innovative convolution operation specially designed to process objects with complex boundaries and irregular shapes. It combines the ideas of dynamic convolution and snake contour extraction, and can flexibly adjust the shape and position of the convolution kernel to better capture the edge information and local features of the target.
[0078] S3. Improve the training and verification of the YOLOv8 network model.
[0079] S3.1 Initialize the model; select a suitable pre-trained model for initialization, which can speed up the training process and improve model performance.
[0080] S3.2 Select the loss function; select the appropriate loss function according to the task, such as bounding box regression loss, classification loss, etc.
[0081] S3.3 sets hyperparameters; freeze the backbone network for the first 50 epochs, set the learning rate to 1e-4, and the decay rate to 0.96. After thawing, the learning rate is set to 1e-5, and the decay rate is still 0.96.
[0082] S3.4 Train the model; use the training set to train the model. Monitor the loss value and other performance indicators during the training process to ensure that the model gradually converges.
[0083] S3.5 Validate the model: Evaluate the model performance on the validation set and check the accuracy, recall, F1 score and other indicators. Using the validation set can timely identify problems with model overfitting or underfitting.
[0084] S4. Realize semantic segmentation of mobile phone screen glass defect categories.
[0085] S4.1, image acquisition: collect the glass image of the mobile phone screen to be identified;
[0086] S4.2. Image annotation: Labelme annotation software is used to annotate the contours of the mobile phone screen glass defects, and the annotated Json format file is converted into a txt format file to form a segmentation training data set.
[0087] S4.3, image semantic segmentation; use the improved YOLOv8-segment model to train the segmentation training data set, and then obtain the best semantic segmentation training file through verification. Use the best semantic segmentation training file to detect defects on the mobile phone screen glass, and the results include the pixel value of the defect, the location, category, and confidence of the target box;
[0088] S5. Measure the actual damage range of different defects on the mobile phone screen glass based on the segmentation results.
[0089] S5.1. Determine the number, pixel value and target frame area of each category of defects based on the defect detection results;
[0090] In this embodiment, based on the detection results of different types of defects in the mobile phone screen glass, the number, pixel value and target box area of each defect category need to be determined. By analyzing the detection results, the performance of each defect category in the image is recorded, including its pixel value in the image and the area of the target box, thereby providing basic data for further defect analysis and processing.
[0091] S5.2. Determine the focal length, shooting distance and other parameters of the camera used to collect the data set;
[0092] During the data collection process, it is necessary to accurately determine the various parameters of the camera, including focal length, shooting distance, etc. These parameters are crucial to ensuring image quality and accuracy, and can affect the accuracy of subsequent defect detection and area calculation. Reasonable settings of focal length and shooting distance can optimize image resolution and ensure the clarity and detail of the defects in the mobile phone screen glass captured.
[0093] S5.3. Relationship between the pixel area occupied by different mobile phone screen glass defect categories in the image and the area in the actual three-dimensional space;
[0094] Since defects on mobile phone screen glass usually present irregular shapes, the actual three-dimensional area of these irregular defects must be calculated by selecting the range of the segmented target box. The specific methods include:
[0095] The relationship between the rectangular target detection box and the area of the actual three-dimensional space is as follows:
[0096] W1 i =(d*p j ) / fi=1,2,...,6;j=1,2,3,...
[0097]
[0098] Among them, i represents different categories, d represents the distance between the camera and the screen glass of the mobile phone to be tested, p represents the width and length pixel value of the target frame of the mobile phone screen glass defect; f represents the focal length of the camera;
[0099] The relationship formula for determining the actual three-dimensional space area of the irregular defect pattern is as follows:
[0100]
[0101] Among them, S1 represents the actual area of the segmentation defect rectangular target box, p1 represents the total pixels of the irregular segmentation defects, and p2 represents the total pixel value of the segmentation defect rectangular target box.
[0102] S5-5. Evaluate the measurement results;
[0103] By comparing the difference between the prediction results of the fitted model and the actual measured data. Commonly used evaluation methods include: root mean square error (RMSE), mean absolute error (MAE), determination coefficient (R 2 ) and residual analysis (ResidualAnalysis), etc.
[0104] See also Figure 4 Specific test results are as follows: Figure 4 shown.
[0105] In summary, the present invention is suitable for accurate detection of mobile phone screen glass defect characteristics and can measure the range of defects, providing intelligent and efficient services for the mobile phone screen glass quality inspection process.
[0106] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A mobile phone screen glass defect detection method based on improved YOLOv8, characterized in that: The following steps are involved: S1. Build a data set: collect mobile phone screen glass images taken in a simulated industrial production environment to build a data set; S2. Improve and optimize the YOLOv8 target detection network model: Based on the YOLOv8 network model, add an attention module, use DySnakeConv convolution to replace the original convolution of the YOLOv8 network, and improve the C2f module to obtain the improved YOLOv8 model; S3. Training an improved YOLOv8 model: Based on the mobile phone screen glass image dataset constructed in S1, the improved YOLOv8 model is trained and verified, and the learning parameters of the improved YOLOv8 model are adjusted; S4, semantic segmentation of mobile phone screen glass defect categories: segment the mobile phone screen glass defect image to be identified based on the improved YOLOv8 model trained in S3, and obtain the classification result of the mobile phone screen glass defect to be identified; S5. Measurement of actual damage range of different defects in mobile phone screen glass: Based on the detection results of mobile phone screen glass defects, the counting results and pixel values of each category of mobile phone screen glass defects are obtained, and the relationship between the pixel area occupied by different categories of mobile phone screen glass defects in the picture and the area in the actual three-dimensional space is established. The focal length, shooting distance and other parameters of the camera used for collecting the data set are determined, and a mathematical mapping relationship model is established to achieve measurement of the damage range of various categories of mobile phone screen glass defects.
2. The mobile phone screen glass defect detection method based on improved YOLOv8 according to claim 1 is characterized in that: The S1 specifically includes the following contents: S101. Build a data image acquisition platform: set up a shooting darkroom, place an industrial camera on the top of the darkroom, place a mobile phone screen glass sample on a transparent support table, illuminate the left and right sides with a strip light source, and collect several mobile phone screen glass images as original image data; S102, data preprocessing: performing data cleaning, data conversion and data enhancement on the original image data to obtain a mobile phone screen glass defect data set; S103, training image annotation: use Labelimg software to mark different defects of mobile phone screen glass in the mobile phone screen glass defect dataset, and the defects include four categories: scratches, bubbles, chipped edges, and pits.
3. The mobile phone screen glass defect detection method based on improved YOLOv8 according to claim 1 is characterized in that: The S2 specifically includes the following contents: Based on the YOLOv8 model, an MCA attention module is added to the top layer of its Head detection head. The MCA attention module uses a three-branch architecture to simultaneously infer the channel, height, and width dimensions; DySnakeConv is integrated into Bottleneck to form Bottleneck_DySnakeConv, and then used as the convolution unit of C2f to form C2f_DySnakeConv; the C2f convolution is the main convolution module of the YOLOv8 model, and the C2f of the Backbone network layer is replaced by C2f_DySnakeConv. The optimized C2F_DySnakeConv module integrates dynamic snake convolution, so that it has the ability to emphasize the recognition of small and linear defects.
4. The mobile phone screen glass defect detection method based on improved YOLOv8 according to claim 1 is characterized in that: The S3 specifically includes the following contents: S301, dividing the mobile phone screen glass data set into a training set and a validation set according to a ratio of 9:1; S302, use the weight of the pre-trained model as the initial weight, and train the number of images in each batch as 16; input image size imgsz:640; freeze the backbone network of the first 50 epochs, and perform fine-tuning, setting the learning rate to 1e-4 and the decay rate to 0.96; after unfreezing, the learning rate is set to 1e-5, and the decay rate is still 0.96; use the training set for training; S303. Verify the mobile phone screen glass defect detection model based on the improved YOLOv8 through the verification set and obtain the best training file.
5. The mobile phone screen glass defect detection method based on improved YOLOv8 according to claim 3 is characterized in that: The specific contents of S4 are as follows: S401, image acquisition: acquiring the glass image of the mobile phone screen to be identified; S402, image annotation: Labelme annotation software is used to annotate the contours of the mobile phone screen glass defects, and the annotated Json format file is converted into a txt format file to form a segmentation training data set; S403, image semantic segmentation: use the improved YOLOv8-segment model to train the segmentation training data set, and then obtain the best semantic segmentation training file through verification; Use the best semantic segmentation training file to detect defects on the mobile phone screen glass. The results include the pixel value of the defect, the location, category, and confidence of the target box.
6. The mobile phone screen glass defect detection method based on improved YOLOv8 according to claim 5 is characterized in that: The improved YOLOv8-segment model described in S403 detects the image, specifically including the following contents: S4031. Introduce feature extractor: Use depthwise separable convolution to replace traditional convolution operations, split the convolution operation into depthwise convolution and pointwise convolution, reduce the amount of calculation while maintaining feature extraction capabilities, and improve the computational efficiency of the model; S4032. Replace the backbone network; combine with the latest backbone network, such as EfficientNet, and use the advantages of the backbone network in feature extraction to enhance the feature expression capability of YOLOv8.
7. The mobile phone screen glass defect detection method based on improved YOLOv8 according to claim 5 is characterized in that: The S5 specifically includes the following contents: S501, determining the number, pixel value and target frame area of each category of defects based on the detection results of different defects of the mobile phone screen glass; S502, determining the focal length and shooting distance parameters of the camera used to collect the data set; S503: Determine the relationship between the pixel area occupied by different types of mobile phone screen glass defects in the image and the area in the actual three-dimensional space: The range of irregular segmentation is calculated by selecting the range of the segmented target box. The relationship between the rectangular target detection box and the area of the actual three-dimensional space is as follows: W1 i =(d*p j ) / f i=1,2,...,6;j=1,2,3,... Among them, i represents different categories; d represents the distance between the camera and the screen glass of the mobile phone to be tested; p represents the width and length pixel value of the target frame of the mobile phone screen glass defect; f represents the focal length of the camera; The relationship formula for determining the actual three-dimensional space area of the irregular defect pattern is as follows: Among them, S1 represents the actual area of the segmentation defect rectangular target box; p1 represents the total pixels of the irregular segmentation defect; p2 represents the total pixel value of the segmentation defect rectangular target box; S504, evaluate the fitting effect: The evaluation is performed by comparing the results of the defect range inspection model with the actual measured data. The evaluation methods include root mean square error, mean absolute error, determination coefficient and residual analysis method.
8. A mobile phone screen glass defect detection system based on improved YOLOv8 applied in any of the methods described in claims 1-7, characterized in that: include: The mobile phone screen glass defect image acquisition platform includes a shooting darkroom and a transparent load-bearing platform. The industrial camera is placed on the top of the darkroom, the transparent load-bearing platform is set inside the darkroom, and strip light sources are installed on the left and right sides of the transparent load-bearing platform. Image processing module, used for image cleaning, data enhancement and data expansion; Mobile phone glass defect detection module, which uses an optimized YOLOv8 model by optimizing convolution and adding an attention mechanism to identify and detect mobile phone screen glass defects; The mobile phone screen glass defect category semantic segmentation module uses the improved YOLOv8-segment network model to perform semantic segmentation on defects to obtain a more accurate defect recognition range; The actual damage range measurement module of mobile phone screen glass can accurately measure the damage area of defects in actual space based on defect segmentation.
9. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set or instruction set, and the instruction, program, code set or instruction set is loaded and executed by the processor to implement the mobile phone screen glass defect detection method based on improved YOLOv8 as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, at least one program, code set or instruction set, and the instruction, program, code set or instruction set is loaded and executed by the processor to implement the mobile phone screen glass defect detection method based on improved YOLOv8 as described in any one of claims 1-7.
Citation Information
Cited By
Mobile phone cover plate glass bubble detection method and system
CN119540236A
Lightweight mobile phone screen defect detection method based on improved YOLOv10
CN119904449A
Mobile phone rear cover defect automatic detection method and system based on machine vision
CN120495260A
High-reflection and high-transmittance material surface flaw detection method based on improved YOLOv11
CN120580221A
High-reflection high-transmission material surface flaw detection method based on improved YOLOv11
CN120580221B