Aluminum Alloy Handle Surface Defect Detection Method, Device, Equipment and Storage Medium
Through multi-angle image acquisition and preprocessing technology, combined with defect enhancement modules with parallel convolutional branching and residual connections, lighting compensation and denoising processing are performed, which solves the problems of low efficiency and poor accuracy of the existing aluminum alloy handle surface defect detection method, and realizes high-precision surface defect detection and correlation analysis of internal defect model.
Patent Information
- Application Number
- CN202411572732.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2044-11-06
AI Technical Summary
The existing aluminum alloy handle surface defect detection methods are low efficiency and strong subjectivity, and the automated detection methods face problems such as uneven lighting, complex backgrounds, and multi-angle imaging, which affect the accuracy and robustness of the detection.
Using multi-angle image acquisition and preprocessing technology, illumination compensation and denoising are performed through three parallel convolutional branches and residual connection defect enhancement modules, and finally multi-scale feature fusion and surface defect detection are carried out.
The accuracy and recall of defect detection are improved, defect omissions may be overcome by single angle imaging, and the ability to identify defects of different sizes and shapes is enhanced. The detection results and the registration of the internal defect model of CT scan realize the correlation analysis of surface and internal defects.
Smart Images

Figure CN119295426B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of surface defect detection, and particularly to a method, device, equipment and storage medium for detecting surface defects of aluminum alloy handles. Background Art
[0002] During the production process of aluminum alloy handles, due to the influence of factors such as materials, processing and environment, various surface defects often occur, such as scratches, pits, bubbles, etc. These defects not only reduce the appearance quality of the product, but may also become stress concentration points, affecting the mechanical properties and durability of the product.
[0003] Traditional methods for detecting surface defects of aluminum alloy handles mainly rely on manual visual inspection. This method has problems such as low efficiency, strong subjectivity, and easy fatigue, and it is difficult to meet the high efficiency and high precision requirements of modern production lines. With the development of computer vision and artificial intelligence technologies, automated surface defect detection methods have gradually attracted attention. However, existing automatic detection methods still face many challenges, such as uneven illumination, complex backgrounds, multi-angle imaging, etc. These factors will affect the accuracy and robustness of detection. Summary of the Invention
[0004] The main purpose of the present invention is to provide a method, device, equipment and storage medium for detecting surface defects of aluminum alloy handles, so as to improve the accuracy and recall rate of defect localization on the surface of aluminum alloy handles.
[0005] To achieve the above object, the present invention provides a method for detecting surface defects of aluminum alloy handles, including the following steps:
[0006] Under standard illumination and low illumination conditions, respectively collect standard illumination original images and low illumination original images of the surface of the aluminum alloy handle at multiple angles, and perform preprocessing and image combination to obtain a pair of preprocessed images for each angle;
[0007] Respectively input the pair of preprocessed images for each angle into the defect enhancement module, and process them through three parallel convolutional branches and residual connections to obtain an enhanced feature map for each angle;
[0008] Respectively perform illumination compensation processing on the enhanced feature map for each angle to obtain an illumination equalized image for each angle;
[0009] Respectively input the illumination equalized image for each angle into the denoising module, perform preliminary denoising through the non-local means algorithm, and then use the DnCNN network based on noise level estimation for optimization to obtain a denoised image for each angle;
[0010] Stitch and reconstruct the denoised images at each angle to obtain a reconstructed surface image, and perform multi-scale feature fusion and surface defect detection on the reconstructed surface image to obtain a surface defect detection result.
[0011] The present invention also provides an aluminum alloy handle surface defect detection device, including:
[0012] An acquisition module, configured to respectively acquire standard illumination original images and low illumination original images of the surface of the aluminum alloy handle at multiple angles under standard illumination and low illumination conditions, and perform preprocessing and image combination to obtain a preprocessing image pair at each angle;
[0013] An enhancement module, configured to respectively input the preprocessing image pair at each angle into a defect enhancement module, and perform processing through three parallel convolutional branches and residual connections to obtain an enhanced feature map at each angle;
[0014] A compensation module, configured to respectively perform illumination compensation processing on the enhanced feature map at each angle to obtain an illumination equalized image at each angle;
[0015] A denoising module, configured to respectively input the illumination equalized image at each angle into the denoising module, perform preliminary denoising through the non-local means algorithm, and then use the DnCNN network based on noise level estimation for optimization to obtain a denoised image at each angle;
[0016] A detection module, configured to stitch and reconstruct the denoised images at each angle to obtain a reconstructed surface image, and perform multi-scale feature fusion and surface defect detection on the reconstructed surface image to obtain a surface defect detection result.
[0017] The present invention also provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps of the method described in any one of the above are implemented.
[0018] The present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method described in any one of the above are implemented.
[0019] In summary, the technical solution provided by the present invention, the multi-angle image acquisition and preprocessing technology, improves the comprehensiveness and accuracy of defect detection, and overcomes the problem of defect omission that may be caused by single-angle imaging. The three-branch parallel convolutional network structure realizes multi-scale feature extraction and enhances the recognition ability of defects of different sizes and shapes. The illumination compensation processing effectively solves the problem of uneven illumination and improves the adaptability of the detection algorithm to different illumination conditions. The denoising method combining the non-local mean algorithm and the DnCNN network significantly improves the image quality. The multi-scale feature fusion and GA-RPN technology improve the accuracy and recall rate of defect localization. The registration of the surface defect detection result and the CT scan internal defect model realizes the correlation analysis of surface and internal defects. Considering the defect characteristics, surface roughness and stress concentration coefficient comprehensively, a more comprehensive and reliable quality assessment report is provided. The entire detection process is automated, greatly improving the detection efficiency and reducing the labor cost. The present invention is applicable to the surface defect detection of aluminum alloy handles with different shapes and materials. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 is a schematic diagram of the steps of the method for detecting surface defects of an aluminum alloy handle in an embodiment of the present invention;
[0021] Figure 2 is a block diagram of the structure of the device for detecting surface defects of an aluminum alloy handle in an embodiment of the present invention;
[0022] Figure 3 is a schematic block diagram of the structure of a computer device in an embodiment of the present invention.
[0023] The implementation, functional features and advantages of the object of the present invention will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0024] In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0025] Refer to Figure 1 , this embodiment provides a method for detecting surface defects of an aluminum alloy handle, including the following steps:
[0026] S1, under standard illumination and low illumination conditions, respectively collect the standard illumination original images and low illumination original images of the surface of the aluminum alloy handle at multiple angles, and perform preprocessing and image combination to obtain a pair of preprocessed images for each angle;
[0027] Among them, the surface of the aluminum alloy handle is photographed at multiple angles using a high-resolution industrial camera under standard illumination conditions of 5000 lumens to obtain original images of standard illumination at multiple angles. At the same time, the surface of the aluminum alloy handle is photographed at multiple angles using the same high-resolution industrial camera under low illumination conditions of 1000 lumens to obtain original images of low illumination at multiple angles. Edge detection is performed on the original images of standard illumination and low illumination, and the Canny algorithm is used to extract the edge information of the images, obtaining a standard illumination edge contour map and a low illumination edge contour map. Based on the standard illumination edge contour map and the low illumination edge contour map, the minimum bounding rectangles of the original images of standard illumination and low illumination are calculated to determine the first boundary coordinates of the standard illumination handle area and the second boundary coordinates of the low illumination handle area. Based on the first boundary coordinates and the second boundary coordinates, the original images of standard illumination and low illumination are respectively cropped to obtain the cropped standard illumination image and the cropped low illumination image. Bilinear interpolation processing is performed on the cropped images to uniformly adjust their sizes to 1024×1024 pixels, obtaining the standard illumination image and the low illumination image with adjusted sizes. The standard illumination image and the low illumination image with adjusted sizes are converted from the RGB color space to the XYZ color space. Calculations are performed using a standard RGB to XYZ conversion matrix to obtain the standard illumination image and the low illumination image in the XYZ color space. The XYZ color space is a color representation method that is close to human visual characteristics, enabling better preservation of the visual features of the image during subsequent color processing and enhancement. Nonlinear transformation is performed on the standard illumination image and the low illumination image in the XYZ color space to map the XYZ values to the Lab color space, obtaining the standard illumination image and the low illumination image in the Lab color space. The Lab color space is a perceptually uniform color space, where L represents luminance, and a and b represent chromaticity components. Therefore, it can be processed on independent luminance channels and chromaticity channels and is suitable for image enhancement and contrast adjustment. To enhance the quality of the image, histogram equalization processing is performed on the luminance channel L of the standard illumination image and the low illumination image in the Lab color space, effectively improving the luminance contrast of the image and making the details in the image more obvious. The processed standard illumination image and low illumination image in the Lab color space are combined into an image pair to obtain a preprocessed image pair for each angle.
[0028] S2, respectively input the preprocessed image pairs for each angle into the defect enhancement module, and process them through three parallel convolutional branches and residual connections to obtain the enhanced feature maps for each angle;
[0029] Specifically, the preprocessed image pairs at each angle are respectively input into the first convolutional branch in the defect enhancement module, and the first convolution operation is performed using a 3×3 convolutional kernel to obtain the first initial feature map. Batch normalization is performed on the first initial feature map to normalize the feature values to a distribution with a mean of 0 and a variance of 1, eliminating the statistical differences of images in different batches, and obtaining the first normalized feature map. The ReLU activation function is applied to this normalized feature map to introduce a non-linear transformation to obtain the first activated feature map. The non-linear transformation helps to improve the representation ability of the network. The first activated feature map is input into the second 3×3 convolutional layer for the second convolution operation to obtain the first intermediate feature map. The second batch normalization process and ReLU activation operation are performed on this intermediate feature map to obtain the first refined feature map. At the same time, the preprocessed image pairs at each angle are input into the second convolutional branch in the defect enhancement module, and the first convolution operation is performed using a 5×5 convolutional kernel to obtain the second initial feature map. For the second initial feature map, batch normalization is also performed to normalize the feature values to a distribution with a mean of 0 and a variance of 1, obtaining the second normalized feature map. The ReLU activation function is applied to this normalized feature map to introduce a non-linear transformation to obtain the second activated feature map. The second activated feature map is input into the second 5×5 convolutional layer for the second convolution operation to obtain the second intermediate feature map, and the second batch normalization and ReLU activation processes are performed on this intermediate feature map to obtain the second refined feature map. In the third convolutional branch, the preprocessed image pairs at each angle are input into the third convolutional branch in the defect enhancement module, and the first convolution operation is performed using a 7×7 convolutional kernel to obtain the third initial feature map. Batch normalization is performed on this third initial feature map to make the feature values conform to a distribution with a mean of 0 and a variance of 1, obtaining the third normalized feature map. The ReLU activation function is applied to this normalized feature map for non-linear transformation to obtain the third activated feature map. The third activated feature map is input into the second 7×7 convolutional layer for the second convolution operation to obtain the third intermediate feature map, and the second batch normalization process and ReLU activation operation are performed on it to obtain the third refined feature map. After completing the feature extraction of the three convolutional branches, the first refined feature map, the second refined feature map, and the third refined feature map are input into the channel attention module. The channel attention module calculates the weight coefficients of each channel to obtain a weighted feature map, realizing the enhancement of important features and ignoring the influence of secondary features. Under the processing of this module, the first weighted feature map, the second weighted feature map, and the third weighted feature map are obtained. Feature fusion operations are performed on the three groups of weighted feature maps. During the fusion process, 1×1 convolution is used for channel dimensionality reduction to reduce the number of channels while maintaining important information, obtaining a fused feature map. At the same time, in order to enhance the training effect of the network and improve the expressiveness of the model, the preprocessed image pairs at each angle are used to generate a residual connection feature map through 1×1 convolution. Residual connections can alleviate the problem of gradient disappearance in deep networks and make the network more stable during feature extraction.Perform an element-wise addition operation on the fused feature map and the residual connection feature map to obtain the initial enhanced feature map. To optimize the enhanced features, perform a 3×3 convolution operation on the initial enhanced feature map and apply the Tanh activation function to map the feature values to the interval [-1, 1], ensuring that the range of the feature values is restricted to a smaller interval for subsequent processing. After the above steps, the enhanced feature map for each angle is finally obtained.
[0030] S3. Perform illumination compensation processing on the enhanced feature map for each angle to obtain the illumination equalized image for each angle;
[0031] It should be noted that the enhanced feature maps at each angle are converted into grayscale images. By calculating the weighted average of the three RGB channels, the pixel values of each channel are weighted and summed in a certain proportion to obtain the grayscale enhanced feature map. A Gaussian filter is applied to the grayscale enhanced feature map to blur the illumination component and eliminate the influence of high-frequency noise. A convolution operation is performed on the grayscale enhanced feature map using a convolution kernel of size 11×11 and a Gaussian filter with a standard deviation of σ = 5 to obtain the blurred illumination component image, and the illumination component is separated from the image to better compensate for the uneven illumination effect in the image. The grayscale enhanced feature map and the blurred illumination component image are simultaneously transformed into the logarithmic domain. The natural logarithm is taken for each pixel value to obtain the logarithmic domain grayscale image and the logarithmic domain illumination component image. The multiplication relationship is transformed into an addition relationship to simplify the calculation and facilitate subsequent processing. In the logarithmic domain, a subtraction operation is performed on the logarithmic domain grayscale image and the logarithmic domain illumination component image to obtain the logarithmic domain reflection component image, which contains the reflection characteristics of the object surface and is not affected by the illumination conditions. To restore the original image domain, an exponential operation is performed on the logarithmic domain reflection component image, and the natural exponential is calculated for each pixel value to obtain the reflection component image. Global contrast enhancement processing is performed on the reflection component image. The global contrast enhancement factor is calculated by analyzing the distribution characteristics of the image histogram to obtain the parameter for adjusting the image contrast. The contrast adjustment parameter is applied to the reflection component image, and a power function transformation is used to enhance the contrast of the image, making the difference between the dark and bright regions in the image more obvious, thereby effectively highlighting the detailed features of the surface defects. The enhanced reflection component image is multiplied pixel by pixel with the original blurred illumination component image to obtain a preliminary equalized image. The preliminary equalized image is divided into 8×8 sub-blocks, and the amplitude of contrast enhancement is limited in each sub-block to obtain a locally enhanced equalized image. The local enhancement method can better compensate for the image contrast difference caused by uneven illumination, and at the same time avoid noise amplification caused by over-enhancement, thereby improving the detail expressiveness and equalization of the image. The locally enhanced equalized image is converted from the grayscale space back to the RGB color space to obtain the illumination equalized image at each angle. The conversion operation is performed by reversely applying the original RGB channel information to the enhanced grayscale image to obtain a color image with the original color information but with the brightness and contrast equalized.
[0032] S4. The illumination equalized images at each angle are respectively input into the denoising module, preliminarily denoised by the non-local means algorithm, and then optimized using the DnCNN network based on noise level estimation to obtain the denoised images at each angle;
[0033] Specifically, the illumination equalization image of each angle is input into the non-local means algorithm, and the image is preliminarily denoised by the algorithm. In the non-local means algorithm, the search window size is set to 21×21 pixels and the similarity window size is set to 7×7 pixels, so as to find similar blocks in the image to achieve smoothing of noise and obtain a preliminary denoised image. The non-local means algorithm uses redundant similar information in the image to effectively remove noise by weighted averaging of similar areas, and reduces the noise of the image while retaining image details as much as possible. The image after preliminary denoising is Fourier transformed to obtain its representation in the frequency domain. The frequency domain representation image can provide information about the image in the frequency space, which is helpful for further analysis of noise characteristics. By calculating the power spectral density of the frequency domain representation image, the energy distribution of different frequency components in the image is effectively quantified. Based on the power spectral density, the maximum likelihood estimation method is used to estimate the noise variance of the image and obtain the estimated value of the noise level. The preliminary denoised image and its noise level estimate are input into DnCNN (denoising convolutional neural network) for optimization. The DnCNN network contains 20 convolutional layers, each of which uses 64 3×3 convolution kernels. The deep convolutional structure can extract deep features of the image and more effectively separate noise and useful information. In each convolutional layer, the output is batch normalized, and the mean of the feature map is adjusted to 0 and the variance is adjusted to 1, which makes the network training process more stable, accelerates the convergence speed and prevents the gradient vanishing problem. After batch normalization, the ReLU activation function is applied to the output of each convolutional layer to introduce nonlinear transformation and obtain the activated feature map. The ReLU activation function enables the network to handle complex nonlinear problems and improves the feature expression ability of the network by introducing sparsity. In the last convolutional layer, the residual learning method is used to perform element-by-element subtraction between the output of the convolutional layer and the preliminary denoising image to obtain the noise residual map. Residual learning can more efficiently separate the noise component and retain useful image features by directly learning the difference (i.e., noise) between the input image and the clean image. Adaptive thresholding is performed on the noise residual map. The threshold is dynamically adjusted according to the characteristics of the local image to ensure that appropriate denoising efforts can be taken in different image areas, thereby reducing the problem of over-smoothing or residual noise and obtaining an optimized noise residual map. The optimized noise residual map is subtracted from the preliminary denoised image to obtain the denoised image at each angle.
[0034] S5, stitching and reconstructing the denoised images at each angle to obtain a reconstructed surface image, and performing multi-scale feature fusion and surface defect detection on the reconstructed surface image to obtain a surface defect detection result.
[0035] Among them, the denoised images at each angle are stitched and reconstructed to obtain a reconstructed surface image, which contains the detailed information of all viewpoints. The reconstructed surface image is input into the ResNet-50 network for feature extraction. ResNet-50 is a deep convolutional neural network with strong feature learning ability, and its structure consists of five stages of convolution and pooling operations. By gradually extracting the spatial features of the image, ResNet-50 can learn the feature representation of the image layer by layer from low level to high level. In this process, the first-scale feature map, the second-scale feature map, the third-scale feature map, and the fourth-scale feature map are extracted from different stages respectively. The low-scale feature map mainly contains the detailed information of the image, while the high-scale feature map reflects more semantic information of the image. A 1×1 convolution and an upsampling operation are performed on the fourth-scale feature map, and an element-wise addition operation is performed with the third-scale feature map to obtain the first upsampled feature map. The 1×1 convolution is used to reduce the number of channels and achieve feature fusion, and the upsampling operation is used to restore the spatial resolution of the feature map. By element-wise addition with the third-scale feature map, the feature information of different scales is fused to enhance the representation ability of the feature map. Similarly, a 1×1 convolution and an upsampling operation are continued on the first upsampled feature map, and then an element-wise addition is performed with the second-scale feature map to obtain the second upsampled feature map. The same operation is performed on the second upsampled feature map to obtain the third upsampled feature map. In the multi-scale feature fusion process, the high-order semantic information and the low-order detailed information are combined layer by layer, so that the final feature map has both rich details and global semantic information. The first upsampled feature map, the second upsampled feature map, and the third upsampled feature map are input into the GA-RPN (Global Attention Region Proposal Network) module. The GA-RPN module generates feature points through deformable convolution. Deformable convolution can adaptively adjust the position of the convolution kernel according to the input features, and better capture the irregular defect features on the surface of the aluminum alloy handle. Classification and regression are performed on the generated feature points to obtain a set of candidate regions. Through the global attention mechanism, GA-RPN can pay more attention to the potential defect regions in the image, and improve the accuracy and recall rate of the candidate regions. The candidate regions are subjected to ROIAlign (Region of Interest Align) operations with the first upsampled feature map, the second upsampled feature map, and the third upsampled feature map to obtain multi-scale ROI features. The purpose of ROI Align is to accurately align the candidate regions with the corresponding feature maps, so as to retain the detailed information within the candidate regions. Through ROI Align, the multi-scale features and the candidate regions are effectively combined to generate ROI features containing different scale information, ensuring that each feature point in the candidate regions is fully expressed. The multi-scale ROI features are input into the multi-task learning module to perform defect classification and bounding box regression simultaneously.The defect classification task is used to determine whether there are defects in each candidate region and the categories of the defects, while the bounding box regression task is used to accurately locate the position, size, and shape of the defects. Through multi-task learning, the classification and localization of defects are carried out simultaneously to generate surface defect detection results containing defect categories, positions, sizes, and shapes.
[0036] The aluminum alloy handle is subjected to CT scanning to obtain its internal 2D projection images. The 2D projection images are processed using the filtered back-projection algorithm to reconstruct the 3D volume data of the handle and obtain an internal defect model containing internal structure information. The surface defect contours in the surface defect detection results are matched with the surface of the internal defect model in terms of feature points. Feature point matching is achieved by corresponding the contour features of the surface defects with the corresponding features of the internal model to obtain an initial registration result. Based on the initial registration result, fine surface registration is performed on the surface defect contours and the internal defect model to ensure a more accurate correspondence between the surface and internal defects, and a registration transformation matrix is obtained. This registration transformation matrix is used to map the surface defect detection results into the coordinate system of the internal defect model to obtain a comprehensive defect model in a unified coordinate system. Feature extraction is performed on each defect in the comprehensive defect model to calculate the area, depth, volume, and shape factor of the defects, obtaining a set of target defect features. The area and depth of the defects reflect the influence degree of the defects on the surface, while the volume and shape factor help to describe the geometric features of the defects in three-dimensional space. The surface of the handle is scanned to obtain surface height data. Based on these height data, by calculating the root mean square roughness (RMS) and the maximum profile height (Rz), the parameters of the surface roughness are obtained, reflecting the quality of the surface machining and the existing micro-defects. Based on the comprehensive defect model, a mechanical model of the aluminum alloy handle is established using finite element analysis software. In the mechanical model, a preset load is applied to simulate the stress conditions of the handle during actual use, and the stress distribution is calculated through finite element analysis to obtain the stress concentration coefficient. The stress concentration coefficient is an important indicator for evaluating the risk of fracture in the stress concentration region of the handle, especially in the defect region, which will cause stress concentration and thus increase the risk of fracture. A comprehensive analysis is performed on the set of target defect features, surface roughness, and stress concentration coefficient. By analyzing the area, depth, volume, and shape factor of each defect, the potential impact of these defects on the mechanical properties of the handle is judged. At the same time, combined with the parameters of the surface roughness, the machining quality of the surface and its impact on the fatigue life are evaluated. The stress concentration coefficient can quantify the impact of defects and roughness on the mechanical properties of the handle under actual working conditions. Combining all the analysis results, a quality assessment report of the aluminum alloy handle is generated.
[0037] In one example, under standard illumination and low illumination conditions, the original standard illumination images and the original low illumination images of the aluminum alloy handle surface at multiple angles are collected respectively, and preprocessing and image combination are carried out to obtain the preprocessed image pairs at each angle, including: using a high-resolution industrial camera to take pictures of the aluminum alloy handle surface at multiple angles under the standard illumination condition of 5000 lumens to obtain the original standard illumination images at multiple angles, and using the same high-resolution industrial camera to take pictures of the aluminum alloy handle surface at multiple angles under the low illumination condition of 1000 lumens to obtain the original low illumination images at multiple angles; performing edge detection on the original standard illumination images and the original low illumination images respectively, using the Canny algorithm to extract the image edges to obtain the standard illumination edge contour map and the low illumination edge contour map; based on the standard illumination edge contour map and the low illumination edge contour map, calculating the minimum bounding rectangles of the original standard illumination images and the original low illumination images respectively to determine the first boundary coordinates of the standard illumination handle area and the second boundary coordinates of the low illumination handle area; according to the first boundary coordinates and the second boundary coordinates, cropping the original standard illumination images and the original low illumination images respectively to obtain the cropped standard illumination images and the cropped low illumination images, and performing bilinear interpolation on the cropped standard illumination images and the cropped low illumination images respectively to uniformly adjust the image size to 1024×1024 pixels to obtain the standard illumination images with adjusted size and the low illumination images with adjusted size; converting the standard illumination images with adjusted size and the low illumination images with adjusted size from the RGB color space to the XYZ color space, calculating using the standard RGB to XYZ conversion matrix to obtain the standard illumination images in the XYZ color space and the low illumination images in the XYZ color space, and performing non-linear transformation on the standard illumination images in the XYZ color space and the low illumination images in the XYZ color space to map the XYZ values to the Lab color space to obtain the standard illumination images in the Lab color space and the low illumination images in the Lab color space; performing histogram equalization processing on the brightness channel L of the standard illumination images in the Lab color space and the low illumination images in the Lab color space, and combining the standard illumination images and the low illumination images in the Lab color space after histogram equalization processing into image pairs to obtain the preprocessed image pairs at each angle.
[0038] In this example, a high-resolution industrial camera is used to take multiple-angle shots of an aluminum alloy handle under standard lighting conditions of 5000 lumens, obtaining original images with standard lighting at multiple angles. Under low lighting conditions of 1000 lumens, the same high-resolution industrial camera is used to take multiple-angle shots again to obtain original images under low lighting conditions. By collecting images under different lighting conditions, while ensuring image clarity, more surface feature details can be captured. Edge detection is performed on the original images of standard lighting and low lighting respectively. The Canny algorithm is used for edge detection, which is an image edge extraction method that can effectively identify edge features in images. The principle of Canny edge detection includes steps such as Gaussian smoothing, calculating gradient magnitude, non-maximum suppression, and double-threshold connection. After being processed by the Canny algorithm, a standard lighting edge contour map and a low lighting edge contour map are obtained, which respectively represent the edge information on the surface of the aluminum alloy handle under standard lighting and low lighting conditions. Through the edge contour maps, the shape and edge features of the object are identified, which helps to accurately segment the handle area in the image. Based on the extracted edge contour maps of standard lighting and low lighting, the calculation of the minimum bounding rectangle is carried out. The purpose of the minimum bounding rectangle is to find the smallest rectangular frame that contains the handle area in the edge contour map, and determine the first boundary coordinates of the standard lighting handle area and the second boundary coordinates of the low lighting handle area , where and respectively represent the upper left coordinates of the rectangular frame, while and represent the width and height of the rectangular frame. The boundary coordinates are used to crop the image, removing the irrelevant background area in the image and focusing on the region of interest of the handle. Based on the above boundary coordinates, the original images of standard lighting and low lighting are cropped respectively to obtain the cropped standard lighting image and low lighting image. The cropping operation can reduce unnecessary background noise, making subsequent processing more focused and efficient. Bilinear interpolation processing is performed on the cropped standard lighting and low lighting images respectively to uniformly adjust their sizes to pixels, ensuring that images under different angles and different lighting conditions have the same spatial size, which helps to maintain consistency in subsequent feature extraction and matching processes and avoid errors caused by different sizes. After the image sizes are unified, the adjusted-size images of standard lighting and low lighting are converted from the RGB color space to the XYZ color space. The conversion from RGB to XYZ is carried out through the following standard conversion matrix:
[0039] ;
[0040] where, respectively represent the pixel values of the image in the red, green, and blue channels, respectively represent the color components of the image in the XYZ color space. The XYZ color space is more in line with the human eye's perception of color. Converting the image from RGB to XYZ can better preserve color features. Perform a non-linear transformation on the standard illumination image and the low-illumination image in the XYZ color space to map the XYZ values to the Lab color space. The Lab color space is a perceptually uniform color representation method, where represents the luminance channel, and represent the chrominance channels. The conversion of the color space can better separate the luminance information and the color information, which is more conducive to subsequent adjustment of the image luminance. Perform histogram equalization processing on the luminance channel L of the standard illumination image and the low-illumination image in the Lab color space. Enhance the contrast of the image by redistributing the luminance values, making the bright parts of the image brighter and the dark parts clearer. Combine the standard illumination image and the low-illumination image in the Lab color space that have undergone histogram equalization processing into an image pair to obtain the preprocessed image pair at each angle. For example, the image pairs at the same position under standard illumination and low-illumination conditions can complement each other. The overall surface structure is prominent under standard illumination conditions, while certain specific details are highlighted under low-illumination conditions. This combination helps to comprehensively analyze the defect characteristics of the aluminum alloy handle surface.
[0041] In one example, the preprocessed images at each angle are respectively input into the defect enhancement module, processed through three parallel convolutional branches and residual connections to obtain the enhanced feature maps at each angle, including: respectively inputting the preprocessed images at each angle into the first convolutional branch in the defect enhancement module, performing the first convolutional operation using a 3×3 convolutional kernel to obtain the first initial feature map; performing batch normalization on the first initial feature map to normalize the feature values to a distribution with a mean of 0 and a variance of 1 to obtain the first normalized feature map; applying the ReLU activation function to the first normalized feature map to introduce a non-linear transformation to obtain the first activated feature map; inputting the first activated feature map into the second 3×3 convolutional layer to perform the second convolutional operation to obtain the first intermediate feature map; performing the second batch normalization and ReLU activation processing on the first intermediate feature map to obtain the first refined feature map; respectively inputting the preprocessed images at each angle into the second convolutional branch in the defect enhancement module, performing the first convolutional operation using a 5×5 convolutional kernel to obtain the second initial feature map; performing batch normalization on the second initial feature map to normalize the feature values to a distribution with a mean of 0 and a variance of 1 to obtain the second normalized feature map; applying the ReLU activation function to the second normalized feature map to introduce a non-linear transformation to obtain the second activated feature map; inputting the second activated feature map into the second 5×5 convolutional layer to perform the second convolutional operation to obtain the second intermediate feature map; performing the second batch normalization and ReLU activation processing on the second intermediate feature map to obtain the second refined feature map; respectively inputting the preprocessed images at each angle into the third convolutional branch in the defect enhancement module, performing the first convolutional operation using a 7×7 convolutional kernel to obtain the third initial feature map; performing batch normalization on the third initial feature map to normalize the feature values to a distribution with a mean of 0 and a variance of 1 to obtain the third normalized feature map; applying the ReLU activation function to the third normalized feature map to introduce a non-linear transformation to obtain the third activated feature map; inputting the third activated feature map into the second 7×7 convolutional layer to perform the second convolutional operation to obtain the third intermediate feature map; performing the second batch normalization and ReLU activation processing on the third intermediate feature map to obtain the third refined feature map; inputting the first refined feature map, the second refined feature map, and the third refined feature map into the channel attention module to calculate the weight coefficients of each channel to obtain the first weighted feature map, the second weighted feature map, and the third weighted feature map; performing feature fusion on the first weighted feature map, the second weighted feature map, and the third weighted feature map, using 1×1 convolution for channel dimensionality reduction to obtain the fused feature map, and generating the residual connection feature map for the preprocessed images at each angle through 1×1 convolution; performing element-wise addition operation on the fused feature map and the residual connection feature map to obtain the initial enhanced feature map, performing a 3×3 convolutional operation on the initial enhanced feature map, and applying the Tanh activation function to map the feature values to the interval [-1, 1] to obtain the enhanced feature maps at each angle.
[0042] In this example, the preprocessed images at each angle are input into multiple convolutional branches in the defect enhancement module to extract features at different scales. The preprocessed images at each angle are input into the first convolutional branch of the defect enhancement module, and a convolution kernel is used to perform a convolution operation on the input image. The convolution operation is represented by the following formula:
[0043] ;
[0044] where represents the feature value of the first initial feature map at position , is the pixel value of the input image, is the weight of the convolution kernel, is the bias term. Through the convolution operation, the local features of the input image can be extracted to obtain the first initial feature map. Batch normalization is performed on the first initial feature map to normalize the distribution of the feature values to a mean of 0 and a variance of 1 to reduce the internal shift problem in training. After batch normalization, the first normalized feature map is obtained. The ReLU activation function is applied to the first normalized feature map to introduce a non-linear transformation. The role of the ReLU activation function is to increase the non-linear expression ability of the network, enabling the network to better adapt to complex input data. The expression of the ReLU activation function is:
[0045] ;
[0046] After being processed by the activation function, the first activated feature map is obtained. The first activated feature map is input into the second convolutional layer to perform a second convolution operation to obtain the first intermediate feature map. Similarly, the second batch normalization and ReLU activation processing are performed on the first intermediate feature map to stabilize the distribution of the feature map and increase the non-linear expression ability of the network, obtaining the first refined feature map. The preprocessed images at each angle are input into the second convolutional branch of the defect enhancement module. The second convolutional branch uses convolution kernel to perform the first convolution operation to obtain the second initial feature map. Similarly, batch normalization is performed on the second initial feature map to normalize the feature values to a distribution with a mean of 0 and a variance of 1, obtaining the second normalized feature map. The ReLU activation function is applied to the second normalized feature map to obtain the second activated feature map. The second activated feature map is input into the second convolutional layer to perform a second convolution operation to obtain the second intermediate feature map, and the second batch normalization and ReLU activation processing are performed on this intermediate feature map to obtain the second refined feature map. For the third convolutional branch, The convolution kernel of convolves the preprocessed image pairs at each angle to obtain the third initial feature map. Batch normalization is performed on the third initial feature map to normalize the eigenvalue and obtain the third normalized feature map. The ReLU activation function is applied to the third normalized feature map to introduce non-linear transformation and obtain the third activated feature map. The third activated feature map is input into the second convolution layer for the second convolution operation to obtain the third intermediate feature map, and batch normalization and ReLU activation processing are performed on it to obtain the third refined feature map. The first refined feature map, the second refined feature map, and the third refined feature map are input into the channel attention module. The channel attention module enhances the response of important features and weakens unimportant features by calculating the weight coefficient of each channel. Assuming the number of channels of the feature map is , the channel attention module calculates a weight coefficient for each channel, and its calculation formula is:
[0047] ;
[0048] where, is the activation function (usually the Sigmoid function), is the weight parameter of channel , represents the eigenvalue at position on channel , and represent the height and width of the feature map respectively. Through the channel attention module, the first weighted feature map, the second weighted feature map, and the third weighted feature map are obtained. Feature fusion is performed on the first weighted feature map, the second weighted feature map, and the third weighted feature map. Feature fusion performs channel dimensionality reduction through a 1 convolution to fuse all weighted feature maps and obtain a fused feature map. At the same time, the preprocessed image pairs at each angle generate residual connection feature maps through convolution. Residual connection is an effective network design that avoids the vanishing gradient problem in deep networks and makes the network more stable during training. The fused feature map and the residual connection feature map are subjected to element-wise addition operation to obtain the initial enhanced feature map. To optimize the feature expression, a convolution operation is performed on the initial enhanced feature map, and the Tanh activation function is applied to map the eigenvalue to the interval [-1, 1]. The expression of the Tanh activation function is:
[0049] ;
[0050] Through the Tanh activation function, the enhanced feature maps at each angle are obtained, and these enhanced feature maps have higher contrast and more prominent defect features.
[0051] In one example, illumination compensation processing is performed on the enhanced feature maps of each angle to obtain the illumination equalized images of each angle, including: converting the enhanced feature map of each angle into a grayscale image, obtaining the grayscale enhanced feature map by calculating the weighted average of the three RGB channels, applying a Gaussian filter to the grayscale enhanced feature map, performing a convolution operation using a 11×11 convolution kernel and a standard deviation σ = 5 to obtain a blurred illumination component image; converting the grayscale enhanced feature map and the blurred illumination component image into the logarithmic domain, obtaining the logarithmic domain grayscale image and the logarithmic domain illumination component image by taking the natural logarithm of each pixel value; performing a subtraction operation on the logarithmic domain grayscale image and the logarithmic domain illumination component image to obtain the logarithmic domain reflection component image, and performing an exponential operation on the logarithmic domain reflection component image, obtaining the reflection component image by calculating the natural exponent of each pixel value; calculating the global contrast enhancement factor based on the reflection component image, obtaining the contrast adjustment parameter by analyzing the distribution characteristics of the image histogram, and applying the contrast adjustment parameter to the reflection component image, enhancing the image contrast through a power function transformation to obtain the enhanced reflection component image; performing a pixel-level multiplication operation on the enhanced reflection component image and the original illumination component image to obtain a preliminary equalized image, dividing the preliminary equalized image into 8×8 sub-blocks and restricting the amplitude of contrast enhancement to obtain a locally enhanced equalized image, and at the same time, converting the locally enhanced equalized image from the grayscale space back to the RGB color space to obtain the illumination equalized image of each angle.
[0052] In this example, the enhanced feature map of each angle is converted from the RGB color space into a grayscale image. The grayscale image is obtained by calculating the weighted average of the three RGB channels, using the following formula:
[0053] ;
[0054] where, represents the pixel value of the grayscale enhanced feature map, respectively represent the pixel values of the red, green, and blue channels in the image. The weights in this formula are determined according to the sensitivity of the human eye to different colors. By weighted averaging, the color image is converted into a grayscale image. Apply a Gaussian filter to the grayscale enhanced feature map, using convolution kernel and standard deviation to perform a convolution operation. The role of the Gaussian filter is to eliminate noise by smoothing the image and obtain a blurred illumination component image. Its convolution operation is represented by the following formula:
[0055] ;
[0056] where, Denotes the pixel value of the blurred illumination component image at position , Denotes the weight of the Gaussian filter, specifically:
[0057] ;
[0058] This formula describes the distribution characteristics of the Gaussian weights. Denotes the standard deviation, which determines the smoothness of the Gaussian filtering. By Gaussian filtering, the high-frequency noise components in the image are removed to obtain a smoother image for representing the illumination component. The gray-scale enhanced feature map and the blurred illumination component image are respectively transformed into the logarithmic domain by taking the natural logarithm of each pixel value to obtain the logarithmic-domain gray-scale image and the logarithmic-domain illumination component image. This operation is represented by the following formula:
[0059] ;
[0060] Among them, Denotes the pixel value of the image in the logarithmic domain, Denotes the pixel value of the original image at position . Adding 1 is to avoid mathematical problems caused by taking the logarithm of positions with pixel value 0. In the logarithmic domain, the multiplication relationship of the image is transformed into an addition relationship, making the subsequent separation of reflection and illumination more convenient. Subtraction operation is performed on the logarithmic-domain gray-scale image and the logarithmic-domain illumination component image to obtain the logarithmic-domain reflection component image. It is represented by the following formula:
[0061] ;
[0062] Among them, Denotes the pixel value of the logarithmic-domain reflection component image. This step realizes the separation of reflection and illumination. Exponential operation is performed on the logarithmic-domain reflection component image. By calculating the natural exponent of each pixel value, it is mapped back to the original domain to obtain the reflection component image:
[0063] ;
[0064] The reflection component image describing the reflection characteristics of the object surface is obtained, which contains the detailed information of the surface without being affected by illumination. To improve the contrast of the reflection component image, global contrast enhancement is performed. By analyzing the distribution characteristics of the image histogram, the global contrast enhancement factor is calculated to obtain the contrast adjustment parameter. The contrast adjustment parameter is applied to the reflection component image, and the power function transformation is used to enhance the image contrast:
[0065] ;
[0066] Among them, A parameter representing contrast adjustment, which is determined through experiments or the distribution characteristics of the histogram. If , the contrast is enhanced and the dark areas are brightened. After this operation, the enhanced reflection component image better highlights the surface defects and details. Multiply the enhanced reflection component image and the original blurred illumination component image pixel by pixel to obtain a preliminary equalized image:
[0067] ;
[0068] Through this step, the enhanced reflection information is recombined into the illumination information to obtain an equalized image. Divide the preliminary equalized image into 8×8 sub-blocks and limit the amplitude of contrast enhancement in each sub-block to obtain a locally enhanced equalized image, avoiding the problem of excessive loss of details or overly dark areas caused by global contrast enhancement. Convert the locally enhanced equalized image from the grayscale space back to the RGB color space to restore the color information of the image and obtain the illumination equalized image for each angle. During this conversion process, the weighted distribution of the enhanced grayscale image is performed using the ratio of the RGB channels to restore the color information and finally obtain the illumination equalized image.
[0069] In one example, the illumination equalized images for each angle are respectively input into a denoising module. First, perform preliminary denoising through the non-local means algorithm, and then use the DnCNN network based on noise level estimation for optimization to obtain the denoised images for each angle, including: respectively input the illumination equalized images for each angle into the non-local means algorithm, set the search window size to 21×21 pixels, and the similarity window size to 7×7 pixels to obtain a preliminary denoised image; perform a Fourier transform on the preliminary denoised image to obtain a frequency domain representation image, calculate the power spectral density of the frequency domain representation image, and based on the power spectral density, use the maximum likelihood estimation method to calculate the noise variance of the image to obtain a noise level estimation value; input the preliminary denoised image and the noise level estimation value into the DnCNN network, where the DnCNN network contains 20 convolutional layers, each layer uses 64 3×3 convolutional kernels, and perform batch normalization on the output of each convolutional layer of the DnCNN network to adjust the mean of the feature map to 0 and the variance to 1 to obtain a target feature map; apply the ReLU activation function to the target feature map to introduce a non-linear transformation to obtain an activated feature map, and perform residual learning on the output of the last convolutional layer and the input image through element-wise subtraction to obtain a noise residual map; perform adaptive threshold processing on the noise residual map, dynamically adjust the threshold according to the local image features to obtain an optimized noise residual map, and subtract the optimized noise residual map from the preliminary denoised image to obtain the denoised images for each angle.
[0070] In this example, the illumination equalized images at each angle are input into the non-local means algorithm, which is a denoising algorithm that reduces noise by weighted averaging of similar pixel blocks in the image. To retain more image details while denoising, the size of the search window is set to pixels, and the size of the similarity window is pixels. The search window is used to find regions in the image that are similar to the current pixel block, and the similarity window is used to perform weighted summation on the similar regions. In this way, noise can be effectively suppressed while retaining the texture and details in the image as much as possible, obtaining a preliminary denoised image. The preliminary denoised image is subjected to Fourier transform to obtain its representation in the frequency domain. The Fourier transform can convert the image from the spatial domain to the frequency domain, providing information on the frequency components of the image. The formula for the Fourier transform is as follows:
[0071] ;
[0072] where, represents the frequency component in the frequency domain, represents the pixel value of the image in the spatial domain at position , and are the width and height of the image respectively, is the imaginary unit. Through the Fourier transform, the image in the frequency domain representation is obtained. Based on the frequency domain representation of the image, its power spectral density is calculated, and the power spectral density is used to describe the energy distribution of the image at different frequency components. Through the power spectral density, the noise variance of the image is estimated using the maximum likelihood estimation method. Let the power spectral density of the image be , then the estimation of the noise variance is expressed as
[0073] ;
[0074] where, represents the noise variance, represents the power spectral density at frequency , and are the dimensions of the image. Through this formula, the estimated value of the noise level of the image is obtained. The preliminary denoised image and the noise level estimated value are input into the DnCNN (Denoising Convolutional Neural Network) for further optimization. The DnCNN network contains 20 convolutional layers, and each convolutional layer uses convolution kernels, with a total of 64 channels. The convolutional kernels of each layer are used to extract local features of the image, thereby gradually removing the residual noise. Batch normalization is performed on the output of each convolutional layer to adjust the mean of the feature map to 0 and the variance to 1 to ensure the stability during the training process and accelerate the convergence of the network. The formula for batch normalization is as follows:
[0075] ;
[0076] Among them, is the normalized eigenvalue, is the original eigenvalue, and respectively represent the mean and variance of the features in the current batch. is a small positive number used to prevent division-by-zero errors. Through batch normalization processing, the problem of vanishing gradients in training is effectively alleviated. Apply the ReLU activation function to the normalized feature map to introduce a non-linear transformation to improve the network's ability to remove complex noise. The expression of the ReLU activation function is:
[0077] ;
[0078] The ReLU function sets values less than 0 to 0 while keeping values greater than 0 unchanged, thereby introducing sparsity and increasing the non-linear expression ability of the network. After being processed by the ReLU activation function, the activated feature map is obtained. In the last convolutional layer of DnCNN, the output feature map and the input image perform residual learning, and the noise residual map is obtained through element-wise subtraction:
[0079] ;
[0080] Among them, represents the pixel value of the noise residual map at position , and respectively represent the input image and the network output image. Residual learning directly predicts the distribution of noise by learning the difference between the input image and the denoised image, and better removes noise. Perform adaptive threshold processing on the noise residual map. Dynamically adjust the threshold according to local image features to ensure that noise in different regions is appropriately suppressed while trying to retain the details of the image. The adaptive threshold processing is expressed as
[0081] ;
[0082] Among them, represents the pixel value of the optimized noise residual map at position , is the dynamic threshold calculated based on local features. If the residual value is less than the threshold, it is set to 0, indicating that this is considered noise and is removed. Subtract the optimized noise residual map from the preliminary denoised image to obtain the denoised image. The calculation formula for the denoised image is:
[0083] ;
[0084] Among them, represents the pixel value of the denoised image, is the pixel value of the preliminary denoised image, is the optimized noise residual.
[0085] In one example, the denoised images at each angle are stitched and reconstructed to obtain a reconstructed surface image, and multi-scale feature fusion and surface defect detection are performed on the reconstructed surface image to obtain surface defect detection results, including: stitching and reconstructing the denoised images at each angle to obtain a reconstructed surface image; inputting the reconstructed surface image into a ResNet-50 network, and through five stages of convolution and pooling operations, obtaining a first-scale feature map, a second-scale feature map, a third-scale feature map, and a fourth-scale feature map; performing 1×1 convolution and upsampling operations on the fourth-scale feature map, and performing element-wise addition with the third-scale feature map to obtain a first upsampled feature map; performing 1×1 convolution and upsampling operations on the first upsampled feature map, and performing element-wise addition with the second-scale feature map to obtain a second upsampled feature map; performing 1×1 convolution and upsampling operations on the second upsampled feature map, and performing element-wise addition with the first-scale feature map to obtain a third upsampled feature map; inputting the first upsampled feature map, the second upsampled feature map, and the third upsampled feature map into a GA-RPN module, generating feature points through deformable convolution, classifying and regressing the feature points to obtain candidate regions; performing ROI Align operations on the candidate regions with the first upsampled feature map, the second upsampled feature map, and the third upsampled feature map to obtain multi-scale ROI features; inputting the multi-scale ROI features into a multi-task learning module, and simultaneously performing defect classification and bounding box regression to generate surface defect detection results including defect category, location, size, and shape.
[0086] In this example, the denoised images at each angle are stitched and reconstructed to obtain a reconstructed surface image. The reconstructed surface image is input into a ResNet-50 network for extracting deep features. ResNet-50 is a convolutional neural network with a residual connection structure, which can effectively solve the gradient vanishing problem in deep networks and extract different levels of features from images. ResNet-50 consists of five stages of convolution and pooling operations, and each stage extracts features of different scales through different convolutional kernels and pooling layers. Through this process, multi-scale feature maps are obtained, including a first-scale feature map, a second-scale feature map, a third-scale feature map, and a fourth-scale feature map. The low-scale feature maps mainly contain detailed information of the image, such as edges and textures, while the high-scale feature maps contain more abstract semantic information. To fuse multi-scale features, perform convolution and upsampling operations on the fourth-scale feature map to make it have the same spatial resolution as the third-scale feature map. Use The purpose of convolution is to reduce the number of channels while maintaining the information density of the features. The upsampling operation restores the spatial dimensions of the feature map through linear interpolation and then performs an element-wise addition operation with the feature map of the third scale to obtain the first upsampled feature map. This element-wise addition is expressed as:
[0087] ;
[0088] where, represents the value of the first upsampled feature map at position . represents the feature map of the third scale, and Up represents the result after upsampling the feature map of the fourth scale. Through this operation, features of different scales are fused to enhance the representation ability of the feature map. The first upsampled feature map is continued to be convolved and upsampled, and the result is added element-wise to the feature map of the second scale to obtain the second upsampled feature map:
[0089] ;
[0090] Similarly, in this way, low-scale features and high-scale features are effectively fused, taking into account both detailed information and global features. The second upsampled feature map is processed in the same way to obtain the third upsampled feature map, enabling the gradual fusion and enhancement of multi-scale features. The first, second, and third upsampled feature maps are input into the GA-RPN (Global Attention Region Proposal Network) module to generate candidate regions. The GA-RPN module generates feature points through deformable convolution, and the formula for deformable convolution is as follows:
[0091] ;
[0092] where, represents the output feature value at position , represents the value of the input feature map at the offset position , represents the weight of the convolution kernel, is the offset of the deformable convolution kernel. Deformable convolution adaptively adjusts the position of the convolution kernel according to the input features to better capture complex geometric shapes and improve sensitivity to defective areas. By classifying and regressing feature points, the GA-RPN module generates a set of candidate regions containing defects. The candidate regions are ROI Aligned with the first, second, and third upsampled feature maps to obtain multi-scale ROI features. The purpose of ROI Align is to accurately align the candidate regions with the corresponding feature maps to retain the detailed information in the region. The spatial interpolation during the alignment process can avoid the quantization error of the feature map. Through the ROI Align operation, features at different scales are obtained to ensure comprehensive information representation when detecting defects. The multi-scale ROI features are input into the multi-task learning module for defect classification and bounding box regression. The purpose of defect classification is to determine whether there is a defect and the category of the defect in each candidate region. The bounding box regression is used to accurately locate the position, size, and shape of the defect. The multi-task learning module optimizes both classification and regression tasks by sharing feature representation, so that the efficiency and accuracy of detection are improved. The classification is represented as:
[0093] ;
[0094] in, Represents the given ROI feature Category The probability of and They are the weight and bias parameters of the classification, and Softmax is used to convert the score into a probability distribution. Bounding box regression predicts the precise boundaries of the candidate area through the regression network:
[0095] ;
[0096] in, represents the adjustment parameters of the bounding box, and are the weights and biases of the regression network. Through this process, the surface defect detection results containing defect category, location, size and shape are finally generated.
[0097] Among them, the denoised images at each angle are stitched and reconstructed to obtain the reconstructed surface image, which includes: extracting feature points from the denoised images at each angle, using the SIFT algorithm to detect and describe local feature points, where the parameters of the SIFT algorithm are set as: the number of Gaussian pyramid levels is 4, the number of scales per level is 5, the contrast threshold is 0.04, and the edge response threshold is 10, to obtain the feature point set and 128-dimensional feature descriptors of each image; matching the feature point sets of the denoised images at adjacent angles, using the fast approximate nearest neighbor search algorithm for feature matching, setting the distance ratio threshold to 0.7, and then using the RANSAC algorithm to remove the mismatched points, where the number of RANSAC iterations is set to 1000 and the inlier threshold is set to 3 pixels, to obtain the valid matching point pairs; based on the valid matching point pairs, using the direct linear transformation algorithm to calculate the homography matrix between adjacent images, to obtain a 3×3 image transformation parameter matrix; constructing a cylindrical projection model, according to the actual diameter D and length L of the aluminum alloy handle, as well as the focal length f of the camera and the image size, establishing the mapping relationship from the image coordinates (u, v) to the cylindrical surface coordinates (θ, h): θ = arctan((u - u0) / (f*D / 2)), h = (v - v0)*L / V, where (u0, v0) is the image center point coordinates and V is the image height; transforming the denoised images at each angle according to the image transformation parameters and the cylindrical projection model, using bicubic interpolation to resample the image pixels, to obtain the projection images on the cylindrical surface; performing edge feathering processing on the projection images on the cylindrical surface, applying a Gaussian weight function with a width of 10% of the image width in the overlapping area, to obtain a smoothly transitional projection image; based on the cylindrical surface geometry, constructing the unfolding mapping from the cylindrical surface to the plane, mapping the cylindrical surface coordinates (θ, h) to the plane coordinates (x, y): x = D*θ / 2, y = h, using the nearest neighbor interpolation method to map the smoothly transitional projection image to the two-dimensional plane, to obtain the preliminary unfolded image; performing geometric correction on the preliminary unfolded image, using the mesh deformation method and bilinear interpolation, to compensate for the image deformation caused by unfolding, with the deformation mesh size set to 32×32 and the number of iterative optimizations set to 50, to obtain the corrected unfolded image; using the phase correlation method for image registration, aligning the corrected unfolded image with the standard aluminum alloy handle template, using the log-polar coordinate transformation to handle rotation and scale changes, and using sub-pixel phase correlation to achieve accurate translation estimation, to compensate for the geometric deviation caused by the shooting angle and position errors, to obtain the aligned unfolded image; performing image enhancement and detail restoration on the aligned unfolded image, enhancing the image contrast and detail clarity, and finally obtaining the reconstructed surface image.
[0098] In one example, it further includes: performing a CT scan on the aluminum alloy handle to obtain a 2D projection image, reconstructing 3D volume data through a filtered back-projection algorithm to obtain an internal defect model; performing feature point matching between the surface defect contour in the surface defect detection result and the surface of the internal defect model to obtain an initial registration result, and based on the initial registration result, performing fine surface registration on the surface defect contour and the internal defect model to obtain a registration transformation matrix; applying the registration transformation matrix to the surface defect detection result to map the surface defect information into the coordinate system of the internal defect model to obtain a comprehensive defect model in a unified coordinate system; extracting features for each defect in the comprehensive defect model, calculating the area, depth, volume, and shape factor of the defect to obtain a target defect feature set; scanning the surface of the aluminum alloy handle to obtain surface height data, and obtaining surface roughness parameters by calculating the root mean square roughness and the maximum profile height; based on the comprehensive defect model, using finite element analysis software to establish a mechanical model of the aluminum alloy handle, applying a preset load, calculating the stress distribution, and obtaining a stress concentration coefficient; comprehensively analyzing the target defect feature set, surface roughness, and stress concentration coefficient to obtain a quality assessment report of the aluminum alloy handle.
[0099] In this example, a CT scan is performed on the aluminum alloy handle to obtain a 2D projection image of its internal structure. CT scan is an imaging technique that can provide detailed internal structure information of an object. By performing X-ray scans on the handle from multiple angles, 2D projection images in different directions are obtained. The filtered back-projection algorithm is used to reconstruct the 3D volume data to obtain an internal defect model. Filtered back-projection is a classic method for reconstructing three-dimensional volume data. By filtering the projection images and then back-projecting each projection into the three-dimensional space, the volume data of the object is obtained. The filtering process is represented by the following formula:
[0100] ;
[0101] where, represents the filtered projection, is the projection data at angle and is the kernel function of the filter, and * represents the convolution operation. By filtering and back-projecting the projections at each angle, the internal three-dimensional structure of the aluminum alloy handle is reconstructed, including any existing internal defects. Feature point matching is performed between the surface defect contours in the surface defect detection results and the surface of the internal defect model to achieve surface-to-internal alignment. The feature point matching process involves detecting the feature points on the surface defects and the surface of the internal model, and then finding the most similar point pairs to obtain the initial registration result. The initial registration process uses SIFT feature extraction and the RANSAC algorithm to achieve a preliminary alignment by matching the feature points of the two models. Fine registration is performed on the surface defect contours and the internal defect model. The iterative closest point (ICP) algorithm is used for fine registration, and the point clouds of the surface defect contours and the internal defect model are iterated multiple times to minimize the Euclidean distance between the two sets of points, obtaining an accurate registration transformation matrix. The registration transformation matrix is represented as a homogeneous transformation matrix T:
[0102] ;
[0103] where, is a rotation matrix representing the rotation of the rigid body, and is a translation vector representing the translation of the rigid body. By applying the registration transformation matrix to the surface defect detection results, the surface defect information is mapped into the coordinate system of the internal defect model, obtaining a comprehensive defect model in a unified coordinate system. The comprehensive defect model contains the defect information on the surface of the aluminum alloy handle and its internal defect information, enabling the simultaneous analysis of internal and external structural features. In the comprehensive defect model, feature extraction is performed on each defect to calculate parameters such as its area, depth, volume, and shape factor. The area of the defect is calculated by triangulating the defect area and summing the areas of all small triangles to obtain the total area. The depth is calculated by measuring the maximum distance from the defect to the surface in the three-dimensional model, specifically expressed as:
[0104] ;
[0105] where, is the height of the surface, and is the height of the th point in the defect. The volume of the defect is obtained by volume integration of the defect area, and the shape factor is used to describe the complexity of the defect shape, usually expressed as the ratio of the surface area to the volume:
[0106] ;
[0107] Based on these features, a target defect feature set is constructed for quality assessment. The surface of the aluminum alloy handle is scanned to obtain surface height data. By analyzing the surface height data, parameters of surface roughness are calculated, including root mean square roughness (RMS Roughness, and maximum height (Maximum Height, ). The root mean square roughness measures the microscopic unevenness of the surface by calculating the standard deviation of the surface height, and its calculation formula is:
[0108] ;
[0109] where, represents the height of the th measurement point, is the average height of all measurement points, is the total number of measurement points. The maximum height is the difference between the maximum and minimum values of the surface height, and is used to measure the most significant uneven feature of the surface. Based on the comprehensive defect model, a mechanical model of the aluminum alloy handle is established using finite element analysis software. The preset load is applied to the mechanical model for stress analysis to calculate the stress distribution and stress concentration factor. The stress concentration factor is calculated by the following formula:
[0110] ;
[0111] where, represents the maximum stress at the defect, represents the reference stress away from the defect area. The stress concentration factor is an important index for evaluating the influence of defects on the structural strength, reflecting the degree of stress concentration at the defect. The larger the value, the more serious the stress concentration, which has a greater impact on the service life of the structure. A comprehensive analysis is performed on the target defect feature set, surface roughness parameters, and stress concentration factor to form a quality assessment report for the aluminum alloy handle. The quality assessment report includes a comprehensive analysis of internal and surface defects of the handle, including the area, depth, volume, and shape factor of each defect, as well as the surface roughness and stress concentration. By comprehensively considering these indicators, it is judged whether there are defects affecting the use performance of the handle, and whether these defects need to be repaired or affect the overall structural strength.
[0112] Referring to Figure 2 , this embodiment provides a surface defect detection device for an aluminum alloy handle, including:
[0113] The acquisition module 1 is used to acquire the standard illumination original images and low illumination original images of the aluminum alloy handle surface at multiple angles under standard illumination and low illumination conditions respectively, and perform preprocessing and image combination to obtain the preprocessed image pairs at each angle;
[0114] The enhancement module 2 is used to input the preprocessed image pairs at each angle into the defect enhancement module respectively, and process them through three parallel convolutional branches and residual connections to obtain the enhanced feature maps at each angle;
[0115] The compensation module 3 is used to perform illumination compensation processing on the enhanced feature maps at each angle respectively to obtain the illumination equalized images at each angle;
[0116] The denoising module 4 is used to input the illumination equalized images at each angle into the denoising module respectively, perform preliminary denoising through the non-local means algorithm, and then use the DnCNN network based on noise level estimation for optimization to obtain the denoised images at each angle;
[0117] The detection module 5 is used to splice and reconstruct the denoised images at each angle to obtain the reconstructed surface image, and perform multi-scale feature fusion and surface defect detection on the reconstructed surface image to obtain the surface defect detection result.
[0118] In this embodiment, for the specific implementation of each unit in the above device embodiment, please refer to that described in the above method embodiment, and details are not described herein again.
[0119] Refer to Figure 3 , in the embodiment of the present invention, a computer device is further provided. The computer device may be a server, and its internal structure may be as Figure 3 shown. The computer device includes a processor, a memory, a display screen, an input device, a network interface, and a database connected through a system bus. Among them, the processor of the computer design is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the corresponding data in this embodiment. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the above method is implemented.
[0120] Those skilled in the art can understand that Figure 3 the structure shown in
[0121] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the above method is implemented. It can be understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.
[0122] Those of ordinary skill in the art can understand that all or part of the processes of implementing the above method embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above method embodiments. Among them, any reference to a memory, storage, database, or other medium provided by the present invention and used in the embodiments can include non-volatile and / or volatile memories. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or an external cache. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM, etc.
[0123] It should be noted that in this article, the terms "including", "comprising", or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, device, article, or method including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, device, article, or method. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of another identical element in the process, device, article, or method including that element.
[0124] The above are only the preferred embodiments of the present invention, and do not limit the patent scope of the present invention accordingly. Any equivalent structural or equivalent process transformation made by using the specification and drawings of the present invention, or directly or indirectly applied in other related technical fields, are equally included in the patent protection scope of the present invention.
Claims
1. A method for detecting surface defects of aluminum alloy handles, characterized in that: The following steps are involved: Under standard lighting and low lighting conditions, standard lighting original images and low lighting original images of the aluminum alloy handle surface at multiple angles are collected respectively, and preprocessed and image combined to obtain preprocessed image pairs at each angle; The preprocessed image of each angle is input into the defect enhancement module respectively, and processed through three parallel convolution branches and residual connections to obtain the enhanced feature map of each angle; Perform illumination compensation processing on the enhanced feature map at each angle to obtain an illumination-balanced image at each angle; The illumination equalized image of each angle is input into the denoising module respectively, and the non-local mean algorithm is used for preliminary denoising, and then the DnCNN network based on noise level estimation is used for optimization to obtain the denoised image of each angle; specifically, the illumination equalized image of each angle is input into the non-local mean algorithm respectively, the search window size is set to 21×21 pixels, and the similarity window size is set to 7×7 pixels to obtain a preliminary denoised image; the preliminary denoised image is Fourier transformed to obtain a frequency domain representation image, and the power spectral density of the frequency domain representation image is calculated, and based on the power spectral density, the noise variance of the image is calculated using the maximum likelihood estimation method to obtain a noise level estimation value; the preliminary denoised image and the noise level estimation value are input into the DnCNN A network, wherein the DnCNN network comprises 20 convolutional layers, each layer uses 64 3×3 convolutional kernels, and batch normalization is performed on the output of each convolutional layer of the DnCNN network, the mean of the feature map is adjusted to 0, and the variance is adjusted to 1, so as to obtain a target feature map; a ReLU activation function is applied to the target feature map, a nonlinear transformation is introduced, and an activated feature map is obtained, and residual learning is performed on the output of the last convolutional layer and the input image, and a noise residual map is obtained by element-by-element subtraction operation; an adaptive threshold processing is performed on the noise residual map, and the threshold is dynamically adjusted according to local image features to obtain an optimized noise residual map, and the optimized noise residual map is subtracted from the preliminary denoised image to obtain a denoised image at each angle; The denoised images at each angle are spliced and reconstructed to obtain a reconstructed surface image, and multi-scale feature fusion and surface defect detection are performed on the reconstructed surface image to obtain a surface defect detection result.
2. The method for detecting surface defects of aluminum alloy handles according to claim 1, characterized in that: Under standard lighting and low lighting conditions, standard lighting original images and low lighting original images of the aluminum alloy handle surface at multiple angles are collected respectively, and preprocessed and image combined to obtain preprocessed image pairs at each angle, including: The surface of the aluminum alloy handle is photographed at multiple angles using a high-resolution industrial camera under standard lighting conditions of 5000 lumens to obtain original images of standard lighting at multiple angles, and the surface of the aluminum alloy handle is photographed at multiple angles using the same high-resolution industrial camera under low-light conditions of 1000 lumens to obtain original images of low lighting at multiple angles; Performing edge detection on the standard illumination original image and the low illumination original image respectively, extracting image edges using the Canny algorithm, and obtaining a standard illumination edge contour map and a low illumination edge contour map; Based on the standard-lighting edge contour map and the low-lighting edge contour map, respectively, minimum circumscribed rectangle calculation is performed on the standard-lighting original image and the low-lighting original image to determine a first boundary coordinate of a standard-lighting handle area and a second boundary coordinate of a low-lighting handle area; According to the first boundary coordinates and the second boundary coordinates, the standard-lighting original image and the low-lighting original image are respectively cropped to obtain a cropped standard-lighting image and a cropped low-lighting image, and bilinearly interpolated the cropped standard-lighting image and the cropped low-lighting image to uniformly adjust the image sizes to 1024×1024 pixels to obtain a resized standard-lighting image and a resized low-lighting image; Converting the resized standard lighting image and the resized low-light image from the RGB color space to the XYZ color space, using a standard RGB to XYZ conversion matrix for calculation to obtain a standard lighting image in the XYZ color space and a low-light image in the XYZ color space, and performing a nonlinear transformation on the standard lighting image in the XYZ color space and the low-light image in the XYZ color space, mapping the XYZ values to the Lab color space, and obtaining a standard lighting image in the Lab color space and a low-light image in the Lab color space; The standard illumination image in the Lab color space and the low illumination image in the Lab color space are subjected to histogram equalization processing of the brightness channel L, and the standard illumination image and the low illumination image in the Lab color space subjected to the histogram equalization processing are combined into an image pair to obtain a preprocessed image pair for each angle.
3. The method for detecting surface defects of aluminum alloy handles according to claim 1, characterized in that: The preprocessed image of each angle is input into the defect enhancement module respectively, and processed through three parallel convolution branches and residual connections to obtain an enhanced feature map of each angle, including: The preprocessed image of each angle is respectively input into the first convolution branch in the defect enhancement module, and the first convolution operation is performed using a 3×3 convolution kernel to obtain a first initial feature map; the first initial feature map is batch normalized to normalize the feature value to a distribution with a mean of 0 and a variance of 1 to obtain a first normalized feature map; the ReLU activation function is applied to the first normalized feature map to introduce a nonlinear transformation to obtain a first activated feature map; the first activated feature map is input into the second 3×3 convolution layer to perform a second convolution operation to obtain a first intermediate feature map; the first intermediate feature map is batch normalized and ReLU activated for the second time to obtain a first refined feature map; The preprocessed image pair of each angle is respectively input into the second convolution branch in the defect enhancement module, and a 5×5 convolution kernel is used to perform a first convolution operation to obtain a second initial feature map; the second initial feature map is batch normalized to normalize the feature value to a distribution with a mean of 0 and a variance of 1 to obtain a second normalized feature map; the ReLU activation function is applied to the second normalized feature map to introduce a nonlinear transformation to obtain a second activated feature map; the second activated feature map is input into a second 5×5 convolution layer to perform a second convolution operation to obtain a second intermediate feature map; the second intermediate feature map is batch normalized and ReLU activated for a second time to obtain a second refined feature map; The preprocessed image pair of each angle is respectively input into the third convolution branch in the defect enhancement module, and a 7×7 convolution kernel is used to perform a first convolution operation to obtain a third initial feature map; the third initial feature map is batch normalized to normalize the eigenvalues to a distribution with a mean of 0 and a variance of 1 to obtain a third normalized feature map; a ReLU activation function is applied to the third normalized feature map to introduce a nonlinear transformation to obtain a third activated feature map; the third activated feature map is input into a second 7×7 convolution layer to perform a second convolution operation to obtain a third intermediate feature map; the third intermediate feature map is batch normalized and ReLU activated for a second time to obtain a third refined feature map; Inputting the first fine feature map, the second fine feature map and the third fine feature map into a channel attention module, calculating a weight coefficient of each channel, and obtaining a first weighted feature map, a second weighted feature map and a third weighted feature map; Performing feature fusion on the first weighted feature map, the second weighted feature map, and the third weighted feature map, using 1×1 convolution to perform channel dimension reduction to obtain a fused feature map, and generating a residual connection feature map for the preprocessed image pair at each angle through 1×1 convolution; An element-wise addition operation is performed on the fused feature map and the residual connection feature map to obtain an initial enhanced feature map, and a 3×3 convolution operation is performed on the initial enhanced feature map. A Tanh activation function is applied to map the eigenvalues to the [-1, 1] interval to obtain an enhanced feature map for each angle.
4. The method for detecting surface defects of aluminum alloy handles according to claim 1, characterized in that: The step of performing illumination compensation processing on the enhanced feature map at each angle to obtain an illumination balanced image at each angle includes: The enhanced feature map of each angle is converted into a grayscale image, and the grayscale enhanced feature map is obtained by calculating the weighted average of the three RGB channels, and a Gaussian filter is applied to the grayscale enhanced feature map, and a convolution operation is performed using a 11×11 convolution kernel and a standard deviation σ=5 to obtain a blurred illumination component image; Converting the grayscale enhancement feature map and the blurred illumination component image to a logarithmic domain, and obtaining a logarithmic domain grayscale image and a logarithmic domain illumination component image by taking the natural logarithm of each pixel value; Performing a subtraction operation on the logarithmic domain grayscale image and the logarithmic domain illumination component image to obtain a logarithmic domain reflection component image, and performing an exponential operation on the logarithmic domain reflection component image to obtain a reflection component image by calculating the natural exponent of each pixel value; Calculating a global contrast enhancement factor based on the reflection component image, obtaining a contrast adjustment parameter by analyzing the distribution characteristics of the image histogram, applying the contrast adjustment parameter to the reflection component image, enhancing the image contrast by power function transformation, and obtaining an enhanced reflection component image; The enhanced reflection component image is multiplied by the original illumination component image at the pixel level to obtain a preliminary equalized image, the preliminary equalized image is divided into 8×8 sub-blocks and the amplitude of contrast enhancement is limited to obtain a locally enhanced equalized image, and at the same time, the locally enhanced equalized image is converted from the grayscale space back to the RGB color space to obtain an illumination equalized image at each angle.
5. The method for detecting surface defects of aluminum alloy handles according to claim 1, characterized in that: The denoised images at each angle are stitched and reconstructed to obtain a reconstructed surface image, and multi-scale feature fusion and surface defect detection are performed on the reconstructed surface image to obtain a surface defect detection result, including: The denoised images at each angle are stitched and reconstructed to obtain a reconstructed surface image; Inputting the reconstructed surface image into a ResNet-50 network, and performing convolution and pooling operations at five stages to obtain a first scale feature map, a second scale feature map, a third scale feature map, and a fourth scale feature map; Performing a 1×1 convolution and upsampling operation on the fourth scale feature map, and performing element-wise addition on the third scale feature map to obtain a first upsampling feature map; performing a 1×1 convolution and upsampling operation on the first upsampling feature map, and performing element-wise addition on the second scale feature map to obtain a second upsampling feature map; performing a 1×1 convolution and upsampling operation on the second upsampling feature map, and performing element-wise addition on the first scale feature map to obtain a third upsampling feature map; Inputting the first up-sampled feature map, the second up-sampled feature map, and the third up-sampled feature map into a GA-RPN module, generating feature points through deformable convolution, and classifying and regressing the feature points to obtain candidate regions; Performing a ROI Align operation on the candidate region, the first up-sampled feature map, the second up-sampled feature map, and the third up-sampled feature map to obtain a multi-scale ROI feature; The multi-scale ROI features are input into a multi-task learning module, and defect classification and bounding box regression are performed simultaneously to generate surface defect detection results including defect category, location, size and shape.
6. The method for detecting surface defects of aluminum alloy handles according to claim 1, characterized in that: The method further comprises: The aluminum alloy handle is CT scanned to obtain a 2D projection image, and the 3D volume data is reconstructed through the filtered back-projection algorithm to obtain the internal defect model; Matching feature points of the surface defect contour in the surface defect detection result with the surface of the internal defect model to obtain an initial registration result, and based on the initial registration result, performing surface fine registration on the surface defect contour and the internal defect model to obtain a registration transformation matrix; Applying the registration transformation matrix to the surface defect detection result, mapping the surface defect information to the coordinate system of the internal defect model, and obtaining a comprehensive defect model in a unified coordinate system; Extracting features of each defect in the comprehensive defect model, calculating the area, depth, volume, and shape factor of the defect, and obtaining a target defect feature set; Scan the surface of the aluminum alloy handle to obtain surface height data, and obtain surface roughness parameters by calculating the root mean square roughness and maximum profile height; Based on the comprehensive defect model, a mechanical model of the aluminum alloy handle is established using finite element analysis software, a preset load is applied, stress distribution is calculated, and a stress concentration coefficient is obtained; A comprehensive analysis is performed on the target defect feature set, the surface roughness and the stress concentration factor to obtain a quality assessment report of the aluminum alloy handle.
7. A device for detecting surface defects of aluminum alloy handles, characterized in that: The method for detecting surface defects of aluminum alloy handles according to any one of claims 1 to 6 is used to implement the steps of the method for detecting surface defects of aluminum alloy handles, the device for detecting surface defects of aluminum alloy handles comprising: The acquisition module is used to respectively acquire standard illumination original images and low illumination original images of the aluminum alloy handle surface at multiple angles under standard illumination and low illumination conditions, and perform preprocessing and image combination to obtain preprocessed image pairs at each angle; The enhancement module is used to input the preprocessed image of each angle into the defect enhancement module, and process it through three parallel convolution branches and residual connections to obtain an enhanced feature map of each angle; A compensation module is used to perform illumination compensation processing on the enhanced feature map at each angle to obtain an illumination balanced image at each angle; The denoising module is used to input the illumination equalization image of each angle into the denoising module, perform preliminary denoising using the non-local means algorithm, and then use the DnCNN network based on noise level estimation to optimize and obtain the denoised image of each angle; The detection module is used to splice and reconstruct the denoised images at each angle to obtain a reconstructed surface image, and perform multi-scale feature fusion and surface defect detection on the reconstructed surface image to obtain a surface defect detection result.
8. A computer device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the steps of the method for detecting surface defects of aluminum alloy handles according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for detecting surface defects of an aluminum alloy handle according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Image detection method for strip steel surface defects
CN118446981A
Printed matter detection method and device based on machine vision
CN118674713A