Aluminum alloy ingot surface defect detection method and system based on RGSC-YOLO

By improving the YOLOv8 model to RGSC-YOLO, using RepConv and ordinary convolution to replace the BottleNeck structure, combining the scaling factor and SPFC module, the low accuracy and inaccurate detection of surface defects of aluminum alloy ingots are solved, and efficient detection effect and lightweight model are achieved.

CN120526221APending Publication Date: 2025-08-22GUIZHOU UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510641643.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-19
Publication Date
2025-08-22

AI Technical Summary

Technical Problem

The existing YOLOv8 method has low detection accuracy and inaccurate detection in the surface defect detection of aluminum alloy ingots, making it difficult to adapt to the diversity and insignificance of surface defects of aluminum alloy ingots.

Method used

Using the RGSC-YOLO detection model, the BottleNeck structure of the YOLOv8 network is replaced by RepConv and ordinary convolution superposition, and the scaling factor and 1×1 convolution operation are introduced to generate redundant feature maps. Multiple convolution operations are applied and shared weights and dynamic fill are used to replace the SPPC block as the SPFC module to enhance feature extraction capabilities.

Benefits of technology

The accuracy of surface defect detection of aluminum alloy ingots and the degree of lightweighting of the model are improved, the computing resource consumption is reduced, and the feature extraction ability and detection accuracy of the model are enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120526221A_ABST
    Figure CN120526221A_ABST
Patent Text Reader

Abstract

The invention provides an aluminum alloy ingot surface defect detection method and system based on RGSC-YOLO, and the method comprises the steps: collecting an aluminum alloy ingot surface image, constructing an image data set, carrying out the preprocessing and marking of the image data set, and dividing the image data set into a training set, a test set and a verification set; an RGSC-YOLO detection model is constructed on the basis of a YOLOv8 model; training, testing and verifying the RGSC-YOLO detection model on the basis of the training set, the test set and the verification set; and performing defect detection on the surface image of the to-be-detected aluminum alloy ingot based on the trained, tested and verified RGSC-YOLO detection model. According to the RGSC-YOLO detection model, the quality detection level of the aluminum alloy ingot can be effectively improved, meanwhile, the floating point operand number and the parameter number of the model are reduced, and the light weight of the model is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of deep learning image processing, and specifically relates to a method and system for detecting surface defects of aluminum alloy ingots based on RGSC-YOLO. Background Art

[0002] Aluminum alloy, as an important metal material, possesses numerous excellent properties and is widely used in fields such as aviation, construction, and electronics. Its production also plays a crucial role in modern industrial production. However, during the actual production of aluminum alloy ingots, factors such as casting temperature, cooling rate, and mold design can cause surface defects such as bubbles, flash, slag inclusions, and burrs. These defects can reduce the uniformity and density of the aluminum alloy material, affecting its strength and toughness, and thus compromising the safety and reliability of subsequent product processing and use. Therefore, surface defect detection of aluminum alloy ingots is of paramount importance.

[0003] Aluminum alloy ingots have a variety of defects, which often exhibit subtle characteristic variations and uneven distribution in images, placing higher demands on the accuracy and robustness of detection algorithms. Therefore, how to improve the YOLO algorithm to meet the needs of aluminum alloy ingot surface defect detection is a problem worthy of in-depth research.

[0004] In an update to the YOLO family of algorithms, YOLOv8 uses a feature pyramid network and a path aggregation network to fuse multi-scale features, enhancing detection capabilities for objects of varying sizes. Advanced data augmentation techniques and training strategies are also employed during training, improving the model's performance and generalization capabilities, making it suitable for target-specific defect detection tasks. However, surface defects in aluminum alloy ingots are characterized by irregularities, unclear features, and high similarity between different types. This results in low detection accuracy and inaccuracy when applied to the basic YOLOv8 method. Summary of the Invention

[0005] In order to solve the problems existing in the prior art, the present invention provides a method and system for detecting surface defects of aluminum alloy ingots based on RGSC-YOLO, aiming to solve the problems of low detection accuracy and inaccurate detection when detecting surface defects of aluminum alloy ingots.

[0006] To achieve the above objectives, the present invention provides the following solution: a method for detecting surface defects of aluminum alloy ingots based on RGSC-YOLO, comprising:

[0007] S1. Collecting surface images of aluminum alloy ingots, constructing an image dataset, preprocessing and annotating the image dataset, and dividing the dataset into a training set, a test set, and a validation set;

[0008] S2. Build the RGSC-YOLO detection model based on the YOLOv8 model;

[0009] S3. Training, testing, and validating the RGSC-YOLO detection model based on the training set, the test set, and the validation set;

[0010] S4. Defect detection is performed on the surface image of the aluminum alloy ingot to be inspected based on the trained, tested and verified RGSC-YOLO detection model.

[0011] Preferably, the step S1 preprocesses and labels the image dataset and divides it into a training set, a test set, and a validation set, including:

[0012] S11, performing preprocessing operations of denoising, filtering, and normalizing on the surface images of the aluminum alloy ingot in the image dataset;

[0013] S12, marking defects on the surface image of the pre-treated aluminum alloy ingot;

[0014] S13. Resize the labeled aluminum alloy ingot surface image and divide it into a training set, a test set, and a validation set in a ratio of 7:2:1.

[0015] Preferably, the S2 constructs an RGSC-YOLO detection model based on the YOLOv8 model, including: using RepConv and ordinary convolution to superimpose the common BottleNeck structure in the C2f module of the YOLOv8 network: using a multi-branch structure during training, including 3×3 convolution, 1×1 convolution and BN layer, expanding the weight of the 1×1 convolution to the form of 3×3 convolution through the padding operation, converting the weight of the BN layer into the form of 3×3 convolution after processing, and adding it to the original 3×3 convolution weight for fusion:

[0016]

[0017] Among them, BN(Conv(x)) is the fused convolution, β and γ are the learnable parameters in the BN layer, σ 2 is the variance, ε is the parameter, W(x) is the weight, b is the bias, and μ is the mean.

[0018] Preferably, the S2 constructs an RGSC-YOLO detection model based on the YOLOv8 model, including: generating a redundant feature map using a 1×1 convolution operation after feature mapping, introducing a scaling factor to control the size of C2f_CRG, and the scaling factor is 0.5.

[0019] Preferably, the S2 constructs an RGSC-YOLO detection model based on the YOLOv8 model, including: using convolution operations to perform fine-grained feature extraction, wherein the filling amount is dynamically calculated according to different expansion rates.

[0020] Preferably, S2 constructs an RGSC-YOLO detection model based on the YOLOv8 model, including: using a shared convolutional layer for parameter sharing.

[0021] Preferably, the S2 constructs an RGSC-YOLO detection model based on the YOLOv8 model, including: using an SPFC module to replace the SPPC block in the YOLOv8 network model, the SPFC module includes a 1×1 convolution layer and a 3×3 convolution, and uses a 1×1 convolution layer to perform channel transformation and feature extraction.

[0022] The present invention also provides an aluminum alloy ingot surface defect detection system based on RGSC-YOLO, which is applied to the aforementioned aluminum alloy ingot surface defect detection method based on RGSC-YOLO. The system includes: an acquisition module, a model building module, a training module and a detection module;

[0023] The acquisition module is used to acquire surface images of aluminum alloy ingots, construct an image dataset, preprocess and annotate the image dataset, and divide it into a training set, a test set, and a validation set;

[0024] The model building module is used to build an RGSC-YOLO detection model based on the YOLOv8 model;

[0025] The training module is used to train, test and verify the RGSC-YOLO detection model based on the training set, the test set and the validation set;

[0026] The detection module is used to perform defect detection on the surface image of the aluminum alloy ingot to be inspected based on the trained, tested and verified RGSC-YOLO detection model.

[0027] Compared with the prior art, the present invention has the following beneficial effects:

[0028] 1. Use RepConv and ordinary convolution operations for feature extraction, and use 1×1 convolution operations to generate redundant features, which improves the lightweightness of the model.

[0029] 2. Add a scaling factor to the module so that it can take into account both small and large models according to actual needs.

[0030] 3. Apply multiple convolution operations for feature extraction, and use shared weights and dynamic padding to optimize model performance. Use the SPFC module to replace the SPPC block in the YOLOv8 network model, which enhances the model's feature extraction capability and reduces the number of parameters. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solution of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0032] Figure 1 This is a flow chart of a method for detecting surface defects of aluminum alloy ingots based on RGSC-YOLO according to embodiment 1 of the present invention;

[0033] Figure 2 This is a schematic diagram of the network structure of the RGSC-YOLO detection model in Example 1 of the present invention;

[0034] Figure 3 Schematic diagram of the training and reasoning process of the RepConv structure in Example 1 of the present invention;

[0035] Figure 4 This is a schematic diagram of the C2f_CRG structure according to the first embodiment of the present invention;

[0036] Figure 5 This is a schematic diagram of the structure of an SPFC module according to an embodiment of the present invention;

[0037] Figure 6 This is a diagram showing the verification results of the RGSC-YOLO detection model in Example 1 of the present invention;

[0038] Figure 7 This is a module diagram of the aluminum alloy ingot surface defect detection system based on RGSC-YOLO in Example 2 of the present invention. DETAILED DESCRIPTION

[0039] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0040] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0041] Example 1

[0042] like Figure 1 As shown, the present invention provides a method for detecting surface defects of aluminum alloy ingots based on RGSC-YOLO, comprising:

[0043] S1. Collect surface images of aluminum alloy ingots, construct an image dataset, preprocess and annotate the image dataset, and divide it into a training set, a test set, and a validation set;

[0044] S2. Build the RGSC-YOLO detection model based on the YOLOv8 model;

[0045] S3. Train, test, and validate the RGSC-YOLO detection model based on the training set, test set, and validation set;

[0046] S4. Defect detection is performed on the surface image of the aluminum alloy ingot to be inspected based on the trained, tested and verified RGSC-YOLO detection model.

[0047] Specifically, S1 collects surface images of aluminum alloy ingots, constructs an image dataset, preprocesses and labels the image dataset, and divides it into a training set, a test set, and a validation set. That is, surface images of aluminum alloy ingots are collected on-site, and the images are preprocessed and labeled. After converting the sample format, the image dataset is divided into a training set, a validation set, and a test set:

[0048] S11, performing preprocessing operations of denoising, filtering, and normalizing on the surface images of the aluminum alloy ingot in the image dataset;

[0049] S12. Defect labeling of the pre-processed aluminum alloy ingot surface image: labeling of the target detection image dataset is completed on the processed image using the image labeling tool LabelImg. To facilitate the recognition of defect labeling information by the programming language for model training, the three categories of slag inclusion, flash, and burr on the aluminum alloy ingot surface defects are named slag_inclusion, overlap, and burr, respectively, and used to annotate the defect rectangles.

[0050] S13. Resize the labeled aluminum alloy ingot surface image and divide it into training set, test set, and validation set according to the ratio of 7:2:1: After the labeling work is completed, the .xml file needs to be converted into a .txt file using the prepared Python code to meet the format requirements of the YOLO algorithm detection, and divide the training set, test set, and validation set according to the ratio of 7:2:1. The number of labels for each category is shown in Table 1:

[0051] Table 1

[0052] Classes Train Test Val Total salg_inclusion 653 150 89 892 Overlap 654 169 88 911 burr 427 112 83 622 Total 1734 431 260 2425

[0053] S2. Build the RGSC-YOLO detection model based on the YOLOv8 model. The overall network architecture of the RGSC-YOLO detection model is as follows: Figure 2 As shown in the figure, in order to meet the requirements of high defect detection accuracy and high speed, the present invention adopts the newly constructed C2f_CRG to replace the original C2f module in the YOLOv8 network, wherein RepConv and ordinary convolution are superimposed to replace the common BottleNeck structure in the C2f module, so as to achieve the purpose of reducing computational costs. In order to avoid the problem of increased model parameters and computational complexity caused by redundant calculations, a 1×1 convolution operation is performed after complex feature mapping calculations in the middle. In addition, in order to improve the detection accuracy of the model, the original SPPC module is replaced with an SPFC module, and convolution operations are used for feature extraction, which can capture more fine-grained features. At the same time, shared weights and dynamic padding are used to optimize the performance of the model.

[0054] In the YOLOv8 model, the C2f module is a very important component, which plays a key role in improving the detection accuracy and operating efficiency of the model. It contains two convolutional layers, which are connected by a residual block in the middle. Its function is to introduce residual connections to allow the network to better learn and utilize the correlation information between features, thereby improving the accuracy of feature extraction and optimizing the network training process. However, due to the need to perform feature fusion operations, the number of model parameters and computational complexity will increase, resulting in an increase in the time cost required during model training and inference, and to a certain extent, an increase in the consumption of computing resources, affecting the training effect of the model. In order to reduce the computational cost, the present invention proposes to use RepConv and ordinary convolution superposition to replace the common BottleNeck structure in the C2f module to make up for the problem of decreased feature extraction capability after discarding the residual block. The training and inference process of the RepConv structure is as follows: Figure 3 Shown, including:

[0055] During training, a multi-branch structure is used, including 3×3 convolution, 1×1 convolution, and batch normalization layers. The weights of the 1×1 convolution are expanded to 3×3 convolution through padding. The weights that are not processed (Batch Normalization) are also converted to 3×3 convolution after processing. These weights are then added to the original 3×3 convolution weights for fusion. The relationship between the convolution layer and the Batch Normalization layer is as follows:

[0056] Conv(x)=W(x)+b

[0057] Among them, Conv(x) represents the convolutional layer, W represents the weight, b represents the bias, and x represents the input of the convolutional layer, which is usually the output feature map of the previous layer.

[0058]

[0059] Among them, β and γ are learnable parameters in the BN layer, μ is the mean, and σ 2 is the variance, and the ε parameter is a number that tends to 0 and is added to prevent the denominator from being 0. It can be ignored during the calculation process.

[0060] During inference, the parameters of these branches are reparameterized onto the main branch and merged into a single 3×3 convolutional layer, thereby reducing computation and memory consumption to improve inference efficiency.

[0061] Weight after fusion:

[0062]

[0063] Bias after fusion:

[0064]

[0065] Therefore, the convolution after fusion can be expressed as:

[0066]

[0067] Because ε is usually a minimum value, it can be ignored. When performing fusion, the bias of the convolution layer is generally set to False. The new convolution layer after fusion can be simplified as:

[0068]

[0069] There is extensive redundancy in the intermediate feature maps calculated by the convolutional neural network, which will increase the number of parameters and computational complexity of the model. Referring to the idea of ​​the GhostNet architecture, after performing complex feature map calculations in the middle, a cheap 1×1 convolution operation is used to generate a part of the redundant feature map, so as to achieve the purpose of increasing the lightweight of the model. The 1×1 convolution operation can compress the number of channels of the input feature map to reduce the computational complexity of subsequent operations. Since the amount of computation is relatively small, it helps to improve the computational efficiency of the entire network. Finally, a scaling factor is introduced in the entire operation to control the size of C2f_CRG so that it can take into account both small and large models. After experimental verification, the most suitable scaling factor size for the aluminum alloy ingot image dataset is 0.5. In summary, the C2f_CRG module structure in the RGSC-YOLO detection model is as follows Figure 4 shown.

[0070] The SPPF module in YOLOv8 effectively improves the accuracy and efficiency of object detection by increasing the receptive field of the model and reducing the amount of computation. However, although the SPPF module has advantages in some scenarios, it may have limitations in complex backgrounds and when the object scale varies, because it lacks a fine-grained attention mechanism for task-critical areas.

[0071] To achieve more fine-grained feature extraction, the SPFC module uses convolution operations for feature extraction, which can capture more fine-grained features. In contrast, the pooling operation of the SPPF may lose some detailed information. Convolution operations offer greater flexibility and expressiveness in feature extraction, better capturing details and complex patterns in images. Applying multiple convolution operations enhances the model's feature extraction capabilities, while leveraging shared weights and dynamic padding to optimize model performance.

[0072] The amount of padding is dynamically calculated based on different dilation rates to ensure that the output of the convolution has an appropriate size, especially when the input image is small or multiple convolutions are performed. The calculation formula is as follows:

[0073]

[0074] Where P represents the amount of padding required for calculating the dilated convolution, d represents the dilation rate, and k represents the spatial size of the convolution kernel. The purpose is to ensure that the output feature map can maintain a certain spatial dimension when performing dilated convolution.

[0075] Multi-scale feature extraction dynamically calculates padding using different dilation rates to ensure the output after convolution is of appropriate size. This is especially true when the input image is small or multiple convolutions are performed. By using convolutional layers with different dilation rates, the module can extract features of different scales. This is very beneficial for capturing information of different sizes and contexts in the image. Low dilation rates capture local details, while high dilation rates capture global context. Furthermore, parameter sharing is used within the module, allowing convolutional layers with different dilation rates to share the same weights and biases. This eliminates the need to learn parameters for each position individually, significantly reducing the number of parameters that require training. Compared to independent convolutional layers, shared convolutional layers can reduce the model's storage and computational overhead while improving computational efficiency.

[0076] The 1×1 convolution layer can retain important feature information while reducing the number of parameters. The SPFC module uses the 1×1 convolution layer to complete efficient channel transformation and feature fusion. Based on the improved strategy, a new SPFC module is proposed, such as Figure 5 shown.

[0077] The model training is performed using the aluminum alloy ingot surface defect image dataset constructed in the present invention. The specific steps are as follows:

[0078] Step 3.1: Build the environment required for the neural network and initialize the classification network parameters;

[0079] Step 3.2: Set the training parameters, select SGD as the model optimizer, momentum to 0.937, optimizer weight decay to 0.0005, learning rate to 0.01, learning batch size to 16, input image size to 640×640, number of worker threads when loading data to 8, and number of training epochs to 200;

[0080] Step 3.3: Use model computational power (Flops), model parameter count (Par(Parameters),) GPU memory usage (GPU_men) during runtime, and mAP50 (Mean Average Precision) for different defects as the main evaluation indicators;

[0081] Step 3.4: Divide the image dataset into a ratio of 7:2:1 and feed it into the RGSC-YOLO network model for iterative operation to finally obtain the trained RGSC-YOLO detection model.

[0082] The trained RGSC-YOLO model is used to perform target detection on the surface image of the aluminum alloy ingot to be inspected, and the model's operating data and detection accuracy are obtained.

[0083] The following uses specific example data for illustration. The example data comes from an aluminum alloy ingot production plant, which photographs defective aluminum alloy ingot products with various defects. The surface defects in this image dataset include slag inclusions, flash, and burrs. The various defects have different shapes, sizes, and characteristics, and the causes are also different. Slag inclusions are caused by impurities or non-metallic substances such as oxides and silicon that fail to completely melt during the smelting and pouring process and are wrapped in the aluminum ingot workpiece; flash is a type of defect in which the aluminum alloy ingot workpiece exceeds the normal size of the casting mold; burrs are caused by tiny, sharp protrusions on the surface of the aluminum alloy ingot during the manual slag salvage process. In view of the characteristics of aluminum alloy ingot surface defects that are irregular, have unclear features, and are highly similar between different types, the present invention proposes a detection model RGSC-YOLO for aluminum alloy ingot surface defects based on the YOLOv8 model, which optimizes and improves the accuracy of detection and the lightweighting of the model.

[0084] To verify the effectiveness of the RGSC-YOLO detection model in the RGSC-YOLO-based aluminum alloy ingot surface defect detection method of the present invention, the detection method of the present invention was compared with advanced target detection methods Faster-RCNN, YOLOv5n, YOLOv6n, YOLOv7-tiny, YOLOv8n, and YOLOv9t on an aluminum alloy ingot surface defect image dataset. The model comparison results are shown in Table 2:

[0085] Table 2

[0086]

[0087] As shown in Table 2, the defect detection performance of the RGSC-YOLO detection model of the present invention is nearly double (38.4%) compared to the Faster-RCNN method. The parameter count of Faster-RCNN is 40.8×106, which is too large compared to the YOLO series algorithm models. Secondly, in the comparison with the YOLO series methods, the salg_inclusion defect detection accuracy of the RGSC-YOLO detection model of the present invention reached 85.5%, and the detection accuracy of the burr defect, which performed poorly, also increased significantly to 65.0%. The overall mAP50 value of the present method is 8.6%, 12.4%, 22.4%, 6.1%, and 14.2% higher than that of YOLOv5, YOLOv6, YOLOv7-tiny, YOLOv8, and YOLOv9-tiny, respectively, achieving the best performance in overall defect detection. In actual industrial application scenarios, not only the accuracy of model detection is important, but also the lightweightness of the algorithm model is also a crucial aspect. Judging from the performance of the parameter Flops, the computing resources required by the RGSC-YOLO detection model of the present invention during the forward propagation and backpropagation processes are minimal. Although the model YOLOv9 has 3.6×105 fewer parameters than the RGSC-YOLO detection model of the present invention, the RGSC-YOLO detection model of the present invention is more lightweight in terms of both the model calculation amount and the GPU occupancy during operation. More importantly, the detection accuracy of each defect feature of the RGSC-YOLO detection model of the present invention is much higher than that of the YOLOv9 model. The above results show that the comprehensive performance of the RGSC-YOLO detection model of the present invention is the best compared to the existing popular defect detection algorithms. The verification results of the RGSC-YOLO detection model of the present invention are as follows: Figure 6 shown.

[0088] In summary, the present invention proposes an RGSC-YOLO-based aluminum alloy ingot surface defect detection method, which uses RepConv and ordinary convolution operations for feature extraction, while using 1×1 convolution operations to generate redundant features, thereby improving the lightweightness of the model; adding a scaling factor to the module so that it can take into account both small and large models according to actual needs; applying multiple convolution operations for feature extraction, and utilizing shared weights and dynamic padding to optimize the model's performance. The SPFC module is used to replace the SPPC block in the YOLOv8 network model to enhance the model's feature extraction capability and reduce the number of parameters. The RGSC-YOLO detection model of the present invention can effectively improve the quality inspection level of aluminum alloy ingots, while reducing the number of floating-point operations and parameters of the model, thereby increasing the lightweightness of the model.

[0089] Example 2

[0090] like Figure 7 As shown, the present invention also provides an aluminum alloy ingot surface defect detection system based on RGSC-YOLO, which is applied to the aluminum alloy ingot surface defect detection method based on RGSC-YOLO described in Example 1. The system includes: an acquisition module, a model building module, a training module and a detection module;

[0091] The acquisition module is used to collect surface images of aluminum alloy ingots, construct image datasets, preprocess and annotate the image datasets, and divide them into training sets, test sets, and validation sets;

[0092] The model building module is used to build the RGSC-YOLO detection model based on the YOLOv8 model;

[0093] The training module is used to train, test, and verify the RGSC-YOLO detection model based on the training set, test set, and validation set;

[0094] The detection module is used to perform defect detection on the surface image of the aluminum alloy ingot to be inspected based on the trained, tested and verified RGSC-YOLO detection model.

[0095] The embodiments described above are merely descriptions of preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by persons skilled in the art should fall within the scope of protection defined by the claims of the present invention.

Claims

1. A method for detecting surface defects of aluminum alloy ingots based on RGSC-YOLO, characterized in that: include: S1. Collecting surface images of aluminum alloy ingots, constructing an image dataset, preprocessing and annotating the image dataset, and dividing the dataset into a training set, a test set, and a validation set; S2. Build the RGSC-YOLO detection model based on the YOLOv8 model; S3. Training, testing, and validating the RGSC-YOLO detection model based on the training set, the test set, and the validation set; S4. Defect detection is performed on the surface image of the aluminum alloy ingot to be inspected based on the trained, tested and verified RGSC-YOLO detection model.

2. The aluminum alloy ingot surface defect detection method based on RGSC-YOLO according to claim 1, characterized in that: The S1 preprocesses and labels the image dataset and divides it into a training set, a test set, and a validation set, including: S11, performing preprocessing operations of denoising, filtering, and normalizing on the surface images of the aluminum alloy ingot in the image dataset; S12, marking defects on the surface image of the pre-treated aluminum alloy ingot; S13. Resize the labeled aluminum alloy ingot surface image and divide it into a training set, a test set, and a validation set in a ratio of 7:2:

1.

3. The aluminum alloy ingot surface defect detection method based on RGSC-YOLO according to claim 1, characterized in that: The S2 constructs the RGSC-YOLO detection model based on the YOLOv8 model, including: using RepConv and ordinary convolution to superimpose the common BottleNeck structure in the C2f module of the YOLOv8 network; using a multi-branch structure during training, including 3×3 convolution, 1×1 convolution and BN layer, expanding the weight of 1×1 convolution to 3×3 convolution through padding operation, converting the weight of BN layer to 3×3 convolution after processing, and adding it to the original 3×3 convolution weight for fusion: Among them, BN(Conv(x)) is the fused convolution, β and γ are the learnable parameters in the BN layer, σ 2 is the variance, ε is the parameter, W(x) is the weight, b is the bias, and μ is the mean.

4. The aluminum alloy ingot surface defect detection method based on RGSC-YOLO according to claim 1, characterized in that: The S2 constructs the RGSC-YOLO detection model based on the YOLOv8 model, including: generating a redundant feature map by using a 1×1 convolution operation after feature mapping, introducing a scaling factor to control the size of C2f_CRG, and the scaling factor is 0.

5.

5. The aluminum alloy ingot surface defect detection method based on RGSC-YOLO according to claim 1, characterized in that: The S2 constructs an RGSC-YOLO detection model based on the YOLOv8 model, including: using convolution operations to perform fine-grained feature extraction, wherein the padding amount is dynamically calculated according to different expansion rates.

6. The aluminum alloy ingot surface defect detection method based on RGSC-YOLO according to claim 1, characterized in that: The S2 constructs the RGSC-YOLO detection model based on the YOLOv8 model, including: using a shared convolutional layer for parameter sharing.

7. The aluminum alloy ingot surface defect detection method based on RGSC-YOLO according to claim 1, characterized in that: The S2 constructs an RGSC-YOLO detection model based on the YOLOv8 model, including: using an SPFC module to replace the SPPC block in the YOLOv8 network model, the SPFC module includes a 1×1 convolution layer and a 3×3 convolution, and uses a 1×1 convolution layer to perform channel transformation and feature extraction.

8. An aluminum alloy ingot surface defect detection system based on RGSC-YOLO, applied to the aluminum alloy ingot surface defect detection method based on RGSC-YOLO according to any one of claims 1 to 7, characterized in that: The system includes: an acquisition module, a model building module, a training module and a detection module; The acquisition module is used to acquire surface images of aluminum alloy ingots, construct an image dataset, preprocess and annotate the image dataset, and divide it into a training set, a test set, and a validation set; The model building module is used to build an RGSC-YOLO detection model based on the YOLOv8 model; The training module is used to train, test and verify the RGSC-YOLO detection model based on the training set, the test set and the validation set; The detection module is used to perform defect detection on the surface image of the aluminum alloy ingot to be inspected based on the trained, tested and verified RGSC-YOLO detection model.