Unmanned aerial vehicle inspection image defect identification method and system based on machine learning

By using deep learning feature extraction and channel attention mechanisms, combined with illumination equalization, background suppression, and viewpoint correction, the problem of environmental interference in UAV inspection images was solved, achieving high-precision defect identification, reducing the false negative rate and the false positive rate, and improving the stability of the identification results.

CN121962078APending Publication Date: 2026-05-01CHINESE PEOPLES LIBERATION ARMY UNIT 95791 +1
View PDF 0 Cites 1 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINESE PEOPLES LIBERATION ARMY UNIT 95791
Filing Date
2026-01-19
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Images from drone inspections are susceptible to changes in lighting, background interference, and differences in shooting angles. Traditional machine learning methods lack the ability to adaptively capture multi-dimensional variations in complex scenes, resulting in insufficient expression of defect features, difficulty in effectively distinguishing real defects from background noise, high rates of missed and false detections, and inability to meet the needs of high-precision inspections.

Method used

A deep learning feature extraction network is used to obtain shallow texture features and deep semantic features of images. The core features of defects are enhanced by combining a channel attention mechanism. Environmental interference is eliminated through illumination equalization, background suppression and viewpoint correction. A defect classification network is used to achieve accurate separation of defect areas and background areas. Morphological features are used to verify and correct boundary offsets.

Benefits of technology

It significantly reduces the rate of missed and false detections of defects, improves the stability and reliability of identification results, meets the needs of high-precision inspection, and provides technical support for the large-scale application of UAV inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121962078A_ABST
    Figure CN121962078A_ABST
Patent Text Reader

Abstract

The invention discloses an unmanned aerial vehicle inspection image defect recognition method and system based on machine learning, and belongs to the technical field of image recognition, and the method specifically comprises the steps: firstly carrying out the illumination equalization, background suppression and visual angle correction preprocessing of an inspection image, and then employing a multi-scale deep network to extract shallow texture and deep semantic features, constructing a multi-dimensional defect feature set; introducing a channel attention mechanism into the multi-dimensional defect feature set, focusing a feature vector corresponding to a defect region, and suppressing a feature vector corresponding to background noise to obtain an enhanced defect core feature; inputting the enhanced features into a hierarchical classification network to obtain a preliminary candidate region; extracting morphological characteristics such as area and perimeter of the candidate region, checking by referring to a defect form template, removing false items and correcting the boundary; and finally, integrating the checked and corrected defect position information and the type result and outputting.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image recognition technology, and specifically to a method and system for identifying defects in UAV inspection images based on machine learning. Background Technology

[0002] The deep integration of drone technology and computer vision has led to the widespread application of drone inspection in various engineering fields, including power line inspection, bridge structure inspection, and oil and gas pipeline monitoring. It has become a core technological means for achieving efficient, non-contact defect detection. In the field of drone inspection image defect recognition, the current mainstream technical approach combines machine learning methods to build recognition models, completing defect detection and recognition through key steps such as image preprocessing, feature extraction, and defect classification.

[0003] However, images from drone inspections are susceptible to changes in lighting, background interference, and differences in shooting angle. Traditional machine learning methods rely on manually designed defect features and lack the ability to adaptively capture multi-dimensional variations in complex scenes. This results in insufficient expression of defect features, making it difficult to effectively distinguish between real defects and background noise, leading to problems such as missed defects and high false positive rates. Furthermore, these methods lack sufficient depth in extracting defect features, failing to accurately characterize the essential attributes of defects. This makes the stability and reliability of the identification results insufficient to meet the requirements of high-precision inspections, limiting their large-scale application in practical drone inspection scenarios. Summary of the Invention

[0004] The purpose of this invention is to provide a machine learning-based method and system for defect recognition in UAV inspection images, thereby solving the problems in the background art: The objective of this invention can be achieved through the following technical solutions: A machine learning-based method for defect identification in drone inspection images includes the following steps: S1. Acquire UAV inspection images and perform illumination equalization, background suppression and viewpoint correction on the images. S2. A deep learning feature extraction network is used to extract features from the preprocessed UAV inspection images to obtain shallow texture features and deep semantic features of the images, forming a multi-dimensional defect feature set. S3. Introduce a channel attention mechanism into the multi-dimensional defect feature set, focus on the feature vector corresponding to the defect region, suppress the feature vector corresponding to the background noise, and obtain the enhanced core defect features. S4. Input the enhanced core features of the defects into the defect classification network, and separate the defect region from the background region through the hierarchical discrimination of the network to output the preliminary defect candidate region. S5. Extract the morphological features of the preliminary defect candidate region, verify the candidate region based on the essential morphological attributes of the defect, eliminate false candidate regions that do not meet the attributes, and correct candidate regions with boundary offset. S6. Integrate and verify the defect area information, and output the final identification result including the defect location and type.

[0005] As a further aspect of the present invention: in step S1, the process of performing illumination equalization, background suppression, and viewpoint correction on the image is as follows: The drone inspection images are converted to the HSV color space, the hue and saturation channel values ​​are fixed, and histogram equalization is performed on the lightness channel to complete the illumination equalization process. Based on the grayscale distribution characteristics of the image after illumination equalization, an adaptive threshold segmentation algorithm is used to divide the pixel region, separate the foreground defect-related region from the background region, and achieve background suppression. Retrieve the camera intrinsic and extrinsic parameters recorded during drone inspection, construct a projection transformation matrix, and perform pixel coordinate mapping on the image based on the matrix to complete the viewpoint correction operation. The images are processed sequentially by applying illumination equalization, background suppression, and viewpoint correction, and the resulting pre-processed UAV inspection images are output after eliminating the three types of interference.

[0006] As a further aspect of the present invention: In step S2, the process of using a deep learning feature extraction network to extract features from the preprocessed UAV inspection image, obtaining shallow texture features and deep semantic features of the image, and forming a multi-dimensional defect feature set is as follows: A deep learning feature extraction network containing multi-scale convolutional kernels is constructed. The preprocessed UAV inspection image is input into the initial convolutional layer of the network to start the feature extraction process. The initial convolutional layer of the network performs sliding operations using small-sized convolutional kernels to capture local grayscale changes, edge contours, texture direction and local contrast information of the image, and generate corresponding shallow texture feature maps. The network performs operations alternately with deep convolutional blocks and pooling layers, while introducing a cross-layer feature fusion mechanism to aggregate global context information and generate corresponding deep semantic feature maps. The shallow texture feature map and the deep semantic feature map are aligned in dimension, and the two types of feature maps are spliced ​​together according to the channel dimension to form a multi-dimensional defect feature set.

[0007] As a further aspect of the present invention: In step S3, the process of introducing a channel attention mechanism into the multi-dimensional defect feature set, focusing on the feature vector corresponding to the defect region, suppressing the feature vector corresponding to the background noise, and obtaining the enhanced core defect features is as follows: Perform global average pooling and global max pooling operations on the multi-dimensional defect feature set, concatenate the two pooling results, and obtain an aggregated feature vector that can represent the global feature distribution. The aggregated feature vector is input into the attention generation module, which consists of a fully connected layer and an activation function. Through hierarchical operations, a channel attention weight vector with the same channel dimension as the feature set is generated. The channel attention weight vector is multiplied element-wise with the original multidimensional defect feature set to strengthen the features of high-weight defect regions and weaken the features of low-weight background noise. The channel dimension normalization process is performed on the features after element-wise multiplication, and the enhanced feature information is integrated to obtain the enhanced core defect features.

[0008] As a further aspect of the present invention: the specific method for performing global average pooling and global max pooling operations on the multi-dimensional defect feature set, and concatenating the two pooling results to obtain an aggregated feature vector that can characterize the global feature distribution is as follows: Define the channel, height, and width dimensions of the multi-dimensional defect feature set. For each channel, iterate through all pixels, calculate the average pixel value, generate the average feature component corresponding to a single channel, and integrate all components to obtain the average pooling vector. Based on the same multi-dimensional defect feature set, numerical comparisons are performed on all pixels in each channel, the maximum pixel value of each channel is selected as the feature component, and the maximum components of all channels are summed to obtain the max pooling vector. Verify the consistency of the number of channels between the average pooling vector and the max pooling vector, and concatenate the two vectors end to end according to the channel order to form a combined feature vector containing information from both types of pooling. By maintaining the channel dimension and numerical integrity of the combined feature vectors and removing redundant vector structures, we finally obtain an aggregated feature vector that can characterize the global feature distribution.

[0009] As a further aspect of the present invention: In step S4, the process of inputting the enhanced core defect features into the defect classification network, separating the defect region from the background region through hierarchical discrimination of the network, and outputting preliminary defect candidate regions is as follows: The enhanced core defect features are subjected to convolutional dimensionality reduction processing to adjust the number of feature channels and spatial dimension so that the feature dimension is fully matched with the input requirements of the defect classification network. Construct a defect classification network that includes a feature mapping layer, a cross-level interaction module, and a discriminant output layer, and input the adapted core defect features into the network feature mapping layer; Each layer of the network sequentially performs transformation and interactive operations on the features. Each discriminative output layer outputs the region category probability of the corresponding layer. The probabilities of all layers are fused through the cross-layer interaction module. Based on the fused category probability, the region affiliation of each pixel is determined, continuous defect pixel clusters are divided, the cluster boundary coordinates are marked, and preliminary defect candidate regions are output.

[0010] As a further aspect of the present invention: In step S5, the process of extracting the morphological features of the preliminary defect candidate region, verifying the candidate region based on the essential morphological attributes of the defect, eliminating false candidate regions that do not meet the attributes, and correcting candidate regions with boundary offsets is as follows: Traverse each preliminary defect candidate region, calculate the region's area, perimeter, aspect ratio, and boundary smoothness, and fully extract these specific morphological features that characterize the region's morphology. Establish essential morphological attribute templates corresponding to different defect types, and compare the extracted morphological features with the corresponding templates item by item to complete the morphological attribute verification of the candidate region. Based on the verification results, all candidate regions whose morphological features do not match the corresponding attribute templates are directly eliminated, clearly distinguishing between false candidate regions and true candidate regions; Morphological erosion and dilation operations are performed on the retained real candidate regions, and the region contour coordinates are adjusted by combining the boundary fitting algorithm to correct candidate regions with boundary offset.

[0011] As a further aspect of the present invention: in step S6, the process of integrating and verifying the defect area information and outputting the final identification result containing the defect location and type is as follows: Extract the location boundary coordinates and corresponding defect type identifier of each verified and corrected defect area to establish an independent information unit containing complete information about a single defect. All independent information units are categorized and organized according to defect type, and the location boundary coordinates of each defect area under the same type are associated to form a structured defect information set; The structured defect information set is sorted out according to a unified format, each defect type and its corresponding full location boundary coordinates are clearly marked, and the final identification result is output.

[0012] A machine learning-based drone inspection image defect recognition system includes: The image preprocessing module is used to acquire UAV inspection images and perform illumination equalization, background suppression and viewpoint correction on the images. The feature extraction module is used to extract features from the preprocessed UAV inspection images using a deep learning feature extraction network, to obtain the shallow texture features and deep semantic features of the images, forming a multi-dimensional defect feature set; The attention enhancement module is used to introduce a spatial attention mechanism into a multi-dimensional defect feature set, focusing on the feature vector corresponding to the defect region and suppressing the feature vector corresponding to the background noise, so as to obtain the enhanced core defect features. The defect classification module is used to input the enhanced core features of defects into the defect classification network, and to separate the defect region from the background region through the hierarchical discrimination of the network, and output the preliminary defect candidate region. The morphological verification module is used to extract the morphological features of the preliminary defect candidate region, verify the candidate region based on the essential morphological attributes of the defect, eliminate false candidate regions that do not meet the attributes, and correct candidate regions with boundary offsets. The results integration module is used to integrate the verified and corrected defect area information and output the final identification result containing the defect location and type.

[0013] The beneficial effects of this invention are: This invention effectively solves the core problem of interference from lighting, background, and viewing angle in inspection images through a three-step collaborative preprocessing and multi-dimensional feature extraction strategy. Illumination equalization eliminates uneven grayscale distribution caused by lighting variations, background suppression accurately separates foreground defects from complex backgrounds, and viewing angle correction corrects geometric distortions caused by shooting angle deviations, reducing the impact of environmental interference on recognition from the source. Furthermore, a deep learning network simultaneously captures shallow texture features and deep semantic features, combined with a channel attention mechanism to strengthen key defect channel features and weaken noise channel interference, resulting in more complete expression of defect features. This significantly improves the distinguishability between real defects and background noise, and significantly reduces the false negative and false positive rates for defects.

[0014] This invention enhances the stability and reliability of recognition results through a dual guarantee of hierarchical discrimination and morphological verification, meeting the needs of high-precision inspection. Utilizing the hierarchical discrimination capability of the defect classification network, it achieves accurate separation of defect areas from the background. Morphological features are extracted from preliminary candidate areas, and false candidate areas are eliminated and boundary offsets are corrected based on the essential morphological attributes of the defects, accurately depicting the essential attributes of the defects. The entire technical solution forms a closed loop of "interference elimination - feature enhancement - accurate recognition - verification and correction," effectively compensating for the insufficient feature extraction depth of traditional methods. This ensures that the recognition results maintain high stability even in complex scenarios, providing technical support for the large-scale practical application of UAV inspection. Attached Figure Description

[0015] The invention will now be further described with reference to the accompanying drawings.

[0016] Figure 1 This is a flowchart illustrating a machine learning-based method for identifying defects in UAV inspection images according to the present invention.

[0017] Figure 2 This is a schematic diagram of a machine learning-based drone inspection image defect recognition system according to the present invention. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] Please see Figure 1 As shown, this invention is a machine learning-based method for defect recognition in UAV inspection images, comprising the following steps: S1. Acquire UAV inspection images and perform illumination equalization, background suppression and viewpoint correction on the images. S2. A deep learning feature extraction network is used to extract features from the preprocessed UAV inspection images to obtain shallow texture features and deep semantic features of the images, forming a multi-dimensional defect feature set. S3. Introduce a spatial attention mechanism into the multi-dimensional defect feature set, focus on the feature vector corresponding to the defect region, suppress the feature vector corresponding to the background noise, and obtain the enhanced core defect features. S4. Input the enhanced core features of the defects into the defect classification network, and separate the defect region from the background region through the hierarchical discrimination of the network to output the preliminary defect candidate region. S5. Extract the morphological features of the preliminary defect candidate region, verify the candidate region based on the essential morphological attributes of the defect, eliminate false candidate regions that do not meet the attributes, and correct candidate regions with boundary offset. S6. Integrate and verify the defect area information, and output the final identification result including the defect location and type.

[0020] In one embodiment of the present invention, the process of performing illumination equalization, background suppression, and viewpoint correction on the image in step S1 is as follows: First, illumination equalization is performed. After acquiring the raw inspection images from the drone, the system converts the images from the red-green-blue color space to the hue-saturation-lightness color space. This conversion process uses a standard color space conversion formula, where the hue channel value range is set to 0 to 180, the saturation channel value range is set to 0 to 255, and the lightness channel value range is also set to 0 to 255. After the conversion, the system keeps all pixel values ​​in the hue and saturation channels unchanged, processing only the lightness channel. When performing histogram equalization on the lightness channel, the system first counts the pixel distribution of gray levels 0 to 255 within that channel, calculates the cumulative distribution function, and then maps the original gray values ​​to new uniformly distributed gray values ​​based on the cumulative distribution function. The mapping formula is: the new gray value equals the cumulative distribution function value multiplied by 255 and then rounded down. This operation effectively expands the dynamic range of the image, allowing areas that were originally too dark or too bright due to uneven illumination to obtain an appropriate gray distribution, thus completing the illumination equalization process. After processing, the image is converted from the hue, saturation, and brightness color space back to the red, green, and blue color space.

[0021] Next, background suppression is performed. The system calculates the grayscale distribution characteristics of the image after illumination equalization. Specifically, the color image is converted to a grayscale image, and then the image is divided into local regions. The size of each local region is set to a square window of 11 by 11 pixels, and the system traverses the entire image using a sliding window approach. Within each local window, the average grayscale value of that region is calculated as a local threshold benchmark. When using an adaptive threshold segmentation algorithm, the segmentation threshold for each pixel is equal to the average grayscale value of its local window minus a constant offset. This offset is typically set between 5 and 15; in this embodiment, it is set to 10. If the grayscale value of a pixel is greater than its corresponding local threshold, the pixel is identified as a foreground defect-related region and marked with a pixel value of 255; otherwise, it is identified as a background region and marked with a pixel value of 0. Through this locally adaptive threshold segmentation method, the system can effectively handle situations where there are large differences in grayscale values ​​between different regions of the image, accurately separate the foreground from the background, and achieve the purpose of background suppression.

[0022] Finally, a viewpoint correction operation is performed. The system retrieves camera parameter information recorded by the onboard equipment during the UAV's inspection flight, including the camera intrinsic and extrinsic parameter matrices. The camera intrinsic parameter matrix contains inherent parameters such as focal length, principal point coordinates, and distortion coefficients. Examples of focal length values ​​in the horizontal and vertical directions are 1200 pixels and 1200 pixels respectively. Examples of principal point coordinates are the image center position (960 pixels in width and 540 pixels in height). Examples of radial distortion coefficients are -0.15 and 0.08, and examples of tangential distortion coefficients are 0.001 and -0.002. The camera extrinsic parameter matrix contains rotation and translation vectors, describing the camera's attitude and position relative to the world coordinate system. Based on these parameters, a projection transformation matrix is ​​constructed from distorted image coordinates to corrected image coordinates. Specifically, the original pixel coordinates are first distorted using the distortion coefficients, then the projection relationship of points in three-dimensional space is calculated using the rotation and translation vectors, ultimately obtaining the pixel coordinate mapping relationship. Based on the projection transformation matrix, the system remaps the coordinates of each pixel in the image, correcting the image taken from an oblique perspective to a normal viewing perspective, thus eliminating measurement errors caused by perspective distortion. For blank pixel areas appearing after mapping, bilinear interpolation is used to fill them, ensuring the integrity of the corrected image.

[0023] The system strictly follows the sequence of illumination equalization, background suppression, and viewpoint correction to perform the three processing steps. The output image of each step is directly used as the input image for the next step, forming a continuous preprocessing flow. After all three steps are completed, the system outputs a preprocessed UAV inspection image that simultaneously eliminates interference from uneven illumination, background noise, and viewpoint distortion. This image will serve as input data for deep learning feature extraction and defect recognition, providing a high-quality image foundation for accurate defect identification.

[0024] In one embodiment of the present invention, step S2, in which a deep learning feature extraction network is used to extract features from the preprocessed UAV inspection image to obtain shallow texture features and deep semantic features of the image, forming a multi-dimensional defect feature set, is as follows: First, a deep learning feature extraction network with multi-scale convolutional kernels is constructed. This network adopts an encoder structure design, comprising five convolutional blocks, each with convolutional kernels of different sizes to achieve multi-scale feature capture. Specifically, the first convolutional block uses 64 3x3 kernels; the second convolutional block uses 64 and 32 kernels of 3x3 and 5x5 sizes respectively; the third convolutional block uses 128, 64, and 32 kernels of 3x3, 5x5, and 7x7 sizes respectively; the fourth and fifth convolutional blocks have the same kernel configuration as the third convolutional block, but the number of channels is doubled. Preprocessed UAV inspection images, with an image size of 1920x1080 pixels and 3 channels, are used as network input. The image first enters the network's initial convolutional layer, which contains 64 3x3 convolutional kernels with a stride of 1 pixel and padding of 1 pixel at the edges to ensure that the spatial dimensions of the output feature map are consistent with the input image. Upon receiving the input image, the initial convolutional layer immediately initiates the feature extraction process, beginning the layer-by-layer abstraction of features from the image.

[0025] When the initial convolutional layers of the network perform feature extraction, each 3x3 convolutional kernel slides across the input image with a set stride. It's important to note that small convolutional kernels can effectively capture subtle changes in local image regions. This is because the kernel size determines its receptive field; a 3x3 kernel focuses only on the central pixel and its eight surrounding pixels. This local receptive field characteristic allows convolutional operations to sensitively detect grayscale differences between pixels, abrupt edge changes, texture directionality, and local brightness contrast. Specifically, the nine weight parameters of the convolutional kernel are element-wise multiplied with the nine pixel values ​​at the corresponding positions, summed, and then the bias parameter is added to obtain the feature response value at that location. Sixty-four convolutional kernels perform this operation, each learning to capture different types of local feature patterns. For example, some kernels exhibit horizontal gradient characteristics in their weight distribution, enabling them to detect horizontal edges; others exhibit vertical gradient characteristics, enabling them to detect vertical edges; and still others can detect diagonal edges, corners, and texture repetition patterns. After the convolution operation is completed, a modified linear unit activation function is applied to each feature response value. This function sets negative feature responses to 0 while leaving positive feature responses unchanged, introducing non-linear transformation capability. Finally, a shallow texture feature map with 64 channels is generated, with a feature map size of 1920 x 1080 pixels. Each channel corresponds to the detection result of a local texture mode.

[0026] The network performs a more complex feature learning process at a deeper level. Starting from the second convolutional block, convolutional blocks and pooling layers alternately perform operations, forming a deep feature extraction path. The second convolutional block receives shallow texture feature maps as input, performs operations through its internal multi-scale convolutional kernels, and outputs a feature map with 128 channels. This is followed by a max pooling layer with a pooling window size of 2 x 2 pixels and a stride of 2 pixels. This pooling operation reduces the spatial size of the feature map to 960 x 540 pixels. It's worth noting that the pooling layer achieves spatial dimensionality reduction and increases the receptive field of subsequent convolutional layers. This is because the pooling operation selects the maximum response value within each 2 x 2 window as a representative value, preserving the most salient local feature information while halving the feature map size. This allows subsequent convolutional layers to cover a larger area of ​​the original image with the same kernel size, thereby capturing more macroscopic semantic information. The third, fourth, and fifth convolutional blocks sequentially perform similar alternating convolution and pooling operations, with the number of feature map channels gradually increasing to 256, 512, and 512, respectively, and the spatial size gradually decreasing to 480 x 270 pixels, 240 x 135 pixels, and 120 x 68 pixels. A cross-layer feature fusion mechanism is introduced into the deep convolutional blocks. Specifically, the output feature map of the third convolutional block is upsampled to the spatial size of the output feature map of the second convolutional block, and then concatenated along the channel dimension. The fused feature simultaneously contains mid-level and deep semantic information. It should be noted that the cross-layer feature fusion mechanism can aggregate global contextual information at different levels of abstraction. This is because shallow features contain rich spatial details but have a low level of semantic abstraction, while deep features contain highly abstract semantic concepts but lose more spatial details. Cross-layer fusion combines the deep global semantic understanding capability with the shallow fine-grained localization capability to generate a deep semantic feature map that possesses both global contextual awareness and retains spatial details. The final output deep semantic feature map has 512 channels and a spatial size of 120 x 68 pixels.

[0027] After extracting the shallow texture feature map and the deep semantic feature map, dimensional alignment of the two types of feature maps is required for stitching. The shallow texture feature map has 64 channels and a spatial size of 1920 x 1080 pixels; the deep semantic feature map has 512 channels and a spatial size of 120 x 68 pixels. The dimensional alignment process consists of two steps: spatial dimension alignment and channel dimension adjustment. Spatial dimension alignment uses bilinear interpolation upsampling to enlarge the spatial size of the deep semantic feature map from 120 x 68 pixels to 1920 x 1080 pixels, making it completely consistent with the spatial size of the shallow texture feature map. It should be noted that bilinear interpolation upsampling can smoothly restore the spatial resolution of the feature map because this method estimates the new pixel value by calculating the weighted average of the four known pixels surrounding the target location. The weights are distributed according to distance, with closer pixels having larger weights. The feature map generated by this interpolation method is visually continuous and smooth, avoiding the blocky effect produced by nearest-neighbor interpolation. After spatial alignment, both types of feature maps have a spatial size of 1920 x 1080 pixels, but the number of channels still differs. Next, the two types of feature maps are concatenated along the channel dimension. Specifically, the 64 channels of the shallow texture feature map and the 512 channels of the deep semantic feature map are concatenated end-to-end along the channel axis, forming a multi-dimensional defect feature set containing 576 channels. This feature set has a spatial size of 1920 x 1080 pixels, and the feature vector at each spatial location has a length of 576 dimensions. The first 64 dimensions come from the shallow texture features, and the last 512 dimensions come from the deep semantic features, comprehensively reflecting the local texture pattern and global semantic attributes at that location, providing a comprehensive feature representation for defect identification.

[0028] In one embodiment of the present invention, step S3, which involves performing illumination equalization, background suppression, and viewpoint correction on the image, is as follows: Global average pooling and global max pooling operations are performed on the multi-dimensional defect feature set. The results of the two pooling operations are concatenated to obtain an aggregated feature vector that can represent the global feature distribution. Specifically: The specific method for performing global average pooling on a multi-dimensional defect feature set is as follows. First, the three key dimension parameters of the feature set are defined: the number of channels C, the height H, and the width W, which are set to 256, 32, and 32 respectively in this embodiment. For each channel in the feature set, it is necessary to traverse all pixels in the channel, specifically, traversing H x W pixel positions of that channel. For the k-th channel, where k ranges from 1 to C, the values ​​of all pixels in that channel are summed, and then divided by the total number of pixels H x W to obtain the average feature component of that channel. Mathematically, the formula for calculating the average feature component of the k-th channel is the sum of all pixel values ​​in that channel divided by H x W. It should be noted that calculating the average value allows us to obtain the central trend of the feature distribution within each channel, reflecting the overall activation intensity of that channel, which is of significant reference value for determining whether the channel contains valid defect-related information. Performing the above average value calculation operation on each of the C channels sequentially yields C average feature components. These C components are arranged and combined according to channel order to form a one-dimensional vector of dimension C multiplied by 1, which is the average pooling vector. In this embodiment, the average pooling vector contains 256 elements, each element corresponding to the average activation level of a channel in the original feature set.

[0029] Based on the same multi-dimensional defect feature set used in calculating the average pooling vector, a global max pooling operation is performed to obtain the max pooling vector. The core operation of this process is to compare the numerical values ​​of all pixels within each channel to select the most significant activation response for each channel. Specifically, for the k-th channel (where k ranges from 1 to C), all pixels at spatial locations H x W within that channel are traversed, and their values ​​are compared one by one. The maximum value is recorded and retained as the maximum feature component of that channel. In terms of algorithm implementation, an iterative comparison method can be used. A temporary variable is initialized with the first pixel value of that channel, and then compared sequentially with subsequent pixel values. If a larger value is found, the temporary variable is updated. After the traversal is complete, the temporary variable stores the maximum pixel value of that channel. It should be noted that max pooling captures the strongest local feature responses within each channel. These peak responses often correspond to key feature activation locations in defective regions, focusing more on salient features than overall distribution compared to average pooling. Repeating the above maximum value selection operation for all C channels yields C maximum feature components. These C components are organized into a one-dimensional vector structure with dimension C multiplied by 1 according to the channel index, which is the max pooling vector. In this embodiment, the vector also contains 256 elements.

[0030] After obtaining the average pooling vector and the max pooling vector, these two vectors need to be concatenated to form a combined feature vector containing double pooling information. Before performing the concatenation operation, data validation is required to confirm that the number of channels in the average pooling vector and the max pooling vector are consistent. Specifically, the validation method is to read the dimension of the average pooling vector, denoted as C1, and the dimension of the max pooling vector, denoted as C2, and determine whether C1 equals C2. Under normal circumstances, since both vectors originate from the same multi-dimensional defect feature set, their number of channels must be equal. If an anomaly of C1 not equal to C2 is detected, subsequent processing is terminated and an error message is output. After passing the validation, the two vectors are concatenated end-to-end according to channel order. Specifically, the C elements of the max pooling vector are appended to the C elements of the average pooling vector, forming a combined vector with a dimension of 2C x 1. It should be noted that this concatenation method can simultaneously retain average pooling and max pooling information in a single vector structure, allowing the subsequent attention generation module to comprehensively utilize two complementary feature statistics to generate more accurate channel attention weights. In this embodiment, the concatenated combined feature vector has a dimension of 512 by 1, with the first 256 elements coming from average pooling and the last 256 elements coming from max pooling.

[0031] The concatenated feature vector undergoes final processing to obtain the aggregated feature vector used for attention generation. This processing must maintain the channel dimension and numerical integrity of the combined feature vector, ensuring that the 2C elements and their corresponding values ​​remain unchanged or undamaged. Simultaneously, it's necessary to remove any redundant structures, referring to extra dimensions or nested structures introduced during vector representation. In practice, if the combined feature vector is stored in memory as a multidimensional array structure, such as 2C x 1 x 1 or 1 x 2C x 1, it needs to be compressed into a standard one-dimensional vector form, i.e., a vector structure with a strict 2C dimension. Redundancy removal can be achieved using a tensor reshaping function, compressing and eliminating unnecessary dimensions of length 1. It's important to note that ensuring the simplicity and standardization of the vector structure is crucial for input matching in the subsequent attention generation module, as fully connected layers require input data in a standard one-dimensional vector format; any additional dimension will lead to matrix operation dimension mismatch errors. After the above processing, the final aggregated feature vector with 2C dimensions, complete numerical content, and a simple and standardized structure is obtained. This vector integrates two global feature statistics: average pooling and max pooling. It can comprehensively represent the global distribution characteristics of the multi-dimensional defect feature set and provide sufficient input information for generating high-quality channel attention weights.

[0032] The aggregated feature vector obtained above is input into a pre-constructed attention generation module for processing. This attention generation module consists of two fully connected layers and an activation function, specifically a first fully connected layer, a first activation function, a second fully connected layer, and a second activation function connected in sequence. The input dimension of the first fully connected layer is consistent with the dimension of the aggregated feature vector, which is 2C. The output dimension is set to C divided by r, where r is the dimensionality reduction ratio parameter. In this embodiment, it can be set to 8, that is, when C equals 256, the output dimension of the first fully connected layer is 32. The first activation function is the modified linear unit activation function, used to introduce nonlinear transformation capability. The input dimension of the second fully connected layer is C divided by r, and the output dimension is restored to C, consistent with the number of channels in the original feature set. The second activation function is the sigmoid function, which compresses the output value range to between 0 and 1, making it meet the value requirements of attention weights. It should be noted that by using a structure design of first reducing and then increasing the dimensionality, the attention generation module can learn the complex nonlinear dependencies between channels while ensuring computational efficiency, thereby generating reasonable importance weights for each channel. The final output is a channel attention weight vector with dimension C by 1, where each element corresponds to the importance weight value of a channel in the original feature set.

[0033] After obtaining the channel attention weight vector, it needs to be multiplied element-wise with the original multi-dimensional defect feature set to achieve differentiated modulation of features from different channels. Specifically, the channel attention weight vector of dimension C x 1 is first expanded spatially to C x H x W, ensuring a perfect match with the dimensions of the original feature set. In this embodiment, if the original feature set has dimensions of 256 x 32 x 32, the weight vector is expanded from 256 x 1 to 256 x 32 x 32, maintaining the same weight value for each channel across all spatial positions within that channel during the expansion process. Then, element-wise multiplication is performed, multiplying each element of the expanded weight vector with the corresponding element in the original feature set. It should be noted that this element-wise multiplication method achieves channel-level feature modulation. For channels with larger weight values, their corresponding feature responses are amplified; these channels typically contain key information related to the defect region. Conversely, for channels with smaller weight values, their feature responses are suppressed; these channels often correspond to background noise or irrelevant information. In a specific example, if the attention weight of a channel is 0.9, it means that the features of that channel are enhanced and preserved; if the attention weight of a channel is 0.1, the features of that channel are significantly weakened.

[0034] The features obtained after element-wise multiplication are normalized by channel dimension to integrate the enhanced feature information. This normalization process standardizes all channel feature values ​​at each spatial location. Specifically, for all channel feature values ​​at any spatial coordinates i, j in the feature map, the mean m and standard deviation s of these C channel feature values ​​are first calculated. Then, for each channel feature value, the mean m is subtracted, the result is divided by the standard deviation s, and a minimum value epsilon is added. This epsilon is set to 0.00001 to prevent division by zero. The normalization formula can be expressed as: the normalized feature value equals the original feature value minus m, divided by s plus epsilon. It should be noted that performing channel dimension normalization eliminates the differences in feature numerical scale between different channels, ensuring that the channel features modulated by the attention mechanism are within a uniform numerical range. This prevents certain channels from dominating subsequent processing due to excessively large values, and also enhances the model's generalization ability and training stability. After normalization, the feature information of all channels is effectively integrated to form an enhanced core defect feature with dimensions still C x H x W. This feature not only retains the spatial structure information of the original feature, but also highlights the channel features most relevant to defect identification through the attention mechanism, providing a higher quality feature representation for subsequent defect classification and localization.

[0035] In one embodiment of the present invention, in step S4, the enhanced core defect features are input into the defect classification network, and the defect region is separated from the background region through hierarchical discrimination of the network, and the preliminary defect candidate region is output as follows: The enhanced core features of defects are first subjected to convolutional dimensionality reduction to adjust the number of feature channels and spatial dimension. Specifically, high-dimensional features with multiple channels are compressed into feature tensors that meet the input requirements of the classification network through a series of convolutional transformations and downsampling operations. Simultaneously, normalization and nonlinear mapping are incorporated during dimensionality reduction to maintain representational power and numerical stability. Layer-by-layer detection is used to verify the integrity and information retention of the reduced features, and obviously redundant channels and hollow regions are removed. It should be noted that convolutional dimensionality reduction uses a convolutional kernel to perform weighted summation of neighboring pixels and achieves linear combination of channels and convergence of spatial information through learned weights. This reduces the burden of channel dimension and spatial resolution while preserving important texture and semantic signals. Normalization controls numerical distribution, while nonlinear mapping enhances the ability to recognize complex patterns.

[0036] When constructing the defect classification network, a feature mapping layer is first set up to receive the adapted core defect features. This mapping layer performs local transformations on the input features through several layers of convolution and activation, and expands the feature channels with discriminative information. The subsequent cross-level interaction module is responsible for connecting the shallow and deep information channels of the network, realizing the exchange and complementarity of multi-scale information. The final discriminative output layer generates the corresponding region category score map at each level. Residual or convergence paths are used between each module to ensure smooth information flow and reduce gradient decay. It should be noted that the feature mapping layer re-encodes the input features in space and channels through the weighted combination of local receptive fields, providing a more discriminative representation for subsequent multi-level decision-making. The cross-level interaction compensates for the recognition blind spots at a single scale by fusing representations at different resolutions. The discriminative output layer maps the mapped features into response intensities that are meaningful to the defect category.

[0037] During network operation, each layer sequentially transforms and interacts with features. Each discriminative output layer generates a region category probability map based on the features of its respective layer. The probability map represents the likelihood of each pixel belonging to each category. Subsequently, the cross-layer interaction module fuses the probability maps from all layers. The fusion method can employ a combination of weighted stacking or conditional constraints to integrate multi-scale information from each layer, thereby improving the consistency and robustness of segmentation. The fused probability map is then thresholded and smoothed to reduce isolated noise and preserve continuous structure. Finally, the processed probability map is used as the basis for candidate region extraction. It should be noted that the discriminative output layer generates pixel-level probability assignments by normalizing and comparing the responses between feature channels. The probability fusion enhances the response to real defects by weighting and integrating information from different sources in space and hierarchy, while suppressing misjudgment components unique to each layer.

[0038] When determining the region affiliation of each pixel based on the fused category probabilities, the probability map is first thresholded to identify high-confidence pixels as candidate defect pixels. Then, connectivity analysis is performed on the identified pixel set to divide it into continuous defect pixel clusters and remove isolated small segments. Next, boundary tracking is performed on each pixel cluster to extract boundary pixel coordinates. Polygon fitting and contour smoothing are then performed based on the boundary point sequence to obtain a more regular boundary representation. Finally, the boundary coordinates of each cluster and its corresponding category label are output as preliminary candidate defect regions. These candidate regions can be used for subsequent morphological verification and manual review. It should be noted that thresholding combined with connectivity analysis transforms the signal on the probability map into a spatially continuous region. Connectivity analysis groups related pixels based on pixel neighborhood relationships, boundary tracking locates contour coordinates by traversing the outer ring pixel by pixel, and polygon fitting and smoothing remove jagged edges and noise through approximation of the boundary point sequence, thus obtaining a structurally complete candidate region representation that is easy for subsequent processing.

[0039] In one embodiment of the present invention, step S5 involves extracting the morphological features of the preliminary defect candidate region, verifying the candidate region based on the essential morphological attributes of the defect, eliminating false candidate regions that do not meet the attributes, and correcting candidate regions with boundary offsets. When traversing each preliminary defect candidate region, pixel-level statistics and contour analysis are first performed on that region. The area of ​​the region is calculated to represent the total number of pixels in the region, the perimeter is calculated to represent the length of the region's contour, the aspect ratio is calculated to reflect the overall geometric shape tendency of the region, and the boundary smoothness is calculated to quantify the undulation and noise distribution of the boundary. These indicators together constitute a complete characterization of the region's morphology. Based on these quantified features, sufficient information can be provided for subsequent template matching and verification. The processing includes counting and traversing from the region's pixel set, reading the coordinate sequence point by point along the contour and accumulating the distance to obtain the perimeter, calculating the approximate circumscribed rectangle from the maximum and minimum coordinates of the pixel points to obtain the aspect ratio, and simultaneously calculating the angle change or curvature change of adjacent edge vectors along the contour to evaluate the boundary smoothness. It should be noted that the area and perimeter characteristics obtained through pixel statistics and contour scanning are based on the accumulation and comparison of discrete geometric measurements of the pixel set, thereby converting the discrete point information on the image into comparable geometric quantities. The evaluation of boundary smoothness is to reflect the continuity and jitter characteristics of the boundary by statistically analyzing the local difference or angle distribution of the contour point sequence. This quantification provides a clear metric basis for subsequent morphological discrimination.

[0040] When establishing essential morphological attribute templates for different defect types, representative real defect samples should first be collected and their morphological features summarized and analyzed. By statistically analyzing and abstracting the area distribution, perimeter features, aspect ratio range, and boundary smoothness features of each type of defect, a set of typical morphological descriptions for that type of defect is formed. Subsequently, these typical descriptions are organized into template items. Template items can include the expected range and allowed variability of several key morphological dimensions, which are used to compare with the candidate regions to be verified item by item. During item-by-item comparison, the candidate regions are checked according to each dimension to see if they fall into the corresponding expected range and the matching status is recorded. It should be noted that the process of constructing templates is to obtain representative feature vectors and tolerance intervals through the analysis of a large number of samples, thereby classifying instances with similar geometric and boundary attributes into one category. The template represents the concentrated area of ​​the defect type in morphological space rather than a single static style. Therefore, by comparing with the template, candidates that are highly consistent with typical morphologies and candidates with abnormal morphologies can be distinguished.

[0041] When eliminating candidates based on the verification results, the extracted morphological features of each candidate region are compared with the corresponding template item by item. A predetermined matching rule is used to determine whether the template requirements are met. Candidate regions that consistently do not match in the main morphological dimensions are eliminated. This clearly distinguishes false candidates from potentially real defective regions in the candidate set. The elimination process should simultaneously record the key features of the eliminated region and the dimensions in which they do not match for subsequent review and statistics. After elimination, consistency verification can be performed on the remaining candidates to ensure the consistency of multiple detection results at the same location. It should be noted that obtaining a clean candidate set through item-by-item comparison and direct elimination is a method to reduce false detections based on the saliency judgment of morphological attributes. This method improves the accuracy of candidates by excluding regions that significantly deviate from the template in key geometric indicators. Simultaneously, recording the comparison information of eliminated items can serve as a basis for verifying the rationality of the decision and provide support for subsequent manual review or rule adjustments.

[0042] For the retained real candidate regions, morphological erosion and dilation operations are first used to fine-tune the region's shape. Erosion is used to remove isolated pixels and small protrusions on the boundary, while dilation is used to fill small gaps and closely connected broken segments within the region. These two types of operations can be used alone or in combination to achieve opening and closing processing, thereby reducing noise interference on the contour and restoring the continuity of the region. Subsequently, contour fitting and smoothing are performed on the boundary of the morphologically processed region. By approximating the boundary point sequence with curves or simplifying it into polygons, more regular boundary coordinates are obtained. At the same time, the local geometric features of the boundary points are considered during the fitting process to suppress abnormal abrupt changes and retain real details. Finally, the corrected contour coordinates replace the original boundary to output the candidate region with the corrected boundary offset. It should be noted that the purer region is obtained by performing neighborhood-level addition and subtraction operations on the pixel set through erosion and dilation, which is based on the local transformation of the pixel neighborhood consistency and connectivity relationship. Boundary fitting and smoothing reduce jaggedness and noise by approximating the discrete contour point sequence with continuous curves and performing local smoothing operations, thereby correcting the boundary offset caused by the initial segmentation while preserving the real morphological features of the region.

[0043] In one embodiment of the present invention, step S6, the process of integrating and verifying the defect area information and outputting the final identification result including the defect location and type, is as follows: For each verified and boundary-corrected defect region, the coordinate sequence of continuous points on its boundary is first extracted one by one, along with the defect type identifier obtained by the region. This forms an independent information unit containing complete information about a single defect. This information unit describes the spatial contour and category attributes of the defect. Simultaneously, the relative position of the region in the original image is recorded for subsequent association and retrieval. Specific operations include scanning point-by-point along the outer contour of the region to obtain an ordered sequence of coordinate points, simplifying the point sequence using a polygon approximation method while retaining key inflection points, and finally combining the simplified boundary coordinates and category identifier into a logically complete entry for management and retrieval. It should be noted that obtaining the boundary sequence by scanning point-by-point along the outer contour and accumulating coordinates is a traversal method based on pixel neighborhood connectivity. This method relies on the continuous connectivity between contour pixels to determine the boundary order, thus transforming a discrete set of pixels into an ordered geometric boundary description. Furthermore, obtaining a single defect information unit by associating the classification output with the boundary coordinates is based on the principle of mapping spatial representation to category response one-to-one, ensuring that each candidate region possesses both geometric representation and semantic identifier, facilitating subsequent processing and utilization.

[0044] All established independent information units are categorized and organized according to defect type. First, they are initially grouped based on the type identifier of each unit. Then, the location boundary coordinates of each unit within the same type are correlated to form a structured defect information set for that type. Correlation processing includes identifying units that are spatially close or have overlapping boundaries as possible instances and merging them, or creating spatial indexes while maintaining independence for regional retrieval and display. During the categorization process, multiple boundary coordinates within the same type are sorted and labeled to reflect their spatial distribution and positional relationships. Finally, a defect set organized by type is obtained, which facilitates summary analysis and on-site handling. It should be noted that the structured set obtained by grouping units by type identifier and spatially correlating them within the group is based on the dual judgment principle of category consistency and spatial proximity. This judgment identifies multiple detection items that may belong to the same real defect by judging the geometric overlap between boundaries or the shortest distance between boundaries, thereby reducing duplicate information and improving information consistency while maintaining data integrity.

[0045] The structured defect information set is uniformly sorted and labeled. Following pre-agreed conventions, the coordinates of all subordinate location boundaries and related identifiers for each type of defect are clearly listed. At the set level, a list of entries for each type of defect is compiled as the final identification result output. This output includes both the spatial boundaries and category descriptions of each defect, and retains location information for traceability to facilitate on-site verification or further processing. During the sorting process, multiple records existing at the same location are merged and deduplicated. If necessary, adjacent but independent entries are retained as independent records to reflect the true distribution. Finally, the sorted structured set is delivered as the identification result to the user or for subsequent steps. It should be noted that obtaining the final identification result through the uniform sorting and labeling of the structured set is based on the principle of unified representation and spatial consistency of similar entries. This principle forms a clear output list by traversing the boundary coordinate set under each category and applying merging or deduplication rules, ensuring that the output can be directly used for location and disposal while retaining necessary traceability information to support subsequent verification work.

[0046] Please see Figure 2 As shown, the present invention also provides a machine learning-based UAV inspection image defect recognition system, comprising: The image preprocessing module is used to acquire UAV inspection images and perform illumination equalization, background suppression and viewpoint correction on the images. The feature extraction module is used to extract features from the preprocessed UAV inspection images using a deep learning feature extraction network, to obtain the shallow texture features and deep semantic features of the images, forming a multi-dimensional defect feature set; The attention enhancement module is used to introduce a spatial attention mechanism into a multi-dimensional defect feature set, focusing on the feature vector corresponding to the defect region and suppressing the feature vector corresponding to the background noise, so as to obtain the enhanced core defect features. The defect classification module is used to input the enhanced core features of defects into the defect classification network, and to separate the defect region from the background region through the hierarchical discrimination of the network, and output the preliminary defect candidate region. The morphological verification module is used to extract the morphological features of the preliminary defect candidate region, verify the candidate region based on the essential morphological attributes of the defect, eliminate false candidate regions that do not meet the attributes, and correct candidate regions with boundary offsets. The results integration module is used to integrate the verified and corrected defect area information and output the final identification result containing the defect location and type.

[0047] The foregoing has provided a detailed description of one embodiment of the present invention, but this description is merely a preferred embodiment and should not be construed as limiting the scope of the invention. All equivalent variations and modifications made within the scope of the claims of this invention should still fall within the patent coverage of this invention.

Claims

1. A machine learning-based method for defect recognition in UAV inspection images, characterized in that, Includes the following steps: S1. Acquire UAV inspection images and perform illumination equalization, background suppression and viewpoint correction on the images. S2. A deep learning feature extraction network is used to extract features from the preprocessed UAV inspection images to obtain shallow texture features and deep semantic features of the images, forming a multi-dimensional defect feature set. S3. Introduce a channel attention mechanism into the multi-dimensional defect feature set, focus on the feature vector corresponding to the defect region, suppress the feature vector corresponding to the background noise, and obtain the enhanced core defect features. S4. Input the enhanced core features of the defects into the defect classification network, and separate the defect region from the background region through the hierarchical discrimination of the network to output the preliminary defect candidate region. S5. Extract the morphological features of the preliminary defect candidate region, verify the candidate region based on the essential morphological attributes of the defect, eliminate false candidate regions that do not meet the attributes, and correct candidate regions with boundary offset. S6. Integrate and verify the defect area information, and output the final identification result including the defect location and type.

2. The method for defect recognition in UAV inspection images based on machine learning according to claim 1, characterized in that, In step S1, the process of performing illumination equalization, background suppression, and viewpoint correction on the image is as follows: The drone inspection images are converted to the HSV color space, the hue and saturation channel values ​​are fixed, and histogram equalization is performed on the lightness channel to complete the illumination equalization process. Based on the grayscale distribution characteristics of the image after illumination equalization, an adaptive threshold segmentation algorithm is used to divide the pixel region, separate the foreground defect-related region from the background region, and achieve background suppression. Retrieve the camera intrinsic and extrinsic parameters recorded during drone inspection, construct a projection transformation matrix, and perform pixel coordinate mapping on the image based on the matrix to complete the viewpoint correction operation. The images are processed sequentially by applying illumination equalization, background suppression, and viewpoint correction, and the resulting pre-processed UAV inspection images are output after eliminating the three types of interference.

3. The method for defect recognition in UAV inspection images based on machine learning according to claim 1, characterized in that, In step S2, the process of using a deep learning feature extraction network to extract features from the preprocessed UAV inspection image, obtaining shallow texture features and deep semantic features of the image, and forming a multi-dimensional defect feature set is as follows: A deep learning feature extraction network containing multi-scale convolutional kernels is constructed. The preprocessed UAV inspection image is input into the initial convolutional layer of the network to start the feature extraction process. The initial convolutional layer of the network performs sliding operations using small-sized convolutional kernels to capture local grayscale changes, edge contours, texture direction and local contrast information of the image, and generate corresponding shallow texture feature maps. The network performs operations alternately with deep convolutional blocks and pooling layers, while introducing a cross-layer feature fusion mechanism to aggregate global context information and generate corresponding deep semantic feature maps. The shallow texture feature map and the deep semantic feature map are aligned in dimension, and the two types of feature maps are spliced ​​together according to the channel dimension to form a multi-dimensional defect feature set.

4. The method for defect recognition in UAV inspection images based on machine learning according to claim 1, characterized in that, In step S3, the process of introducing a channel attention mechanism into the multi-dimensional defect feature set, focusing on the feature vector corresponding to the defect region, suppressing the feature vector corresponding to the background noise, and obtaining the enhanced core defect features is as follows: Perform global average pooling and global max pooling operations on the multi-dimensional defect feature set, concatenate the two pooling results, and obtain an aggregated feature vector that can represent the global feature distribution. The aggregated feature vector is input into the attention generation module, which consists of a fully connected layer and an activation function. Through hierarchical operations, a channel attention weight vector with the same channel dimension as the feature set is generated. The channel attention weight vector is multiplied element-wise with the original multidimensional defect feature set to enhance the features of high-weight defect regions and weaken the features of low-weight background noise. The channel dimension normalization process is performed on the features after element-wise multiplication, and the enhanced feature information is integrated to obtain the enhanced core defect features.

5. The method for defect recognition in UAV inspection images based on machine learning according to claim 4, characterized in that, The specific method for performing global average pooling and global max pooling operations on the multi-dimensional defect feature set, and concatenating the two pooling results to obtain an aggregated feature vector that can represent the global feature distribution is as follows: Define the channel, height, and width dimensions of the multi-dimensional defect feature set. For each channel, iterate through all pixels, calculate the average pixel value, generate the average feature component corresponding to a single channel, and integrate all components to obtain the average pooling vector. Based on the same multi-dimensional defect feature set, numerical comparisons are performed on all pixels in each channel, the maximum pixel value of each channel is selected as the feature component, and the maximum components of all channels are summed to obtain the max pooling vector. Verify the consistency of the number of channels between the average pooling vector and the max pooling vector, and concatenate the two vectors end to end according to the channel order to form a combined feature vector containing information from both types of pooling. By maintaining the channel dimension and numerical integrity of the combined feature vectors and removing redundant vector structures, we finally obtain an aggregated feature vector that can characterize the global feature distribution.

6. The method for defect recognition in UAV inspection images based on machine learning according to claim 1, characterized in that, In step S4, the process of inputting the enhanced core defect features into the defect classification network, separating the defect region from the background region through hierarchical discrimination of the network, and outputting preliminary defect candidate regions is as follows: The enhanced core defect features are subjected to convolutional dimensionality reduction processing to adjust the number of feature channels and spatial dimension so that the feature dimension is fully matched with the input requirements of the defect classification network. Construct a defect classification network that includes a feature mapping layer, a cross-level interaction module, and a discriminant output layer, and input the adapted core defect features into the network feature mapping layer; Each layer of the network sequentially performs transformation and interactive operations on the features. Each discriminative output layer outputs the region category probability of the corresponding layer. The probabilities of all layers are fused through the cross-layer interaction module. Based on the fused category probability, the region affiliation of each pixel is determined, continuous defect pixel clusters are divided, the cluster boundary coordinates are marked, and preliminary defect candidate regions are output.

7. The method for defect recognition in UAV inspection images based on machine learning according to claim 1, characterized in that, In step S5, the process of extracting the morphological features of the preliminary defect candidate region, verifying the candidate region based on the essential morphological attributes of the defect, eliminating false candidate regions that do not meet the attributes, and correcting candidate regions with boundary offsets is as follows: Traverse each preliminary defect candidate region, calculate the region's area, perimeter, aspect ratio, and boundary smoothness, and fully extract these specific morphological features that characterize the region's morphology. Establish essential morphological attribute templates corresponding to different defect types, and compare the extracted morphological features with the corresponding templates item by item to complete the morphological attribute verification of the candidate region. Based on the verification results, all candidate regions whose morphological features do not match the corresponding attribute templates are directly eliminated, clearly distinguishing between false candidate regions and true candidate regions; Morphological erosion and dilation operations are performed on the retained real candidate regions, and the region contour coordinates are adjusted by combining the boundary fitting algorithm to correct candidate regions with boundary offset.

8. The method for defect recognition in UAV inspection images based on machine learning according to claim 1, characterized in that, In step S6, the process of integrating and verifying the defect area information and outputting the final identification result containing the defect location and type is as follows: Extract the location boundary coordinates and corresponding defect type identifier of each verified and corrected defect area to establish an independent information unit containing complete information about a single defect. All independent information units are categorized and organized according to defect type, and the location boundary coordinates of each defect area under the same type are associated to form a structured defect information set; The structured defect information set is sorted out according to a unified format, each defect type and its corresponding full location boundary coordinates are clearly marked, and the final identification result is output.

9. A machine learning-based UAV inspection image defect recognition system, characterized in that, A machine learning-based method for defect recognition in UAV inspection images, implemented according to any one of claims 1-8, characterized in that it comprises: The image preprocessing module is used to acquire UAV inspection images and perform illumination equalization, background suppression and viewpoint correction on the images. The feature extraction module is used to extract features from the preprocessed UAV inspection images using a deep learning feature extraction network, to obtain the shallow texture features and deep semantic features of the images, forming a multi-dimensional defect feature set. The attention enhancement module is used to introduce a spatial attention mechanism into a multi-dimensional defect feature set, focusing on the feature vector corresponding to the defect region and suppressing the feature vector corresponding to the background noise, so as to obtain the enhanced core defect features. The defect classification module is used to input the enhanced core features of defects into the defect classification network, and to separate the defect region from the background region through the hierarchical discrimination of the network, and output the preliminary defect candidate region. The morphological verification module is used to extract the morphological features of the preliminary defect candidate region, verify the candidate region based on the essential morphological attributes of the defect, eliminate false candidate regions that do not meet the attributes, and correct candidate regions with boundary offsets. The results integration module is used to integrate the verified and corrected defect area information and output the final identification result containing the defect location and type.

Citation Information

Cited By

  • Curtain wall surface defect intelligent detection method based on deep learning image recognition

    CN122175969A