Porcelain dish surface defect detection method and system and readable storage medium
Through area grading and ROI extraction, the YOLO model is improved, the CBAM and BiFPN modules are introduced, and the Focal EIOU Loss loss function is used to solve the problem of high detection difficulty in surface defect detection of porcelain disks, and the detection accuracy and accuracy are improved.
Patent Information
- Application Number
- CN202411399650.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-09
- Publication Date
- 2025-01-10
AI Technical Summary
In the detection of surface defects of porcelain disks, manual design feature extraction is complicated and poor in versatility. Deep learning methods are not effective in detecting micro defects and detecting edge areas, resulting in high detection difficulty.
Using regional hierarchy and ROI extraction, the traditional YOLO model is improved, the CBAM module and weighted bidirectional feature pyramid network BiFPN are introduced, and the Focal EIOU Loss loss function is used to optimize the model's identification of small defects and bounding box regression tasks.
It improves the accuracy and accuracy of surface defect detection of porcelain disks, reduces the difficulty of edge defect detection, enhances the ability to identify small defects, and solves the problem of sample imbalance and the loss value oscillation caused by low-quality samples.
Smart Images

Figure CN119295405A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of machine vision technology, and more specifically, to a method and system for detecting surface defects of a porcelain plate and a readable storage medium. Background Art
[0002] Ceramic products are widely used as eating utensils due to their environmental protection, high temperature resistance, and easy cleaning. Among them, handicraft porcelain plates have a high export value due to their exquisite appearance. The surface defects of porcelain plates not only affect the beauty of the product, but also serve as an important basis for product grade classification, and directly affect the value of the product and the company's profits. Therefore, in-depth research on the automated detection technology of surface defect recognition and positioning of porcelain plates is of great significance for product quality inspection and grade classification. In recent years, with the joint development and in-depth research of multiple disciplines such as computers and image processing, surface defect detection technology based on machine vision has also been widely used in the industry. There are currently two main methods in machine vision. The first is to rely on artificial design to extract defect features to achieve surface defect detection; the second is the feature self-extraction method of deep learning to learn the required image feature representation through iterative optimization to achieve surface defect detection.
[0003] In the application of traditional artificially designed features to the detection of surface defects of ceramic plates, although the existing algorithms can solve some specific problems of surface defect detection of ceramic plates, the extraction of artificially designed features is relatively cumbersome, and new methods need to be redefined for specific problems. It has high requirements for the quality of sample images, and its versatility and robustness are relatively poor. In the application of deep learning to the detection of surface defects of ceramic plates, on the one hand, there are problems with poor results in feature extraction and detection of minor defects. On the other hand, the irregular distribution of minor defects makes the detection of defects at the edge of the plate more difficult than in the middle area. Some defects have low grayscale and texture significance and low differentiation from normal parts, and the edges of the area are blurred, resulting in high detection difficulty. Summary of the invention
[0004] The purpose of this application is to provide a method, system and readable storage medium for detecting surface defects of ceramic plates. Through regional classification and ROI extraction, the precise edge defect detection area is located to reduce the difficulty of edge defect detection; the traditional YOLO model is improved, and the CBAM module is introduced to enhance the model's ability to recognize tiny defects; the weighted bidirectional feature pyramid network BiFPN is used to facilitate the model to quickly perform multi-scale feature fusion; Focal EIOU Loss is used as the loss function to optimize the sample imbalance problem in the bounding box regression task, effectively improving the accuracy of ceramic plate surface defect detection.
[0005] The first aspect of the present application provides a method for detecting surface defects of a porcelain plate, the method comprising:
[0006] Collecting the whole image of the porcelain plate, and performing regional classification processing on the whole image of the porcelain plate to obtain the edge area image and the middle area image;
[0007] Extracting the region of interest (ROI) from the edge region image to obtain the edge region of interest image;
[0008] Label the type and location information of defects in the edge region of interest image and the middle region image, generate a data set, and divide the data set into a training set and a test set;
[0009] Based on the traditional YOLO network model, the attention module CBAM, the weighted bidirectional feature pyramid network BiFPN, and the loss function Focal EIOU Loss are introduced to obtain an improved YOLO network model;
[0010] The improved YOLO network model is trained and tested using the training set and test set respectively to obtain a porcelain plate surface defect detection model;
[0011] The collected overall image of the porcelain plate to be tested is input into a porcelain plate surface defect detection model, and the porcelain plate surface defect detection model outputs the type and position information of the porcelain plate surface defects.
[0012] Optionally, the whole image of the porcelain plate is collected, and the whole image of the porcelain plate is subjected to regional classification processing to obtain an image of an edge region of interest and an image of a middle region, specifically:
[0013] Grayscale processing is performed on the collected overall image of the porcelain plate to obtain a grayscale image;
[0014] The grayscale image is statistically analyzed by histogram. When the proportion of specified grayscale pixels is greater than the preset proportion, it is judged as an edge area image, otherwise it is a middle area image.
[0015] Optionally, the step of extracting a region of interest (ROI) from the edge region image to obtain the edge region of interest image is specifically as follows:
[0016] The grayscale image corresponding to the edge area image is segmented using the Otsu threshold algorithm OTSU, and the edge area of the porcelain plate is roughly separated from the background by binarization.
[0017] The image after threshold segmentation is subjected to curve fitting to obtain the precise coordinates of the boundary of the region of interest (ROI) at the edge of the porcelain plate, thereby completing the extraction of the region of interest (ROI) at the edge of the porcelain plate.
[0018] Optionally, the Otsu threshold algorithm OTSU is used for threshold segmentation, specifically:
[0019] The Otsu threshold algorithm (OTSU) was selected to determine the optimal threshold by finding the maximum value of the inter-class variance between the target area and the background area. The area with a grayscale value greater than the optimal threshold is the edge area of the porcelain plate, and the area with a grayscale value less than the optimal threshold is the background.
[0020] Optionally, the between-class variance is defined as follows:
[0021] g=w1×(μ0-μ1) 2 +w2×(μ0-μ2) 2
[0022] μ0=μ1×w1+μ2×w2
[0023] Among them, g is the inter-class variance value; μ0 is the average grayscale of the whole image; w1 is the pixel ratio of the target area; μ1 is the average grayscale of the target area; w2 is the pixel ratio of the background area; μ2 is the average grayscale of the background area.
[0024] Optionally, the curve fitting is performed on the image after the threshold segmentation, specifically:
[0025] The least square fitting method is used to perform curve fitting on the edge of the threshold segmentation image. Let the edge point set of the fitting be (x i ,y i ),i=0,……,n, then the constructed fitting curve function is:
[0026]
[0027] According to the principle of least squares method, the best fitting curve can be obtained when the following equation is established:
[0028]
[0029] Optionally, the type and location information of the defects of the image of the edge region of interest and the image of the middle region are specifically:
[0030] The LabelImg open source auxiliary image calibration software is used to label the defects in the edge area of interest images and the middle area images. The labels include the type of defects and the location information of the defects in the images.
[0031] Optionally, based on the traditional YOLO network model, the attention module CBAM, the weighted bidirectional feature pyramid network BiFPN, and the loss function Focal EIOU Loss are introduced to obtain an improved YOLO network model, which specifically includes:
[0032] The attention module CBAM is introduced into the backbone network of the traditional YOLO network model. The attention module CBAM consists of two key parts, including a channel attention module and a spatial attention module.
[0033] The weighted bidirectional feature pyramid network BiFPN is introduced into the neck network part of the traditional YOLO network model, fused with the original Concat layer and replaced the original ordinary Concat layer;
[0034] The loss function Focal EIOU Loss is used to replace the loss function CIOU of the traditional YOLO network model to optimize the sample imbalance problem in the bounding box regression task.
[0035] Optionally, after acquiring the overall image of the porcelain plate, the method further includes:
[0036] The deep convolutional adversarial network DCGAN is used to perform image enhancement on the overall image of the porcelain plate. The enhanced overall image data of the porcelain plate is input into the DCGAN network structure model for image generation and sample expansion.
[0037] Optionally, before marking the type and location information of defects in the edge region of interest image and the middle region image, the edge region of interest image and the middle region image are also size normalized to generate a normalized image; Gaussian filtering is used to eliminate noise contained in the normalized image, and Laplace transform is used to enhance the contrast of the normalized image; the sample image is rotated 90°, 180°, and 270° in a counterclockwise direction, and the sample image at each rotation angle is randomly cropped to enhance the clarity of the sample image.
[0038] The second aspect of the present application provides a porcelain plate surface defect detection system, including a memory and a processor, wherein the memory includes a porcelain plate surface defect detection method program, and when the porcelain plate surface defect detection method program is executed by the processor, the steps of a porcelain plate surface defect detection method are implemented.
[0039] The third aspect of the present application provides a computer-readable storage medium, which includes a porcelain plate surface defect detection method program. When the porcelain plate surface defect detection method program is executed by a processor, the steps of a porcelain plate surface defect detection method are implemented.
[0040] As can be seen from the above, the present application provides a method, system and readable storage medium for detecting surface defects of ceramic plates. The method described in the present application locates accurate edge defect detection areas through region classification and ROI extraction, thereby reducing the difficulty of edge defect detection;
[0041] This application improves the traditional YOLO model and introduces the CBAM module, so that the model can better capture the characteristics of small defects, thereby improving the ability to identify small defects, and also helps to improve the detection and classification accuracy of the model; using the weighted bidirectional feature pyramid network BiFPN, the network can quickly perform multi-scale feature fusion; using Focal EIOU Loss as the loss function to replace the original loss function, optimize the sample imbalance problem in the bounding box regression task, reduce the optimization contribution of a large number of anchor boxes that have little overlap with the target box to the BBox regression, so that the regression process focuses on high-quality anchor boxes, and solves the problem of severe fluctuations in loss values caused by low-quality samples in current defect detection;
[0042] This application uses a generative adversarial network to enhance the data set, and the generated image samples are highly diverse and high-quality, solving the problem of poor detection results due to insufficient training samples.
[0043] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the embodiments of the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0045] Figure 1 A flow chart of a method for detecting surface defects of a porcelain plate provided in an embodiment of the present application.
[0046] Figure 2 A flow chart of a porcelain plate surface defect detection system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0048] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0049] Please refer to Figure 1 , is a method for detecting surface defects of a porcelain plate in some embodiments of the present application, the method comprising:
[0050] S102: collecting an overall image of the porcelain plate, and performing regional classification processing on the overall image of the porcelain plate to obtain an edge region image and a middle region image;
[0051] S104: extracting the region of interest (ROI) from the edge region image to obtain an edge region of interest image;
[0052] S106: marking the type and location information of defects in the edge region of interest image and the middle region image, generating a data set, and dividing the data set into a training set and a test set;
[0053] S108: Based on the traditional YOLO network model, the attention module CBAM, the weighted bidirectional feature pyramid network BiFPN, and the loss function Focal EIOU Loss are introduced to obtain an improved YOLO network model;
[0054] S110: using the training set and the test set to train and test the improved YOLO network model respectively, to obtain a porcelain plate surface defect detection model;
[0055] S112: Inputting the collected overall image of the porcelain plate to be tested into a porcelain plate surface defect detection model, and the porcelain plate surface defect detection model outputs the type and location information of the porcelain plate surface defects.
[0056] It should be noted that this application uses regional classification and ROI extraction to locate accurate edge defect detection areas and reduce the difficulty of edge defect detection; improves the traditional YOLO model and introduces the CBAM module to enhance the model's ability to recognize tiny defects; uses the weighted bidirectional feature pyramid network BiFPN to facilitate the model to quickly perform multi-scale feature fusion; uses Focal EIOU Loss as the loss function to optimize the sample imbalance problem in the bounding box regression task. This application achieves high-precision recognition and positioning of surface defects on porcelain plates, solves the problems of high difficulty in edge area defect detection, poor results in feature extraction and small target defect detection, and effectively improves the effect of surface defect detection on porcelain plates.
[0057] According to an embodiment of the present invention, the whole image of the porcelain plate is collected, and the whole image of the porcelain plate is subjected to regional classification processing to obtain an image of the edge region of interest and an image of the middle region, specifically:
[0058] Grayscale processing is performed on the collected overall image of the porcelain plate to obtain a grayscale image;
[0059] The grayscale image is statistically analyzed by histogram. When the proportion of specified grayscale pixels is greater than the preset proportion, it is judged as an edge area image, otherwise it is a middle area image.
[0060] It should be noted that the irregular distribution of small defects makes it more difficult to detect defects at the edge of the plate than in the middle area. Some defects have low grayscale and texture significance and are not distinguishable from normal parts, and the regional edges are blurred, which further increases the difficulty of detection. Therefore, this application proposes a regional classification method. After the porcelain plate image is collected by hardware equipment, the image is first grayed; then the grayscale image is histogram counted. When the proportion of specified grayscale pixels is greater than the set ratio, it is judged as an edge area image, and ROI extraction is performed first, followed by subsequent labeling and other processing; otherwise, it is judged as an image of the middle area of the plate, and no ROI extraction is required, and subsequent processing is performed directly.
[0061] According to an embodiment of the present invention, the extraction of the region of interest ROI from the edge region image to obtain the edge region of interest image is specifically as follows:
[0062] The grayscale image corresponding to the edge area image is segmented using the Otsu threshold algorithm OTSU, and the edge area of the porcelain plate is roughly separated from the background by binarization.
[0063] The image after threshold segmentation is subjected to curve fitting to obtain the precise coordinates of the boundary of the region of interest (ROI) at the edge of the porcelain plate, thereby completing the extraction of the region of interest (ROI) at the edge of the porcelain plate.
[0064] It should be noted that ROI extraction refers to identifying and extracting the region of interest (ROI) in an image during image processing. This process is extremely important in the field of computer vision and image analysis because it allows researchers or developers to focus on specific and relevant parts of an image, thereby improving processing efficiency and accuracy.
[0065] This application uses the ROI extraction algorithm to limit the scope of image processing to the disk area, so that the ROI area is separated from the laboratory bench background, further reducing the difficulty of later defect detection.
[0066] According to an embodiment of the present invention, the Otsu threshold algorithm OTSU is used to perform threshold segmentation, specifically:
[0067] The Otsu threshold algorithm (OTSU) was selected to determine the optimal threshold by finding the maximum value of the inter-class variance between the target area and the background area. The area with a grayscale value greater than the optimal threshold is the edge area of the porcelain plate, and the area with a grayscale value less than the optimal threshold is the background.
[0068] According to an embodiment of the present invention, the between-class variance is defined as follows:
[0069] g=w1×(μ0-μ1) 2 +w2×(μ0-μ2) 2
[0070] μ0=μ1×w1+μ2×w2
[0071] Among them, g is the inter-class variance value; μ0 is the average grayscale of the whole image; w1 is the pixel ratio of the target area; μ1 is the average grayscale of the target area; w2 is the pixel ratio of the background area; μ2 is the average grayscale of the background area.
[0072] It should be noted that image threshold segmentation is a typical region segmentation technology, which separates the foreground and background of the image by selecting a suitable threshold. Since the surface of the porcelain plate is smooth and there is reflection in the collected image, it is difficult to select the threshold. In order to obtain a higher fitting accuracy, the edge of the target area after segmentation must be smooth and have few free noise points. Through a comprehensive comparison of commonly used threshold segmentation methods, this application selects the Otsu threshold method.
[0073] According to an embodiment of the present invention, the curve fitting of the image after threshold segmentation is specifically performed as follows:
[0074] The least square fitting method is used to perform curve fitting on the edge of the threshold segmentation image. Let the edge point set of the fitting be (x i ,y i ),i=0,……,n, then the constructed fitting curve function is:
[0075]
[0076] According to the principle of least squares method, the best fitting curve can be obtained when the following equation is established:
[0077]
[0078] It should be noted that accurate edge extraction is an extremely important part of the ROI extraction algorithm of this application. Since there is background error in the threshold segmentation result, more accurate edge detection is required to finally achieve complete separation of the subject from the noisy background. Common edge fitting methods include least squares fitting, random sampling consistent fitting, etc. Thanks to good threshold segmentation, there are fewer free interference points on the disk boundary. This application uses the least squares fitting method to perform curve fitting on the edge of the threshold segmented image.
[0079] According to an embodiment of the present invention, the type and location information of the defects of the edge region of interest image and the middle region image are specifically:
[0080] The LabelImg open source auxiliary image calibration software is used to label the defects in the edge area of interest images and the middle area images. The labels include the type of defects and the location information of the defects in the images.
[0081] It should be noted that, in this embodiment, the labeled defect image data is made into a data set according to the format of the VOC 2007 data set. The labeled defect image data is divided into a training set and a test set at a ratio of 8:2.
[0082] According to an embodiment of the present invention, based on the traditional YOLO network model, an attention module CBAM, a weighted bidirectional feature pyramid network BiFPN, and a loss function Focal EIOU Loss are introduced to obtain an improved YOLO network model, which specifically includes:
[0083] The attention module CBAM is introduced into the backbone network of the traditional YOLO network model. The attention module CBAM consists of two key parts, including a channel attention module and a spatial attention module.
[0084] The weighted bidirectional feature pyramid network BiFPN is introduced into the neck network part of the traditional YOLO network model, fused with the original Concat layer and replaced the original ordinary Concat layer;
[0085] The loss function Focal EIOU Loss is used to replace the loss function CIOU of the traditional YOLO network model to optimize the sample imbalance problem in the bounding box regression task.
[0086] It should be noted that the present application improves the YOLO model for surface defect detection of porcelain plates, including adding an attention module, adding an adaptive feature fusion module, and optimizing the loss function. Specifically, the CBAM module is introduced in the P2 layer of the backbone network, so that the model can better capture the characteristics of tiny defects, thereby improving the ability to recognize tiny defects, and also helping to improve the detection and classification accuracy of the model; a weighted bidirectional feature pyramid network BiFPN is used to facilitate the network to quickly perform multi-scale feature fusion; Focal EIOU Loss is used as the loss function to replace the original loss function, optimize the sample imbalance problem in the bounding box regression task, reduce the optimization contribution of a large number of anchor boxes that have less overlap with the target box to the BBox regression, and make the regression process focus on high-quality anchor boxes, so as to solve the problem of violent fluctuations in loss values caused by low-quality samples in current defect detection.
[0087] It should be noted that the channel attention mechanism of the CBAM attention module allows the model to automatically learn and focus on important channels of the input feature map. For surface defect detection of porcelain plates, different types of defects may have different visual features in different channels, such as color, texture, etc. CBAM can adaptively enhance the channels related to defects, thereby improving the model's perception of defect features and making the algorithm more sensitive and accurate. In addition, the spatial attention mechanism in the CBAM module helps the model capture the correlation of different positions in the input feature map. In surface defect detection of porcelain plates, defects may appear at different positions and scales. By introducing spatial attention, the model can focus more on areas where defects may exist, reduce the risk of false detection, and improve the reliability of detection. This module consists of two key parts, namely the channel attention module and the spatial attention module. In the channel attention module, first, the input feature F undergoes global average pooling and maximum pooling operations to obtain the global information of each feature channel; then, the two sets of pooled information are weighted summed through two fully connected layers, and the result is activated using the Sigmoid activation function; finally, the channel attention feature map M′ is obtained, which contains information about the degree of attention to different channels of the input feature F. Spatial attention module,First, the feature map F′ undergoes maximum pooling and average pooling operations to capture its spatial information;,Next, a 7×7 convolution operation is used to reduce the dimension of F′ to a channel for subsequent calculations;,Then, the sigmoid function is used to generate the spatial attention feature map M″.,Through the spatial attention module, we can obtain the information about the,spatial attention degree of the input feature map F and get the corresponding feature map,representation.
[0088] According to an embodiment of the present invention, in step S110, the improved YOLO network model is trained using the training set to obtain a primary porcelain plate surface defect detection model, and then the primary porcelain plate surface defect detection model is tested and evaluated using the test set. The evaluation indicators include precision, recall, mAP, and FPS. Precision refers to the proportion of samples predicted by the model to be positive examples that are truly positive examples; recall refers to the proportion of samples correctly predicted by the model to be positive examples to all samples that are truly positive examples; mAP is a comprehensive indicator used to evaluate the performance of the target detection model. It is the average of the average precision of all categories, that is, the area under the precision-recall curve of each category. The higher the mAP, the better the performance of the model on multiple categories; FPS stands for frames per second, which is one of the important indicators for measuring system performance, indicating the number of image frames processed in one second.
[0089] According to an embodiment of the present invention, after collecting the overall image of the porcelain plate, the method further includes:
[0090] The deep convolutional adversarial network DCGAN is used to perform image enhancement on the overall image of the porcelain plate. The enhanced overall image data of the porcelain plate is input into the DCGAN network structure model for image generation and sample expansion.
[0091] It should be noted that in S102, the present application also includes: using a deep convolutional adversarial network DCGAN to perform image enhancement processing on the overall image of the porcelain plate, inputting the acquired original data and the data after sample amplification into the DCGAN network structure model, generating images, and expanding samples.
[0092] The dataset is enhanced by combining generative adversarial networks. The generated image samples are diverse and of high quality, solving the problem of poor detection results due to insufficient training samples.
[0093] According to an embodiment of the present invention, before marking the type and location information of defects in the edge region of interest image and the middle region image, the edge region of interest image and the middle region image are also size normalized to generate a normalized image; Gaussian filtering is used to eliminate noise contained in the normalized image, and Laplace transform is used to enhance the contrast of the normalized image; the sample image is rotated 90°, 180°, and 270° in a counterclockwise direction, and the sample image at each rotation angle is randomly cropped to enhance the clarity of the sample image.
[0094] It should be noted that, in S106, before marking the image defect type and location, the present application also includes: normalizing, filtering and clarifying the image. Through the above preprocessing, the sample quality is improved, thereby improving the model defect detection effect. Surface defects include spots, cracks, slag, breakage and highlights.
[0095] Please refer to Figure 2 In a second aspect, the present application provides a porcelain plate surface defect detection system, wherein the porcelain plate surface defect detection system 2 comprises a memory 21 and a processor 22, wherein the memory 21 comprises a porcelain plate surface defect detection method program, and when the porcelain plate surface defect detection method program is executed by the processor 22, the steps of a porcelain plate surface defect detection method are implemented.
[0096] A third aspect of the present application provides a computer-readable storage medium, which includes a porcelain plate surface defect detection method program. When the porcelain plate surface defect detection method program is executed by the processor 22, the steps of a porcelain plate surface defect detection method are implemented.
[0097] As can be seen from the above, the present application provides a method, system and readable storage medium for detecting surface defects of ceramic plates. The method described in the present application locates accurate edge defect detection areas through region classification and ROI extraction, thereby reducing the difficulty of edge defect detection;
[0098] This application improves the traditional YOLO model and introduces the CBAM module, so that the model can better capture the characteristics of small defects, thereby improving the ability to identify small defects, and also helps to improve the detection and classification accuracy of the model; using the weighted bidirectional feature pyramid network BiFPN, the network can quickly perform multi-scale feature fusion; using Focal EIOU Loss as the loss function to replace the original loss function, optimize the sample imbalance problem in the bounding box regression task, reduce the optimization contribution of a large number of anchor boxes that have little overlap with the target box to the BBox regression, so that the regression process focuses on high-quality anchor boxes, and solves the problem of severe fluctuations in loss values caused by low-quality samples in current defect detection;
[0099] This application uses a generative adversarial network to enhance the data set, and the generated image samples are highly diverse and high-quality, solving the problem of poor detection results due to insufficient training samples.
[0100] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0101] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0102] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0103] Those skilled in the art can understand that: all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions, and the aforementioned program can be stored in a readable storage medium. When the program is executed, it executes the steps of the above method embodiments; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), disks or optical disks, and other media that can store program codes.
[0104] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product that contributes to the prior art. The software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
Claims
1. A method for detecting surface defects of a porcelain plate, characterized in that: The method comprises: Collecting the whole image of the porcelain plate, and performing regional classification processing on the whole image of the porcelain plate to obtain the edge area image and the middle area image; Extracting the region of interest (ROI) from the edge region image to obtain the edge region of interest image; Label the type and location information of defects in the edge region of interest image and the middle region image, generate a data set, and divide the data set into a training set and a test set; Based on the traditional YOLO network model, the attention module CBAM, the weighted bidirectional feature pyramid network BiFPN, and the loss function Focal EIOU Loss are introduced to obtain an improved YOLO network model; The improved YOLO network model is trained and tested using the training set and test set respectively to obtain a porcelain plate surface defect detection model; The collected overall image of the porcelain plate to be tested is input into a porcelain plate surface defect detection model, and the porcelain plate surface defect detection model outputs the type and position information of the porcelain plate surface defects.
2. A method for detecting surface defects of a ceramic plate according to claim 1, characterized in that: The whole image of the porcelain plate is collected, and the whole image of the porcelain plate is subjected to regional classification processing to obtain an image of the edge region of interest and an image of the middle region, specifically: Grayscale processing is performed on the collected overall image of the porcelain plate to obtain a grayscale image; The grayscale image is statistically analyzed by histogram. When the proportion of specified grayscale pixels is greater than the preset proportion, it is judged as an edge area image, otherwise it is a middle area image.
3. A method for detecting surface defects of a ceramic plate according to claim 2, characterized in that: The extraction of the region of interest (ROI) from the edge region image to obtain the edge region of interest image is specifically as follows: The grayscale image corresponding to the edge area image is segmented using the Otsu threshold algorithm OTSU, and the edge area of the porcelain plate is roughly separated from the background by binarization. The image after threshold segmentation is subjected to curve fitting to obtain the precise coordinates of the boundary of the region of interest (ROI) at the edge of the porcelain plate, thereby completing the extraction of the region of interest (ROI) at the edge of the porcelain plate.
4. A method for detecting surface defects of a ceramic plate according to claim 3, characterized in that: The Otsu threshold algorithm OTSU is used for threshold segmentation, specifically: The Otsu threshold algorithm OTSU is selected to find the maximum value of the inter-class variance between the target area and the background area, and then determine the optimal threshold. The gray value greater than the optimal threshold is the edge area of the porcelain plate, and the gray value less than the optimal threshold is the background. Among them, the between-class variance is defined as follows: g=w1×(μ0-μ1) 2 +w2×(μ0-μ2) 2 μ0=μ1×w1+μ2×w2 Among them, g is the inter-class variance value; μ0 is the average grayscale of the whole image; w1 is the pixel ratio of the target area; μ1 is the average grayscale of the target area; w2 is the pixel ratio of the background area; μ2 is the average grayscale of the background area.
5. A method for detecting surface defects of a ceramic plate according to claim 4, characterized in that: The curve fitting of the image after the threshold segmentation is specifically performed as follows: The least square fitting method is used to perform curve fitting on the edge of the threshold segmentation image. Let the edge point set of the fitting be (x i ,y i ),i=0,……,n, then the constructed fitting curve function is: According to the principle of least squares method, the best fitting curve can be obtained when the following equation is established:
6. A method for detecting surface defects of a ceramic plate according to claim 5, characterized in that: Based on the traditional YOLO network model, the attention module CBAM, the weighted bidirectional feature pyramid network BiFPN, and the loss function FocalEIOU Loss are introduced to obtain an improved YOLO network model, which specifically includes: The attention module CBAM is introduced into the backbone network of the traditional YOLO network model. The attention module CBAM consists of two key parts, including a channel attention module and a spatial attention module. The weighted bidirectional feature pyramid network BiFPN is introduced into the neck network part of the traditional YOLO network model, fused with the original Concat layer and replaced the original ordinary Concat layer; The loss function Focal EIOU Loss is used to replace the loss function CIOU of the traditional YOLO network model to optimize the sample imbalance problem in the bounding box regression task.
7. A method for detecting surface defects of a ceramic plate according to claim 6, characterized in that: After collecting the whole image of the porcelain plate, the method further includes: The deep convolutional adversarial network DCGAN is used to perform image enhancement on the overall image of the porcelain plate. The enhanced overall image data of the porcelain plate is input into the DCGAN network structure model for image generation and sample expansion.
8. A method for detecting surface defects of a ceramic plate according to claim 7, characterized in that: Before marking the type and location information of the defects in the edge region of interest image and the middle region image, the edge region of interest image and the middle region image are also size normalized to generate a normalized image; Gaussian filtering is used to remove noise contained in the normalized image, and Laplace transform is used to enhance the contrast of the normalized image; The sample image is rotated 90°, 180°, and 270° in a counterclockwise direction, and the sample image at each rotation angle is randomly cropped to enhance the clarity of the sample image.
9. A porcelain plate surface defect detection system, characterized in that: It comprises a memory and a processor, wherein the memory comprises a method program for detecting surface defects of a ceramic plate, and when the method program for detecting surface defects of a ceramic plate is executed by the processor, the steps of a method for detecting surface defects of a ceramic plate as described in any one of claims 1 to 8 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a porcelain plate surface defect detection method program. When the porcelain plate surface defect detection method program is executed by a processor, the steps of a porcelain plate surface defect detection method as described in any one of claims 1 to 8 are implemented.