A method, system and storage medium for detecting small scratches on aluminum surface

By constructing a network model in aluminum surface detection, using sparse sampling and semantic information modulation technology to adaptively select foreground and background feature points, the problem of low accuracy in fine scratch detection is solved and more efficient aluminum surface defect detection is achieved.

CN118096680BActive Publication Date: 2024-10-22SICHUAN YITIAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410200988.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-02-23
Publication Date
2024-10-22
Estimated Expiration
2044-02-23

AI Technical Summary

Technical Problem

Existing deep learning-based aluminum surface scratch detection methods have the problem of false detection and missed detection in the detection of small scratches, and it is difficult to fully fit the long and narrow shape characteristics of scratches, resulting in low detection accuracy.

Method used

By building a network model, the backbone network is used to extract multi-scale hierarchical feature information, and sparse sampling and semantic information modulation are performed in the foreground distribution sensing module, adaptively selecting foreground and background feature points, generating sparse sampling maps, and enhancing the model's ability to detect fine-grained features. expression ability and improve detection accuracy.

Benefits of technology

It significantly improves the model's detection accuracy of small scratch defects, reduces false detections and missed detections, enhances the model's target expression ability, and can more accurately identify small scratches on the surface of aluminum materials.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118096680B_ABST
    Figure CN118096680B_ABST
Patent Text Reader

Abstract

The present invention discloses a defect detection method, system and storage medium for fine scratches on the surface of aluminum materials. The backbone network is used to extract multi-scale hierarchical feature information of an image and output a multi-level feature map. For the feature map, sparse sampling is performed based on the loss cost to generate a sparse sampling map. The sparse sampling map is multiplied with the high-level feature map, and then fused with the low-level feature map modulated by the semantic information of the high-level feature map. The feature blocks are segmented and input into an encoder to add positioning information. The feature information is decoded using a decoder, and a predicted positioning bounding box and target category are output. Defects on the surface of aluminum materials are detected based on the trained network model. The present invention focuses on foreground features, so that the model learning attention is more focused on the pixel points where small targets are located, gradually introduces fine-grained features, and enhances the target expression ability of the model, thereby improving the model's detection accuracy for fine scratch defects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of defect detection, and in particular relates to a defect detection method, system and storage medium for fine scratches on the surface of aluminum material. Background Art

[0002] As my country's national strength gradually increases, the types of industrial products continue to increase, and various aluminum products appear in people's lives. Aluminum is light in texture, high in strength, and low in production cost, so the manufacturing industry tends to use aluminum as a basic material, such as industrial parts, electronic product housings, window frames, etc., to promote the development of industrial lightweight products and improve the environmental protection level of products. However, due to the traditional production process and processing methods, scratches, bumps, gravure and other defects will appear on the surface of aluminum. The degree of defects on the surface of aluminum is one of the criteria for judging its quality. How to improve the defect detection technology of aluminum is one of the hot issues in the current manufacturing industry research.

[0003] At present, the methods for detecting scratches on aluminum surfaces can be roughly divided into three categories:

[0004] ① Manual inspection: Using human eyes to identify and judge the surface defects of aluminum materials has high labor costs and the subjective factors of inspectors are relatively large.

[0005] ② Single mechanism identification: Use optical, electromagnetic or acoustic components to collect electrical or magnetic signals, and then process these signals to detect defects, such as laser scanning detection and infrared detection. This method has high external equipment procurement costs and is limited in its use scenarios, so it has not been promoted in the manufacturing industry.

[0006] ③Method based on machine recognition: Deep learning technology can be used to extract target features with high quality and better fit the target. It has obvious advantages in accuracy and speed, and its performance is more stable in complex application environments. This method uses an image collector to collect surface images of aluminum materials and transmits them to computer processing equipment for positioning and classification calculations.

[0007] However, most of the current deep learning-based defect detection methods still have some problems in the scratch detection task: the scratch target is small and its features are not obvious compared with the large background. The model ignores the feature extraction of such small targets in multiple downsampling. In addition, the existing methods cannot fully fit the narrow and long appearance characteristics of scratches, resulting in many false detections and missed detections. Therefore, there is an urgent need for a method to adaptively distinguish the foreground and background during the model learning process to solve the problem of difficult scratch feature extraction. Summary of the invention

[0008] The purpose of the present invention is to provide a defect detection method, system and storage medium for fine scratches on the surface of aluminum materials, aiming to solve the above-mentioned problems. The present invention utilizes the correlation between feature information to improve the quality of foreground features and enhance the target expression ability of the model. By focusing on foreground features, the present invention makes the model learning attention more focused on the pixel points where the fine targets are located, gradually introduces fine-grained features, and enhances the target expression ability of the model, thereby improving the detection accuracy of the model for fine scratch defects and having good practicality.

[0009] The present invention is mainly achieved through the following technical solutions:

[0010] A defect detection method for fine scratches on the surface of aluminum material comprises the following steps:

[0011] Step S1: Collect image data of the aluminum surface, and mark the scratch position labels and category labels to obtain a training set;

[0012] Step S2: construct a network model and use the training set to train the network model;

[0013] Step S21: extracting multi-scale hierarchical feature information of the image using the backbone network, and outputting multi-level feature maps;

[0014] Step S22: for the feature map, sparse sampling is performed based on the loss cost, foreground and background selection is adaptively performed on the feature points, target correlation screening is achieved, foreground feature points are located, and a sparse sampling map is generated;

[0015] Step S23: Then, the sparse sampling map is multiplied with the high-level feature map, and then fused with the low-level feature map modulated by the semantic information of the high-level feature map, and finally the feature block is segmented;

[0016] Step S24: input the segmented feature blocks into the encoder to add positioning information to increase the granularity of the feature information;

[0017] Step S25: Use the decoder to decode the feature information and output the predicted positioning bounding box and target category;

[0018] Step S3: Detecting defects on the surface of the aluminum material based on the trained network model.

[0019] In order to better implement the present invention, further, step S22 includes the following steps:

[0020] Step A1: input feature map;

[0021] Step A2: Select feature points that fall within the true bounding box on the feature map and use them as candidate positive sample points;

[0022] Step A3: Then use the k-means algorithm to cluster the clusters, and then calculate the number of center point cluster objects k;

[0023] Step A4: Calculate the Euclidean distance between each feature point and the center point of the bounding box, and select the first k points with the closest distance as the optimal candidate positive sample points;

[0024] Step A5: Calculate the loss cost between the optimal candidate positive sample point and the true bounding box, and optimize the loss cost;

[0025] Step A6: Repeat steps A1 to A5 as the model is trained, and adaptively fit the global optimal set of candidate positive sample points with the lowest loss cost.

[0026] In order to better implement the present invention, further, the loss cost includes a cross entropy loss function and a KL divergence, and the calculation formula is as follows:

[0027] L c =D KL +H cls

[0028]

[0029]

[0030] in:

[0031] L c represents the loss cost value,

[0032] D KL represents the KL divergence,

[0033] H cls represents the cross entropy loss function,

[0034] represents the true distribution probability of the sample points,

[0035] represents the predicted distribution probability of the sample point,

[0036] N represents the number of sample points,

[0037] y i,j Represents the label value, where the label value of the candidate positive sample point is 1, and the label value of the negative sample point is the minimum value on the feature map.

[0038] In order to better implement the present invention, further, the total loss function of the network model includes a calculation function of the loss cost and a position regression loss function and a classification loss function used in the decoder; the calculation function of the loss cost includes a classification loss function and a KL divergence.

[0039] The present invention is mainly achieved through the following technical solutions:

[0040] A defect detection system for fine scratches on the surface of aluminum material, based on the above-mentioned defect detection method, comprises an image processing module, a model training module and a defect detection module; the image processing module is used to obtain an image of the surface of the aluminum material and generate a training set, the model training module is used to train a network model using the training set, and the defect detection module is used to input the image to be detected into the trained network model and output the defect detection result;

[0041] The network model includes a backbone network, a foreground distribution perception module, an encoder and a decoder which are arranged in sequence from front to back; the backbone network is used to extract multi-scale hierarchical feature information of the image and output multi-level feature maps; the foreground distribution perception module includes a plurality of sparse representation extraction modules and a semantic information modulation and fusion module, the semantic information modulation and fusion module is provided with a plurality of modulation branches corresponding to the plurality of sparse representation extraction modules, and the output ends of the plurality of modulation branches are respectively connected to the feature splicing layer; the sparse representation extraction module is used to perform sparse sampling through the loss cost between the candidate positive sample points and the real frame, locate the foreground feature points of the feature map, and generate a sparse sampling map; the modulation branch is used to fuse the input sparse sampling map with the feature map output by the backbone network and extract the foreground feature points, and fuse with the low-level feature map modulated by the semantic information of the high-level feature map to guide the model to tend to learn the foreground features.

[0042] In order to better realize the present invention, further, the modulation branch includes a first feature multiplication layer, a multilayer perceptron, an upsampling layer, a second feature multiplication layer, a feature addition layer, a multilayer perceptron and a convolution combination block arranged in sequence from front to back; the input of the first feature multiplication layer includes a sparse sampling map and a high-level feature map, and the low-level feature map is respectively input into the second feature multiplication layer and the feature addition layer.

[0043] In order to better realize the present invention, further, the backbone network extracts and outputs 4 levels of feature maps f1-f4, the foreground distribution perception module is correspondingly provided with 3 sparse representation extraction modules, the semantic information modulation fusion module is correspondingly provided with a first modulation branch, a second modulation branch and a third modulation branch, the feature maps f2-f4 are respectively connected to the first modulation branch, the second modulation branch and the third modulation branch through the sparse representation extraction module, the second modulation branch and the third modulation branch are respectively connected to the feature splicing layer through the downsampling layer; the high-level feature map and the low-level feature map at the input end of the first modulation branch are feature map f4 and feature map f3, respectively; the high-level feature map and the low-level feature map at the input end of the second modulation branch are feature map f3 and feature map f2, respectively; the high-level feature map and the low-level feature map at the input end of the third modulation branch are feature map f2 and feature map f1, respectively.

[0044] In order to better realize the present invention, further, the backbone network includes a convolution combination block, a batch normalization layer and an activation function layer arranged in sequence from front to back; the encoder includes a transformer block; the decoder includes a multi-head self-attention module, a cross self-attention module and a feedforward network arranged in sequence from front to back, and the output end of the encoder is respectively connected to the multi-head self-attention module and the cross self-attention module.

[0045] In order to better implement the present invention, further, a convolution combination block for segmenting the feature blocks is arranged between the feature concatenation layer and the encoder.

[0046] A computer-readable storage medium stores a computer program, which implements the above-mentioned defect detection method when executed by a processor.

[0047] The beneficial effects of the present invention are as follows:

[0048] (1) The present invention first extracts multi-scale and hierarchical feature information from the backbone network, then inputs the feature information of each level into the foreground distribution perception module, locates the foreground feature points by the sparse representation extraction module, generates a sparse sampling map, and then uses the semantic information modulation fusion module to adjust the fusion, and in order to reduce the subsequent increase in the amount of calculation, the feature map is divided into feature blocks by the convolution combination block; then the feature blocks are input into the encoder to add positioning information, increase the fine-grainedness of the feature information, because the target is small, the recognition probability can be increased only after the fine-grainedness is increased; finally, the decoder is used to decode the feature information, and a variety of attention modules are added to enhance the self-learning ability of the model, make up for the lack of interactive information of feature points in the forward propagation, and output the predicted positioning boundary box and target category after processing. The present invention realizes the subdivision of foreground and background, focuses on foreground features, makes the model learning attention more focused on the pixel points where the small target is located, gradually introduces fine-grained features, enhances the target expression ability of the model, and thus improves the detection accuracy of the model for small scratch defects.

[0049] (2) The present invention adaptively selects foreground background for feature points by optimizing the loss cost value based on the foreground distribution perception module. Preferably, the present invention adopts KL divergence and cross entropy loss function as the loss cost. The KL divergence is responsible for pulling the distribution similarity between the predicted point and the real point, and has scale invariance, which meets the characteristics of the task target; the cross entropy loss function is responsible for evaluating the inconsistency between the predicted point and the real point, which can better optimize the selection of foreground features; through the coordinated cooperation of the two, the target correlation screening is efficiently realized, the model's learning of redundant information is reduced, and the defect detection performance of the model for small scratches is significantly improved, which has good practicality.

[0050] (3) The present invention introduces a clustering method in the foreground distribution perception module to dynamically find the optimal match of foreground feature points for model learning, and this process can become more accurate according to the iterative learning of the model. The sparse representation extraction module uses the clustering method and loss cost to calculate the optimal matching foreground feature point sampling map, that is, the sparse sampling map, and then fuses the sparse sampling map with the original hierarchical feature map through the semantic information modulation fusion module to extract the foreground feature points that need more attention, and uses the high-level feature map to modulate the low-level feature map to enhance the semantic expression ability, thereby guiding the model to tend to learn foreground features and reduce the intrusion of redundant features that reduce accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 A schematic diagram of the overall network structure.

[0052] Figure 2 Compute the flow chart for the sparse representation extraction module.

[0053] Figure 3Schematic diagram of the structure of the semantic information modulation fusion module. DETAILED DESCRIPTION

[0054] Embodiment 1:

[0055] A defect detection method for fine scratches on the surface of aluminum material comprises the following steps:

[0056] 1) Collect image data of the aluminum material surface, manually mark the scratch position labels and category labels, and divide the data set into a training set and a test set;

[0057] 2) A network model is constructed based on the characteristics and distribution of the target data. The overall structure of the network model is mainly composed of a backbone network, a foreground distribution perception module, an encoder and a decoder.

[0058] 3) Train the network model based on the training set: First, use the backbone network to extract multi-scale hierarchical feature information, then use the foreground distribution perception module to process the feature information, filter the foreground and background feature points, and then use the encoder to enhance the granularity of the feature information. Finally, use the decoder to predict the positioning bounding box and target category.

[0059] 4) At the beginning of training, the weight parameters in the model are initialized randomly, the relevant hyperparameters are set, and a suitable optimizer is selected to optimize the loss value. Training is terminated when the number of model training iterations reaches the maximum number of iterations, and the model with the best performance on the test set is selected for deployment.

[0060] Preferably, the foreground distribution perception module is mainly composed of a sparse representation extraction module and a semantic information modulation fusion module. Furthermore, the sparse representation extraction module mainly performs sparse sampling by calculating the loss cost between the candidate positive sample point and the real frame, and the loss cost is composed of the classification loss value and the KL divergence. Guided by the loss cost, the foreground background selection of feature points is adaptively performed, the target relevance screening is efficiently achieved, the model's learning of redundant information is reduced, and the model performance is improved.

[0061] Under the condition of lowest loss cost, the globally optimal set of candidate positive sample points can be adaptively fitted, which can continuously optimize the dynamic allocation effect of positive and negative samples during model training, improve the correlation of foreground feature points, and make the model learning focus on the learning of foreground features.

[0062] Preferably, if Figure 2 As shown, the process of the sparse representation extraction module is as follows:

[0063] (1) First, input the feature map and select candidate positive sample points based on the true bounding box: This module selects feature points that fall within the true bounding box on the feature map as candidate positive sample points.

[0064] (2) Then, the k-means algorithm is used to calculate the number of optimal positive sample point clusters k: the center point of the bounding box, the upper left corner point, the upper right corner point, the lower left corner point, and the lower right corner point are divided into 5 groups for unsupervised clustering, and then the number of center point cluster objects k is calculated.

[0065] (3) Secondly, select the top k candidate positive sample points in terms of Euclidean distance from the candidate positive sample points: calculate the Euclidean distance between each feature point and the center point of the bounding box, and select the top k points with the closest distance as the optimal candidate positive sample points. The label value of the optimal candidate positive sample is 1, and the remaining sample points are negative samples, and their values ​​are the minimum values ​​on the feature map.

[0066] (4) Calculate the loss cost value, and then output the sparse representation sampling graph and the optimized loss cost value respectively. After optimizing the loss cost value, iterative calculation is performed as the model is trained and enter step (1).

[0067] When outputting the sparse representation sampling map, specifically, the generation formula F of the sparse sampling map is as follows:

[0068]

[0069] in:

[0070] (i,j) represents the index of the sample, l represents the index of the level, and GT represents the ground-truth bounding box.

[0071] Preferably, the main processing flow of the semantic information modulation and fusion module is: first, the sparse sampling map output by the sparse representation extraction module is multiplied by the high-level feature map, and then the semantic information of the high-level feature map is used to modulate the low-level feature map for fusion, to supplement the detail information lost due to downsampling, and to enhance the target expression ability of the model, and finally, the feature block is segmented using the convolution combination block to reduce the amount of calculation for the subsequent encoder.

[0072] Preferably, the loss function of the network model is divided into two parts: one is the loss cost calculation function in the foreground distribution perception module; the other is the position regression loss function and classification loss function used in the decoder. Furthermore, the loss cost calculation function is composed of a cross entropy loss function and a KL divergence, and the classification loss function in the decoder is a focal classification loss function, and the position regression loss function is a smooth L1 loss function.

[0073] Preferably, the calculation formula of the loss cost calculation function is as follows:

[0074]

[0075]

[0076] L c =D KL+H cls

[0077] Where D KL is the KL divergence, H cls is the cross entropy loss function, L c is the loss cost value, represents the true distribution probability of the point, represents the predicted distribution probability of the sample point, N refers to the number of sample points, y i,j It represents the label value, which is 1 for candidate positive sample points and the minimum value on the feature map for negative sample points. The loss cost value is optimized as the network is iterated.

[0078] The present invention can segment the foreground background and focus on the foreground features, so that the model learning attention is more focused on the pixel points where small targets are located, gradually introduces fine-grained features, and enhances the target expression ability of the model, thereby improving the model's detection accuracy for small scratch defects and having good practicality.

[0079] Embodiment 2:

[0080] A defect detection system for fine scratches on the surface of aluminum materials, comprising an image processing module, a model training module and a defect detection module; the image processing module is used to obtain an image of the aluminum surface and generate a training set, the model training module is used to train a network model using the training set, and the defect detection module is used to input the image to be detected into the trained network model and output the defect detection result. Figure 1 As shown, a network model is constructed, and defect detection is performed based on the trained network model. The network model is mainly composed of a backbone network, a foreground distribution perception module, an encoder and a decoder. The backbone network is used to extract multi-scale hierarchical feature information of the image and output a multi-level feature map; the foreground distribution perception module is used to screen the foreground and background feature points of the multi-level feature map; the encoder enhances the granularity of the feature information, and the decoder is used to predict the positioning bounding box and the target category.

[0081] Preferably, the network model includes a backbone network, a foreground distribution perception module, an encoder and a decoder which are arranged in sequence from front to back; the backbone network is used to extract multi-scale hierarchical feature information of the image and output multi-level feature maps; the foreground distribution perception module includes a plurality of sparse representation extraction modules and a semantic information modulation fusion module, and the semantic information modulation fusion module is provided with a plurality of modulation branches corresponding to the plurality of sparse representation extraction modules, and the output ends of the plurality of modulation branches are respectively connected to the feature splicing layer.

[0082] Preferably, the sparse representation extraction module is used to perform sparse sampling through the loss cost between the candidate positive sample point and the real frame, adaptively select the foreground background for the feature points, screen the foreground background feature points, locate the foreground feature points, and generate a sparse sampling map. The modulation branch is used to fuse the input sparse sampling map with the feature map output by the backbone network and extract the foreground feature points, and fuse with the low-level feature map modulated by the semantic information of the high-level feature map to guide the model to tend to learn foreground features. The present invention solves the problem that small scratches are easily ignored by designing a foreground distribution perception module.

[0083] Preferably, if Figure 3 As shown, the modulation branch includes a first feature multiplication layer, a multilayer perceptron, an upsampling layer, a second feature multiplication layer, a feature addition layer, a multilayer perceptron, and a convolutional combination block, which are arranged in sequence from front to back. The main processing flow is to first multiply the sparse sampling map output by the sparse representation extraction module with the high-level feature map, and then use the semantic information of the high-level feature map to modulate the low-level feature map for fusion, supplement the detail information lost due to downsampling, enhance the target expression ability of the model, and finally use the convolutional combination block to segment the feature block to reduce the amount of calculation for the subsequent encoder.

[0084] Furthermore, if Figure 1 and Figure 3 As shown, the backbone network extracts and outputs 4 levels of feature maps f1-f4, the foreground distribution perception module is correspondingly provided with 3 sparse representation extraction modules, the semantic information modulation fusion module is correspondingly provided with a first modulation branch, a second modulation branch and a third modulation branch, the feature maps f2-f4 are respectively connected to the first modulation branch, the second modulation branch and the third modulation branch through the sparse representation extraction module, the second modulation branch and the third modulation branch are respectively connected to the feature splicing layer through the downsampling layer; the high-level feature map and the low-level feature map at the input end of the first modulation branch are feature map f4 and feature map f3 respectively; the high-level feature map and the low-level feature map at the input end of the second modulation branch are feature map f3 and feature map f2 respectively; the high-level feature map and the low-level feature map at the input end of the third modulation branch are feature map f2 and feature map f1 respectively.

[0085] Preferably, the backbone network includes a convolutional combination block, a batch normalization layer, and an activation function layer arranged in sequence from front to back; the encoder includes a transformer block; the decoder includes a multi-head self-attention module, a cross self-attention module, and a feedforward network arranged in sequence from front to back, and the output end of the encoder is connected to the multi-head self-attention module and the cross self-attention module respectively. Preferably, if Figure 1As shown, the encoder includes a normalization layer, a multi-head self-attention module, a feature addition layer, a normalization layer and a feedforward network, which are arranged in sequence from front to back. Preferably, the encoder is provided with 3.

[0086] Preferably, the loss function is mainly divided into two parts, one is the loss cost calculation function in the foreground distribution perception module, which is composed of the cross entropy loss function and KL divergence, and the other is the position regression loss function and classification loss function used in the decoder. The other part is specifically composed of the focus classification loss function and the smooth L1 loss function, so the total loss function is as follows:

[0087] L=L cls +L reg +L c

[0088] In the formula, L cls is the classification loss function in the decoder, L reg is the position regression loss function in the decoder, L c is the loss cost value.

[0089] In summary, the scratch defect detection proposed in the present invention introduces loss cost values, subdivides the foreground and background of feature points, enhances the model's learning ability for foreground feature information, focuses on foreground features, gradually introduces fine-grained features, and enhances the model's target expression ability. Experiments show that compared with existing methods, the method proposed in the present invention can adaptively distinguish the foreground and background, solve the problem that small scratches are easily ignored, efficiently detect scratch defects, and promptly report them to staff for processing to avoid losses.

[0090] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any simple modification or equivalent change made to the above embodiment based on the technical essence of the present invention shall fall within the protection scope of the present invention.

Claims

1. A defect detection method for fine scratches on the surface of aluminum materials, It is characterized in that The following steps are involved: Step S1: Collect image data of the aluminum surface, and mark the scratch position labels and category labels to obtain a training set; Step S2: construct a network model and use the training set to train the network model; The network model includes a backbone network, a foreground distribution perception module, an encoder and a decoder which are arranged in sequence from front to back; the foreground distribution perception module includes a plurality of sparse representation extraction modules and a semantic information modulation fusion module, the semantic information modulation fusion module is provided with a plurality of modulation branches corresponding to the plurality of sparse representation extraction modules, and the output ends of the plurality of modulation branches are respectively connected to the feature splicing layer; The sparse representation extraction module is used to perform sparse sampling through the loss cost between the candidate positive sample points and the real frame, locate the foreground feature points on the feature map, and generate a sparse sampling map; The modulation branch is used to fuse the input sparse sampling map with the feature map output by the backbone network and extract foreground feature points, and fuse with the low-level feature map modulated by the semantic information of the high-level feature map to guide the model to tend to learn foreground features; Step S21: extracting multi-scale hierarchical feature information of the image using the backbone network, and outputting multi-level feature maps; Step S22: for the feature map, sparse sampling is performed based on the loss cost between the candidate positive sample points and the true frame, the foreground background is adaptively selected for the feature points, the target correlation screening is achieved, the foreground feature points are located, and the sparse sampling map is generated; Step S23: Then, the sparse sampling map is multiplied with the high-level feature map, and then fused with the low-level feature map modulated by the semantic information of the high-level feature map, and finally the feature block is segmented; Step S24: input the segmented feature blocks into the encoder to add positioning information to increase the granularity of the feature information; Step S25: Use the decoder to decode the feature information and output the predicted positioning bounding box and target category; Step S3: Detecting defects on the surface of the aluminum material based on the trained network model.

2. A method for detecting fine scratches on the surface of aluminum material according to claim 1, It is characterized in that The step S22 comprises the following steps: Step A1: Input feature map; Step A2: Select feature points that fall within the true bounding box on the feature map and use them as candidate positive sample points; Step A3: Then use the k-means algorithm to cluster the clusters, and then calculate the number of center point cluster objects k; Step A4: Calculate the Euclidean distance between each feature point and the center point of the bounding box, and select the first k points with the closest distance as the optimal candidate positive sample points; Step A5: Calculate the loss cost between the optimal candidate positive sample point and the true bounding box, and optimize the loss cost; Step A6: Repeat steps A1 to A5 as the model is trained, and adaptively fit the global optimal set of candidate positive sample points with the lowest loss cost.

3. A method for detecting fine scratches on the surface of aluminum material according to claim 1 or 2, It is characterized in that The loss cost includes the cross entropy loss function and KL divergence, and the calculation formula is as follows: L c =D KL +H cls in: L c represents the loss cost value, D KL represents the KL divergence, H cls represents the cross entropy loss function, represents the true distribution probability of the sample points, represents the predicted distribution probability of the sample point, N represents the number of sample points, y i,j Represents the label value, where the label value of the candidate positive sample point is 1, and the label value of the negative sample point is the minimum value on the feature map.

4. A method for detecting fine scratches on the surface of aluminum material according to claim 1, It is characterized in that The total loss function of the network model includes a loss cost calculation function and a position regression loss function and a classification loss function used in the decoder; the loss cost calculation function includes a classification loss function and a KL divergence.

5. A defect detection system for fine scratches on the surface of aluminum material, based on the defect detection method according to any one of claims 1 to 4, It is characterized in that It includes an image processing module, a model training module and a defect detection module; the image processing module is used to obtain the surface image of the aluminum material and generate a training set, the model training module is used to train the network model using the training set, and the defect detection module is used to input the image to be detected into the trained network model and output the defect detection result.

6. A defect detection system for fine scratches on the surface of aluminum material according to claim 5, It is characterized in that The modulation branch includes a first feature multiplication layer, a multilayer perceptron, an upsampling layer, a second feature multiplication layer, a feature addition layer, a multilayer perceptron and a convolution combination block, which are arranged in sequence from front to back; the input of the first feature multiplication layer includes a sparse sampling map and a high-level feature map, and the low-level feature map is input into the second feature multiplication layer and the feature addition layer respectively.

7. A defect detection system for fine scratches on the surface of aluminum material according to claim 6, It is characterized in that The backbone network extracts and outputs 4-level feature maps f1-f4, the foreground distribution perception module is correspondingly provided with 3 sparse representation extraction modules, the semantic information modulation fusion module is correspondingly provided with a first modulation branch, a second modulation branch and a third modulation branch, the feature maps f2-f4 are respectively connected to the first modulation branch, the second modulation branch and the third modulation branch through the sparse representation extraction module, and the second modulation branch and the third modulation branch are respectively connected to the feature splicing layer through the downsampling layer; The high-level feature map and the low-level feature map at the input end of the first modulation branch are feature map f4 and feature map f3 respectively; the high-level feature map and the low-level feature map at the input end of the second modulation branch are feature map f3 and feature map f2 respectively; The high-level feature map and the low-level feature map at the input end of the third modulation branch are the feature map f2 and the feature map f1 respectively.

8. A defect detection system for fine scratches on the surface of aluminum material according to claim 5, It is characterized in that The backbone network includes a convolution combination block, a batch normalization layer and an activation function layer arranged in sequence from front to back; the encoder includes a transformer block; the decoder includes a multi-head self-attention module, a cross self-attention module and a feedforward network arranged in sequence from front to back, and the output end of the encoder is respectively connected to the multi-head self-attention module and the cross self-attention module.

9. A defect detection system for fine scratches on the surface of aluminum material according to claim 5 or 8, It is characterized in that A convolution combination block for segmenting feature blocks is arranged between the feature concatenation layer and the encoder.

10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the defect detection method described in any one of claims 1 to 4 is implemented.