A deep learning-based online detection method for complex printing defects of glass bottles
Patent Information
- Application Number
- CN202610928427.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-25
- Publication Date
- 2026-10-27
AI Technical Summary
[0006]针对背景技术提出的问题,本发明提出一种基于深度学习的玻璃瓶复杂印花缺陷在线检测方法
1、高精度与高鲁棒性:深度学习模型能够学习复杂印花的内在特征,对渐变色、重叠图案的缺陷识别能力远超传统算法,有效克服反光、畸变干扰。
Smart Images

Figure CN122989544A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of bottle printing defect detection technology, and particularly relates to an online detection method for complex printing defects on glass bottles based on deep learning. Background Technology
[0002] Glass bottles, as a crucial packaging medium for the wine, beverage, pharmaceutical, and daily chemical industries, typically feature complex printed structures on their surfaces, including multi-color, multi-layered, gradient, or overprinted designs. Currently, printing defects are primarily detected through manual visual inspection or traditional open-circuit vision (OCV) methods, which presents the following problems: 1. Limitations of manual inspection: It relies entirely on human eyes, is prone to fatigue on high-speed production lines (such as more than 200 bottles per minute), has inconsistent inspection standards, has a high rate of missed and false detections, and cannot quantify and record defect data, making it difficult to achieve quality traceability and analysis.
[0003] 2. Limitations of Traditional Machine Vision Methods: These methods employ rule-based feature matching (such as template matching), grayscale thresholding, or edge detection algorithms. These methods exhibit extremely poor robustness to prints with complex backgrounds and varied patterns (such as gradient colors and ink wash effects). Slight changes in lighting, pattern deformation caused by the curvature of the bottle, and minute misregistration can all be misjudged as defects. Furthermore, expanding the defect database is difficult; each new defect or change in bottle type requires rewriting and debugging complex algorithms, resulting in high deployment and maintenance costs.
[0004] 3. Preliminary Applications of Deep Learning: While some studies have attempted to apply deep learning to surface defect detection, these are mostly focused on static images with simple backgrounds, or limited to defect classification. In online inspection scenarios involving high-speed dynamics, strong reflections, and complex backgrounds of glass bottles, directly applying general-purpose models yields poor results. Specifically, this manifests in: the inability to complete imaging, localization, analysis, and decision-making within milliseconds; insufficient pixel-level localization accuracy for minute defects (such as pinholes and broken wires); and a lack of systematic design for real-time integration with the production line control system.
[0005] Therefore, the industry urgently needs a comprehensive online inspection solution for complex printing on glass bottles that can overcome the above-mentioned shortcomings and achieve "high speed, high precision, high adaptability, and high intelligence". Summary of the Invention
[0006] In response to the problems raised in the background technology, this invention proposes an online detection method for complex printing defects on glass bottles based on deep learning.
[0007] To achieve this objective, the present invention adopts the following technical solution: A deep learning-based online detection method for complex printed defects on glass bottles includes: Step A: Collect original images of the glass bottles being transported on the conveyor line from multiple angles and under different lighting conditions; Step B: Preprocess the acquired raw bottle images and fuse them into a fused image that highlights the defect features; Step C: Input the fused image into the printing area localization model to obtain the printing pattern area image; Step D: Input the printed pattern area image into the deep learning model to generate a defect probability map and defect type for the defect area of the printed pattern area image; Step E: Analyze the defect probability map according to the defect type to obtain the defect mask, and calculate the geometric features of the defect mask; Step F: Match the defect type, the geometric features of the defect mask, and the rejection rules to output the defect detection results; Step G: Link and store the original bottle image, defect type, defect detection result, detection timestamp, and batch number in the database. Perform multidimensional statistical analysis based on the detection timestamp, batch number, and defect type to generate a quality report.
[0008] Preferably, step A includes: The glass bottles are transported into the inspection station along the conveyor line. The position information of the glass bottles is acquired and fed back in real time. When the glass bottle is detected to have entered the preset acquisition position, multiple original bottle images with different angles and different lighting conditions are acquired within the same inspection cycle by preset switching sequence, light intensity and light duty cycle of different light sources. Among them, the different lighting conditions formed by different light sources include low-angle ring light, coaxial light, and backlight.
[0009] Preferably, before performing step A, the following steps are included: Based on the bottle's property parameters, the switching sequence, light intensity, and light duty cycle of different light sources are pre-configured in the formula library. Among them, the bottle body attribute parameters include at least the bottle body curvature radius, the coverage ratio of the printed area in the axial and circumferential directions of the bottle body, the type of printed ink layer, and the reflective properties of the ink layer.
[0010] Preferably, step A includes: The reflective image feature index is calculated for the original bottle body image acquired in real time. When the reflective image feature index exceeds the preset threshold range, the light intensity and light duty cycle of the corresponding light source are adaptively adjusted according to the preset adjustment rules. Among them, the reflective image feature indicators include the saturation pixel ratio, average brightness value, and reflective area.
[0011] Preferably, step B includes: Step B1: Perform time synchronization and subpixel registration on multiple original bottle images acquired within the same detection cycle from multiple angles and under different lighting conditions, and perform brightness normalization and noise suppression processing on each original bottle image. Step B2: For each image processed in step B1, perform the following operations: Calculate sharpness and detail response characteristic metrics, where the detail response characteristic metrics include one or more of gradient magnitude, local contrast, and texture energy; Normalize the detailed response feature indicators; The normalized detailed response feature indicators are weighted and combined according to preset weight coefficients to obtain the initial weight map. High-brightness reflective areas are detected and reflective masks are generated. The initial weight map is then suppressed and corrected based on the reflective mask to obtain the final weight map. Step B3: The images processed in step B2 are fused according to pixel-level weights to obtain a fused image that highlights the defect features.
[0012] Preferably, step C includes: The printing area localization model includes a backbone network, a feature pyramid network (FPN), and a detection head. The backbone network is used to extract multi-scale features of the fused image, the feature pyramid network is used to fuse high and low layer semantics to adapt to printed pattern areas of different sizes, and the detection head is used to output the coordinates of the circumscribed rectangle of the printed pattern area and the confidence level.
[0013] Preferably, step C includes: An attention module is introduced into the key layer of the backbone network or the FPN fusion layer of the feature pyramid network to adaptively recalibrate multi-scale features, including: Channel weights are generated based on global averaging or max pooling to enhance channel response with print textures and edges; Spatial weights are generated based on multi-scale features to suppress the response of the bottle's highlight and the non-printed background area.
[0014] Preferably, step D includes: The deep learning model includes a classification subnetwork and a segmentation subnetwork. The classification subnetwork is used to output the defect type of the defect region in the printed pattern region image, and the segmentation subnetwork is used to perform pixel-level semantic segmentation of the defect region to generate a defect probability map of the same size as the printed pattern region.
[0015] Preferably, step E includes: Step E1: Threshold the defect probability map. Thresholding includes obtaining the defect probability value output by the segmentation sub-network at the pixel coordinates. When the defect probability value is greater than or equal to the preset probability judgment threshold, the pixel corresponding to the pixel coordinate is judged as a defect pixel. When the defect probability value is less than the preset probability judgment threshold, the pixel corresponding to the pixel coordinate is judged as a non-defect pixel. Step E2: Denoise the defect probability map by performing morphological opening and closing operations and filtering connected components to remove small false detection regions to obtain a defect mask.
[0016] Preferably, calculating the geometric features of the defect mask in step E includes: Calculate the pixel area, physical area, circumscribed rectangle, center point of circumscribed rectangle, boundary contour, curve length, and physical length of the defect mask.
[0017] The advantages of this invention over the prior art are: 1. High precision and high robustness: Deep learning models can learn the inherent characteristics of complex printing, and their ability to identify defects in gradient colors and overlapping patterns far exceeds that of traditional algorithms, effectively overcoming interference from reflection and distortion.
[0018] 2. High efficiency and high speed: Through hardware and software co-optimization (such as encoder triggering, lightweight network design, and GPU acceleration), the cycle time requirements of high-speed production lines are met.
[0019] 3. Strong adaptability and scalability: When changing products, only a small number of sample images of the new bottle type need to be imported through the human-machine interface to fine-tune the positioning and recognition model, which can be quickly deployed, greatly reducing the cost and time of product changeover.
[0020] 4. Intelligentization and digitalization: It not only realizes defect detection, but also completes pixel-level positioning, classification, statistics and traceability of defects, providing data-driven decision support for production process optimization (such as printing press pressure adjustment) and helping to upgrade intelligent manufacturing. Attached Figure Description
[0021] Figure 1 This is a flowchart of the steps of an online detection method for complex printing defects on glass bottles based on deep learning, according to the present invention. Figure 2 This is a schematic diagram of the multi-source collaborative illumination imaging of the present invention; Figure 3 This is a schematic diagram of the overall structure of the system of the present invention; Figure 4 This is an example diagram illustrating the defect identification and segmentation effect of the present invention. Detailed Implementation
[0022] The technical solution of the present invention will be further described below with reference to the accompanying drawings and specific embodiments.
[0023] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0024] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, product, or end that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or ends.
[0025] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0026] This application proposes an online detection method for complex printed defects on glass bottles based on deep learning, such as... Figure 1 As shown, it includes: Step A: Collect original images of the glass bottles being transported on the conveyor line from multiple angles and under different lighting conditions; Preferably, step A includes: The glass bottles are transported into the inspection station along the conveyor line. The position information of the glass bottles is acquired and fed back in real time. When the glass bottle is detected to have entered the preset acquisition position, multiple original bottle images with different angles and different lighting conditions are acquired within the same inspection cycle by preset switching sequence, light intensity and light duty cycle of different light sources. Among them, the different lighting conditions formed by different light sources include low-angle ring light, coaxial light, and backlight.
[0027] In this embodiment, when the glass bottle enters the inspection station along the conveyor line, the encoder on the conveyor line monitors and feeds back the position information of the glass bottle on the conveyor line in real time. Based on the real-time position information of the glass bottle on the conveyor line, it is determined whether the glass bottle has entered the preset acquisition position. When it enters the preset acquisition position, the controller configured on the conveyor line accurately triggers the high-speed industrial camera to acquire images at the preset acquisition position, ensuring that the bottle body is in a stable posture and the imaging area is consistent.
[0028] Furthermore, in this embodiment, as Figure 2 As shown, multi-source collaborative illumination image acquisition is achieved using a multi-source lighting device combining low-angle ring light, coaxial light, and backlight. The switching timing and intensity of different light sources are controlled by a program to acquire 2-3 images under different lighting conditions within the same detection cycle. For example, low-angle ring light can highlight uneven defects (such as bubbles or scratches), while coaxial light is used to obtain accurate information about surface color and pattern, thus eliminating specular reflections.
[0029] Furthermore, this application employs a "multi-angle incident illumination under the same or similar wavelength band" method to alter the proportion of reflection / scattering components on the glass bottle surface. Specifically, this can be manifested as follows: low-angle incident ring light is used to enhance the unevenness defects in the printed area of the bottle, which can be understood as diffuse reflection and shadows caused by minor deformations due to bubbles or scratches; coaxial incident light is used to acquire intrinsic information of the printed color and pattern; backlighting is used to enhance edge contours and light transmission anomalies; the core of using different lighting conditions formed by different light sources to acquire images is to suppress glass mirror reflection and improve defect visibility through the difference in incident angle, rather than relying on different spectra to distinguish materials as in existing technologies.
[0030] Furthermore, this application can also preset the switching timing, illumination duty cycle, and illumination intensity of different light sources before acquisition, and dynamically adjust the parameters of different light sources based on the real-time acquired images. For example, for different bottle curvatures, printing coverage areas, and reflectivity of hot stamping / gradient ink layers, the switching timing, duty cycle, and illumination intensity of each light source can be configured in the formula library; and closed-loop adjustment can be performed based on indicators such as the saturated pixel ratio, average brightness, and reflective area of the real-time image to control the reflective area within a preset threshold, ensuring the fusion and stability of multi-angle images.
[0031] Preferably, before performing step A, the following steps are included: Based on the bottle's property parameters, the switching sequence, light intensity, and light duty cycle of different light sources are pre-configured in the formula library. Among them, the bottle body attribute parameters include at least the bottle body curvature radius, the coverage ratio of the printed area in the axial and circumferential directions of the bottle body, the type of printed ink layer, and the reflective properties of the ink layer.
[0032] Furthermore, the aforementioned technical means can be understood as the acquisition and quantification of bottle body attribute parameters: during system initialization or model change phases (glass bottle shape change phases), the bottle body attribute parameters of the glass bottle to be tested are acquired. These bottle body attribute parameters include at least: the bottle body radius of curvature, the coverage ratio of the printed area in the axial and circumferential directions (circumferential direction refers to the circumference of the bottle body), the type of printed ink layer (such as ordinary ink, hot stamping ink layer, or gradient ink layer), and the reflective characteristics of the printed ink layer. The bottle body radius of curvature can be obtained based on bottle shape design parameters or by fitting a bottle body contour image; the printed coverage area can be statistically analyzed based on the positioning results of the printed area in the sample image; the reflective characteristics of the ink layer can be characterized by acquiring sample images under preset lighting conditions and calculating the proportion of high-brightness saturated pixels or the area of specular reflection.
[0033] Furthermore, based on the bottle's attribute parameters, pre-established lighting formula rules are invoked to initially configure the lighting parameters of the multi-source lighting unit. These lighting parameters include at least the switching sequence, light intensity level, and duty cycle corresponding to the incident angle of each light source. For example, when the bottle curvature is small or the reflectivity of the hot stamping ink layer is high, the lighting intensity of the coaxial light is reduced and the proportion of low-angle ring light is increased to suppress specular reflection; when the printed area is large, the effective lighting sequence of the multiple light sources is extended to ensure the uniformity of the printed area.
[0034] Preferably, step A includes: The reflective image feature index is calculated for the original bottle body image acquired in real time. When the reflective image feature index exceeds the preset threshold range, the light intensity and light duty cycle of the corresponding light source are adaptively adjusted according to the preset adjustment rules. Among them, the reflective image feature indicators include the saturation pixel ratio, average brightness value, and reflective area.
[0035] The above-mentioned technical means can be understood as follows: during the online detection process, the system calculates reflective image feature indicators for the original bottle image collected in real time. The reflective image indicators include at least: saturation pixel ratio, average brightness value, and reflective area.
[0036] When the image feature index exceeds the preset threshold range, the system adaptively adjusts the light intensity or duty cycle of the corresponding light source according to the preset adjustment rules. Specifically, in the initial stage of the system, different light source adjustment methods can be selected according to different product specifications. The light source adjustment mainly adopts the adjustment of light intensity or duty cycle to achieve the light intensity. This light source adjustment method is based on experience obtained from a large number of experimental tests in the early stage. For example, if the product is a fully transparent glass bottle, the light intensity is adjusted to between 100 and 150, and the duty cycle is about 50%. This ensures that the reflective area in the subsequently acquired image is controlled within the threshold range, thereby ensuring the stability and consistency of multi-angle images in subsequent fusion processing.
[0037] Step B: Preprocess the acquired raw bottle images and fuse them into a fused image that highlights the defect features; Preferably, step B includes: Step B1: Perform time synchronization and subpixel registration on multiple original bottle images acquired within the same detection cycle from multiple angles and under different lighting conditions, and perform brightness normalization and noise suppression processing on each original bottle image. In this embodiment, multiple images with different illumination angles acquired within the same detection period are synchronized in time and registered subpixel to achieve techniques such as existing affine correction based on phase correlation or feature point matching. Brightness normalization and noise suppression (e.g., median / bilateral filtering) are also performed on each image to reduce the impact of exposure differences.
[0038] Furthermore, in a specific embodiment, the time synchronization and sub-pixel registration can be implemented as follows: Within the same detection cycle, the glass bottle enters the detection station triggered by the position signal of the conveyor encoder. The same trigger controller sequentially turns on light sources at different illumination angles according to a preset switching sequence, and controls the same industrial camera to complete multiple exposure acquisitions at corresponding times. Since each original bottle image is acquired by the same camera at the same bottle position, and the time interval between adjacent exposures is controlled within milliseconds, the images remain synchronized in time and correspond to the same detection object.
[0039] Meanwhile, due to the possibility of slight displacement or vibration of the bottle during multiple exposures, sub-pixel spatial offsets may occur between the images. Therefore, in image processing, one original bottle image is used as a reference image, and registration processing is performed on the remaining images. Specifically, this can be achieved using existing techniques such as performing Fourier transforms on the two images and calculating the phase correlation function to obtain the translational offsets in the horizontal and vertical directions, and then using sub-pixel interpolation to accurately estimate the offsets; alternatively, the printing edge or texture feature points can be extracted from the images, and affine transformation parameters can be calculated through feature point matching to perform sub-pixel geometric correction on the images to be registered.
[0040] After registration, brightness normalization is performed on each original bottle image. For example, exposure differences are eliminated by linear stretching or normalization to a uniform grayscale range. Median filtering or bilateral filtering is combined to suppress random noise, thereby obtaining multi-angle images that are consistent in both spatial location and brightness scale, providing stable input for subsequent weighted fusion and defect identification.
[0041] Step B2: For each image processed in step B1, perform the following operations: Calculate sharpness and detail response characteristic metrics, where the detail response characteristic metrics include one or more of gradient magnitude, local contrast, and texture energy; In one embodiment, for the i-th image acquired within the same detection period Calculate its sharpness and detail response feature indicators respectively, wherein the detail response feature indicators include at least one of the following or a combination thereof: a. Gradient magnitude index For example, the gradient of the image in the horizontal and vertical directions can be calculated using the Sobel or Laplacian operators, and its magnitude can be taken. b. Local contrast index For example, in pixels The gray-level variance is calculated within a local window centered on the model, or the local gain after adaptive histogram equalization (CLAHE) is used as a contrast characterization. c. Texture energy index For example, texture energy values calculated through Gabor filtering or gray-level co-occurrence matrix (GLCM).
[0042] The above technologies are all existing technologies that can be understood by those skilled in the art, and will not be elaborated on further here.
[0043] To eliminate differences in the dimensions of different features, the detailed response feature indices are normalized; for example, minimum and maximum normalization are used to map the above feature values to the [0,1] interval, resulting in a normalized feature map. , , .
[0044] The normalized detailed response feature indicators are weighted and combined according to preset weight coefficients to obtain the initial weight map. In this embodiment, based on the normalized feature indicators, the above features are weighted and combined according to preset weight coefficients to generate the initial weight map of the i-th image. For example, it can be in the following form: ,in This is a non-negative weighting coefficient, whose value can be configured according to different defect types or detection requirements, and satisfies... .
[0045] High-brightness reflective areas are detected and reflective masks are generated. The initial weight map is then suppressed and corrected based on the reflective mask to obtain the final weight map. In this embodiment, bright reflective areas are detected in each image, for example by thresholding the image brightness channel or generating a reflective mask by statistically analyzing the proportion of saturated pixels. In this context, pixels in the bright reflective areas are assigned a value of 1, while those in the non-reflective areas are assigned a value of 0. Correspondingly, this applies to the initial weight map. Suppression corrections are performed to obtain the final weight map. ,For example: .in, is the reflection suppression coefficient, with a value range of [0,1], used to control the degree of attenuation of the weight of the reflective area.
[0046] Step B3: The images processed in step B2 are fused according to pixel-level weights to obtain a fused image that highlights the defect features.
[0047] In this step, the images are fused according to pixel-level weights using the following formula: ,in, This represents the image intensity fusion function, i.e., in pixel coordinates. The pixel intensity values of the fused image at that point This is the final weight map after step B2, which dynamically assigns the contribution ratio of each image to the fusion result. =1, This represents the index of the single input image currently being processed, and K represents the total number of input images, i.e., the total number of images participating in the fusion. Indicates the coordinates of the k-th input image. The original pixel intensity value at that location. Block-level weighting (using a small window to calculate weights) can also be used to improve real-time performance.
[0048] The fused image has a higher gradient / texture response at defect-sensitive details (such as broken lines, pinholes, ink splatter edges, etc.), while the weights are suppressed at specular reflections, thereby enhancing the defect-related features of interest.
[0049] Step C: Input the fused image into the printing area localization model to obtain the printing pattern area image; Preferably, step C includes: The printing area localization model includes a backbone network, a feature pyramid network (FPN), and a detection head. The backbone network is used to extract multi-scale features of the fused image, the feature pyramid network is used to fuse high and low layer semantics to adapt to printed pattern areas of different sizes, and the detection head is used to output the coordinates of the circumscribed rectangle of the printed pattern area and the confidence level.
[0050] In this embodiment, the printed area localization model can be understood as using a lightweight convolutional neural network (CNN) localization model or an improved attention mechanism region proposal network to achieve adaptive localization of the printed pattern area. Specifically, it takes the entire image as input and directly outputs the precise bounding rectangle coordinates of the printed pattern area. This model can adapt to different bottle types and different printed layouts after training with a small number of samples, replacing traditional fixed ROI or color threshold segmentation methods.
[0051] The localization network structure of the printing area localization model in this embodiment includes a backbone network, a feature pyramid network (FPN), and a detection head. The backbone network extracts multi-scale features, and the FPN integrates high- and low-level semantics to adapt to printing areas of different sizes. The detection head outputs the circumscribed rectangle coordinates (x, y, w, h) and confidence score of the printing area.
[0052] Further improvements to the attention mechanism: An attention module is introduced into the key layers of the backbone network or the FPN fusion layer to adaptively recalibrate features. 1. Channel Attention: Channel weights are generated based on global average / max pooling to enhance channel responses related to print texture and edges; 2. Spatial attention: Spatial weights are generated based on the feature map to suppress the response of the bottle's highlight and non-printed background areas; This improves the positioning robustness under complex gradients, overprinting, and overlapping patterns.
[0053] Furthermore, the training and inference process of the printed area localization model is as follows: during the training phase, the bounding box of the printed area is labeled, and data augmentation (such as rotation, affine, lighting perturbation, and surface deformation simulation) is used to improve generalization; during the inference phase, the candidate boxes are screened for confidence and non-maximum suppression (NMS) is performed, and the final printed area ROI is output.
[0054] Based on the above methods, when changing the glass bottle type, the positioning head parameters can be fine-tuned through transfer learning based on a small number of new bottle type samples to achieve rapid adaptation.
[0055] Step D: Input the printed pattern area image into the deep learning model to generate a defect probability map and defect type for the defect area of the printed pattern area image; Preferably, step D includes: The deep learning model includes a classification subnetwork and a segmentation subnetwork. The classification subnetwork is used to output the defect type of the defect region in the printed pattern region image, and the segmentation subnetwork is used to perform pixel-level semantic segmentation of the defect region to generate a defect probability map of the same size as the printed pattern region.
[0056] In this step, the located printed area image is input into a dedicated deep learning model for defect recognition. This model is a multi-task learning network with a backbone network of a Feature Pyramid Network (FPN) and branches into two sub-networks: Classification subnetwork: Outputs the type of defect (such as dirt, missing print, misalignment, etc.) and its confidence level.
[0057] Segmentation sub-network: Using U-Net++ or DeepLabv3+ architecture, pixel-level semantic segmentation of defect regions is performed to generate accurate defect probability maps.
[0058] The model was trained using data augmentation techniques (such as simulating glass reflection, surface distortion, and slight motion blur) to improve robustness.
[0059] Step E: Analyze the defect probability map according to the defect type to obtain the defect mask, and calculate the geometric features of the defect mask; Preferably, step E includes: Step E1: Threshold the defect probability map. Thresholding includes obtaining the defect probability value output by the segmentation sub-network at the pixel coordinates. When the defect probability value is greater than or equal to the preset probability judgment threshold, the pixel corresponding to the pixel coordinate is judged as a defect pixel. When the defect probability value is less than the preset probability judgment threshold, the pixel corresponding to the pixel coordinate is judged as a non-defect pixel. In this step, the segmentation subnetwork outputs a defect probability map of the same size as the input ROI. This map is then thresholded to obtain a binary mask M(x,y). For example, a pixel is classified as defective if P(x,y) ≥ τ, and as non-defective if P(x,y) < τ. Here, P(x,y) represents the defect probability value output by the segmentation subnetwork at pixel coordinates (x,y), with a value range of [0,1]. τ is a preset probability threshold used to distinguish between defective and non-defective pixels, with a value range of (0,1), which can be configured according to different defect types or detection accuracy requirements, or determined experimentally. Finally, morphological opening and closing operations are used for noise reduction, and connected component filtering is used to remove small false detection regions, resulting in the final defect mask.
[0060] Step E2: Denoise the defect probability map by performing morphological opening and closing operations and filtering connected components to remove small false detection regions to obtain a defect mask.
[0061] Preferably, calculating the geometric features of the defect mask in step E includes: Calculate the pixel area, physical area, circumscribed rectangle, center point of circumscribed rectangle, boundary contour, curve length, and physical length of the defect mask.
[0062] In this step, the pixel area is calculated as follows: , M represents the pixel area of the defective region; The binary mask function obtained from the defect segmentation above, when pixel coordinates When it belongs to the defect area =1, otherwise =0; This represents the summation of all pixel coordinates in the defect mask; The physical area is calculated as follows: if the physical size of a single pixel is obtained through camera calibration... The physical area is then expressed as s represents the physical size of a single pixel obtained through camera calibration, in millimeters per pixel (mm / px). This indicates the physical area corresponding to the defect region, expressed in square millimeters (mm²).
[0063] The calculation of the circumscribed rectangle and the center point is as follows: Find the minimum circumscribed rectangle for the connected region of the defect mask. The center point is .
[0064] The calculation of boundary contour, curve length, and physical length is as follows: Extract the boundary contour point sequence from the defect mask. curve length , Represents the horizontal coordinates of the contour points. Represents the vertical coordinates and physical length of the contour points. , This represents the conversion factor from pixels to physical units.
[0065] Step F: Match the defect type, the geometric features of the defect mask, and the rejection rules to output the defect detection results; In this step, the defect type and geometric features are matched against a pre-defined multi-level rejection rule library. Rules can be: "Any area of missing print in the main logo area of the bottle is considered a rejection product," and "A dirty spot area greater than 0.5mm² in the side pattern area is considered a rejection product." The final "pass" or "fail" result is then output.
[0066] Furthermore, defect identification and segmentation are used to output "defect type and quantitative results," but whether it is judged as unqualified depends on the production line process tolerance and customer standards. The same defect is handled differently under different area / size thresholds. For example, any missing print in the main logo area is considered unqualified, while small areas of ink splatter or slight color difference are allowed in non-critical decorative areas. Therefore, this application sets up a configurable rule engine to match "defect type + size + location + quantity / density" with the rule base and output qualified / unqualified or A / B / C grades, realizing interpretable, traceable, and rapid changeover quality decisions.
[0067] Step G: Link and store the original bottle image, defect type, defect detection result, detection timestamp, and batch number in the database. Perform multidimensional statistical analysis based on the detection timestamp, batch number, and defect type to generate a quality report.
[0068] In another aspect, this application also proposes an online detection system for complex printing defects on glass bottles to implement the above method, such as... Figure 3 As shown, the system includes: Conveying and Precision Positioning Module: Includes a variable frequency speed control conveyor line, guiding mechanism, encoder and servo positioning mechanism to ensure stable bottle spacing and uniform posture.
[0069] Optical lighting module: integrates multiple light sources such as low-angle ring light, coaxial light, and backlight, as well as their independent controllers. The lighting scheme can be configured via software according to the bottle shape and printing characteristics.
[0070] High-speed imaging module: includes at least one high-resolution area or line scan industrial camera, equipped with an anti-smudging lens, and the shooting timing is precisely controlled by a trigger controller.
[0071] Image processing and AI analysis module: This is the core of the system's computation, including: Image processing unit: performs preprocessing algorithms such as image fusion, enhancement, and localization.
[0072] AI Inference Unit: Equipped with a GPU or high-performance AI accelerator card, it runs the printed area localization model and the deep learning defect recognition model.
[0073] Rule Decision Unit: Embedded configurable invalidation rule engine.
[0074] Scrap Execution Module: Based on the analysis instructions from the rule-based judgment unit, it controls the rejection device (such as a pneumatic push rod or robotic arm) to remove non-conforming products from the production line.
[0075] Human-computer interaction and data management module: Provides a graphical user interface for parameter setting, model management, real-time monitoring, alarm display, historical data query and quality report generation.
[0076] Based on the above technical solution, this application takes a liquor glass bottle production line as an example. The bottle body has a red gradient hot-stamped gold logo and black embossed patterns, and the actual effect is as follows. Figure 4 As shown.
[0077] 1. System Configuration: • The conveyor speed is set to 4 m / s, and the bottle spacing is 200 mm.
[0078] • It uses a 20-megapixel monochrome camera, combined with the aforementioned multiple light sources.
[0079] • The industrial control computer has an integrated NVIDIA Jetson AGX Orin as its AI inference unit.
[0080] 2. Model Training: • Collect approximately 5,000 images of qualified products and various defective products (approximately 10 types of defects in total), and label them (label with classification tags and segmentation masks).
[0081] • Using the PyTorch framework, a multi-task learning model was built and trained using ResNet-50-FPN as the backbone network.
[0082] • Simulated glass reflection noise was added during training.
[0083] 3. Online testing process: (1) When the bottle reaches the detection position, the encoder triggers the camera, and within 2ms, the coaxial light and low-angle light are turned on in sequence and two images are acquired.
[0084] (2) The image processing unit quickly merges the two images and calls the deployed lightweight positioning model (YOLOv11s variant) to extract the logo and pattern area.
[0085] (3) The two region images are fed into the defect recognition multi-task model respectively. The model outputs the results within 50ms: for example, a "dirt spot" defect is identified in the pattern region, its outline is segmented, and its area is calculated to be 0.8mm².
[0086] (4) The rule judgment unit immediately sends a signal to the rejection cylinder according to the preset rule "the area of dirt spots in the patterned area is greater than 0.5 mm² and then it is rejected" and pushes out the unqualified bottle at the next station.
[0087] (5) All data from this inspection (image ID, defect type, area, location, and judgment result) are stored in an SQL database.
[0088] 4. Results: The system achieved a testing speed of over 300 bottles per minute, with a detection rate of over 99.5% for defects such as dirt spots, missing prints, and misregistration, and a false detection rate of less than 0.1%. Through quality reports, production managers discovered an increase in misregistration defects during a certain period, allowing them to adjust the printing equipment in a timely manner and improve the overall yield rate.
[0089] The technical principles of the present invention have been described above with reference to specific embodiments. These descriptions are merely for explaining the principles of the invention and should not be construed as limiting the scope of protection of the invention in any way. Based on this explanation, those skilled in the art can readily conceive of other specific embodiments of the invention without inventive effort, and these embodiments will all fall within the scope of protection of the present invention.
Claims
1. A deep learning-based online detection method for complex printed defects on glass bottles, characterized in that, include: Step A: Collect original images of the glass bottles being transported on the conveyor line from multiple angles and under different lighting conditions; Step B: Preprocess the acquired raw bottle images and fuse them into a fused image that highlights the defect features; Step C: Input the fused image into the printing area localization model to obtain the printing pattern area image; Step D: Input the printed pattern area image into the deep learning model to generate a defect probability map and defect type for the defect area of the printed pattern area image; Step E: Analyze the defect probability map according to the defect type to obtain the defect mask, and calculate the geometric features of the defect mask; Step F: Match the defect type, the geometric features of the defect mask, and the rejection rules to output the defect detection results; Step G: Link and store the original bottle image, defect type, defect detection result, detection timestamp, and batch number in the database. Perform multidimensional statistical analysis based on the detection timestamp, batch number, and defect type to generate a quality report.
2. The online detection method for complex printing defects on glass bottles based on deep learning according to claim 1, characterized in that, Step A includes: The glass bottles are transported into the inspection station along the conveyor line. The position information of the glass bottles is acquired and fed back in real time. When the glass bottle is detected to have entered the preset acquisition position, multiple original bottle images with different angles and different lighting conditions are acquired within the same inspection cycle by preset switching sequence, light intensity and light duty cycle of different light sources. Among them, the different lighting conditions formed by different light sources include low-angle ring light, coaxial light, and backlight.
3. The online detection method for complex printing defects on glass bottles based on deep learning according to claim 2, characterized in that, Before performing step A, the following is included: Based on the bottle's property parameters, the switching sequence, light intensity, and light duty cycle of different light sources are pre-configured in the formula library. Among them, the bottle body attribute parameters include at least the bottle body curvature radius, the coverage ratio of the printed area in the axial and circumferential directions of the bottle body, the type of printed ink layer, and the reflective properties of the ink layer.
4. The online detection method for complex printing defects on glass bottles based on deep learning according to claim 3, characterized in that, When performing step A, the following is included: The reflective image feature index is calculated for the original bottle body image acquired in real time. When the reflective image feature index exceeds the preset threshold range, the light intensity and light duty cycle of the corresponding light source are adaptively adjusted according to the preset adjustment rules. Among them, the reflective image feature indicators include the saturation pixel ratio, average brightness value, and reflective area.
5. The online detection method for complex printing defects on glass bottles based on deep learning according to claim 1, characterized in that, Step B includes: Step B1: Perform time synchronization and subpixel registration on multiple original bottle images acquired within the same detection cycle from multiple angles and under different lighting conditions, and perform brightness normalization and noise suppression processing on each original bottle image. Step B2: For each image processed in step B1, perform the following operations: Calculate sharpness and detail response characteristic metrics, where the detail response characteristic metrics include one or more of gradient magnitude, local contrast, and texture energy; Normalize the detailed response feature indicators; The normalized detailed response feature indicators are weighted and combined according to preset weight coefficients to obtain the initial weight map. High-brightness reflective areas are detected and reflective masks are generated. The initial weight map is then suppressed and corrected based on the reflective mask to obtain the final weight map. Step B3: The images processed in step B2 are fused according to pixel-level weights to obtain a fused image that highlights the defect features.
6. The online detection method for complex printing defects on glass bottles based on deep learning according to claim 1, characterized in that, Step C includes: The printing area localization model includes a backbone network, a feature pyramid network (FPN), and a detection head. The backbone network is used to extract multi-scale features of the fused image, the feature pyramid network is used to fuse high and low layer semantics to adapt to printed pattern areas of different sizes, and the detection head is used to output the coordinates of the circumscribed rectangle of the printed pattern area and the confidence level.
7. The online detection method for complex printing defects on glass bottles based on deep learning according to claim 6, characterized in that, Step C includes: An attention module is introduced into the key layer of the backbone network or the FPN fusion layer of the feature pyramid network to adaptively recalibrate multi-scale features, including: Channel weights are generated based on global averaging or max pooling to enhance channel response with print textures and edges; Spatial weights are generated based on multi-scale features to suppress the response of the bottle's highlight and the non-printed background area.
8. The online detection method for complex printing defects on glass bottles based on deep learning according to claim 1, characterized in that, Step D includes: The deep learning model includes a classification subnetwork and a segmentation subnetwork. The classification subnetwork is used to output the defect type of the defect region in the printed pattern region image, and the segmentation subnetwork is used to perform pixel-level semantic segmentation of the defect region to generate a defect probability map of the same size as the printed pattern region.
9. The online detection method for complex printing defects on glass bottles based on deep learning according to claim 8, characterized in that, Step E includes: Step E1: Threshold the defect probability map. Thresholding includes obtaining the defect probability value output by the segmentation sub-network at the pixel coordinates. When the defect probability value is greater than or equal to the preset probability judgment threshold, the pixel corresponding to the pixel coordinate is judged as a defect pixel. When the defect probability value is less than the preset probability judgment threshold, the pixel corresponding to the pixel coordinate is judged as a non-defect pixel. Step E2: Denoise the defect probability map by performing morphological opening and closing operations and filtering connected components to remove small false detection regions to obtain a defect mask.
10. The online detection method for complex printing defects on glass bottles based on deep learning according to claim 9, characterized in that, The calculation of the geometric features of the defect mask in step E includes: Calculate the pixel area, physical area, circumscribed rectangle, center point of circumscribed rectangle, boundary contour, curve length, and physical length of the defect mask.
