A pot defect detection method and device based on improved YOLO26

CN122434832APending Publication Date: 2026-07-21XIAN TI DOU METAL PROD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XIAN TI DOU METAL PROD TECH CO LTD
Filing Date
2026-04-03
Publication Date
2026-07-21

Smart Images

  • Figure CN122434832A_ABST
    Figure CN122434832A_ABST
Patent Text Reader

Abstract

The present application belongs to the field of computer vision and industrial intelligent manufacturing quality inspection, and discloses a pot defect detection method and device based on improved YOLO26, which solves the problems of weak anti-metal surface reflection ability, poor multi-scale feature fusion effect, rough segmentation boundary and inability to accurately quantify the physical size of defects of the existing model. The method first constructs and preprocesses a pot defect dataset containing pixel-level mask labels, and then reconstructs the depth of the YOLO26 network: replace the C3k2 module of the backbone and neck network with the A2C2f-IFGC module, add the MCAF multi-scale cross-domain attention fusion module after the C2PSA module at the tail of the backbone network, and replace the original prediction head after the neck network with the TDAL-SegHead task dynamic alignment segmentation head. Experimental verification shows that the model has the advantages of strong anti-reflection, good multi-scale feature alignment effect, and high-precision segmentation boundary, realizes the full-process closed loop of pot quality inspection and high-precision defect quantification, and can be directly applied to the online quality inspection link of high-end kitchenware intelligent manufacturing, and adapts to the high-tact quality inspection demand of the industrial production line.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of computer vision and industrial intelligent manufacturing quality inspection, specifically to a method and apparatus for detecting defects in cookware based on an improved YOLO26. Background Technology

[0002] As indispensable kitchen utensils in daily life, the surface quality of cookware directly determines the product's aesthetics, durability, and the end-user experience. In the modern industrial production of cookware, the complex processes of die casting, polishing, stamping, and handling easily result in various types of flaws and defects on the surface, such as scratches, pinholes, oil stains, and dents. These defects are highly complex in their visual presentation: oil stains typically appear as large-area, low-frequency features with blurred edges; while scratches and pinholes are fine-grained, tiny localized structural defects. Furthermore, the highly reflective and light-sensitive nature of metal cookware surfaces exponentially amplifies the difficulty of extracting defect features.

[0003] Traditional cookware surface quality control primarily relies on manual visual inspection. This method is not only inefficient and labor-intensive, but also highly susceptible to the subjective judgment and visual fatigue of inspectors, leading to a high rate of missed defects and failing to meet the stringent yield requirements of modern high-end manufacturing. In recent years, deep learning-based visual inspection and segmentation technologies have been gradually introduced into industrial quality inspection processes. However, existing defect segmentation models still face three major technological bottlenecks when dealing with the inspection needs of complex cookware surfaces: First, existing models lack fine-grained perception capabilities to withstand strong light interference during feature extraction. Changes in illumination and reflections on metal surfaces cause traditional static convolution to extract a large amount of invalid background noise, masking local gradient abrupt changes caused by minor defects such as scratches and pinholes. This results in a severe deficiency in the model's ability to capture minute structural defects, making it highly susceptible to missed detections in reflective areas.

[0004] Secondly, existing multi-scale feature fusion mechanisms in networks struggle to take into account frequency domain features across extreme scales. Traditional feature pyramids or single-scale attention mechanisms, when fusing large-scale features, fail to perfectly align the global low-frequency contextual information required for large-scale defects with the local high-frequency edge features required for small-scale defects in the same high-dimensional space. This can easily lead to coarse boundaries in segmentation mask predictions and the submergence of small target features.

[0005] Finally, existing segmentation head designs lack dynamic adaptive capabilities to multi-task trajectory conflicts. In pixel-level semantic segmentation tasks, the model needs to simultaneously consider global semantic recognition and local detail localization. Mainstream methods often employ statically parallel prediction branches, which cannot explicitly measure and mitigate spatial offsets and feature conflicts between semantic trajectories and boundary trajectories. This results in the model being unable to adaptively balance feature weights when dealing with objects such as blurred edges (e.g., oil stains) or collisions with local deformation, leading to poor segmentation edge fit, difficulty in recognition, and insufficient robustness. Summary of the Invention

[0006] The purpose of this invention is to provide a method and apparatus for detecting cookware defects based on an improved YOLO26, addressing the aforementioned technical problems.

[0007] The technical solution of the present invention is as follows: S1, Construction and preprocessing of cookware defect dataset: Collect cookware surface images from industrial production lines with different lighting conditions and background environments, covering typical defects such as scratches, bumps, oil stains and pinholes; perform pixel-level semantic annotation on the images to generate defect mask labels; perform data cleaning and data augmentation on the annotated images to simulate complex factory lighting environments, and divide the processed dataset into training set, validation set and test set according to a preset ratio.

[0008] S2, Construction of a Cookware Defect Segmentation Model Based on Improved YOLO26: The YOLO26 segmentation network is used as the foundation for deep reconstruction. An A2C2f-IFGC module is designed in the backbone and neck network to replace the original C3k2 module. This module embeds information flow-driven convolutions into the feature extraction bottleneck to suppress metal surface reflection and extract fine-grained features. A multi-scale cross-domain attention fusion module (MCAF) is designed at the tail of the backbone network and placed after the C2PSA module to unify multi-resolution features with the global context. The original prediction head is replaced with a unified task-dynamic alignment segmentation head (TDAL-SegHead) to alleviate the conflict between semantic recognition and boundary localization.

[0009] S3, Model Training and Optimization: The training set is input into the constructed cookware defect segmentation model for iterative training. During training, the model extracts and fuses features through the A2C2f-IFGC module in the backbone and neck networks, dynamically aligns the segmentation head output with the predicted mask through the task, calculates the segmentation loss between the predicted mask and the true mask label, and uses the optimizer to update the network parameters through backpropagation until the model converges on the validation set, thus obtaining the trained cookware defect segmentation model.

[0010] S4, High-precision defect segmentation and physical size calculation: Acquire video frames or images of the cookware to be inspected on the actual production line and input them into the trained cookware defect segmentation model. After A2C2f-IFGC feature extraction, MCAF cross-scale alignment, and TDAL-SegHead dynamic recalibration, the model outputs a pixel-level mask and the corresponding defect category probability. Connected components are extracted based on the predicted pixel-level mask to obtain the pixel set of each independent defect. Combining the calibration parameters of the industrial camera, i.e., the actual physical area represented by a single pixel, the total number of pixels contained in the connected component of the defect is multiplied by the actual physical area to calculate the actual physical size of the defect. If the actual physical size or category probability of the defect exceeds a preset quality threshold, the cookware is determined to be defective.

[0011] S5, Industrial-side deployment of the model: The trained cookware defect segmentation model is exported as a lightweight inference format and deployed on the edge computing device or industrial control host of the production line. Combined with multi-threading and hardware acceleration technology, parallel inference is performed to realize real-time online segmentation, size calculation and rejection of good products for cookware surface defects.

[0012] Compared with the prior art, the present invention has the following beneficial effects: (1) The closed-loop process and high-precision quantification solve the application pain point that traditional target detection cannot quantify the actual defect area. Traditional bounding box detection can only provide rough rectangular positioning and cannot fit the actual topological edges of irregular defects such as oil stains and scratches. This invention opens up the entire industrial quality inspection process from dynamic feature extraction to edge deployment. It accurately extracts connected components through high-precision pixel-level semantic segmentation masks and combines them with camera calibration parameters to achieve accurate measurement of the physical size of defects of arbitrary shapes, providing reliable quantitative data support for industrial yield analysis.

[0013] (2) Strong anti-reflection and fine-grained perception solve the problems of feature submersion and strong light interference that are prone to occur on metal surfaces by traditional feature extraction modules such as C3k2. The traditional C3k2 module relies on a fixed receptive field and static convolution parameters, which cannot distinguish between the high gloss reflection of metal and real small defects. This invention introduces the A2C2f-IFGC module in the backbone and neck network, which perfectly integrates information flow driven convolution (IFGC) into the multi-branch bottleneck structure. The parameters of the convolution kernel are adjusted by dynamically calculating the local gradient and variance. This mechanism enables the model to actively suppress noise in smooth reflective areas and accurately focus on high-frequency abrupt changes caused by small defects such as pinholes and scratches as needed.

[0014] (3) The extreme multi-scale fusion and feature alignment solve the problems of small target loss and large target boundary blurring in traditional feature pyramids under extreme scale spans. This invention creatively introduces the MCAF module at the tail of the backbone network (after the C2PSA module), realizing cross-scale pixel-level alignment of shallow high-resolution boundary information and deep semantic information in a unified high-dimensional attention space, and is supplemented by frequency domain filtering to eliminate aliasing noise; ensuring that the model does not lose small features and maintains the smoothness of large target segmentation edges when facing large areas of oil stains and extremely small pinholes at the same time.

[0015] (4) Task dynamic alignment and high-fidelity boundary fitting solve the problem of rough segmentation edges caused by semantic and boundary trajectory conflicts in traditional prediction heads. The TDAL-SegHead of this invention is the first to construct a dynamic gradient modeling mechanism inside the segmentation head, explicitly quantifying and evaluating the conflict gap between semantic feature trajectories and boundary detail feature trajectories; through conflict-aware recalibration, the model can adaptively compromise and align these two types of features, achieving highly robust identification of difficult-to-detect defects and accurate fitting of mask boundaries when dealing with extremely blurry oil stains or collisions with local geometric distortions. Attached Figure Description

[0016] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments will be briefly introduced below. Obviously, the 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 : Overall flowchart of the cookware defect detection method based on the improved YOLO26; Figure 2 Improved overall architecture diagram of the YOLO26 model; Figure 3 : Structural topology diagram of the A2C2f-IFGC module; Figure 4 : Block diagram of the MCAF module; Figure 5 : Block diagram of the TDAL-SegHead module; Figure 6 Performance curves of each model in detection and segmentation on the cookware defect detection dataset. Detailed Implementation

[0018] The embodiments of the present invention are described in detail below. The embodiments described with reference to the accompanying drawings are exemplary. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.

[0019] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments. Obviously, the described embodiments are merely some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0020] This embodiment provides a cookware defect detection method based on an improved YOLO26 standard, such as... Figure 1 As shown, to address the challenges of industrial inspection such as strong surface reflectivity, large defect size range, and blurred boundaries in cookware, the YOLO26 architecture has been deeply reconstructed. This method specifically includes the following steps: S1. Construction and Preprocessing of the Cookware Defect Dataset. Original images of cookware surfaces from multiple angles and under various lighting conditions on an industrial production line were acquired, covering typical defects such as scratches, dents, oil stains, and pinholes. A polygon annotation tool was used to perform pixel-level semantic annotation of the defects in the images, generating corresponding defect masks. To improve the model's generalization ability in complex factory environments, data cleaning and data augmentation were performed on the annotated images. Specific data augmentation strategies included: random cropping, random rotation, adaptive adjustment of brightness and contrast, and introducing Gaussian noise to simulate dust and lighting interference in industrial settings. The processed dataset was then divided into training, validation, and test sets in a pre-defined 8:1:1 ratio.

[0021] S2, Construction of a cookware defect segmentation model based on improved YOLO26. (For example...) Figure 2 As shown, based on the YOLO26 segmentation network architecture, its backbone, neck, and prediction head are systematically improved. The specific construction process is as follows: S2.1, the A2C2f-IFGC module was designed and introduced. The A2C2f-IFGC module was designed to replace the original C3k2 module in both the backbone and neck networks. This module embeds continuous information flow-driven convolutions (IFGC) within a dual-branch bottleneck architecture similar to a cross-stage local network (CSP) to adaptively suppress surface reflections on metal surfaces and extract fine-grained defect features from cookware. Combined with the appendix... Figure 3 The structural topology, its specific calculation process is divided into two levels: macroscopic architectural feature transformation and microscopic IFGC operator calculation. Furthermore, the macroscopic architecture feature flow (A2C2f structure part) is as follows: given the initial input feature map of this module... First, a regular convolutional layer (Conv) is used for channel adjustment and feature preprocessing to obtain the basic feature map. : , in, This represents the initial input feature tensor of the A2C2f-IFGC module; This represents the regular convolution operations at the front end of the module, including convolution, batch normalization (BatchNorm), and activation functions; This represents the basic feature map output after preprocessing.

[0022] Subsequently, the basic feature map The information transmission is divided into two parallel paths. The first path (upper branch) extracts features directly through a regular convolutional layer; the second path (lower branch) continuously passes through... The process involves two IFGC operators, followed by a regular convolutional layer. The output expressions for the two paths are as follows: , , in, This represents the output feature map of the upper branch (the first path); This indicates a regular convolution operation in the branch above; Indicates the first cascade in the lower branch Each information flow-driven convolutional module, in which Indicates the total number of cascaded IFGC modules, which is a positive integer; This indicates a regular convolution operation where the lower branch is connected after passing through all IFGC modules; This represents the final output feature map of the lower branch (the second path).

[0023] Finally, the output feature maps from the upper and lower branches are input into the Shortcut fusion module for feature aggregation and output: , in, This indicates shortcut fusion operations, including concatenation of features along the channel dimension or addition of features element by element. This represents the fused feature map that is finally output by the A2C2f-IFGC module.

[0024] Furthermore, the computation of the micro-dynamic operator (internal structure of IFGC) is as follows: for any IFGC module in the lower branch, let its input feature be... .like Figure 3 As shown, input It will simultaneously enter two sub-modules: Information Density CalcD and Dynamic Kernel GenK.

[0025] First, construct an information density map at a local scale. The input feature map is divided into several local regions. For each region, calculate the gradient magnitude and local variance: , , , in, This represents the input feature map of the current IFGC module; Indicates the feature map A local receptive field region defined in the spatial dimension; Indicates location in a local area The characteristic tensor values ​​within; This represents the gradient operator, used to extract edge and high-frequency texture information within a local region; Represents the calculated local region The gradient magnitude characterizes the sharpness of the structure in this region; This represents the variance calculation function; Represents the calculated local region The characteristic variance characterizes the statistical volatility (smoothness) of the signal in this region. This represents the normalization operation performed across the entire feature map space. This indicates the local region after weighted summation and normalization. Information density value. Traverse all regions. This can be combined to form a complete information density map. .

[0026] Subsequently, the calculated information density map Feed the dynamic kernel generation (Kernel GenK) module, combining the input features. Explicitly mapped to the structural parameters of the convolution kernel: , , , , in, This represents the complete information density map constructed in the previous step; This represents the kernel size mapping function, used to adaptively determine the receptive field size based on density; This represents the kernel shape mapping function, used to control the anisotropy and directionality of the convolution kernel; This represents the kernel weight generation function, which outputs specific convolution parameter values ​​based on density changes. , , These represent the size, shape, and weight matrix of the dynamically generated convolutional kernel, respectively. This represents the convolution kernel assembly function; This refers to a dynamic convolution kernel that is tailored to the local information flow density of the input region.

[0027] Finally, perform the dynamic convolution operation: , in, Represents a dynamic convolution operator; This represents the original input feature map of the IFGC module; This indicates that the information flow generated in the previous stage drives the dynamic convolution kernel; This represents the intermediate feature map output after dynamic convolution processing. This is the final output of the current IFGC module, which is then passed to the next cascaded module.

[0028] S2.2, Design and introduce a multi-scale cross-domain attention fusion module (MCAF). At the tail of the backbone network (after the C2PSA module), design and integrate the multi-scale cross-domain attention fusion module (MCAF). For example... Figure 4 As shown, this module structurally constructs a high-dimensional attention space that spans scale, frequency domain, and semantic context to address the problem of unifying multi-resolution features when large areas of oil stains and tiny pinholes coexist on the surface of cookware. Based on the structural topology in the attached diagram, its specific computation and feature transfer process is divided into four levels: Furthermore, the multi-branch feature preprocessing and feature reconstruction are performed as follows: given four different scale input feature branches from the network's pre-processing stage, denoted as follows: , , and To extract complementary spatial texture and semantic statistical information, different scale operators are applied to reconstruct these four branches: , , , in: , , , They respectively represent the corresponding to The original input feature map; This represents the depthwise separable convolution operation (DSConv), which is used to extract local spatial topological features while reducing the number of parameters. This represents a standard convolution operation. This represents an upsampling operation (UPSample) used to align the sizes of low-resolution deep semantic features; , , , These represent the spatially resolution-aligned multi-resolution feature tensors after reconstruction using the aforementioned scaling operators.

[0029] Furthermore, the spatial feature aggregation path (upper part of the structure diagram) involves concatenating the four reconstructed features along the channel dimension to obtain mixed-scale features. : , in This indicates a splicing operation along the channel dimension; This represents the aggregated feature tensor that contains all local details at all scales and global semantics after concatenation.

[0030] Subsequently, The spatial features are smoothed and fused with depth by sequentially passing through a convolutional layer and a residual block (Res Block): , in: This represents the intermediate layer's regular convolutional operation used for channel dimensionality reduction and feature integration; This represents a residual feature extraction block, used to prevent gradient vanishing and further extract deep spatial features; This represents the spatial fusion feature tensor, which is the final output of the spatial feature aggregation path.

[0031] Furthermore, for the aforementioned cross-scale semantic frequency domain path (lower half of the structure diagram), in order to achieve dynamic information routing between different scales, the reconstructed features are... to The input is fed into the feature selector. The feature selector calculates the correlation gating weights between scales using global information. : , in: , They represent the first The and the first Reconstructed feature tensors at various scales ; This indicates a global average pooling operation, used to extract global statistics for features at this scale. This represents the mapping function of a multilayer perceptron (MLP), used to calculate the correlation between global statistics at two scales; Indicates the subscript The normalized exponential function executed along the dimension; Representing scale scale Dynamic gating attention weights.

[0032] Next, the features are fed into the Cross-Scale Attention module to compute a fully bidirectional cross-scale attention response. Alignment features are obtained by aggregating gating weights. : , , in: Representing scale The learnable weights of the query matrix; , Representing scale Learnable weights of the key and value matrices; This represents the scaling factor in the attention mechanism, which is the square root of the number of channels; This represents the matrix transpose operation; This represents the normalized exponential function; Representing scale scale Attention mapping features in high-dimensional space; This indicates a summation operation over all scales involved in the fusion; This represents the alignment feature output after cross-scale attention interaction and gating weighting.

[0033] To compensate for the frequency shift caused by cross-scale fusion, this feature is entered into the frequency enhancement branch. Discrete Fourier transform, complex domain selective filtering, and inverse Fourier transform are then performed sequentially. , , , in, This represents the two-dimensional discrete Fourier transform operation; This represents the complex characteristic representation in the frequency domain. This represents the Hadamard product (element-by-element multiplication) operation; This represents a frequency-domain learnable filter parameter matrix used to explicitly model the high-frequency and low-frequency subspaces and suppress aliasing noise. This indicates the enhanced frequency domain characteristics after frequency domain filtering; This represents the two-dimensional inverse discrete Fourier transform operation; This represents the spatial domain enhancement feature of the final output of the frequency domain enhancement branch.

[0034] Furthermore, the unified feature fusion output is, finally, the spatial aggregation feature of the upper part of the output. Cross-scale frequency domain enhancement features of the lower half output The inputs are combined into the final convolutional block (Conv) and merged into a unified feature map. : , in, This indicates an operation that aligns and concatenates the features of two paths along the channel dimension. This represents the convolution mapping operation at the end of the output layer; This represents the unified feature map that the MCAF module finally outputs, which is then passed to the next layer of the network.

[0035] S2.3, Design the Task Dynamic Alignment SegHead (TDAL-SegHead). After the neck network, replace the original prediction head with a unified Task Dynamic Alignment SegHead (TDAL-SegHead). For example... Figure 5 As shown, to address the inherent conflict between global semantic recognition and local boundary localization in semantic segmentation tasks, this module achieves high-fidelity defect pixel-level mask prediction through dynamic gradient modeling and conflict-aware recalibration. Combined with the structural topology in the attached diagram, its specific computation and feature transfer process is divided into four levels: Furthermore, the task decomposition and trajectory construction are performed based on the fundamental feature map output from the neck network. First, the data is input to the Task Decomposition module. A dynamic gradient mapping operator is used to characterize texture changes and geometric perturbations within the local neighborhood, resulting in a local gradient representation. : , Subsequently, based on input features With local gradient representation By concatenating the channels, two parallel task feature trajectories, namely semantic feature trajectories, are constructed. With boundary detail feature trajectory : , , in: This represents the base feature map input to the segmentation head, and its tensor dimension is... , For the number of channels, and These are the height and width of the space, respectively. Represents the dynamic gradient mapping operator; This represents the extracted local gradient features, also with dimension 1. , used to explicitly capture the structural nonstationarity of the input region; This indicates a splicing operation along the channel dimension; This represents a semantic trajectory mapping function; This represents the semantic feature trajectory used to extract low-frequency contextual information; This represents a boundary detail trajectory mapping function; This represents the boundary detail feature trajectory used to characterize high-frequency information such as defect edges and pinholes.

[0036] Furthermore, the dynamic alignment and conflict awareness are achieved by feeding the two feature trajectories mentioned above into the Dynamic Alignment Module. First, a Trajectory Gap Estimator is used to calculate the difference in feature responses between the semantic and boundary tasks, thereby quantifying the conflict intensity. : , Meanwhile, in the Conflict-aware Alignment Router, basic features and trajectory conflict information are concatenated, and global average pooling (GAP) is performed in the spatial dimension to obtain the channel statistical vector. : , Based on channel statistics Dynamic channel weights containing conflict-aware information are generated through a two-layer learnable network mapping. : , in The trajectory gap feature between tasks is represented by the dimension . The larger the value, the more inconsistent the feature space offset between semantic classification and boundary localization; This indicates a global average pooling operation; This represents the extracted channel statistical feature vector, whose tensor dimension is compressed to... ; and These represent the learnable weight parameter matrices of the first and second layer mapping networks, respectively, used for channel dimensionality reduction and dimensionality increase interactions; Represents the ReLU activation function; This represents the Sigmoid activation function; This represents the generated dynamic channel attention weights, whose tensor dimension is... .

[0037] Furthermore, the feature encoding and dual-branch attention enhancement involve inputting the extracted features into the feature encoding module and utilizing dynamic weights. Features are recalibrated based on conflict awareness at the channel dimension to output a unified joint representation. : , Subsequently, the dimension is joint representation The attention enhancement is divided into two parallel branches: a detail-aware attention branch for enhancing local high-frequency edge features, and a context-aware attention branch for enhancing global low-frequency features. The outputs of the two branches are denoted as follows: and : , , in, This represents a feature encoding mapping function used to reduce the dimensionality of concatenated features and fuse them. This indicates an element-wise multiplication operation performed along the channel dimension using a broadcast mechanism. This represents the joint feature representation output after dynamic recalibration and encoding; This represents the detail-aware attention computation function; This represents the enhanced detail features output after attention enhancement. This represents the context-aware attention computation function; This represents the semantic context features output after context-aware attention enhancement.

[0038] Furthermore, the segmentation prediction and mask output are the detail enhancement features after dual-branch attention enhancement. With semantic context features The data is concatenated along the channel dimension and then input into a unified segmentation head for pixel-level prediction mapping. , in, This represents a concatenation operation along the channel dimension, resulting in a concatenated feature dimension. ; This represents a unified segmentation prediction head mapping function, which includes consecutive convolutional layers and activation functions for pixel classification; This represents the pixel-level mask (Output) of the final output of TDAL-SegHead, whose tensor dimension is mapped as follows: (or ),in This represents the number of defect categories, including the background. Each channel of this output mask directly corresponds to the spatial probability distribution of different defect categories, which is used for subsequent accurate calculation of defect physical dimensions and determination of the cookware's good condition.

[0039] S3, Model Training and Optimization. The training set images constructed and segmented in step S1, along with their corresponding ground truth mask labels, are input into the cookware defect segmentation model constructed in step S2 for iterative training. The network weight parameters are continuously optimized through forward and backward propagation mechanisms. The specific training and optimization process is as follows: Furthermore, the loss function is constructed and calculated as follows: in each training iteration, the model outputs the predicted class probability distribution. With the predicted pixel-level mask Compare it with the actual category label and real pixel-level mask labels Perform comparisons and calculate the total loss function. : , , , in, This represents the total loss function for multi-task joint optimization; and These represent the balancing weight hyperparameters for classification loss and masking loss, respectively. This represents the cross-entropy loss function, used to optimize the model's ability to recognize global semantics; Indicates the total number of categories; and Representing the true label and predicted probability respectively on the 1st... Values ​​in each category; This represents the Dice similarity coefficient loss function, which is used to optimize the intersection-union ratio of the predicted mask and the real mask in the spatial topology, making the boundary fit smoother. and Represent the spatial coordinates of the predicted mask and the true mask, respectively. The pixel activation value at that location.

[0040] Furthermore, to ensure the optimization strategy and model convergence, the AdamW or SGD optimizer is used to update the learnable parameters in the network through backpropagation. During training, an initial learning rate is set, and a cosine annealing learning rate decay strategy is used to avoid the model getting trapped in local optima. Weight decay regularization is also introduced to prevent overfitting. After several epochs of iterative training, until the model's mean intersection-over-union (mIoU) and mean average precision (mAP) on the validation set reach convergence, the network weights are saved, resulting in the trained improved YOLO26 cookware defect segmentation model.

[0041] S4, High-precision defect segmentation and physical size calculation. The trained cookware defect segmentation model is applied to an actual industrial production line. High-frame-rate inference is performed on online-acquired cookware surface images, and machine vision calibration parameters are combined to achieve accurate quantification of defect physical dimensions and product acceptance.

[0042] Furthermore, the mask extraction and connected component analysis involve inputting the image of the cookware to be detected into a trained model, resulting in an output tensor with dimension [missing information]. Prediction mask For each defect category channel in the mask, a threshold binarization operation is applied to remove the background. Then, a connected component labeling (CCL) algorithm is used to extract the set of connected component regions for each independent defect in the image. : , in, Indicates the first A set of spatial points of an independent defect in pixel coordinates; Represents the two-dimensional coordinates of a single pixel within a point set; Indicates the first The total absolute number of pixels contained in an individual defect.

[0043] Furthermore, the physical size mapping and quality determination are performed by reading the calibration parameters of the industrial camera and obtaining the actual physical area mapping coefficient represented by a single pixel. Calculate the first... The actual physical area of ​​an independent defect : , in, This represents the camera calibration coefficient, in units of... ; This represents the specific area of ​​the defect mapped to the real physical world, in units of... .

[0044] Based on calculated physical dimensions The system compares the confidence level of the defect category output by the model with the factory's preset tolerance thresholds for the maximum pinhole area or the longest scratch length allowed by quality control for each category. If the physical dimensions of any defect exceed the tolerance, the system outputs a control signal to determine that the cookware is a defective product (NG).

[0045] S5, Industrial-scale deployment of the model. To meet the high-speed quality inspection requirements of modern production lines, the trained deep learning model needs to be lightweighted and deployed with hardware acceleration.

[0046] Furthermore, the graph optimization and edge inference acceleration involve exporting the weights (.pt files) of the pot defect segmentation model trained under the PyTorch framework into the structure-neutral ONNX format. Then, the computational graph is optimized and operator fusion is performed using the inference engine. Continuous convolutions, normalizations, and activation functions are merged into a single-layer operator, and mixed-precision quantization (FP16 or INT8) is used depending on hardware support. Finally, the compiled high-efficiency inference engine is deployed on an edge computing platform or industrial personal computer (IPC) on the production line. Combined with multi-threaded asynchronous data streams and GPU hardware acceleration mechanisms, real-time parallel segmentation, online size calculation, and automated sorting of multi-station pot surface video streams are achieved.

[0047] In summary, this invention deeply reconstructs the YOLO26 architecture by introducing information flow-driven convolution (A2C2f-IFGC), multi-scale cross-domain attention fusion (MCAF), and task-dynamic alignment segmentation head (TDAL-SegHead). This method not only overcomes industry pain points at the algorithmic level, such as large reflective interference from the metal surface of cookware, easy obscuring of multi-scale defect features, and blurred mask boundaries, but also establishes a closed loop for industrial inspection at the application level, from high-precision pixel-level segmentation to accurate quantification of defect physical dimensions. This provides a highly robust quality inspection solution with significant application value for the intelligent manufacturing of modern high-end cookware.

[0048] S6, Experimental verification and analysis of the beneficial effects of the present invention: To further verify the effectiveness and advancement of the improved YOLO26-based cookware defect segmentation and dimensional measurement method proposed in this invention, this embodiment conducted systematic ablation and comparative experiments using the actual industrial cookware defect dataset constructed in S1, under the same high-performance computing platform and training parameters. Given that the core task of this invention is high-precision pixel-level defect segmentation, the experimental evaluation metrics include model computational cost (GFLOPs) and traditional bounding box average accuracy (mAP). box In addition to @0.5, the key feature introduced is the mask average precision mAP. mask @0.5 and the average intersection-union ratio (mloU) are used as core indicators for evaluating the high fidelity of segmentation boundaries and the accuracy of connected component extraction.

[0049] 1. Ablation Experiments and Criterion Block Validation: To systematically deconstruct the independent contributions and synergistic gains of the three core components—A2C2f-IFGC, MCAF, and TDAL-SegHead—introduced in this invention, this embodiment designed orthogonal ablation experiments. Using the original YOLO26 segmentation network as the baseline model, various improved modules were progressively embedded. Specific experimental data are shown in Table 1: Table 1: Ablation Experiment Results of Each Core Module of the Invention ; Analysis of ablation experimental data: As shown in Table 1, the introduction of each single module brought stable gains in mask accuracy and intersection-union ratio. Notably, the introduction of the MCAF module alone (Experiment 2) significantly improved mIoU (+1.6%), validating its effectiveness in aligning features and improving the smoothness of large target edges under extreme scale spans; while the introduction of TDAL-SegHead alone (Experiment 4) greatly improved mAP. mask @0.5 (+2.0%) demonstrates that the dynamic recalibration mechanism successfully mitigates trajectory conflicts between semantics and boundaries. When the three are integrated (Experiment 8), mAP mask The performance was dramatically improved from 0.5 to 0.908, with mIoU reaching 88.2%. This demonstrates a deep synergistic gain between the specular noise suppression of A2C2f-IFGC, the scale alignment of MCAF, and the task recalibration of TDAL, effectively ensuring the reliability of subsequent defect physical size calculations.

[0050] 2. Comparison Experiment of Mainstream Models To objectively evaluate the overall performance of this invention, its network architecture was compared with current mainstream instance segmentation models in the industry using the same dataset and hardware / software environment. Specific experimental comparison data are shown in Table 2. Table 2: Performance Comparison of the Invention with Current Mainstream Industrial Vision Inspection Models ; Comparative experimental data analysis: As shown in Table 2 and Figure 6 The experimental results show that the improved model proposed in this invention exhibits significant advantages in various accuracy metrics and training convergence performance. From Figure 6 As can be seen from the training performance curves, compared to the mainstream YOLO segmentation network, which is prone to accuracy bottlenecks in the mid-to-late stages, and Mask R-CNN, which has a relatively low convergence upper limit, the model of this invention benefits from the multi-scale cross-domain feature fusion mechanism. Its accuracy increases more rapidly and with less oscillation throughout the entire iteration process, ultimately converging smoothly to the global maximum in both bounding box and mask accuracy. Combined with the quantization data in Table 2, this model, while maintaining an extremely high lightweight level of 15.8 GFLOPs, not only achieves an average bounding box accuracy of 0.917, but also reaches the highest global average mask accuracy of 0.908 and the best average intersection-union ratio (mIoU) of 88.2%, comprehensively surpassing existing benchmarks. Especially when faced with extremely difficult segmentation defects such as oil stains with extremely blurred edges and bumps that are prone to local geometric deformation, thanks to the task dynamic alignment segmentation head's effective resolution of semantic and boundary feature conflicts, this model achieves mask accuracy of 0.896 and 0.885 for these two types, respectively. This completely solves the problem of the traditional network's precipitous drop in accuracy on difficult samples, fully demonstrating its high robustness and high-fidelity boundary fitting ability in the quality inspection task of complex industrial cookware surfaces.

[0051] Experimental conclusion: The experimental data above fully verify the superior robustness and high-fidelity segmentation capability of this invention when dealing with extreme scale spans, high-intensity metallic reflections, and blurred boundary morphological defects on cookware surfaces. This invention successfully achieves feature representation capabilities surpassing those of heavy-duty visual models with extremely low computational overhead. It not only establishes a new technical benchmark in algorithm accuracy but also has irreplaceable advantages in real-time deployment and precise quantification of physical dimensions on the industrial side.

[0052] 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 principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for detecting defects in cookware based on an improved YOLO 26 standard, characterized in that, Includes the following steps: S1. Construction and preprocessing of cookware defect dataset: Collect surface images of cookware with typical defects such as scratches, bumps, oil stains and pinholes under different lighting and backgrounds in industrial production lines. Perform pixel-level semantic annotation on the images to generate defect mask labels. Perform data cleaning and data augmentation on the annotated images. Divide the processed dataset into training set, validation set and test set according to a preset ratio. S2. Construction of the improved YOLO26 cookware defect segmentation model: Based on the YOLO26 segmentation network, its backbone network, neck network and prediction head are deeply reconstructed. The original C3k2 module is replaced by the A2C2f-IFGC module in the backbone network and neck network. A multi-scale cross-domain attention fusion module MCAF is added after the C2PSA module at the end of the backbone network. The original prediction head after the neck network is replaced by the task-dynamically aligned segmentation head to obtain the improved cookware defect segmentation model. S3. Model Training and Optimization: The training set is input into the constructed improved YOLO26 cookware defect segmentation model for iterative training. After the model extracts fine-grained features through the A2C2f-IFGC module and realizes multi-scale feature alignment and fusion through the MCAF module, the defect prediction mask is output by the task dynamic alignment segmentation head. The segmentation loss between the prediction mask and the real mask label is calculated, and the total loss function is constructed by combining the defect category classification loss. The network parameters are updated by the optimizer through backpropagation until the evaluation index of the model on the validation set converges, and the trained cookware defect segmentation model is obtained. S4. High-precision segmentation and physical size calculation of cookware defects: Acquire video frames or images of cookware to be inspected on the industrial production line, input them into the trained cookware defect segmentation model, and after A2C2f-IFGC feature extraction, MCAF cross-scale alignment, and task dynamic alignment segmentation head dynamic recalibration, output pixel-level defect masks and corresponding defect category probabilities; extract the defect connected components from the pixel-level defect masks and count the total number of pixels for each independent defect, and calculate the actual physical size of each defect in combination with the calibration parameters of the industrial camera. If the actual physical size or category probability of the defect exceeds the preset quality threshold, the cookware is determined to be defective. S5. Industrial-side deployment of the model: Export the trained cookware defect segmentation model into a lightweight inference format and deploy it on the edge computing device or industrial control host of the production line. Combine multi-threading and hardware acceleration technology to realize real-time online segmentation, size calculation and automatic rejection of good products of cookware surface defects.

2. The cookware defect detection method based on the improved YOLO26 according to claim 1, characterized in that, In step S1, a polygon annotation tool is used to complete pixel-level semantic annotation. The data augmentation strategies include random cropping, random rotation, adaptive adjustment of brightness and contrast, and introduction of Gaussian noise. The dataset is divided into training set, validation set and test set in a ratio of 8:1:

1.

3. The cookware defect detection method based on the improved YOLO26 according to claim 1, characterized in that, In step S2, the A2C2f-IFGC module includes a two-layer structure: macro-architecture feature transfer and micro-IFGC operator computation. Specifically, the macro-architecture feature transfer is as follows: the input feature map of the module is preprocessed and convolved to obtain a basic feature map. The basic feature map is divided into two parallel paths. The first path extracts features through conventional convolution. The second path is concatenated with N IFGC operators and then convolved again through conventional convolution. The outputs of the two paths are aggregated by the shortcut fusion module to obtain the output feature map of the module, where N is a positive integer.

4. The cookware defect detection method based on the improved YOLO26 according to claim 1, characterized in that, In step S2, the feature processing of the MCAF module includes four levels, specifically: Multi-branch feature preprocessing and reconstruction: For the four input feature branches of different scales from the network preprocessing stage, depthwise separable convolution, regular convolution and upsampling operations are performed respectively to obtain spatially resolution aligned multi-resolution feature tensors; Spatial feature aggregation: The reconstructed multi-resolution feature tensors are concatenated along the channel dimension, and then smoothed and deeply fused with residual blocks through convolutional layers to output a spatially fused feature tensor. Cross-scale semantic frequency domain enhancement: The reconstructed multi-resolution feature tensor is input into the feature selector to obtain the inter-scale dynamic gating weights, which are then passed through the cross-scale attention module to obtain scale-aligned features. The aligned features are then subjected to discrete Fourier transform, frequency-domain selective filtering, and inverse Fourier transform in sequence to obtain frequency-domain enhanced features. Unified feature fusion output: The spatial fusion feature tensor and the frequency domain enhanced features are concatenated in the channel dimension, and then mapped by the terminal convolutional block to output a unified feature map.

5. The cookware defect detection method based on the improved YOLO26 according to claim 1, characterized in that, In step S2, the feature processing of the task dynamic alignment segmentation head module includes four levels, specifically: Task decomposition and trajectory construction: Extract local gradient representations from the basic feature map of the module input, concatenate the basic feature map and the local gradient representations in the channel dimension, and construct semantic feature trajectories and boundary detail feature trajectories. Dynamic alignment and conflict awareness: Calculate the conflict intensity between semantic feature trajectory and boundary detail feature trajectory. After concatenating the basic feature map, the two feature trajectories and the conflict intensity, the channel statistical vector is obtained by global average pooling. Dynamic channel weights are generated by mapping through two layers of learnable network. Feature Encoding and Dual-Branch Attention Enhancement: The concatenated features are recalibrated and encoded using dynamic channel weights to obtain a joint representation. The joint representation is then input into the detail-aware attention branch and the context-aware attention branch, which output detail-enhanced features and semantic context features, respectively. Segmentation prediction and mask output: The detail enhancement features and semantic context features are concatenated along the channel dimension, and pixel-level prediction is performed by the segmentation head to output a pixel-level defect mask containing the spatial probability distribution of defect categories.

6. The cookware defect detection method based on the improved YOLO26 according to claim 1, characterized in that, In step S3, the total loss function is a weighted sum of the cross-entropy loss and the Dice similarity coefficient loss, and the calculation formula is as follows: , in, This is the cross-entropy loss function, used to optimize the defect category recognition capability; The Dice similarity coefficient loss function is used to optimize the spatial topological fit between the predicted mask and the real mask; , , are the balancing weight hyperparameters for classification loss and masking loss, respectively; p is the probability distribution of defect categories predicted by the model. Label the actual category of the defect; The prediction mask output by the model. This is the true mask label for defects.

7. The cookware defect detection method based on the improved YOLO26 according to claim 1 or 6, characterized in that, In step S3, the AdamW or SGD optimizer is used to update the network parameters. During training, a cosine annealing learning rate decay strategy is used to avoid the model getting trapped in local optima. Weight decay regularization is introduced to prevent the model from overfitting. The mean intersection-union ratio mIoU and the mean average precision mAP are used as evaluation metrics for model convergence.

8. The cookware defect detection method based on the improved YOLO26 according to claim 1, characterized in that, In step S4, the connected component labeling algorithm is used to extract the connected components of the defect. The formula for calculating the actual physical area of ​​the defect is: , in, The actual physical area of ​​the nth independent defect, in units of Let n be the total number of pixels for the nth independent defect. For industrial cameras, the calibration parameters are the actual physical area represented by a single pixel, in units of... .

9. The cookware defect detection method based on the improved YOLO26 according to claim 1, characterized in that, In step S5, the model weights under the PyTorch framework are exported as ONNX format. After the inference engine performs computation graph optimization and operator fusion, FP16 or INT8 mixed precision quantization is adopted according to the hardware support. The quantized model is deployed on an edge computing platform or industrial personal computer, and real-time parallel detection of multi-station cookware defects is achieved by combining GPU hardware acceleration and multi-threaded asynchronous data stream.

10. A cookware defect detection device based on an improved YOLO26, characterized in that, include: The data processing module is used for the construction and preprocessing of cookware defect datasets: collecting cookware surface images with typical defects such as scratches, bumps, oil stains and pinholes under different lighting and backgrounds in industrial production lines, performing pixel-level semantic annotation on the images to generate defect mask labels, performing data cleaning and data augmentation on the annotated images, and dividing the processed dataset into training set, validation set and test set according to a preset ratio. The model building module is used to improve the construction of the YOLO26 cookware defect segmentation model: Based on the YOLO26 segmentation network, its backbone network, neck network and prediction head are deeply reconstructed. In the backbone network and neck network, the A2C2f-IFGC module replaces the original C3k2 module. After the C2PSA module at the end of the backbone network, the multi-scale cross-domain attention fusion module MCAF is added. The original prediction head after the neck network is replaced with the task-dynamically aligned segmentation head to obtain the improved cookware defect segmentation model. The training and optimization module is used for model training and optimization: the training set is input into the constructed improved YOLO26 cookware defect segmentation model for iterative training. After the model extracts fine-grained features through the A2C2f-IFGC module and realizes multi-scale feature alignment and fusion through the MCAF module, the defect prediction mask is output by the task dynamic alignment segmentation head; the segmentation loss of the prediction mask and the real mask label is calculated, and the total loss function is constructed by combining the defect category classification loss. The network parameters are updated by the optimizer through backpropagation until the evaluation index of the model on the validation set converges, and the trained cookware defect segmentation model is obtained. The defect detection and calculation module is used for high-precision segmentation and physical size calculation of cookware defects: It acquires video frames or images of cookware to be inspected on the industrial production line, inputs them into the trained cookware defect segmentation model, and outputs pixel-level defect masks and corresponding defect category probabilities after A2C2f-IFGC feature extraction, MCAF cross-scale alignment, and task dynamic alignment segmentation head dynamic recalibration. It extracts the defect connected components from the pixel-level defect mask and counts the total number of pixels for each independent defect. Combined with the calibration parameters of the industrial camera, it calculates the actual physical size of each defect. If the actual physical size or category probability of the defect exceeds the preset quality threshold, the cookware is determined to be defective. The edge deployment module is used for industrial edge deployment of the model: it exports the trained cookware defect segmentation model into a lightweight inference format and deploys it on the edge computing device or industrial control host of the production line. It combines multi-threading and hardware acceleration technology to realize real-time online segmentation, size calculation and automatic rejection of good products of cookware surface defects.