Image analysis-based online detection and control method for surface quality of aluminum alloy profile

By combining multi-angle light sources and multispectral cameras with structured light projection, the problems of specular reflection interference and texture differentiation in the surface quality inspection of aluminum alloy profiles have been solved. This has enabled closed-loop linkage between inspection results and production line control, improving inspection accuracy and efficiency, adapting to different texture variations, and meeting the requirements of high-speed online inspection.

CN122199544APending Publication Date: 2026-06-12GUIZHOU GUICAI INNOVATION TECH (GRP) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUIZHOU GUICAI INNOVATION TECH (GRP) CO LTD
Filing Date
2026-05-14
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

Existing surface quality inspection methods for aluminum alloy profiles suffer from problems such as insufficient robustness due to specular reflection interference, difficulty in accurately distinguishing textures from defects, lack of closed-loop feedback between inspection results and production line control, and insufficient adaptive capability.

Method used

A multi-angle ring light source array and a multispectral industrial camera are used to acquire surface images of aluminum alloy profiles. Combined with structured light projection, a lightweight cascaded detection network is constructed using a specular reflection probability mask and adaptive specular suppression and texture suppression factors to achieve defect type identification and comprehensive scoring, and output production line control commands.

🎯Benefits of technology

It effectively suppresses specular reflection, accurately separates texture and defects, realizes closed-loop linkage between detection results and production line control, has adaptive capabilities, improves detection accuracy and efficiency, reduces computational load, and meets the requirements of high-speed real-time online detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122199544A_ABST
    Figure CN122199544A_ABST
Patent Text Reader

Abstract

The application discloses an aluminum alloy profile surface quality online detection and control method based on image analysis, relates to the technical field of visual detection and image analysis, and comprises the following steps: synchronously collecting surface images of a profile to be detected at three wave bands and a structured light projection image at a discharging end of an extrusion production line; extracting surface curvature distribution by using the structured light image, calculating a mirror reflection probability mask, and performing adaptive highlight suppression; generating a fusion image based on reflectivity differences between the wave bands; extracting a gradient field from the fusion image and calculating a texture suppression factor; inputting the gradient amplitude field after texture suppression into a lightweight cascade detection network, and outputting defect types, confidence scores and position coordinates; and comprehensively calculating defect comprehensive scores according to defect numbers, types, severity and spatial distribution density, and outputting production line control instructions after comparison with grading thresholds. The application realizes high-precision real-time detection and quality control closed-loop linkage of aluminum alloy profile surface defects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of visual inspection and image analysis technology, specifically to an online detection and control method for the surface quality of aluminum alloy profiles based on image analysis. Background Technology

[0002] Aluminum alloy profiles are widely used in building curtain walls, door and window frames, industrial plant structures, and rail transportation. According to national standards, surface defects in aluminum alloy profiles include various types such as cracks, peeling, bubbles, scratches, abrasions, indentations, and corrosion spots. These defects directly affect the mechanical properties, corrosion resistance, and service life of the product, and in severe cases, may lead to structural failure and safety accidents. Traditional surface quality inspection of aluminum alloy profiles mainly relies on manual visual inspection. Quality inspectors observe the profile surface with the naked eye and judge the presence and severity of defects based on experience. Under workshop lighting conditions, the human eye can hardly detect minute defects, and manual visual inspection is far less efficient than production line speed, becoming a bottleneck restricting production efficiency.

[0003] In recent years, machine vision-based aluminum alloy surface defect detection technology has made some progress. Some methods extract texture features for defect analysis or use deep neural networks for defect recognition. However, existing technologies still have the following core problems: the high reflectivity of aluminum alloy surfaces leads to insufficient detection robustness; specular reflection can obscure defect features, causing missed detections; extrusion textures and linear defects such as scratches are similar in gradient features, making them difficult to distinguish accurately, resulting in a high false detection rate in textured areas; online inspection results lack an effective closed-loop feedback mechanism with production line control, and there is a lack of correlation between quality inspection data and production processes, leading to the recurrence of the same type of defects; existing methods lack adaptability to changes in profile texture, requiring frequent manual parameter adjustments when changing profiles with different alloy grades or cross-sectional shapes.

[0004] Therefore, there is an urgent need for an online detection and control method for the surface quality of aluminum alloy profiles that can effectively suppress specular reflection interference, accurately separate textures and defects, achieve closed-loop linkage between detection results and production line control, and have adaptive capabilities to changes in profile texture. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to address the shortcomings of the prior art by providing an online detection and control method for the surface quality of aluminum alloy profiles based on image analysis.

[0006] To achieve the above objectives, the technical solution adopted by the present invention is as follows:

[0007] An online detection and control method for the surface quality of aluminum alloy profiles based on image analysis includes the following steps:

[0008] Step S1: Set up an image acquisition unit consisting of a multi-angle ring light source array and a multi-spectral industrial camera at the discharge end of the aluminum alloy profile extrusion production line. Simultaneously acquire surface images of the profile under the three bands of red light, green light and blue light, and at the same time acquire surface images under structured light projection to obtain three-dimensional morphological information of the profile surface.

[0009] Step S2: Extract the surface curvature distribution from the three acquired surface images using structured light projection images, calculate the specular reflection probability mask, perform adaptive specular suppression on the surface images of the three bands based on the specular reflection probability mask, and construct fusion weights based on the difference in reflectivity between the bands to generate a fused image.

[0010] Step S3: Extract the gradient direction field and gradient magnitude field from the fused image, calculate the main texture direction, construct a direction-aware texture suppression operator based on the main texture direction, calculate the texture suppression factor, and adaptively attenuate the gradient magnitude of the fused image through the texture suppression factor to obtain the texture-suppressed gradient magnitude field.

[0011] Step S4: Input the gradient magnitude field after texture suppression into a lightweight cascaded detection network consisting of a coarse detection network and a fine detection network, and output the defect type label, confidence score and location coordinates;

[0012] Step S5: Calculate the overall defect score by combining the number of defects, defect type, defect severity, and defect spatial distribution density in the current detection frame. Compare the overall defect score with the preset graded quality threshold and output the graded quality judgment result and the corresponding production line control instruction.

[0013] Further, in step S1, the multi-angle ring light source array includes a high-angle ring light source and a low-angle ring light source. The angle between the high-angle ring light source and the normal to the profile surface is 15 to 30 degrees, and the high-angle ring light source is used to illuminate the planar area of ​​the profile surface. The angle between the low-angle ring light source and the normal to the profile surface is 60 to 75 degrees, and the low-angle ring light source is used to illuminate the edges and corner areas of the profile surface. The center wavelength of the red light band is 660 nanometers, the center wavelength of the green light band is 532 nanometers, and the center wavelength of the blue light band is 450 nanometers.

[0014] Furthermore, step S2 specifically includes the following steps:

[0015] Step S2.1: Extract the three-dimensional morphology information of the profile surface using structured light projection image, calculate the principal curvature at each pixel point on the profile surface, and the gradient magnitude of the structured light projection image at each pixel point;

[0016] Step S2.2: The normalized gradient magnitude and the normalized principal curvature are weighted and summed, and the specular reflection probability mask value at each pixel is obtained by mapping through a nonlinear activation function.

[0017] Step S2.3: Based on the specular reflection probability mask value, perform adaptive specular suppression processing on the original surface images of the three bands of red light, green light and blue light respectively;

[0018] Step S2.4: Calculate the local contrast of the three band surface images at each pixel point, and combine the degree of specular reflection affecting the three band surface images at each pixel point to determine the fusion weight of the three band surface images at the corresponding pixel points.

[0019] Step S2.5: Based on the fusion weights, perform weighted fusion of the surface images of the three bands to generate a fused image.

[0020] Furthermore, in step S2.2, the nonlinear activation function is a sigmoid function with adjustable kurtosis and offset parameters.

[0021] Furthermore, in step S2.4, the fusion weight of the band surface image at each pixel is calculated using a Softmax function. The numerator of the fusion weight function contains the ratio of the local contrast of the band surface image to the degree of influence of specular reflection on the band surface image, and the ratio is controlled by a temperature parameter.

[0022] Furthermore, step S3 specifically includes the following steps:

[0023] Step S3.1: Calculate the gradient direction angle and gradient magnitude of each pixel in the fused image, and construct a gradient direction histogram;

[0024] Step S3.2: Estimate the Gaussian kernel density of the gradient direction histogram and take the direction angle corresponding to the density peak as the global texture main direction;

[0025] Step S3.3: For each pixel in the fused image, calculate the directional deviation between the gradient direction angle of the pixel and the global texture principal direction;

[0026] Step S3.4: Calculate the local mean of the gradient magnitude within a preset neighborhood window centered on the pixel, and obtain the global mean of the gradient magnitude of the entire fused image.

[0027] Step S3.5: After the directional deviation is attenuated by a Gaussian function, it is multiplied by the ratio of the local mean to the global mean, and then the product of the multiplication result and the suppression intensity coefficient is subtracted from 1 to obtain the texture suppression factor of the pixel.

[0028] Step S3.6: Multiply the gradient magnitude of the fused image at each pixel by the texture suppression factor of the pixel to obtain the gradient magnitude field after texture suppression.

[0029] Further, in step S4, the coarse detection network adopts the MobileNet-SSD network. The input of the coarse detection network is the gradient magnitude field after texture suppression, and the output of the coarse detection network is the defect candidate region image patch and the initial confidence score. The fine detection network adopts the ResNet-18 network. The input of the fine detection network is the defect candidate region image patch output by the coarse detection network, and the output of the fine detection network is the defect type label, the confidence score and the location coordinates.

[0030] Furthermore, step S5 specifically includes the following steps:

[0031] Step S5.1: Obtain all defect records output by the lightweight cascaded defect detection network in the current detection frame. Each defect record includes a defect type label, confidence score, location coordinates, and pixel area of ​​the defect region.

[0032] Step S5.2: Query the preset type weight coefficient table according to the defect type label to obtain the hazard weight value corresponding to the defect type;

[0033] Step S5.3: Multiply the confidence score, normalized area and hazard weight value of each defect, and sum the multiplication results of all defects in the current detection frame to obtain the defect weighted severity.

[0034] Step S5.4: Calculate the ratio of the sum of the normalized areas of all defects in the current detection frame to the total area of ​​the effective detection region to obtain the spatial distribution density of defects;

[0035] Step S5.5: Perform spatial clustering on all defects in the current detection frame, calculate the product of the number of defects in each defect cluster and the inverse square of the minimum distance between defects in the cluster, sum the product results of all defect clusters and divide by the total number of defect clusters to obtain the defect clustering severity index.

[0036] Step S5.6: Add the following four factors together to obtain the comprehensive defect score: the product of the basic offset constant, the product of the defect weighted severity and the defect weighted severity coefficient, the product of the defect spatial distribution density and the defect spatial distribution density weight coefficient, and the product of the defect cluster severity and the defect cluster severity weight coefficient.

[0037] Furthermore, in step S5.2, the defect types include cracks, peeling, scratches, abrasions, bubbles, indentations, corrosion spots, and oxide spots, wherein the hazard weight value corresponding to cracks and peeling is not less than 1.5, the hazard weight value corresponding to scratches and abrasions is 0.8 to 1.2, and the hazard weight value corresponding to bubbles, indentations, corrosion spots, and oxide spots is not greater than 0.6.

[0038] Furthermore, in step S5, the graded quality judgment result and the corresponding production line control instructions specifically include:

[0039] When the overall defect score is less than the first preset threshold, the current profile segment is determined to be a superior product, a normal production instruction is output, and the profile segment is controlled to enter the next process.

[0040] When the comprehensive defect score is greater than or equal to the first preset threshold and less than the second preset threshold, the current profile segment is determined to be a first-class product, and a marking instruction is output to mark the current profile segment for downgrading or re-inspection.

[0041] When the comprehensive defect score is greater than or equal to the second preset threshold and less than the third preset threshold, the current profile segment is determined to be a defective product, and an alarm and rejection command are output to control the cutting device to reject the current profile segment.

[0042] When the overall defect score is greater than or equal to the third preset threshold, it is judged as a serious defect, and an emergency shutdown and process investigation command is output. The extrusion production line is stopped and the process personnel are notified to check the mold, extrusion temperature and extrusion speed parameters.

[0043] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0044] 1. This invention fuses three-dimensional curvature information and two-dimensional gradient information of structured light to construct a specular reflection probability mask. By introducing surface curvature factors into reflection detection, it can accurately distinguish between normal highlights at geometric edges and abnormal reflections from defects, thus solving the problem of high misjudgment rate in traditional brightness threshold methods.

[0045] 2. This invention designs an adaptive multispectral fusion weighting mechanism driven by the combined effects of contrast and specular reflection, which enables the fusion process to automatically select bands with less interference in the reflective region and bands with high contrast in the flat region, effectively suppressing reflection contamination and preserving defect details.

[0046] 3. This invention constructs a texture suppression factor with dual constraints of directional consistency and local energy. Gradient decay is only applied to pixels that conform to the main texture direction and have normal energy, thereby achieving adaptive and accurate separation of squeezed textures and random defects and significantly reducing the false detection rate of texture regions.

[0047] 4. This invention establishes a five-dimensional defect comprehensive scoring model that integrates type hazard, confidence level, area, distribution density, and cluster severity, comprehensively and objectively quantifying the surface quality of profiles and providing a reliable decision-making basis for production line graded control.

[0048] 5. This invention constructs a complete closed-loop system from detection to control, which automatically outputs release, marking, rejection or shutdown instructions based on defect scores and grading thresholds, realizing the linkage feedback between detection data and process parameters, and effectively preventing batch quality accidents.

[0049] 6. This invention adopts a lightweight cascaded network architecture of MobileNet coarse inspection and ResNet fine inspection, which greatly reduces the amount of computation while ensuring detection accuracy, and meets the industrial deployment requirements of high-speed real-time online inspection of extrusion production lines. Attached Figure Description

[0050] Other features, objects, and advantages of the invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:

[0051] Figure 1 This is a flowchart illustrating an embodiment of the present invention;

[0052] Figure 2 This is a flowchart illustrating the defect comprehensive scoring calculation method according to an embodiment of the present invention.

[0053] Figure 3 This is a system architecture diagram according to an embodiment of the present invention. Detailed Implementation

[0054] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0055] like Figure 1 As shown, the online detection and control method for the surface quality of aluminum alloy profiles based on image analysis includes the following steps:

[0056] Step S1: Set up an image acquisition unit consisting of a multi-angle ring light source array and a multi-spectral industrial camera at the discharge end of the aluminum alloy profile extrusion production line. Simultaneously acquire surface images of the profile under the three bands of red light, green light and blue light, and at the same time acquire surface images under structured light projection to obtain three-dimensional morphological information of the profile surface.

[0057] Step S2: Extract the surface curvature distribution from the three acquired surface images using structured light projection images, calculate the specular reflection probability mask, perform adaptive specular suppression on the surface images of the three bands based on the specular reflection probability mask, and construct fusion weights based on the difference in reflectivity between the bands to generate a fused image.

[0058] Step S3: Extract the gradient direction field and gradient magnitude field from the fused image, calculate the main texture direction, construct a direction-aware texture suppression operator based on the main texture direction, calculate the texture suppression factor, and adaptively attenuate the gradient magnitude of the fused image through the texture suppression factor to obtain the texture-suppressed gradient magnitude field.

[0059] Step S4: Input the gradient magnitude field after texture suppression into a lightweight cascaded detection network consisting of a coarse detection network and a fine detection network, and output the defect type label, confidence score and location coordinates;

[0060] Step S5: Calculate the overall defect score by combining the number of defects, defect type, defect severity, and defect spatial distribution density in the current detection frame. Compare the overall defect score with the preset graded quality threshold and output the graded quality judgment result and the corresponding production line control instruction.

[0061] Aluminum alloy profiles include 6063 aluminum alloy profiles, 6061 aluminum alloy profiles and 7075 aluminum alloy profiles.

[0062] In step S1, the multi-angle ring light source array includes a high-angle ring light source and a low-angle ring light source. The angle between the high-angle ring light source and the normal to the profile surface is 15 to 30 degrees, and the high-angle ring light source is used to illuminate the planar area of ​​the profile surface. The angle between the low-angle ring light source and the normal to the profile surface is 60 to 75 degrees, and the low-angle ring light source is used to illuminate the edges and corner areas of the profile surface. The center wavelength of the red light band is 660 nanometers, the center wavelength of the green light band is 532 nanometers, and the center wavelength of the blue light band is 450 nanometers.

[0063] The structured light projection uses a black and white alternating sinusoidal stripe pattern with a stripe period of 3 to 8 pixels.

[0064] Step S2 specifically includes the following steps:

[0065] Step S2.1: Extract the three-dimensional morphology information of the profile surface using structured light projection image, calculate the principal curvature at each pixel point on the profile surface, and the gradient magnitude of the structured light projection image at each pixel point;

[0066] Step S2.2: The normalized gradient magnitude and the normalized principal curvature are weighted and summed, and the specular reflection probability mask value at each pixel is obtained by mapping through a nonlinear activation function.

[0067] Step S2.3: Based on the specular reflection probability mask value, perform adaptive specular suppression processing on the original surface images of the three bands of red light, green light and blue light respectively;

[0068] Step S2.4: Calculate the local contrast of the three band surface images at each pixel point, and combine the degree of specular reflection affecting the three band surface images at each pixel point to determine the fusion weight of the three band surface images at the corresponding pixel points.

[0069] Step S2.5: Based on the fusion weights, perform weighted fusion of the surface images of the three bands to generate a fused image.

[0070] The specific formula for the specular reflection probability mask value is as follows:

[0071]

[0072] in, This represents the specular reflection probability mask value at coordinates (x, y), with a value ranging from [0, 1]. The closer the value is to 1, the higher the probability of the pixel undergoing specular reflection. To represent a non-linear activation function, the Sigmoid function is used. and This represents the weighting coefficients, which sum to 1, and and The value range is [0.3, 0.7]. This represents the gradient magnitude of the structured light projection image at (x, y). This represents the maximum gradient magnitude across the entire image. The principal curvature of the surface at (x, y) is calculated from the 3D topography reconstructed from the structured light image. This represents the maximum value of the principal curvature of the entire graph;

[0073] Adaptive specular suppression processing is performed on the original surface images of the three bands of red light, green light and blue light respectively. The suppression method can be to replace the pixel values ​​in the original surface image whose corresponding specular reflection probability mask values ​​are higher than a preset threshold. The preset threshold is between 0.7 and 0.9.

[0074] The fusion weights are calculated using the Softmax function, with the following formula:

[0075]

[0076] in, This represents the fusion weight of band c at coordinates (x, y). This represents the temperature parameter, controlling the concentration of the weight distribution, and its value ranges from [0.5, 2.0]. The local contrast of the surface image at (x, y) in band c is defined as the ratio of the standard deviation to the mean of the pixel values ​​within a neighborhood window centered at (x, y). This indicates the degree to which the surface image in band c is affected by specular reflection at (x, y). This represents a very small constant to prevent the denominator from being zero. The band c takes R, G, and B, which correspond to red light, green light, and blue light, respectively.

[0077] Among them, the degree of influence of specular reflection The specific formula is:

[0078]

[0079] in, and These represent the mean and standard deviation of the pixel values ​​for the entire image in band c, respectively. This represents the original surface image of band c;

[0080] The specific formula for image fusion is as follows:

[0081]

[0082] in, This represents the pixel value at (x, y) in the merged image.

[0083] In step S2.2, the nonlinear activation function is a Sigmoid function with adjustable kurtosis and offset parameters.

[0084] In step S2.4, the fusion weight of the band surface image at each pixel is calculated using the Softmax function. The numerator of the fusion weight function contains the ratio of the local contrast of the band surface image to the degree of influence of specular reflection on the band surface image. This ratio is controlled by temperature parameters.

[0085] Step S3 specifically includes the following steps:

[0086] Step S3.1: Calculate the gradient direction angle and gradient magnitude of each pixel in the fused image, and construct a gradient direction histogram;

[0087] Step S3.2: Estimate the Gaussian kernel density of the gradient direction histogram and take the direction angle corresponding to the density peak as the global texture main direction;

[0088] Step S3.3: For each pixel in the fused image, calculate the directional deviation between the gradient direction angle of the pixel and the global texture principal direction;

[0089] Step S3.4: Calculate the local mean of the gradient magnitude within a preset neighborhood window centered on the pixel, and obtain the global mean of the gradient magnitude of the entire fused image.

[0090] Step S3.5: After the directional deviation is attenuated by a Gaussian function, it is multiplied by the ratio of the local mean to the global mean, and then the product of the multiplication result and the suppression intensity coefficient is subtracted from 1 to obtain the texture suppression factor of the pixel.

[0091] Step S3.6: Multiply the gradient magnitude of the fused image at each pixel by the texture suppression factor of the pixel to obtain the gradient magnitude field after texture suppression.

[0092] The gradient direction angle and gradient magnitude of each point in the fused image are calculated using the following formula:

[0093]

[0094] in, This represents the gradient direction angle of pixel (x, y). This represents the gradient magnitude of the pixel (x, y).

[0095] Gaussian kernel density estimation is performed on the gradient direction histogram, and the orientation angle corresponding to the density peak is taken as the global texture main direction;

[0096] For each pixel in the fused image, calculate the directional deviation between its gradient direction angle and the global texture principal direction;

[0097] Calculate the local mean of the gradient magnitude within a preset neighborhood window centered on the pixel (x, y). The neighborhood window size is m×m, where m is 7~11. Obtain the global mean of the gradient magnitude of the entire image.

[0098] The specific formula for calculating the texture suppression factor is as follows:

[0099]

[0100] in, This represents the texture suppression factor at coordinates (x, y). This represents the inhibition intensity coefficient, which controls the maximum inhibition ratio, and its value ranges from [0.5, 0.9]. Indicates the main direction of the global texture. This represents the directional bandwidth parameter, which controls the rate of directional similarity decay, and ranges from 5 to 20 degrees. This represents the mean of the gradient magnitudes within an m×m neighborhood centered at (x, y). This represents the mean of the gradient magnitudes across the entire graph.

[0101] Multiply the gradient magnitude at pixel (x, y) of the fused image by the texture suppression factor of that pixel to obtain the texture-suppressed gradient magnitude. The specific formula is as follows:

[0102]

[0103] in, This represents the gradient magnitude after texture suppression. This represents the gradient magnitude of the fused image at pixel (x, y);

[0104] All pixels This constitutes the gradient magnitude field after texture suppression.

[0105] In step S4, the coarse detection network uses the MobileNet-SSD network. The input of the coarse detection network is the gradient magnitude field after texture suppression, and the output of the coarse detection network is the defect candidate region image patch and the initial confidence score. The fine detection network uses the ResNet-18 network. The input of the fine detection network is the defect candidate region image patch output by the coarse detection network, and the output of the fine detection network is the defect type label, the confidence score, and the location coordinates.

[0106] The gradient magnitude field after texture suppression is input into a lightweight cascaded detection network consisting of a coarse detection network and a fine detection network, and the output is a defect type label, confidence score and location coordinates.

[0107] The coarse detection network adopts the MobileNet-SSD network, which uses MobileNet as the backbone network and utilizes depthwise separable convolution to reduce the computational cost. Combined with the SSD detection head, it performs target detection on multi-scale feature maps. The input of the coarse detection network is the gradient magnitude field after texture suppression. The input image size is normalized to 320 pixels × 320 pixels. The output of the coarse detection network is the image patch of the defect candidate region and the corresponding confidence score for the initial screening.

[0108] The fine detection network uses the ResNet-18 network, which is a residual convolutional neural network with 18 weight layers. The residual connection solves the problem of training difficulties in deep networks. The input of the fine detection network is the defect candidate region image patch output by the coarse detection network, and the output is the defect type label corresponding to the candidate region, such as crack, peeling, scratch, etc., fine confidence score, and precise location coordinates, represented in the form of bounding boxes.

[0109] like Figure 2 As shown, step S5 specifically includes the following steps:

[0110] Step S5.1: Obtain all defect records output by the lightweight cascaded defect detection network in the current detection frame. Each defect record includes a defect type label, confidence score, location coordinates, and pixel area of ​​the defect region.

[0111] Step S5.2: Query the preset type weight coefficient table according to the defect type label to obtain the hazard weight value corresponding to the defect type;

[0112] Step S5.3: Multiply the confidence score, normalized area and hazard weight value of each defect, and sum the multiplication results of all defects in the current detection frame to obtain the defect weighted severity.

[0113] Step S5.4: Calculate the ratio of the sum of the normalized areas of all defects in the current detection frame to the total area of ​​the effective detection region to obtain the spatial distribution density of defects;

[0114] Step S5.5: Perform spatial clustering on all defects in the current detection frame, calculate the product of the number of defects in each defect cluster and the inverse square of the minimum distance between defects in the cluster, sum the product results of all defect clusters and divide by the total number of defect clusters to obtain the defect clustering severity index.

[0115] Step S5.6: Add the following four factors together to obtain the comprehensive defect score: the product of the basic offset constant, the product of the defect weighted severity and the defect weighted severity coefficient, the product of the defect spatial distribution density and the defect spatial distribution density weight coefficient, and the product of the defect cluster severity and the defect cluster severity weight coefficient.

[0116] The specific formula for the weighted severity of the defect is as follows:

[0117]

[0118] in, Indicates the weighted severity of the defect. This indicates the total number of defects within the currently detected frame. This represents the hazard weight value of defect i. This represents the confidence score for defect i. The normalized area of ​​defect i is represented by the ratio of the pixel area of ​​the defect region to the preset reference area. The preset reference area is usually taken as 1 / 100 of the effective detection area of ​​the profile surface.

[0119] The specific formula for the spatial distribution density of the defects is:

[0120]

[0121] in, This indicates the spatial distribution density of defects, reflecting the overall density of defect coverage on the profile surface. This represents the total area of ​​the effective detection area;

[0122] Spatial clustering is performed on all defects within the current detection frame using the DBSCAN algorithm. The neighborhood radius is set to 1 / 20 to 1 / 10 of the profile width, and the minimum number of neighborhood points is set to 2. The specific formula for the defect clustering severity index is as follows:

[0123]

[0124] in, This index represents the severity of defect clustering. The higher the value, the more closely clustered the defects are. Clustered defects, such as continuous scratches and dense indentations, pose a much greater threat to the overall quality of the product than scattered, independent defects. This represents the total number of defect clusters obtained from spatial clustering. This represents the number of defects contained in the j-th defect cluster. The smallest pixel unit representing the pairwise distance between all defects within the j-th defect cluster. This represents a minimal constant to prevent the denominator from being zero, and is taken as 10. -6 ;

[0125] The specific formula for the comprehensive defect scoring is as follows:

[0126]

[0127] in, This represents the overall defect score of the current detection frame, used to comprehensively quantify the surface quality of the profile. This represents the base offset constant, used to map scores to target intervals, with a value range of [0, 10]. The weighting coefficient represents the weighted severity of the defect, and its value ranges from [0.5, 2.0]. The weighting coefficient represents the spatial distribution density of defects, and its value ranges from [0.2, 1.0]. The weighting coefficient represents the severity of defect clustering, with a value range of [0.3, 1.5].

[0128] In step S5.2, the defect types include cracks, peeling, scratches, abrasions, bubbles, indentations, corrosion spots, and oxide spots. The hazard weight value corresponding to cracks and peeling is not less than 1.5, the hazard weight value corresponding to scratches and abrasions is 0.8 to 1.2, and the hazard weight value corresponding to bubbles, indentations, corrosion spots, and oxide spots is not greater than 0.6.

[0129] In step S5, the graded quality judgment result and the corresponding production line control instructions specifically include:

[0130] When the overall defect score is less than the first preset threshold, the current profile segment is determined to be a superior product, a normal production instruction is output, and the profile segment is controlled to enter the next process.

[0131] When the comprehensive defect score is greater than or equal to the first preset threshold and less than the second preset threshold, the current profile segment is determined to be a first-class product, and a marking instruction is output to mark the current profile segment for downgrading or re-inspection.

[0132] When the comprehensive defect score is greater than or equal to the second preset threshold and less than the third preset threshold, it is determined that the current profile section is a non-conforming product, an alarm and rejection instruction are output, and the cutting device is controlled to reject the current profile section;

[0133] When the comprehensive defect score is greater than or equal to the third preset threshold, it is determined as a serious defect, an emergency shutdown and process troubleshooting instruction are output, the extrusion production line is stopped and the process personnel are notified to check the die, extrusion temperature and extrusion speed parameters.

[0134] Compare the comprehensive defect score with the preset classification quality thresholds, output the classification quality determination result and the corresponding production line control instructions. The preset classification quality thresholds include the first preset threshold T1, the second preset threshold T2 and the third preset threshold T3, and satisfy 0 < T1 < T2 < T3. The preferred value ranges of the thresholds are as follows:

[0135] The value range of the first preset threshold T1 is [0.5, 1.5], and the preferred value is 1.0;

[0136] The value range of the second preset threshold T2 is [2.5, 4.0], and the preferred value is 3.0;

[0137] The value range of the third preset threshold T3 is [5.0, 8.0], and the preferred value is 6.0.

[0138] As Figure 3 shown, the system of the present invention as a whole adopts a hierarchical architecture. The image acquisition layer consists of a multi-angle annular light source and a multi-spectral camera, which is responsible for obtaining surface images and structured light images in three bands. The preprocessing layer performs specular reflection suppression, multi-spectral image fusion and texture-defect separation, and outputs the gradient amplitude field after texture suppression. The detection network layer adopts a lightweight cascaded structure. First, the coarse detection network MobileNet-SSD quickly screens the defect candidate regions and outputs the preliminary screening scores. Then, the fine detection network ResNet-18 performs fine classification and positioning on the candidate regions, outputs the defect type labels, confidence scores and position coordinates. Finally, based on the detection results, the comprehensive defect score is calculated, and the corresponding production line control instructions are generated after hierarchical determination. This architecture realizes a complete processing link from image acquisition, defect detection to production line closed-loop control.

[0139] The embodiments described in the present invention are only descriptions of the preferred embodiments of the present invention, and do not limit the concept and scope of the present invention. Without departing from the design idea of the present invention, various deformations and improvements made by those skilled in the art to the technical solutions of the present invention should fall within the protection scope of the present invention.

Claims

1. A method for online detection and control of surface quality of aluminum alloy profiles based on image analysis, characterized in that, Includes the following steps: Step S1: Set up an image acquisition unit consisting of a multi-angle ring light source array and a multi-spectral industrial camera at the discharge end of the aluminum alloy profile extrusion production line. Simultaneously acquire surface images of the profile under the three bands of red light, green light and blue light, and at the same time acquire surface images under structured light projection to obtain three-dimensional morphological information of the profile surface. Step S2: Extract the surface curvature distribution from the three acquired surface images using structured light projection images, calculate the specular reflection probability mask, perform adaptive specular suppression on the surface images of the three bands based on the specular reflection probability mask, and construct fusion weights based on the difference in reflectivity between the bands to generate a fused image. Step S3: Extract the gradient direction field and gradient magnitude field from the fused image, calculate the main texture direction, construct a direction-aware texture suppression operator based on the main texture direction, calculate the texture suppression factor, and adaptively attenuate the gradient magnitude of the fused image through the texture suppression factor to obtain the texture-suppressed gradient magnitude field. Step S4: Input the gradient magnitude field after texture suppression into a lightweight cascaded detection network consisting of a coarse detection network and a fine detection network, and output the defect type label, confidence score and location coordinates; Step S5: Calculate the overall defect score by combining the number of defects, defect type, defect severity, and defect spatial distribution density in the current detection frame. Compare the overall defect score with the preset graded quality threshold and output the graded quality judgment result and the corresponding production line control instruction.

2. The method according to claim 1, characterized in that, In step S1, the multi-angle ring light source array includes a high-angle ring light source and a low-angle ring light source. The angle between the high-angle ring light source and the normal to the profile surface is 15 to 30 degrees, and the high-angle ring light source is used to illuminate the planar area of ​​the profile surface. The angle between the low-angle ring light source and the normal to the profile surface is 60 to 75 degrees, and the low-angle ring light source is used to illuminate the edges and corner areas of the profile surface. The center wavelength of the red light band is 660 nanometers, the center wavelength of the green light band is 532 nanometers, and the center wavelength of the blue light band is 450 nanometers.

3. The method according to claim 2, characterized in that, Step S2 specifically includes the following steps: Step S2.1: Extract the three-dimensional morphology information of the profile surface using structured light projection image, calculate the principal curvature at each pixel point on the profile surface, and the gradient magnitude of the structured light projection image at each pixel point; Step S2.2: The normalized gradient magnitude and the normalized principal curvature are weighted and summed, and the specular reflection probability mask value at each pixel is obtained by mapping through a nonlinear activation function. Step S2.3: Based on the specular reflection probability mask value, perform adaptive specular suppression processing on the original surface images of the three bands of red light, green light and blue light respectively; Step S2.4: Calculate the local contrast of the three band surface images at each pixel point, and combine the degree of specular reflection affecting the three band surface images at each pixel point to determine the fusion weight of the three band surface images at the corresponding pixel points. Step S2.5: Based on the fusion weights, perform weighted fusion of the surface images of the three bands to generate a fused image.

4. The method according to claim 3, characterized in that, In step S2.2, the nonlinear activation function is a Sigmoid function with adjustable kurtosis and offset parameters.

5. The method according to claim 4, characterized in that, In step S2.4, the fusion weight of the band surface image at each pixel is calculated using the Softmax function. The numerator of the fusion weight function contains the ratio of the local contrast of the band surface image to the degree of influence of specular reflection on the band surface image. This ratio is controlled by temperature parameters.

6. The method according to claim 5, characterized in that, Step S3 specifically includes the following steps: Step S3.1: Calculate the gradient direction angle and gradient magnitude of each pixel in the fused image, and construct a gradient direction histogram; Step S3.2: Estimate the Gaussian kernel density of the gradient direction histogram and take the direction angle corresponding to the density peak as the global texture main direction; Step S3.3: For each pixel in the fused image, calculate the directional deviation between the gradient direction angle of the pixel and the global texture principal direction; Step S3.4: Calculate the local mean of the gradient magnitude within a preset neighborhood window centered on the pixel, and obtain the global mean of the gradient magnitude of the entire fused image. Step S3.5: After the directional deviation is attenuated by a Gaussian function, it is multiplied by the ratio of the local mean to the global mean, and then the product of the multiplication result and the suppression intensity coefficient is subtracted from 1 to obtain the texture suppression factor of the pixel. Step S3.6: Multiply the gradient magnitude of the fused image at each pixel by the texture suppression factor of the pixel to obtain the gradient magnitude field after texture suppression.

7. The method according to claim 6, characterized in that, In step S4, the coarse detection network uses the MobileNet-SSD network. The input of the coarse detection network is the gradient magnitude field after texture suppression, and the output of the coarse detection network is the defect candidate region image patch and the initial confidence score. The fine detection network uses the ResNet-18 network. The input of the fine detection network is the defect candidate region image patch output by the coarse detection network, and the output of the fine detection network is the defect type label, the confidence score, and the location coordinates.

8. The method according to claim 7, characterized in that, Step S5 specifically includes the following steps: Step S5.1: Obtain all defect records output by the lightweight cascaded defect detection network in the current detection frame. Each defect record includes a defect type label, confidence score, location coordinates, and pixel area of ​​the defect region. Step S5.2: Query the preset type weight coefficient table according to the defect type label to obtain the hazard weight value corresponding to the defect type; Step S5.3: Multiply the confidence score, normalized area and hazard weight value of each defect, and sum the multiplication results of all defects in the current detection frame to obtain the defect weighted severity. Step S5.4: Calculate the ratio of the sum of the normalized areas of all defects in the current detection frame to the total area of ​​the effective detection region to obtain the spatial distribution density of defects; Step S5.5: Perform spatial clustering on all defects in the current detection frame, calculate the product of the number of defects in each defect cluster and the inverse square of the minimum distance between defects in the cluster, sum the product results of all defect clusters and divide by the total number of defect clusters to obtain the defect clustering severity index. Step S5.6: Add the following four factors together to obtain the comprehensive defect score: the product of the basic offset constant, the product of the defect weighted severity and the defect weighted severity coefficient, the product of the defect spatial distribution density and the defect spatial distribution density weight coefficient, and the product of the defect cluster severity and the defect cluster severity weight coefficient.

9. The method according to claim 8, characterized in that, In step S5.2, the defect types include cracks, peeling, scratches, abrasions, bubbles, indentations, corrosion spots, and oxide spots. The hazard weight value corresponding to cracks and peeling is not less than 1.5, the hazard weight value corresponding to scratches and abrasions is 0.8 to 1.2, and the hazard weight value corresponding to bubbles, indentations, corrosion spots, and oxide spots is not greater than 0.

6.

10. The method according to claim 9, characterized in that, In step S5, the graded quality judgment result and the corresponding production line control instructions specifically include: When the overall defect score is less than the first preset threshold, the current profile segment is determined to be a superior product, a normal production instruction is output, and the profile segment is controlled to enter the next process. When the comprehensive defect score is greater than or equal to the first preset threshold and less than the second preset threshold, the current profile segment is determined to be a first-class product, and a marking instruction is output to mark the current profile segment for downgrading or re-inspection. When the comprehensive defect score is greater than or equal to the second preset threshold and less than the third preset threshold, the current profile segment is determined to be a defective product, and an alarm and rejection command are output to control the cutting device to reject the current profile segment. When the overall defect score is greater than or equal to the third preset threshold, it is judged as a serious defect, and an emergency shutdown and process investigation command is output to stop the extrusion production line and notify the process personnel to check the mold, extrusion temperature and extrusion speed parameters.