Light-weight flange forge piece surface defect detection method capable of reducing characteristic redundancy
By reconstructing the lightweight SqueezeNet network, the weight separation redundant reconstruction feature unit and spatial channel reconstruction mechanism is adopted to solve the problem of redundant feature extraction of traditional convolutional neural networks, and realize efficient and low-complexity flange forging surface defect detection.
Patent Information
- Application Number
- CN202510028281.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-08
- Publication Date
- 2025-06-06
AI Technical Summary
Traditional convolutional neural networks have problems with redundant feature extraction in spatial and channel dimensions, resulting in increased computing burden and storage requirements, which cannot meet the needs of modern industry for high precision and high efficiency.
By reconstructing the lightweight SqueezeNet network architecture, the redundant reconstruction feature unit is used to replace the extension layer, the spatial and channel reconstruction mechanism is introduced, the redundant characteristics are reduced, and the model performance is optimized through the combination of RankSortLoss and multiple loss functions.
It effectively reduces the computational complexity and storage requirements of the model, and improves the performance and efficiency of the model, and can achieve efficient computing and high-precision defect detection in scenarios with limited computing resources.
Smart Images

Figure CN120107156A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of computer data analysis, and in particular to a method for detecting surface defects of lightweight flange forgings with reduced feature redundancy. Background Art
[0002] In the field of deep learning, convolutional neural networks are widely used in image classification, target detection, semantic segmentation and other tasks due to their powerful feature extraction capabilities. However, traditional CNNs often have the problem of redundant feature extraction in the spatial and channel dimensions. In the spatial dimension, the convolution kernel of CNN is usually fixed in size and cannot adaptively adjust the shape and size to capture features of different scales and directions. This causes the model to generate a large number of redundant features when processing complex images, increasing the computational burden and storage requirements. In the channel dimension, the convolution layer of CNN usually contains a large number of convolution kernels, each of which is responsible for extracting a specific feature. However, in practical applications, many convolution kernels may extract similar or redundant features, which not only reduces the efficiency of the model, but may also affect the performance of the model. Traditional defect detection methods can no longer meet the needs of modern industry for high precision and high efficiency. Therefore, in order to solve the problem of redundant feature extraction of traditional CNN and the demand for lightweight defect detection technology of flange forgings, an important means to solve the problem of redundant feature extraction of traditional CNN and meet the needs of efficient and real-time defect detection of flange forgings is proposed. Lightweight defect detection technology will play a more important role in the future. Summary of the invention
[0003] In order to overcome the above-mentioned deficiencies of the prior art, the present invention provides a method for detecting surface defects of lightweight flange forgings with reduced feature redundancy.
[0004] The technical solution adopted by the present invention is: a method for detecting surface defects of lightweight flange forgings with reduced feature redundancy, comprising the following steps:
[0005] S1. Collect the surface defect image of the flange forging, connect the Nano genle camera with a microscope, and use the Nano genle camera to collect the surface image of the flange forging observed under the microscope;
[0006] S2. Obtain and mark the surface defect labels of flange forgings;
[0007] S3, sorting the flange forging surface defect data set, making an index file of the data set, and using the image and the index file as corresponding input training of the deep neural network;
[0008] S4, reconstruct the lightweight SqueezeNet network architecture, adopt weight separation redundant reconstruction feature units for the network layer, perform feature reconstruction to reduce redundant features;
[0009] S5. Input the feature map with detailed texture information into the lightweight SqueezeNet network and improve the efficiency by adjusting the network structure.
[0010] The core of the SqueezeNet network is the Fire module, which consists of two layers, namely the squeeze layer and the expansion layer. The weight separation redundant reconstruction feature unit is used to replace the expansion layer, which can reduce the computational cost and model storage, and improve the performance of the model by reducing the spatial and channel redundancy that is widely present in standard convolution.
[0011] The squeeze layer uses 1x1 convolution instead of 3x3 convolution, and compresses the number of channels of the input feature map through 1x1 convolution, thereby reducing the number of input channels of the subsequent 3x3 convolution, thereby reducing the amount of calculation.
[0012] After the squeeze layer, dimension expansion is performed and the weight separation redundant reconstruction feature unit is input, which consists of two units, the spatial reconstruction unit and the channel reconstruction unit, which are placed in a serial order;
[0013] S6. For the intermediate input features in the bottleneck residual block, the spatial refinement features are first obtained by the spatial reconstruction unit, and then the channel refinement features are obtained by the channel reconstruction unit operation;
[0014] S7. For the spatial reconstruction unit, set the number of output channels, the number of groups (group_num: set to 16), the gate threshold (gate_treshold), design the bottleneck residual block and create the sigmoid activation function. The bottleneck residual calculation of the input feature map introduces the number of groups, applies group batch normalization, obtains the normalized deep features, and uses them as input to calculate the gamma weight. The calculation method is as follows:
[0015]
[0016] Among them, x is the input feature data, represents the mean of the input data x, is the variance of the input data x, and ε is 1 e-5 , γ and β are learnable parameters, which control the relative importance of positive and negative features, respectively, and are used to adjust the coefficients of weights;
[0017] S8. Calculate the feature importance weight w based on the obtained gamma weight reweights , calculated as follows:
[0018]
[0019] S9. Establish a gating mechanism to obtain the gating threshold and feature importance weight. When the importance weight is greater than or equal to the gating threshold, it is marked as an information gating mask, otherwise it is marked as a non-information gating mask. The information gating mask is multiplied by the input feature to obtain the feature The non-informative gated mask is multiplied by the input feature to obtain the feature
[0020] S10, split features for Two parts, split features for The four parts are reconstructed and connected. The reconstruction method is to and Fusion is performed for lateral compression to obtain feature X W1 , and Fusion is performed for lateral compression to obtain feature X W2 , and then fuse again to obtain the spatial refinement features;
[0021] S11. In order to utilize the channel redundancy of features, a channel reconstruction unit is introduced. Using the split-conversion-fusion strategy, for the channel reconstruction unit, the split index alpha is set to 1 / 2. The spatial reconstruction features are split into upper-layer features and lower-layer features using the split index. The lower-layer features are redundantly separated using the conversion strategy to obtain the redundant information features corresponding to the key information features and the spatial content.
[0022] The specific process of the conversion strategy is to use two layers of convolution calculation on the upper layer features, and fuse the results of the two convolution operations to obtain the upper layer conversion feature Y 1 , the lower layer features are calculated by a layer of convolution, the convolution calculation results are spliced with the spatial reconstruction features, and the number of feature channels is restored by lateral compression to obtain the lower layer transformation feature Y2;
[0023] S12, concatenate upper layer transformation features Y 1 and the underlying transformation feature Y 2 , the concatenated features are first calculated using adaptive average pooling, and then input into the softmax function to obtain the redundant weight coefficient and multiply it with the concatenated features to obtain the channel refinement features;
[0024] S13, SqueezeNet uses global average pooling at the last layer to integrate the global information of the feature map into a fixed-size output, uses RankSortLoss as the classification loss, and introduces the total loss function L ATSS , including the sum of sorting loss, intersection loss and cross entropy loss to replace the original softmax function,
[0025] LATSS =λ box L DIoU +λ ctr L ctr +L LRS
[0026] Among them, L DIOU represents the intersection-over-union loss, L ctr represents the cross entropy loss, which is used to supervise the centrality prediction, L LRS represents the sorting loss, and the task-level balancing coefficient λ box =2, set to a constant scalar, λ ctr =1 represents a constant;
[0027] S14. Set the learning parameters, batch_size is 32, the learning rate is 0.0001, and the weight decay parameter is 0.0001. By introducing the weight decay term, the weight of the model can be regularized to prevent overfitting.
[0028] S15, input the defect image, train it through the reconstructed lightweight network, select the optimal defect detection model according to the feedback value of the loss function, and load the model to perform defect detection on the surface of the flange forging;
[0029] Further, in S1, the surface defects of the flange forging include plaques, cracks, pitting surfaces and scratches;
[0030] Furthermore, in S3, before the flange forging surface defect dataset image is input into the network, a convolution layer is used to capture high-level features, and 96 convolution kernels with a size of 7×7 and a stride of 2 are used to gradually extract detail texture information, and the feature map with detail texture information is input into the lightweight SqueezeNet network;
[0031] Furthermore, the intersection-over-intersection loss L DIOU That is, the loss of the bounding box. The center point of the defect sample is set using an anchor box of 116x90 size. The intersection area between the real box and the predicted box is calculated to calculate the intersection-union ratio.
[0032]
[0033] Among them, b represents the center point of the predicted box, bgt represents the center point of the real box, c represents the diagonal length of the smallest rectangle containing these two boxes, and ρ 2 (b,b gt ) represents the Euclidean distance between two center points;
[0034] Furthermore, the cross entropy loss calculation formula is as follows:
[0035]
[0036] Among them, x i Represents the i-th element of the true label, y i It indicates the probability that the model predicts that x belongs to the i-th category, and I indicates the fixed-size input dimension;
[0037] Furthermore, the sorting loss L LRS The calculation steps are:
[0038] The first step is to give the logic S to mark the fixed-size output i , that is, the fixed-size output starts with labeling 0, with a total of i-1 labeling bits,
[0039] The second step is to calculate the difference conversion component, through the logic S i and S j Get the difference component value X i,j , according to the source sample example X i,j The difference component value is used to distinguish the main items. The difference item obtained by each pair of samples can be expressed as a basic item L i,j ,
[0040]
[0041] Where P(j|i) is the probability mass fraction of l(i), and the error is calculated on i∈P, on j∈N, where N is the set of negative samples, and the output relationship between i and j is determined by a non-differentiable function H(x). When x≥0, H(x)=1, when x<0, H(x)=0,
[0042] Step 3, L i,j is calculated as the normalized sum of the principal terms L LRS =∑ i∈P ∑ j∈N L i,j .
[0043] Beneficial effects of the invention:
[0044] A microscope is connected to the Nano genle camera module, and the surface image of the flange forging observed under the microscope is captured using the Nano genle camera to obtain high-quality defect images and extract features of defects in the enlarged sample. This is used as a data set for model training, which can greatly improve the model training effect.
[0045] During the reconstruction process, the computational complexity of SqueezeNet can be further reduced by reducing redundant convolutional layers and optimizing the size of convolution kernels. The collaborative work of spatial reconstruction and channel reconstruction effectively reduces the redundant features in the network parameters, and can provide a lightweight model design strategy that balances performance and efficiency. Among them, spatial reconstruction separates redundant features according to weights and reconstructs them to suppress redundancy in the spatial dimension and enhance the representation ability of features. Channel reconstruction uses split transformation and fusion strategies to reduce redundancy in the channel dimension as well as computational cost and storage.
[0046] RankSortLoss does not require additional auxiliary heads, simplifies the network structure, and reduces the complexity of the model. Due to its sorting-based nature, RankSortLoss is robust to class imbalance problems, which helps balance samples of different categories during training. Multiple loss definitions can complement each other and jointly improve the performance of neural networks. This combination helps achieve higher accuracy and robustness in object detection tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 A schematic flow chart of a method for detecting surface defects of lightweight flange forgings with reduced feature redundancy provided by the present invention.
[0048] Figure 2 A schematic diagram of a weight separation redundant reconstruction feature space reconstruction unit process for a lightweight flange forging surface defect detection method that reduces feature redundancy provided by the present invention.
[0049] Figure 3 A schematic diagram of a weight separation redundant reconstruction feature channel reconstruction unit process for a lightweight flange forging surface defect detection method that reduces feature redundancy provided by the present invention.
[0050] Figure 4 A schematic diagram of the intersection-over-union ratio loss function of a surface defect detection method for lightweight flange forgings that reduces feature redundancy provided by the present invention. DETAILED DESCRIPTION
[0051] In order to more clearly understand the technical solution of the present invention, the present invention is further described below in conjunction with the accompanying drawings;
[0052] like Figure 1-Figure 4 As shown, a method for detecting surface defects of lightweight flange forgings with reduced feature redundancy comprises the following steps:
[0053] Select the flange forging, place it on the microscope stage, adjust the magnification, and clearly see the surface contour of the forging. Rotate different parts to observe different types of defect parts. Use Nano genle camera to obtain high-quality flange forging surface defect images, namely:
[0054] S1. Collect the surface defect images of flange forgings. Connect the Nano genle camera with a microscope and use the Nano genle camera to collect the surface images of flange forgings observed under the microscope, so as to obtain high-quality surface defect images of flange forgings.
[0055] Label the acquired images with defects, sort the surface defect data sets of the same type, create an index file for the data set, and use the images with defects and the corresponding index files as input, that is:
[0056] S2. Obtain and mark the surface defect labels of flange forgings;
[0057] S3, sorting the flange forging surface defect data set, creating an index file of the data set, and using the image and the index file as input training for the deep neural network;
[0058] Reconstructing the SqueezeNet network and replacing the extended layer with weight-separated redundant reconstruction feature units can reduce computational costs and model storage, while improving the performance of the model by reducing the spatial and channel redundancy that is widely present in standard convolutions, namely:
[0059] S4. Reconstruct the lightweight SqueezeNet network architecture, adopt weight separation to reconstruct the feature units of the network layer, and reconstruct the features to reduce the redundant features to obtain better performance, and significantly reduce the complexity and computational cost;
[0060] S5. Input the feature map with detailed texture information into the lightweight SqueezeNet network, and improve the efficiency by adjusting the network structure;
[0061] The core of the SqueezeNet network is the Fire module, which consists of two layers, namely the squeeze layer and the expansion layer. The weight separation redundant reconstruction feature unit is used to replace the expansion layer, which can reduce the computational cost and model storage, and improve the performance of the model by reducing the spatial and channel redundancy that is widely present in standard convolution.
[0062] The squeeze layer uses 1x1 convolution instead of 3x3 convolution, and compresses the number of channels of the input feature map through 1x1 convolution, thereby reducing the number of input channels of the subsequent 3x3 convolution, thereby reducing the amount of calculation.
[0063] After the squeeze layer, dimension expansion is performed and the input weight separation redundant reconstruction feature unit is used, which consists of two units, the spatial reconstruction unit and the channel reconstruction unit, which are placed in a sequential manner;
[0064] The squeeze layer uses 1x1 convolution instead of 3x3 convolution, and compresses the number of channels of the input feature map through 1x1 convolution, thereby reducing the number of input channels of the subsequent 3x3 convolution, thereby reducing the amount of calculation;
[0065] After the squeeze layer, dimension expansion is performed and the input weight separation redundant reconstruction feature unit is used, which consists of two units, the spatial reconstruction unit and the channel reconstruction unit, which are placed in a sequential manner;
[0066] S6. For the intermediate input features in the bottleneck residual block, the spatial reconstruction unit is used to obtain the spatial refinement features, and then the channel reconstruction unit is used to obtain the channel refinement features. The spatial redundancy and channel redundancy between the features are used to reduce the redundancy between the intermediate feature maps and enhance the feature representation of the SqueezeNet network.
[0067] In order to utilize the spatial redundancy of features, a spatial reconstruction unit is introduced, which utilizes separation and reconstruction operations. The purpose of the separation operation is to separate the feature map with rich information from the feature map with less information corresponding to the spatial content.
[0068] S7. For the spatial reconstruction unit, set the number of output channels, the number of groups (group_num: set to 16), the gate threshold (gate_treshold), design the bottleneck residual block and create the sigmoid activation function. The bottleneck residual calculation of the input feature map introduces the number of groups, applies group batch normalization, obtains the normalized deep features, and uses them as input to calculate the gamma weight. The calculation method is as follows:
[0069]
[0070] Among them, x is the input feature data. represents the mean of the input data x, is the variance of the input data x, and ε is 1 e-5 , γ and β are learnable parameters, which control the relative importance of positive and negative features, respectively, and are used to adjust the coefficients of weights;
[0071] S8. Calculate the feature importance weight w based on the obtained gamma weight reweights , calculated as follows:
[0072]
[0073] S9. Establish a gating mechanism to obtain the gating threshold and feature importance weight. When the importance weight is greater than or equal to the gating threshold, it is marked as an information gating mask, otherwise it is marked as a non-information gating mask. The information gating mask is multiplied by the input feature to obtain the feature The non-informative gated mask is multiplied by the input feature to obtain the feature
[0074] S10, split features for Two parts, split features for The four parts are reconstructed and connected. The reconstruction method is to and Fusion and lateral compression to obtain feature X W1 , and Fusion is performed for lateral compression to obtain feature X W2 , and then fuse again to obtain the spatial refinement features;
[0075] S11. In order to utilize the channel redundancy of features, a channel reconstruction unit is introduced. Using the split-conversion-fusion strategy, for the channel reconstruction unit, the split index alpha is set to 1 / 2. The spatial reconstruction features are split into upper-layer features and lower-layer features using the split index. The lower-layer features are redundantly separated using the conversion strategy to obtain the redundant information features corresponding to the key information features and the spatial content.
[0076] The specific process of the transformation strategy is to use two layers of convolution calculation on the upper layer features, fuse the results of the two convolution operations, and obtain the upper layer transformation feature Y 1 , the lower layer features are calculated by a layer of convolution, the convolution calculation results are spliced with the spatial reconstruction features, and the number of feature channels is restored by lateral compression to obtain the lower layer transformation feature Y 2 ;
[0077] S12, concatenate upper layer transformation features Y 1 and the underlying transformation feature Y 2 , the concatenated features are first calculated using adaptive average pooling, and then input into the softmax function to obtain the redundant weight coefficient and multiply it with the concatenated features to obtain the channel refinement features;
[0078] At the end, global average pooling is used to integrate the global information of the feature map into a fixed-size output. RankSortLoss is used as the classification loss, and the total loss function is induced, including the sum of the sorting loss, intersection loss and cross entropy loss to constrain the model, that is:
[0079] S13, SqueezeNet uses global average pooling at the last layer to integrate the global information of the feature map into a fixed-size output, uses RankSortLoss as the classification loss, and introduces the total loss function L ATSS , including the sum of sorting loss, intersection loss and cross entropy loss to replace the original softmax function,
[0080] L ATSS =λbox L DIOU +λ ctr L ctr +L LRS
[0081] Among them, L DIOU represents the intersection-over-union loss, L ctr represents the cross entropy loss, which is used to supervise the centrality prediction, L LRS represents the sorting loss, and the task-level balancing coefficient λ box =2, set to a constant scalar, λ ctr =1 represents a constant;
[0082] Adjust the model learning parameters, set the batch_size, input the image to be detected, train it through the reconstructed lightweight network, and select the optimal defect model according to the feedback value of the loss function, that is:
[0083] S14. Set the learning parameters, batch_size is 32, the learning rate is 0.0001, and the weight decay parameter is 0.0001. By introducing the weight decay term, the weight of the model can be regularized to prevent overfitting.
[0084] S15. Input the defect image, train it through the reconstructed lightweight network, select the optimal defect detection model according to the feedback value of the loss function, and load the model to perform defect detection on the surface of the flange forging.
[0085] Specifically, the surface defects of the flange forging include plaques, cracks, pitting surfaces and scratches.
[0086] Specifically, the intersection-over-intersection loss L DIOU That is, the loss of the bounding box. The center point of the defect sample is set using an anchor box of 116x90 size. The intersection area between the real box and the predicted box is calculated to calculate the intersection-union ratio.
[0087]
[0088] Among them, b represents the center point of the predicted box, bgt represents the center point of the real box, c represents the diagonal length of the smallest rectangle containing these two boxes, and ρ 2 (b,b gt ) represents the Euclidean distance between two center points.
[0089] Specifically, the cross entropy loss calculation formula is as follows:
[0090]
[0091] Among them, x i Represents the i-th element of the true label, y iIt represents the probability that the model predicts that x belongs to the i-th category, and I represents the fixed-size input dimension.
[0092] Specifically, the sorting loss L LRS The calculation steps are:
[0093] The first step is to give the logic S to mark the fixed-size output i , that is, the fixed-size output starts with labeling 0, with a total of i-1 labeling bits,
[0094] The second step is to calculate the difference conversion component, through the logic S i and S j Get the difference component value X i,j , according to the source sample example X i,j The difference component value is used to distinguish the main items. The difference item obtained by each pair of samples can be expressed as a basic item L i,j ,
[0095]
[0096] Where P(j|i) is the probability mass fraction of l(i), and the error is calculated on i∈P, on j∈N, where N is the set of negative samples, and the output relationship between i and j is determined by a non-differentiable function H(x). When x≥0, H(x)=1, when x<0, H(x)=0,
[0097] Step 3, L i,j is calculated as the normalized sum of the principal terms L LRS =∑ i∈P ∑ j∈N L i,j .
[0098] This invention solves the redundant feature extraction problem of traditional convolutional neural networks in terms of space and channel dimensions. By introducing space and channel reconstruction mechanisms, the convolution kernel can adaptively adjust its shape and size to better adapt to different tasks and data sets.
[0099] RankSortLoss does not require additional auxiliary heads, simplifies the network structure, and reduces the complexity of the model. DIoU loss directly measures the overlap between the predicted box and the true box, which helps to optimize the positioning accuracy of the model. The cross entropy loss function can handle multi-classification problems well and optimize the model by measuring the classification error of each category;
[0100] The reconstructed design of SqueezeNet gives it a great advantage in scenarios with limited computing resources. By adopting special modules and channel squeezing methods, the number of parameters and computational complexity are reduced, thus achieving efficient operation.
[0101] The above description is only a preferred embodiment of the present invention, so all equivalent changes or modifications made according to the structure, characteristics and principles described in the scope of the patent application of the present invention are included in the scope of the patent application of the present invention.
Claims
1. A method for detecting surface defects of lightweight flange forgings with reduced feature redundancy, characterized in that: The following steps are involved: S1. Collect the surface defect image of the flange forging, connect the Nano genle camera with a microscope, and use the Nano genle camera to collect the surface image of the flange forging observed under the microscope; S2. Obtain and mark the surface defect labels of flange forgings; S3, sorting the flange forging surface defect data set, making an index file of the data set, and using the image and the index file as corresponding input training of the deep neural network; S4, reconstruct the lightweight SqueezeNet network architecture, adopt weight separation redundant reconstruction feature units for the network layer, perform feature reconstruction to reduce redundant features; S5. Input the feature map with detailed texture information into the lightweight SqueezeNet network and improve the efficiency by adjusting the network structure. The core of the SqueezeNet network is the Fire module, which consists of two layers, namely the squeeze layer and the expansion layer. The weight separation redundant reconstruction feature unit is used to replace the expansion layer, which can reduce the computational cost and model storage, and improve the performance of the model by reducing the spatial and channel redundancy that is widely present in standard convolution. The squeeze layer uses 1x1 convolution instead of 3x3 convolution, and compresses the number of channels of the input feature map through 1x1 convolution, thereby reducing the number of input channels of the subsequent 3x3 convolution, thereby reducing the amount of calculation. After the squeeze layer, dimension expansion is performed and the weight separation redundant reconstruction feature unit is input, which consists of two units, the spatial reconstruction unit and the channel reconstruction unit, which are placed in a serial order; S6. For the intermediate input features in the bottleneck residual block, the spatial refinement features are first obtained by the spatial reconstruction unit, and then the channel refinement features are obtained by the channel reconstruction unit operation; S7. For the spatial reconstruction unit, set the number of output channels, the number of groups group_num: set to 16, the gate threshold gate_treshold, design the bottleneck residual block and create the sigmoid activation function, perform bottleneck residual calculation on the input feature map, introduce the number of groups, apply group batch normalization, obtain the normalized deep features, and use them as input to calculate the gamma weight. The calculation method is as follows: Among them, x is the input feature data, represents the mean of the input data x, is the variance of the input data x, and ε is e e-5 , γ and β are learnable parameters, which control the relative importance of positive and negative features, respectively, and are used to adjust the coefficients of weights; S8. Calculate the feature importance weight w based on the obtained gamma weight reweights , calculated as follows: S9. Establish a gating mechanism to obtain the gating threshold and feature importance weight. When the importance weight is greater than or equal to the gating threshold, it is marked as an information gating mask, otherwise it is marked as a non-information gating mask, so that the information gating mask is multiplied by the input feature to obtain the feature The non-informative gated mask is multiplied by the input feature to obtain the feature S10, split features for Two parts, split features for The four parts are reconstructed and connected. The reconstruction method is to and Fusion is performed for lateral compression to obtain feature X W1 , and Fusion is performed for lateral compression to obtain feature X W2 , and then fuse again to obtain the spatial refinement features; S11. In order to utilize the channel redundancy of features, a channel reconstruction unit is introduced. Using the split-conversion-fusion strategy, for the channel reconstruction unit, the split index alpha is set to 1 / 2. The spatial reconstruction features are split into upper-layer features and lower-layer features using the split index. The lower-layer features are redundantly separated using the conversion strategy to obtain the redundant information features corresponding to the key information features and the spatial content. The specific process of the conversion strategy is to use two layers of convolution calculation on the upper layer features, fuse the results of the two convolution operations, and obtain the upper layer conversion feature Y1. The lower layer features are calculated by one layer of convolution, and the convolution calculation results are spliced with the spatial reconstruction features. After performing lateral compression to restore the number of feature channels, the lower layer conversion feature Y2 is obtained. S12, concatenate the upper layer conversion feature Y1 and the lower layer conversion feature Y2, first calculate the concatenated features using adaptive average pooling, then input them into the softmax function to obtain the redundant weight coefficient and multiply it by the concatenated features to obtain the channel refinement features; S13, SqueezeNet uses global average pooling at the last layer to integrate the global information of the feature map into a fixed-size output, uses RankSortLoss as the classification loss, and introduces the total loss function L ATSS , including the sum of sorting loss, intersection loss and cross entropy loss to replace the original softmax function, L ATSS =λ box L DIOU +λ ctr L ctr +L LRS Among them, L DIOU represents the intersection-over-union loss, L ctr represents the cross entropy loss, which is used to supervise the centrality prediction, L LRS represents the sorting loss, and the task-level balancing coefficient λ box =2, set to a constant scalar, λ ctr =1 represents a constant; S14. Set the learning parameters, batch_size is 32, learning rate is 0.0001, and weight decay parameter is 0.0001. By introducing the weight decay term, the weight of the model can be regularized to prevent overfitting. S15. Input the defect image, train it through the reconstructed lightweight network, select the optimal defect detection model according to the feedback value of the loss function, and load the model to perform defect detection on the surface of the flange forging.
2. A method for detecting surface defects of lightweight flange forgings with reduced feature redundancy according to claim 1, characterized in that: In S1, the surface defects of the flange forging include plaques, cracks, pitting surfaces and scratches.
3. A method for detecting surface defects of lightweight flange forgings with reduced feature redundancy according to claim 1, characterized in that: In S3, before the flange forging surface defect dataset image is input into the network, a convolution layer is used to capture high-level features, and 96 convolution kernels with a size of 7×7 and a stride of 2 are used to gradually extract detailed texture information, and the feature map with detailed texture information is input into the lightweight SqueezeNet network.
4. A method for detecting surface defects of lightweight flange forgings with reduced feature redundancy according to claim 1, characterized in that: The intersection-and-join ratio loss L DIOU That is, the loss of the bounding box. The center point of the defect sample is set using an anchor box of 116×90 size. The intersection area between the real box and the predicted box is calculated to calculate the intersection-union ratio. Among them, b represents the center point of the prediction box, b gt represents the center point of the true box, c represents the diagonal length of the smallest rectangle containing the two boxes, ρ 2 (b,b gt ) represents the Euclidean distance between two center points.
5. The method for detecting surface defects of lightweight flange forgings with reduced feature redundancy according to claim 1, characterized in that: The cross entropy loss calculation formula is as follows: Among them, x i Represents the i-th element of the true label, y i It represents the probability that the model predicts that x belongs to the i-th category, and I represents the fixed-size input dimension.
6. A method for detecting surface defects of lightweight flange forgings with reduced feature redundancy according to claim 1, characterized in that: The ranking loss L LRS The calculation steps are: The first step is to give the logic S to mark the fixed-size output i , that is, the fixed-size output starts with labeling 0, with a total of i-1 labeling bits, The second step is to calculate the difference conversion component, through the logic S i and S j Get the difference component value X i,j , according to the source sample example X i,j The difference component value is used to distinguish the main items. The difference item obtained by each pair of samples can be expressed as a basic item L i,j , Where P(j|i) is The probability mass score is calculated on i∈P, and the error is calculated on j∈N, where N is the set of negative samples. The output relationship between i and j needs to be determined by a non-differentiable function H(x). When x≥0, H(x)=1, when x<0, H(x)=0, Step 3, L i,j is calculated as the normalized sum of the principal terms L LRS =∑ i∈P ∑ j∈N L i,j .