Vehicle defect detection method based on fusion frequency adaptive expansion convolution

By introducing frequency-adaptive dilated convolution and an improved loss function into the YOLOv8 target detection algorithm, the problem of multi-class defect identification in vehicle defect detection is solved, achieving accurate detection of large-area dents and minor scratches, and improving detection accuracy and stability.

CN121074005APending Publication Date: 2025-12-05NANJING HOWSO TECH +1

Patent Information

Application Number
CN202511320346.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-16
Publication Date
2025-12-05

AI Technical Summary

Technical Problem

Existing vehicle defect detection methods struggle to effectively identify multiple types of defects, especially large dents and minor scratches, in complex industrial environments. Furthermore, traditional convolution operations result in insufficient understanding of the overall contextual information, affecting detection accuracy and stability.

Method used

The YOLOv8 target detection algorithm based on frequency-adaptive dilated convolution is adopted. The frequency-adaptive dilated convolution module dynamically adjusts the convolution dilation rate. Combined with the Shape-IoU loss function and the normalized Wasserstein distance, the feature extraction and loss function are optimized to achieve accurate identification of defects at different scales.

Benefits of technology

It significantly improves the accuracy and stability of vehicle defect detection, enabling rapid identification of multiple types of defects in real-time scenarios, meeting industrial needs, and maintaining high-efficiency computing performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121074005A_ABST
    Figure CN121074005A_ABST
Patent Text Reader

Abstract

The invention discloses a vehicle defect detection method based on fusion frequency adaptive expansion convolution, and the method comprises the steps: S1, building a data set: collecting data, carrying out the cleaning and marking of the data, and dividing the processed data according to a proportion; s2, constructing an improved model and training: adopting a YOLOv8 target detection algorithm model as a benchmark, introducing a frequency self-adaptive expansion convolution module, and dynamically adjusting a convolution expansion rate through real-time frequency domain analysis in a feature extraction process to distinguish a background from a defect; selecting a loss function and improving the loss function to obtain an improved FSN-YOLO network; training parameters are set, training is carried out, weights are obtained, and a trained improved model is obtained; and S3, defect detection: detecting a defect target existing in the to-be-detected image by using the improved model, judging a defect type and a defect position, and marking the defect type and the defect position to complete vehicle defect detection. The method is high in small target detection accuracy and high in efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the field of new artificial intelligence technology, and particularly relates to a vehicle defect detection method based on fusion frequency adaptive dilated convolution. BACKGROUND

[0002] In the field of machine vision, researchers have carried out explorations on vehicle surface defects, such as automobile paint defect detection. The conventional method usually adopts a pre-processing image enhancement method, extracts automobile defects through multiple rounds of processing using a local direction blur method, and then inputs the processing result into a classifier, or directly uses a threshold method to determine the defect type. The method of some researchers is to first realize paint defect positioning through morphological-based image enhancement and graph theory-based image segmentation, and then utilize a support vector machine to identify and classify the defects. However, such algorithms have certain limitations in actual application, and the image processing process will occupy a large amount of computing time, so it is difficult to meet the high requirements of industrial scenes on detection efficiency.

[0003] With the continuous development of deep learning technology, the application of this technology to the field of vehicle partial defect detection has made some progress. In the research on glass crack detection, Chen Chen et al. aimed at the problem of insufficient negative samples, adopted the method of artificially synthesizing glass edge defects to expand the data set, and completed the defect detection task based on the AlexNet algorithm. However, the defect synthesis method in this research has a narrow application range and can only match the specific type of glass edge defects, and it is difficult to play a good role when facing other position or shape defects, and has the problem of poor universality. Some researchers designed a method based on self-supervised learning to solve the problem of insufficient vehicle surface defect samples, and realized the learning of defect features by using a small number of labeled samples. However, when there are interference factors such as reflection on the paint surface, noise data is easy to affect the model, which may cause the model to be disturbed by irrelevant features in the learning process and fail to play a stable detection performance.

[0004] Current defect detection technology mainly relies on deep learning-based visual detection methods, which have made significant progress compared to traditional image processing methods, but still face many challenges in practical industrial applications. Current research mostly focuses on the detection of a certain type of defect on the surface of a vehicle, focusing on the detection of specific defects on the surface of a vehicle, while research on the detection of multiple types of defects on the surface of a vehicle is relatively less. And the existing detection method usually uses fixed receptive field convolution operation, which is difficult to effectively capture the defect features of different scales such as large-scale concave and fine scratches on the vehicle body. Although some research has improved the model's attention to local features by introducing an attention mechanism, this improvement often leads to a lack of understanding of the overall context information. Especially when detecting small defects, traditional convolution operations are prone to lose detailed features that only occupy a small number of pixels, and standard loss functions can cause a sharp fluctuation in loss values when facing small target detection, thereby affecting the training stability of the model.

[0005] In small target detection, how to effectively extract and learn the effective features of small defects is always an important task. The surface defects of vehicles are diverse, and some background features may have some similarity with real defects. How to build a robust feature discrimination mechanism to avoid the model misjudging these interference information as defects, and thus improve the detection accuracy and reliability of small and micro defects, is still a problem that current research needs to break through.

[0006] Chinese patent document CN120375118A discloses a kind of automobile painting surface defect detection method and device based on image data enhancement, related to automobile manufacturing field, by collecting automobile painting surface defect image data set C1, by data enhancement based on Poisson fusion defect image generation algorithm, obtain data set C2, then build improved YOLOv8 detection model, replace original C2f module with C2f-Star module;Place the custom CGAFusion module in front of each YOLOv8Detect module, fuse high and low level features.Use data set C2 to train the model and determine the parameters, obtain the improved detection model. Then collect the painting line field video stream V1, adjust the frame rate and detect, define the confidence threshold to judge whether the frame exists defects, judge the frame near the confidence and the front and rear frames, and build a defect knowledge graph. This prior art still has some misjudgment, and cannot quickly identify different types of defects.

[0007] Therefore, a vehicle defect detection method based on fusion frequency adaptive dilated convolution is needed, which can effectively overcome the limitations of traditional algorithms in complex industrial environments. The improved model takes advantage of the end-to-end training of deep single-stage target detection algorithms and can quickly identify different types of defects, better meeting the actual needs of vehicle surface defect detection in industrial scenarios. SUMMARY

[0008] The technical problem solved by the present application is to provide a vehicle defect detection method based on fusion frequency adaptive dilated convolution, which can adaptively identify various defect morphologies through autonomous learning and feature extraction capability, and can realize rapid identification of different types of defects, and is more suitable for the actual needs of vehicle surface defect detection in industrial scenarios.

[0009] To solve the above technical problems, the technical scheme adopted by the present application is: the vehicle defect detection method based on fusion frequency adaptive dilated convolution, specifically comprising the following steps:

[0010] S1 Constructing a data set: collect data, and after cleaning and labeling the data, divide the processed data by proportion;

[0011] S2 Building and training an improved model: using the YOLOv8 target detection algorithm model as the benchmark model, introducing the frequency adaptive dilated convolution module, dynamically adjusting the convolution dilation rate in the feature extraction process through real-time frequency domain analysis to distinguish background and defects, selecting and improving the loss function, obtaining the improved FSN-YOLO network; set the training parameters, train, obtain the weight, and get the trained improved model;

[0012] S3 Defect detection: using the improved model to detect the defect targets existing in the image to be detected, judging the defect type and its position, and labeling the defect type and position, completing the vehicle defect detection.

[0013] The above technical scheme introduces the frequency adaptive dilated convolution module in the YOLOv8 target detection algorithm model, dynamically adjusts the convolution dilation rate in the feature extraction process through real-time frequency domain analysis to distinguish background and defects, that is, for different targets or backgrounds, the feature extraction process is performed by adaptively adjusting the dilation rate, for defect features and other high-frequency components, a larger weight is used to enhance the feature response, and then the detailed features are transmitted and processed; for background and other low-frequency components, a smaller weight coefficient is used to suppress redundant information. Further, the expansion of the receptive field is realized, so that the feature extraction process can combine more comprehensive context information to make judgments on defect features; this adaptive mechanism significantly improves the detection capability of multi-scale defects.

[0014] Preferably, in the step S2, the frequency adaptive dilated convolution is used to improve the original C2f module in the YOLOv8 target detection network architecture to obtain the C2f_FADC module; specifically:

[0015] The bottleneck module of the C2f module is improved, the frequency adaptive dilated convolution is integrated into the bottleneck module, the feature extraction process is optimized through frequency domain analysis, the feature extraction process is performed through adaptive adjustment of the dilated rate, different dilated rates are used for different sizes of defects and backgrounds, and the dilated rate is dynamically adjusted to distinguish the background and the defect, and more comprehensive context information and defect features are obtained in the process of expanding the model receptive field.

[0016] Preferably, the specific step of feature extraction by adaptive adjustment of the dilated rate in the step S2 is that, in the frequency analysis process, the discrete Fourier transform is used to transform the feature map X into the frequency domain, and the formula is:

[0017] ;

[0018] wherein, represents an array output by the discrete Fourier transform, represents X F belongs to a real number set with dimensions of H and W, that is, X F is a real number matrix with H rows and W columns, H and W represent height and width respectively, h and w represent the coordinates of the feature map X, and (u, v) represent the frequency size in the horizontal and vertical directions; that is, is a natural base, is a natural base, is a natural base, is a natural base,

[0019] Since the optimal dilated rate of each pixel in the input feature map is different, the application of the adaptive dilated rate can achieve better balance, and the calculation formula of the output feature map after the adaptive dilated rate adjustment is:

[0020] ;

[0021] wherein, represents the pixel value of the position p in the output feature map, represents the weight of the K*K size convolution kernel at the kernel position i, represents the pixel value of the input feature map corresponding to the position p with an offset of , is the optimized dilated rate.

[0022] ​Preferably, the Shape-IoU loss is used as the benchmark loss function in the step S2, the model extracts irregular defect features by explicitly modeling the aspect ratio and geometric shape difference of the bounding box, and the normalized Wasserstein distance is introduced as a new measurement standard and fused into the Shape-IoU loss function to construct a new loss function.

[0023] The Shape-IoU loss function introduces the aspect ratio constraint and the dynamic weight adjustment mechanism to ensure the shape matching degree of the irregular defect, and the normalized Wasserstein distance evaluates the positioning accuracy by calculating the Gaussian distribution difference between the predicted box and the real box.

[0024] In view of the particularity of vehicle defects, the Shape-IoU loss and the normalized Wasserstein distance are fused to form a new loss function more suitable for small target detection. The former optimizes the positioning accuracy of irregular defects by constraining the geometric shape and scale factor of the bounding box, and the latter effectively solves the gradient imbalance problem in small target detection. The fusion of the two makes the model maintain excellent performance for defects of different sizes. The original loss function of the model is improved by the method, so that the accuracy of the model in the detection process is further improved.

[0025] The Shape-IoU is introduced as the benchmark loss function, the shape and scale difference of the bounding box are modeled to realize accurate positioning of defects of different sizes. Compared with the conventional IoU which only considers the overlapping area, the Shape-IoU additionally introduces the aspect ratio constraint and the dynamic weight adjustment mechanism, so that the model can maintain the detection accuracy of large-scale depressions while improving the positioning accuracy of small scratches. The normalized Wasserstein distance is fused in the Shape-IoU to construct a new loss function.

[0026] The normalized Wasserstein distance evaluates the positioning accuracy by calculating the Gaussian distribution difference between the predicted box and the real box. Compared with the traditional IoU, it is more sensitive to the pixel-level shift of small targets and can effectively alleviate the gradient disappearance problem caused by slight position deviation of small targets. By comprehensively using the advantages of the two, the Shape-IoU is used to accurately model the geometric characteristics of the bounding box, and the NWD is used to combine the sensitivity of small targets in space distribution, realizing the cooperative optimization of defects of different sizes. Specifically, the Shape-IoU loss function ensures the shape matching degree of the irregular defect through the aspect ratio constraint and the dynamic weight adjustment mechanism, and the normalized Wasserstein distance evaluates the positioning accuracy by calculating the Gaussian distribution difference between the predicted box and the real box, effectively alleviating the pixel-level positioning deviation problem in small scratch detection.

[0027] Preferably, the expression of the Shape-IoU loss function is:

[0028] ;

[0029] ;

[0030] ;

[0031] ;

[0032] ;

[0033] wherein, represents a weight coefficient in the horizontal direction, is a weight coefficient in the vertical direction, the value of the weight coefficient is related to the shape of the real box in the detection process, and is a scale factor; and respectively represent the width and height of the real box, and represent the horizontal and vertical coordinates of the center point of the prediction box, and and are the horizontal and vertical coordinates of the center point of the real box; c refers to the diagonal length of the outer box containing the real box and the prediction box; are the width and height, respectively, so that is, it represents the normalized scale in the t direction; the hyperparameter is used to adjust the curve shape of the penalty function; is a distance indicator of the bounding box shape, and is a shape weight term; that is, the final loss function calculation; IoU is the intersection over union;

[0034] In the calculation process, first, the intersection over union IoU value is calculated by the overlapping area between the real box and the prediction box and the total area of the real box and the prediction box, and on this basis, the shape information between the real box and the prediction box is introduced to calculate the loss.

[0035] Preferably, in the step S2, the normalized Wasserstein distance is introduced as a new measurement standard, and the calculation formula is:

[0036] ;

[0037] ;

[0038] wherein, is a Gaussian distribution of the bounding box of the real box, is a Gaussian distribution of the bounding box of the prediction box, represents a distance measurement between the real box and the prediction box, and C is a constant, the value of which is related to the data set. with are the horizontal and vertical coordinates of the prediction box, with correspond to the width and height of the prediction box; with are the horizontal and vertical coordinates of the real box, with correspond to the width and height of the real box; represents the similarity measure after normalizing the Wasserstein distance with an exponential function, exp is the exponential function.

[0039] The Shape-IoU loss function improves the detection accuracy by modeling the shape and scale difference of the bounding box, and has good applicability to targets of various sizes. The normalized Wasserstein distance is specifically designed to address the sensitivity problem in small target detection, and optimizes the positioning accuracy by measuring the distribution distance between the real box and the prediction box. The organic combination of the two not only retains the ability of Shape-IoU to capture the geometric characteristics of the target, but also effectively alleviates the regression instability caused by small position deviations in small target detection through the normalized Wasserstein distance, thereby significantly improving the accuracy of the detection model as a whole. This joint loss function design can focus on the shape matching degree of the bounding box, so that the detection performance of the model for targets of different scales is synergistically optimized.

[0040] Preferably, in the step S1, the vehicle surface defect data is obtained through the network, and the defect targets are screened and adjusted, and then labeled; the processed data is divided into a training set, a verification set and a test set in a ratio of 8:1:1.

[0041] Preferably, the vehicle surface defect data includes three types of defects: vehicle surface scratches, vehicle surface depressions, and vehicle glass cracks.

[0042] Preferably, in the step S2, before training the improved model, a YOLOv8 target detection algorithm model is built and data is input for training to obtain an initial training effect of the model.

[0043] Compared with the prior art, the present application has the beneficial effects of:

[0044] (1) Accuracy: The YOLOv8 target detector itself has certain accuracy, and by fusing the frequency self-adaptive dilated convolution to dynamically optimize the receptive field, it can effectively extract features for large-scale depressions and small scratches, improve the defect detection capability, and by combining the Shape-IoU loss function and the normalized Wasserstein distance to construct a new loss function, the defect detection accuracy can be further improved.

[0045] (2) Real-time: YOLOv8, as a single-stage object detection algorithm, has inherent efficiency in the detection process. The improvement is based on the efficient architecture of YOLOv8, which aims to maintain the original computational efficiency while improving the detection accuracy. This ensures that the model can run in real-time scenarios and meet the actual needs of defect detection.

[0046] (3) Frequency adaptive dilated convolution: A frequency-aware dynamic convolution mechanism is introduced, which intelligently adjusts the dilation rate of the convolution kernel by dynamically analyzing the frequency domain distribution of the input features. This adaptive design enables the model to capture the overall structure of large-scale defects and the fine features of small defects, thereby improving the detection capability without increasing additional computational burden.

[0047] (4) Joint loss function: Shape-IoU loss function and normalized Wasserstein distance are combined. The dual advantages of shape-aware loss and distribution matching loss are fused. By combining boundary box geometry modeling and spatial distribution sensitivity analysis, the model can more accurately locate defects of various shapes, especially solving the positioning deviation problem in small target detection of traditional methods, achieving more stable and reliable detection performance.

[0048] (5) Universality: Modular design supports flexible expansion, which can quickly adapt to vehicle surface defect detection and defect recognition in other scenarios through parameter adjustment. BRIEF DESCRIPTION OF DRAWINGS

[0049] Figure 1 The detection flowchart of the vehicle defect detection method based on the fusion of frequency adaptive dilated convolution of the present application;

[0050] Figure 2 The FSN-YOLO network framework diagram improved in the vehicle defect detection method based on the fusion of frequency adaptive dilated convolution of the present application;

[0051] Figure 3 The frequency adaptive dilated convolution structure diagram designed in the vehicle defect detection method based on the fusion of frequency adaptive dilated convolution of the present application;

[0052] Figure 4 The C2f_FADC structure diagram in the vehicle defect detection method based on the fusion of frequency adaptive dilated convolution of the present application;

[0053] Figure 5 The Shape-IoU loss effect diagram in the vehicle defect detection method based on the fusion of frequency adaptive dilated convolution of the present application;

[0054] Figure 6It is a detection effect comparison chart of the improved model and the improved model of the vehicle defect detection method based on fusion frequency adaptive dilated convolution for vehicle surface depression; wherein (a) is the improved YOLOv8 target detection model; (b) is the improved FSN-YOLO model of the application;

[0055] Figure 7 It is a detection effect comparison chart of the improved model and the improved model of the vehicle defect detection method based on fusion frequency adaptive dilated convolution for vehicle surface scratch; wherein (a) is the improved YOLOv8 target detection model; (b) is the improved FSN-YOLO model of the application;

[0056] Figure 8 It is a detection effect comparison chart of the improved model and the improved model of the vehicle defect detection method based on fusion frequency adaptive dilated convolution for vehicle glass crack; wherein (a) is the improved YOLOv8 target detection model; (b) is the improved FSN-YOLO model of the application;

[0057] Figure 9 It is a loss curve chart of the improved model and the improved model of the vehicle defect detection method based on fusion frequency adaptive dilated convolution. DETAILED DESCRIPTION

[0058] The embodiments of the application will be described in detail below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the application, and cannot be used to limit the protection scope of the application.

[0059] Those skilled in the art can understand that, unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meaning as commonly understood by those skilled in the art to which this application belongs. It should also be understood that terms such as those defined in a general dictionary should be understood to have meanings consistent with those in the context of the prior art, and should not be interpreted with idealized or overly formal meanings unless otherwise defined.

[0060] Embodiment: as Figure 1 The vehicle defect detection method based on fusion frequency adaptive dilated convolution specifically includes the following steps:

[0061] S1 Construct a data set: collect data, filter and remove images with poor quality, and use Labelimg tool to complete label annotation. After cleaning and labeling the data, the processed data is divided according to the proportion;

[0062] In the step S1, vehicle surface defect data is obtained through a network, and defect targets are screened and adjusted, and then labeled; the processed data is divided into a training set, a verification set and a test set in a ratio of 8:1:1; the vehicle surface defect data includes three types of defects, i.e., vehicle surface scratches, vehicle surface depressions and vehicle glass cracks;

[0063] S2, an improved model is constructed and trained: a YOLOv8 target detection algorithm model is used as a benchmark model, a frequency adaptive dilated convolution module is introduced, and in the feature extraction process, the convolution dilatation rate is dynamically adjusted through real-time frequency domain analysis to distinguish between background and defects, so as to expand the receptive field and obtain more comprehensive context information and more detailed defect features, which help the model to better learn the defect features, wherein a large dilatation rate focuses on capturing global features of large-scale defects such as vehicle body deformation, and a small dilatation rate accurately extracts local details of small scratches, a loss function is selected and improved, and thus an improved FSN-YOLO network is obtained, as shown in Figure 2 ; training parameters are set, training is performed, weights are obtained, and the improved model after training is obtained;

[0064] Figure 2 CBS is a convolution layer; C2f_FADC is an improved C2f module; SPPF is a spatial pyramid pooling layer; Upsample is an up-sampling; Concat is feature fusion; and Detect is a detection head;

[0065] In the step S2, the frequency adaptive dilated convolution (as shown in Figure 3 ) is used to improve the original C2f module in the YOLOv8 target detection network architecture, and the C2f_FADC module is obtained; the structure of the C2f_FADC module is as shown in Figure 4 , Figure 4 Conv represents a convolution layer, Split is a splitting operation, Concat is feature fusion, and FADC is the added frequency adaptive dilated convolution module; specifically,

[0066] The Bottleneck module of the C2f module is improved, the frequency adaptive dilated convolution is integrated therein, the feature extraction process is optimized through frequency domain analysis, the feature extraction process is performed through adaptive adjustment of the dilatation rate, that is, different dilatation rates are used for defects and background of different sizes, and the dilatation rate is dynamically adjusted to distinguish between background and defects, and in the process of expanding the receptive field of the model, more comprehensive context information and defect features are obtained;

[0067] In the defect feature extraction process, the frequency adaptive dilated convolution module is introduced, so that the model can autonomously perceive and adapt to the expression of defect features of different scales, and realize accurate capture from large-area depressions on the vehicle surface to slight scratch defects;

[0068] The specific step of feature extraction by adaptive adjustment of the expansion rate in step S2 is: in the frequency analysis process, the discrete Fourier transform is used to transform the feature map X into the frequency domain, and the formula is:

[0069]

[0070] wherein, represents the array output by the discrete Fourier transform, represents X F belongs to the real number set with dimensions H and W, that is, X F is a real number matrix with H rows and W columns, and H and W represent height and width, respectively, and h and w represent the coordinates of the feature map X, and (u, v) represent the frequency size in the horizontal and vertical directions; that is, is the normalized frequency used to calculate the height dimension, is the normalized frequency used to calculate the width dimension; is the natural base, is an imaginary number;

[0071] Since the optimal expansion rate of each pixel in the input feature map is different, the application of the adaptive expansion rate can achieve better balance, and the calculation formula of the output feature map after adaptive expansion rate adjustment is:

[0072]

[0073] wherein, is the pixel value of position p in the output feature map X, represents the weight of the KxK size convolution kernel at the kernel position i, represents the pixel value of the input feature map X corresponding to the position p with an offset of , and is the optimized expansion rate;

[0074] In step S2, a Shape-IoU loss function and a normalized Wasserstein distance are introduced to construct a new loss function, specifically: the Shape-IoU loss is used as the benchmark loss function, the length-width ratio and geometric shape difference of the boundary box are modeled explicitly, so that the model extracts irregular defect features; and the normalized Wasserstein distance is introduced as a new measurement standard, which is fused into the Shape-IoU loss function to construct a new loss function;

[0075] ​​​This paper introduces the Shape-IoU loss function into the loss function application. By explicitly modeling the aspect ratio and geometric differences of the bounding box, the model can more accurately capture the morphological features of irregular defects, thereby improving the model's localization accuracy for defects with complex shapes. Based on the Shape-IoU loss function, the normalized Wasserstein distance metric is further combined to evaluate the similarity between the predicted box and the ground truth box from the perspective of probability distribution. This effectively solves the problem that traditional IoU loss is sensitive to the positional deviation of small targets, enhancing the model's ability to detect small defects. By combining shape-aware loss with distribution matching loss, the model considers both the geometric matching of the bounding box and the similarity of feature distributions, thereby improving the accurate localization and classification of defects with different shapes.

[0076] Normalized Wasserstein distance (NWD) evaluates localization accuracy by calculating the difference in Gaussian distribution between the predicted bounding box and the ground truth bounding box. Compared to traditional IoU, it is more sensitive to pixel-level offsets of small targets, effectively mitigating the gradient vanishing problem caused by slight positional deviations of small targets. By combining the advantages of both, it leverages the accurate modeling capability of Shape-IoU for bounding box geometry while combining it with NWD's sensitivity to the spatial distribution of small targets, achieving synergistic optimization for defects of different scales. Specifically, the Shape-IoU loss function ensures the shape matching degree of irregular defects through aspect ratio constraints and dynamic weight adjustment mechanisms, while normalized Wasserstein distance evaluates localization accuracy by calculating the difference in Gaussian distribution between the predicted bounding box and the ground truth bounding box, effectively mitigating pixel-level localization deviation problems in the detection of small scratches.

[0077] The expression for the Shape-IoU loss function is:

[0078] ;

[0079] ;

[0080] ;

[0081] ;

[0082] ;

[0083] in, Represents the weighting coefficient in the horizontal direction. This refers to the weighting coefficient in the vertical direction. The value of this weighting coefficient is related to the shape of the ground truth bounding box during the detection process. Scale factor; and These represent the width and height of the actual bounding box, respectively. and (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively

[0084] (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively Figure 5 (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively

[0085] (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively

[0086] (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively

[0087] (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively

[0088] (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively

[0089] (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively

[0090] (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively (x, y) represent the horizontal and vertical coordinates of the center point of the prediction box, respectively The similarity metric is represented by the exponential function of the normalized Wasserstein distance, exp is the exponential function; wherein With , With C and cy in the above formula are a whole, and c is not a separate variable;

[0091] The Shape-IoU loss function improves the detection accuracy by modeling the shape and size difference of the bounding box, and has good applicability to targets of various sizes. The normalized Wasserstein distance is specifically designed to address the sensitivity problem in small target detection, and optimizes the positioning accuracy by measuring the distribution distance between the real box and the predicted box. The organic combination of the two not only retains the ability of Shape-IoU to capture the geometric characteristics of the target, but also effectively alleviates the regression instability caused by small position deviation in small target detection through the normalized Wasserstein distance, thereby significantly improving the accuracy of the detection model as a whole. This joint loss function design can focus on the shape matching degree of the bounding box, so that the detection performance of the model for targets of different sizes is synergistically optimized.

[0092] In some embodiments, before training the improved model in step S2, a YOLOv8 target detection algorithm model is built and input data is trained to obtain the initial training effect of the model.

[0093] S3 defect detection: using the improved model to detect the defect targets existing in the to-be-detected image, judging the defect type and its position, and labeling the defect type and position, completing the vehicle defect detection.

[0094] Application example: 1278 vehicle surface defect data are obtained through the network, and the defect targets are screened and adjusted, and then labeled; the processed data are divided into training set, validation set and test set according to the ratio of 8:1:1; the vehicle surface defect data include three types of defects: vehicle surface scratch, vehicle surface depression and vehicle glass crack; the training parameters are set, the improved model is trained using the training set, and the result is verified using the validation set; wherein the training is based on the Pytorch framework, the training process iteration is 300 rounds, the batchsize size is 16, the workers is 8, the learning rate is 0.01, and the RTX4090 GPU is used for acceleration.

[0095] In order to verify the effectiveness and advancement of the method, the improved YOLOv8 model (FSN-YOLO) of the application is compared with the YOLOv8 model before improvement, and the evaluation indexes adopted include Precision, Recall, mAP and FPS, and the effect comparison is shown in Table 1. The improved model has slightly improved in the detection frame rate, and has obviously improved in the accuracy, recall rate and mAP value.

[0096] Table 1. Effect comparison of model before and after improvement

[0097] Model P R mAP FPS YOLOv8 94.8 70 68.6 40.9 FSN-YOLO 96.3 71 69.8 41.4

[0098] Among them, P is the precision, which means the proportion of samples actually being positive in the samples predicted to be positive. R is the recall rate, which means the proportion of samples correctly predicted in the samples actually being positive. mAP is the average precision, which is the average of AP calculated on all classes. The calculation formula of each index is as follows:

[0099]

[0100]

[0101]

[0102]

[0103] Among them, TP reflects the correct prediction of positive samples by the model, FP reflects the misprediction of negative samples as positive samples by the model, and FN reflects the misprediction of positive samples as negative samples by the model. AP is the area under the Precision-Recall curve, N is the total number of detection target classes. In addition, FPS is usually used to measure the real-time performance of the model, which represents the number of image frames that the model can process per second.

[0104] In order to intuitively present the detection effect of the model before and after improvement on different defects, the same defect target is detected by using the model, and the effect is shown in Figures 6~8 ;(a) in the (a) of Figure 6 is the recognition effect diagram of the YOLOv8 target detection model before improvement on the surface indentation of the vehicle; Figure 6 (b) in the (b) of Figure 7 is the recognition effect diagram of the YOLOv8 target detection model before improvement on the surface scratch of the vehicle; Figure 7 (b) in the (b) of Figure 8 ​​​(a) in the figure is the recognition effect diagram of the vehicle glass crack of the YOLOv8 target detection model before improvement; Figure 8 (b) in the figure is the recognition effect diagram of the vehicle glass crack of the FSN-YOLO model improved by the application; it can be observed from the comparison of the recognition effect diagrams that the positioning and detection of the defect target of the improved model are relatively more accurate.

[0105] In order to further observe the model training effect, the loss value in the model training process is extracted, and a loss curve diagram is drawn, as shown in Figure 9 . The blue part is the loss value trend of the YOLOv8 benchmark model before improvement, and the yellow part is the loss value trend of the FSN-YOLO model after improvement. It can be seen from Figure 9 that in the early stage of model training, both of them are synchronous decline, and the difference is small. With the increase of training iteration times, both of them gradually decrease and tend to be stable, indicating that the model has been continuously optimized in the training process; finally, the loss value of the improved FSN-YOLO model presents a lower trend, indicating that the loss reduction achieves a better effect. It is shown that based on the Shape-IoU loss function, combined with the normalized Wasserstein distance measurement method, the similarity of the predicted box and the real box is evaluated from the probability distribution angle, effectively solving the problem that the traditional IoU loss is sensitive to the position deviation of small targets, and enhancing the detection ability of the model to small defects. By combining the shape perception loss and the distribution matching loss, the model not only considers the geometric characteristic matching of the boundary box, but also pays attention to the similarity of the feature distribution, so as to improve the accurate positioning and classification of defects of different shapes. Compared with the conventional IoU which only considers the overlapping area, Shape-IoU additionally introduces the length-width ratio constraint and dynamic weight adjustment mechanism, so that the model can maintain the detection accuracy of large concave defects while improving the positioning accuracy of small cracks.

[0106] For those skilled in the art, the specific embodiments are only exemplary descriptions of the present application, and obviously the specific implementation of the present application is not limited by the above-mentioned manner. Various non-essential improvements or direct application of the inventive concept and technical solution to other occasions without improvement are within the protection scope of the present application.

Claims

1. A vehicle defect detection method based on fusion frequency adaptive dilated convolution, characterized in that, Specifically comprising the following steps: S1, constructing a data set: collecting data, cleaning and labeling the data, and then dividing the processed data in proportion; S2, constructing and training an improved model: using a YOLOv8 target detection algorithm model as a benchmark model, introducing a frequency adaptive dilated convolution module, dynamically adjusting the convolution dilation rate in the feature extraction process to distinguish between background and defects, selecting a loss function, and improving the loss function to obtain an improved FSN-YOLO network; setting training parameters, training the model, obtaining weights, and verifying the final model to obtain a trained improved model; S3, defect detection: using the improved model to detect defects in the image to be detected, judging the type and position of the defects, and labeling the type and position of the defects to complete the vehicle defect detection. 2.The vehicle defect detection method based on fusion frequency adaptive dilated convolution according to claim 1, characterized in that, In the step S2, the frequency adaptive dilated convolution is used to improve the original C2f module of the YOLOv8 target detection network architecture to obtain a C2f_FADC module; specifically: The Bottleneck module of the C2f module is improved, and the frequency adaptive dilated convolution is integrated into it. The feature extraction process is optimized through frequency domain analysis, and the feature extraction is adjusted adaptively. That is, different dilation rates are used for defects and backgrounds of different sizes, and the dilation rate is dynamically adjusted to distinguish between background and defects. In the process of expanding the model's receptive field, comprehensive context information and defect features are obtained. 3.The vehicle defect detection method based on fusion frequency adaptive dilated convolution according to claim 2, characterized in that, The specific steps for feature extraction by adaptively adjusting the expansion rate in step S2 are as follows: During the frequency analysis process, the discrete Fourier transform is used to extract the feature map. Transforming to the frequency domain, the formula is: ; wherein, an array representing the discrete Fourier transform output, represents X F belongs to the set of real numbers of dimension H and W, i.e. X F is a real number matrix of H rows and W columns, H and W representing the height and the width, respectively, h and w representing the coordinates of the feature map X, (u, v) representing the transverse and longitudinal frequency size; is the natural base, is the imaginary number; The calculation formula of the output feature map after adaptive dilation rate adjustment is: ; wherein, is a feature in the output feature map X at position p, represents the weight of the KxK size kernel at kernel position i, represents the pixel value in the input feature map X corresponding to the position p with an offset of is a feature in the output feature map X at position p, is the dilation rate of each position after the optimization processing.

4. The method for vehicle defect detection based on fusion frequency adaptive dilated convolution according to claim 2, characterized in that, In the step S2, the Shape-IoU loss is used as the benchmark loss function. By explicitly modeling the aspect ratio and geometric shape difference of the bounding box, the model extracts irregular defect features; And the normalized Wasserstein distance is introduced as a new measurement standard, which is integrated into the Shape-IoU loss function to construct a new loss function; Where the Shape-IoU loss function introduces an aspect ratio constraint and a dynamic weight adjustment mechanism to ensure the shape matching degree of irregular defects, and the normalized Wasserstein distance evaluates the positioning accuracy by calculating the Gaussian distribution difference between the predicted box and the real box.

5. The method for vehicle defect detection based on fusion frequency adaptive dilated convolution according to claim 4, characterized in that, The expression of the Shape-IoU loss function is: ; ; ; ; ; where, represents the weight coefficient in the horizontal direction, is the weight coefficient in the vertical direction, the value of which is related to the real box shape in the detection process, and is the scale factor; and respectively represent the width and height of the real box, and represent the horizontal and vertical coordinates of the center point of the prediction box, and and are the horizontal and vertical coordinates of the center point of the real box; c refers to the diagonal length of the outer box containing both the real box and the prediction box; are the width and height, respectively, so that is, it represents the normalized scale in the t direction; the hyperparameter is used to adjust the curve shape of the penalty function; is the distance indicator of the bounding box shape, and is the shape weight term; is the final loss function calculation; IoU is the intersection over union. In the calculation process, first calculate the IoU value by the overlap area between the real box and the predicted box and the total area of the real box and the predicted box, and then introduce the shape information between the real box and the predicted box to calculate the loss.

6. The method for vehicle defect detection based on fusion frequency adaptive dilated convolution according to claim 5, characterized in that, In the step S2, the normalized Wasserstein distance is introduced as a new measurement standard, and the calculation formula is: ; ; wherein, is a Gaussian distribution of the bounding box of the ground truth, is a Gaussian distribution of the bounding box of the prediction, represents a distance measure between the ground truth and the prediction, and C is a constant whose value is related to the dataset; and are the horizontal and vertical coordinates of the prediction, and correspond to the width and height of the prediction; and are the horizontal and vertical coordinates of the ground truth, and correspond to the width and height of the ground truth; represents a similarity measure after normalizing the Wasserstein distance with an exponential function, exp being the exponential function.

7. The method for vehicle defect detection based on fusion frequency adaptive dilated convolution according to claim 1, characterized in that, In the step S1, the vehicle surface defect data is obtained through the network, and the defect targets are screened and adjusted, and then labeled; the processed data is divided into a training set, a validation set and a test set.

8. The vehicle defect detection method based on fusion frequency adaptive dilated convolution according to claim 7, characterized in that, The vehicle surface defect data includes three types of defects: vehicle surface scratches, vehicle surface depressions and vehicle glass cracks. 9.The vehicle defect detection method based on fusion frequency adaptive dilated convolution of claim 2, wherein, Before the improved model is trained in the step S2, a YOLOv8 target detection algorithm model is built and data is inputted for training, and an initial training effect of the model is obtained.

Citation Information

Patent Citations

  • Strip steel surface small target defect detection method and system based on super-resolution and YOLOv8

    CN116630301A

  • Image semantic segmentation method and system based on frequency adaptive expansion convolution

    CN117765264A

  • Image defect target detection method and device, equipment and storage medium

    CN118154529A

  • Small target industrial defect detection method and system based on deep learning

    CN118552523A

  • Fabric defect detection method based on EFC feature extraction and mixed loss function

    CN118570155A

Cited By

  • Lightweight target detection edge deployment method based on high-frequency detail enhancement

    CN121746687A

  • Lightweight target detection edge deployment method based on high-frequency detail enhancement

    CN121746687B