Method and device for wheel hub surface defect detection based on deep learning

Through deep learning methods, pre-training models and particle swarm optimization algorithms are used to build wheel hub defect detection models, which solves the problem of difficulty in obtaining defect sample data in wheel hub production and achieves high-precision wheel hub defect detection.

CN118644667BActive Publication Date: 2024-10-15INSPUR WORLDWIDE SERVICES LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411116759.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-10-15
Estimated Expiration
2044-08-15

AI Technical Summary

Technical Problem

In the existing technology, it is difficult to train wheel hub defect detection models through large-scale sample data sets, especially the difficulty in collecting defect sample data during the wheel hub production process and the lack of labels.

Method used

Using a method based on deep learning, a training data set is constructed by collecting wheel image samples and performing data annotation. The pre-trained VGG19 model is used as the feature extraction module, combined with the multi-scale feature decomposition module and spatial attention mechanism, and the particle swarm optimization algorithm is used to optimize Model structure, and iterative training based on the preset regression loss function to achieve wheel hub defect detection.

Benefits of technology

It reduces the dependence on training sample data, improves the convergence speed of model training, and can use small-scale sample data to train a high-precision wheel hub defect detection model, solving the problem of difficulty in obtaining large-scale sample data sets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118644667B_ABST
    Figure CN118644667B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for wheel hub surface defect detection based on deep learning, which relates to the field of data processing technology. The method comprises the following steps: collecting wheel hub image samples, annotating the wheel hub image samples to obtain a training data set; setting the front layer network of a pre-trained VGG19 model as a feature extraction module; constructing a wheel hub defect detection model based on the feature extraction module and a multi-scale feature decomposition module; calculating the optimal feature decomposition layer number of the multi-scale feature decomposition module; optimizing the wheel hub defect detection model according to the optimal feature decomposition layer number to obtain an optimized wheel hub defect detection model; training the optimized wheel hub defect detection model based on the training data set, and determining the total loss values ​​corresponding to the optimized wheel hub defect detection models of each iterative training based on a preset regression loss function; determining the optimized wheel hub defect detection model corresponding to the minimum total loss value as the wheel hub defect target detection model; and detecting the wheel hub using the wheel hub defect target detection model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a method and device for hub surface defect detection based on deep learning. Background Art

[0002] In the process of automobile wheel hub production, due to improper production materials and manufacturing equipment parameter settings, the surface of the produced automobile wheel hub may have defects such as cracks, which poses a great hidden danger to the driving safety of the car. Therefore, accurately identifying defective wheels has become a key issue that needs to be solved in this field.

[0003] The Chinese invention patent with the publication (announcement) number CN115830033B proposes a method for detecting surface defects of automobile hubs based on machine vision, which includes the following steps: Step 1, obtaining a grayscale image of the automobile hub area and obtaining the original scale parameter of each pixel in the grayscale image; Step 2, obtaining the focus points in the grayscale image and the defect approximation degree of each focus point; Step 3, performing three-dimensional reconstruction on the grayscale image to obtain surface images under all viewing angles, and obtaining the improvement factor of the corresponding focus point according to the difference in the defect approximation degree of each focus point in the grayscale image and the corresponding surface image; Step 4, using the improvement factor of each focus point to obtain the adaptive scale parameter of the corresponding focus point; Step 5, based on the adaptive scale parameter and the original scale parameter, using the Retinex algorithm to enhance the grayscale image, and performing automobile hub surface defect detection on the enhanced grayscale image.

[0004] The Chinese invention patent with the publication (announcement) number CN115937155A proposes a method for detecting automobile wheel hub surface defects based on YOLOv5, which includes the following steps: Step 1, establishing an initial data set: the initial data set contains initial images of four types of automobile wheel hub surface defects, and the four types of automobile wheel hub surface defects are linear defects, point defects, sludge defects and pinhole defects; Step 2, using the methods in the field of image processing to expand and enhance the initial data set; Step 3, using the YOLOv5 target detection algorithm, selecting the YOLOv5s model to train and detect the four types of wheel hub surface defects, and by analyzing the results of each training, the parameters of the YOLOv5s model are optimized to finally obtain the optimal network parameters and model weights.

[0005] Although the above two Chinese invention patents have achieved wheel hub defect detection, the technical solutions still have the following deficiencies, including: detecting wheel hub defects through a trained target model, the target model includes a YOLOv5s model, and the training of the target model depends on a large-scale sample data set. Since the probability of a wheel hub with surface defects in the production process of the wheel hub is small, it is difficult to collect defective sample data. In addition, the collected sample data is usually unlabeled and requires manual labeling of the sample data, which makes it difficult to construct a large-scale sample data set, which in turn makes it difficult to train the target model through a large-scale sample data set. Summary of the invention

[0006] The present disclosure provides a method and device for wheel hub surface defect detection based on deep learning, the main purpose of which is to solve the problem in the related art that it is difficult to train a target model through a large-scale sample data set.

[0007] According to a first aspect of the present disclosure, a method for detecting wheel hub surface defects based on deep learning is provided, comprising:

[0008] Collecting wheel hub image samples containing wheel hub surface information during the production process, and annotating the wheel hub image samples to obtain a training data set for wheel hub defect detection;

[0009] The front-layer network of the VGG19 model pre-trained on a preset large-scale image dataset is set as a feature extraction module;

[0010] Building a wheel hub defect detection model based on the feature extraction module, the multi-scale feature decomposition module, and the feature fusion module and the regressor module based on the spatial attention mechanism;

[0011] Calculate the optimal number of feature decomposition layers corresponding to the multi-scale feature decomposition module based on a particle swarm optimization algorithm;

[0012] Optimizing the network structure of the wheel hub defect detection model according to the optimal feature decomposition layer number to obtain an optimized wheel hub defect detection model;

[0013] Iteratively training the optimized wheel hub defect detection model based on the training data set, and determining the total loss value corresponding to each iterative training of the optimized wheel hub defect detection model based on a preset regression loss function;

[0014] Determine the optimized wheel hub defect detection model after the iteration corresponding to the minimum total loss value among the total loss values ​​respectively corresponding to the optimized wheel hub defect detection models trained in each iteration as the wheel hub defect target detection model;

[0015] The produced wheel hubs are subjected to surface defect detection based on the wheel hub defect target detection model, so as to timely discover the wheel hubs with surface defects.

[0016] Optionally, the determining of the total loss values ​​corresponding to the optimized wheel hub defect detection model after each iterative training based on a preset regression loss function includes:

[0017] Initializing the initial weight of each wheel hub image sample in the training data set;

[0018] Calculating the first loss value of the wheel image sample corresponding to the initial weight using the initial weight based on the preset regression loss function, so as to obtain the first loss value corresponding to each of the wheel image samples;

[0019] Accumulating the first loss values ​​corresponding to each of the wheel hub image samples to obtain a first total loss value corresponding to the optimized wheel hub defect detection model after the current iterative training;

[0020] The initial weight of each wheel image sample is updated based on a preset weight update algorithm and a preset weight update rate to obtain an updated weight corresponding to each wheel image sample;

[0021] Based on the preset regression loss function, the updated weights are used to calculate the second loss value corresponding to each of the wheel hub image samples, and the second loss values ​​are accumulated to obtain the second total loss value corresponding to the optimized wheel hub defect detection model after the iterative training again, until the total loss values ​​corresponding to the optimized wheel hub defect detection models of each iterative training are obtained after the first preset round of iterative training, and the total loss values ​​corresponding to the optimized wheel hub defect detection models of each iterative training include the first total loss value and the second total loss value, and the optimized wheel hub defect detection model after the iterative training again is the wheel hub defect detection model obtained by iteratively training the optimized wheel hub defect detection model after the current iterative training.

[0022] Optionally, the calculating the optimal number of feature decomposition layers corresponding to the multi-scale feature decomposition module based on the particle swarm optimization algorithm includes:

[0023] Randomly generate a preset number of particles, each particle in the preset number of particles represents a set of characteristic decomposition layer number combinations;

[0024] Iteratively train the characteristic decomposition layer combination corresponding to each particle, and calculate the third loss value corresponding to each characteristic decomposition layer combination based on the preset regression loss function, wherein the third loss value is used to describe the fitness of the corresponding particle, and each characteristic decomposition layer combination is the characteristic decomposition layer combination corresponding to the preset number of particles;

[0025] Determine the characteristic decomposition layer number combination corresponding to the third loss value with the smallest value among the third loss values ​​corresponding to each characteristic decomposition layer number combination as the first optimal characteristic decomposition layer number combination;

[0026] Based on a preset particle update algorithm, each of the feature decomposition layer number combinations is updated using the first optimal feature decomposition layer number combination to obtain each updated feature decomposition layer number combination;

[0027] Iterative training is performed on each updated feature decomposition layer combination, and the fourth loss values ​​corresponding to each updated feature decomposition layer combination are calculated based on the preset regression loss function, and the updated feature decomposition layer combination corresponding to the fourth loss value with the smallest value among the fourth loss values ​​corresponding to each updated feature decomposition layer combination is determined as the second optimal feature decomposition layer combination, and each updated feature decomposition layer combination is updated and iteratively trained using the second optimal feature decomposition layer combination based on the preset particle update algorithm, until the second preset round of iterative training is completed, and the feature decomposition layer number of the final iterative feature decomposition layer combination with the smallest loss value among the feature decomposition layer combinations after the final iteration is determined as the optimal feature decomposition layer number, and the final iterative feature decomposition layer combinations include the final iterative feature decomposition layer combination, and the updated feature decomposition layer combinations include the updated feature decomposition layer combination.

[0028] Optionally, the wheel hub defect detection model is constructed based on the feature extraction module, the multi-scale feature decomposition module, and the feature fusion module and the regressor module based on the spatial attention mechanism, including:

[0029] Constructing the multi-scale feature decomposition module based on the multi-scale feature decomposition layer and the maximum pooling layer, wherein the multi-scale feature decomposition layer includes a convolution layer, a batch normalization layer, and a ReLU activation function, and the number of the multi-scale feature decomposition layers and the maximum pooling layers included in the multi-scale feature decomposition module is determined according to the optimal number of feature decomposition layers;

[0030] Constructing the regressor module based on a fully connected neural network;

[0031] The wheel hub defect detection model is constructed based on the feature extraction module, the multi-scale feature decomposition module, the feature fusion module and the regressor module.

[0032] Optionally, after determining the total loss values ​​respectively corresponding to the optimized wheel hub defect detection models after each iterative training based on the preset regression loss function, the method includes:

[0033] Obtaining initial model parameters of the optimized wheel hub defect detection model;

[0034] Based on the total loss value corresponding to the optimized wheel hub defect detection model after the current iterative training, the initial model parameters are optimized using the Adam optimizer to obtain the first model parameters of the optimized wheel hub defect detection model after the current iterative training, until all the model parameters generated in each iterative training of the first preset round of iterative training are obtained.

[0035] Optionally, after determining the optimized wheel hub defect detection model after the iteration corresponding to the minimum total loss value among the total loss values ​​respectively corresponding to the optimized wheel hub defect detection models trained in each iteration as the wheel hub defect target detection model, the method includes:

[0036] The second model parameters of the wheel hub defect target detection model are set based on the first model parameters corresponding to the optimized wheel hub defect detection model after the iteration, and the model parameters generated in each iterative training include the first model parameters and the second model parameters.

[0037] According to a second aspect of the present disclosure, a device for detecting wheel hub surface defects based on deep learning is provided, comprising:

[0038] An acquisition unit, used for acquiring wheel hub image samples containing wheel hub surface information during the production process, and performing data annotation on the wheel hub image samples to obtain a training data set for wheel hub defect detection;

[0039] A first setting unit is used to set a front-layer network of a VGG19 model pre-trained under a preset large-scale image dataset as a feature extraction module;

[0040] A construction unit, used to construct a wheel defect detection model based on the feature extraction module, the multi-scale feature decomposition module, and the feature fusion module and the regressor module based on the spatial attention mechanism;

[0041] A calculation unit, used for calculating the optimal number of feature decomposition layers corresponding to the multi-scale feature decomposition module based on a particle swarm optimization algorithm;

[0042] An optimization unit, used for optimizing the network structure of the wheel hub defect detection model according to the optimal feature decomposition layer number to obtain an optimized wheel hub defect detection model;

[0043] A training unit, configured to iteratively train the optimized wheel hub defect detection model based on the training data set, and determine a total loss value corresponding to each of the optimized wheel hub defect detection models for each iterative training based on a preset regression loss function;

[0044] A determination unit, configured to determine the optimized wheel hub defect detection model after the iteration corresponding to the minimum total loss value among the total loss values ​​respectively corresponding to the optimized wheel hub defect detection models trained in each iteration as the wheel hub defect target detection model;

[0045] The detection unit is used to perform surface defect detection on the produced wheel hubs based on the wheel hub defect target detection model, so as to timely discover the wheel hubs with surface defects.

[0046] Optionally, the training unit is further used for:

[0047] Initializing the initial weight of each wheel hub image sample in the training data set;

[0048] Calculating the first loss value of the wheel image sample corresponding to the initial weight using the initial weight based on the preset regression loss function, so as to obtain the first loss value corresponding to each of the wheel image samples;

[0049] Accumulating the first loss values ​​corresponding to each of the wheel hub image samples to obtain a first total loss value corresponding to the optimized wheel hub defect detection model after the current iterative training;

[0050] The initial weight of each wheel image sample is updated based on a preset weight update algorithm and a preset weight update rate to obtain an updated weight corresponding to each wheel image sample;

[0051] Based on the preset regression loss function, the updated weights are used to calculate the second loss value corresponding to each of the wheel hub image samples, and the second loss values ​​are accumulated to obtain the second total loss value corresponding to the optimized wheel hub defect detection model after the iterative training again, until the total loss values ​​corresponding to the optimized wheel hub defect detection models of each iterative training are obtained after the first preset round of iterative training, and the total loss values ​​corresponding to the optimized wheel hub defect detection models of each iterative training include the first total loss value and the second total loss value, and the optimized wheel hub defect detection model after the iterative training again is the wheel hub defect detection model obtained by iteratively training the optimized wheel hub defect detection model after the current iterative training.

[0052] Optionally, the computing unit is used for:

[0053] Randomly generate a preset number of particles, each particle in the preset number of particles represents a set of characteristic decomposition layer number combinations;

[0054] Iteratively train the characteristic decomposition layer combination corresponding to each particle, and calculate the third loss value corresponding to each characteristic decomposition layer combination based on the preset regression loss function, wherein the third loss value is used to describe the fitness of the corresponding particle, and each characteristic decomposition layer combination is the characteristic decomposition layer combination corresponding to the preset number of particles;

[0055] Determine the characteristic decomposition layer number combination corresponding to the third loss value with the smallest value among the third loss values ​​corresponding to each characteristic decomposition layer number combination as the first optimal characteristic decomposition layer number combination;

[0056] Based on a preset particle update algorithm, each of the feature decomposition layer number combinations is updated using the first optimal feature decomposition layer number combination to obtain each updated feature decomposition layer number combination;

[0057] Iterative training is performed on each updated feature decomposition layer combination, and the fourth loss values ​​corresponding to each updated feature decomposition layer combination are calculated based on the preset regression loss function, and the updated feature decomposition layer combination corresponding to the fourth loss value with the smallest value among the fourth loss values ​​corresponding to each updated feature decomposition layer combination is determined as the second optimal feature decomposition layer combination, and each updated feature decomposition layer combination is updated and iteratively trained using the second optimal feature decomposition layer combination based on the preset particle update algorithm, until the second preset round of iterative training is completed, and the feature decomposition layer number of the final iterative feature decomposition layer combination with the smallest loss value among the feature decomposition layer combinations after the final iteration is determined as the optimal feature decomposition layer number, and the final iterative feature decomposition layer combinations include the final iterative feature decomposition layer combination, and the updated feature decomposition layer combinations include the updated feature decomposition layer combination.

[0058] Optionally, the construction unit is further used for:

[0059] Constructing the multi-scale feature decomposition module based on the multi-scale feature decomposition layer and the maximum pooling layer, wherein the multi-scale feature decomposition layer includes a convolution layer, a batch normalization layer, and a ReLU activation function, and the number of the multi-scale feature decomposition layers and the maximum pooling layers included in the multi-scale feature decomposition module is determined according to the optimal number of feature decomposition layers;

[0060] Constructing the regressor module based on a fully connected neural network;

[0061] The wheel hub defect detection model is constructed based on the feature extraction module, the multi-scale feature decomposition module, the feature fusion module and the regressor module.

[0062] Optionally, the device comprises:

[0063] An acquisition unit, used for acquiring initial model parameters of the optimized wheel hub defect detection model;

[0064] An optimization unit is used to optimize the initial model parameters using an Adam optimizer based on the total loss value corresponding to the optimized wheel hub defect detection model after the current iterative training, to obtain the first model parameters of the optimized wheel hub defect detection model after the current iterative training, until all the model parameters generated by each iterative training in the first preset round of iterative training are obtained.

[0065] Optionally, the device comprises:

[0066] The second setting unit is used to set the second model parameters of the wheel hub defect target detection model based on the first model parameters corresponding to the optimized wheel hub defect detection model after the iteration, and the model parameters generated in each iterative training include the first model parameters and the second model parameters.

[0067] According to a third aspect of the present disclosure, there is provided an electronic device, including:

[0068] at least one processor; and

[0069] a memory communicatively connected to the at least one processor; wherein,

[0070] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect.

[0071] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method described in the first aspect.

[0072] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method as described in the first aspect above.

[0073] The method and device for wheel hub surface defect detection based on deep learning provided by the present invention collect wheel hub image samples containing wheel hub surface information during the production process, and perform data annotation on the wheel hub image samples to obtain a training data set for wheel hub defect detection; set the front layer network of the VGG19 model pre-trained under a preset large-scale image data set as a feature extraction module; construct a wheel hub defect detection model based on the feature extraction module, the multi-scale feature decomposition module, and the feature fusion module and regressor module based on the spatial attention mechanism; calculate the optimal feature decomposition layer number corresponding to the multi-scale feature decomposition module based on the particle swarm optimization algorithm; and perform the regressor optimization on the wheel hub defect detection model according to the optimal feature decomposition layer number. The network structure of the wheel hub defect detection model is optimized to obtain an optimized wheel hub defect detection model; the optimized wheel hub defect detection model is iteratively trained based on the training data set, and the total loss values ​​corresponding to the optimized wheel hub defect detection models of each iterative training are determined based on a preset regression loss function; the optimized wheel hub defect detection model after the iteration corresponding to the smallest total loss value among the total loss values ​​corresponding to the optimized wheel hub defect detection models of each iterative training is determined as the wheel hub defect target detection model; surface defect detection is performed on the produced wheel hubs based on the wheel hub defect target detection model to promptly discover the wheel hubs with surface defects. Compared with the related art, by setting the front-layer network of the VGG19 model pre-trained under a preset large-scale image dataset as a feature extraction module, it is achieved that no training is required when performing wheel hub image feature extraction, thereby reducing the dependence on training sample data. In addition, the preset regression loss function is used to accelerate the convergence speed of the optimized wheel hub defect detection model during the training process to reduce the scale of training sample data for training the optimized wheel hub defect detection model, thereby solving the problem that it is difficult to implement training of the target model through a large-scale sample dataset, and realizing that a high-precision wheel hub defect target detection model can be trained using small-scale training sample data. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the accompanying drawings:

[0075] Figure 1 A schematic flow chart of a method for detecting wheel hub surface defects based on deep learning provided by an embodiment of the present disclosure;

[0076] Figure 2 A schematic diagram of a network structure of a feature extraction module provided in an embodiment of the present disclosure;

[0077] Figure 3A schematic diagram of a network structure of an automobile wheel hub defect detection model provided by an embodiment of the present disclosure;

[0078] Figure 4 A schematic diagram of the structure of a device for detecting wheel hub surface defects based on deep learning provided by an embodiment of the present disclosure;

[0079] Figure 5 A schematic diagram of the structure of another device for detecting wheel hub surface defects based on deep learning provided by an embodiment of the present disclosure;

[0080] Figure 6 A schematic block diagram of an exemplary electronic device 300 provided for an embodiment of the present disclosure. DETAILED DESCRIPTION

[0081] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present invention can be combined with each other without conflict.

[0082] The following detailed description is an exemplary description, which is intended to provide further detailed description of the present invention. Unless otherwise specified, all technical terms used in the present invention have the same meaning as those generally understood by those skilled in the art to which the present invention belongs. The terms used in the present invention are only for describing specific embodiments, and are not intended to limit the exemplary embodiments according to the present invention.

[0083] In addition, the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein.

[0084] The following describes the method and device for hub surface defect detection based on deep learning according to an embodiment of the present disclosure with reference to the accompanying drawings.

[0085] In order to at least solve the problem in the related art that it is difficult to train a target model using a large-scale sample data set, this embodiment provides a method for detecting wheel hub surface defects based on deep learning.

[0086] Figure 1 The following is a flow chart of a method for detecting wheel hub surface defects based on deep learning provided by an embodiment of the present disclosure. Figure 1 As shown, the method comprises the following steps:

[0087] Step 101, collecting wheel hub image samples containing wheel hub surface information during the production process, and annotating the wheel hub image samples to obtain a training data set for wheel hub defect detection;

[0088] As a refinement of the above step 101, the wheel hub image data used to train the optimized wheel hub defect detection model is collected in real time based on the industrial-grade CCD camera deployed in the wheel hub production process; and the captured wheel hub image data is adjusted to image data with a resolution of 2048×2048. After that, the wheel hub image data with defects is screened out, and the defects therein are annotated with rectangular frames using the labeling software LabelImg to obtain the location information of the defects in the wheel hub image data, including ; and They are the horizontal and vertical coordinates of the center point of the rectangular box corresponding to the marked defect, and are the height and width of the rectangular frame respectively. The wheel hub image data is the wheel hub image sample. The training data set is constructed based on the labeled wheel hub image data.

[0089] Step 102, setting the front layer network of the VGG19 model pre-trained under a preset large-scale image dataset as a feature extraction module;

[0090] As a refinement of the above step 102, feature extraction is performed on the wheel hub image data to obtain deeper semantic information. Therefore, the selection and design of the feature extraction module directly affects the quality of deep features. The pre-trained VGG19 model has been trained on the large-scale ImageNet dataset. It has a strong feature extraction capability and can well capture the edges, textures and more complex shapes in the image. The ImageNet dataset is the preset large-scale image dataset. Therefore, defect features can also be effectively extracted. The present disclosure ultimately retains the front-layer network and parameters of the VGG19 model as the feature extraction module for the wheel hub image, and in order to more intuitively display the structure of the feature extraction module, Figure 2 A schematic diagram of a network structure of a feature extraction module provided in an embodiment of the present disclosure is shown in FIG. Figure 2 As shown in FIG. 1 , the feature extraction module includes five convolution blocks and one pooling layer. The structure of any convolution block in the five convolution blocks includes two convolution layers and two activation functions ReLU. Therefore, a feature extraction function is set in the feature extraction module. The feature extraction function is shown in formula (1). For the detected wheel image, , the deep features after the feature extraction module are The specific process is shown in formula (1):

[0091] Formula (1)

[0092] in, It is the feature extraction function of the feature extraction module.

[0093] Step 103, constructing a wheel hub defect detection model based on the feature extraction module, the multi-scale feature decomposition module, and the feature fusion module and the regressor module based on the spatial attention mechanism;

[0094] As a refinement of the above step 103, the feature extraction module, the multi-scale feature decomposition module, the feature fusion module and the regressor module are sequentially connected to form the wheel hub defect detection model.

[0095] Step 104, calculating the optimal number of feature decomposition layers corresponding to the multi-scale feature decomposition module based on a particle swarm optimization algorithm;

[0096] As a refinement of the above step 104, after the hub defect detection model is constructed through step 103, in order to improve the quality and efficiency of the hub defect detection model in decomposing the feature data, the optimal feature decomposition layer number corresponding to the multi-scale feature decomposition module is calculated based on the particle swarm optimization algorithm, and the feature data is the depth feature extracted from the hub image based on the feature extraction module. .

[0097] Step 105, optimizing the network structure of the wheel hub defect detection model according to the optimal feature decomposition layer number to obtain an optimized wheel hub defect detection model;

[0098] As a refinement of the above-mentioned step 105, after the optimal number of feature decomposition layers is calculated based on step 104, the network layer structure of the multi-scale feature decomposition module in the wheel hub defect detection model is set according to the optimal number of feature decomposition layers, thereby completing the optimization of the network structure of the wheel hub defect detection model and obtaining the optimized wheel hub defect detection model.

[0099] Step 106, iteratively training the optimized wheel hub defect detection model based on the training data set, and determining the total loss value corresponding to each iterative training of the optimized wheel hub defect detection model based on a preset regression loss function;

[0100] As a refinement of the above step 106, in order to know the performance of the optimized wheel hub defect detection model after each iteration, the optimized wheel hub defect detection model is iteratively trained based on the training data set constructed in step 101, and the total loss value of the optimized wheel hub defect detection model obtained in this iteration is calculated based on the preset regression loss function after each iteration, so as to obtain the total loss value corresponding to the optimized wheel hub defect detection model trained in each iteration. The total loss value is used to describe the performance of the optimized wheel hub defect detection model after each iteration. The larger the value of the total loss value, the worse the performance of the optimized contour defect detection model after the corresponding iteration, and vice versa.

[0101] Step 107, determining the optimized wheel hub defect detection model after the iteration corresponding to the minimum total loss value among the total loss values ​​corresponding to the optimized wheel hub defect detection models trained in each iteration as the wheel hub defect target detection model;

[0102] As a refinement of the above step 107, in order to obtain the best-performing optimized wheel hub defect detection model generated during the iterative training process, the total loss values ​​corresponding to the optimized wheel hub defect detection models of each iterative training are compared to determine the minimum total loss value. The optimized wheel hub defect detection model after the iteration corresponding to the minimum total loss value is the model with the best performance, and the optimized wheel hub defect detection model after the iteration is determined as the wheel hub defect target detection model.

[0103] Step 108: Perform surface defect detection on the produced wheel hubs based on the wheel hub defect target detection model to promptly detect the wheel hubs with surface defects.

[0104] As a refinement of the above step 108, the wheel hub defect target detection model is deployed on the target server, and the produced wheel hub is subjected to surface defect detection, so as to timely discover the defects existing on the wheel hub surface.

[0105] The method for wheel hub surface defect detection based on deep learning provided by the present invention collects wheel hub image samples containing wheel hub surface information during the production process, and performs data annotation on the wheel hub image samples to obtain a training data set for wheel hub defect detection; the front-layer network of the VGG19 model pre-trained under a preset large-scale image data set is set as a feature extraction module; a wheel hub defect detection model is constructed based on the feature extraction module, the multi-scale feature decomposition module, and the feature fusion module and regressor module based on the spatial attention mechanism; the optimal feature decomposition layer number corresponding to the multi-scale feature decomposition module is calculated based on the particle swarm optimization algorithm; the optimal feature decomposition layer number is quantified according to the optimal feature decomposition layer number. The network structure of the wheel hub defect detection model is optimized to obtain the optimized wheel hub defect detection model; the optimized wheel hub defect detection model is iteratively trained based on the training data set, and the total loss value corresponding to each iterative training of the optimized wheel hub defect detection model is determined based on a preset regression loss function; the optimized wheel hub defect detection model after the iteration corresponding to the smallest total loss value among the total loss values ​​corresponding to the optimized wheel hub defect detection model of each iterative training is determined as the wheel hub defect target detection model; surface defect detection is performed on the produced wheel hubs based on the wheel hub defect target detection model to timely discover the wheel hubs with surface defects. Compared with the related art, by setting the front-layer network of the VGG19 model pre-trained under a preset large-scale image dataset as a feature extraction module, it is achieved that no training is required when performing wheel hub image feature extraction, thereby reducing the dependence on training sample data. In addition, the preset regression loss function is used to accelerate the convergence speed of the optimized wheel hub defect detection model during the training process to reduce the scale of training sample data for training the optimized wheel hub defect detection model, thereby solving the problem that it is difficult to implement training of the target model through a large-scale sample dataset, and realizing that a high-precision wheel hub defect target detection model can be trained using small-scale training sample data.

[0106] As a refinement of the above embodiment, when executing step 103 to construct a wheel hub defect detection model based on the feature extraction module, the multi-scale feature decomposition module, and the feature fusion module and regressor module based on the spatial attention mechanism, the following implementation methods may also be adopted but are not limited to, for example: constructing the multi-scale feature decomposition module based on a multi-scale feature decomposition layer and a maximum pooling layer, the multi-scale feature decomposition layer includes a convolution layer, a batch normalization layer and a ReLU activation function, and the number of the multi-scale feature decomposition layers and the maximum pooling layers included in the multi-scale feature decomposition module is determined according to the optimal number of feature decomposition layers; constructing the regressor module based on a fully connected neural network; constructing the wheel hub defect detection model based on the feature extraction module, the multi-scale feature decomposition module, the feature fusion module and the regressor module.

[0107] In order to facilitate the understanding of the above embodiment, this embodiment combines Figure 3 Provide an exemplary description, Figure 3 A schematic diagram of a network structure of an automobile wheel hub defect detection model provided by an embodiment of the present disclosure, the specific description includes: Figure 3 The feature extraction module, the multi-scale feature decomposition module, the feature fusion module based on the spatial attention mechanism and the regressor network are shown in FIG. The regressor network is the regressor module. Furthermore, the multi-scale feature decomposition module includes multiple multi-scale feature decomposition layers. And multiple maximum pooling layers, where , and There are three different scale feature decomposition layers, Max-Pooling2*2 and Max-Pooling3*3 are two different maximum pooling layers, and the multi-scale feature decomposition layer And the maximum pooling layer constructs a multi-scale feature decomposition module. Among them, The layer consists of a convolution layer, a batch normalization layer (BN), and a ReLU activation function; and according to different convolution kernel sizes, There are three types:

[0108]

[0109] in, Represents the size of the convolution kernel. A larger convolution kernel has a larger receptive field, but at the same time requires more computation. A smaller convolution kernel is more likely to capture detail defect features, but the area of ​​perceptual features is smaller. Therefore, in order to ensure the quality and efficiency of feature decomposition, different feature decomposition scales are used. , and The number of layers is , and In the detailed description of step 102 above, the depth feature The extraction process is described. Add after the feature decomposition layer 2*2 maximum pooling layer (Max-Pooling2*2), and at the same time Add after the feature decomposition layer A 3*3 maximum pooling layer (Max-Pooling3*3) is used to ensure that the sizes of the three decomposed features are consistent. Finally, the feature outputs under the above three decompositions are , and .

[0110] A feature fusion module based on the spatial channel attention mechanism is constructed to realize automatic feature selection of the three types of decomposed features. First, the three decomposed features are spliced ​​into channels to obtain the feature , the splicing process is shown in the following formula (2):

[0111] Formula (2)

[0112] in, is the channel concatenation operation. Then the spatial attention module The calculation method is shown in the following formula (3):

[0113] Formula (3)

[0114] Among them, MP(F_mix): MP stands for Max Pooling. Max pooling is a commonly used pooling operation that is used to reduce the spatial dimension of the feature map while retaining the most important features. AP(F_mix): AP stands for Average Pooling. Unlike max pooling, average pooling calculates the average of all values ​​in the pooling window, which helps to retain background information. MP(F_mix) + AP(F_mix): means adding the results of max pooling and average pooling. The purpose is to combine the advantages of both, retaining both the most important features and the background information. K (7×7) : This represents a 7×7 convolution kernel. The convolution kernel is used to perform a convolution operation on the input feature map to extract or fuse features. (7×7) (MP(F_mix) + AP(F_mix)): This step is to apply a 7×7 convolution kernel to the mixed pooling result obtained in the previous step for convolution operation, the purpose is to further fuse and extract features. σ(...): Here σ represents the activation function, such as Sigmoid or ReLU. The activation function is used to increase the nonlinearity of the network and help the network learn complex patterns.

[0115] Finally, the features fused based on the spatial attention mechanism are obtained. The specific fusion process is shown in formula (4):

[0116] Formula (4)

[0117] in, It means element-wise multiplication. is the fused feature;

[0118] Design a regressor network, which is a fully connected (FL) neural network, and use the fused features As the input of the regressor, the final result of whether the wheel image has defects is obtained. The specific process is shown in formula (5):

[0119] Formula (5)

[0120] in, is the fully connected layer, is the target detection result, which specifically includes , and They are the horizontal and vertical coordinates of the center point of the rectangular box corresponding to the defect detection, and are the height and width of the defect detection rectangle respectively.

[0121] As a refinement of the above embodiment, when executing step 104 to calculate the optimal feature decomposition layer number corresponding to the multi-scale feature decomposition module based on the particle swarm optimization algorithm, the following implementation methods may also be used but are not limited to, for example: randomly generate a preset number of particles, each particle in the preset number of particles represents a set of feature decomposition layer number combinations; iteratively train the feature decomposition layer number combinations corresponding to each particle, and calculate the third loss value corresponding to each feature decomposition layer number combination based on the preset regression loss function, the third loss value is used to describe the fitness of the corresponding particle, and each feature decomposition layer number combination is the feature decomposition layer number combination corresponding to the preset number of particles; determine the feature decomposition layer number combination corresponding to the smallest third loss value among the third loss values ​​corresponding to each feature decomposition layer number combination as the first optimal feature decomposition layer number combination; based on the preset particle update algorithm, use the first optimal feature decomposition layer number combination to update each feature decomposition layer number combination, and obtain to each updated feature decomposition layer combination; iteratively train each updated feature decomposition layer combination, calculate the fourth loss values ​​corresponding to each updated feature decomposition layer combination based on the preset regression loss function, and determine the updated feature decomposition layer combination corresponding to the fourth loss value with the smallest value among the fourth loss values ​​corresponding to each updated feature decomposition layer combination as the second optimal feature decomposition layer combination, update each updated feature decomposition layer combination respectively based on the preset particle update algorithm and iteratively train the second optimal feature decomposition layer combination, until the second preset round of iterative training is completed, and determine the feature decomposition layer number of the final iterative feature decomposition layer combination with the smallest loss value among the feature decomposition layer combinations after the final iteration as the optimal feature decomposition layer number, the final iterative feature decomposition layer combinations include the final iterative feature decomposition layer combination, and the updated feature decomposition layer combinations include the updated feature decomposition layer combination.

[0122] In order to facilitate understanding of the above embodiment, this embodiment provides an exemplary description, and the exemplary description here is based on the above exemplary description. For understanding of the exemplary description here, reference can be made to the above exemplary description, including:

[0123] S1: Designing a regression loss function for wheel defect detection model based on DIoU (Distance IoU) , the regression loss function That is the preset regression loss function, which is shown in formula (6):

[0124] Formula (6)

[0125] in, To detect the IoU value between the rectangular box and the real rectangular box, is the diagonal length of the minimum enclosing area that contains the detection rectangle and the true rectangle.

[0126] S2: Selection based on particle swarm optimization algorithm , and The optimal number of layers, , and The optimal number of layers is the optimal number of eigendecomposition layers, and the specific process includes:

[0127] 1) Initialize the particle swarm: randomly generate T particles, each particle represents a group , and Layer combination scheme, the set , and The layer combination scheme is a set of feature decomposition layer combinations, specifically:

[0128]

[0129] in, Respectively represent The corresponding particles , and The number of layers, and ;

[0130] 2) Obtain particle fitness: Iterate according to the layer combination scheme corresponding to each particle and calculate the corresponding The loss value is used as the fitness value of the particle;

[0131] 3) Determine the current optimal particle: The layer combination scheme corresponding to the particle with the smallest fitness in the particle swarm is taken as the current optimal combination scheme of the particle swarm ;

[0132] 4) The process of updating the combination of the number of feature decomposition layers is the process of updating particles. The particle updating process is shown in formula (7):

[0133] Formula (7)

[0134] in, is the update speed weight, and , Belong to the interval A random number, For the updated particles, and ;

[0135] 5) Repeat steps 2) to 4) until the maximum number of iterations is reached, which is the number of iterations of the second preset round, and the optimal particle obtained in the last iteration is :

[0136]

[0137] in, correspond , and The optimal combination scheme of the number of layers, the optimal combination scheme corresponds to the optimal number of characteristic decomposition layers, in addition, Corresponding to , and That is to say The number of layers is , The number of layers is , The number of layers is .

[0138] 6) Based on the optimal combination scheme obtained in 5), the optimal network structure of the wheel hub defect detection model is finally determined;

[0139] As a refinement of the embodiment of the present disclosure, when executing step 106 to determine the total loss value corresponding to the optimized wheel hub defect detection model for each iterative training based on the preset regression loss function, the following implementation methods may also be adopted but are not limited to, for example: initializing the initial weight of each wheel hub image sample in the training data set; calculating the first loss value of the wheel hub image sample corresponding to the initial weight based on the preset regression loss function using the initial weight, thereby obtaining the first loss value corresponding to each of the wheel hub image samples; accumulating the first loss value corresponding to each of the wheel hub image samples to obtain the first total loss value corresponding to the optimized wheel hub defect detection model after the current iterative training; updating the initial weight of each wheel hub image sample based on a preset weight update algorithm and a preset weight update rate. , obtain the updated weight corresponding to each wheel hub image sample; calculate the second loss value corresponding to each wheel hub image sample based on the preset regression loss function using the updated weight, accumulate the second loss values, and obtain the second total loss value corresponding to the optimized wheel hub defect detection model after the iterative training again, until the total loss values ​​corresponding to the optimized wheel hub defect detection model of each iterative training are obtained after the first preset round of iterative training, the total loss values ​​corresponding to the optimized wheel hub defect detection model of each iterative training include the first total loss value and the second total loss value, and the optimized wheel hub defect detection model after the iterative training again is the wheel hub defect detection model obtained by iteratively training the optimized wheel hub defect detection model after the current iterative training again.

[0140] As a refinement of the above embodiment, after executing step 106 to determine the total loss values ​​corresponding to the optimized wheel hub defect detection model for each iterative training based on the preset regression loss function, the method can also adopt but is not limited to the following implementation methods, for example: obtaining the initial model parameters of the optimized wheel hub defect detection model; optimizing the initial model parameters using the Adam optimizer based on the total loss value corresponding to the optimized wheel hub defect detection model after the current iterative training, and obtaining the first model parameters of the optimized wheel hub defect detection model after the current iterative training, until all the model parameters generated in each iterative training in the first preset round of iterative training are obtained.

[0141] As a refinement of the above embodiment, after executing step 107 to determine the optimized wheel hub defect detection model after each iteration corresponding to the smallest total loss value among the total loss values ​​corresponding to the optimized wheel hub defect detection model trained in each iteration as the wheel hub defect target detection model, the method may also adopt but is not limited to the following implementation methods, for example: setting the second model parameters of the wheel hub defect target detection model based on the first model parameters corresponding to the optimized wheel hub defect detection model after the iteration, and the model parameters generated in each iterative training include the first model parameters and the second model parameters.

[0142] In order to facilitate understanding of the above embodiment, this embodiment provides an exemplary description, and the exemplary description here is based on the above exemplary description. For understanding of the exemplary description here, reference can be made to the above exemplary description, including:

[0143] A1: Initialize the initial weight of each wheel image sample. The total number of wheel image samples is , so the training weight of each sample is:

[0144]

[0145] in, In addition, the parameters of the initialization wheel defect detection model are .

[0146] A2: Iterative model training, calculating the loss function result of the current iteration, that is, using the initial weights based on the preset regression loss function to calculate the first loss value of the wheel image sample corresponding to the initial weights. The specific calculation process is shown in the following formulas (8) and (9):

[0147] Formula (8)

[0148] Formula (9)

[0149] in, is the i-th sample in training The loss calculation results are: is the corresponding weighted loss result, that is, the first loss value corresponding to the i-th sample in training, is the overall loss of the first iteration; based on The parameters of the wheel target detection model after the first training are obtained by using the Adam optimizer for parameter optimization. ;

[0150] A3: Update the weight of each wheel sample data. The specific process is shown in formula (10):

[0151] Formula (10)

[0152] in, is the preset weight update rate, is the updated weight of the i-th sample, exp(▪) is the natural exponential function;

[0153] A4: Repeat steps A2 and A3 for a total of times, and obtained The total loss of iteration , and the parameters of the wheel hub defect detection model ; Each group of parameters corresponds to a wheel hub defect detection model, i.e., q0, q1, …, q H Represents the model parameters corresponding to each iteration of the wheel defect detection model.

[0154] A5: Since a larger loss function value indicates a poorer model detection performance, and vice versa, a larger loss function value indicates a better model detection performance, the present invention selects the model parameters corresponding to the minimum total loss value as the final wheel hub defect target detection model.

[0155] As a refinement of the above embodiment, performing surface defect detection on the produced wheel hubs based on the wheel hub defect target detection model in executing step 108 to timely discover the wheel hubs with surface defects includes: deploying the wheel hub defect target detection model on the background server; using the visual camera in the production workshop, real-time collecting and returning image information of the wheel hub production process to the background server; inputting the collected wheel hub image into the defect detection model to obtain the wheel hub defect detection result; finally realizing real-time detection of wheel hub defects in the wheel hub production process and timely detecting wheel hubs with defects in the production process.

[0156] In order to more intuitively demonstrate the performance of the wheel hub surface defect detection method based on deep learning in the embodiment of the present disclosure, the performance indicators are evaluated, namely accuracy, precision, recall rate and F-1 score, and the verification results are shown in Table 1 below:

[0157] Table 1 Verification results

[0158]

[0159] It has been verified that the wheel hub defect target detection model provided by the present invention has high detection accuracy.

[0160] In summary, the embodiments of the present disclosure can achieve the following effects:

[0161] 1. By setting the front-layer network of the VGG19 model pre-trained under a preset large-scale image dataset as a feature extraction module, it is achieved that no training is required when performing wheel hub image feature extraction, thereby reducing the dependence on training sample data. In addition, the convergence speed of the optimized wheel hub defect detection model during the training process is accelerated by the preset regression loss function to reduce the scale of training sample data for training the optimized wheel hub defect detection model, thereby solving the problem that it is difficult to implement training of the target model through a large-scale sample dataset, and realizing that a high-precision wheel hub defect target detection model can be trained using small-scale training sample data.

[0162] 2. The feature extraction module proposed in the present disclosure is a VGG19 model pre-trained with a large amount of image data. No training is required when extracting features from automobile wheel images. The computational complexity is low and it is suitable for small sample data sets.

[0163] 3. The feature fusion module based on the spatial attention mechanism proposed in the present invention can effectively filter out the background information in the car wheel image and focus the model's attention on the car wheel.

[0164] 4. The multi-scale feature decomposition module proposed in this disclosure can effectively remove illumination noise.

[0165] 5. The present invention adopts a particle swarm algorithm to obtain the optimal network structure of the automobile wheel hub defect detection model, which replaces the manual adjustment of network parameters, and can obtain the automobile wheel hub defect detection model with the optimal network structure in a relatively short time.

[0166] 6. The sample enhancement training mechanism and loss function designed in the present invention are suitable for small sample training problems. A high-precision detection model can be trained using small-scale automobile wheel sample data, solving the problem that large-scale automobile wheel data sets are difficult to obtain.

[0167] Corresponding to the above-mentioned method for detecting wheel hub surface defects based on deep learning, the present invention also proposes a device for detecting wheel hub surface defects based on deep learning. Since the device embodiment of the present invention corresponds to the above-mentioned method embodiment, the details not disclosed in the device embodiment can be referred to the above-mentioned method embodiment, and will not be described in detail in the present invention.

[0168] Figure 4 A schematic diagram of the structure of a device for detecting wheel hub surface defects based on deep learning provided by an embodiment of the present disclosure is shown in FIG. Figure 4 As shown, including:

[0169] The acquisition unit 21 is used to acquire wheel hub image samples containing wheel hub surface information during the production process, and to perform data annotation on the wheel hub image samples to obtain a training data set for wheel hub defect detection;

[0170] A first setting unit 22 is used to set a front-layer network of a VGG19 model pre-trained under a preset large-scale image dataset as a feature extraction module;

[0171] A construction unit 23, configured to construct a wheel defect detection model based on the feature extraction module, the multi-scale feature decomposition module, and the feature fusion module and the regressor module based on the spatial attention mechanism;

[0172] A calculation unit 24, used for calculating the optimal number of feature decomposition layers corresponding to the multi-scale feature decomposition module based on a particle swarm optimization algorithm;

[0173] An optimization unit 25, configured to optimize the network structure of the wheel hub defect detection model according to the optimal feature decomposition layer number to obtain an optimized wheel hub defect detection model;

[0174] A training unit 26, configured to iteratively train the optimized wheel hub defect detection model based on the training data set, and determine the total loss value corresponding to each of the optimized wheel hub defect detection models in each iterative training based on a preset regression loss function;

[0175] A determination unit 27, configured to determine the optimized wheel hub defect detection model after the iteration corresponding to the minimum total loss value among the total loss values ​​respectively corresponding to the optimized wheel hub defect detection models trained in each iteration as the wheel hub defect target detection model;

[0176] The detection unit 28 is used to perform surface defect detection on the produced wheel hubs based on the wheel hub defect target detection model, so as to timely find the wheel hubs with surface defects.

[0177] The device for wheel hub surface defect detection based on deep learning provided by the present disclosure collects wheel hub image samples containing wheel hub surface information during the production process, and performs data annotation on the wheel hub image samples to obtain a training data set for wheel hub defect detection; sets the front layer network of the VGG19 model pre-trained under a preset large-scale image data set as a feature extraction module; constructs a wheel hub defect detection model based on the feature extraction module, the multi-scale feature decomposition module, and the feature fusion module and regressor module based on the spatial attention mechanism; calculates the optimal feature decomposition layer number corresponding to the multi-scale feature decomposition module based on the particle swarm optimization algorithm; and performs regressor optimization on the wheel hub defect detection model according to the optimal feature decomposition layer number. The network structure of the wheel hub defect detection model is optimized to obtain the optimized wheel hub defect detection model; the optimized wheel hub defect detection model is iteratively trained based on the training data set, and the total loss value corresponding to each iterative training of the optimized wheel hub defect detection model is determined based on a preset regression loss function; the optimized wheel hub defect detection model after the iteration corresponding to the smallest total loss value among the total loss values ​​corresponding to the optimized wheel hub defect detection model of each iterative training is determined as the wheel hub defect target detection model; surface defect detection is performed on the produced wheel hubs based on the wheel hub defect target detection model to timely discover the wheel hubs with surface defects. Compared with the related art, by setting the front-layer network of the VGG19 model pre-trained under a preset large-scale image dataset as a feature extraction module, it is achieved that no training is required when performing wheel hub image feature extraction, thereby reducing the dependence on training sample data. In addition, the preset regression loss function is used to accelerate the convergence speed of the optimized wheel hub defect detection model during the training process to reduce the scale of training sample data for training the optimized wheel hub defect detection model, thereby solving the problem that it is difficult to implement training of the target model through a large-scale sample dataset, and realizing that a high-precision wheel hub defect target detection model can be trained using small-scale training sample data.

[0178] Figure 5 A schematic diagram of the structure of another device for detecting wheel hub surface defects based on deep learning provided by an embodiment of the present disclosure is shown in FIG. Figure 5 As shown, the training unit 26 is also used for:

[0179] Initializing the initial weight of each wheel hub image sample in the training data set;

[0180] Calculating the first loss value of the wheel image sample corresponding to the initial weight using the initial weight based on the preset regression loss function, so as to obtain the first loss value corresponding to each of the wheel image samples;

[0181] Accumulating the first loss values ​​corresponding to each of the wheel hub image samples to obtain a first total loss value corresponding to the optimized wheel hub defect detection model after the current iterative training;

[0182] The initial weight of each wheel image sample is updated based on a preset weight update algorithm and a preset weight update rate to obtain an updated weight corresponding to each wheel image sample;

[0183] Based on the preset regression loss function, the updated weights are used to calculate the second loss value corresponding to each of the wheel hub image samples, and the second loss values ​​are accumulated to obtain the second total loss value corresponding to the optimized wheel hub defect detection model after the iterative training again, until the total loss values ​​corresponding to the optimized wheel hub defect detection models of each iterative training are obtained after the first preset round of iterative training, and the total loss values ​​corresponding to the optimized wheel hub defect detection models of each iterative training include the first total loss value and the second total loss value, and the optimized wheel hub defect detection model after the iterative training again is the wheel hub defect detection model obtained by iteratively training the optimized wheel hub defect detection model after the current iterative training.

[0184] Optionally, the computing unit 24 is used for:

[0185] Randomly generate a preset number of particles, each particle in the preset number of particles represents a set of characteristic decomposition layer number combinations;

[0186] Iteratively train the characteristic decomposition layer combination corresponding to each particle, and calculate the third loss value corresponding to each characteristic decomposition layer combination based on the preset regression loss function, wherein the third loss value is used to describe the fitness of the corresponding particle, and each characteristic decomposition layer combination is the characteristic decomposition layer combination corresponding to the preset number of particles;

[0187] Determine the characteristic decomposition layer number combination corresponding to the third loss value with the smallest value among the third loss values ​​corresponding to each characteristic decomposition layer number combination as the first optimal characteristic decomposition layer number combination;

[0188] Based on a preset particle update algorithm, each of the feature decomposition layer number combinations is updated using the first optimal feature decomposition layer number combination to obtain each updated feature decomposition layer number combination;

[0189] Iterative training is performed on each updated feature decomposition layer combination, and the fourth loss values ​​corresponding to each updated feature decomposition layer combination are calculated based on the preset regression loss function, and the updated feature decomposition layer combination corresponding to the fourth loss value with the smallest value among the fourth loss values ​​corresponding to each updated feature decomposition layer combination is determined as the second optimal feature decomposition layer combination, and each updated feature decomposition layer combination is updated and iteratively trained using the second optimal feature decomposition layer combination based on the preset particle update algorithm, until the second preset round of iterative training is completed, and the feature decomposition layer number of the final iterative feature decomposition layer combination with the smallest loss value among the feature decomposition layer combinations after the final iteration is determined as the optimal feature decomposition layer number, and the final iterative feature decomposition layer combinations include the final iterative feature decomposition layer combination, and the updated feature decomposition layer combinations include the updated feature decomposition layer combination.

[0190] Optionally, the construction unit 23 is further used for:

[0191] Constructing the multi-scale feature decomposition module based on the multi-scale feature decomposition layer and the maximum pooling layer, wherein the multi-scale feature decomposition layer includes a convolution layer, a batch normalization layer, and a ReLU activation function, and the number of the multi-scale feature decomposition layers and the maximum pooling layers included in the multi-scale feature decomposition module is determined according to the optimal number of feature decomposition layers;

[0192] Constructing the regressor module based on a fully connected neural network;

[0193] The wheel hub defect detection model is constructed based on the feature extraction module, the multi-scale feature decomposition module, the feature fusion module and the regressor module.

[0194] Optionally, the device comprises:

[0195] An acquisition unit 29, used to acquire initial model parameters of the optimized wheel hub defect detection model;

[0196] The optimization unit 210 is used to optimize the initial model parameters using the Adam optimizer based on the total loss value corresponding to the optimized wheel hub defect detection model after the current iterative training, and obtain the first model parameters of the optimized wheel hub defect detection model after the current iterative training, until all the model parameters generated by each iterative training in the first preset round of iterative training are obtained.

[0197] Optionally, the device comprises:

[0198] The second setting unit 211 is used to set the second model parameters of the wheel hub defect target detection model based on the first model parameters corresponding to the optimized wheel hub defect detection model after the iteration, and the model parameters generated by each iteration training include the first model parameters and the second model parameters. It should be noted that the above explanation of the method embodiment is also applicable to the device of this embodiment, and the principle is the same, which is no longer limited in this embodiment.

[0199] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0200] Figure 6 A schematic block diagram of an example electronic device 300 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0201] like Figure 6 As shown, the device 300 includes a computing unit 301, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 302 or a computer program loaded from a storage unit 308 to a RAM (Random Access Memory) 303. In the RAM 303, various programs and data required for the operation of the device 300 can also be stored. The computing unit 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An I / O (Input / Output) interface 305 is also connected to the bus 304.

[0202] A number of components in the device 300 are connected to the I / O interface 305, including: an input unit 306, such as a keyboard, a mouse, etc.; an output unit 307, such as various types of displays, speakers, etc.; a storage unit 308, such as a disk, an optical disk, etc.; and a communication unit 309, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 309 allows the device 300 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0203] The computing unit 301 may be various general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 301 include, but are not limited to, CPU (Central Processing Unit), GPU (Graphic Processing Units), various special AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 301 performs the various methods and processes described above, such as a method for detecting wheel hub surface defects based on deep learning. For example, in some embodiments, the method for detecting wheel hub surface defects based on deep learning may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 308. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 300 via the ROM 302 and / or the communication unit 309. When the computer program is loaded into the RAM 303 and executed by the computing unit 301, one or more steps of the method described above may be performed. Alternatively, in other embodiments, the computing unit 301 may be configured in any other appropriate manner (for example, by means of firmware) to execute the aforementioned method for hub surface defect detection based on deep learning.

[0204] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System On Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a dedicated or general-purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0205] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0206] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or apparatus. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include an electrical connection based on one or more wires, a portable computer disk, a hard disk, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage device, magnetic storage device, or any suitable combination of the foregoing.

[0207] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0208] The systems and techniques described herein may be implemented in a computing system that includes a backend component (e.g., as a data server), or a computing system that includes a middleware component (e.g., an application server), or a computing system that includes a frontend component (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.

[0209] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.

[0210] It should be noted that artificial intelligence is a discipline that studies how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.), and includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.

Claims

1. A method for detecting wheel hub surface defects based on deep learning, characterized in that: include: Collecting wheel hub image samples containing wheel hub surface information during the production process, and annotating the wheel hub image samples to obtain a training data set for wheel hub defect detection; The front-layer network of the VGG19 model pre-trained on a preset large-scale image dataset is set as a feature extraction module; Building a wheel hub defect detection model based on the feature extraction module, the multi-scale feature decomposition module, and the feature fusion module and the regressor module based on the spatial attention mechanism; Calculate the optimal number of feature decomposition layers corresponding to the multi-scale feature decomposition module based on a particle swarm optimization algorithm; Optimizing the network structure of the wheel hub defect detection model according to the optimal feature decomposition layer number to obtain an optimized wheel hub defect detection model; Iteratively training the optimized wheel hub defect detection model based on the training data set, and determining the total loss value corresponding to each iterative training of the optimized wheel hub defect detection model based on a preset regression loss function; Determine the optimized wheel hub defect detection model after the iteration corresponding to the minimum total loss value among the total loss values ​​respectively corresponding to the optimized wheel hub defect detection models trained in each iteration as the wheel hub defect target detection model; The produced wheel hubs are subjected to surface defect detection based on the wheel hub defect target detection model, so as to timely discover the wheel hubs with surface defects.

2. The method according to claim 1, characterized in that The total loss values ​​corresponding to the optimized wheel hub defect detection model after each iterative training are determined based on the preset regression loss function, including: Initializing the initial weight of each wheel hub image sample in the training data set; Calculating the first loss value of the wheel image sample corresponding to the initial weight using the initial weight based on the preset regression loss function, so as to obtain the first loss value corresponding to each of the wheel image samples; Accumulating the first loss values ​​corresponding to each of the wheel hub image samples to obtain a first total loss value corresponding to the optimized wheel hub defect detection model after the current iterative training; The initial weight of each wheel image sample is updated based on a preset weight update algorithm and a preset weight update rate to obtain an updated weight corresponding to each wheel image sample; Based on the preset regression loss function, the updated weights are used to calculate the second loss value corresponding to each of the wheel hub image samples, and the second loss values ​​are accumulated to obtain the second total loss value corresponding to the optimized wheel hub defect detection model after the iterative training again, until the total loss values ​​corresponding to the optimized wheel hub defect detection models of each iterative training are obtained after the first preset round of iterative training, and the total loss values ​​corresponding to the optimized wheel hub defect detection models of each iterative training include the first total loss value and the second total loss value, and the optimized wheel hub defect detection model after the iterative training again is the wheel hub defect detection model obtained by iteratively training the optimized wheel hub defect detection model after the current iterative training.

3. The method according to claim 2, characterized in that The method of calculating the optimal number of feature decomposition layers corresponding to the multi-scale feature decomposition module based on the particle swarm optimization algorithm includes: Randomly generate a preset number of particles, each particle in the preset number of particles represents a set of characteristic decomposition layer number combinations; Iteratively train the characteristic decomposition layer combination corresponding to each particle, and calculate the third loss value corresponding to each characteristic decomposition layer combination based on the preset regression loss function, wherein the third loss value is used to describe the fitness of the corresponding particle, and each characteristic decomposition layer combination is the characteristic decomposition layer combination corresponding to the preset number of particles; Determine the characteristic decomposition layer number combination corresponding to the third loss value with the smallest value among the third loss values ​​corresponding to each characteristic decomposition layer number combination as the first optimal characteristic decomposition layer number combination; Based on a preset particle update algorithm, each of the feature decomposition layer number combinations is updated using the first optimal feature decomposition layer number combination to obtain each updated feature decomposition layer number combination; Iterative training is performed on each updated feature decomposition layer combination, and the fourth loss values ​​corresponding to each updated feature decomposition layer combination are calculated based on the preset regression loss function, and the updated feature decomposition layer combination corresponding to the fourth loss value with the smallest value among the fourth loss values ​​corresponding to each updated feature decomposition layer combination is determined as the second optimal feature decomposition layer combination, and each updated feature decomposition layer combination is updated and iteratively trained using the second optimal feature decomposition layer combination based on the preset particle update algorithm, until the second preset round of iterative training is completed, and the feature decomposition layer number of the final iterative feature decomposition layer combination with the smallest loss value among the feature decomposition layer combinations after the final iteration is determined as the optimal feature decomposition layer number, and the final iterative feature decomposition layer combinations include the final iterative feature decomposition layer combination, and the updated feature decomposition layer combinations include the updated feature decomposition layer combination.

4. The method according to claim 3, characterized in that The wheel hub defect detection model is constructed based on the feature extraction module, the multi-scale feature decomposition module, and the feature fusion module and the regressor module based on the spatial attention mechanism, including: Constructing the multi-scale feature decomposition module based on the multi-scale feature decomposition layer and the maximum pooling layer, wherein the multi-scale feature decomposition layer includes a convolution layer, a batch normalization layer, and a ReLU activation function, and the number of the multi-scale feature decomposition layers and the maximum pooling layers included in the multi-scale feature decomposition module is determined according to the optimal number of feature decomposition layers; Constructing the regressor module based on a fully connected neural network; The wheel hub defect detection model is constructed based on the feature extraction module, the multi-scale feature decomposition module, the feature fusion module and the regressor module.

5. The method according to any one of claims 2 to 4, characterized in that: After determining the total loss values ​​respectively corresponding to the optimized wheel hub defect detection models trained in each iteration based on the preset regression loss function, the method includes: Obtaining initial model parameters of the optimized wheel hub defect detection model; Based on the total loss value corresponding to the optimized wheel hub defect detection model after the current iterative training, the initial model parameters are optimized using the Adam optimizer to obtain the first model parameters of the optimized wheel hub defect detection model after the current iterative training, until all the model parameters generated in each iterative training of the first preset round of iterative training are obtained.

6. The method according to claim 5, characterized in that After determining the optimized wheel hub defect detection model after the iteration corresponding to the smallest total loss value among the total loss values ​​respectively corresponding to the optimized wheel hub defect detection models trained in each iteration as the wheel hub defect target detection model, the method includes: The second model parameters of the wheel hub defect target detection model are set based on the first model parameters corresponding to the optimized wheel hub defect detection model after the iteration, and the model parameters generated in each iterative training include the first model parameters and the second model parameters.

7. A device for detecting wheel hub surface defects based on deep learning, characterized in that: include: An acquisition unit, used for acquiring wheel hub image samples containing wheel hub surface information during the production process, and performing data annotation on the wheel hub image samples to obtain a training data set for wheel hub defect detection; A first setting unit is used to set a front-layer network of a VGG19 model pre-trained under a preset large-scale image dataset as a feature extraction module; A construction unit, used to construct a wheel defect detection model based on the feature extraction module, the multi-scale feature decomposition module, and the feature fusion module and the regressor module based on the spatial attention mechanism; A calculation unit, used for calculating the optimal number of feature decomposition layers corresponding to the multi-scale feature decomposition module based on a particle swarm optimization algorithm; An optimization unit, used for optimizing the network structure of the wheel hub defect detection model according to the optimal feature decomposition layer number to obtain an optimized wheel hub defect detection model; A training unit, configured to iteratively train the optimized wheel hub defect detection model based on the training data set, and determine a total loss value corresponding to each of the optimized wheel hub defect detection models for each iterative training based on a preset regression loss function; A determination unit, configured to determine the optimized wheel hub defect detection model after the iteration corresponding to the minimum total loss value among the total loss values ​​respectively corresponding to the optimized wheel hub defect detection models trained in each iteration as the wheel hub defect target detection model; The detection unit is used to perform surface defect detection on the produced wheel hubs based on the wheel hub defect target detection model, so as to timely discover the wheel hubs with surface defects.

8. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-6.

10. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 6.