Defect detection system and method for glass bottle

By embedding the GBDM module into the YOLOv8 network model, the problems of large detection error and ambiguous category distinction in glass bottle inspection are solved, and high accuracy and robustness of surface defect detection of glass bottles are achieved.

CN121504814APending Publication Date: 2026-02-10LUZHOU LAOJIAO CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511458356.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-13
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

The existing YOLOv8 network model has shortcomings in glass bottle detection, such as large detection errors and ambiguous category distinctions, resulting in low robustness and accuracy.

Method used

The GBDM module is embedded in the backbone network of the YOLOv8 network model. By utilizing a multi-branch structure such as wavelet transform, Gabor directional filtering, and specular reflection suppression, the feature extraction capability for various complex defects such as cracks, dirt, and breakage on the surface of glass bottles is enhanced.

Benefits of technology

It significantly improves the model's generalization ability in small sample scenarios, meets the real-time requirements of industrial scenarios, and achieves continuous self-optimization with strong robustness and high accuracy in detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121504814A_ABST
    Figure CN121504814A_ABST
Patent Text Reader

Abstract

The invention discloses a defect detection system and method for a glass bottle, and belongs to the field of industrial visual defect detection and analysis. The system comprises a GBDM module, the GBDM module is a defect detection module, and the GBDM module comprises a front attention enhancement structure, a rear attention enhancement structure and a defect detection structure, a multi-branch feature extraction structure is used for generating four feature branch diagrams; and the feature fusion structure is used for fusing the four feature branch diagrams. The GBDM module is embedded in the backbone network of the YOLOv8 network model, and multi-branch structures such as wavelet transform, Gabor direction filtering and specular reflection suppression are utilized, so that the feature extraction capability of multiple types of complex defects such as cracks, smudginess and damage on the surface of the glass bottle is enhanced, the generalization capability of the model in a small sample scene is remarkably improved, and the accuracy of the model is improved. The real-time requirement of an industrial scene is met, continuous self-optimization is achieved, and the method has high robustness, high accuracy and high application value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a defect detection system and method for glass bottles, belonging to the field of industrial visual defect detection and analysis. Background Technology

[0002] In the intelligent manufacturing and packaging quality inspection of glass bottles, accurate detection of surface defects (such as cracks, dirt, breakage, paint peeling, etc.) is crucial to ensuring product sealing, safety, and appearance quality. However, in practical applications, the following problems exist in the glass bottle inspection process: 1. The high reflectivity of glass results in strong specular reflection in the inspection images; 2. The defect scale varies greatly, from micron-level cracks to centimeter-level damage; 3. The defect morphology is complex, such as directional scratches, dense bubbles, and gradual dirt; 4. Uneven lighting or variable environment on the production line can easily lead to missed detections, false detections, and category confusion.

[0003] Among existing technologies, the YOLO (You Only Look Once) network model is widely used in industrial visual inspection due to its end-to-end and high-efficiency characteristics. This series of models unifies target classification and location regression into a single regression task, significantly improving inference speed while maintaining accuracy. Compared with traditional detection frameworks, the YOLO series has stronger global perception capabilities when handling complex image backgrounds and high-density targets, effectively reducing the risk of missed detections and false detections.

[0004] YOLOv8, the latest version in this network model series, features numerous optimizations in its structural design and detection mechanism. It abandons the traditional anchor-based mechanism, adopting an anchorless target regression approach, simplifying the training process and improving generalization ability. Simultaneously, its backbone network integrates lightweight design and deep semantic extraction capabilities, giving the model both rapid deployment advantages and the ability to capture subtle and complex defect features. The loss function in YOLOv8 has also been reconstructed, introducing a more stable bounding box matching strategy, further enhancing the model's accuracy in target localization and scale regression.

[0005] However, in the process of detecting glass bottles, due to the complex interference factors that actually exist on the surface of glass bottles, such as specular reflection, blurred texture, high-frequency noise, and similar morphological defects, relying solely on the original structure of the YOLOv8 network model still has defects such as large detection errors and blurred category distinctions, resulting in low robustness and accuracy of detection. Summary of the Invention

[0006] To address the shortcomings of current methods for defect detection in glass bottles, such as large detection errors and ambiguous category distinctions, which lead to low robustness and accuracy, this invention provides a defect detection system and method for glass bottles. By embedding a GBDM module into the backbone of the YOLOv8 network model and utilizing a multi-branch structure including wavelet transform, Gabor directional filtering, and specular reflection suppression, the system enhances the feature extraction capability for complex defects such as cracks, dirt, and breakage on the glass bottle surface. This significantly improves the model's generalization ability in small sample scenarios, meets the real-time requirements of industrial applications, achieves continuous self-optimization, and possesses strong robustness and high accuracy, making it highly valuable for application. The technical solution is as follows: A defect detection system for glass bottles includes a YOLOv8 network model, which comprises a backbone network, a feature fusion network, and a detection head. The backbone network further embeds a GBDM module, which is a defect detection module, and the GBDM module includes: The pre-attention enhancement structure enhances the responsiveness of the input feature map in terms of position and orientation by introducing vertical and horizontal spatial attention mechanisms; A multi-branch feature extraction structure is provided, comprising a conventional convolution branch, a wavelet transform branch, a Gabor convolution branch, and a specular reflection suppression branch distributed in parallel. The four parallel feature branches process the feature map respectively to generate four feature branch maps. A feature fusion structure is used to fuse the four feature branch maps.

[0007] Furthermore, the input image contains 9 types of defects and covers the shooting locations of the bottle mouth, neck, body, and bottom. The center coordinates x, y, width w, height h, and category id of the input image are normalized to obtain the feature map with an input size of 800×800 pixels.

[0008] Furthermore, the conventional convolutional branch employs 3×3 convolution, batch normalization, and ReLU activation function to extract the basic spatial texture features of the feature map.

[0009] Furthermore, the wavelet transform branch uses the Haar wavelet transform kernel to perform two-dimensional wavelet decomposition on the feature map, extracting low-frequency and high-frequency features in four directions respectively. The wavelet kernels in the four directions are specifically as follows: Low-frequency LL: [[0.5, 0.5], [0.5, 0.5]]; Vertical high-frequency LH: [[-0.5, -0.5], [0.5, 0.5]]; Horizontal high frequency (HL): [[-0.5, 0.5], [-0.5, 0.5]]; Diagonal high frequency HH: [[0.5, -0.5], [-0.5, 0.5]].

[0010] Furthermore, the Gabor convolution branch extracts the directional features of cracks and scratches from the feature map. The Gabor convolution kernel is calculated as follows: ; Where λ represents wavelength, θ represents the orientation angle of the convolution kernel, ψ is the phase shift, σ is the standard deviation of the Gaussian function, and γ is the aspect ratio parameter. = xcosθ+ysinθ; = -xsinθ+ycosθ.

[0011] Furthermore, the specular reflection suppression branch employs lightweight convolution combined with post-CA attention enhancement to generate weight parameters to achieve feature suppression of the reflective region of the feature map, wherein the lightweight convolution ranges from 3×3 convolution to 1×1 convolution.

[0012] Furthermore, the feature fusion structure includes: the four feature branch maps are aligned in size through interpolation, then concatenated along the channel dimension; next, channel compression is performed through 1×1 convolution; and finally, the feature distribution is unified through ReLU activation function and BatchNorm regularization operation. The fused feature map can be directly output and fed into the YOLOv8 network model for subsequent detection. The alignment function expression is as follows: , In the formula, h and w represent the height and width of the image, and c represents a formula for a specific step in a series of processing steps. The results of channel mapping and alignment for wavelet convolution and Gabor convolution branches are obtained by decomposing the global average pooling directional encoding vectors along both height and width, followed by Sigmoid normalization. and .

[0013] A defect detection method for glass bottles, based on the aforementioned defect detection system for glass bottles, includes the following steps: S1. Input feature map: The input feature map comes from the convolution output of one layer in YOLOv8. The feature map usually has multiple channels and a certain spatial dimension. S2. Calculate self-attention. The pre-attention enhancement structure introduces vertical and horizontal spatial attention mechanisms. The pre-attention enhancement structure calculates the relationship between different spatial positions and the similarity between different positions in the input feature map to obtain an attention weight map. This attention weight map is used to weight the positions and directions of defects in the input feature map, highlighting important regions and suppressing irrelevant regions. S3. Multi-branch feature extraction: After the attention weight map is input into the multi-branch feature extraction structure, the corresponding defect features are extracted using each parallel branch to generate the corresponding feature branch map. S4. Feature fusion: The feature branch maps are fused together using a feature fusion structure.

[0014] Furthermore, the fused feature branch maps are fed into the YOLOv8 backbone network to continue subsequent processing operations.

[0015] The beneficial effects of this invention are: By introducing a custom GBDM (Glass Bottle Defect Module) into the backbone of the YOLOv8 network model as a structural component to enhance feature perception capabilities, this GBDM module is based on a lightweight neural network structure. Through a multi-branch design concept, it integrates wavelet transform, Gabor directional filtering, specular reflection suppression, and attention mechanisms, which significantly improves the system's ability to identify multiple types of defects such as cracks, dirt, damage, and paint peeling. It effectively enhances the system's detection accuracy and robustness for complex texture defects (such as cracks, dirt, and edge damage). Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a diagram of the overall network architecture of GBDM-YOLOv8 according to Embodiment 1 of the present invention; Figure 2 This is a structural diagram of the GBDM module according to Embodiment 1 of the present invention; Figure 3 This is a flowchart of the network model working method according to Embodiment 2 of the present invention; Figure 4 The image shows the detection results of the original YOLOv8 model. Figure 5 This is a diagram illustrating the detection results of the network model in Embodiment 2 of the present invention. Detailed Implementation

[0018] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.

[0019] This invention belongs to the field of industrial visual defect detection, and specifically addresses the detection of surface defects in glass bottles. It proposes a defect detection system based on the GBDM-YOLO network model, specifically a defect detection system for glass bottles. Figure 1 As shown, this detection system significantly enhances its ability to detect various defects, including cracks, dirt, breakage, and paint peeling, by embedding a custom GBDM (Glass BottleDefect Module) into the backbone network of the YOLOv8 network model. The GBDM module, through multi-branch feature extraction including wavelet transform, Gabor directional filtering, specular reflection suppression, and attention mechanisms, effectively handles complex textures and specular interference on the glass bottle surface, improving the system's detection accuracy for minute defects. This significantly enhances the system's robustness and practicality, making it particularly suitable for real-time defect detection on industrial production lines.

[0020] In the technical solution of this invention, several key concepts are first defined: Object detection aims to accurately identify and locate predefined categories of objects in images or videos. It not only determines the presence of defects but also provides information on the spatial location and extent of the defects.

[0021] Frequency decomposition: This method uses wavelet transform or Fourier transform to decompose an image into different frequency components, which are then used to extract low-frequency structural information and high-frequency detail features respectively.

[0022] Directional Texture Perception: Using Gabor filters or similar methods, the image is convolved in multiple directions to enhance the model's sensitivity to directional defects such as thin cracks.

[0023] Attention Mechanism: By introducing modules such as Coordinate Attention and SE-Block, higher weights are adaptively assigned to key spatial locations and channel features to suppress irrelevant interference (such as specular highlights) and focus on defective areas.

[0024] Example 1 like Figure 1As shown in the figure, this embodiment discloses a defect detection system for glass bottles, including a YOLOv8 network model. The YOLOv8 network model includes a backbone network, a feature fusion network, and a detection head. The backbone network is responsible for extracting basic semantic features from the glass bottle image, such as the bottle outline, the edges of reflective areas, and texture details. The feature fusion module integrates multi-scale features from different depth layers, providing an expression with both local and global perspectives for subsequent judgment. The head network outputs the location and category of each potential defect based on the above information, which is a key step in completing the target detection task. The backbone network also embeds a GBDM module, which is a defect detection module.

[0025] Specifically, such as Figure 2 As shown, the GBDM module includes: The Coordinate Attention (CA) pre-attention enhancement structure encodes the input feature map at different positions, guiding the model to focus on potentially defective target regions and improving the spatial sensitivity of the feature map. This structure enhances the feature map's responsiveness in both position and direction by introducing vertical and horizontal spatial attention mechanisms, helping the subsequent model extract more focused target region features.

[0026] A multi-branch feature extraction structure is provided, which includes the following four parallel branches, each processing the feature map to generate four feature branch maps, as detailed below; The PlainBranch branch uses traditional 3×3 convolution, batch normalization, and ReLU activation functions to extract basic spatial texture features from the input feature map, serving as a perceptual baseline and providing a reference feature path.

[0027] The Wavelet Branch uses the Haar wavelet transform kernel to perform multi-frequency analysis on the input feature map, extracting low-frequency and high-frequency features (LL, LH, HL, HH) in four directions. The specific wavelet kernels for these four directions are: LL (low frequency): [[0.5, 0.5], [0.5, 0.5]]; LH (Vertical High Frequency): [[-0.5, -0.5], [0.5, 0.5]]; HL (Horizontal High Frequency): [[-0.5, 0.5], [-0.5, 0.5]]; HH (Diagonal High Frequency): [[0.5, -0.5], [-0.5, 0.5]]; The aforementioned wavelet transform branch can highlight abrupt changes in the glass bottle's edge, such as broken boundaries and fine cracks, which helps enhance the model's ability to perceive high-frequency details.

[0028] The Gabor convolution branch (GaborBranch) designs multiple Gabor convolution kernels with different directional angles, performing convolution at a single transformation angle of 45°. This simulates the human eye's sensitivity to directional textures, extracting features of directional defects such as cracks and scratches. The Gabor convolution kernel is calculated as follows: ; Where: λ represents the wavelength, used to control the size of the filter; θ represents the direction angle of the convolution kernel, which determines the main direction of the filter; ψ is the phase offset, used to adjust the initial phase of the sine wave; σ is the standard deviation of the Gaussian function, which determines the receptive field of the filter; and γ is the aspect ratio parameter, used to adjust the elliptical shape of the filter. = xcosθ+ysinθ; = -xsinθ+ycosθ; This branch integrates multi-directional texture response results and improves the ability to distinguish fine cracks through channel compression and convolution adaptation.

[0029] The SpecularReflectionBranch suppresses bright artifacts caused by reflections from the glass surface. It employs lightweight convolutional layers (replacing 3×3 convolutions with 1×1 convolutions) combined with post-processor CA attention enhancement to suppress reflective features in reflective areas. This branch effectively distinguishes between genuine defects and lighting interference, improving the system's stability and accuracy in real-world shooting scenarios.

[0030] The feature fusion structure, after the feature branch maps output by the four feature branches are aligned in size using interpolation, has the following alignment function expression: ; In the formula, h and w represent the height and width of the image, and c represents a formula for a specific step in a series of processing steps. The results of channel mapping and alignment for wavelet convolution and Gabor convolution branches are obtained by decomposing the global average pooling directional encoding vectors along both height and width, followed by Sigmoid normalization. and ; The features are then concatenated along the channel dimension, followed by channel compression using 1×1 convolution, and then unified through ReLU activation and BatchNorm regularization. The fused feature map can be directly output and fed into the subsequent YOLOv8 network model for further head detection and prediction.

[0031] The glass bottle defect detection system described in Embodiment 1 of the present invention outputs the bounding box coordinates (x, y, w, h) and category confidence level of each defect through an end-to-end detector network.

[0032] In existing technologies, when faced with complex interference factors actually present on the surface of glass bottles, such as specular reflection, texture blurring, high-frequency noise, and morphologically similar defects, relying solely on the native structure of the YOLOv8 network model still suffers from problems such as large detection errors and unclear category distinctions. Therefore, this invention introduces a custom GBDM (Glass Bottle Defect Module) module into the backbone of the YOLOv8 network model as a structural component to enhance feature perception capabilities. This GBDM module is based on a lightweight neural network structure, integrating wavelet transform, Gabor directional filtering, specular reflection suppression, and attention mechanisms. Through a multi-branch design concept, it specifically processes frequency information, directional response, background interference, and salient region attention, significantly improving the model's ability to identify multiple types of defects such as cracks, dirt, breakage, and paint peeling. This effectively enhances the system's detection accuracy and robustness for complex texture defects (such as cracks, dirt, and edge damage).

[0033] Furthermore, the fused feature branch maps are fed into the YOLOv8 backbone network to continue subsequent processing operations.

[0034] Furthermore, in the YOLOv8 network model, the location regression loss adopts the CIoU (Complete IoU) loss, which comprehensively considers the overlap between the predicted box and the ground truth box, the distance between the center points, and the difference in aspect ratio. Its function is as follows: ; in: ; ; ; ; Where A and B are the center coordinates and width and height of the predicted box and the ground truth box, respectively; c is the diagonal length of the smallest closed box containing A and B; and α is the aspect ratio difference weight. The classification loss uses a multi-label binary cross-entropy form, independently optimizing the class probabilities of each predicted bounding box. The classification loss function is as follows: ; Where N is the total number of predicted bounding boxes, and C is the number of defect categories. For the i-th box, the true label of the j-th class is... Predict probabilities for the model.

[0035] The total loss function is: ; in, and These are the weighting coefficients for the bounding box loss and the classification loss, respectively, used to balance the importance of localization and classification tasks.

[0036] In this invention, the YOLOv8 algorithm is used to detect defects on the surface of glass bottles. During the inference phase, the model outputs the spatial location information of each suspected defect area in the image, including the center coordinates x, y, width w, height h, and confidence probability values ​​for each category.

[0037] Example 2 This second embodiment provides a defect detection method for glass bottles, based on the aforementioned defect detection system for glass bottles, which includes: S1. Input feature map: The input feature map comes from the convolution output of one layer in YOLOv8. The feature map usually has multiple channels and a certain spatial dimension. S2. Calculate self-attention. The pre-attention enhancement structure introduces vertical and horizontal spatial attention mechanisms. The pre-attention enhancement structure calculates the relationship between different spatial positions and the similarity between different positions in the input feature map to obtain an attention weight map. This attention weight map is used to weight the positions and directions of defects in the input feature map, highlighting important regions and suppressing irrelevant regions. S3. Multi-branch feature extraction: After the attention weight map is input into the multi-branch feature extraction structure, the corresponding defect features are extracted using each parallel branch to generate the corresponding feature branch map. S4. Feature fusion: The feature branch maps are fused together using a feature fusion structure.

[0038] Furthermore, to avoid multiple predicted boxes repeatedly identifying the same defect region, the YOLOv8 network model integrates the Non-Maximum Suppression (NMS) algorithm by default during the inference process to remove redundant candidate boxes and retain only the best detection results.

[0039] The selection steps for the NMS algorithm are as follows: S1. Select the prediction box with the highest confidence from all predicted candidate boxes of glass bottle defect images. ; S2. Calculate the prediction box. The Intersection over Union (IoU) with all other predicted bounding boxes is calculated using the following formula: ; in, This represents the area of ​​the intersection of two candidate boxes A and B. This represents the area of ​​the union of two candidate boxes A and B; S3. Since defects on the surface of glass bottles may adhere or aggregate, to avoid repeated detection, when the overlap IoU exceeds the set threshold τ, candidates with lower confidence in the candidate box are removed. S4. Repeat the above steps for the remaining candidate boxes until all candidate boxes have been processed.

[0040] Model Training: After integrating the YOLOv8 network backbone with the GBDM module, this invention conducted systematic training experiments to improve the detection capabilities of micro-cracks, directional textures, and specular reflection interference on industrially acquired glass bottle surface images, while maintaining the feasibility of engineering deployment. The model training followed a reproducible process, and empirically validated parameter ranges were used in key stages to ensure the comparability and robustness of the results. The specific steps of the main model training process are as follows: S1. Initial Model Construction: Build the detection network based on custom configuration parameters, and call the Ultralytics YOLO interface to complete the loading of the network structure and weight initialization.

[0041] S2. Dataset Preparation and Labeling Specifications: The data used comes from the production line and consists of real-life images of glass bottle surfaces taken with industrial cameras. The images cover five categories of locations: top, neck, body, bottom, and other defects. Nine defect types are included: damaged labels, inverted bottles, flying insects, burn marks, cracks, paint peeling, breakage, foreign objects, and dirt. All samples are manually labeled, and the center coordinates (x, y), width (w), height (h), and category ID of the images are normalized to conform to the YOLO network model specifications.

[0042] S3. Training Configuration and Optimization Strategy: Training consists of 800 epochs, with input image size of 800×800 pixels and batch size of 16. To prevent overfitting, an early stopping strategy is implemented when the validation set metrics do not improve within 50 consecutive epochs; the initial learning rate is set to... The minimum learning rate ratio is 0.01, and the first 10 epochs are a warm-up phase; the weight decay coefficient is set to... For data augmentation, hue, saturation, and brightness perturbations were used (hsv_h=0.015, hsv_s=0.7, hsv_v=0.4), and vertical and horizontal flipping was performed with a 50% probability (flipud=0.5, fliplr=0.5); simultaneously, mosaic (=1.0) and mixup (=0.2) blending enhancements were enabled, with augmentation=True. Training was run on the GPU, with automatic blended precision (AMP) enabled to improve training efficiency and save GPU memory.

[0043] S4. Training Execution and Model Selection Strategy: Training is performed in batches using forward inference and backpropagation. During training, the model is periodically evaluated on a validation set, recording accuracy, recall, and mean precision (mAP50). The model's performance is analyzed, with particular attention paid to its detection performance on small cracks, linear scratches, and specular reflection areas, as these minor or directional defects are easily missed or misjudged. To avoid overfitting, an early stopping strategy is employed during training. Training is terminated and the model rolls back to the optimal checkpoint when the validation metrics show no significant improvement over several consecutive epochs.

[0044] S5. Numerical Experiments and Result Analysis This numerical experiment used surface images of industrial glass bottles collected from actual production lines, covering five imaging locations: top, neck, body, bottom, and others. A total of nine types of defects were identified, including cracks, dirt, chips, and foreign objects. The images were acquired by an industrial camera with a resolution of 200×200 pixels and were manually labeled to construct the dataset. In the experiment, the dataset was divided into a training set of 255 images, a validation set of 255 images, and a test set of 50 images.

[0045] The model training section compares the original YOLOv8n network model (a specific version of the YOLOv8 network model) with the GBDM-YOLO network model of this invention. The training configuration is as follows: 800 training epochs, input size 800×800 pixels, batch size 16, early stopping patience value 50, and initial learning rate... Minimum learning rate ratio 0.01, number of warm-up rounds 10, weight decay. Data augmentation strategies include color perturbation (hsv_h=0.015, hsv_s=0.7, hsv_v=0.4), horizontal and vertical flipping (50% probability each), and mixed augmentation (100% and 20%), with augmentation=True. Training was run on a GPU with Automatic Mixed Precision (AMP) enabled to improve computational efficiency and save GPU memory. To comprehensively evaluate model performance, this invention used precision, recall, mean average precision (mAP@0.5), and a custom class detection rate metric (defined as the proportion of correctly predicted classes at the sample level, with the class with the highest predicted probability for each sample being taken as the final result). The evaluation results of the two models on the test set are shown in Table 1 below.

[0046]

[0047] Table 1. Performance metrics of different models on the test set As shown in Table 1, integrating the GBDM module into the original YOLOv8 network model improved the accuracy by 6.16 percentage points, the recall by 1.55 percentage points, and the mAP@0.5 by 0.78 percentage points, while significantly increasing the class detection rate to 100%. This demonstrates that the GBDM module effectively enhances the model's discrimination ability in glass bottle defect detection, particularly in improving the overall class detection rate and accuracy, proving the model's effectiveness.

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

Claims

1. A defect detection system for glass bottles, comprising a YOLOv8 network model, wherein the YOLOv8 network model includes a backbone network, a feature fusion network, and a detection head, characterized in that, The backbone network also embeds a GBDM module, which is a defect detection module. The GBDM module includes: The pre-attention enhancement structure enhances the responsiveness of the input feature map in terms of position and orientation by introducing vertical and horizontal spatial attention mechanisms; A multi-branch feature extraction structure is provided, comprising a conventional convolution branch, a wavelet transform branch, a Gabor convolution branch, and a specular reflection suppression branch distributed in parallel. The four parallel feature branches process the feature map respectively to generate four feature branch maps. A feature fusion structure is used to fuse the four feature branch maps.

2. The defect detection system for glass bottles according to claim 1, characterized in that, The input image contains 9 types of defects and covers the shooting locations of the bottle mouth, neck, body, and bottom. The center coordinates x, y, width w, height h, and category id of the input image are normalized to obtain the feature map with an input size of 800×800 pixels.

3. The defect detection system for glass bottles according to claim 1, characterized in that, The conventional convolutional branch employs 3×3 convolution, batch normalization, and ReLU activation function to extract the basic spatial texture features of the feature map.

4. The defect detection system for glass bottles according to claim 1, characterized in that, The wavelet transform branch uses the Haar wavelet transform kernel to perform two-dimensional wavelet decomposition on the feature map, extracting low-frequency and high-frequency features in four directions respectively. The wavelet kernels in the four directions are specifically as follows: Low-frequency LL: [[0.5, 0.5], [0.5, 0.5]]; Vertical high-frequency LH: [[-0.5, -0.5], [0.5, 0.5]]; Horizontal high frequency (HL): [[-0.5, 0.5], [-0.5, 0.5]]; Diagonal high frequency HH: [[0.5, -0.5], [-0.5, 0.5]].

5. A defect detection system for glass bottles according to claim 1, characterized in that, The Gabor convolution branch extracts the directional features of cracks and scratches from the feature map. The Gabor convolution kernel is calculated as follows: ; Where λ represents wavelength, θ represents the orientation angle of the convolution kernel, ψ is the phase shift, σ is the standard deviation of the Gaussian function, and γ is the aspect ratio parameter. = xcosθ+ysinθ; = -xsinθ+ycosθ.

6. A defect detection system for glass bottles according to claim 1, characterized in that, The specular reflection suppression branch uses lightweight convolution combined with post-CA attention enhancement to generate weight parameters to achieve feature suppression of the reflective region of the feature map, wherein the lightweight convolution is from 3×3 convolution to 1×1 convolution.

7. A defect detection system for glass bottles according to claim 1, characterized in that, The feature fusion structure includes: the four feature branch maps are aligned in size through interpolation, then concatenated along the channel dimension; next, channel compression is performed through 1×1 convolution; and finally, the feature distribution is unified through ReLU activation and BatchNorm regularization. The fused feature map can be directly output and fed into the YOLOv8 network model for subsequent detection. The alignment function expression is as follows: ; In the formula, h and w represent the height and width of the image, and c represents a formula for a specific step in a series of processing steps. The results of channel mapping and alignment for wavelet convolution and Gabor convolution branches are obtained by decomposing the global average pooling directional encoding vectors along both height and width, followed by Sigmoid normalization. and .

8. A method for detecting defects in glass bottles, comprising a defect detection system for glass bottles according to any one of claims 1 to 7, characterized in that, It includes the following steps: S1. Input feature map: The input feature map comes from the convolution output of one layer in YOLOv8. The feature map usually has multiple channels and a certain spatial dimension. S2. Calculate self-attention. The pre-attention enhancement structure introduces vertical and horizontal spatial attention mechanisms. The pre-attention enhancement structure calculates the relationship between different spatial positions and the similarity between different positions in the input feature map to obtain an attention weight map. This attention weight map is used to weight the positions and directions of defects in the input feature map, highlighting important regions and suppressing irrelevant regions. S3. Multi-branch feature extraction: After the attention weight map is input into the multi-branch feature extraction structure, the corresponding defect features are extracted using each parallel branch to generate the corresponding feature branch map. S4. Feature fusion: The feature branch maps are fused together using a feature fusion structure.

9. A defect detection method for glass bottles according to claim 1, characterized in that, The fused feature branch maps are then fed into the YOLOv8 backbone network for further processing.

Citation Information

Cited By

  • Camouflage target detection method based on texture and edge enhancement

    CN121884004A

  • A camouflage target detection method based on texture and edge enhancement

    CN121884004B