Optical glass edge defect detection method and system
By installing multiple digital optical imaging devices on the edge of the optical glass, combining the self-attention mechanism and a fully connected neural network, comprehensive and accurate detection of the edge defects of the optical glass is achieved, solving the problems of time-consuming and labor-intensive manual detection and limited detection range.
Patent Information
- Application Number
- CN202510059386.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2045-01-15
AI Technical Summary
The existing optical glass defect detection mainly relies on manual labor, which is time-consuming and labor-intensive, and there is no objective judgment standard. It is difficult to fully detect the surroundings of the edges of optical glass based on computer vision.
Four digital optical imaging devices are used to detect the optical glass around it. The adsorption device suspends the optical glass, and four edge images are acquired and grayscaled and segmented to generate the target image. Then the target image is spliced in the horizontal direction, the feature vectors in the vertical direction are extracted, and the defect confidence is calculated using the self-attention mechanism and the fully connected neural network to determine whether there is an edge defect.
The objective and quantitative detection of edge defects of optical glass is achieved, which solves the time-consuming and labor-intensive problem of manual inspection. Through the coordinated detection of multiple camera devices, the surrounding edges of optical glass can be comprehensively evaluated, improving the accuracy and automation of detection.
Smart Images

Figure CN119941690A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of optical glass detection, and in particular to an optical glass edge defect detection method and system. Background Art
[0002] With the development of society, optical glass has been widely used in many industries, and industrial demand has gradually increased. Since the traditional production model can no longer meet the growing industrial demand, the automated production model has gradually replaced the traditional production model.
[0003] However, currently, the detection of optical glass defects mainly relies on manual inspection, which judges optical glass defects based on the experience and eyesight of the inspectors. This method is time-consuming and labor-intensive, relies on the experience of the inspectors, and has no objective judgment criteria. In addition, when performing defect detection on the edge of optical glass based on computer vision, it is necessary to detect the edges of the optical glass all around, while the detection range of a single digital optical camera device is relatively limited, making it difficult to detect the edges of the optical glass all around. Summary of the invention
[0004] In view of the above-mentioned technical deficiencies, the purpose of the present invention is to provide a method and system for detecting optical glass edge defects, aiming to solve the problem that the existing optical glass defect detection mainly relies on manual detection, which is time-consuming and labor-intensive, has no objective judgment criteria, and when the defect detection of the edge of the optical glass is performed based on computer vision, the detection range of a single digital optical camera device is relatively limited, and it is difficult to detect the surrounding areas of the optical glass edge.
[0005] In view of the above problems, the present application provides a method and system for detecting edge defects of optical glass.
[0006] In a first aspect disclosed in the present application, a method for detecting edge defects of optical glass is provided, the method comprising the following steps: Step 1: adsorb the optical glass by an adsorption device, so that the optical glass is suspended horizontally, and four digital optical camera devices are used to obtain four edge images of the optical glass, wherein the four digital optical camera devices are placed on the same horizontal plane as the optical glass and are evenly distributed around the optical glass; Step 2: Grayscale the four optical glass edge images to generate four grayscale images. Segment the four grayscale images using the pre-trained FCN network model to retain only the edge of the optical glass to generate four target images. Step 3: stitch the four target images horizontally to generate a stitched image; Step 4: Extract the pixel grayscale value of each column of the stitched image in the vertical direction and convert it into N feature vectors with a dimension of M, where N is the width of the stitched image and M is the height of the stitched image; Step 5: Perform self-attention mechanism calculation on N feature vectors with dimension M to generate N hidden vectors, and input the N hidden vectors into the pre-trained fully connected neural network model in sequence to generate N defect confidences, where the value range of the defect confidence is (0,1); Step 6: Perform numerical statistics on the N defect confidence levels. If the number of defect confidence levels less than 0.5 among the N defect confidence levels reaches 0.2N, the optical glass is determined to be an unqualified product with edge defects.
[0007] Preferably, the step 2 specifically includes the following steps: Step 2.1: Use formula (1) to perform weighted summation on the values of each pixel in the four optical glass edge images on the three channels of red, green and blue. The result of the weighted summation of each pixel is used as the grayscale value of each pixel to generate four grayscale images, where R is the value on the red channel, G is the value on the green channel, B is the value on the blue channel, and H is the grayscale value: Formula (1); Step 2.2: The four grayscale images are segmented respectively by the pre-trained FCN network model, and the pre-trained FCN network model is used to segment the background part and the edge part of the optical glass in the grayscale image; Step 2.3: Crop and remove the background parts of the four grayscale images, leaving only the edge of the optical glass to generate four target images.
[0008] Preferably, the step 4 specifically includes the following steps: Step 4.1: Extract the pixel grayscale value of the i-th column in the vertical direction of the stitched image , where i=1,2,...,N, is used to indicate the column number; Step 4.2: Convert the pixel grayscale value of each column in the vertical direction of the spliced image into a feature vector with N dimensions and M .
[0009] Preferably, the step 5 specifically includes the following steps: Step 5.1: Calculate the cosine similarity between N feature vectors using formula (2), where j = 1, 2, ..., N, which is used to indicate the column number. To represent vector and The cosine similarity between: Formula (2); Step 5.2: Use formula (3) to perform normalization and generate self-attention scores, where To represent vector and The self-attention score between: Formula (3); Step 5.3: Use formula (4) to perform weighted summation using the self-attention score, where: Used to represent the hidden vector: Formula (4); Step 5.4: N hidden vectors The pre-trained fully connected neural network model is input in sequence, and the fully connected neural network model outputs N defect confidences respectively, wherein the fully connected neural network model includes an input layer, two hidden layers and an output layer.
[0010] The second aspect disclosed in the present application provides an optical glass edge defect detection system, the system is used for the above-mentioned optical glass edge defect detection method, the system comprises: An optical camera module, wherein the optical glass is adsorbed by an adsorption device so that the optical glass is suspended horizontally, and four images of the edge of the optical glass are obtained by using four digital optical camera devices, wherein the four digital optical camera devices are placed on the same horizontal plane as the optical glass and are evenly distributed around the optical glass; A preprocessing module, wherein the preprocessing module is used to perform grayscale processing on the four optical glass edge images respectively to generate four grayscale images, and to perform segmentation processing on the four grayscale images respectively through a pre-trained FCN network model to retain only the optical glass edge portion to generate four target images; A stitching module, wherein the stitching module is used to stitch the four target images in a horizontal direction to generate a stitched image; A conversion module, the conversion module is used to extract the pixel gray value of each column of the spliced image in the vertical direction, and convert it into a feature vector with N dimensions of M, where N is the width of the spliced image and M is the height of the spliced image; A confidence module, which is used to perform self-attention mechanism calculation on N feature vectors with a dimension of M to generate N hidden vectors, and input the N hidden vectors into a pre-trained fully connected neural network model in sequence to generate N defect confidences, where the value range of the defect confidence is (0,1); A determination module is used to perform numerical statistics on N defect confidences. If the number of defect confidences less than 0.5 among the N defect confidences reaches 0.2N, the optical glass is determined to be an unqualified product with edge defects.
[0011] The third aspect disclosed in the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned optical glass edge defect detection method when executing the computer program.
[0012] The fourth aspect disclosed in the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the above-mentioned optical glass edge defect detection method are implemented.
[0013] The fifth aspect disclosed in the present application provides a computer program product, including a computer program or instructions, which implement the steps of the above-mentioned optical glass edge defect detection method when executed by a processor.
[0014] The beneficial effects of the present invention are: (1) It solves the problem that optical glass defect detection currently relies mainly on manual work. It has objective and quantitative judgment standards, which is conducive to accelerating the realization of full-link automated production of optical glass.
[0015] (2) Four digital optical camera devices are evenly distributed around the optical glass and placed on the same horizontal plane as the optical glass to obtain four images of the edge of the optical glass, thereby solving the problem that the detection range of a single digital optical camera device is limited and it is difficult to detect the edges of the optical glass.
[0016] (3) The self-attention mechanism is used to detect defects based on the inherent differences of the optical glass edges, which has high accuracy and low time and space complexity. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 The figure is an overall flow chart of an optical glass edge defect detection method.
[0019] Figure 2 This is an overall structural diagram of an optical glass edge defect detection system. DETAILED DESCRIPTION
[0020] 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.
[0021] like Figure 1 As shown, an embodiment of the present application provides a method for detecting edge defects of optical glass, the method comprising the following steps: Step 1: adsorb the optical glass by an adsorption device, so that the optical glass is suspended horizontally, and four digital optical camera devices are used to obtain four edge images of the optical glass, wherein the four digital optical camera devices are placed on the same horizontal plane as the optical glass and are evenly distributed around the optical glass; Step 2: Grayscale the four optical glass edge images to generate four grayscale images. Segment the four grayscale images using the pre-trained FCN network model to retain only the edge of the optical glass to generate four target images. Step 3: stitch the four target images horizontally to generate a stitched image; Step 4: Extract the pixel grayscale value of each column of the stitched image in the vertical direction and convert it into N feature vectors with a dimension of M, where N is the width of the stitched image and M is the height of the stitched image; Step 5: Perform self-attention mechanism calculation on N feature vectors with dimension M to generate N hidden vectors, and input the N hidden vectors into the pre-trained fully connected neural network model in sequence to generate N defect confidences, where the value range of the defect confidence is (0,1); Step 6: Perform numerical statistics on the N defect confidence levels. If the number of defect confidence levels less than 0.5 among the N defect confidence levels reaches 0.2N, the optical glass is determined to be an unqualified product with edge defects.
[0022] Furthermore, the step 2 specifically includes the following steps: Step 2.1: Use formula (1) to perform weighted summation on the values of each pixel in the four optical glass edge images on the three channels of red, green and blue. The result of the weighted summation of each pixel is used as the grayscale value of each pixel to generate four grayscale images, where R is the value on the red channel, G is the value on the green channel, B is the value on the blue channel, and H is the grayscale value: Formula (1); Step 2.2: The four grayscale images are segmented respectively by the pre-trained FCN network model, and the pre-trained FCN network model is used to segment the background part and the edge part of the optical glass in the grayscale image; Step 2.3: Crop and remove the background parts of the four grayscale images, leaving only the edge of the optical glass to generate four target images.
[0023] Furthermore, the step 4 specifically includes the following steps: Step 4.1: Extract the pixel grayscale value of the i-th column in the vertical direction of the stitched image , where i=1,2,...,N, is used to indicate the column number; Step 4.2: Convert the pixel grayscale value of each column in the vertical direction of the spliced image into a feature vector with N dimensions and M .
[0024] Furthermore, the step 5 specifically includes the following steps: Step 5.1: Calculate the cosine similarity between N feature vectors using formula (2), where j = 1, 2, ..., N, which is used to indicate the column number. To represent vector and The cosine similarity between: Formula (2); Step 5.2: Use formula (3) to perform normalization and generate self-attention scores, where To represent vector and The self-attention score between: Formula (3); Step 5.3: Use formula (4) to perform weighted summation using the self-attention score, where: Used to represent the hidden vector: Formula (4); Step 5.4: N hidden vectors The pre-trained fully connected neural network model is input in sequence, and the fully connected neural network model outputs N defect confidences respectively, wherein the fully connected neural network model includes an input layer, two hidden layers and an output layer.
[0025] Specifically, the training data set of the fully connected neural network model is constructed as follows: four optical glass edge images corresponding to two thousand optical glasses are collected, and the corresponding N hidden vectors are calculated in accordance with steps 2 to 5 respectively, and the hidden vectors corresponding to the positions of the defective parts are manually labeled respectively. The labeling method is one-hot vector labeling, 1 indicates that there is no defect, and 0 indicates that there is no defect. The objective function of the training is the binary cross entropy loss function.
[0026] In summary, the optical glass edge defect detection method provided by the embodiment of the present application has the following technical effects: (1) It solves the problem that optical glass defect detection currently relies mainly on manual work. It has objective and quantitative judgment standards, which is conducive to accelerating the realization of full-link automated production of optical glass.
[0027] (2) Four digital optical camera devices are evenly distributed around the optical glass and placed on the same horizontal plane as the optical glass to obtain four images of the edge of the optical glass, thereby solving the problem that the detection range of a single digital optical camera device is limited and it is difficult to detect the edges of the optical glass.
[0028] (3) The self-attention mechanism is used to detect defects based on the inherent differences of the optical glass edges, which has high accuracy and low time and space complexity.
[0029] Based on the same inventive concept as the optical glass edge defect detection method in the aforementioned embodiment, Figure 2 As shown, the present application provides an optical glass edge defect detection system, the system comprising: An optical camera module, wherein the optical glass is adsorbed by an adsorption device so that the optical glass is suspended horizontally, and four images of the edge of the optical glass are obtained by using four digital optical camera devices, wherein the four digital optical camera devices are placed on the same horizontal plane as the optical glass and are evenly distributed around the optical glass; A preprocessing module, wherein the preprocessing module is used to perform grayscale processing on the four optical glass edge images respectively to generate four grayscale images, and to perform segmentation processing on the four grayscale images respectively through a pre-trained FCN network model to retain only the optical glass edge portion to generate four target images; A stitching module, wherein the stitching module is used to stitch the four target images in a horizontal direction to generate a stitched image; A conversion module, the conversion module is used to extract the pixel gray value of each column of the spliced image in the vertical direction, and convert it into a feature vector with N dimensions of M, where N is the width of the spliced image and M is the height of the spliced image; A confidence module, which is used to perform self-attention mechanism calculation on N feature vectors with a dimension of M to generate N hidden vectors, and input the N hidden vectors into a pre-trained fully connected neural network model in sequence to generate N defect confidences, where the value range of the defect confidence is (0,1); A determination module is used to perform numerical statistics on N defect confidences. If the number of defect confidences less than 0.5 among the N defect confidences reaches 0.2N, the optical glass is determined to be an unqualified product with edge defects.
[0030] Through the above-mentioned detailed description of an optical glass edge defect detection method in this specification, those skilled in the art can clearly understand an optical glass edge defect detection system in this embodiment. Since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0031] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps of the above-mentioned optical glass edge defect detection method when executing the computer program.
[0032] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned optical glass edge defect detection method are implemented.
[0033] In one embodiment, a computer program product is provided, including a computer program or instructions, which implement the steps of the above-mentioned optical glass edge defect detection method when executed by a processor.
[0034] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0035] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for detecting edge defects of optical glass, characterized in that: The method comprises the following steps: Step 1: adsorb the optical glass by an adsorption device, so that the optical glass is suspended horizontally, and four digital optical camera devices are used to obtain four edge images of the optical glass, wherein the four digital optical camera devices are placed on the same horizontal plane as the optical glass and are evenly distributed around the optical glass; Step 2: Grayscale the four optical glass edge images to generate four grayscale images. Segment the four grayscale images using the pre-trained FCN network model to retain only the edge of the optical glass to generate four target images. Step 3: stitch the four target images horizontally to generate a stitched image; Step 4: Extract the pixel grayscale value of each column of the stitched image in the vertical direction and convert it into N feature vectors with a dimension of M, where N is the width of the stitched image and M is the height of the stitched image; Step 5: Perform self-attention mechanism calculation on N feature vectors with dimension M to generate N hidden vectors, and input the N hidden vectors into the pre-trained fully connected neural network model in sequence to generate N defect confidences, where the value range of the defect confidence is (0,1); Step 6: Perform numerical statistics on the N defect confidence levels. If the number of defect confidence levels less than 0.5 among the N defect confidence levels reaches 0.2N, the optical glass is determined to be an unqualified product with edge defects.
2. The optical glass edge defect detection method according to claim 1, characterized in that: The step 2 specifically includes the following steps: Step 2.1: Use formula (1) to perform weighted summation on the values of each pixel in the four optical glass edge images on the three channels of red, green and blue. The result of the weighted summation of each pixel is used as the grayscale value of each pixel to generate four grayscale images, where R is the value on the red channel, G is the value on the green channel, B is the value on the blue channel, and H is the grayscale value: Formula (1); Step 2.2: The four grayscale images are segmented respectively by the pre-trained FCN network model, and the pre-trained FCN network model is used to segment the background part and the edge part of the optical glass in the grayscale image; Step 2.3: Crop and remove the background parts of the four grayscale images, leaving only the edge of the optical glass to generate four target images.
3. The optical glass edge defect detection method according to claim 2, characterized in that: The step 4 specifically comprises the following steps: Step 4.1: Extract the pixel grayscale value of the i-th column in the vertical direction of the stitched image , where i=1,2,...,N, is used to indicate the column number; Step 4.2: Convert the pixel grayscale value of each column in the vertical direction of the spliced image into a feature vector with N dimensions and M .
4. The optical glass edge defect detection method according to claim 3, characterized in that: The step 5 specifically comprises the following steps: Step 5.1: Calculate the cosine similarity between N feature vectors using formula (2), where j = 1, 2, ..., N, which is used to indicate the column number. To represent vector and The cosine similarity between: Formula (2); Step 5.2: Use formula (3) to perform normalization and generate self-attention scores, where To represent vector and The self-attention score between: Formula (3); Step 5.3: Use formula (4) to perform weighted summation using the self-attention score, where: Used to represent the hidden vector: Formula (4); Step 5.4: N hidden vectors The pre-trained fully connected neural network model is input in sequence, and the fully connected neural network model outputs N defect confidences respectively, wherein the fully connected neural network model includes an input layer, two hidden layers and an output layer.
5. An optical glass edge defect detection system, the system comprising: An optical camera module, wherein the optical glass is adsorbed by an adsorption device so that the optical glass is suspended horizontally, and four images of the edge of the optical glass are obtained by using four digital optical camera devices, wherein the four digital optical camera devices are placed on the same horizontal plane as the optical glass and are evenly distributed around the optical glass; A preprocessing module, wherein the preprocessing module is used to perform grayscale processing on the four optical glass edge images respectively to generate four grayscale images, and to perform segmentation processing on the four grayscale images respectively through a pre-trained FCN network model to retain only the optical glass edge portion to generate four target images; A stitching module, wherein the stitching module is used to stitch the four target images in a horizontal direction to generate a stitched image; A conversion module, the conversion module is used to extract the pixel gray value of each column of the spliced image in the vertical direction, and convert it into a feature vector with N dimensions of M, where N is the width of the spliced image and M is the height of the spliced image; A confidence module, which is used to perform self-attention mechanism calculation on N feature vectors with a dimension of M to generate N hidden vectors, and input the N hidden vectors into a pre-trained fully connected neural network model in sequence to generate N defect confidences, where the value range of the defect confidence is (0,1); A determination module is used to perform numerical statistics on N defect confidences. If the number of defect confidences less than 0.5 among the N defect confidences reaches 0.2N, the optical glass is determined to be an unqualified product with edge defects.
6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the optical glass edge defect detection method described in any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of an optical glass edge defect detection method according to any one of claims 1 to 4 are implemented.
8. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of an optical glass edge defect detection method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Glass boundary defect detection method and device, terminal and storage medium
CN110596120A
Glass surface defect detection method and system based on unsupervised pre-training
CN115880298A
Image segmentation method and device applied to photovoltaic glass surface defect detection
CN117788488A
Corrugated board defect detection method, medium and equipment
CN119273677A
System for inspecting edge of glass substrate
KR101019831B1