Fine-grained building detection algorithm based on improved YOLOV8

By improving the YOLOV8 algorithm, the C2f_CD and C2f_GELAN modules and SlideLoss are introduced, the missed and missed detection problems in complex backgrounds are solved, the accuracy and generalization capabilities of building detection are improved, and efficient fine-grained detection is achieved.

CN119007026APending Publication Date: 2024-11-22CHINA THREE GORGES UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411042908.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-31
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

The prior art is prone to missed detection in complex contexts, with inter-class similarity leading to false detection, and sample imbalance leading to low accuracy.

Method used

The fine-grained building detection algorithm of improved YOLOV8 is adopted, and dynamic convolution operation is carried out by introducing the C2f_CD module, feature fusion is carried out in combination with the C2f_GELAN module, and SlideLoss loss function is introduced to solve the sample imbalance problem.

Benefits of technology

It significantly improves the model's ability to capture building features, reduces missed and missed detection, improves detection accuracy and generalization capabilities, maintains detection speed, and reduces computational complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119007026A_ABST
    Figure CN119007026A_ABST
Patent Text Reader

Abstract

The invention discloses a fine-grained building detection algorithm based on improved YOLOV8, and the algorithm is based on the improvement of a YOLOV8 model, and aims to improve the accuracy and efficiency of building detection in a remote sensing image. The algorithm comprises the following detailed steps: S1, firstly, collecting abundant remote sensing building images, and constructing a special remote sensing building data set according to the images to provide a solid foundation for model training; step S2, then, utilizing the data set to carefully improve and optimize a YOLOV8 model, and through a training process, obtaining an accurate remote sensing building detection model; and S3, finally, the remote sensing building detection model is applied to remote sensing image data to be detected, and efficient recognition and positioning of the building are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to remote sensing image processing technology, and specifically to a fine-grained building detection algorithm based on improved YOLOV8. Background Art

[0002] As the global urbanization process continues to advance, the rapid expansion of urban areas has led to a significant increase in the demand for building detection and management. As one of the most prominent elements in the urban landscape, the accurate detection of buildings is of vital importance to many fields such as urban planning, land use assessment, environmental monitoring, and disaster response. Traditional building detection methods, such as manual drawing based on topographic maps or semi-automated image processing techniques, are not only time-consuming and labor-intensive, but also susceptible to human factors and precision limitations. In recent years, the rapid development of deep learning technology has provided new solutions for the automatic interpretation of remote sensing images. In particular, the introduction of convolutional neural networks (CNNs) has greatly promoted the accuracy and efficiency of image recognition and classification tasks. Deep learning models can automatically extract image features, learn complex patterns, and self-optimize based on large amounts of data, making them ideal tools for remote sensing detection of buildings. Deep learning methods for remote sensing detection of buildings usually include multiple steps such as image preprocessing, feature extraction, target recognition, and post-processing. These methods are able to process high-resolution remote sensing images, identify building attributes such as location, size, and shape, and achieve high-accuracy detection in complex urban environments. In addition, with the improvement of computing power and the continuous optimization of algorithms, deep learning models have shown great potential in real-time detection and large-scale data processing.

[0003] In the research process of object detection, deep learning has become a powerful engine to promote the performance improvement of algorithms. Object detection methods based on deep learning can be divided into two categories: one is the two-stage detection algorithm, which relies on the generation of candidate regions and subsequent refinement; the other is the single-stage detection algorithm, which directly completes the classification and positioning of the target through a one-time prediction. Representatives of the two-stage detection algorithm include Faster R-CNN and Mask R-CNN, which first use the Region Proposal Network (RPN) to quickly locate candidate regions in the image that may contain target objects. Subsequently, these candidate regions will undergo further classification and bounding box regression to determine the final detection results, including the category and precise location of the target. In contrast, single-stage detection algorithms, such as the YOLO (You Only Look Once) series and SSD (Single Shot multibox Detector), use a more direct regression method to integrate the target classification and positioning tasks. In single-stage detection, after completing feature extraction, the network directly predicts the location and category of the target without generating and screening candidate regions. Compared with the two-stage algorithm, the single-stage detection algorithm significantly reduces the complexity of the operation and the required computing resources while maintaining a high detection accuracy. This simplified process not only improves the detection speed, but also makes the single-stage detection algorithm more practical in application scenarios with high real-time requirements. In addition, with the deepening of research, the single-stage detection algorithm has achieved a good balance between processing speed and accuracy, and has gradually become a popular choice in industry and academia. In the future, with the continuous innovation of deep learning technology and the improvement of computing power, target detection algorithms are expected to achieve further breakthroughs in accuracy, speed and robustness, providing more powerful support for various visual applications.

[0004] The present invention aims to solve the problem of missed detection in complex backgrounds, the problem of false detection caused by similarity between classes, and the problem of low accuracy caused by sample imbalance.

[0005] Therefore, the applicant proposes a fine-grained building detection algorithm based on improved YOLOV8. Summary of the invention

[0006] The purpose of this invention is to solve the problem of missed detection in a cluttered background, the problem of false detection caused by similarity between classes, and the problem of low accuracy caused by sample imbalance, and propose a fine-grained building detection algorithm based on improved YOLOV8.

[0007] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0008] A fine-grained building detection algorithm based on improved YOLOV8, including the following steps:

[0009] Step S1: constructing a remote sensing building dataset based on the collected remote sensing building images;

[0010] Step S2: training the YOLOV8 model according to the remote sensing building dataset to obtain a remote sensing building detection model;

[0011] Step S3: Detecting the remote sensing building image data to be detected according to the remote sensing building detection model.

[0012] In step S1, the following steps are included:

[0013] Step S1-1: Construct a remote sensing building detection dataset, which includes two categories, completed buildings and unfinished buildings, as processing objects and annotate the collected data through the Labelimg tool to ensure the accuracy and availability of the dataset;

[0014] Step S1-2: Divide the labeled data into a training set, a test set and a validation set in a certain manner, and perform horizontal flipping, vertical flipping and Mosaic data enhancement operations on the data set.

[0015] In step S2, the YOLOV8 model is specifically:

[0016] Parse the image dataset through the first Conv convolutional layer to obtain the feature map Feature0;

[0017] Input feature map Feature0 into the second Conv convolutional layer for parsing to obtain feature map Feature1;

[0018] Input the feature map Feature1 into the first C2f_CD module, and obtain the feature map Feature2 through the dynamic convolution layer;

[0019] Parse the feature map Feature2 through the third Conv convolution layer to obtain the feature map Feature3;

[0020] The feature map Feature3 passes through the second C2f_CD module and obtains the feature map Feature4 through the dynamic convolution layer;

[0021] Parse the feature map Feature4 through the fourth Conv convolutional layer to obtain the feature map Feature5;

[0022] The feature map Feature5 is passed through the third C2f_CD module and the feature map Feature6 is obtained through the dynamic convolution layer;

[0023] Parse the feature map Feature6 through the fifth Conv convolutional layer to obtain the feature map Feature7;

[0024] Pass the feature map Feature7 through the fourth C2f_CD module and obtain the feature map Feature8 through dynamic convolution;

[0025] After processing the feature map Feature8 through spatial pyramid pooling, the feature map Feature9 is obtained, and the feature map Feature9 is used as the input data of the feature fusion module;

[0026] Perform an upsampling operation on the feature map Feature9, whose number of channels is 1024 layers, and obtain the feature map Feature_Up1;

[0027] The feature map Feature_Up1 and the feature map Feature6 are fused to obtain the feature map Feature_Cat1;

[0028] The feature map Feature_Cat1 is passed through the first C2f_GELAN module to aggregate feature information from different levels, with 512 channels, to obtain the feature map Feature10;

[0029] The feature map Feature10 is upsampled to obtain the feature map Feature_Up2;

[0030] The feature map Feature_Up2 and the feature map Feature4 are fused to obtain the feature map Feature_Cat2;

[0031] The feature map Feature_Cat2 is passed through the second C2f_GELAN module, which extracts the features of the aggregated feature map to obtain Feature11;

[0032] After passing the feature map Feature11 through Conv, the feature map Feature12 is obtained. Feature12 and the feature map Feature10 are fused to obtain the feature map Feature_Cat3.

[0033] After the feature map Feature11 passes through Conv, it is convolved with a convolution kernel size of 1×1 to obtain the feature map F3, whose feature size is 1 / 8 of the original image and is used for small target detection;

[0034] The feature map Feature_Cat3 is passed through the third C2f_GELAN module, which is responsible for feature extraction and generation of multi-scale feature maps, to obtain a multi-scale feature map Feature13;

[0035] After passing the feature map Feature13 through Conv, it is convolved with a convolution kernel size of 1×1 to obtain the feature map F2, whose feature size is 1 / 16 of the original image and is used for target detection;

[0036] After the feature map Feature13 is subjected to Conv, the feature map Feature14 is obtained. The feature map Feature14 is fused with the feature map Feature9 to obtain Feature_Cat4.

[0037] The feature map Feature_Cat4 passes through the fourth C2f_GELAN module and then undergoes convolution with a convolution kernel size of 1×1 to obtain the feature map F1, whose feature size is 1 / 32 of the original image and is used for large target detection.

[0038] The C2f_CD module is specifically:

[0039] After the feature map F1 passes through the convolution module, the feature map F2 is obtained. The feature map F2 passes through the segmentation module to obtain the feature map F3. The channel dimension of the feature map F3 is half of the feature map F2. The feature map F3 passes through N D_B modules in sequence, where the channel dimension of the output feature map of each D_B module is half of the channel dimension of the input feature map. The feature map F2, the feature map F3, and the output feature map of each D_B module are fused to obtain F4, and after passing through the convolution module, the final output feature map F5 of the C2f_CD module is obtained.

[0040] A special residual connection strategy is adopted after the segmentation module and the DB module: by halving the number of channels of the feature map in each module, this not only reduces the computational complexity of the model but also improves the efficiency of feature fusion. This method ensures that the key information of the feature map is maintained even when the number of parameters is reduced, and promotes the effective propagation of gradients through residual connections.

[0041] The D_B module includes a convolution layer and a Dynamic convolution layer. The input features of the D_B module are obtained through the convolution layer and then input into the Dynamic convolution layer to obtain the output of the Dynamic convolution layer. The output of the convolution layer is added to the output of the Dynamic convolution layer in the channel dimension to obtain the final output of the D_B module.

[0042] In the D_B module, the Dynamic convolution layer is specifically:

[0043] The features of the input Dynamic convolution layer first pass through an adaptive pooling layer, which can dynamically adjust the size of the pooling window according to the size of the input feature map, so that the size of the output feature map remains consistent and effectively compresses the size of the feature map, reducing the number of parameters and computational complexity while retaining important feature information; then the output passes through a linear layer, which can combine features from different layers, allowing the model to learn the complex relationship between input features and the linear layer provides the model with the ability to adjust its predictions by learning weights and bias parameters; then the output passes through a sigmoid function to compress the input linear value to the (0.1) interval, and then the obtained compressed value and the input Dynamic convolution layer feature map are simultaneously input into the conditional convolution layer, which dynamically adjusts the parameters of the convolution kernel according to the obtained compressed value to guide the generation process or feature extraction process, and the output of the conditional convolution layer is used as the final output of the Dynamic convolution layer.

[0044] The C2f_GELAN module is as follows:

[0045] After the feature map G1 passes through the convolution module, the feature map G2 is obtained. The feature map G2 passes through the segmentation module to obtain the feature map G3. The channel dimension of the feature map G3 is half of the feature map G2. The feature map G3 passes through N GELAN modules in sequence, and the channel dimension of the output feature map of each GELAN module is half of the channel dimension of the input feature map. The feature map G2, the feature map G3, and the output feature map of each GELAN module are efficiently aggregated to obtain G4, and after passing through the convolution module, the output feature map G5 of the final C2f_GELAN module is obtained.

[0046] In order to solve the problem of sample imbalance and make the model pay more attention to difficult samples during training, SlideLoss is introduced. It introduces a weight function to solve the IOU size between simple samples and difficult samples to distinguish simple samples from difficult samples, and gives higher weights to difficult samples through the Slide function; specifically, samples with lower IoU values ​​are regarded as difficult samples, and samples with higher IoU values ​​are regarded as simple samples; the design of the Slide function enables the model to pay more attention to samples that are at the boundary and difficult to identify during training, thereby increasing the model's attention to difficult samples. The design of the SlideLOSS function enables the model to better optimize samples at the boundary and make more full use of these samples to train the network. The core idea is to give higher weights to difficult samples through a weighting function. The formula is as follows:

[0047]

[0048] Among them, X is the IoU value and μ is the threshold parameter used to distinguish easy samples from difficult samples.

[0049] Compared with the prior art, the present invention has the following technical effects:

[0050] 1) The present invention innovatively introduces the C2f_CD module to replace the original feature extraction mechanism. The C2f_CD module realizes deep mining and optimization of the feature space by dynamically adjusting the convolution operation, significantly improving the model's ability to capture building features, thereby reducing missed detection. Secondly, the C2f_GELAN module is introduced in the neck of the model. C2f_GELAN is a generalized and efficient aggregation module, which significantly improves the model's ability to distinguish features of different categories by introducing a gating mechanism and an efficient feature aggregation strategy. The design of this module makes full use of contextual information and enhances the feature fusion effect, thereby effectively improving the model's detection accuracy for buildings while maintaining the detection speed and reducing the occurrence of false detections. Finally, the SlideLoss loss function is introduced, which uses a weight function to solve the imbalance problem between simple and difficult samples to improve the generalization ability of the model. The present invention significantly improves the overall detection accuracy by improving the core architecture of the YOLOV8 network, including its backbone network and neck network. In addition, we introduce a new loss function to further enhance the performance of the model;

[0051] 2) The present invention provides a fine-grained building detection algorithm based on an improved YOLOV8 model; first, the Mosaic data enhancement method is used to enrich the target features in the data set; secondly, dynamic convolution is introduced, and the dynamic convolution module is combined with the C2f module to design the C2f_CD module. The improved method processes the input data by dynamically selecting or combining different convolution kernels for each input sample. This can be regarded as an extension of the traditional convolution operation, which allows the network to adaptively adjust parameters according to different inputs. The core idea is to add additional conditional information to the convolution operation to guide the feature map extraction process. In the neck network, the original C2f module is replaced by the C2f_GELAN module, and the performance of the model in the fine-grained building detection task is significantly improved by optimizing the feature fusion strategy. Specifically, the C2f_GELAN module not only enhances the expressive power of the features by introducing advanced feature enhancement technology, but also enhances the complementarity between features, thereby more accurately capturing the details and contextual information of the building. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] The present invention will be further described below in conjunction with the accompanying drawings and embodiments:

[0053] Figure 1 is a flow chart of the present invention;

[0054] Figure 2 It is a schematic diagram of the structure of the improved YOLOV8 model in the present invention;

[0055] Figure 3 yes Figure 2 Schematic diagram of the model structure of the C2f_CD module;

[0056] Figure 4 yes Figure 3 The structural diagram of the D_B module in the figure;

[0057] Figure 5 yes Figure 4 Schematic diagram of the structure of the Dynamic convolutional layer;

[0058] Figure 6 yes Figure 2 Model diagram of the C2f_GELAN module. DETAILED DESCRIPTION

[0059] like Figure 1 As shown, an improved YOLOV8 fine-grained building detection algorithm includes the following steps:

[0060] S1 constructs a remote sensing building dataset based on the collected remote sensing building images;

[0061] S2 trains the YOLOV8 model according to the remote sensing building data set to obtain a remote sensing building detection model;

[0062] The YOLOV8 model includes a feature extraction module and a feature fusion module, the feature extraction module includes a C2f_CD module, and the feature fusion module includes a C2f_GELAN module;

[0063] S3 detects the image data of the building to be detected according to the remote sensing building detection model.

[0064] The step of constructing a remote sensing building image dataset based on the collected remote sensing building image data comprises the following sub-steps:

[0065] S11: The remote sensing image dataset includes a public dataset on the network side, and the images in the public dataset are sorted and annotated by a Labelimg tool to construct a remote sensing building dataset;

[0066] S12 divides the remote sensing image building dataset into a training set, a validation set and a test set in a 6:2:2 manner.

[0067] According to this step, firstly, image data is collected to construct a remote sensing image dataset. The images are annotated using the Labelimg tool to construct a remote sensing building detection dataset, which includes two categories, completed buildings and unfinished buildings, as research objects. Then, the acquired image data is annotated, and the annotated images are divided into a training set, a test set, and a validation set in a 6:2:2 manner. The dataset is then horizontally flipped, vertically flipped, and Mosaic data enhancement operations are performed.

[0068] The 6:2:2 division can balance the needs of training, validation, and testing to a certain extent; in the remote sensing building dataset, 60% of the data is used for training, which enables the model to better learn image features. The training set is a dataset used to train deep learning models. The model adjusts its parameters by learning samples in the training set. It contains a large amount of labeled data, which is used to guide the model to learn features and patterns. 10% validation set The validation set is used for performance evaluation and hyperparameter adjustment during model training. It helps monitor the performance of the model on unseen data to avoid overfitting on the training set. The 10% test set is used to finally evaluate the generalization ability of the model, that is, the performance of the model on new data.

[0069] Furthermore, the method also includes performing a Mosaic data enhancement operation on the remote sensing building dataset to obtain an enhanced dataset.

[0070] The Mosaic data enhancement method randomly scales and splices four images into a new image. It not only increases the diversity of the data set and the model's ability to detect small targets, but also helps reduce overfitting and improve the generalization and robustness of the network. In addition, Mosaic enhancement reduces the use of GPU video memory and improves computational efficiency by simulating more scenes and backgrounds. Although it may increase the amount of computation and storage overhead, through reasonable implementation, Mosaic enhancement can significantly improve the performance of target detection tasks, especially in complex and changing environments.

[0071] Following this step, it effectively improves the generalization ability and robustness of the model for changing scenarios, enhances the detection accuracy of small targets, reduces overfitting, optimizes the use of computing resources, simplifies the data enhancement process, and improves training efficiency, making the model show higher accuracy and adaptability in actual target detection tasks.

[0072] The structure of the YOLOV8 model in S2 is 9 layers:

[0073] Parse the image dataset through the first Conv convolutional layer to obtain the feature map Feature0;

[0074] Input feature map Feature0 into the second Conv convolutional layer for parsing to obtain feature map Feature1;

[0075] Input the feature map Feature1 into the first C2f_CD module, and obtain the feature map Feature2 through the dynamic convolution layer;

[0076] Parse the feature map Feature2 through the third Conv convolution layer to obtain the feature map Feature3;

[0077] The feature map Feature3 passes through the second C2f_CD module and obtains the feature map Feature4 through the dynamic convolution layer;

[0078] Parse the feature map Feature4 through the fourth Conv convolutional layer to obtain the feature map Feature5;

[0079] The feature map Feature5 is passed through the third C2f_CD module and the feature map Feature6 is obtained through the dynamic convolution layer;

[0080] Parse the feature map Feature6 through the fifth Conv convolutional layer to obtain the feature map Feature7;

[0081] Pass the feature map Feature7 through the fourth C2f_CD module and obtain the feature map Feature8 through dynamic convolution;

[0082] After processing the feature map Feature8 through spatial pyramid pooling, the feature map Feature9 is obtained, and the feature map Feature9 is used as the input data of the feature fusion module;

[0083] Perform an upsampling operation on the feature map Feature9, whose number of channels is 1024 layers, and obtain the feature map Feature_Up1;

[0084] The feature map Feature_Up1 and the feature map Feature6 are fused to obtain the feature map Feature_Cat1;

[0085] The feature map Feature_Cat1 is passed through the first C2f_GELAN module to aggregate feature information from different levels, with 512 channels, to obtain the feature map Feature10;

[0086] The feature map Feature10 is upsampled to obtain the feature map Feature_Up2;

[0087] The feature map Feature_Up2 and the feature map Feature4 are fused to obtain the feature map Feature_Cat2;

[0088] The feature map Feature_Cat2 is passed through the second C2f_GELAN module, which extracts the features of the aggregated feature map to obtain Feature11;

[0089] After passing the feature map Feature11 through Conv, the feature map Feature12 is obtained. Feature12 and the feature map Feature10 are fused to obtain the feature map Feature_Cat3.

[0090] After the feature map Feature11 passes through Conv, it is convolved with a convolution kernel size of 1×1 to obtain the feature map F3, whose feature size is 1 / 8 of the original image and is used for small target detection;

[0091] The feature map Feature_Cat3 is passed through the third C2f_GELAN module, which is responsible for feature extraction and generation of multi-scale feature maps, to obtain a multi-scale feature map Feature13;

[0092] After passing the feature map Feature13 through Conv, it is convolved with a convolution kernel size of 1×1 to obtain the feature map F2, whose feature size is 1 / 16 of the original image and is used for target detection;

[0093] After the feature map Feature13 is subjected to Conv, the feature map Feature14 is obtained. The feature map Feature14 is fused with the feature map Feature9 to obtain Feature_Cat4.

[0094] The feature map Feature_Cat4 passes through the fourth C2f_GELAN module and then undergoes convolution with a convolution kernel size of 1×1 to obtain the feature map F1, whose feature size is 1 / 32 of the original image and is used for large target detection.

[0095] The C2f_CD module is specifically:

[0096] After the feature map F1 passes through the convolution module, the feature map F2 is obtained. The feature map F2 passes through the segmentation module to obtain the feature map F3. The channel dimension of the feature map F3 is half of the feature map F2. The feature map F3 passes through N D_B modules in sequence, where the channel dimension of the output feature map of each D_B module is half of the channel dimension of the input feature map. The feature map F2, the feature map F3, and the output feature map of each D_B module are feature fused, and after passing through the convolution module, the output of the final C2f_CD module is obtained.

[0097] A special residual connection strategy is adopted after the segmentation module and the DB module: by halving the number of channels of the feature map in each module, this not only reduces the computational complexity of the model but also improves the efficiency of feature fusion. This method ensures that the key information of the feature map is maintained even when the number of parameters is reduced, and promotes the effective propagation of gradients through residual connections.

[0098] The D_B module includes a convolution layer and a Dynamic convolution layer. The input features of the D_B module are obtained through the convolution layer and then input into the Dynamic convolution layer to obtain the output of the Dynamic convolution layer. The output of the convolution layer is added to the output of the Dynamic convolution layer to obtain the final output of the D_B module.

[0099] In the D_B module, the Dynamic convolution layer is specifically:

[0100] The features of the input Dynamic convolution layer first pass through an adaptive pooling layer, which can dynamically adjust the size of the pooling window according to the size of the input feature map, so that the size of the output feature map remains consistent and effectively compresses the size of the feature map, reducing the number of parameters and computational complexity while retaining important feature information; then the output passes through a linear layer, which can combine features from different layers, allowing the model to learn the complex relationship between input features and the linear layer provides the model with the ability to adjust its predictions by learning weights and bias parameters; then the output passes through a sigmoid function to compress the input linear value to the (0.1) interval, and then the obtained compressed value and the input Dynamic convolution layer feature map are simultaneously input into the conditional convolution layer, which dynamically adjusts the parameters of the convolution kernel according to the obtained compressed value to guide the generation process or feature extraction process, and the output of the conditional convolution layer is used as the final output of the Dynamic convolution layer.

[0101] Among them, the C2f_CD module is a feature extraction module of the improved model, which is used to better extract the feature information of the input image. It utilizes a conditional convolution network layer, which dynamically adjusts the parameters of the convolution kernel according to the input conditional information. This adaptive adjustment allows the model to adapt to different input data more flexibly under different conditions, which can be beneficial to the extraction of building features under complex backgrounds.

[0102] The processing rules of feature maps are as follows: First, a color image of the three primary colors of R, G, and B is input, and feature information of different scales and levels in the image is extracted through convolutional layers and dynamic convolutional layers, including shallow position information and deep semantic information; then, features of different levels are fused to obtain multi-scale information; further, predefined anchor frames are used to detect objects in the feature map; finally, the category and location information of the detected object are output;

[0103] In the present invention, the feature map Feature1 passes through the C2f_CD module, wherein the C2f_CD module first passes through a convolution layer, and the convolution layer is a combination of a 1*1 convolution, Batchnorm2d and SILU function. The most prominent effect of this operation combination is to improve the expressiveness and stability of the model, while accelerating the training process and enhancing the generalization ability of the model.

[0104] The feature maps of the other half of the channel dimension after the feature maps passing through the above convolutional layer pass through the segmentation module and the DB module and are finally connected. This reduces the computational complexity and improves the feature fusion efficiency by reducing the number of channels when the feature maps pass through each module.

[0105] In the D_B module, the output first passes through a convolution layer, and then passes through a Dynamic convolution layer. The Dynamic convolution layer first passes through an adaptive pooling layer, which can dynamically adjust the size of the pooling window according to the size of the input feature map, so that the size of the output feature map remains consistent and effectively compresses the size of the feature map, reducing the number of parameters and computational complexity, while retaining important feature information. The output then passes through a linear layer, which can combine features from different layers, allowing the model to learn the complex relationship between input features, and the linear layer provides the model with the ability to adjust its predictions by learning weights and bias parameters. The output then passes through a sigmoid function to compress the input linear value into the (0.1) interval, and then the obtained compressed value and the input Dynamic convolution layer feature map are simultaneously input into the conditional convolution layer, which dynamically adjusts the parameters of the convolution kernel according to the obtained compressed value to guide the generation process or feature extraction process.

[0106] The feature map that is split into half of the original one in the channel dimension after the segmentation module and multiple Dynamic convolution modules is reorganized in the channel dimension in the final stage, so that the model can learn richer feature representations. At the end of the C2f_CD module, a 1*1 convolution layer is passed to restore the feature map to the size of the input.

[0107] In the present invention, the feature map Feature_Cat1 is passed through the C2f_GELAN module, whose channel number is 512 layers, to obtain the feature map Feature11, wherein the feature map C2f_GELAN module first passes through the C2f structure and then passes through the generalized efficient aggregation module GELAN, which adopts the concept of segmentation and reorganization, and introduces the hierarchical convolution processing method of ELAN in each part. The difference is that the calculation blocks can be replaced at will in GELAN, making the network more flexible and customizable according to different needs. And the design of GELAN takes into account lightweight, inference speed and accuracy, so as to improve the overall performance of the model. Set the training parameters: the input size of the picture is set to 640×640, the initial learning rate is set to 0.01, the batch size is set to 32, the epoch iteration is set to 200, and the stochastic gradient descent strategy is used for random attenuation;

[0108] The C2f_GELAN module is specifically:

[0109] After the feature map G1 passes through the convolution module, the feature map G2 is obtained. The feature map G2 passes through the segmentation module to obtain the feature map G3. The channel dimension of the feature map G3 is half of the feature map G2. The feature map G3 passes through N GELAN modules in sequence, and the channel dimension of the output feature map of each GELAN module is half of the channel dimension of the input feature map. The feature map G2, the feature map G3, and the output feature map of each GELAN module are efficiently aggregated to obtain G4, and after passing through the convolution module, the output feature map G5 of the final C2f_GELAN module is obtained.

[0110] In order to solve the problem of sample imbalance and make the model pay more attention to difficult samples during training, SlideLoss is introduced. It introduces a weight function to solve the IOU size between simple samples and difficult samples to distinguish simple samples from difficult samples, and gives higher weights to difficult samples through the Slide function; specifically, samples with lower IoU values ​​are regarded as difficult samples, and samples with higher IoU values ​​are regarded as simple samples; the design of the Slide function enables the model to pay more attention to samples that are at the boundary and difficult to identify during training, thereby increasing the model's attention to difficult samples. The design of the SlideLOSS function enables the model to better optimize samples at the boundary and make more full use of these samples to train the network. The core idea is to give higher weights to difficult samples through a weighting function. The formula is as follows:

[0111]

[0112] Among them, X is the IoU value, and μ is the threshold parameter used to distinguish simple samples from difficult samples. (The loss function for class imbalance is added to the algorithm, which is newly added.

[0113] In the present invention, the methods of upside down and left-right flipping are used to increase remote sensing building images at different angles and combined with the Mosaic method to improve the ability to recognize objects; the improved convolutional neural network is used for training, and after training, the final fine-grained building detection algorithm based on the YOLOV8 model is obtained.

[0114] This invention not only solves the problem of missed detection in complex backgrounds and false detection caused by similarity between classes of traditional detection algorithms, but also significantly improves the generalization ability of the model by targeting the problem of sample imbalance. Through this method, we can more accurately capture the details of buildings in remote sensing images, providing strong technical support for urban planning, building monitoring and other fields.

[0115] Example:

[0116] In order to verify the effectiveness of this solution, further explanation is given below in combination with experimental data.

[0117] The experiment of remote sensing building target detection in this paper uses the deep learning PyTorch framework, running on the Ubuntu20.04 operating system, with the hardware configuration of Intel(R) Xeon(R) Silver 4210R CPU@2.40GHz, NVIDIA GeForce RTX 3090Ti GPU, 24G memory; the software configuration is: Python version is 3.11, the framework uses Pytorch 2.1+CUDA 11.8. The training rounds are set to 300 rounds, batch_size is set to 4, and workers are set to 0.

[0118] In order to qualitatively analyze the contribution of the improved YOLOv8 to the algorithm in this embodiment, YOLOv8s was used as the baseline system to test the experimental effect on the remote sensing building dataset. The algorithm effect was evaluated using mAP@0.5, mAP@0.5-0.95, Flops, and Params as reference evaluation indicators. The parameter settings and experimental environment were kept consistent. The results are shown in Table 1:

[0119] Table 1 Ablation experiment

[0120]

[0121] As can be seen from Table 1, the effects of different improvement measures were explored through ablation experiments, including the separate application of the C2f_CD module and the C2f_GELAN module, as well as the optimization of the loss function, which were finally integrated into the algorithm of the present invention. The experimental results are summarized in Table 1, which shows in detail the specific effects of various improvements on the performance of the model. First, the introduction of the C2f_CD module into the baseline algorithm not only significantly improves the accuracy of the model, with mAP@0.5 and mAP@0.5-0.95 increasing by 5.4% and 2.2% respectively, but also performs well in reducing the computational burden, reducing the number of floating-point operations (FLOPS) by 2.7G. Secondly, the integration of the C2f_GELAN module also performs well in improving accuracy, with mAP@0.5 and mAP@0.5-0.95 increasing by 5.4% and 2.2% respectively. This result confirms the effectiveness of the C2f_GELAN module in enhancing feature fusion and extraction capabilities. In terms of loss function optimization, although no significant changes were observed in FLOPS and the number of parameters, the improvement in accuracy was still significant, with mAP@0.5 and mAP@0.5-0.95 increasing by 1.2% and 1.6% respectively, indicating that the adjustment of the loss function has a positive effect on the prediction accuracy of the model. When these three strategies are combined to form a complete algorithm, not only a significant improvement in accuracy is witnessed, with mAP@0.5 and mAP@0.5-0.95 increasing by 7.8% and 4% respectively, but also a significant reduction in the overall computational effort is observed. This result highlights the importance of comprehensive improvement strategies in improving algorithm efficiency while improving detection accuracy.

[0122] In order to verify the practicality and effectiveness of the improved algorithm of the present invention, several deep learning target detection algorithms were selected for comparison with the improved algorithm of the present invention:

[0123] Table 2: Experimental comparison of different algorithms:

[0124]

[0125] The improved algorithm of the present invention achieves excellent performance in the key performance indicators of target detection, and it shows significant advantages in many aspects compared with other mainstream target detection networks. Specifically, the algorithm of the present invention achieves the highest mean average precision (mAP) at a 50% intersection-over-union (IoU) threshold, while maintaining the lowest level in both floating-point operations (GFLOPs) and parameters (Params). Compared with YOLOv5-L, the improved algorithm achieves a significant improvement of 2.5% in mAP@50, which is an improvement that cannot be underestimated in the field of target detection. Even more impressive is that it has also achieved great success in reducing computing resource consumption, with a reduction of 79G in floating-point operations and 30M in parameters, which makes the algorithm more efficient and practical while maintaining high accuracy. Compared with the classic algorithm Faster-RCNN, the improved algorithm has increased mAP@50 by 5.1%, a leap that marks a new breakthrough in target detection accuracy. At the same time, the floating point operations were reduced by 140G and the number of parameters was reduced by 24M, showing the great advantages of the improved algorithm in computational efficiency and model complexity. Compared with RTMDet, the improved algorithm improved mAP@50 by 0.6%. Although this improvement is not as significant as the previous two, it is an achievement in itself to achieve improvement at such a high level of accuracy. At the same time, it reduced the floating point operations by 87G and the number of parameters by 36M, further demonstrating the excellent ability of the improved algorithm in optimizing resource utilization and improving efficiency. In summary, while improving the accuracy of target detection, the improved algorithm greatly reduces the consumption of computing and model resources, which not only demonstrates its technical advancement, but also provides the possibility for efficient deployment in practical applications.

Claims

1. A fine-grained building detection algorithm based on improved YOLOV8, characterized in that: The following steps are involved: Step S1: constructing a remote sensing building dataset based on the collected remote sensing building images; Step S2: training the YOLOV8 model according to the remote sensing building dataset to obtain a remote sensing building detection model; Step S3: Detecting the remote sensing building image data to be detected according to the remote sensing building detection model.

2. The method according to claim 1, characterized in that: In step S1, the following steps are included: Step S1-1: Construct a remote sensing building detection dataset, which includes two categories, completed buildings and unfinished buildings, as processing objects and annotate the collected data through the Labelimg tool to ensure the accuracy and availability of the dataset; Step S1-2: Divide the labeled data into a training set, a test set and a validation set in a certain manner, and perform horizontal flipping, vertical flipping and Mosaic data enhancement operations on the data set.

3. The method according to claim 1, characterized in that In step S2, the YOLOV8 model is specifically: Parse the image dataset through the first Conv convolutional layer to obtain the feature map Feature0; Input feature map Feature0 into the second Conv convolutional layer for parsing to obtain feature map Feature1; Input the feature map Feature1 into the first C2f_CD module, and obtain the feature map Feature2 through the dynamic convolution layer; Parse the feature map Feature2 through the third Conv convolution layer to obtain the feature map Feature3; The feature map Feature3 passes through the second C2f_CD module and obtains the feature map Feature4 through the dynamic convolution layer; Parse the feature map Feature4 through the fourth Conv convolutional layer to obtain the feature map Feature5; The feature map Feature5 is passed through the third C2f_CD module and the feature map Feature6 is obtained through the dynamic convolution layer; Parse the feature map Feature6 through the fifth Conv convolutional layer to obtain the feature map Feature7; Pass the feature map Feature7 through the fourth C2f_CD module and obtain the feature map Feature8 through dynamic convolution; After processing the feature map Feature8 through spatial pyramid pooling, the feature map Feature9 is obtained, and the feature map Feature9 is used as the input data of the feature fusion module; Perform an upsampling operation on the feature map Feature9 to obtain the feature map Feature_Up1; The feature map Feature_Up1 and the feature map Feature6 are fused to obtain the feature map Feature_Cat1; The feature map Feature_Cat1 is passed through the first C2f_GELAN module to aggregate feature information from different levels to obtain the feature map Feature10; The feature map Feature10 is upsampled to obtain the feature map Feature_Up2; The feature map Feature_Up2 and the feature map Feature4 are fused to obtain the feature map Feature_Cat2; The feature map Feature_Cat2 is passed through the second C2f_GELAN module, which extracts the features of the aggregated feature map to obtain Feature11; After passing the feature map Feature11 through Conv, the feature map Feature12 is obtained. Feature12 and the feature map Feature10 are fused to obtain the feature map Feature_Cat3. After passing the feature map Feature11 through Conv, it is convolved with a convolution kernel size of 1×1 to obtain the feature map F3 for small target detection; The feature map Feature_Cat3 is passed through the third C2f_GELAN module, which is responsible for feature extraction and generation of multi-scale feature maps, to obtain a multi-scale feature map Feature13; After passing the feature map Feature13 through Conv, it is convolved with a convolution kernel size of 1×1 to obtain the feature map F2, whose feature size is 1 / 16 of the original image and is used for target detection; After the feature map Feature13 is subjected to Conv, the feature map Feature14 is obtained. The feature map Feature14 is fused with the feature map Feature9 to obtain Feature_Cat4. The feature map Feature_Cat4 passes through the fourth C2f_GELAN module and then undergoes convolution with a convolution kernel size of 1×1 to obtain the feature map F1, whose feature size is 1 / 32 of the original image and is used for large target detection.

4. The method according to claim 3, characterized in that The C2f_CD module is specifically: After the feature map F1 passes through the convolution module, the feature map F2 is obtained. The feature map F2 passes through the segmentation module to obtain the feature map F3. The channel dimension of the feature map F3 is half of the feature map F2. The feature map F3 passes through N D_B modules in sequence, where the channel dimension of the output feature map of each D_B module is half of the channel dimension of the input feature map. The feature map F2, the feature map F3, and the output feature map of each D_B module are fused to obtain F4, and after passing through the convolution module, the final output feature map F5 of the C2f_CD module is obtained.

5. The method according to claim 4, characterized in that The D_B module includes a convolution layer and a Dynamic convolution layer. The input features of the D_B module are obtained through the convolution layer and then input into the Dynamic convolution layer to obtain the output of the Dynamic convolution layer. The output of the convolution layer is added to the output of the Dynamic convolution layer in the channel dimension to obtain the final output of the D_B module.

6. The method according to claim 5, characterized in that In the D_B module, the Dynamic convolution layer is specifically: The features of the input Dynamic convolution layer first pass through an adaptive pooling layer, which can dynamically adjust the size of the pooling window according to the size of the input feature map, so that the size of the output feature map remains consistent and effectively compresses the size of the feature map, reducing the number of parameters and computational complexity while retaining important feature information; then the output passes through a linear layer, which can combine features from different layers, allowing the model to learn the complex relationship between input features and the linear layer provides the model with the ability to adjust its predictions by learning weights and bias parameters; then the output passes through a sigmoid function to compress the input linear value to the (0.1) interval, and then the obtained compressed value and the input Dynamic convolution layer feature map are simultaneously input into the conditional convolution layer, which dynamically adjusts the parameters of the convolution kernel according to the obtained compressed value to guide the generation process or feature extraction process, and the output of the conditional convolution layer is used as the final output of the Dynamic convolution layer.

7. The method according to claim 3, characterized in that The C2f_GELAN module is specifically: After the feature map G1 passes through the convolution module, the feature map G2 is obtained. The feature map G2 passes through the segmentation module to obtain the feature map G3. The channel dimension of the feature map G3 is half of the feature map G2. The feature map G3 passes through N GELAN modules in sequence, and the channel dimension of the output feature map of each GELAN module is half of the channel dimension of the input feature map. The feature map G2, the feature map G3, and the output feature map of each GELAN module are efficiently aggregated to obtain G4, and after passing through the convolution module, the output feature map G5 of the final C2f_GELAN module is obtained.