Two-stage bathroom ceramic surface defect detection method and equipment based on deep learning

Through the dual-stage detection method and grid division adaptive tailoring technology, the problem of high-resolution image training is solved, efficient surface defect detection of bathroom ceramics is realized, the detection speed and accuracy are improved, and the detection speed and accuracy are improved to adapt to the needs of industrial sites.

CN114255223BActive Publication Date: 2024-10-29CHINA UNIV OF GEOSCIENCES (WUHAN)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111575859.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-21
Publication Date
2024-10-29
Estimated Expiration
2041-12-21

AI Technical Summary

Technical Problem

Existing methods for detecting surface defects in bathroom ceramics based on deep learning require a large amount of training data, and it is difficult for existing networks to directly use high-resolution images as input for model training, resulting in limited detection efficiency and accuracy.

Method used

A two-stage detection method is adopted. First, the workpiece area recognition model is trained through a deep network and the background is cropped. Then, defects are detected on the workpiece area pictures. The high-resolution pictures are processed using grid division and adaptive clipping technology to form a data set of labeled defect pictures. It is divided into workpiece recognition model and defect detection model for iterative training to suppress background interference and improve detection speed.

Benefits of technology

It effectively suppresses background information interference, improves detection speed and accuracy, meets the needs of industrial sites, and adapts to surface detection in complex environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114255223B_ABST
    Figure CN114255223B_ABST
Patent Text Reader

Abstract

The present invention provides a two-stage bathroom ceramic defect detection method and device based on deep learning, the method is to divide the original annotation file marked with target defect information into a first annotation data set and a second annotation data set; and the second annotation data set is grid-divided and clipped, and the pictures containing only the background are filtered out to obtain a defect picture data set; according to the original annotation file and the coordinate offset value of the defect target relative to the original picture, the annotation file corresponding to the defect picture is obtained, so as to form an annotated defect picture data set, and the first annotation data set and the annotated defect picture data set are respectively divided into a training set and a test set, and then respectively input into a deep network model for training, and the training model is used to perform defect detection on the target to be tested, and the defect type identification and positioning are completed. The method of the present invention can well suppress the interference of background information on the detection result, and can improve the detection speed, meeting the accuracy and speed requirements of industrial field applications.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field, and in particular to a two-stage bathroom ceramic surface defect detection method and device based on deep learning. Background Art

[0002] The ceramic industry is an important part of the national economy. my country is the world's largest producer and seller of sanitary ceramics, with the highest production, export and consumption of ceramic products in the world, and has broad market prospects. In recent years, the automation and mechanization of ceramic industry production technology have been continuously improved, and a large number of automated production equipment and production lines have been introduced. However, the quality inspection and grading evaluation process has not yet been automated, and still relies on manual visual methods for inspection, which makes it difficult to achieve quantitative inspection, and workers are prone to missed inspections, wrong inspections and misinspections under long working hours, making it difficult to ensure product quality. With the progress of society and the improvement of people's quality of life, consumers pay more and more attention to the appearance quality of products. Product quality control is directly related to consumers' reputation for the company and affects the development of the company.

[0003] Existing methods for detecting surface defects of sanitary ceramics are mainly divided into two categories: those based on traditional image processing and those based on deep learning. For example, in the patent entitled "A method and device for detecting surface defects of sanitary ceramics based on deep learning", a method and device for detecting surface defects of sanitary ceramics based on deep learning is disclosed. First, an image data set is obtained, which is a collection of surface images of sanitary ceramics to be detected; and the defect type and the minimum bounding rectangle of the defect of the surface image are annotated to generate an image feature set; then the image feature set is divided into a training set, a validation set, and a test set, and a candidate box is generated according to the minimum bounding rectangle of the defect of the training set; then the candidate box is input into the Faster R-CNN neural network for training to generate a surface defect detection model; finally, the test set is input into the detection model to detect the defect type of the sanitary ceramics to be detected.

[0004] Another example is a ceramic cup defect detection method based on a deep learning algorithm disclosed in a patent titled "A ceramic cup defect detection method based on machine vision", which belongs to the field of machine vision and deep learning. The method includes: pixel-level defect annotation of ceramic product images, and using the original product images and the corresponding annotation information as sample data to obtain the original data set, training set and test set; constructing a defect detection network model based on deep learning; inputting the training set and test set into the constructed defect detection model for training, and after obtaining the complete detection model through parameter fine-tuning, the model completes the task of online detection of ceramic product defects.

[0005] Among them, the bathroom ceramic surface defect detection method based on traditional image methods mainly identifies defects through artificially designed feature operators. It has very strict requirements on imaging conditions, and the artificially designed features are usually not the optimal features, and it is difficult to stably represent the defect features. Therefore, it is not competent for surface detection problems in complex environments; the bathroom ceramic surface defect detection method based on deep learning has better adaptability and accuracy than traditional methods, but the deep learning-based method requires a large amount of training data, and the existing network model is difficult to directly train images at the tens of millions of pixels level as input. Summary of the invention

[0006] One of the main problems solved by the present invention is that the existing deep learning-based bathroom ceramic surface defect detection method requires a large amount of training data, and it is difficult for the existing network to directly use high-resolution images as input for model training.

[0007] According to one aspect of the present invention, the present invention provides a two-stage bathroom ceramic surface defect detection method based on deep learning, the two-stage bathroom ceramic surface defect detection method comprising:

[0008] Dividing the original annotated file annotated with target defect information into a first annotated data set and a second annotated data set;

[0009] Gridding and cropping the images in the second annotated data set, filtering out images containing only the background, and obtaining a defect image data set;

[0010] Based on the original annotation file and the coordinate offset value of the target defect relative to the original image, the annotation file corresponding to the defect image is obtained to form an annotated defect image dataset;

[0011] Dividing the first labeled data set into a first training set and a first validation set, and performing iterative training based on a deep network until an artifact recognition model is obtained;

[0012] Dividing the labeled defect image data set into a second training set and a second validation set, and performing iterative training based on a deep network until a defect detection model is obtained;

[0013] The image to be tested is scaled and input into the workpiece recognition model, and the output recognition result is trimmed to obtain a workpiece area image;

[0014] The workpiece area image is scaled, and the scaled image is input into the defect detection model for detection, and the defect detection result is output.

[0015] Furthermore, the images in the second annotated data set are gridded and cropped, and images containing only the background are filtered out to obtain a defect image data set, including the steps of:

[0016] Dividing the images in the second annotated data set into grids of a preset size;

[0017] Taking one corner of the image in the second annotated data set as the coordinate origin, the length direction of the image is the x-axis, and the width direction is the y-axis. The defects in the grid-divided image are indexed and sorted according to the x-axis direction using the second annotated data set, and the defects are cropped in sequence according to the size of the x-axis coordinate. After the grid area defect is cropped, the defect is deleted from the index. The cropping step is repeated until there are no defects in the index, and the images containing only the background are filtered out to obtain a defect image data set.

[0018] Furthermore, gridding and cropping the images in the second labeled data set further includes:

[0019] When the grid crosses the border area of ​​the image, the grid coordinates are corrected.

[0020] Furthermore, gridding and cropping the images in the second labeled data set further includes:

[0021] When a single grid contains only one defective target, the image area corresponding to the grid is directly cropped.

[0022] Furthermore, gridding and cropping the images in the second labeled data set further includes:

[0023] When the coordinates of the upper left corner of the defect target are within the grid, but the coordinates of the lower right corner are not within the grid, the image is re-gridded with the coordinates of the lower right corner as the origin so that the defect target is completely contained in the grid, and the grid containing the complete defect target is trimmed.

[0024] Furthermore, after the image is re-gridified, if a single cropped grid contains partial areas of multiple defective targets, the grid size is adjusted and then re-cropped to obtain a grid image containing at least one complete defective target.

[0025] Furthermore, when the sizes of the grids after the order is adjusted are adjusted, if the sizes of some grids do not meet the preset sizes, these grids are filled with zeros.

[0026] According to another aspect of the present invention, a deep learning-based two-stage bathroom ceramic surface defect detection device is also disclosed, the two-stage bathroom ceramic surface defect detection device comprising a memory, a processor, and a deep learning-based two-stage bathroom ceramic surface defect detection program stored in the memory and executable on the processor, the deep learning-based two-stage bathroom ceramic surface defect detection program implementing the steps of the deep learning-based two-stage bathroom ceramic surface defect detection method as described in any of the preceding items when executed by the processor.

[0027] The present invention proposes a two-stage bathroom ceramic defect detection method and equipment based on deep learning. The method specifically trains a workpiece area recognition model and a defect detection model based on a deep network model, and first identifies and crops the workpiece area of ​​the acquired image to filter out the background, and then performs defect detection on the workpiece area image to identify and locate the defect type. This two-stage deep learning method can effectively suppress the interference of background information on the detection results, and can improve the detection speed to meet the accuracy and speed requirements of industrial field applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The accompanying drawings, which constitute a part of the specification, illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention.

[0029] Figure 1 Schematic diagram of the overall process of the method for detecting surface defects of sanitary ceramics in an embodiment of the present invention.

[0030] Figure 2 Schematic diagram of the model detection process in an embodiment of the present invention. DETAILED DESCRIPTION

[0031] Various exemplary embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. It should be noted that unless otherwise specifically stated, the relative arrangement of components and steps, numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present invention.

[0032] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.

[0033] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.

[0034] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings.

[0035] Technologies, methods, and apparatus known to ordinary technicians in the relevant field may not be discussed in detail, but where appropriate, such technologies, methods, and apparatus should be considered part of the authorization specification.

[0036] In all examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limiting. Therefore, other examples of the exemplary embodiments may have different values.

[0037] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0038] Embodiment 1 discloses a two-stage bathroom ceramic surface image defect detection method based on deep learning. In order to realize the defect detection of bathroom ceramic surface images, it is first necessary to collect and produce the original data set, then use the processed original data set to train the model, and finally use the trained model to detect the target to be tested.

[0039] Use a high-pixel camera, such as a 12-megapixel RGB camera, to take pictures of the surface of the sanitary ceramics to be tested. The acquired image data is divided into two data sets. Data set 1 is used to train the network model for identifying the workpiece area, and data set 2 is used to train the network model for defect recognition.

[0040] For dataset 1, labelimg is used to annotate the workpieces in the collected images to obtain the annotation file corresponding to the image. The main information contained in the annotation file is the defect type information and coordinate information. Since the original image can be regarded as a two-dimensional data, the annotated defect is a rectangular box containing two-dimensional coordinate information.

[0041] For data set 2, since the size of the original collected images is 4000x3000, images of this size are not suitable for model training. Therefore, under normal circumstances, the original collected images are first labeled using the aforementioned labelimg, and then the 4000x3000 images are cropped into several image files of size 640x640.

[0042] Since the defect areas are randomly distributed when the original image is cropped, the method of using a 640x640 fixed window and moving it at a step size of 640 cannot adapt to the diversity of defects. The defects in the cropped image may be truncated or the defect areas may lack corresponding annotations.

[0043] Therefore, in this embodiment, a new image adaptive cropping method is applied, wherein the method is specifically implemented by a python program script, and the specific method is:

[0044] Step 1: Divide the bathroom ceramics picture with an original size of 4000x3000 into a grid of 640x640. Other suitable grid sizes can also be selected here.

[0045] In some embodiments, when a grid crosses a boundary, the grid coordinates are corrected. For example, the original grid upper left corner coordinates are (3840, 0), and the lower right corner coordinates are (4480, 640), which are now adjusted to (3360, 0), and the lower right corner coordinates are (4000, 640).

[0046] Step 2: Take the upper left corner of the original image as the coordinate origin, the length direction as the x-axis, and the width direction as the y-axis. Use the annotation file of the original image to index and sort the defects in the image along the x-axis, and crop them in sequence according to the size of the coordinates of the defects on the x-axis. After the defect and the grid area where it is located are cropped, delete the defect from the index until there are no defects in the index. Finally, filter out the images containing only the background to obtain the required defect image dataset.

[0047] In this step, any other corner of the original image can be used as the coordinate origin, and only corresponding coordinate changes need to be made.

[0048] During the cutting process in step 2:

[0049] 1. If a single grid contains only one defective target, the image area corresponding to the grid is directly cropped;

[0050] 2. If the upper left corner of the defect target is within the grid, but the coordinates of the lower right corner are not within the grid, the grid is re-divided into a new size based on the coordinates of the lower right corner, so that the defect target is completely contained in the grid, and the image area corresponding to the grid is cropped;

[0051] 3. If a single grid contains multiple defective targets, and some of the defective targets meet the conditions described in Case 2, the positions of the grids are adjusted in sequence according to the method described in Case 2, so that all defective targets are completely contained in the grid, and the area corresponding to the grid is cropped;

[0052] 4. If the situation described in case 3 cannot be fully met, there is no grid that can contain all defect targets, that is, for a picture with multiple defects, according to the current division method, it is impossible to use a 640x640 grid to completely contain all defects. There may be several defects that cannot be completely contained, but can only be partially contained. This situation is not suitable for subsequent detection work. According to the order of grid adjustment, when the position of the grid cannot be adjusted, the size of the current grid is adjusted to only contain the defect targets that have been adjusted.

[0053] In case 4, the area where the grid is less than 640x640 is filled with zeros.

[0054] Step 3: For the cropped image, use the original annotation file information, the coordinate relationship between the cropped image and the original image to re-annotate the cropped defect image dataset, and obtain the final annotated defect image dataset as the new dataset 2.

[0055] After obtaining the labeled data set, start model training.

[0056] After obtaining the labeled data set 1 and the new data set 2, the data sets need to be used to train the model. Since both workpiece area recognition and defect area recognition can be regarded as an application of target detection, but there are differences in the objects to be detected, the single-stage target detection network YOLOv5 network is used for training. The loss function consists of three parts: classification loss, confidence loss, and bounding regression box loss. The classification loss and confidence loss use the cross entropy loss function, and the bounding regression box uses GIOU Loss. The network parameter update method is the SGD algorithm with momentum.

[0057] For the workpiece area recognition model, the training parameters are batch-size: 8, learning-rate: 0.01, momentum: 0.937;

[0058] For the defect recognition model, the training parameters are batch-size: 64, learning-rate: 0.001, and momentum: 0.937.

[0059] The detailed process of using the two obtained data sets to input the network model for training is as follows: Figure 1 As shown, the steps include:

[0060] 1. The obtained data sets are divided into training set and validation set in a ratio of 9:1;

[0061] 2. Input batch images from the training set according to the batch-size size;

[0062] 3. Load the pre-trained model and use the deep network to extract features from the processed input image and calculate the loss function;

[0063] 4. Calculate the performance of the training model on the validation set. If the performance of the current model is better than that of the historical model, keep the current model.

[0064] 5. When the training reaches a preset number of iterations, 300 times is selected as the preset number of iterations in the embodiment of the present invention, and the optimal workpiece region recognition model and defect detection model obtained through training are output respectively.

[0065] After obtaining the trained workpiece area recognition model and defect detection model, a two-stage detection of surface defects of sanitary ceramic products can be performed based on the above models.

[0066] like Figure 2 As shown, the specific detection steps are:

[0067] The RGB camera collects the original image. The 12-megapixel camera fixed on the bracket is used to collect images of the workpiece to be inspected to obtain the original image.

[0068] Workpiece area recognition. Since the original image obtained by the RGB camera contains a large number of background areas, these background areas will not only reduce the efficiency of subsequent processing, but also affect the recognition results. Therefore, the defective areas in the original image are first cropped out. Specifically, considering that the features of the workpiece are very obvious and the deep network model has a strong feature extraction capability, the original image is first scaled to 640x640 size and input into the trained workpiece area recognition model to speed up the detection speed of the model, and then the original image is cropped according to the recognition result to obtain the workpiece area image.

[0069] Defective area detection. Since the sizes of different workpieces are different, the sizes of the workpiece area images cropped in the previous step are not the same. Therefore, the size of the cropped images must be unified first. Combined with the target box size annotated in Dataset 1 and the experimental results at different zoom scales, the image size is determined to be 1600x1600. The scaled image is then passed into the defect detection model, and features are continuously extracted through a deep convolutional neural network. Feature fusion between different levels is achieved through cross-layer connections, the features of the defect target to be detected are enhanced, and finally defects are detected on the fused multi-scale feature layer, and the detection results are output.

[0070] Labeling of test results. Since the offset coordinates of the workpiece area image relative to the original image can be obtained in the workpiece area recognition step, and the scaling ratio of the workpiece area image and the offset coordinates of the output test results relative to the workpiece area image can be obtained in the defect area detection step, the offset coordinates of the test results relative to the original image can be inversely solved and labeled.

[0071] In some embodiments, the data set 1 of the first embodiment and the new data set 2 may be integrated, and only one network model may be trained using the integrated data to complete the workpiece area recognition and defect detection tasks, while ensuring that the existing detection steps do not change.

[0072] In some embodiments, the resolution of the camera may be further improved to achieve better imaging effects for small target defects.

[0073] According to the second aspect of the present application, the present invention also provides a two-stage bathroom ceramic surface defect detection method and device based on deep learning. The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the bathroom ceramic surface defect detection method based on deep learning described in the embodiment of the first aspect is implemented.

[0074] The two-stage bathroom ceramic surface defect detection method and device based on deep learning can be run on computing devices such as desktop computers, notebooks, PDAs, and cloud servers. The two-stage bathroom ceramic surface defect detection method and device based on deep learning can be run on devices including, but not limited to, processors and memories.

[0075] Those skilled in the art will understand that the examples are merely examples of the two-stage bathroom ceramic surface defect detection method and device based on deep learning, and do not constitute a limitation of the two-stage bathroom ceramic surface defect detection method and device based on deep learning. The method and device may include more or fewer components than the examples, or a combination of certain components, or different components. For example, the two-stage bathroom ceramic surface defect detection method and device based on deep learning may also include input and output devices, network access devices, buses, etc.

[0076] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the deep learning-based bathroom ceramic surface defect detection device, and uses various interfaces and lines to connect the various parts of the entire deep learning-based dual-stage bathroom ceramic surface defect detection method and device operable device.

[0077] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the dual-stage bathroom ceramic surface defect detection method and device based on deep learning by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, a picture playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc.

[0078] In addition, the memory may include high-speed random access memory and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart-Media-Card, SMC), a secure digital (Secure-Digital, SD) card, a flash card (Flash-Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0079] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

[0080] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

Claims

1. A two-stage bathroom ceramic surface defect detection method based on deep learning, characterized in that: The dual-stage bathroom ceramic surface defect detection method comprises: Dividing the original annotated file annotated with target defect information into a first annotated data set and a second annotated data set; Gridding and cropping the images in the second annotated data set, filtering out images containing only the background, and obtaining a defect image data set; Based on the original annotation file and the coordinate offset value of the target defect relative to the original image, the annotation file corresponding to the defect image is obtained to form an annotated defect image data set; Dividing the first labeled data set into a first training set and a first validation set, and performing iterative training based on a deep network until an artifact recognition model is obtained; Dividing the labeled defect image data set into a second training set and a second validation set, and performing iterative training based on a deep network until a defect detection model is obtained; The image to be tested is scaled and input into the workpiece recognition model, and the output recognition result is trimmed to obtain a workpiece area image; The workpiece area image is scaled, and the scaled image is input into the defect detection model for detection, and the defect detection result is output.

2. A two-stage bathroom ceramic surface defect detection method based on deep learning as claimed in claim 1, characterized in that: The images in the second annotated data set are grid-divided and cropped, and images containing only the background are filtered out to obtain a defect image data set, including the following steps: Dividing the images in the second annotated data set into grids of a preset size; Taking a corner of the image in the second annotated data set as the coordinate origin, the length direction of the image is the x-axis, and the width direction is the y-axis. The defects in the grid-divided image are indexed and sorted according to the x-axis direction using the second annotated data set, and the defects are cropped in sequence according to the size of the x-axis coordinate. After the grid area defect is cropped, the defect is deleted from the index, and the cropping step is repeated until there are no defects in the index, thereby filtering out the image containing only the background and obtaining a defect image data set.

3. A two-stage bathroom ceramic surface defect detection method based on deep learning as claimed in claim 1, characterized in that: Gridding and cropping the pictures in the second labeled data set further includes: When the grid crosses the border area of ​​the image, the grid coordinates are corrected.

4. A two-stage bathroom ceramic surface defect detection method based on deep learning as claimed in claim 1, characterized in that: Gridding and cropping the pictures in the second labeled data set further includes: When a single grid contains only one defective target, the image area corresponding to the grid is directly cropped.

5. A two-stage bathroom ceramic surface defect detection method based on deep learning as claimed in claim 1, characterized in that: Gridding and cropping the pictures in the second labeled data set further includes: When the coordinates of the upper left corner of the defect target are within the grid, but the coordinates of the lower right corner are not within the grid, the image is re-gridded with the coordinates of the lower right corner as the origin so that the defect target is completely contained in the grid, and the grid containing the complete defect target is trimmed.

6. A two-stage bathroom ceramic surface defect detection method based on deep learning as claimed in claim 5, characterized in that: After the image is re-gridified, if a single cropped grid contains partial areas of multiple defective targets, the grid size is adjusted and re-cropped to obtain a grid image containing at least one complete defective target.

7. A two-stage bathroom ceramic surface defect detection method based on deep learning as claimed in claim 6, characterized in that: When adjusting the size of the grids after the order is adjusted, if the sizes of some grids do not meet the preset sizes, these grids are filled with zeros.

8. A two-stage bathroom ceramic surface defect detection device based on deep learning, characterized in that: The dual-stage bathroom ceramic surface defect detection device includes a memory, a processor, and a deep learning-based dual-stage bathroom ceramic surface defect detection program stored in the memory and executable on the processor. When the deep learning-based dual-stage bathroom ceramic surface defect detection program is executed by the processor, the steps of the deep learning-based dual-stage bathroom ceramic surface defect detection method described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Metal shaft surface defect identification method based on deep learning

    CN109829907A

  • Optical fiber end face defect detection method and device and storage medium

    CN112950561A