Aluminum alloy surface defect identification method and system based on image identification

Through image recognition-based methods, including image acquisition, preprocessing, feature extraction and GNN-GAN model recognition, the problems of traditional manual detection are solved, and efficient and accurate identification of surface defects of aluminum alloys are achieved, which improves product quality and yield rate.

CN120339277AInactive Publication Date: 2025-07-18BEIJING JUJIA MASCH CO LTD

Patent Information

Application Number
CN202510812260.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-18
Publication Date
2025-07-18
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional artificial visual inspection methods are inefficient and have poor accuracy, making them difficult to meet the needs of large-scale, high-precision aluminum alloy surface defect identification in modern industries, and are easily affected by subjective factors of the detector.

Method used

Image recognition-based methods are adopted, including image acquisition, preprocessing, feature extraction, feature selection and GNN-GAN model recognition, to identify defect types, locations and sizes of aluminum alloy surfaces.

Benefits of technology

It improves the efficiency and accuracy of defect identification, reduces manual inspection costs, reduces the leakage inspection rate, ensures the quality stability of aluminum alloy products, and improves the product yield rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120339277A_ABST
    Figure CN120339277A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of aluminum alloy surface detection, and discloses an aluminum alloy surface defect recognition method and system based on image recognition, and the method comprises the steps: carrying out the image collection of an aluminum alloy surface, and obtaining an original image of the aluminum alloy surface; preprocessing the collected original image to obtain a preprocessed image; performing feature extraction on the preprocessed image, and extracting geometric features, texture features and color features of defects; screening the extracted features by adopting a feature selection method based on the combination of a genetic algorithm and a support vector machine to obtain a feature subset; inputting the feature subset into a GNN-GAN model, outputting the type, position and size of a defect according to a defect identification result, and marking and recording the defect; according to the invention, the labor cost and the time cost required by manual detection are reduced, the product rework and the rejection rate caused by missing detection are reduced, and the quality stability of the aluminum alloy product is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of aluminum alloy surface detection, and specifically relates to a method and system for identifying aluminum alloy surface defects based on image recognition. Background Art

[0002] Due to its light weight, high strength and other characteristics, aluminum alloy materials are widely used in high-end fields such as aerospace, automobile manufacturing, and electronic equipment. However, during the production and processing of aluminum alloys, surface defects such as cracks, depressions, scratches, and inclusions are likely to occur. These defects not only affect the appearance of the product, but also significantly reduce the mechanical properties and corrosion resistance of the material. In severe cases, they may even pose safety hazards. Therefore, it is crucial to accurately identify aluminum alloy surface defects. Traditional manual visual inspection methods are inefficient, inaccurate, and easily affected by the subjective factors of inspectors, making it difficult to meet the large-scale and high-precision production requirements of modern industry. Summary of the Invention

[0003] The purpose of the present invention is to solve the above problems and design a method and system for identifying aluminum alloy surface defects based on image recognition.

[0004] The first aspect of the present invention provides a method and system for identifying aluminum alloy surface defects based on image recognition. The method includes the following steps: Collect images of the aluminum alloy surface to obtain the original image of the aluminum alloy surface; Preprocess the collected original image, including image denoising, image enhancement, and image segmentation, to obtain the preprocessed image; Extract features from the preprocessed image, extracting geometric features, texture features, and color features of the defects; Adopt a feature selection method combining genetic algorithm and support vector machine to screen the extracted features, remove redundant features and irrelevant features, and obtain a feature subset; Input the feature subset into the GNN-GAN model, and according to the defect recognition result, output the type, position, and size of the defect, and mark and record the defect.

[0005] Optionally, in the first implementation manner of the first aspect of the present invention, the preprocessing of the collected original image, including image denoising, image enhancement, and image segmentation, to obtain the preprocessed image, includes: Traverse each pixel point of the original image. Taking the current pixel point as the center, sort all the pixel values within the window in ascending order of gray value, and take the middle value as the new value of the current pixel point to remove noise; Divide the denoised image into multiple sub-blocks, and perform histogram equalization on each sub-block respectively to enhance the local contrast of the image; Calculate the grayscale histogram of the enhanced image, use the Otsu algorithm to find the threshold that maximizes the between-class variance, divide the image into a defect region and a background, and obtain a binary image; Perform morphological processing on the binary image, use the Canny edge detection algorithm to extract the edge contour of the defect, and combine the morphological processing results to obtain a preprocessed image.

[0006] Optionally, in the second implementation manner of the first aspect of the present invention, the feature extraction of the preprocessed image, extracting the geometric features, texture features and color features of the defect, includes: Calculate the number of pixels in the defect region of the preprocessed image to obtain the area, calculate the pixel length of the defect edge contour to obtain the perimeter, obtain the shape factor through the area and perimeter, and then calculate the ratio of the major axis to the minor axis of the defect region to obtain the eccentricity, and integrate to obtain geometric features; Adopt the gray-level co-occurrence matrix and local binary pattern to extract the texture features of the preprocessed image; Extract the statistics of the R, G, and B channels of the preprocessed image respectively, convert the RGB image to an HSV image, and extract the statistics of the H, S, and V components to obtain color features.

[0007] Optionally, in the third implementation manner of the first aspect of the present invention, the adopting the gray-level co-occurrence matrix and local binary pattern to extract the texture features of the preprocessed image includes: Select four directions of 0°, 45°, 90°, and 135° through the gray-level co-occurrence matrix, calculate the energy, contrast, entropy and correlation of the preprocessed image, adopt the uniform LBP operator, compare the neighborhood gray value of each pixel with the central pixel value to generate a binary code, count the LBP histogram, and combine the gray-level co-occurrence matrix results to obtain texture features.

[0008] Optionally, in the fourth implementation manner of the first aspect of the present invention, the adopting a feature selection method combining a genetic algorithm and a support vector machine to screen the extracted features, removing redundant features and irrelevant features, and obtaining a feature subset, includes: Initialize the genetic algorithm population, set the population size to 50, set the number of iterations to 100, adopt binary coding, and each gene bit represents whether a feature is selected; Use the classification accuracy of the support vector machine as the fitness function, and adopt the radial basis function as the kernel function of the SVM; Decode each individual to obtain the corresponding feature subset, use the support vector machine to classify and evaluate the feature subset, and calculate the fitness value; Adopt the roulette wheel selection method to calculate the probability of each individual being selected according to its fitness value; The single-point crossover method is used to perform crossover operations on the selected individuals with a crossover probability of 0.9 to generate new individuals; The basic bit mutation method is used to flip the gene bits of the individuals with a mutation probability of 0.05 to introduce new feature combinations; A new generation of population is generated according to the selection, crossover, and mutation operations until the maximum number of iterations is reached. The individual with the highest fitness value is selected as the optimal feature subset, and redundant and irrelevant features are removed.

[0009] Optionally, in the fifth implementation manner of the first aspect of the present invention, the inputting the feature subset into the GNN-GAN model, and according to the defect recognition result, outputting the type, position, and size of the defect, and marking and recording the defect includes: The feature subset after feature selection is input into the GNN-GAN model, and the image in the feature subset is converted into a graph structure through superpixel segmentation; First, the GNN module is used to extract the spatial-texture joint features of the defect, then the generator of the GAN module is used to generate the simulated features of the defect, and the discriminator discriminates between the real features and the simulated features; The extracted joint features are input into the classification network, and the probability distribution of each defect type is output through multiple fully connected layers; An independent branch is used to predict the coordinates of the upper left corner and the lower right corner of the circumscribed rectangle of the defect, and sub-pixel level positioning is performed through the coordinate regression algorithm; According to the positioning coordinates and the actual resolution of the image, the width, height, and area of the defect are calculated, and the type, position, and size of the defect are output.

[0010] Optionally, in the sixth implementation manner of the first aspect of the present invention, the extracting the spatial-texture joint features of the defect by the GNN module first includes: The graph convolutional layer of the GNN module is used to aggregate the node neighborhood information, capture the local correlation features between the defect area and the surrounding background, then the graph attention layer is used to strengthen the weights of the key nodes, focus on the long-distance dependence relationship of the defect edge and the irregular area, and finally a vector representation containing the spatial-texture joint features is generated through global pooling.

[0011] The second aspect of the present invention provides an aluminum alloy surface defect recognition method and system based on image recognition. The system includes: An image acquisition module for acquiring an image of the aluminum alloy surface to obtain the original image of the aluminum alloy surface; An image preprocessing module for preprocessing the acquired original image, including image denoising, image enhancement, and image segmentation, to obtain the preprocessed image; A feature extraction module for extracting features from the preprocessed image, and extracting the geometric features, texture features, and color features of the defect; A feature selection module, which is used to screen the extracted features by adopting a feature selection method combining a genetic algorithm and a support vector machine, remove redundant features and irrelevant features, and obtain a feature subset. A defect recognition module, which is used to input the feature subset into the GNN-GAN model, and according to the defect recognition result, output the type, position and size of the defect, and mark and record the defect.

[0012] In a third aspect of the present invention, there is provided an aluminum alloy surface defect recognition device based on image recognition. The aluminum alloy surface defect recognition device based on image recognition includes a memory and at least one processor, and instructions are stored in the memory; the at least one processor calls the instructions in the memory to enable the aluminum alloy surface defect recognition device based on image recognition to execute each step of the aluminum alloy surface defect recognition method described in any one of the above.

[0013] In a fourth aspect of the present invention, there is provided a computer-readable storage medium, and instructions are stored on the computer-readable storage medium. When the instructions are executed by a processor, each step of the aluminum alloy surface defect recognition method described in any one of the above is implemented.

[0014] In the technical solution provided by the present invention, image acquisition is performed on the aluminum alloy surface to obtain the original image of the aluminum alloy surface; preprocessing is performed on the collected original image, including image denoising, image enhancement and image segmentation, to obtain the preprocessed image; feature extraction is performed on the preprocessed image to extract the geometric features, texture features and color features of the defect; a feature selection method combining a genetic algorithm and a support vector machine is adopted to screen the extracted features, remove redundant features and irrelevant features, and obtain a feature subset; the feature subset is input into the GNN-GAN model, and according to the defect recognition result, the type, position and size of the defect are output, and the defect is marked and recorded; the present invention effectively preprocesses the aluminum alloy surface image, improves the quality of the image and the segmentation accuracy of the defect area, selects the feature subset that can best represent the defect features, reduces the dimension of the feature space, improves the efficiency and accuracy of defect recognition, and the defect is recognized by the model without manual intervention, reducing the labor cost and time cost required for manual detection, and at the same time reducing the product rework and scrap rate caused by missed detection. The high-precision defect recognition ability ensures the quality stability of aluminum alloy products, helps enterprises improve the product yield rate, and has high practical value and application prospect. Description of the Drawings

[0015] By reading the following detailed description of the preferred embodiments, various other advantages and benefits will become clear to those of ordinary skill in the art. The drawings are only for the purpose of showing the preferred embodiments and are not considered to be a limitation of the present invention.

[0016] Figure 1 Flowchart of the aluminum alloy surface defect recognition method based on image recognition provided by an embodiment of the present invention; Figure 2 Structural schematic diagram of the aluminum alloy surface defect recognition system based on image recognition provided by an embodiment of the present invention; Figure 3 Structural schematic diagram of the aluminum alloy surface defect recognition device based on image recognition provided by an embodiment of the present invention. Detailed implementation manners

[0017] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above drawings are used to distinguish similar objects and do not necessarily describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments described herein can be implemented in an order different from that shown or described herein. In addition, the terms "comprising" or "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, device, product, or equipment that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or are inherent to these processes, methods, products, or equipment.

[0018] For ease of understanding, the specific process of the embodiments of the present invention will be described below. Please refer to Figure 1 The flowchart of the aluminum alloy surface defect recognition method based on image recognition provided by an embodiment of the present invention. The method specifically includes the following steps: Step 101: Collect images of the aluminum alloy surface to obtain the original image of the aluminum alloy surface; In this embodiment, a high-resolution industrial camera is selected. The camera has the imaging ability of one million pixels, and the resolution is set to 4096×3072. It can clearly capture the smallest details on the aluminum alloy surface, such as 0.1mm×0.1mm, meeting the requirements for image clarity in subsequent defect recognition. The camera can achieve automatic focusing to ensure clear images can be obtained at different distances; An LED ring light source with uniform distribution is arranged around the camera to form 360-degree non-dead-angle lighting. The color temperature of the light source is set to 6500K to simulate a natural light environment and reduce color distortion. The light intensity of the light source is monitored in real time by a light intensity sensor and controlled at 1000 lux to avoid reflection caused by too strong light or blurred details caused by too weak light; Build a stable mechanical platform for fixing aluminum alloy workpieces. The platform is equipped with high-precision guide rails and servo motors, which can achieve uniform movement of the workpieces. The movement speed is controlled at 50 mm / s to ensure that the camera can continuously and evenly collect images. The acquisition process is carried out in a closed laboratory. The laboratory temperature is controlled at 25°C ± 2°C, and the humidity is controlled at 50% ± 5% to avoid the influence of temperature and humidity changes on the image acquisition equipment and the surface state of the aluminum alloy. Before image acquisition, clean the surface of the aluminum alloy workpiece. First, use high-pressure air to blow off the dust and debris on the surface, and then wipe the surface with a soft cloth dipped in anhydrous ethanol to remove pollutants such as oil stains and fingerprints, ensuring that the original images collected can truly reflect the actual condition of the aluminum alloy surface.

[0019] Step 102: Preprocess the collected original images, including image denoising, image enhancement, and image segmentation, to obtain preprocessed images. In this embodiment, traverse each pixel point of the original image. Taking the current pixel point as the center, sort all the pixel values within the window in ascending order of gray value, and take the middle value as the new value of the current pixel point to remove noise. Divide the denoised image into multiple sub-blocks, and perform histogram equalization on each sub-block respectively to enhance the local contrast of the image. Calculate the gray histogram of the enhanced image, use the Otsu algorithm to find the threshold that maximizes the between-class variance, divide the image into a defect region and a background part to obtain a binary image. Perform morphological processing on the binary image, use the Canny edge detection algorithm to extract the edge contour of the defect, and combine the morphological processing results to obtain the preprocessed image.

[0020] In this embodiment, after completing the image enhancement processing, first count the pixel distribution of each gray level in the enhanced image to generate a gray histogram with a range of 0 - 255. This histogram intuitively reflects the pixel quantity distribution characteristics of different brightness levels in the image. Based on this histogram, use the Otsu algorithm for automatic threshold segmentation. Its core idea is to assume that the image is divided into two categories: a defect region and a non-defect region. By traversing all possible gray thresholds, such as 0 - 255, calculate the probability distribution, mean, and between-class variance of the two types of pixels under each threshold. The between-class variance is used to measure the separation degree of the two types of pixels, and the larger the value, the more obvious the difference between the foreground and the background. The Otsu algorithm finds the threshold that maximizes the between-class variance through mathematical optimization, and this threshold is the optimal segmentation threshold. Finally, determine the pixels with gray values less than or equal to this threshold in the image as the defect region, assign a value of 255 or white, and determine the pixels with gray values greater than this threshold as the background region, assign a value of 0 or black, so as to obtain a binary image with clear contours and significant contrast.

[0021] In this embodiment, when performing morphological processing on the binary image, first, erosion operation is used to remove isolated small noise points and edge burrs in the image, and then dilation operation is performed to connect adjacent defect regions and fill internal small cavities, thereby optimizing the integrity and continuity of the defect regions. Subsequently, the Canny edge detection algorithm is used. First, Gaussian smoothing is performed on the image to reduce noise interference, then the gradient intensity and direction of pixel points are calculated. Non-maximum suppression is used to retain local gradient maximum points to thin the edges. Finally, high and low double thresholds are used to screen edge pixels to ensure the complete retention of real defect edges and filter out irrelevant noise. The defect contours obtained by edge detection are logically fused with the binary image after morphological processing. Through contour fitting and region screening, a preprocessed image with clear contours, complete boundaries, and extremely little noise is finally obtained, laying a foundation for the accurate extraction of subsequent defect features.

[0022] Step 103: Extract features from the preprocessed image, and extract the geometric features, texture features, and color features of the defects. In this embodiment, the aluminum alloy surface image may be interfered by salt-and-pepper noise, Gaussian noise, etc. Salt-and-pepper noise is mainly caused by electromagnetic interference or sensor noise during the image acquisition process, manifested as isolated black and white pixel points in the image. Gaussian noise mainly comes from uneven illumination or thermal noise of the sensor, manifested as the overall blurring of the image. For salt-and-pepper noise, the median filtering method is adopted. Median filtering is a non-linear filtering technique that can remove noise while maintaining the edge information of the image. According to the resolution and noise intensity of the image, the size of the filtering window is set to 3×3 or 5×5. For areas with more severe noise, adaptive median filtering can be used to dynamically adjust the window size according to the local noise situation.

[0023] In this embodiment, the number of pixels in the defect region of the preprocessed image is calculated to obtain the area, the pixel length of the defect edge contour is calculated to obtain the perimeter, the shape factor is obtained through the area and perimeter, and then the ratio of the major axis to the minor axis of the defect region is calculated to obtain the eccentricity, and the geometric features are integrated. The texture features of the preprocessed image are extracted using the gray-level co-occurrence matrix and local binary pattern. The statistics of the R, G, and B channels of the preprocessed image are extracted respectively, the RGB image is converted to the HSV image, and the statistics of the H, S, and V components are extracted to obtain the color features.

[0024] In this embodiment, four directions of 0°, 45°, 90°, and 135° are selected through the gray-level co-occurrence matrix, and the energy, contrast, entropy, and correlation of the preprocessed image are calculated. The uniform LBP operator is used to compare the neighborhood gray values of each pixel point with the central pixel value to generate a binary code, the LBP histogram is statistically analyzed, and the texture features are obtained in combination with the results of the gray-level co-occurrence matrix.

[0025] In this embodiment, image enhancement highlights the features of aluminum alloy surface defects, improves the contrast between defects and the background, and facilitates subsequent feature extraction and defect recognition. The contrast-limited adaptive histogram equalization method is adopted. This method divides the image into multiple sub-blocks, performs histogram equalization on each sub-block respectively, and at the same time limits the enhancement amplitude of the contrast to avoid noise amplification and over-enhancement phenomena. The sub-block size is set to 8×8, and the contrast limit threshold is set to 40. Through CLAHE processing, the local contrast of the image is enhanced, making the edges and details of the defect area clearer.

[0026] Step 104: Adopt a feature selection method combining genetic algorithm and support vector machine to screen the extracted features, remove redundant features and irrelevant features, and obtain a feature subset. In this embodiment, the genetic algorithm population is initialized. The population size is set to 50, and the number of iterations is set to 100. Binary coding is adopted, and each gene bit represents whether a feature is selected. The classification accuracy of the support vector machine is used as the fitness function, and the radial basis function is used as the kernel function of the SVM. Decode each individual to obtain the corresponding feature subset, use the support vector machine to classify and evaluate the feature subset, and calculate the fitness value. The roulette wheel selection method is used to calculate the probability of each individual being selected according to its fitness value. The single-point crossover method is used to perform crossover operations on the selected individuals with a crossover probability of 0.9 to generate new individuals. The basic bit mutation method is used to flip the gene bits of individuals with a mutation probability of 0.05 to introduce new feature combinations. Generate a new generation of population according to the selection, crossover, and mutation operations until the maximum number of iterations is reached. Select the individual with the highest fitness value as the optimal feature subset, and remove redundant features and irrelevant features.

[0027] In this embodiment, during the specific implementation process of the support vector machine, first, the feature subset preliminarily screened by the genetic algorithm is divided into a training set and a test set to ensure the uniformity of data distribution and avoid model overfitting. For the multi-classification problem of aluminum alloy surface defect recognition, a one-versus-all strategy is adopted to construct an SVM classifier. A binary classifier is trained for each defect type, regarding the samples of this class as positive examples and all the other samples as negative examples. In terms of kernel function selection, the classification performances of the linear kernel, polynomial kernel, and radial basis function kernel are compared through cross-validation. Finally, the RBF kernel is selected as the optimal solution because it can better handle non-linearly separable data, and the mapping effect of the feature space can be optimized through the adaptive adjustment of the parameter γ. During the training process, the sequential minimal optimization algorithm is used to quickly solve the quadratic programming problem of the SVM, and the balance between the classification error rate and the model complexity is controlled by adjusting the penalty parameter to obtain a hyperplane with the largest classification margin. In the feature evaluation stage, the feature subset is input into the trained SVM model for testing, and the effectiveness of the features is evaluated by calculating performance indicators such as classification accuracy, recall rate, and F1 value. These performance indicators serve as the fitness values of the genetic algorithm, guiding the algorithm to evolve towards a better feature combination direction, and finally screening out the optimal feature subset that can not only retain the essential features of the defects but also effectively distinguish different types of defects.

[0028] Step 105: Input the feature subset into the GNN-GAN model, and according to the defect recognition result, output the type, location, and size of the defect, and mark and record the defect.

[0029] In this embodiment, the feature subset after feature selection is input into the GNN-GAN model, and the images in the feature subset are transformed into a graph structure through superpixel segmentation; first, the GNN module is used to extract the spatial-texture joint features of the defects, then the generator of the GAN module is used to generate the simulated features of the defects, and the discriminator discriminates between the real features and the simulated features; the extracted joint features are input into the classification network, and the probability distribution of each defect type is output through multiple fully connected layers; an independent branch is used to predict the coordinates of the upper left corner and the lower right corner of the circumscribed rectangle of the defect, and sub-pixel level positioning is performed through the coordinate regression algorithm; according to the positioning coordinates and the actual resolution of the image, the width, height, and area of the defect are calculated, and the type, location, and size of the defect are output.

[0030] In this embodiment, the graph convolutional layer of the GNN module aggregates the node neighborhood information to capture the local correlation features between the defect area and the surrounding background, and then the graph attention layer is used to strengthen the weights of the key nodes to focus on the long-distance dependence relationships of the defect edges and irregular regions. Finally, a vector representation containing the spatial-texture joint features is generated through global pooling.

[0031] In this embodiment, after the feature subset selected by feature selection is input into the GNN-GAN model, first, a graph-based superpixel segmentation algorithm is used to convert the image into a graph structure. In this process, the image is divided into multiple irregular regions with similar features, namely superpixels. Each superpixel serves as a node in the graph, and the node features are composed of the color, texture, and geometric statistics of the pixels within the region. By calculating the spatial proximity and feature similarity between nodes, an edge connection relationship is constructed to form a graph representation containing node features and edge weights. In particular, in the scenario of aluminum alloy surface defect recognition, to strengthen the structural features of the defect region, the superpixel segmentation parameters are adaptively adjusted: for defects such as micro-cracks, the superpixel size is reduced to capture detailed edges; for large-area depression defects, the superpixel size is increased to retain the overall morphological features. At the same time, an edge weight calculation method based on defect prior knowledge is introduced. On the basis of traditional spatial distance and color similarity, the similarity measures of texture gradient and gray-level co-occurrence matrix are added, so that the graph structure can more effectively express the spatial topological relationship and context information of the defects. This graph-structured processing not only retains the local features of the image but also explicitly models the association relationships between regions, providing a more suitable structured data input for the graph convolution operation of the subsequent GNN module for defect feature extraction.

[0032] In this embodiment, during the operation of the GAN module, the generator first receives a random noise vector that follows a specific distribution and gradually fits the latent feature distribution of aluminum alloy defects through multi-layer non-linear transformations to generate a simulated feature vector with the same dimension as the real defect features. These simulations cover key attributes such as the geometric shape, texture pattern, and color distribution of the defects, aiming to approximate the feature space of real defects as much as possible. At the same time, as a true / false discriminator, the discriminator synchronously receives the real defect features from the feature selection stage and the simulated features output by the generator, and uses a multi-layer perceptron to probabilistically discriminate the authenticity of the two types of features: output a high-probability real label for real features and a high-probability simulated label for simulated features. The generator and the discriminator are iteratively optimized in an adversarial game manner: the generator adjusts its parameters through the feedback signal of the discriminator to continuously improve the fidelity of the simulated features, making them difficult to be distinguished by the discriminator; the discriminator continuously optimizes its discrimination ability according to the progress of the generator to accurately capture the subtle differences between real and simulated features. This dynamic adversarial process forces the model to deeply learn the essential laws of defect features, not only enhancing the discriminability of feature representation but also effectively alleviating the problem of insufficient real defect data by introducing generated samples, making the feature learning of the model more comprehensive and robust in complex defect scenarios.

[0033] Please refer to Figure 2 , the structural schematic diagram of the aluminum alloy surface defect recognition system based on image recognition provided by the embodiment of the present invention. The system includes: An image acquisition module for acquiring images of the aluminum alloy surface to obtain the original images of the aluminum alloy surface; An image preprocessing module for preprocessing the acquired original images, including image denoising, image enhancement, and image segmentation, to obtain preprocessed images; A feature extraction module for extracting features from the preprocessed images, including geometric features, texture features, and color features of the defects; A feature selection module for screening the extracted features using a feature selection method combining genetic algorithms and support vector machines to remove redundant and irrelevant features and obtain a feature subset; A defect recognition module for inputting the feature subset into the GNN-GAN model, and according to the defect recognition results, outputting the type, location, and size of the defects, and marking and recording the defects.

[0034] Figure 3 FIG. 12 is a schematic structural diagram of a device for identifying defects on the surface of an aluminum alloy based on image recognition provided by an embodiment of the present invention. The device 300 for identifying defects on the surface of an aluminum alloy based on image recognition may vary greatly due to different configurations or performances, and may include one or more processors (central processing units, CPU) 310 (for example, one or more processors) and a memory 320, and one or more storage media 330 for storing application programs 333 or data 332 (for example, one or more mass storage devices). Among them, the memory 320 and the storage media 330 may be transient storage or persistent storage. The program stored in the storage media 330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the device 300 for identifying defects on the surface of an aluminum alloy based on image recognition. Further, the processor 310 may be configured to communicate with the storage media 330 and execute a series of instruction operations in the storage media 330 on the device 300 for identifying defects on the surface of an aluminum alloy based on image recognition to implement the method provided by the above embodiment.

[0035] The device 300 for identifying defects on the surface of an aluminum alloy based on image recognition may further include one or more power supplies 340, one or more wired or wireless network interfaces 350, one or more input / output interfaces 360, and / or one or more operating devices 331, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art can understand. Figure 3The structure of the aluminum alloy surface defect recognition device based on image recognition shown does not limit the computer device provided by the present invention, and may include more or fewer components than those shown, or combine certain components, or have different component arrangements.

[0036] The present invention also provides a computer-readable storage medium, which can be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are run on a computer, the computer is caused to execute each step of the aluminum alloy surface defect recognition method based on image recognition provided in the above-mentioned embodiments.

[0037] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described devices, apparatuses, or units can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0038] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in various embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.

[0039] The above shows and describes the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited by the above embodiments. The above embodiments and the descriptions in the specification are only preferred examples of the present invention and are not used to limit the present invention. Without departing from the spirit and scope of the present invention, the present invention will have various changes and improvements, and these changes and improvements all fall within the scope of the present invention claimed. The scope of protection claimed by the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for identifying surface defects of aluminum alloy based on image recognition, characterized in that, The method includes the following steps: Collect images of the aluminum alloy surface to obtain the original image of the aluminum alloy surface; Preprocess the collected original image, including image denoising, image enhancement, and image segmentation, to obtain the preprocessed image; Extract features from the preprocessed image, and extract the geometric features, texture features, and color features of the defects; Adopt a feature selection method combining genetic algorithm and support vector machine to screen the extracted features, remove redundant features and irrelevant features, and obtain a feature subset; Input the feature subset into the GNN-GAN model, and according to the defect recognition result, output the type, location, and size of the defects, and mark and record the defects.

2. The aluminum alloy surface defect recognition method based on image recognition according to claim 1, wherein The preprocessing of the collected original image, including image denoising, image enhancement, and image segmentation, to obtain the preprocessed image, includes: Traverse each pixel point of the original image. Taking the current pixel point as the center, sort all the pixel values within the window in ascending order of gray value, and take the middle value as the new value of the current pixel point to remove noise; Divide the denoised image into multiple sub-blocks, and perform histogram equalization on each sub-block respectively to enhance the local contrast of the image; Calculate the gray histogram of the enhanced image, use the Otsu algorithm to find the threshold that maximizes the between-class variance, and divide the image into a defect area and a background part to obtain a binary image; Perform morphological processing on the binary image, use the Canny edge detection algorithm to extract the edge contour of the defect, and combine the morphological processing results to obtain the preprocessed image.

3. The aluminum alloy surface defect recognition method based on image recognition according to claim 1, characterized in that, The feature extraction from the preprocessed image, and extraction of the geometric features, texture features, and color features of the defects, includes: Calculate the number of pixels within the defect area of the preprocessed image to obtain the area, calculate the pixel length of the defect edge contour to obtain the perimeter, obtain the shape factor from the area and perimeter, and then calculate the ratio of the long axis to the short axis of the defect area to obtain the eccentricity, and integrate to obtain geometric features; Adopt methods based on gray-level co-occurrence matrix and local binary pattern to extract the texture features of the preprocessed image; Extract the statistics of the R, G, and B channels of the preprocessed image respectively, convert the RGB image to an HSV image, and extract the statistics of the H, S, and V components to obtain color features.

4. The aluminum alloy surface defect recognition method based on image recognition according to claim 3, wherein, The method of adopting methods based on gray-level co-occurrence matrix and local binary pattern to extract the texture features of the preprocessed image includes: Select four directions of 0°, 45°, 90°, and 135° through the gray-level co-occurrence matrix, calculate the energy, contrast, entropy, and correlation of the preprocessed image, adopt the uniform LBP operator, compare the neighborhood gray value of each pixel point with the central pixel value to generate a binary code, count the LBP histogram, and combine the gray-level co-occurrence matrix results to obtain texture features.

5. A method for identifying surface defects of aluminum alloy based on image recognition according to claim 1, characterized in that, The method of adopting a feature selection method combining genetic algorithm and support vector machine to screen the extracted features, remove redundant features and irrelevant features, and obtain a feature subset includes: Initialize the genetic algorithm population, set the population size to 50, set the number of iterations to 100, adopt binary coding, and each gene bit represents whether a feature is selected; The classification accuracy of the support vector machine is used as the fitness function, and the radial basis function is used as the kernel function of the SVM; Decode each individual to obtain the corresponding feature subset, use the support vector machine to classify and evaluate the feature subset, and calculate the fitness value; The roulette wheel selection method is used to calculate the probability of each individual being selected according to its fitness value; The single-point crossover method is used to perform crossover operations on the selected individuals with a crossover probability of 0.9 to generate new individuals; The basic bit mutation method is used to flip the gene bits of individuals with a mutation probability of 0.05 to introduce new feature combinations; Generate a new generation of population according to the selection, crossover, and mutation operations until the maximum number of iterations is reached. Select the individual with the highest fitness value as the optimal feature subset, and remove redundant and irrelevant features.

6. The aluminum alloy surface defect recognition method based on image recognition according to claim 1, characterized in that, The feature subset is input into the GNN-GAN model. According to the results of defect recognition, the type, location, and size of the defect are output, and the defect is marked and recorded, including: The feature subset after feature selection is input into the GNN-GAN model, and the images in the feature subset are transformed into a graph structure through superpixel segmentation; First, the GNN module extracts the spatial-texture joint features of the defect, and then the generator of the GAN module generates the simulated features of the defect. The discriminator discriminates between the real features and the simulated features; The extracted joint features are input into the classification network, and the probability distributions of each defect type are output through multiple fully connected layers; Independent branches are used to predict the coordinates of the upper left and lower right corners of the defect circumscribed rectangle, and sub-pixel level positioning is performed through the coordinate regression algorithm; According to the positioning coordinates and the actual resolution of the image, calculate the width, height, and area of the defect, and output the type, location, and size of the defect.

7. The method for identifying surface defects of aluminum alloy based on image recognition according to claim 6, characterized in that, The step of first extracting the spatial-texture joint features of the defect by the GNN module includes: The graph convolution layer of the GNN module aggregates the node neighborhood information to capture the local correlation features between the defect region and the surrounding background. Then, the graph attention layer is used to strengthen the weights of the key nodes, focusing on the long-distance dependence relationships of the defect edges and irregular regions. Finally, global pooling is used to generate a vector representation containing the spatial-texture joint features.

8. An aluminum alloy surface defect recognition system based on image recognition, characterized in that, The system includes: An image acquisition module for acquiring images of the aluminum alloy surface to obtain the original images of the aluminum alloy surface; An image preprocessing module for preprocessing the acquired original images, including image denoising, image enhancement, and image segmentation, to obtain the preprocessed images; A feature extraction module for extracting features from the preprocessed images, extracting the geometric features, texture features, and color features of the defects; A feature selection module for using a feature selection method combining genetic algorithm and support vector machine to screen the extracted features, removing redundant and irrelevant features, and obtaining a feature subset; A defect recognition module for inputting the feature subset into the GNN-GAN model, and according to the results of defect recognition, outputting the type, location, and size of the defect, and marking and recording the defect.

9. An aluminum alloy surface defect recognition device based on image recognition, characterized in that, The aluminum alloy surface defect recognition device based on image recognition includes a memory and at least one processor, and instructions are stored in the memory; the at least one processor calls the instructions in the memory so that the aluminum alloy surface defect recognition device based on image recognition executes each step of the aluminum alloy surface defect recognition method according to any one of claims 1-7.

10. A computer-readable storage medium having instructions stored thereon, characterized in that, When the instructions are executed by the processor, each step of the aluminum alloy surface defect recognition method according to any one of claims 1-7 is implemented.

Citation Information

Patent Citations

  • Optimization method of support vector machine for part image recognition

    CN111275078A

  • Surface image recognition method and system for aluminum alloy casting

    CN117372410A

  • Defect detection method for lead sealing layer of high-voltage cable

    CN118897004A

  • Intelligent industrial quality inspection method and system based on AI visual identification

    CN119151869A

  • Image recognition method for titanium alloy online detection sensor calibration

    CN119395040A

Cited By

  • Cutting workpiece defect detection method and system based on image feature feedback

    CN120747040A

  • High-voltage switch shell surface coating uniformity evaluation method and system

    CN121437512A

  • Image analysis-based liquid cooling plate surface polishing on-line sorting detection method

    CN122391215A

  • Tooth surface pitting corrosion wiping rechecking detection method and system

    CN122434947A