A glass defect detection method and device based on image recognition
By adaptively adjusting the intensity and angle of the light source, combining pre-trained models and reinforcement learning algorithms, the problem of glass defect detection error in the prior art is solved, and high accuracy detection and defect position recognition of different glass types are achieved.
Patent Information
- Application Number
- CN202411476940.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2044-10-22
AI Technical Summary
The existing glass defect detection technology has caused detection errors due to the complex optical characteristics of glass and different glass parameters. The fixed light source intensity and light angle cannot adapt to different glass types, resulting in confusion of defect types.
By acquiring glass types, adaptively adjusting the light source intensity and light source angle, collecting multiple sets of images and fusing them, dynamically adjusting the light source with pre-trained models and reinforcement learning algorithms to improve detection accuracy.
Highly accurate defect detection of different glass types is achieved, which improves the flexibility and overall accuracy of the detection system, and can quickly identify and accurately locate defect types.
Smart Images

Figure CN119000727B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of glass defect detection, and in particular to a glass defect detection method and device based on image recognition. Background Art
[0002] With the rapid development of the electronics industry, transparent parts such as glass are widely used in various industries. Due to certain factors (temperature, mold, bumps, etc.) during the production and transportation process, transparent parts such as glass will produce various defects, such as scratches, cracks, bubbles, inclusions, stains, white spots, etc. These defects will reduce the transmittance and visibility of transparent parts such as glass, thereby reducing the quality of the product. Therefore, it is particularly necessary to perform defect detection on transparent parts such as glass.
[0003] The existing technology generally uses a fixed-angle light source to aim at the glass piece to be inspected, and then uses an industrial camera to take pictures of the glass piece to be inspected to collect images, and then uses some image recognition algorithms to perform defect detection. However, this detection method has the following problems: glass has complex optical properties, and some defects present similar optical phenomena at a single lighting angle, which makes it easy to detect the wrong defect type during subsequent image detection and recognition.
[0004] In addition, different glass parameters have different requirements for glass inspection. For example, the thickness of the glass will affect the degree of light transmission and reflection. Thicker glass may require a stronger light source intensity to ensure that the light penetrates deep enough. The inspection of transparent glass may require a lower light source intensity and more flexible angle changes to avoid contrast loss caused by excessive transmission. Therefore, different glass parameters require different light source intensities and lighting angles. If fixed light source intensity and lighting angle are used uniformly, some similar defects are easily confused.
[0005] The purpose of the present invention is to design a glass defect detection method and device based on image recognition in view of the above-mentioned problems in the prior art. Summary of the invention
[0006] In view of this, an object of the present invention is to provide a glass defect detection method and device based on image recognition, which can solve the above-mentioned problems.
[0007] The present invention provides a glass defect detection method based on image recognition, comprising:
[0008] Obtain the current glass type to be detected, adaptively adjust the light source intensity and light source angle according to the glass type, obtain multiple groups of light source intensities and light source angles, and collect glass images with different groups of light source intensities and light source angles;
[0009] Fusing glass images with different light source intensities and light source angles to obtain a fused glass image, and inputting the fused glass image into a pre-trained defect recognition model to obtain a first defect type and position of the glass to be detected;
[0010] Selecting a corresponding sensor for detection according to the first defect type and position to obtain a second defect type;
[0011] If the first defect type and the second defect type are the same, the glass defect type is output; otherwise, a reinforcement learning algorithm is used to dynamically adjust the light source intensity and light source angle for detection.
[0012] Further, obtaining the type of glass to be detected currently includes:
[0013] Obtain the refractive index and transmittance of the glass to be tested through instrument testing;
[0014] Calculate the glass thickness by the weight and area of the glass to be tested.
[0015] Furthermore, the calculation formula for calculating the glass thickness by the weight of the glass to be detected and the glass area is as follows:
[0016] T = W / (A × D),
[0017] Among them, T is the glass thickness, W is the glass weight, A is the glass area, and D is the glass density.
[0018] Further, the light source intensity and light source angle are adaptively adjusted according to the glass type to obtain multiple groups of light source intensities and light source angles, and the glass images with different groups of light source intensities and light source angles are collected, including:
[0019] Input the glass type into a pre-trained selection model to obtain multiple sets of light source intensities and light source angles, wherein the light source intensities include: low, medium, and high; the light source angles include: parallel light source, backlight source, and oblique light source, wherein the oblique light source is 0-90°;
[0020] The glass to be inspected is photographed according to multiple groups of light source intensities and light source angles to obtain glass images with different groups of light source intensities and light source angles.
[0021] Furthermore, the selection model is trained through the following steps:
[0022] Collect defect detection data on different types of glass under different light source intensities and angles, the defect detection data including: defect type and detection accuracy, and select data with 100% detection accuracy as detection samples;
[0023] Recording the glass parameters of each test sample, the glass parameters including: refractive index, transmittance, thickness, glass area, and corresponding light source intensity and light source angle settings;
[0024] A selection model is constructed using a multi-layer perceptron, the glass parameters of each detection sample are used as input of the selection model, and the corresponding light source intensity and light source angle settings are used as output to train the selection model to obtain selection model parameters.
[0025] Further, the fusing of glass images with different light source intensities and light source angles to obtain a fused glass image includes:
[0026] Perform multiple Gaussian filtering and downsampling on each glass image to obtain a Gaussian pyramid image with a gradually reduced resolution.
[0027] Upsampling and Gaussian filtering are performed on each layer of the Gaussian pyramid image to obtain an upsampled blurred image and a Gaussian image respectively, and the upsampled blurred image is subtracted from the previous Gaussian image to obtain a difference image to form each layer of the Laplacian pyramid image until a Laplacian pyramid image of the same level as the Gaussian pyramid is formed;
[0028] Select the parts with high contrast between different images in the same level of Laplacian pyramid, combine the Laplacian pyramid layers of each image, and form a fused Laplacian pyramid;
[0029] Reconstruction is performed layer by layer from the smallest layer of the fused Laplacian pyramid upwards, and the Laplacian image of each layer is gradually restored to the original resolution by adding the Laplacian image of each layer to the corresponding Gaussian pyramid image. After reaching the top layer, the fused glass image is obtained.
[0030] Furthermore, the defect recognition model is trained through the following steps:
[0031] Collect and annotate image data containing glass defects, including stains, white spots, bubbles, scratches, and cracks;
[0032] Use annotation tools to annotate each defect in the image data to obtain recognition training samples;
[0033] The defect recognition model is built using the TFLITE model of YOLO V8, and the defect recognition model is trained by identifying training samples.
[0034] Further, the selecting a corresponding sensor for detection according to the first defect type and position to obtain the second defect type includes:
[0035] Build a sensor mapping table to map each defect type and location to the appropriate sensor;
[0036] The second defect type is obtained by detecting the position of the first defect type through a corresponding sensor.
[0037] Further, the use of a reinforcement learning algorithm to dynamically adjust the light source intensity and light source angle for detection includes:
[0038] Construct a relationship table between defect type, light source intensity, and light source angle, and select the corresponding light source intensity and light source angle according to the second defect type;
[0039] The light source intensity and light source angle are discretized into a finite action space a, and the defect detection accuracy is used as the reward signal r. The update formula is as follows:
[0040] Q(s,a) ← Q(s,a) + α[r + γ max Q(s',a') - Q(s,a)],
[0041] Where s is the current first defect type, a is the light source intensity and light source angle adjustment action, Q(s,a) is the state action value update function, s' is the first defect type in the new state, a' is the light source intensity and light source angle adjustment action in the new state, r is the reward for improved detection accuracy, α is the learning rate, and γ is the discount factor.
[0042] The present invention provides a glass defect detection device based on image recognition, which uses the above-mentioned glass defect detection method based on image recognition for detection.
[0043] Beneficial effects of the present invention:
[0044] First, different light source intensities and angles are selected based on different glass types (refractive index, transmittance, thickness, and glass area). Different beam intensities are used to ensure that light can fully enter the glass and reflect, which is sufficient to highlight glass defects. The detection optical path design can fully consider light scattering, reflection, and absorption, so that subsequent models can better identify defect types. The neural network can learn the mapping relationship between different glass parameters and the optimal light source conditions, and automatically select the optimal light source intensity and angle settings to improve the accuracy of subsequent defect detection.
[0045] Second, image fusion under different light source conditions can effectively gather and optimize information, improving the flexible adaptability of the detection system to various defects. By obtaining high-quality fused images, the defect recognition model can more accurately identify the defect type and its exact location. The defect recognition model can not only quickly identify the defect type, but also accurately locate the defect in the image, which facilitates subsequent secondary defect detection based on the image recognition position.
[0046] The third is the first defect type and location obtained through image recognition. After the previously determined defect location, the professional sensor conducts a more detailed analysis and detection of the defect location to subdivide and accurately classify these defects for subsequent defect type comparison. By adjusting the light source intensity and angle according to inconsistent defect types, combined with the reinforcement learning algorithm, the light source intensity and light source angle can be dynamically adjusted to improve the overall detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description 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.
[0048] Figure 1 This is a flow chart of the method of the first embodiment. DETAILED DESCRIPTION
[0049] To facilitate understanding by those skilled in the art, the structure of the present invention is now further described in detail with reference to the embodiments and the accompanying drawings. It should be understood that the steps mentioned in the present embodiment, unless otherwise specified in their order, can be adjusted in order according to actual needs, and can even be executed simultaneously or partially simultaneously.
[0050] Embodiment 1
[0051] like Figure 1 As shown, an embodiment of the present invention provides a glass defect detection method based on image recognition, comprising:
[0052] S1 obtains the current glass type to be detected, adaptively adjusts the light source intensity and light source angle according to the glass type, obtains multiple groups of light source intensities and light source angles, and collects glass images with different groups of light source intensities and light source angles;
[0053] Further, obtaining the type of glass to be detected currently includes:
[0054] Obtain the refractive index and transmittance of the glass to be tested through instrument testing;
[0055] Calculate the glass thickness by the weight and area of the glass to be tested.
[0056] Specifically, the calculation formula for calculating the glass thickness by the weight of the glass to be detected and the glass area is as follows:
[0057] ,
[0058] Among them, T is the glass thickness, W is the glass weight, A is the glass area, and D is the glass density.
[0059] In this step, use a dedicated optical measuring instrument (such as a refractometer or spectrophotometer) to obtain the refractive index and transmittance of the glass. Instrument measurement is the most accurate. Use a weight sensor to measure the weight of the glass, combined with the glass area A and material density D (usually available directly from the manufacturer).
[0060] The refractive index determines the change in the angle of refraction of light inside the glass. High refractive index materials will cause the light path to bend at a greater angle, thus affecting the viewing angle and surface image clarity. For high refractive index glass, a shallow angle light source may be required to reduce the impact of excessive refraction and ensure that surface or internal defects can be observed intuitively. A higher refractive index can increase surface reflections, affecting the light source intensity requirements to avoid excessive reflections. Adjusting the light source angle is critical to reducing unnecessary reflections and optimizing the contrast of defects.
[0061] Light transmittance directly affects the efficiency of light transmission in the material. Low light transmittance requires a stronger light source intensity to ensure sufficient light penetrates the material for detection. Appropriately increase the light source intensity to compensate for low light transmittance while ensuring the possibility of identifying internal defects. Glass with low light transmittance may require a different type of light source, such as a light source with a wider wavelength range to contrast and enhance the imaging of surface and subtle internal defects.
[0062] The thicker the glass, the longer the distance light has to travel inside the glass, which increases the possibility of scattering and absorption. A higher intensity light source is required to ensure that light can penetrate thicker glass and return enough light signals for detection. The thicker the glass, the more significant the angle at which light enters and leaves the glass, affecting its focus and detection effect. By adjusting the light source angle, the effect of thickness on imaging clarity and contrast can be reduced, and the detection field of view can be optimized.
[0063] Glass areas of different sizes require corresponding adjustments to the light source configuration to ensure uniform lighting. Reasonable light source intensity and angle configuration can avoid artifacts caused by uneven lighting, thereby improving the accuracy of defect detection. Improper light intensity or angle may cause excess reflection or scattered light to interfere with image capture, especially in the detection of large areas of glass.
[0064] S101 inputs the glass type into a pre-trained selection model to obtain multiple sets of light source intensities and light source angles, wherein the light source intensities include: low, medium, and high; the light source angles include: parallel light source, backlight source, and oblique light source, wherein the oblique light source is 0-90°;
[0065] S102 photographs the glass to be inspected according to multiple groups of light source intensities and light source angles to obtain glass images with different groups of light source intensities and light source angles.
[0066] Furthermore, the selection model is trained through the following steps:
[0067] Collect defect detection data on different types of glass under different light source intensities and angles, the defect detection data including: defect type and detection accuracy, and select data with 100% detection accuracy as detection samples;
[0068] Recording the glass parameters of each test sample, the glass parameters including: refractive index, transmittance, thickness, glass area, and corresponding light source intensity and light source angle settings;
[0069] A selection model is constructed using a multi-layer perceptron, the glass parameters of each detection sample are used as input of the selection model, and the corresponding light source intensity and light source angle settings are used as output to train the selection model to obtain selection model parameters.
[0070] In this step, according to the transmittance and thickness adjustment, different beam intensities are used to ensure that the light can fully enter the glass and reflect, which is enough to highlight the glass defects. The appropriate incident angle is selected according to the refractive index, so that the optical path design can fully consider light scattering, reflection and absorption, so that the subsequent model can better identify the defect type. The selection model adopts a multi-layer perceptron (MLP) structure, which contains 3 hidden layers, each with 64, 32 and 16 neurons respectively, and the activation function uses ReLU. The input layer receives 4 parameters: refractive index, transmittance, thickness and glass area. The output layer uses the Softmax function, corresponding to different combinations of light source intensities and angles. In this way, the mapping relationship between different glass parameters and the optimal light source conditions can be learned, and the optimal light source intensity and angle settings can be automatically selected to improve the accuracy of subsequent defect detection.
[0071] By standardizing the light intensity level, the control logic of the inspection can be simplified. The graded light intensity setting allows for quick adjustment in different glass types, ensuring that the appropriate light intensity is selected for each application. Parallel light sources provide uniform illumination, which is suitable for detecting surface details and small defects (such as scratches) without introducing significant shadows. Backlight sources are particularly effective when inspecting transparent or translucent materials. They can highlight internal defects (such as bubbles) and edge non-uniformity, enhance the contrast effect under transmitted light, and improve the imaging quality of transparent glass. Oblique light sources (0-90°) can be adjusted to any angle, so that the light is incident obliquely to highlight certain defect features (such as surface bumps and cracks), and enhance the visualization of defects through the shadow effect of light. During inspection, three images of parallel light source, backlight source, and oblique light source are usually required. These three images need to select the appropriate light source intensity according to the corresponding transmittance and thickness. The classification of these light source intensities and angles can cover the actual inspection needs in most industrial environments.
[0072] S2 fuses the glass images with different light source intensities and light source angles to obtain a fused glass image, and inputs the fused glass image into a pre-trained defect recognition model to obtain the first defect type and position of the glass to be detected;
[0073] S201 performs multiple Gaussian filtering and downsampling on each glass image to obtain a Gaussian pyramid image with a gradually reduced resolution;
[0074] S202: upsampling and Gaussian filtering are performed on each layer of the Gaussian pyramid image to obtain an upsampled blurred image and a Gaussian image respectively, and the upsampled blurred image is subtracted from the previous Gaussian image to obtain a difference image to form each layer of the Laplacian pyramid image, until a Laplacian pyramid image of the same level as the Gaussian pyramid is formed;
[0075] S203 selects a portion with a high contrast between different images in the same level of the Laplacian pyramid, combines the Laplacian pyramid layers of each image, and forms a fused Laplacian pyramid;
[0076] Further, selecting a portion with high contrast between different images in the Laplacian pyramid at the same level includes:
[0077] Calculate the local contrast of each pixel in the image, and select pixels with higher local contrast as the high-contrast part.
[0078] In this step, when selecting the part with high contrast between the images at the same level of the Laplacian pyramid, the local contrast calculation method is used. For each pixel (x, y) in image I, calculate its local contrast C(x, y):
[0079] C(x,y) = (I(x,y) - μ) / (μ + ε)
[0080] Where μ is the average pixel value of a 3x3 neighborhood centered at (x, y), and ε is a small constant (such as 0.01) to avoid division by zero. When fusion is performed, pixels with higher C(x, y) values are selected.
[0081] S204 reconstructs the fused Laplacian pyramid layer by layer from the smallest layer upwards, and gradually restores the original resolution by adding the Laplacian image of each layer to the corresponding Gaussian pyramid image, and obtains the fused glass image after reaching the top layer.
[0082] In this step, by selecting high-contrast image parts for combination, the contrast is enhanced and the detail display is improved, which is crucial for detecting subtle defects (such as small cracks or scratches). Multiple filtering and multi-resolution analysis help reduce noise, especially at low resolution levels, and improve the quality of subsequent inspections. Image fusion under different light source conditions can effectively gather optimization information (for example, certain light source conditions enhance the observation of certain types of defects), and improve the flexible adaptability of the inspection system to various types of defects. By obtaining high-quality fused images, the defect recognition model can more accurately identify the defect type and its exact location.
[0083] Furthermore, the defect recognition model is trained through the following steps:
[0084] Collect and annotate image data containing glass defects, including stains, white spots, bubbles, scratches, and cracks;
[0085] Use annotation tools to annotate each defect in the image data to obtain recognition training samples;
[0086] The defect recognition model is built using the TFLITE model of YOLO V8, and the defect recognition model is trained by identifying training samples.
[0087] In this step, the TFLite model of YOLO v8 is used for inference, and the AidLite framework is used to load and run the model, which supports GPU acceleration. The model input is a 640x640x3 image, and the output is a 1x8x8400 tensor, including bounding box coordinates, confidence, and category probability. It can not only quickly identify the type of defects, but also accurately locate the location of the defects in the image, which facilitates subsequent secondary defect detection based on the location of image recognition.
[0088] S3 selects a corresponding sensor to perform detection according to the first defect type and position to obtain a second defect type;
[0089] S301 constructs a sensor mapping table to correspond each defect type and location to a suitable sensor;
[0090] S302 detects the position of the first defect type through a corresponding sensor to obtain a second defect type.
[0091] In this step, the first defect type and position obtained by image recognition may be limited by factors such as image quality and detection model errors and may not be accurate enough. In particular, some defects may have similar visual features (such as cracks and scratches, bubbles and white spots), and image recognition can only identify defects on the glass surface. Some cracks and scratches may exist not only on the glass surface, and are easy to be confused in preliminary identification. After the defect position is determined previously, professional sensors perform more detailed analysis and detection of the defect position to subdivide and accurately classify these defects.
[0092] Table 1 Sensor mapping table
[0093]
[0094] In this step, the ultrasonic sensor is used to detect bubbles as an example. The system uses pulse echo technology. Short pulses of ultrasonic waves are emitted, and the echo time and intensity are measured. Bubbles will cause changes in acoustic impedance and produce characteristic echoes. By analyzing the echo pattern, the size and position of the bubble can be estimated. Specifically, there is a relationship between the bubble size d and the echo frequency f: d ≈ c / (2f), where c is the speed of sound in the glass, and the position is calculated by the echo time. The detection methods of other sensors are existing technologies and will not be described in detail.
[0095] S4 outputs the glass defect type if the first defect type and the second defect type are the same; otherwise, a reinforcement learning algorithm is used to dynamically adjust the light source intensity and light source angle for detection.
[0096] S401 constructs a relationship table between defect type, light source intensity, and light source angle, and selects the corresponding light source intensity and light source angle according to the second defect type;
[0097] S402 discretizes the light source intensity and light source angle into a finite action space a, and uses the defect detection accuracy as the reward signal r. The update formula is as follows:
[0098] Q(s,a) ← Q(s,a) + α[r + γ max Q(s',a') - Q(s,a)],
[0099] Where s is the current first defect type, a is the light source intensity and light source angle adjustment action, Q(s,a) is the state action value update function, s' is the first defect type in the new state, a' is the light source intensity and light source angle adjustment action in the new state, r is the reward for improved detection accuracy, α is the learning rate, and γ is the discount factor.
[0100] In this step, the Q-learning algorithm can be used to obtain the first defect type from image recognition as the initial state. Use the ε-greedy strategy to select actions from the action space, that is, randomly select an action with an ε probability, and select the action with the maximum Q value in the current state with a 1-ε probability. According to the selected action a, adjust the light source intensity and light source angle. Perform secondary defect detection to obtain new detection results. The new defect type is the new state s ′. Calculate the reward based on the change in detection accuracy. If the new detection method improves the accuracy, r is a positive value, otherwise it is negative or zero. Use the update formula to update the current state s to s ′, repeat the above steps, and continue learning until convergence or the preset learning round is reached. Adjusting the light source intensity and angle through inconsistent defect types can dynamically adjust the light source intensity and light source angle to improve the overall detection accuracy.
[0101] Table 2 Relationship between defect type, light source intensity and light source angle
[0102]
[0103] Stains generally require medium to high intensity light sources to make them more visible in reflected or transmitted images, which can enhance contrast and improve the ability to identify surface unevenness. Stains use larger angles (e.g. > 45°) to enhance reflected light, making surface stains stand out, and can increase surface reflective features to capture the location of the stain.
[0104] White spots and bubbles are suitable for medium-intensity light sources. Too high an intensity may cause overexposure of white spots and bubbles. This can keep the edges of bubbles clear and avoid false images caused by reflected light. A small angle of incidence close to the normal (e.g. 10°-30°) can prevent internal reflection interference and highlight changes in internal structures.
[0105] Scratches should be imaged at low to medium intensities to avoid excessive reflections that make them less visible and to enhance the capture of linear discontinuities. Use shallow incident angles (<30°) to show scratches from the side of the surface, enhancing the length and depth of scratches.
[0106] The cracks are suitable for medium to high strength to ensure that the crack edges and depths can be clearly displayed, and the width and length of the cracks can be accurately determined. Multiple angles are used for oblique and direct illumination, combined with image analysis, to detect the crack path and depth at different angles.
[0107] Embodiment 2
[0108] Embodiment 2 provides a glass defect detection device based on image recognition, which uses the above-mentioned glass defect detection method based on image recognition for detection.
[0109] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0110] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0111] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0112] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0113] It should be noted that in the claims, any reference signs placed between brackets shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claim. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention may be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.
[0114] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0115] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
[0116] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0117] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms should not be understood as necessarily referring to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
Claims
1. A glass defect detection method based on image recognition, characterized in that: include: Obtain the current glass type to be detected, adaptively adjust the light source intensity and light source angle according to the glass type, obtain multiple groups of light source intensities and light source angles, and collect glass images with different groups of light source intensities and light source angles, specifically including: The glass type is input into a pre-trained selection model to obtain multiple sets of light source intensities and light source angles, wherein the light source intensities include: low, medium, and high; the light source angles include: parallel light source, backlight source, and oblique light source, wherein the oblique light source is 0-90°; Photograph the glass to be inspected according to multiple groups of light source intensities and light source angles to obtain glass images with different groups of light source intensities and light source angles; The selection model is trained by the following steps: Collect defect detection data on different types of glass under different light source intensities and angles, the defect detection data including: defect type and detection accuracy, and select data with 100% detection accuracy as detection samples; Recording the glass parameters of each test sample, the glass parameters including: refractive index, transmittance, thickness, glass area, and corresponding light source intensity and light source angle settings; A selection model is constructed using a multi-layer perceptron, the glass parameters of each test sample are used as inputs of the selection model, and the corresponding light source intensity and light source angle settings are used as outputs to train the selection model, thereby obtaining selection model parameters; Fusing glass images with different light source intensities and light source angles to obtain a fused glass image, and inputting the fused glass image into a pre-trained defect recognition model to obtain a first defect type and position of the glass to be detected; Selecting a corresponding sensor for detection according to the first defect type and position to obtain a second defect type; If the first defect type and the second defect type are the same, the glass defect type is output; otherwise, a reinforcement learning algorithm is used to dynamically adjust the light source intensity and light source angle for detection.
2. The glass defect detection method based on image recognition according to claim 1, characterized in that: The obtaining of the current glass type to be detected includes: Obtain the refractive index and transmittance of the glass to be tested through instrument testing; Calculate the glass thickness by the weight and area of the glass to be tested.
3. The glass defect detection method based on image recognition according to claim 2, characterized in that: The calculation formula for calculating the glass thickness by the weight of the glass to be detected and the glass area is as follows: , Among them, T is the glass thickness, W is the glass weight, A is the glass area, and D is the glass density.
4. The glass defect detection method based on image recognition according to claim 3 is characterized in that: The fusing of glass images with different light source intensities and light source angles to obtain a fused glass image comprises: Perform multiple Gaussian filtering and downsampling on each glass image to obtain a Gaussian pyramid image with a gradually reduced resolution. Upsampling and Gaussian filtering are performed on each layer of the Gaussian pyramid image to obtain an upsampled blurred image and a Gaussian image respectively, and the upsampled blurred image is subtracted from the previous Gaussian image to obtain a difference image to form each layer of the Laplacian pyramid image until a Laplacian pyramid image of the same level as the Gaussian pyramid is formed; Select the parts with high contrast between different images in the same level of Laplacian pyramid, combine the Laplacian pyramid layers of each image, and form a fused Laplacian pyramid; Reconstruction is performed layer by layer from the smallest layer of the fused Laplacian pyramid upwards, and the Laplacian image of each layer is gradually restored to the original resolution by adding the Laplacian image of each layer to the corresponding Gaussian pyramid image. After reaching the top layer, the fused glass image is obtained.
5. The glass defect detection method based on image recognition according to claim 4, characterized in that: The defect recognition model is trained through the following steps: Collect and annotate image data containing glass defects, including stains, white spots, bubbles, scratches, and cracks; Use annotation tools to annotate each defect in the image data to obtain recognition training samples; The defect recognition model is built using the TFLITE model of YOLO V8, and the defect recognition model is trained by identifying training samples.
6. The glass defect detection method based on image recognition according to claim 5, characterized in that: The step of selecting a corresponding sensor for detection according to the first defect type and position to obtain the second defect type includes: Build a sensor mapping table to map each defect type and location to the appropriate sensor; The second defect type is obtained by detecting the position of the first defect type through a corresponding sensor.
7. The glass defect detection method based on image recognition according to claim 6, characterized in that: The use of a reinforcement learning algorithm to dynamically adjust the light source intensity and light source angle for detection includes: Construct a relationship table between defect type, light source intensity, and light source angle, and select the corresponding light source intensity and light source angle according to the second defect type; The light source intensity and light source angle are discretized into a finite action space a, and the defect detection accuracy is used as the reward signal r. The update formula is as follows: Q(s,a) ← Q(s,a) + α[r + γ max Q(s',a') - Q(s,a)], Where s is the current first defect type, a is the light source intensity and light source angle adjustment action, Q(s,a) is the state action value update function, s' is the first defect type in the new state, a' is the light source intensity and light source angle adjustment action in the new state, r is the reward for improved detection accuracy, α is the learning rate, and γ is the discount factor.
8. A glass defect detection device based on image recognition, characterized in that: The detection is performed using a glass defect detection method based on image recognition as described in any one of claims 1 to 7.
