Glass defect detection method and system, storage medium and electronic equipment
By combining deep learning segmentation models and classifiers, the problems of low efficiency and high subjectivity in glass inspection are solved, realizing automated and high-precision glass defect detection and improving inspection efficiency and accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ANHUI ZHIJIE NEW ENERGY VEHICLE CO LTD
- Filing Date
- 2026-01-30
- Publication Date
- 2026-05-15
AI Technical Summary
Existing technologies for glass inspection are characterized by low efficiency, high subjectivity, and inability to perform quantitative analysis, thus failing to achieve automated and high-precision detection of internal glass defects.
A method combining deep learning segmentation models and classifiers is adopted. By acquiring transmission images of glass, defect features are enhanced and noise is suppressed. Binary segmentation and morphological processing are performed to extract defect feature parameters. Finally, a classifier is used to identify the defect type.
It has achieved full automation of glass defect detection, improved detection efficiency, overcome the subjectivity and instability of manual inspection, and improved the detection rate and classification accuracy of minor defects.
Smart Images

Figure CN122048868A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of glass inspection technology, and in particular to a glass defect detection method and system, storage medium, and electronic device. Background Technology
[0002] As a critical safety and structural component of automobiles, the internal quality of automotive glass directly affects the safety and reliability of the entire vehicle. During the glass manufacturing process, improper control of processes such as melting and forming can lead to the formation of air bubbles or the inclusion of solid impurities within the glass. These defects not only affect the glass's aesthetics and optical properties, but more importantly, they can create stress concentrations within the glass, reducing its mechanical strength. Upon impact, this can cause the glass to crack, posing a serious safety hazard.
[0003] Currently, the industry primarily relies on manual visual inspection for detecting internal defects in glass. Operators, under specific lighting conditions, judge the presence of abnormalities within the glass based on their naked eyes and experience. This method has significant drawbacks: First, manual inspection is inefficient and cannot keep pace with the high speed of modern production lines, becoming a bottleneck in production. Second, the inspection results are highly subjective, depending heavily on the operator's experience, focus, and mental state, leading to inconsistent inspection standards, poor stability, and a high risk of missed detections and misjudgments. Finally, the human eye has limited ability to identify minute, low-contrast defects, and it is impossible to achieve quantitative and digital recording and analysis of defects, hindering quality traceability and process improvement.
[0004] With the advancement of intelligent manufacturing in industry, the demand for automated and intelligent quality inspection in the automotive parts industry is becoming increasingly urgent. Therefore, developing an automated, high-precision, non-contact method for detecting internal defects in glass is of great significance for improving product quality, increasing production efficiency, and reducing labor costs. Summary of the Invention
[0005] The purpose of this invention is to overcome the shortcomings of existing glass inspection methods, such as low detection efficiency, high subjectivity, and inability to perform quantitative analysis, and to provide a glass defect detection method and system, storage medium, and electronic device.
[0006] The technical solution of the present invention provides a method for detecting glass defects, comprising:
[0007] Acquire the first transmission image of the glass under test under uniform backlighting conditions; The first transmission image is processed to enhance defect features and suppress noise, resulting in an optimized image. The optimized image is input into a preset deep learning segmentation model, which outputs a binary segmentation image, where white areas represent suspected defects. Morphological processing and feature calculation are performed on the binary segmentation image to extract feature parameters representing defects; Based on the aforementioned feature parameters, a classifier is used to identify the defect type and obtain glass defect information. The glass defect information includes defect type, location coordinates, and size information. The glass defect types include bubble defects and impurity defects.
[0008] Further, the process of enhancing defect features and suppressing noise in the transmitted image to obtain an optimized image includes: Remove the Gaussian noise from the first transmission image to obtain the second transmission image; A contrast-limited adaptive histogram equalization method is used to enhance the local contrast of the second transmission image to obtain a third transmission image; The optimized image is obtained by binarizing the third transmission image using the Otsu threshold segmentation method.
[0009] Furthermore, the deep learning segmentation model is obtained through the following steps: Construct a semantic segmentation network; Obtain a set of labeled historical glass defect images; The historical glass defect image set is input into the semantic segmentation network for training using an adaptive moment estimation optimizer and a binary cross-entropy loss function to obtain the deep learning segmentation model.
[0010] Furthermore, the morphological processing and feature calculation of the binary segmentation image to extract feature parameters representing defects includes: Morphological closure operation is performed on the suspected defective region; Connect the suspected defective areas and mark the independent defective areas; Calculate the geometric features and grayscale features of each independent defect region to obtain the feature parameters. The geometric features include area, perimeter, and circularity. The grayscale features include the mean and contrast of pixels within the defect region.
[0011] Furthermore, the step of using a classifier to determine the defect type based on the feature parameters to obtain glass defect information includes: The feature parameters are constructed into a feature vector; The feature vector is input into a preset vector classifier model to obtain the glass defect information.
[0012] Furthermore, the vector classifier model is obtained through the following steps: Construct a support vector machine classifier; Obtain a set of labeled historical glass defect images; The set of historical glass defect images is input into the classifier for training to obtain the vector classifier model.
[0013] The technical solution of the present invention also provides a glass defect detection system, comprising: The first transmission image acquisition unit is used to acquire the first transmission image of the glass under test under uniform backlight conditions. The preprocessing unit is used to enhance defect features and suppress noise in the first transmission image to obtain an optimized image; The defect segmentation unit is used to input the optimized image into a preset deep learning segmentation model and output a binary segmentation map, in which the white area represents a suspected defect; The feature extraction unit is used to perform morphological processing and feature calculation on the binary segmentation image to extract feature parameters that characterize defects; The defect discrimination unit is used to discriminate the defect type based on the feature parameters using a classifier to obtain glass defect information. The glass defect information includes defect type, location coordinates, and size information. The glass defect type includes bubble defects and impurity defects.
[0014] Furthermore, the deep learning segmentation model is obtained through the following steps: Construct a semantic segmentation network; Obtain a set of labeled historical glass defect images; The historical glass defect image set is input into the semantic segmentation network for training using an adaptive moment estimation optimizer and a binary cross-entropy loss function to obtain the deep learning segmentation model.
[0015] The present invention also provides a computer-readable storage medium that stores computer instructions, which, when executed by a computer, are used to perform all the steps of the glass defect detection method described above.
[0016] The present invention also provides an electronic device, comprising: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the glass defect detection method as described above.
[0017] The above technical solution has the following beneficial effects: By acquiring the first transmission image of the glass under uniform backlighting, enhancing defect features and suppressing noise in the first transmission image to obtain an optimized image, the optimized image is input into a preset deep learning segmentation model to output a binary segmentation map. Morphological processing and feature calculation are performed on the binary segmentation map to extract feature parameters representing defects. Based on the feature parameters, a classifier is used to distinguish the defect type to obtain glass defect information, thereby realizing the full automation of glass defect detection, significantly improving detection efficiency and meeting the needs of online detection. Furthermore, by combining deep learning segmentation with traditional feature classification, the subjectivity and instability of manual detection are overcome, resulting in a high detection rate and classification accuracy for minute defects. Attached Figure Description
[0018] The disclosure of this invention will become more readily understood by referring to the accompanying drawings. It should be understood that these drawings are for illustrative purposes only and are not intended to limit the scope of protection of this invention. In the drawings: Figure 1 A flowchart illustrating a glass defect detection method according to an embodiment of the present invention; Figure 2 This is a schematic diagram of a glass defect detection system according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the hardware structure of an electronic device for glass defect detection according to an embodiment of the present invention. Detailed Implementation
[0019] The specific embodiments of the present invention will be further described below with reference to the accompanying drawings.
[0020] It is readily understood that, based on the technical solution of this invention, various structural and implementation methods can be interchanged by those skilled in the art without altering the essential spirit of the invention. Therefore, the following detailed embodiments and accompanying drawings are merely illustrative examples of the technical solution of this invention and should not be considered as the entirety of the invention or as limitations or restrictions on the technical solution of the invention.
[0021] The directional terms such as up, down, left, right, front, back, front, back, top, and bottom mentioned or possibly used in this specification are defined relative to the structures shown in the accompanying drawings. They are relative concepts and may therefore vary depending on their location and usage. Therefore, these or other directional terms should not be interpreted as restrictive.
[0022] like Figure 1 As shown, an embodiment of the present invention provides a glass defect detection method, comprising: Step S101: Acquire the first transmission image of the glass under test under uniform backlighting conditions; Step S102: Enhance defect features and suppress noise in the first transmission image to obtain an optimized image; Step S103: Input the optimized image into a preset deep learning segmentation model and output a binary segmentation map, where the white area represents a suspected defect; Step S104: Perform morphological processing and feature calculation on the binary segmentation image to extract feature parameters representing defects; Step S105: Based on the feature parameters, a classifier is used to identify the defect type to obtain glass defect information. The glass defect information includes defect type, location coordinates, and size information. The glass defect type includes bubble defects and impurity defects.
[0023] Specifically, this invention is mainly applied to glass inspection, such as the inspection of automotive glass. The following description will use automotive glass inspection as an example.
[0024] After the automotive glass is produced, when it needs to be tested, step S101 is first executed to obtain the first transmission image of the glass under uniform backlight conditions. Specifically, a dark chamber is constructed, with its interior coated with a light-absorbing material to reduce stray light reflection. The glass sample to be tested is fixed on a stage inside the dark chamber. An LED planar light source is installed approximately 50 cm behind the sample, and a 12-megapixel monochrome industrial camera is positioned approximately 80 cm in front of the sample. The camera's focal length, aperture, and exposure time are adjusted to ensure that the acquired transmissive image of the glass has moderate brightness, without overexposed or underexposed areas. Under these conditions, bubbles appear as dark, nearly circular spots due to refraction and scattering of light, while impurities appear as irregularly shaped dark areas due to absorption or scattering of light.
[0025] Next, step S102 is performed to enhance defect features and suppress noise in the first transmission image to obtain an optimized image; In one embodiment, step S102 includes: Remove the Gaussian noise from the first transmission image to obtain the second transmission image; A contrast-limited adaptive histogram equalization method is used to enhance the local contrast of the second transmission image to obtain a third transmission image; The optimized image is obtained by binarizing the third transmission image using the Otsu threshold segmentation method.
[0026] Specifically, Gaussian filtering is used for noise reduction. A 5×5 Gaussian kernel is used to convolve the original image to suppress Gaussian noise introduced by the image sensor, resulting in a smooth image. Then, Contrast-Limited Adaptive Histogram Equalization (CLAHE) is used to enhance the contrast of local regions. The cropping limit is set to 2.0, and the grid size is 8×8 to make the defect edges clearer. Finally, the Otsu method is used to automatically calculate the optimal global threshold, converting the contrast-enhanced image into a binary image, where black pixels represent the background and white pixels represent the initially selected foreground.
[0027] Next, step S103 is executed, in which the optimized image is input into a preset deep learning segmentation model, and a binary segmentation image is output. Specifically, a pre-trained deep learning segmentation network (e.g., U-Net) model is used for segmentation. During detection, the pre-processed binary image is scaled to 256×256 pixels, normalized, and then input into the trained model to obtain a pixel-level binary segmentation map, where the white areas are the identified suspected defect areas.
[0028] In one embodiment, the deep learning segmentation model is obtained using the following steps: Construct a semantic segmentation network; Obtain a set of labeled historical glass defect images; The historical glass defect image set is input into the semantic segmentation network for training using an adaptive moment estimation optimizer and a binary cross-entropy loss function to obtain the deep learning segmentation model.
[0029] Specifically, glass transmission images containing various bubbles and impurities are collected, pixel-level annotations are performed to generate binary mask labels, and the historical glass defect image set is divided into training, validation, and test sets in an 8:1:1 ratio. A semantic segmentation network (such as U-Net) is built using the PyTorch framework, trained with an Adaptive Moment Estimation Optimizer (Adam) and a binary cross-entropy loss function, and its performance is monitored on the validation set. Training continues until the loss function converges, resulting in a deep learning segmentation model.
[0030] Then, step S104 is performed to perform morphological processing and feature calculation on the binary segmentation image to extract feature parameters representing defects; In one embodiment, the morphological processing and feature calculation of the binary segmentation map to extract feature parameters representing defects includes: Morphological closure operation is performed on the suspected defective region; Connect the suspected defective areas and mark the independent defective areas; Calculate the geometric features and grayscale features of each independent defect region to obtain the feature parameters. The geometric features include area, perimeter, and circularity. The grayscale features include the mean and contrast of pixels within the defect region.
[0031] Specifically, a morphological closing operation (using a 3×3 ellipse as the structuring element) is performed on the binary segmentation image to fill in any small holes that may exist in the segmented defect region and connect adjacent micro-regions to smooth the defect boundaries. Then, connected component analysis is performed on the closed image to identify independent defect regions, and the feature parameters of each independent defect region are calculated. Area S: The total number of pixels in the region.
[0032] Perimeter L: The total number of pixels at the boundary of the region.
[0033] Circularity: The calculation formula is as follows It is used to measure how close a region is to a circle.
[0034] Gray-scale mean: Calculates the average gray-scale value of pixels within a region on the enhanced image.
[0035] Contrast ratio: Calculates the standard deviation of gray levels of pixels within a region. The standard deviation of gray levels can reflect the degree of drastic change in gray levels within the region.
[0036] Finally, step S105 is executed to determine the defect type based on the feature parameters using a classifier, thereby obtaining glass defect information.
[0037] In some embodiments, step S105 includes: The feature parameters are constructed into a feature vector; The feature vector is input into a preset vector classifier model to obtain the glass defect information.
[0038] Specifically, the area, perimeter, circularity, mean grayscale value, and contrast of each defect region are combined into a five-dimensional feature vector. A Support Vector Machine (SVM) classifier with radial basis function kernels is used for training on the labeled feature vector dataset. The feature vector to be classified is input into the trained SVM model to obtain glass defect information, including defect type, location coordinates (such as center point coordinates), and size information (such as area, length and width of the circumscribed rectangle). Glass defect types include bubble defects and impurity defects. Preferably, the information on each glass defect can be integrated into a JSON object for output, visualized in the user interface in the form of tables and / or images, generating an inspection report and storing it.
[0039] In some embodiments, the vector classifier model is obtained through the following steps: Construct a support vector machine classifier; Obtain a set of labeled historical glass defect images; The set of historical glass defect images is input into the classifier for training to obtain the vector classifier model.
[0040] This invention acquires a first transmission image of the glass under uniform backlighting, enhances defect features and suppresses noise in the first transmission image to obtain an optimized image, inputs the optimized image into a preset deep learning segmentation model, outputs a binary segmentation map, performs morphological processing and feature calculation on the binary segmentation map to extract feature parameters characterizing defects, and uses a classifier to determine the defect type based on the feature parameters to obtain glass defect information. This achieves fully automated glass defect detection, significantly improves detection efficiency, and meets online detection requirements. Furthermore, by combining deep learning segmentation with traditional feature classification, it overcomes the subjectivity and instability of manual detection, achieving high detection rate and classification accuracy for minute defects.
[0041] like Figure 2 As shown, an embodiment of the present invention provides a glass defect detection system, comprising: The first transmission image acquisition unit 201 is used to acquire the first transmission image of the glass under test under uniform backlight conditions. Preprocessing unit 202 is used to enhance defect features and suppress noise in the first transmission image to obtain an optimized image; The defect segmentation unit 203 is used to input the optimized image into a preset deep learning segmentation model and output a binary segmentation map, wherein the white area represents a suspected defect; Feature extraction unit 204 is used to perform morphological processing and feature calculation on the binary segmentation image to extract feature parameters that characterize defects; The defect discrimination unit 205 is used to discriminate the defect type based on the feature parameters using a classifier to obtain glass defect information. The glass defect information includes defect type, location coordinates and size information. The glass defect type includes bubble defects and impurity defects.
[0042] In one embodiment, the deep learning segmentation model is obtained using the following steps: Construct a semantic segmentation network; Obtain a set of labeled historical glass defect images; The historical glass defect image set is input into the semantic segmentation network for training using an adaptive moment estimation optimizer and a binary cross-entropy loss function to obtain the deep learning segmentation model.
[0043] One embodiment of the present invention provides a computer-readable storage medium for storing computer instructions, which, when executed by a computer, are used to perform all the steps of the glass defect detection method as described in any of the above method embodiments.
[0044] like Figure 3 As shown, a hardware structure diagram of an electronic device for glass defect detection according to an embodiment of the present invention includes: At least one processor 301; and, Memory 302 is communicatively connected to at least one processor 301; wherein, The memory 302 stores instructions that can be executed by at least one processor 301, which enables the at least one processor 301 to perform the glass defect detection method as described in any of the above method embodiments.
[0045] Figure 3 Take processor 301 as an example.
[0046] The electronic device is preferably an electronic control unit (ECU).
[0047] The electronic device may also include an input device 303 and an output device 304.
[0048] The processor 301, memory 302, input device 303 and output device 304 can be connected by a bus or other means. The figure shows an example of connection by bus.
[0049] The memory 302, as a non-volatile computer-readable storage medium, can be used to obtain non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules corresponding to the glass defect detection method in the embodiments of this application, for example, Figure 1 The method flow is shown. The processor 301 executes various functional applications and data processing by running non-volatile software programs, instructions, and modules acquired in the memory 302, thereby realizing the glass defect detection method in the above embodiments.
[0050] The memory 302 may include an acquisition program area and an acquisition data area, wherein the acquisition program area may acquire an operating system and an application program required for at least one function; the acquisition data area may acquire data created based on the use of the glass defect detection method, etc. Furthermore, the memory 302 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 302 may optionally include memory remotely located relative to the processor 301, and these remote memories may be connected via a network to the apparatus performing the glass defect detection method. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0051] The input device 303 can receive user clicks and generate signal inputs related to user settings and function control of the glass defect detection method. The output device 304 may include a display device such as a screen.
[0052] When the one or more modules are accessed in the memory 302 and are run by the one or more processors 301, the glass defect detection method in any of the above method embodiments is executed.
[0053] The above-described product can perform the methods provided in the embodiments of this application, and has the corresponding functional modules and beneficial effects for performing the methods. Technical details not described in detail in this embodiment can be found in the methods provided in the embodiments of this application.
[0054] The above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, and are not intended to limit them. Although the embodiments of the present invention have been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting glass defects, characterized in that, include: Acquire the first transmission image of the glass under test under uniform backlighting conditions; The first transmission image is processed to enhance defect features and suppress noise, resulting in an optimized image. The optimized image is input into a preset deep learning segmentation model, which outputs a binary segmentation map, where white areas represent suspected defects. Morphological processing and feature calculation are performed on the binary segmentation image to extract feature parameters representing defects; Based on the aforementioned feature parameters, a classifier is used to identify the defect type and obtain glass defect information. The glass defect information includes defect type, location coordinates, and size information. The glass defect types include bubble defects and impurity defects.
2. The glass defect detection method as described in claim 1, characterized in that, The process of enhancing defect features and suppressing noise in the transmitted image to obtain an optimized image includes: Remove the Gaussian noise from the first transmission image to obtain the second transmission image; A contrast-limited adaptive histogram equalization method is used to enhance the local contrast of the second transmission image to obtain a third transmission image; The optimized image is obtained by binarizing the third transmission image using the Otsu threshold segmentation method.
3. The glass defect detection method as described in claim 1, characterized in that, The deep learning segmentation model is obtained through the following steps: Construct a semantic segmentation network; Obtain a set of labeled historical glass defect images; The historical glass defect image set is input into the semantic segmentation network for training using an adaptive moment estimation optimizer and a binary cross-entropy loss function to obtain the deep learning segmentation model.
4. The glass defect detection method as described in claim 1, characterized in that, The morphological processing and feature calculation of the binary segmentation image to extract feature parameters representing defects includes: Morphological closure operation is performed on the suspected defective region; Connect the suspected defective areas and mark the independent defective areas; Calculate the geometric features and grayscale features of each independent defect region to obtain the feature parameters. The geometric features include area, perimeter, and circularity. The grayscale features include the mean and contrast of pixels within the defect region.
5. The glass defect detection method according to any one of claims 1-4, characterized in that, The step of using a classifier to determine the defect type based on the feature parameters to obtain glass defect information includes: The feature parameters are constructed into a feature vector; The feature vector is input into a preset vector classifier model to obtain the glass defect information.
6. The glass defect detection method as described in claim 5, characterized in that, The vector classifier model is obtained through the following steps: Construct a support vector machine classifier; Obtain a set of labeled historical glass defect images; The set of historical glass defect images is input into the classifier for training to obtain the vector classifier model.
7. A glass defect detection system, characterized in that, include: The first transmission image acquisition unit is used to acquire the first transmission image of the glass under test under uniform backlight conditions. The preprocessing unit is used to enhance defect features and suppress noise in the first transmission image to obtain an optimized image; The defect segmentation unit is used to input the optimized image into a preset deep learning segmentation model and output a binary segmentation map, in which the white area represents a suspected defect; The feature extraction unit is used to perform morphological processing and feature calculation on the binary segmentation image to extract feature parameters that characterize defects; The defect discrimination unit is used to discriminate the defect type based on the feature parameters using a classifier to obtain glass defect information. The glass defect information includes defect type, location coordinates, and size information. The glass defect type includes bubble defects and impurity defects.
8. The glass defect detection system as described in claim 7, characterized in that, The deep learning segmentation model is obtained through the following steps: Construct a semantic segmentation network; Obtain a set of labeled historical glass defect images; The historical glass defect image set is input into the semantic segmentation network for training using an adaptive moment estimation optimizer and a binary cross-entropy loss function to obtain the deep learning segmentation model.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a computer, perform all the steps of the glass defect detection method as described in any one of claims 1-6.
10. An electronic device, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the glass defect detection method as described in any one of claims 1-6.