A method and system for automatic detection of aluminum profile surface defects based on image recognition

Through three-dimensional scanning and multi-view image fusion technology, the observation angle and lighting are dynamically adjusted, which solves the problems of low detection efficiency and shadow blind spots of traditional aluminum profiles, and achieves high-precision and full coverage defect detection.

CN120374615BActive Publication Date: 2025-08-29CHONGQING JIUHAI ALUMINUM CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510856667.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-25
Publication Date
2025-08-29
Estimated Expiration
2045-06-25

AI Technical Summary

Technical Problem

The surface defect detection methods of traditional aluminum profiles are inefficient and subjective, making it difficult to adapt to complex cross-sectional shapes, resulting in the formation of detection blind spots in the shadowed areas, affecting the continuity and accuracy of detection.

Method used

Through three-dimensional scanning, the geometric data of the aluminum profile section is obtained, the observation angle is dynamically designed, the shadow areas are eliminated, the camera lighting and triggering timing are adjusted, and the multi-view image fusion technology is used to achieve full coverage and high-precision detection.

Benefits of technology

It realizes all-round blind spot detection of aluminum profile surfaces, adapts to changes in complex section shapes and production rhythms, and improves the accuracy and comprehensiveness of defect detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120374615B_ABST
    Figure CN120374615B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for automatic detection of surface defects of aluminum profiles based on image recognition, which relates to the technical field of image processing and intelligent detection. The method comprises acquiring three-dimensional geometric data of the cross section of the aluminum profile by means of a three-dimensional scanning device, extracting geometric feature parameters required for calculating candidate observation angles and coverage ranges, and if the cross-sectional shape contains grooves or curved surface structures, marking the spatial coordinate range corresponding to the area of ​​the shadow region, thereby obtaining a cross-sectional geometric feature vector and a set of shadow region coordinates. The method and system for automatic detection of surface defects of aluminum profiles based on image recognition realize all-round and non-dead-angle detection of the surface of the aluminum profile, can adapt to complex cross-sectional shapes and changing production rhythms, improve the accuracy and comprehensiveness of defect detection, and provide effective technical support for quality control of aluminum profiles.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing and intelligent detection, and in particular to an automatic detection method and system for aluminum profile surface defects based on image recognition. Background Art

[0002] Aluminum profiles, as a core material for modern industrial manufacturing, are widely used in key areas such as aerospace, automotive manufacturing, and architectural decoration. Their surface quality directly impacts product performance and service life. As the manufacturing industry continues to increase its demands for product quality, aluminum profile surface defect detection has become a crucial step in ensuring product quality.

[0003] Traditional manual inspection methods suffer from low efficiency, strong subjectivity, and high rates of missed detections. While existing automated inspection systems have improved inspection efficiency to some extent, they often rely on fixed observation angles and uniform inspection parameters when dealing with aluminum profiles with complex cross-sectional shapes, making them difficult to adapt to the individual needs of different products. These methods exhibit significant limitations when handling the diverse range of aluminum profiles. The diversity and complexity of aluminum profile cross-sectional shapes presents the technical challenge of optimizing observation angles. Different cross-sectional shapes require different observation angles to ensure effective inspection of all surface areas, a requirement that cannot be met with fixed camera placement. Improper selection of observation angles directly leads to the creation of shadowed areas, which become inspection blind spots, preventing hidden surface defects from being identified. The presence of shadowed areas further exacerbates the problem of incomplete image acquisition, especially in high-speed production environments where product dimensional variations and fluctuating production speeds make precise control of camera trigger timing difficult. When trigger timing does not align with the actual production cycle, image acquisition can be intermittent or overlapping, seriously impacting inspection continuity and accuracy. Summary of the Invention

[0004] The purpose of the present invention is to provide a method and system for automatic detection of surface defects of aluminum profiles based on image recognition, dynamically designing the optimal observation angle for different cross-sectional shapes of aluminum profiles, effectively eliminating shadow areas, and adaptively adjusting the camera trigger timing according to product specifications and production parameters to ensure full coverage and high precision of the detection process.

[0005] To achieve the above-mentioned objectives, the present invention provides the following technical solutions: a method for automatic detection of surface defects of aluminum profiles based on image recognition, the method comprising: acquiring three-dimensional geometric data of the aluminum profile cross section through a three-dimensional scanning device, extracting geometric feature parameters required for calculating candidate observation angles and coverage ranges, and if the cross-sectional shape contains grooves or curved surface structures, marking the spatial coordinate range corresponding to the area of ​​the shadow region to obtain a cross-sectional geometric feature vector and a set of shadow region coordinates; obtaining a spatially unified complete surface image based on the cross-sectional geometric feature vector, and extracting surface abnormality features and defect boundary segmentation results through the complete surface image using a defect detection algorithm; if defect features are detected, performing defect type label classification and severity level assessment to obtain a detection report including defect location coordinates, defect type label and severity level; adjusting the camera illumination intensity parameters through the illumination compensation coefficient based on the defect location coordinates and defect type label in the detection report; and if the defect boundary segmentation accuracy of the area is lower than a preset threshold, updating the candidate observation angles and the viewing angle switching frequency to obtain an optimized multi-view configuration scheme and trigger timing table.

[0006] Preferably, obtaining a spatially unified complete surface image based on the cross-sectional geometric feature vector includes: calculating the coverage range of candidate observation angles using a perspective optimization algorithm based on the cross-sectional geometric feature vector; if the area of ​​the shadow region under a certain observation angle exceeds a preset threshold, adjusting the camera position parameters and angle adjustment strategy to determine the optimal multi-perspective configuration scheme and the corresponding camera three-dimensional spatial coordinate position and tilt angle parameters.

[0007] Preferably, the method of obtaining a spatially unified complete surface image based on the cross-sectional geometric feature vector also includes: obtaining image acquisition parameter settings under different candidate observation angles through the optimal multi-perspective configuration scheme, detecting the overlapping area detection results between adjacent perspectives, and if there is an overlapping area, establishing a spatial mapping relationship between the perspectives to obtain the alignment reference points and multi-perspective fusion weights of the multi-perspective image.

[0008] Preferably, the method of obtaining a spatially unified complete surface image based on the cross-sectional geometric feature vector also includes: using a dynamic timing calculation module to analyze the time interval for the product to pass through the detection area based on the aluminum profile product specifications and the current production line speed; if the production rhythm changes, the viewing angle switching frequency, camera trigger frequency and exposure time parameters are adjusted to determine the synchronous trigger timing table and image acquisition time window.

[0009] Preferably, the method of obtaining a spatially unified complete surface image based on the cross-sectional geometric feature vector also includes: controlling the coordinated operation of multiple cameras through a synchronous triggering timing table to obtain an image sequence of the same product cross-section at different candidate observation angles; if a product position offset is detected within the image acquisition time window, a position compensation mechanism is activated to obtain a time-synchronized multi-view image data set.

[0010] Preferably, the method of obtaining a spatially unified complete surface image based on the cross-sectional geometric feature vector also includes: using image registration technology to spatially align images from different angles based on a time-synchronized multi-perspective image data set and a multi-perspective fusion weight; if the registration accuracy is lower than a registration accuracy threshold, recalculating the registration reference point to obtain a spatially unified complete surface image.

[0011] Preferably, the three-dimensional scanning device is a laser three-dimensional profile scanner or a structured light scanning system, which is used to improve the accuracy of geometric data acquisition of complex cross-sectional structures.

[0012] Preferably, the geometric characteristic parameters include curvature change rate, normal direction distribution and groove depth index.

[0013] Preferably, the shadow area coordinate set is automatically generated by calculating the local viewing angle occlusion degree and the angle between the surface normal direction.

[0014] An automatic surface defect detection system for aluminum profiles based on image recognition is used to implement the steps of the automatic surface defect detection method for aluminum profiles based on image recognition. The system includes: a data acquisition and preprocessing module for acquiring three-dimensional geometric data of the aluminum profile cross section using a three-dimensional scanning device, extracting geometric feature parameters required for calculating candidate observation angles and coverage ranges, and if the cross-sectional shape contains grooves or curved surface structures, marking the spatial coordinate range corresponding to the area of ​​the shadow region to obtain a cross-sectional geometric feature vector and a set of shadow region coordinates; an image construction and defect recognition module for obtaining a spatially unified complete surface image based on the cross-sectional geometric feature vectors, extracting surface abnormality features and defect boundary segmentation results from the complete surface image using a defect detection algorithm, and if defect features are detected, classifying the defect type label and evaluating the severity level to obtain a detection report including the defect location coordinates, defect type label, and severity level; and an intelligent control module for adjusting the camera illumination intensity parameter using an illumination compensation coefficient based on the defect location coordinates and defect type label in the detection report. If the defect boundary segmentation accuracy of the region is lower than a preset threshold, updating the candidate observation angles and view switching frequency to obtain an optimized multi-view configuration scheme and trigger timing table.

[0015] It can be seen from the above technical solution that the present invention has the following beneficial effects:

[0016] This method and system for automatic detection of surface defects in aluminum profiles based on image recognition acquires cross-sectional geometric data through three-dimensional scanning, extracts characteristic parameters, marks shadow areas, and optimizes the configuration of observation angles. The camera trigger timing is dynamically adjusted according to the production line speed, and synchronized multi-view images are acquired. Image registration technology is used to align images at different angles, fuse them to generate a complete surface image, and perform defect detection and classification. Based on the detection results, the lighting parameters and observation angles are dynamically optimized to improve the accuracy of defect boundary segmentation. The present invention achieves all-round, no-dead-angle detection of aluminum profile surfaces, can adapt to complex cross-sectional shapes and changing production rhythms, improves the accuracy and comprehensiveness of defect detection, and provides effective technical support for aluminum profile quality control. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 Flow chart of the method of the present invention;

[0018] Figure 2 This is a connection diagram of the system modules of the present invention. DETAILED DESCRIPTION

[0019] 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.

[0020] like Figure 1 As shown, the present invention provides a technical solution: an automatic detection method for surface defects of aluminum profiles based on image recognition, the method comprising: acquiring three-dimensional geometric data of the aluminum profile cross section through a three-dimensional scanning device, extracting geometric feature parameters required for calculating candidate observation angles and coverage ranges, if the cross-sectional shape contains a groove or a curved surface structure, marking the spatial coordinate range corresponding to the area of ​​the shadow region, and obtaining a cross-sectional geometric feature vector and a shadow region coordinate set; obtaining a spatially unified complete surface image based on the cross-sectional geometric feature vector, extracting surface abnormality features and defect boundary segmentation results through the complete surface image using a defect detection algorithm, if defect features are detected, performing defect type label classification and severity level evaluation, and obtaining a detection report including defect location coordinates, defect type label and severity level; adjusting the camera illumination intensity parameters through the illumination compensation coefficient based on the defect location coordinates and defect type label in the detection report, and if the defect boundary segmentation accuracy of the area is lower than a preset threshold, updating the candidate observation angles and the viewing angle switching frequency, and obtaining an optimized multi-view configuration scheme and trigger timing table.

[0021] This method is based on 3D geometric modeling of aluminum profile cross-sections. High-precision point cloud data of the cross-section is collected using 3D scanning equipment (such as laser scanners or structured light systems). A surface reconstruction algorithm extracts features such as cross-section shape, groove locations, and curvature variations. This generates geometric feature vectors for the cross-section, identifies shadow areas potentially caused by structural occlusion, and constructs corresponding spatial coordinate sets. During the surface imaging phase, multi-angle capture is used to synthesize a complete, spatially unified surface image, ensuring that every area is fully covered by the imaging system. Subsequently, deep learning or traditional image processing methods (such as a convolutional neural network (CNN)-based defect recognition model) are used to identify defects such as abnormal textures, cracks, and bubbles in the image. Defect boundaries are extracted and image segmentation is performed. Defect types (such as indentations, scratches, and bubbles) are annotated and graded according to severity. Furthermore, based on the coordinate location and type labels provided by the defect report, intelligent compensation is applied to the imaging system's illumination module, adjusting the intensity or direction of the LED or laser illumination. In areas where detection accuracy is insufficient, a feedback mechanism automatically adjusts the viewing angle selection strategy and capture frequency, forming a multi-angle capture and processing solution to achieve optimal image coverage and defect recognition rate.

[0022] The method of the present invention begins by acquiring complete geometric information about the aluminum profile cross section. Using 3D scanning equipment (such as a laser triangulator or structured light system), the cross section is scanned at high density to obtain a data set of discrete 3D point coordinates that constitute the surface. First, the system uses a principal component analysis algorithm to perform pose alignment and normalization on the point cloud data, extracting a set of vectors that describe the cross section's primary structural orientations and contour features. These vectors are then used to characterize the structural characteristics of the cross section's overall shape.

[0023] During processing, the system extracts the normal direction of the local area surrounding each scan point. This is done by fitting tiny planes near the point to determine its orientation. These normal directions can be used to determine changes in curvature of the cross-sectional surface. For example, a sudden change in the normal direction of a region or a dramatic angle change indicates the presence of grooves, protrusions, or other curved structures. The system further calculates the visibility of each point from the current viewing angle, determining whether the point is easily obscured or shadowed from the current imaging direction. This judgment is based on the angle between the normal direction and the viewing direction, as well as the severity of the local surface changes. If an area has a distinct concave structure and faces the non-viewing direction, it is considered to be in a shadowed area. The system records the 3D coordinates of this area as a compensation target for potential defects. Based on the extracted cross-sectional structural features, the system then plans multiple observation angles and sequentially acquires images. Finally, using image stitching and registration algorithms, a complete image covering the entire aluminum profile surface is generated. This image captures all suspicious areas and complex geometric surfaces, ensuring that critical information is not missed during subsequent inspections. During the defect detection phase, the system feeds the complete image into a defect recognition algorithm model. Through training, the model acquires the ability to identify surface defects such as scratches, indentations, and bubbles. For each pixel in the image, the system assesses its probability of belonging to a defect region and compares it to a set probability threshold. For example, if the probability of a pixel's defect exceeds a set threshold (e.g., 50%), the system marks it as a defect region. Setting this threshold typically requires training and cross-validation using manually annotated datasets, ultimately selecting a value that strikes the optimal balance between precision and recall. Once a defect region is detected, the system further extracts geometric information such as the region's area, boundary length, and surface depth to calculate a severity score for each defect. For example, a defect with a larger area, a tortuous boundary, and a deeper depth will receive a higher severity score. The weighting of each scoring dimension is determined by actual industrial inspection standards, such as the weighting coefficients for indentation width and depth tolerances specified in national standards. After defect identification, the system intelligently adjusts the lighting system for the next imaging session based on the defect type and location. This lighting adjustment determines the lighting compensation coefficient based on the ratio between the image brightness of the current defect area and the expected brightness. For example, when the local brightness in the inspection image is significantly lower than the target brightness set by the system, it indicates that the recognition effect may be affected by insufficient lighting in this area. The system will accordingly increase the brightness of the light source in this area. In addition, if the accuracy of defect boundary segmentation detected by the system in certain areas is lower than the preset threshold (for example, lower than 80%), the automatic optimization mechanism is triggered to re-plan the image acquisition angle and adjust the frequency and sequence of perspective switching. By analyzing the image coverage at different angles, the system selects the optimal angle combination to improve the coverage rate and image clarity of the entire system.Based on the inspection results, the system also generates a multi-view image acquisition plan and determines the specific time points to trigger acquisition at each angle. Through this process, the present invention has built an adaptive, closed-loop adjustable surface defect detection system that not only accurately identifies defects but also provides real-time feedback to adjust detection strategies to address the challenges posed by complex geometric structures.

[0024] Compared with the traditional single-angle imaging detection method, the present invention has significant advantages in obtaining complete structural information of the cross section and compensating for occluded areas. By constructing the geometric feature vector of the cross section, accurate viewing angle planning and imaging strategy deployment can be achieved, effectively avoiding image blind spots caused by grooves or curved surface structures. The introduction of multi-view synthesis technology and intelligent illumination compensation mechanism significantly improves the uniformity of surface imaging and the accuracy of defect detection. Defect recognition adopts an efficient image recognition algorithm, which takes into account both detection speed and accuracy in the automated processing flow. Through defect level assessment and feedback adjustment mechanism, the system's ability to adaptively adjust parameters is also realized, improving the robustness and intelligence level of the overall system. Finally, the output test report has three-dimensional information of spatial positioning, type classification and severity evaluation, which meets the actual needs of industrial automation detection and quality control.

[0025] According to the cross-sectional geometric feature vector, a spatially unified complete surface image is obtained, which includes calculating the coverage range of candidate observation angles using a perspective optimization algorithm based on the cross-sectional geometric feature vector. If the area of ​​the shadow area under a certain observation angle exceeds a preset threshold, the camera position parameters and angle adjustment strategy are adjusted to determine the optimal multi-perspective configuration scheme and the corresponding camera three-dimensional spatial coordinate position and tilt angle parameters.

[0026] In this implementation, the system first analyzes the aluminum profile's structural shape and occlusion characteristics based on the acquired cross-sectional geometric feature vectors. This feature vector, derived through principal component analysis, curvature analysis, and concave-convex structure recognition on the cross-sectional scan point cloud, comprehensively describes the profile's surface geometry in all directions, including groove depth, curvature distribution, and the location of sudden edge changes. The system then predefines a set of candidate observation angles. Using these angles as a benchmark, the system uses simulations to evaluate their occlusion and coverage capabilities when observing the cross-sectional surface, providing a foundation for subsequent imaging configuration optimization. At each candidate angle, the system calculates the angle between each known structural point on the aluminum profile's surface and the current camera's viewing direction, and then assesses the likelihood of occlusion based on the curvature characteristics of the area within which the point lies. Specifically, an occlusion index is calculated as the ratio of the cosine of the angle to the local surface curvature. When this index falls below a set occlusion threshold (typically between 0.3 and 0.5, based on empirical curvature statistics), the point is likely to be in a shadow area at that viewing angle. By summarizing the occlusion metrics for all points, the system identifies shadow areas within a given viewing angle and calculates the total area covered by shadows at that angle. To determine whether an observation angle is valid, the system calculates the ratio of the shadow area at that angle to the total visible area to obtain the shadow area ratio. If this ratio exceeds a preset area ratio threshold (typically 15%), the angle is deemed to provide insufficient image information and is removed from the candidate set. This area ratio threshold is statistically determined through experiments on the inspection accuracy of various aluminum profile types to ensure coverage quality within an acceptable error range. After eliminating unqualified candidate angles, the system optimizes the remaining valid angles, aiming to cover the entire imageable area of ​​the aluminum profile while minimizing the number of observation angles and camera switching frequency. To achieve this, the system constructs an objective function that weights the effective imaging area of ​​each angle and controls the number of angles by multiplying it by a penalty factor, balancing image integrity and capture efficiency. This optimization process can employ heuristic search, simulated annealing, or genetic algorithms to ultimately determine an optimal combination of angles, known as a multi-angle configuration. Finally, for each selected observation angle, the system calculates the precise coordinate position of the camera in three-dimensional space and its pitch, yaw, roll and other tilt angles based on the position and shape of the aluminum profile in space and the imaging requirements. The calculation results of the camera's spatial posture will be organized into a standardized configuration table for use by the camera control unit or robot execution system to ensure that each imaging can be completed at an optimized position and angle, providing a guarantee for the final generation of a complete surface image with unified space and no blind spots. This implementation method significantly improves the effectiveness of image acquisition and the accuracy of defect identification by jointly optimizing the coverage and shadow evaluation of the observation angle. Shadow area analysis enables the system to avoid detection blind spots caused by occlusion on complex structure surfaces, thereby improving the integrity of the surface image.At the same time, by optimizing the configuration of spatial parameters, we effectively improve shooting efficiency and reduce data redundancy and system resource consumption caused by multiple imaging. Compared with fixed-angle or uniformly distributed shooting schemes, this method achieves a better balance between imaging coverage and computational load, enhancing the practicality and intelligence of the system.

[0027] According to the cross-sectional geometric feature vector, obtaining a spatially unified complete surface image also includes obtaining the image acquisition parameter settings under different candidate observation angles through the optimal multi-view configuration scheme, detecting the overlapping area detection results between adjacent view angles, and if there is an overlapping area, establishing a spatial mapping relationship between the view angles to obtain the alignment reference points and multi-view fusion weights of the multi-view image.

[0028] In this embodiment, the system first acquires the corresponding image acquisition parameters for each defined observation angle based on the determined optimal multi-view configuration. These parameters primarily include exposure time, illumination intensity, camera focal length, and image resolution. The system automatically calculates the appropriate exposure time based on the aluminum profile surface reflectivity, lighting conditions, and desired image brightness. Specifically, exposure time is directly proportional to the desired image brightness and inversely proportional to the surface reflectivity and illumination intensity. To ensure clear images of sections of varying structural complexity, the system sets an empirical coefficient, typically ranging from 0.8 to 1.2, to compensate for the effects of environmental variations on exposure. The system then performs overlap detection between two adjacent view angles. This process extracts local image feature points from each image and calculates the Euclidean distance between the two sets of feature points to determine whether there is overlap. If the system detects more than 60 valid matching points in the two images (this threshold can be set based on the image resolution and profile texture complexity, with a recommended range of 30 to 100), it deems the view angle pair to have valid overlap. After confirming the existence of an overlapping region, the system uses these matching points to construct a spatial mapping between the views. This mapping is modeled using an affine transformation: a point in image A is mapped to a corresponding point in image B according to the rules of rotation, scaling, and translation. To ensure the accuracy of the mapping, the system uses a minimum error criterion to determine the set of spatial transformation parameters that best fits all pairs of matching points. After completing the geometric alignment of the images, the system also fuses the pixel values ​​within the overlapping region. The image quality of each view within the overlapping region serves as a metric for its contribution to the fused image. The system first calculates the image gradient strength (an indicator of image clarity, often achieved through edge detection such as the Sobel operator) and a local image quality metric (such as signal-to-noise ratio or structural similarity). These two metrics are then multiplied together to produce a fusion weight. The fusion weights for all views are normalized so that their sum is 1. These weights are then multiplied by the pixel values ​​of their corresponding images, and the weighted sum is finally calculated to produce the pixel values ​​for the overlapping region of the fused image. To ensure registration accuracy, the system also sets a maximum error tolerance threshold, typically set to within 2 pixels. If the average residual error of all matching points after the registration is completed exceeds the error threshold, the system will consider the registration to have failed and automatically re-execute the feature point matching and mapping process until the accuracy requirements are met. Through the above method, on the basis of realizing multi-view image acquisition, it is possible to effectively solve the problem of image breakage or overlapping blur caused by different positions, angles and shooting parameters between adjacent images. By establishing a spatial mapping relationship between perspectives and introducing fusion weights, the multi-angle imaging data can maintain consistency and image quality stability when combined, thereby improving the accuracy and robustness of overall defect detection. At the same time, this method supports high-precision image stitching, which is particularly suitable for the detection of aluminum profile sections with complex geometric changes or curved structures.

[0029] Obtaining a spatially unified complete surface image based on the cross-sectional geometric feature vector also involves using a dynamic timing calculation module to analyze the time intervals between products passing through the inspection area based on the aluminum profile product specifications and the current production line speed. If the production rhythm changes, the viewing angle switching frequency, camera trigger frequency, and exposure time parameters are adjusted to determine the synchronous trigger timing table and image acquisition time window.

[0030] In this embodiment, the system incorporates a dynamic timing calculation module to achieve precise timing control of aluminum profiles during production line operation. This module first obtains the current production line speed, typically in meters per second, and simultaneously reads the length of the aluminum profile being inspected (in meters). The system divides the product's length by the production line speed to calculate the time it takes for the product to enter the inspection area and exit it. This result is called the total time it takes to pass through the inspection zone. For example, if a 6-meter-long aluminum profile is traveling on a production line at a speed of 1 meter per second, it will take 6 seconds to pass through the inspection zone. The system then divides this total time into several time periods, allocating them to image acquisition tasks for different cameras or different observation angles. This division is based on the total number of view angles required and the minimum stabilization time required for imaging at each view angle. For example, if the entire inspection system includes three different view angles, and image acquisition for each view angle takes at least 0.8 seconds, the system must reserve a capture window of at least 0.8 seconds for each view angle, appropriately distributed within the total 6-second timeframe. If, during operation, the system samples real-time speed data and detects a significant change in speed compared to the previous cycle—for example, an increase or decrease of more than 5%—then the production cycle is considered to have changed. This 5% threshold, determined empirically through historical process analysis and test data, serves as a system sensitivity adjustment parameter. At this point, the system automatically recalculates the new product inspection time and updates the time window corresponding to each acquisition task. In addition to adjusting the time window, the system also updates the following parameters: First, the camera's angle switching frequency—the interval required for the camera or observation device to switch between different shooting angles. The system must ensure that the camera remains stable at the new angle for at least the specified time after switching. Second, the camera's trigger frequency—the number of frames captured per unit time—is calculated by reverse engineering the new available time window. Third, the camera's exposure time is automatically adjusted based on the acquisition interval to ensure consistent image brightness. For example, as the cycle speed increases, the exposure time should be shortened to avoid image blur. After all parameters are calculated, the system generates a synchronized trigger timing table, detailing the trigger moment, exposure duration, corresponding view angle number, and imaging duration for each camera or imaging unit. This table also associates the image acquisition time window, ensuring that all imaging tasks are executed accurately and efficiently during the effective time period when the product actually enters the inspection area, thereby enabling uninterrupted multi-view image registration, fusion, and defect detection.

[0031] This implementation introduces a dynamic timing adjustment mechanism to improve the system's adaptability to actual production line rhythm changes, preventing image acquisition quality from being affected by speed fluctuations. Compared to traditional fixed acquisition cycle solutions, this invention offers greater time sensitivity and adaptive control capabilities, making it particularly suitable for high-speed, variable-speed, or multi-beat mixed-line production environments. Precise trigger timing and exposure time control not only ensure image quality but also enhance the detection accuracy and stability of the entire system, helping to achieve high-reliability industrial automation defect identification.

[0032] Based on the cross-sectional geometric feature vector, obtaining a spatially unified complete surface image also includes controlling the coordinated operation of multiple cameras through a synchronized trigger timing table to obtain an image sequence of the same product cross-section at different candidate observation angles. If a product position offset is detected within the image acquisition time window, a position compensation mechanism is activated to obtain a time-synchronized multi-view image dataset.

[0033] In this embodiment, the system uses the previously generated synchronized trigger timing table to coordinate the operation of multiple cameras in the inspection device, ensuring that images of the same product section are captured within their specified time windows. Each camera is assigned a trigger start time and an exposure duration in this timing table. For example, for the first camera, its image capture start time might be 3 seconds, its exposure time 0.5 seconds, and its capture end time 3.5 seconds. In a similar manner, the acquisition processes of multiple cameras are systematically scheduled throughout the entire time the product passes through the inspection area. The system uses a unified master clock or hardware trigger signal to synchronize all cameras with microsecond accuracy. Each camera is triggered at a preset time to capture an image of the current section, ensuring that images captured from different perspectives are based on the product state at the same time. Furthermore, within each image capture time window, the system monitors the position of the aluminum profile product in real time. Monitoring methods include laser ranging, visual positioning, or encoders. The actual position data collected is compared with the theoretical position data. The theoretical position is the expected position calculated by multiplying the production line speed by the time. The difference between the actual and theoretical positions is compared to determine the current offset. If the offset exceeds a preset threshold, such as 2 mm, the system determines that the position offset has reached a level requiring compensation. This threshold is determined based on the camera resolution and the minimum detectable defect size, typically between 2 and 5 mm. At this point, the system immediately initiates position compensation. This compensation mechanism primarily involves two methods. The first is forward compensation, where the system calculates a new trigger time for cameras that have not yet triggered a shot based on the current offset value and production line speed. For example, if the offset is 20 mm and the production line speed is 100 mm / s, the new trigger time should be 0.2 seconds earlier than originally planned. The second is backward compensation, where image processing algorithms perform coordinate transformations on already captured images, realigning the image coordinates to a standard reference position. This correction involves applying affine or perspective transformations to restore the spatial position of the target area in the image to its theoretical position. To ensure temporal and spatial consistency of the multi-view image data, the system accurately records timestamps and spatial pose parameters for each image. Timestamp accuracy is typically required to be less than 1 millisecond. Pose parameters include the camera's position coordinates in three-dimensional space, as well as angular information about its shooting direction, such as pitch, yaw, and roll. Ultimately, the system generates image datasets that are not only strictly synchronized in time but also precisely aligned in spatial position, serving as high-quality input data for subsequent multi-view image fusion, three-dimensional reconstruction, or defect detection. By employing time synchronization control and position compensation mechanisms, the present invention significantly improves the consistency and temporal matching of image data in multi-camera collaboration.Even under high-speed movement or environmental disturbances, the system can adjust the imaging plan in real time to ensure that each frame of image originates from the product cross-section at the same moment, thus avoiding image misalignment and recognition errors caused by positional errors or time drift. This technology improves the robustness and data quality of the multi-view imaging system and is particularly suitable for the inspection of aluminum profiles with complex structures and fast production pace.

[0034] Obtaining a spatially unified complete surface image based on the cross-sectional geometric feature vector also includes spatially aligning images from different angles using image registration technology based on a time-synchronized multi-view image dataset and multi-view fusion weights. If the registration accuracy is lower than a registration accuracy threshold, the registration reference point is recalculated to obtain a spatially unified complete surface image.

[0035] In this embodiment, after acquiring multi-view image data with a unified timestamp, the system sets fusion weights based on the image quality of each image within the overlapping region. The fusion weight for each view is determined by two key metrics: edge clarity in the overlapping region, or gradient strength, which indicates the sharpness of edge texture; and the signal-to-noise ratio, which reflects the overall image quality. The system multiplies the image's gradient strength by its signal-to-noise ratio to obtain a weighted value for each image. After summing the weighted values ​​for all viewpoints, each image's weight is normalized and used as the fusion weight to ensure a total weight of 1 for all images. This weight reflects the contribution of each viewpoint to the final fused image. During the registration phase, the system uses a feature point-based registration method to spatially align images from different observation angles. First, multiple feature points are extracted from each image, such as corners and edge intersections, and matched with corresponding feature points in the other image to form a set of one-to-one corresponding point pairs. Based on these point pairs, the system constructs a transformation relationship. This transformation can be an affine transformation (including rotation, scaling, and translation) or a more complex perspective transformation. To determine the optimal transformation parameters, the system sums the squared spatial errors of all matching points before and after the transformation and selects the transformation that minimizes this error sum as the final mapping model. After registration, to assess the accuracy of the image alignment, the system calculates the positional deviations of all matching points after the transformation and takes the square root of the average squared deviations to obtain the average residual error, or root mean square error (RMS). The system compares this error value with a preset accuracy threshold. This threshold is typically set between 1 and 2 pixels, depending on the camera resolution and the minimum detection unit for defect detection. For example, for a camera system with a resolution of 1024 by 1024 pixels, if the minimum detection size of the target defect is 0.5 mm, a threshold of no more than 2 pixels is recommended to ensure accurate detection. If the RMS error of the registration result exceeds the preset threshold, the system deems the current registration failed and initiates a re-registration process. This process includes re-extracting image feature points, removing mismatched pairs, introducing new stable areas as registration reference points, and recalculating the transformation relationship between images until the error value meets the threshold requirement. After all images are successfully aligned, the system will perform a weighted average of the image pixels in the overlapping area based on the fusion weights calculated above. That is, for multiple image pixels at the same position, their corresponding weights are multiplied by the pixel grayscale value, and the sum of all weighted values ​​is used as the pixel value of the final image. In the end, the output image is not only highly aligned in space and seamlessly connected in structure, but also has a visual effect of balanced brightness and uniform clarity, which can provide a stable and high-quality input basis for subsequent defect recognition. The registration accuracy threshold is an important criterion for judging whether the quality of image spatial alignment meets the standards. Its setting is mainly determined by the image resolution, the minimum recognition scale of defect detection, and the feature quality of the overlapping area of ​​the image.Specifically, the threshold is usually measured in pixels and measures the average spatial offset of corresponding feature points in the overlapping areas of the registered images. Taking a camera with a 1024×1024 pixel resolution as an example, if the minimum defect size that the inspection system needs to identify is 0.5 mm, and each pixel corresponds to an actual length of approximately 0.1 mm, it is recommended to set the registration error threshold to 1 to 2 pixels to ensure that image errors do not interfere with the accurate positioning of the defect boundary. If the registration error exceeds this threshold, the system will automatically trigger the process of recalculating the registration reference points. The threshold can also be dynamically adjusted based on specific application scenarios. For example, on a production line with weak feature texture, low image contrast, or slight displacement jitter, the threshold can be set within 3 pixels based on preliminary test data, and appropriate tolerance control can be performed in combination with image enhancement or geometric compensation strategies to ensure that the registration effect is both reliable and robust. This embodiment ensures the stability and consistency of the multi-view image fusion process by introducing a fusion weight and registration accuracy judgment mechanism, significantly improving the spatial alignment quality of the overall image. The system can dynamically adjust the registration strategy and reference point settings based on the real-time registration effect, improving image stitching efficiency while reducing stitching errors, thereby effectively supporting the image input quality of high-precision defect detection systems and enhancing their adaptability and practical value in complex application environments in industrial sites.

[0036] The 3D scanning equipment is a laser 3D profile scanner or a structured light scanning system, which is used to improve the accuracy of geometric data acquisition of complex cross-sectional structures.

[0037] In this embodiment, the 3D scanning equipment used in the system is a laser 3D profile scanner or a structured light scanning system. Both offer high-precision surface profile reconstruction capabilities and are particularly well-suited for scanning the cross-sectional geometry of aluminum profiles with grooves, abrupt boundaries, or curved surfaces. A laser 3D profile scanner emits a single or multiple laser lines at the object being measured and uses a receiver to receive the reflected signals. Based on the principle of triangulation, it calculates the spatial coordinates of each scan point, thereby constructing a complete point cloud model of the cross-section. A structured light scanning system, on the other hand, projects a specific pattern of fringe light onto the surface of the aluminum profile and uses binocular or multi-lens cameras to decode the fringe deformation, rapidly reconstructing high-density 3D geometric data. Compared to traditional contact measurement methods or low-resolution imaging, these two types of non-contact optical scanning technologies enable accurate modeling of cross-sections of profiles with complex curves and deep grooves without impacting production schedules. After acquiring the complete 3D point cloud data, the system generates geometric feature vectors of the cross-section using algorithms such as curvature analysis, normal calculation, and principal axis extraction. These vectors further assist in establishing a multi-view image acquisition strategy and predicting occluded areas. High-precision geometric information also makes the image acquisition angle configuration more reasonable, avoids image loss and misjudgment, and lays the foundation for the comprehensiveness and reliability of surface defect detection. This embodiment significantly improves the three-dimensional reconstruction accuracy of complex geometric cross-sectional structures by adopting a laser three-dimensional profile scanner or a structured light scanning system, providing high-quality basic data for the entire image recognition and defect detection process. Compared with general imaging equipment, this method has higher spatial resolution and measurement sensitivity, and is particularly suitable for industrial aluminum profile scenarios with high-frequency micro-structural changes. Its fast, high-density, and non-contact measurement characteristics also improve the automation capability and environmental adaptability of the detection system, meeting the industrial application requirements of high-speed, continuous production lines.

[0038] Geometric feature parameters include curvature change rate, normal direction distribution and groove depth index. In this embodiment, in order to accurately characterize the structural morphology of the aluminum profile cross section, the system extracts a number of geometric feature parameters from the three-dimensional point cloud data. These parameters include curvature change rate, normal direction distribution and groove depth index. The curvature change rate is used to describe the degree of geometric mutation of the surface curve. The system fits the surface in the local neighborhood of each point, calculates the principal curvature or Gaussian curvature, and analyzes its first-order derivative in space to obtain the trend of change representing the geometric complexity, thereby identifying the sharply changing structural edges or corners. The normal direction distribution is used to evaluate the overall folding or convex-concave state of the cross-sectional surface by statistically analyzing the distribution density of the normal vectors of all points on the unit sphere. If the normal distribution shows a highly clustered or multipolar feature, it means that there are a large number of sharp turns, overlapping or nested structures in the area, and perspective optimization processing is required. In addition, based on the contour information of the aluminum profile cross section on different projection planes, the system measures the maximum depth of each potential groove area relative to the reference surface and defines the groove depth index. This metric, calculated from the distance between the edge of the section and the fitted principal plane (or envelope), is typically expressed in millimeters and used in conjunction with the groove width and contour enclosing area to determine occlusion propensity. These geometric feature parameters form a geometric feature vector for the section, which not only provides a precise basis for subsequent shadow area identification and image acquisition angle planning, but also quantifies the structural complexity, facilitating the system's automatic adjustment of multi-view detection strategies. By introducing three geometric feature parameters—curvature change rate, normal direction distribution, and groove depth—the present invention enables a more comprehensive and accurate characterization of the cross-sectional structure of aluminum profiles, making it particularly suitable for inspecting components with complex curves, depressions, and variable cross-sections. This geometric parameter system not only enhances the ability to identify potential occlusion areas and key defect-sensitive areas, but also provides strong structural support for the system's image acquisition optimization, adaptive scheduling, and defect classification and identification. Compared to traditional approaches that rely solely on coarse geometric data, this method significantly improves detection coverage and accuracy.

[0039] The coordinate set of the shadow area is automatically generated by calculating the local perspective occlusion degree and the angle between the surface normal direction. In this embodiment, in order to identify the image occlusion or imaging dead zone that may exist in the cross section of the aluminum profile at different observation angles, the system automatically calculates the local occlusion degree of each three-dimensional point and the angle between its normal direction and the camera perspective direction, thereby generating a coordinate set for the shadow area. Specifically, the system first extracts the normal vector of each point from the three-dimensional point cloud data, and performs a dot multiplication operation with the incident direction of the light of the current candidate perspective to obtain the cosine value of the angle between the two. The cosine value reflects the degree of consistency between the direction of the surface normal and the line of sight of the camera. If the value is closer to zero, it means that the surface tends to be perpendicular to the camera direction, and it is very easy for the imaging quality to deteriorate due to depression or occlusion. At the same time, in each local area, the visibility of the area from this perspective is evaluated in combination with the point cloud density, curvature and groove depth analysis to obtain the perspective occlusion factor of the area. This factor is typically determined by combining two sub-indicators: the curvature gradient, which measures how quickly the curvature of the area changes, and is used to determine whether it is a sudden bump; and the range of change in the local normal direction, which reflects whether the surface continuously and dramatically folds. Ultimately, when the cosine value of the angle at a particular 3D point falls below a set occlusion threshold (e.g., 0.3) and the occlusion factor of the area it resides in exceeds a preset standard (e.g., 0.6), the point is marked as a potential shadow point by the system. The coordinates of all points that meet this condition are aggregated into a shadow region coordinate set, which is used to guide the multi-view optimization configuration and image reconstruction process.

[0040] This implementation combines 3D spatial geometry with imaging viewpoint parameters to achieve automatic identification and spatial calibration of shadowed areas. Compared to traditional blind spot estimation methods that rely on empirical settings, this method can accurately label easily obscured areas under different cross-sectional shapes and observation angle combinations, providing quantifiable data support for viewpoint optimization, lighting compensation, and image reconstruction, effectively improving defect identification integrity and system robustness. This is particularly applicable to aluminum profile sections with multiple grooves and sudden curved structures.

[0041] In this patent, in order to accurately extract the geometric features of the aluminum profile, such as the cross-sectional shape information, groove position, and curvature change, the present invention adopts the following surface reconstruction processing flow:

[0042] 3D point cloud data acquisition and preprocessing: a laser profile scanner or structured light scanning system is used to obtain high-density 3D point cloud data of aluminum profile sections. The data is processed by statistical filtering and voxel grid sampling to remove outliers, reduce noise and improve the uniformity of point cloud density. Posture normalization: the principal component analysis (PCA) algorithm is used to normalize the point cloud data, calculate the main direction vectors of the point cloud, and rotate the point cloud to a unified reference coordinate system to facilitate subsequent surface feature analysis. Normal direction calculation and curvature analysis: for each point cloud data point, its neighborhood point set is selected (for example, using k-nearest neighbor or fixed radius search). ), fit the local plane and calculate the normal direction; further fit the local surface, calculate the Gaussian curvature, mean curvature and its rate of change, which are used to identify areas of sudden curvature changes and preliminarily determine the cross-sectional geometric boundaries and concave-convex areas; groove structure recognition and depth feature extraction, by clustering analysis of areas with rapidly changing normal directions to identify groove boundaries; using the reference surface fitted in the main direction as a reference, measure the maximum distance from the local point to the reference surface as the groove depth indicator, and further confirm the concave characteristics by combining the groove length and opening angle; execute the surface reconstruction algorithm, and use the Poisson surface reconstruction algorithm to perform overall surface modeling on the preprocessed point cloud. This algorithm forms a continuous and smooth three-dimensional surface by solving the implicit function field (i.e., based on the gradient field reconstruction of the point and the normal), which is suitable for aluminum profile cross-sectional structures with complex contours and significant changes in details; generate a cross-sectional geometric feature vector, and vectorize the extracted curvature change rate, normal direction distribution density, and groove depth indicators to form a cross-sectional geometric feature vector for subsequent perspective optimization analysis and shadow area recognition. Through the above steps, not only high-precision surface reconstruction is achieved, but also quantitative extraction of cross-sectional structural features is completed, ensuring that subsequent defect recognition algorithms can perform accurate detection on the complete surface image, thereby eliminating missed detection problems caused by image blind spots and structural occlusions.

[0043] Identify shadow areas that may be formed due to structural occlusion. The specific methods and steps are:

[0044] To prepare the input data, first, a cross-sectional 3D point cloud data is acquired using laser profiling or structured light equipment. A surface fitting algorithm is then used to obtain the normal vector and local curvature characteristics of each point. This point cloud data should be a cross-sectional geometric model with normalized poses. A set of candidate observation angles is defined. Based on the camera layout constraints of the industrial production line and the characteristic shape of the cross-sectional area, multiple observation directions are predefined (e.g., a set of angles from 0° to 180° is constructed at 15° intervals), each corresponding to a line of sight vector. For each point, the cosine of the angle between the point's normal direction and the current viewing angle is calculated. If the cosine of this angle is less than a set threshold (e.g., 0.3), the point is considered to be non-oriented relative to the viewing angle, indicating an occlusion tendency. The curvature of the neighborhood surrounding the point (e.g., within 5 mm) is calculated, and the maximum curvature value within this neighborhood is calculated. If this value exceeds a set curvature threshold (e.g., 0.1), the area is considered to be a structural mutation region. If both of the above conditions are met, the point is marked as a potential shadow point; shadow area clustering and coordinate extraction: all potential shadow points are spatially clustered, and after removing discrete points, the minimum bounding box coordinate range of each cluster is extracted to form the shadow area coordinate set for this perspective under the section; multi-view fusion evaluation: repeat the local occlusion factor calculation and shadow area clustering and coordinate extraction steps to evaluate all candidate perspectives, and count the occlusion frequency of each point under each perspective. If a point is marked as a potential shadow point in more than half of the perspectives, it is marked as a "high occlusion risk area" and its imaging compensation is given priority in the subsequent multi-view configuration; output results: finally, the shadow area coordinate set and the global high occlusion point coordinate set under each candidate perspective are output, providing a basis for occlusion area prediction for image acquisition path planning, lighting compensation adjustment, and image stitching processing. This step method has clear input conditions, logical judgment process, and output structure. It can effectively predict the visual blind spots caused by the complex cross-sectional structure of aluminum profiles and provide support for image acquisition configuration optimization. This technical solution takes into account the relationship between the point cloud normal direction, curvature information and observation direction, and has universal adaptability and good engineering feasibility.

[0045] In the present invention, the process of defect boundary extraction and image segmentation includes the following detailed steps:

[0046] Image acquisition and preprocessing: Multiple line scan cameras first capture raw images of the aluminum profile surface. Geometric correction and illumination normalization are performed on the multi-view images. Grayscale equalization and Gaussian filtering are then used to preprocess the images to reduce surface texture interference and enhance contrast in defect areas. Defect candidate regions are generated by encoding features in the multi-view images using a deep learning feature extraction module. A detection algorithm based on an improved YOLOv5 network is then used to detect suspected defects in the images and generate initial candidate boxes as suspected defect regions. This process extracts multi-scale feature maps through convolutional layers and incorporates an attention mechanism module to improve the recognition of low-contrast defects.

[0047] Region enhancement and segmentation preparation: For the detected defect candidate areas, the edge clarity is improved through adaptive gradient enhancement, and the image in the candidate area is locally normalized. The image pyramid method is used to perform multi-resolution processing on the defect area to provide redundant feature support for subsequent boundary extraction;

[0048] Precise boundary extraction: In the enhanced defect image area, the Canny edge detection algorithm is first used to locate the edge lines of grayscale mutations in the image. Morphological operations (including erosion, dilation, and edge closure) are then combined to remove false edges. Subsequently, a contour tracking algorithm is used to reconstruct the edge curve to form a closed contour and obtain the defect boundary line.

[0049] Image segmentation and label generation: Based on the closed contour area, the corresponding binary mask image is generated and image segmentation is performed. For each defect area, the system performs pixel-level superposition segmentation with the original image to extract a clear defect area image and generate corresponding label information, including defect number, area, location coordinates, etc.

[0050] Post-processing and anomaly removal: For each segmented defect area, the system calculates its area, aspect ratio, boundary complexity, grayscale gradient intensity and other indicators. If the characteristic value of the defect area does not meet the set threshold (for example, the area is too small or the contrast is insufficient), it will be removed to reduce false detection and improve the overall detection accuracy.

[0051] Through the above steps, the system can accurately locate the defect area from the original image, extract the boundary and complete pixel-level image segmentation, effectively supporting subsequent defect classification and grade assessment, and ensuring the accuracy and robustness of defect identification.

[0052] In order to achieve complete imaging of the entire aluminum profile surface, the present invention proposes a multi-view image stitching and registration method, which specifically includes the following implementation steps:

[0053] Multi-view image acquisition uses linear array cameras installed at multiple angles to synchronously capture the moving aluminum profile. Each camera captures a continuous sequence of image frames through encoder trigger signals to ensure image consistency in time and space, avoiding data overlap or frame loss.

[0054] Image preprocessing and distortion correction: Calibrate the camera's intrinsic and extrinsic parameters for each image, using the Zhang Zhengyou calibration method to obtain lens distortion parameters, and perform geometric correction on the image to eliminate image curvature caused by lens distortion. Further normalize the image grayscale value to reduce the impact of uneven lighting on stitching quality.

[0055] Image feature point extraction: Select the edge overlapping area of ​​each group of adjacent images, extract key points using the scale-invariant feature transform (SIFT) algorithm, and combine it with fast corner detection (such as FAST) to enhance the feature density of edge texture areas and improve matching accuracy;

[0056] Image registration and parameter solution: Use the RANSAC algorithm to remove abnormalities from the matched feature point pairs, solve the affine transformation matrix or perspective projection matrix, and achieve spatial alignment between the images. The transformation matrix is ​​used to uniformly map images from multiple perspectives to a common reference coordinate system.

[0057] Image fusion and stitching: After completing the geometric alignment of the images, a multi-exposure weighted fusion method is used to perform grayscale equalization and edge smoothing on the overlapping areas of the images to prevent sudden brightness changes at the seams. Finally, through weighted image superposition, the images from multiple perspectives are stitched together to generate a continuous image strip covering the entire surface of the aluminum profile.

[0058] Complete image generation and post-processing: The stitched images are uniformly cropped to a standard size, black edges or invalid pixel areas are removed, and a high-resolution, seamless, complete surface image is output, providing high-quality image input for subsequent defect detection algorithms.

[0059] Through the above steps, the system can efficiently and stably complete the registration and fusion processing of multi-view images, solving the problems of image breakage, ghosting or misalignment caused by stitching errors or image distortion in traditional methods, and ensuring the accuracy and continuity of the complete image.

[0060] In this invention, in order to realize the automatic recognition of aluminum profile surface defects, the system adopts the improved YOLOv5 target detection model based on deep learning for defect recognition. The detailed implementation process is as follows:

[0061] Training data construction: collect surface images of aluminum profiles containing a variety of typical defects (such as scratches, dents, cracks, bubbles, corrosion spots, etc.). Use manual annotation tools to annotate the bounding box of each defect to generate a training dataset in YOLO format. The annotation content includes category labels, location information (center point coordinates, width and height), etc.

[0062] Model structure design. The selected model is based on the YOLOv5 framework. The backbone network uses CSPDarknet as the feature extractor (Backbone). The cross-stage partial connection mechanism is used to improve the deep semantic extraction capability. The FPN and PAN path enhancers are introduced into the feature pyramid structure to improve the detection capability of small-sized defects. In the detection head, feature maps of different scales are output to cover various defect targets with significant size differences.

[0063] Module optimization and improvement: To improve the recognition of low-contrast subtle defects, the model introduces an attention mechanism module (such as CBAM or SE module) to enhance the feature response in the spatial and channel dimensions. In addition, the CIoU loss function is introduced in the loss function to optimize the bounding box regression effect and reduce the detection box offset.

[0064] Training process and parameter configuration: Model training uses a transfer learning strategy, initially loading the pre-trained weights from the COCO dataset for fine-tuning. The Adam optimizer is used during training, with an initial learning rate of 0.001, a batch size of 16, and 300 training epochs. Random data augmentation (such as random cropping, rotation, flipping, and lighting perturbations) is used during training to improve model generalization.

[0065] In the inference and detection process, during the actual detection phase, the model inputs the fully assembled aluminum profile surface image. The model output includes the predicted category, location coordinates, and confidence score for each defect. Valid detection results are then filtered based on a set confidence threshold (e.g., 0.3), and the image segmentation module is used to further extract defect contours and generate labels.

[0066] Evaluation and output: The defect recognition model achieved a mean average precision (mAP) of over 90% on the validation set, capable of stably identifying various types of surface defects and providing clear location, area, shape, and classification labels for each defect target, meeting industrial-grade detection accuracy requirements.

[0067] In summary, the present invention explicitly adopts the YOLOv5 deep neural network as the core defect recognition model, and combines attention enhancement mechanism, CIoU regression optimization, transfer learning and other methods to achieve high robustness and high precision automatic detection capability of aluminum profile surface defects, which meets the requirements of modern intelligent manufacturing for the feasibility and practicality of detection algorithms.

[0068] In the present invention, the defect severity scoring module is used to quantitatively grade the detected surface defects of aluminum profiles. The scoring is based on indicators such as the defect area, shape characteristics, grayscale contrast, edge clarity, and location. The specific scoring process is as follows:

[0069] Feature extraction. For each detected defect area, the system automatically extracts the following feature indicators: Defect area: Counting the number of pixels and converting it into physical dimensions; Defect shape: Calculating geometric features such as aspect ratio, roundness, and edge complexity; Grayscale contrast: The average grayscale difference between the defect area and the surrounding background area; Edge clarity: Using a gradient operator to calculate the average gradient strength of the edge; Defect location: Marking whether it is in a critical functional area or a crack-prone edge area;

[0070] Indicator normalization processing: All characteristic values ​​are standardized and converted into scores between 0 and 1. Taking the defect area as an example, the minimum acceptable defect area is set as the threshold, and the excess area is scored proportionally; the grayscale contrast is linearly converted based on the maximum grayscale difference of 100.

[0071] A weighted scoring model is constructed, and the following weighted scoring model is used to calculate the severity of defects: Severity score = A × area score + B × contrast score + C × edge clarity score + D × shape score + E × position score, where the weight AE is determined based on actual process experience or expert system evaluation. The typical settings are as follows: area weight is 0.3, contrast is 0.25, edge clarity is 0.2, shape is 0.15, and position is 0.1;

[0072] Score classification and grading standards. According to the final score, defects are divided into three categories: minor defects: score between 0.00-0.39; moderate defects: score between 0.40-0.69; severe defects: score between 0.70-1.00;

[0073] Result output and annotation: Each defect is labeled with its category, severity level and specific score in the image, and output to the result form for subsequent quality analysis and sorting system call;

[0074] Through the above scoring process, the system can comprehensively analyze various image parameters to quantify the impact of each defect, thereby achieving scientific and objective defect level determination and effectively supporting quality control and grading processing at industrial sites.

[0075] In this paper, in order to evaluate the performance of the defect boundary segmentation module, the image semantic segmentation constant intersection union is used as the core indicator, supplemented by precision, recall rate and F1 value for comprehensive evaluation. The specific implementation process is as follows:

[0076] A manually annotated benchmark dataset was constructed. Representative defect images of various types were selected from actual production image samples. Professional annotators used image annotation tools to accurately delineate the defect boundaries and generate manually annotated real masks as a standard reference.

[0077] The model outputs mask extraction, and the defect detection and segmentation modules process the same image and output the model-predicted mask image, which has a one-to-one correspondence with the real mask at the pixel level;

[0078] The intersection-over-union (IoU) calculation method calculates the area of ​​the intersection and the area of ​​the union of each pair of predicted and true masks. IoU is defined as the ratio of the two: IoU = the area of ​​the intersection of the predicted and true areas / the area of ​​the union. When IoU is higher than a preset threshold (for example, 0.5), the prediction is considered a valid and correct segmentation.

[0079] Statistical evaluation indicators are extracted, including: accuracy: the proportion of areas predicted as defects by the model that are actually defects; recall: the proportion of all areas of real defects that are correctly identified by the model; F1 value: the harmonic mean of accuracy and recall, used to comprehensively evaluate the segmentation performance of the model; average IoU: the average IoU of multiple images, reflecting the overall segmentation accuracy;

[0080] The system calculates the average IoU and F1 values ​​across the entire test set as performance indicators for the defect boundary segmentation module. For example, in the test set, the proposed system achieved an average IoU of 0.86 for scratch defects and 0.82 for pit defects. The F1 values ​​were generally above 0.88, indicating high accuracy in model boundary extraction.

[0081] Threshold adjustment and model iteration: If the IoU of some types of defects is too low, the system can automatically adjust edge-sensitive parameters or image enhancement strategies based on error heat map analysis to further iterate and optimize the model structure and parameter configuration;

[0082] Through the above-mentioned segmentation accuracy evaluation mechanism, the defect boundary extraction process is ensured to have quantitative standards and comparable performance, thereby improving the stability and reliability of the overall detection system and meeting the industrial quality control accuracy requirements.

[0083] To address issues such as multiple occlusion areas and single-view imaging blind spots in complex cross-section aluminum profiles, the system introduces a multi-view dynamic optimization model based on an occlusion rate evaluation function to achieve automatic optimization and scheduling of camera view configurations. The specific algorithm model and implementation process are as follows:

[0084] To prepare the input data, the system first completes the 3D point cloud reconstruction of the target aluminum profile cross section, calculates the normal vector, local curvature, and spatial distribution characteristics of each surface point, and defines a set of candidate camera view angles (e.g., constructing multiple observation direction vectors from 0 to 180 degrees at angular intervals).

[0085] For each candidate viewpoint, the visibility analysis model traverses all surface points and calculates the cosine of the angle between the point's normal direction and the viewpoint direction. When this value falls below a set threshold (e.g., 0.3), the point is considered invisible. The system further records the proportion of all invisible points at that viewpoint, defining this as the "occlusion rate" for that viewpoint.

[0086] The optimization objective function is constructed, and the objective function is defined as minimizing the overall occlusion rate under the view angle combination. At the same time, the overlap between each view angle image and the shooting redundancy are considered. The optimization model objectives are as follows: minimize the global occlusion rate (the cumulative frequency of all points being occluded); limit the overlap area between adjacent view angle images to no less than 30% to ensure image stitching continuity; and control the number of view angles to reduce system complexity and imaging time.

[0087] The system uses a combined optimization strategy based on heuristic search and genetic algorithms to solve the multi-perspective combination problem. First, a greedy algorithm is used to quickly generate a feasible initial solution (e.g., taking a perspective every 60°). Then, the genetic algorithm is used to iterate and evolve the perspective combination over multiple rounds. Each generation of individuals represents a perspective set, and the fitness function is based on the weighted score of the objective function, ultimately converging to the optimal perspective configuration.

[0088] Output the optimal view angle set, including the selected minimum necessary view angles, the layout angle and number of each camera, and the occlusion point distribution map under this configuration for occlusion hotspot verification;

[0089] Dynamic adjustment mechanism: During the inspection process, if the system detects a drop in the defect recognition rate in a local area, it will re-evaluate the occlusion risk of that area under the current viewing angle and trigger a re-adjustment of the local viewing angle to ensure overall inspection continuity and minimize blind spots.

[0090] Through the above-mentioned optimization algorithm model, the system can realize automatic camera perspective layout for any cross-sectional structure, effectively improve the integrity and defect coverage of image acquisition, enhance the accuracy of multi-perspective image fusion, and meet the needs of high-precision defect detection in complex industrial scenarios.

[0091] To achieve accurate control of the 3D placement of multi-view cameras, the system uses 3D inverse calibration technology to reversely calculate the precise coordinate position (x, y, z) of each camera in 3D space and its attitude parameters (pitch, yaw, and roll). The specific steps of this process are as follows:

[0092] Calibration plate layout and data acquisition: A standard checkerboard calibration plate is placed on the image acquisition system work platform. The calibration plate's plane pose is known and has an accurate three-dimensional coordinate system. Each camera takes a static image of the calibration plate to obtain a calibration image sequence containing multiple corner point images.

[0093] Image corner extraction: A sub-pixel corner detection algorithm is used for each calibration image to extract the coordinates of the chessboard corners. Using the "findChessboardCorners" and "cornerSubPix" functions in OpenCV, the precise image point coordinates and their correspondence in the calibration board coordinate system can be obtained;

[0094] Internal parameter calibration: perform internal parameter calibration on each camera to solve the focal length, principal point, and distortion coefficient parameters to form the camera internal parameter matrix. This step ensures the accuracy of the subsequent pose inverse solution;

[0095] To solve the pose inverse problem, use the PnP (Perspective-n-Point) solution method to match the 3D points of the calibration plate with the points on the image plane. Then, use the least squares method or RANSAC-PnP algorithm to solve the pose transformation matrix of the camera relative to the calibration plate coordinate system. This transformation includes: the position coordinates (x, y, z) of the camera in 3D space; the rotation angles expressed in Euler angles, including the roll angle around the x-axis, the pitch angle around the y-axis, and the yaw angle around the z-axis.

[0096] Coordinate system conversion and unification: transform the pose matrix of each camera from the calibration plate coordinate system to the system's unified reference coordinate system (such as the reference edge of the aluminum profile) to ensure the consistency of the spatial pose of each camera; perform the conversion from the rotation matrix to Euler angles when necessary to clarify the meaning of each angle in physical space;

[0097] Error assessment and calibration optimization: reprojection error analysis is performed on all camera calibration results. If the reprojection error is greater than a set threshold (such as 0.5 pixels), the system automatically prompts you to recapture the image or fine-tune the camera position to ensure accuracy requirements.

[0098] Ultimately, the position and pose information of each camera in space will be saved as a six-dimensional parameter vector (3D position + 3D attitude) for the system to use for image registration, view planning, and occlusion assessment.

[0099] Through the above-mentioned decalibration steps, the system can achieve high-precision spatial layout reconstruction of the multi-camera imaging system, providing an accurate geometric basis for image stitching, defect location and path compensation.

[0100] like Figure 2As shown, an automatic detection system for aluminum profile surface defects based on image recognition is also provided, which is used to implement the steps of the automatic detection method for aluminum profile surface defects based on image recognition. The system includes:

[0101] The data acquisition and preprocessing module is used to obtain the 3D geometric data of the aluminum profile section through a 3D scanning device, extract the geometric feature parameters required for candidate observation angles and coverage calculations, and if the cross-sectional shape contains grooves or curved surface structures, mark the spatial coordinate range corresponding to the area of ​​the shadow region to obtain the cross-sectional geometric feature vector and the coordinate set of the shadow region;

[0102] The image construction and defect recognition module is used to obtain a spatially unified complete surface image based on the cross-sectional geometric feature vector. The defect detection algorithm is used to extract surface abnormality features and defect boundary segmentation results from the complete surface image. If defect features are detected, the defect type label is classified and the severity level is evaluated to obtain an inspection report including the defect location coordinates, defect type label and severity level.

[0103] The intelligent control module is used to adjust the camera illumination intensity parameters through the illumination compensation coefficient according to the defect location coordinates and defect type labels in the inspection report. If the defect boundary segmentation accuracy of the area is lower than the preset threshold, the candidate observation angles and view switching frequency are updated to obtain the optimized multi-view configuration scheme and trigger timing table.

[0104] The overall design of the system follows a modular architecture to ensure efficient collaboration between data acquisition, image analysis and system self-adjustment processes. First, the data acquisition and preprocessing module acquires high-precision three-dimensional point cloud data through a laser profiler or structured light scanning device. The system calculates the normal direction, curvature and depth difference of each point through point cloud analysis methods, thereby extracting key geometric parameters such as curvature change rate, normal direction distribution and groove depth. Combined with perspective occlusion simulation, the system automatically identifies shadow areas where imaging blind spots may exist, and outputs their spatial coordinates as the shadow area coordinate set. Based on the above features, the module also uses coverage evaluation methods to generate an initial set of candidate observation angles for subsequent image planning.

[0105] Subsequently, the image construction and defect recognition module automatically selects the imaging angle and camera parameter configuration based on the cross-sectional geometric feature vector. Through multi-angle image acquisition and registration, it constructs a complete surface image with unified space and continuous structure. Based on this, the module uses a convolutional neural network model to identify features such as brightness changes, texture discontinuities, or geometric abrupt changes in the image. It automatically labels defect types (such as scratches, bubbles, and indentations) and categorizes the severity of the defects based on quantitative indicators such as area, length, and contrast. The final inspection report includes the precise spatial coordinates of the defects, the defect type label, and the resulting grade assessment.

[0106] The intelligent control module dynamically adjusts the imaging system strategy based on inspection report results. If the defect recognition accuracy in a particular area falls below a threshold (e.g., 85%), the system analyzes the image quality of that area, estimates the illumination compensation coefficient using brightness deviation and structural boundary ambiguity, and automatically adjusts the intensity and direction of the LED or laser light source. Simultaneously, the module recalculates the optimal observation angle combination and switching frequency based on image redundancy and blind spot assessments, and updates the camera trigger timing table to achieve higher-quality imaging within the same time window for the next inspection.

[0107] The system constructed in this implementation integrates 3D acquisition, defect detection, and strategy optimization into a closed-loop control process through a data-driven approach, significantly enhancing the adaptability and intelligence of the aluminum profile defect detection system. Compared to traditional solutions based on fixed viewing angles and manual analysis, this system not only improves detection coverage and recognition accuracy, but also offers efficient data management and imaging task scheduling capabilities, making it particularly suitable for production environments with a wide variety of products and complex cross-sections that frequently change.

[0108] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.

Claims

1. An automatic detection method for aluminum profile surface defects based on image recognition, characterized in that: The method comprises: The 3D geometric data of the aluminum profile section is acquired through a 3D scanning device. The geometric feature parameters required for candidate observation angles and coverage calculations are extracted. If the cross-sectional shape contains grooves or curved surface structures, the spatial coordinate range corresponding to the area of ​​the shadow region is marked to obtain the cross-sectional geometric feature vector and the coordinate set of the shadow region. Based on the cross-sectional geometric feature vectors, a spatially unified complete surface image is obtained. From this complete surface image, a defect detection algorithm is used to extract surface abnormality features and defect boundary segmentation results. If defect features are detected, defect type label classification and severity level assessment are performed to obtain an inspection report including defect location coordinates, defect type label, and severity level. Based on the defect location coordinates and defect type labels in the inspection report, the camera illumination intensity parameters are adjusted using the illumination compensation coefficient. If the defect boundary segmentation accuracy of the area is lower than the preset threshold, the candidate observation angles and view switching frequency are updated to obtain an optimized multi-view configuration scheme and trigger timing table. According to the cross-sectional geometric eigenvectors, a complete surface image with unified space is obtained, including: Based on the cross-sectional geometric feature vectors, a view angle optimization algorithm is used to calculate the coverage of candidate observation angles. If the shadow area under a certain observation angle exceeds a preset threshold, the camera position parameters and angle adjustment strategy are adjusted to determine the optimal multi-view configuration scheme and the corresponding camera 3D spatial coordinate position and tilt angle parameters. According to the cross-sectional geometric eigenvectors, obtaining a spatially unified complete surface image also includes: Through the optimal multi-view configuration scheme, the image acquisition parameter settings under different candidate observation angles are obtained, and the overlapping area detection results between adjacent view angles are detected. If there is an overlapping area, the spatial mapping relationship between the view angles is established to obtain the registration reference points and multi-view fusion weights of the multi-view image.

2. The method for automatically detecting surface defects of aluminum profiles based on image recognition according to claim 1, characterized in that: The step of obtaining a spatially unified complete surface image based on the cross-sectional geometric feature vector further comprises: Based on the aluminum profile product specifications and the current production line speed, a dynamic timing calculation module is used to analyze the time interval between products passing through the inspection area. If the production rhythm changes, the viewing angle switching frequency, camera trigger frequency, and exposure time parameters are adjusted to determine the synchronous trigger timing table and image acquisition time window.

3. The method for automatically detecting surface defects of aluminum profiles based on image recognition according to claim 2, characterized in that: The step of obtaining a spatially unified complete surface image based on the cross-sectional geometric feature vector further comprises: The coordinated work of multiple cameras is controlled by a synchronous triggering schedule to obtain image sequences of the same product section at different candidate observation angles. If a product position offset is detected within the image acquisition time window, the position compensation mechanism is activated to obtain a time-synchronized multi-view image dataset.

4. The method for automatically detecting surface defects of aluminum profiles based on image recognition according to claim 3, characterized in that: The step of obtaining a spatially unified complete surface image based on the cross-sectional geometric feature vector further comprises: Based on the time-synchronized multi-view image dataset and multi-view fusion weights, image registration technology is used to spatially align images from different angles. If the registration accuracy is lower than the registration accuracy threshold, the registration reference points are recalculated to obtain a spatially unified complete surface image.

5. The method for automatically detecting surface defects of aluminum profiles based on image recognition according to claim 1, characterized in that: The three-dimensional scanning device is a laser three-dimensional profile scanner or a structured light scanning system, which is used to improve the accuracy of geometric data acquisition of complex cross-sectional structures.

6. The method for automatically detecting surface defects of aluminum profiles based on image recognition according to claim 1, characterized in that: The geometric characteristic parameters include curvature change rate, normal direction distribution and groove depth index.

7. The method for automatically detecting surface defects of aluminum profiles based on image recognition according to claim 1, characterized in that: The shadow area coordinate set is automatically generated by calculating the local viewing angle occlusion degree and the angle between the surface normal direction.

8. An automatic detection system for aluminum profile surface defects based on image recognition, used to implement the steps of the automatic detection method for aluminum profile surface defects based on image recognition according to any one of claims 1 to 7, characterized in that: The system comprises: The data acquisition and preprocessing module is used to obtain the 3D geometric data of the aluminum profile section through a 3D scanning device, extract the geometric feature parameters required for candidate observation angles and coverage calculations, and if the cross-sectional shape contains grooves or curved surface structures, mark the spatial coordinate range corresponding to the area of ​​the shadow region to obtain the cross-sectional geometric feature vector and the coordinate set of the shadow region; The image construction and defect recognition module is used to obtain a spatially unified complete surface image based on the cross-sectional geometric feature vector. The defect detection algorithm is used to extract surface abnormality features and defect boundary segmentation results from the complete surface image. If defect features are detected, the defect type label is classified and the severity level is evaluated to obtain an inspection report including the defect location coordinates, defect type label and severity level. The intelligent control module is used to adjust the camera illumination intensity parameters through the illumination compensation coefficient according to the defect location coordinates and defect type labels in the inspection report. If the defect boundary segmentation accuracy of the area is lower than the preset threshold, the candidate observation angles and view switching frequency are updated to obtain the optimized multi-view configuration scheme and trigger timing table.

Citation Information

Patent Citations

  • Multi-camera image acquisition method and device

    CN113888408A

  • Cable head defect intelligent detection system

    CN117455843A

  • Die-casting alloy workpiece defect detection method and system based on visual identification

    CN118130477A

  • Internet intelligent manufacturing service platform

    CN118261439A