Multi-size adaptive defect detection method and detection system
By using semantic segmentation and multi-scale feature extraction in an adaptive detection framework, this method solves the problems of resource waste and low efficiency in multi-scale defect detection of traditional defect detection methods, and achieves efficient and flexible defect detection that is suitable for various industrial scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SUZHOU TIANZHUN SOFTWARE CO LTD
- Filing Date
- 2026-03-13
- Publication Date
- 2026-06-19
AI Technical Summary
Existing defect detection methods require frequent adjustments to the detection window or parameters when dealing with defects of different sizes, resulting in wasted resources and low detection efficiency. Furthermore, they are difficult to effectively capture defect features of different sizes simultaneously, and the detection system is unstable, especially in industrial quality inspection when the defect size range is large.
An adaptive detection framework is constructed, which accurately segments defective regions through a semantic segmentation network, combines a classification network with size evaluation and multi-scale feature extraction mechanisms, adopts a dynamically adjusted optimization strategy to process defective images of different sizes, and combines non-maximum suppression and image segmentation techniques to optimize the detection results.
It improves detection efficiency, reduces resource waste, enhances detection accuracy and system flexibility, adapts to changes in defect size in different industrial scenarios, and significantly improves production efficiency and product quality.
Smart Images

Figure CN122243908A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image processing technology, specifically relating to a multi-size adaptive defect detection method and system. Background Technology
[0002] In the field of industrial quality inspection, defect detection is a crucial step in ensuring product quality and production efficiency. However, in actual production, defects in industrial products often exhibit significant size variations, such as tiny scratches, bubbles, or larger cracks and defects. This dimensional diversity poses a significant challenge to traditional defect detection methods. Existing detection methods typically require designing separate detection models or adjusting detection parameters for defects of different sizes, leading to resource waste and low detection efficiency. Traditional industrial quality inspection systems mainly rely on rule-based methods or simple image processing techniques, such as edge detection and threshold segmentation, to identify defects. However, these methods fall short when dealing with complex industrial scenarios, especially when facing defects of different sizes. They often require multiple adjustments to the detection window or parameters, making the detection process cumbersome and prone to missed or false detections.
[0003] Furthermore, as industrial production demands increasing precision and efficiency, the limitations of traditional methods have become more apparent. In recent years, deep learning technology has been widely applied in defect detection, especially object detection methods based on convolutional neural networks (CNNs). However, these methods still have shortcomings when dealing with multi-scale problems. Existing deep learning models typically employ fixed-scale feature extraction strategies, making it difficult to effectively capture defect features of different sizes simultaneously.
[0004] To address this issue, some studies have proposed multi-scale detection methods, such as constructing pyramid structures or multi-level detection networks to achieve feature extraction and detection at different scales. However, these methods typically require complex model structures or additional computational resources, leading to reduced detection efficiency and resource utilization. Furthermore, in practical industrial quality inspection applications, the size range of defects not only varies between different categories but may also exhibit significant variations across different batches or production lines of the same product type. This dynamic variation further exacerbates the difficulty of detection. Traditional detection methods often require frequent model retraining or parameter adjustments to adapt to new size distributions, which not only increases maintenance costs but may also lead to instability in the detection system. In conclusion, the problem of large defect size ranges in industrial quality inspection urgently requires an efficient, flexible, and resource-efficient detection method. Summary of the Invention
[0005] To overcome the shortcomings of existing technologies, an adaptive size inspection method is proposed, which can flexibly handle defects of different sizes within the same inspection framework, thereby improving inspection efficiency and reducing resource waste.
[0006] Design Principle: To address the issue of large size variations in defects during industrial quality inspection, this invention provides an adaptive size detection method for defects with such a wide size range. It aims to solve the problems of resource waste, low detection efficiency, and missed detections / false detections inherent in traditional detection methods when handling multi-scale defects. The core idea of this invention is to construct a dynamically adaptive detection framework that can simultaneously and efficiently handle defects of different sizes, thereby reducing redundant inspections and resource consumption, and improving the overall efficiency and accuracy of industrial quality inspection.
[0007] A multi-size adaptive defect detection method includes: S1, semantic segmentation preprocessing, using a semantic segmentation network to process the product image and accurately segment the target defect region; S2, defect size evaluation, evaluating the size of the segmented target defect region; S3, optimization processing, processing the defect image according to the size evaluation result and inputting it into a classification network for classification; S4, adaptive classification detection, using a classification network with a multi-scale feature extraction mechanism to extract features and classify defects in the optimized image or image patch; S5, post-processing optimization, combining non-maximum suppression and image segmentation techniques to remove redundant detection boxes and optimize the detection results.
[0008] Furthermore, the size assessment of the target defect area is as follows: calculate the ratio of the width and height of the defect area to a fixed scale.
[0009] Furthermore, the defect image processing is as follows: Optimization 1: When the width and height of the defect are both less than 1.2 times the scale of 256×256, the 256×256 image is directly input into the classification network for classification; Optimization 2: When the width or height of the defect is between 1.2 and 2 times the scale of 256×256, the defect image is scaled to fit the standard 256×256 scale before being input into the classification network for classification; Optimization 3: When the width or height of the defect is more than 2 times the scale of 256×256, it is segmented into image blocks multiple times, and the image blocks are further optimized according to Optimization 1 or Optimization 2.
[0010] This invention also provides a multi-size adaptive defect detection system, comprising: a semantic segmentation module configured to process industrial product images using a semantic segmentation network to segment target defect regions; a size evaluation module configured to calculate the ratio of the width and height of the defect region to a 256×256 pixel scale; a multi-mode optimization module configured to select a corresponding optimization method to process the defect image based on the ratio result, including direct input, scaling processing, or segmentation followed by optimization; an adaptive classification module configured to complete defect feature extraction and classification using a classification network with a multi-scale feature extraction mechanism; and a post-processing optimization module configured to combine non-maximum suppression and image segmentation techniques to optimize the detection results and output them.
[0011] Compared with the prior art, the beneficial effects of the present invention are as follows.
[0012] High-efficiency detection: Within the same detection framework, corresponding optimization strategies are adopted according to the size of different defects, which reduces the waste of resources and time caused by multiple inspections in traditional methods.
[0013] Reduced computational resources: Through a dynamic adaptive mechanism, the computational complexity of the model is optimized, hardware requirements are reduced, and resource utilization is improved.
[0014] Improved accuracy: It can more accurately identify defects of different sizes, reduce the possibility of missed detections and false detections, and improve the reliability of quality inspection results.
[0015] High applicability: It is suitable for different industrial scenarios and product types, and can dynamically adapt to changes in defect size distribution, thus improving the flexibility and stability of the detection system.
[0016] Applicable Scenarios: The method of this invention is particularly suitable for industrial production lines where the size range of defects is large, such as in the production of electronic components, automobile manufacturing, and aerospace. Through this method, industrial quality inspection systems can achieve more efficient resource utilization and more accurate defect detection, thereby significantly improving production efficiency and product quality. Attached Figure Description
[0017] Figure 1 This is a flowchart of the multi-size adaptive defect detection method of the present invention. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] A multi-size adaptive defect detection method, see [link to relevant documentation]. Figure 1 The method includes the following steps.
[0020] S1. Semantic segmentation preprocessing: The product image is processed using a semantic segmentation network to accurately segment the target defect area. This process effectively locates the defect, laying the foundation for subsequent classification and detection. In the specific example, the semantic segmentation network adopts U-Net and its improved architecture, capturing the contextual information of the image through an encoder-decoder structure to achieve accurate localization of the defect area, laying the foundation for subsequent size evaluation and classification detection.
[0021] S2. Defect Size Assessment: The size of the segmented target defect area is assessed; the ratio of the defect's width and height relative to a fixed scale (256×256 pixels) is calculated. This assessment step is crucial for subsequent optimization, ensuring that appropriate optimization strategies are adopted based on defect sizes. Specifically, the actual width and height of the defect area are calculated as ratios to 256 pixels to obtain the width and height ratios.
[0022] S3. Optimization processing: Based on the size evaluation results, that is, based on the ratio of the width and height of the size defect to the standard fixed size (256×256 pixels), the defect image is processed accordingly and input into the classification network for classification; the corresponding processing method, that is, the multi-mode optimization processing method, includes.
[0023] Scale Optimization 1 (Small Image Processing): When the width and height of the defect are both less than 1.2 times the scale of 256×256, the 256×256 image is directly input into the classification network for classification. This method is suitable for smaller defects, avoids unnecessary image processing, and saves computational resources.
[0024] Scale Optimization II (Medium-Size Image Processing): When the width or height of a defect is between 1.2 and 2 times the scale of 256×256, the defect image is scaled to fit the standard 256×256 size. This process employs a high-quality scaling algorithm to ensure that important feature information is not lost while reducing the image size, maintaining image quality so that the classification network can accurately identify the defect. In Scale Optimization II, a high-quality scaling algorithm is used to scale the defect image. In specific examples, the high-quality scaling algorithm is either bilinear interpolation or Lanczos interpolation.
[0025] Scale Optimization 3 (Large Image Processing): When the width or height of a defect exceeds twice the scale of 256×256, the defect image is first segmented into two smaller image blocks. Segmentation can be horizontal or vertical, or intelligent segmentation based on the specific shape of the defect. Then, scale optimization 1 or scale optimization 2 is applied to each segmented image block. This method is particularly suitable for larger defects, improving detection accuracy and efficiency through segmentation and optimization.
[0026] S4. Adaptive classification detection: It uses a classification network with a multi-scale feature extraction mechanism to extract features and classify defects in optimized images or image patches.
[0027] Classification Network Design: The classification network employs an adaptive multi-scale feature extraction mechanism, capable of handling image inputs of varying scales. By dynamically adjusting the scale range of feature extraction, the network can more flexibly capture features of defects of different sizes, improving classification accuracy and reliability. Based on an improved ResNet architecture, the classification network introduces adjustable feature fusion modules in different convolutional layers to dynamically adjust the scale range of feature extraction, enabling it to flexibly capture features of defects of different sizes and further enhance classification accuracy and reliability.
[0028] S5. Post-processing optimization: Combining non-maximum suppression (NMS) and image segmentation techniques, redundant detection boxes are removed to optimize the detection results. Removing redundant detection boxes improves the clarity and reliability of the detection results, ensuring the accuracy of the final output. The NMS algorithm removes redundant detection boxes, preventing the same defect from being detected multiple times; simultaneously, the semantic segmentation results are used to correct the position of the detection boxes, ensuring the accuracy of the final output and improving the clarity and reliability of the detection results.
[0029] The present invention also provides a multi-size adaptive defect detection system, which includes the following modules.
[0030] The semantic segmentation module is configured to use a semantic segmentation network to process industrial product images and segment target defect areas.
[0031] The size evaluation module is configured to calculate the ratio of the width and height of the defect area to a 256×256 pixel scale.
[0032] The multi-mode optimization module is configured to select the corresponding optimization method to process the flawed image based on the ratio result, including direct input, scaling, or segmentation followed by optimization. The optimization method is performed using the methods described above. For flawed images with a ratio exceeding 2 times, the module intelligently selects horizontal, vertical, or custom segmentation methods based on the shape of the flaws for image segmentation optimization.
[0033] The adaptive classification module is configured to extract and classify defect features using a classification network with a multi-scale feature extraction mechanism. The classification network includes a defect library, a standard library, a feature extraction layer, and a result output layer. In the specific example, the classification network is based on an improved ResNet architecture. By introducing an adjustable feature fusion module in different convolutional layers, it dynamically adjusts the scale range of feature extraction, enabling flexible capture of features from defects of different sizes and improving classification accuracy and reliability.
[0034] The post-processing optimization module is configured to combine non-maximum suppression (NMS) and image segmentation techniques to optimize the detection results and output them. The NMS algorithm removes redundant detection boxes, preventing the same defect from being detected multiple times; simultaneously, it combines semantic segmentation results to correct the position of the detection boxes, ensuring the accuracy of the final output detection results and improving their clarity and reliability.
[0035] Application Scenario 1: Detection of surface defects in electronic components.
[0036] On electronic component production lines, the size of surface defects varies greatly, ranging from minute scratches of 0.1mm to damaged areas of 5mm. The detection process using the method of this invention is as follows.
[0037] 1. Semantic segmentation processing: The U-Net semantic segmentation network is used to process the surface image of the component to segment out all defective areas, including minor scratches and damaged areas.
[0038] 2. Defect Size Assessment: Calculate the ratio of the width and height of each defect area relative to 256×256 pixels. Among them, the aspect ratio of minor scratches is 0.8 (corresponding to an actual size of 0.1mm, and the image pixel scale is 1:0.125mm / pixel), and the width ratio of the damaged area is 3.2 (corresponding to an actual size of 4mm) and the height ratio is 2.8 (corresponding to an actual size of 3.5mm).
[0039] 3. Multi-method optimization: For minor scratches, Method 1 is used, directly inputting the 256×256 image block containing the scratch into the classification network. For damaged areas, Method 3 is used, vertically segmenting the area according to its shape into two image blocks with a width ratio of 1.6. Then, Method 2 is used on each image block, scaling it to a scale of 256×256 using a bilinear interpolation algorithm.
[0040] 4. Adaptive classification and detection: An improved ResNet classification network is used to classify the processed images. The network dynamically adjusts the feature extraction scale to capture the texture features of fine scratches and the edge features of damaged areas, thereby achieving accurate classification.
[0041] 5. Post-processing optimization: Redundant detection boxes are removed using the NMS algorithm, and the positions of the detection boxes are corrected in conjunction with the semantic segmentation results. Finally, the type and location information of each defect are output.
[0042] Actual testing showed that the detection efficiency in this embodiment was 45% higher than that of traditional single-scale detection methods, the false negative rate was reduced to below 0.2%, and the false positive rate was reduced to below 0.5%, significantly improving the efficiency and accuracy of electronic component quality inspection.
[0043] Application Scenario 2: Detection of surface defects in automotive parts.
[0044] In the automotive parts manufacturing process, surface defects range from pits as small as 0.5mm to deformed areas as large as 10mm. The detection process using the system of this invention is as follows.
[0045] 1. The semantic segmentation module uses a semantic segmentation network to segment the pits and deformation areas on the surface of the parts.
[0046] 2. The size assessment module calculated that the width-to-height ratio of the pit is 1.1, and the height ratio of the deformed area is 3.5.
[0047] 3. The multi-mode optimization module directly inputs the pits into the classification network using mode one; it performs horizontal segmentation of the deformed area using mode three to obtain two image blocks with a height ratio of 1.75, and then performs scaling processing on each image block using mode two.
[0048] 4. The adaptive classification module uses a multi-scale feature extraction mechanism to identify the depth features of the pits and the morphological features of the deformed areas to complete the classification.
[0049] 5. The post-processing optimization module combines NMS and semantic segmentation results to optimize the detection results and output the final quality inspection report.
[0050] Test results show that the system's detection speed meets the real-time detection needs of the production line, its resource consumption is only 60% of that of traditional multi-scale detection methods, and its detection accuracy reaches 99.6%, effectively ensuring the quality of automotive parts.
[0051] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A multi-size adaptive defect detection method, characterized in that the method include: S1. Semantic segmentation preprocessing: The product image is processed using a semantic segmentation network to accurately segment the target defect area. S2. Defect size assessment: The size of the segmented target defect area is assessed. S3. Optimization processing: Based on the size evaluation results, the defective images are processed accordingly and then input into the classification network for classification. S4. Adaptive classification detection: It adopts a classification network with a multi-scale feature extraction mechanism to perform feature extraction and defect classification on optimized images or image patches. S5. Post-processing optimization: Combining nonmaximum suppression and image segmentation techniques, redundant detection boxes are removed to optimize the detection results.
2. The multi-size adaptive defect detection method according to claim 1, characterized in that, The size assessment of the target defect area is as follows: calculate the ratio of the width and height of the defect area to a fixed scale.
3. The multi-size adaptive defect detection method according to claim 2, characterized in that, The corresponding processing for defective images is as follows: Optimization of proportion 1: When the width and height of the defect are both less than 1.2 times the proportion of 256×256, the 256×256 image is directly input into the classification network for classification. Scale optimization 2: When the width or height of the defect is between 1.2 and 2 times the scale of 256×256, the defect image is scaled to fit the standard scale of 256×256 before being input into the classification network for classification. Optimization 3: When the width or height of the defect exceeds twice the ratio of 256×256, the image is segmented into image blocks multiple times, and the image blocks are optimized again according to Optimization 1 or Optimization 2.
4. The multi-size adaptive defect detection method according to claim 3, characterized in that, In the third aspect of scaling optimization, the method for obtaining image blocks is to divide the defective image into multiple smaller image blocks. The segmentation method can be horizontal segmentation, vertical segmentation, or intelligent segmentation based on the specific shape of the defect.
5. The multi-size adaptive defect detection method according to claim 3, characterized in that: In the second aspect of scaling optimization, a high-quality scaling algorithm is used to scale the flawed image.
6. A multi-size adaptive defect detection system, characterized in that, The system includes: The semantic segmentation module is configured to use a semantic segmentation network to process industrial product images and segment target defect regions. The size evaluation module is configured to calculate the ratio of the width and height of the defect area to a 256×256 pixel scale. The multi-mode optimization module is configured to select the corresponding optimization method to process flawed images based on the ratio results, including direct input, scaling, or segmentation followed by optimization. The adaptive classification module is configured to extract and classify defect features using a classification network with a multi-scale feature extraction mechanism. The post-processing optimization module is configured to combine nonmaximum suppression and image segmentation techniques to optimize the detection results and output them.
7. The multi-size adaptive defect detection system according to claim 6, characterized in that: In the multi-mode optimization module, for images with defects exceeding twice the size, the module intelligently selects horizontal, vertical, or custom segmentation methods based on the shape of the defects for image segmentation optimization.