Building shape recognition and classification method and system based on YOLO and CBAM attention mechanism

By introducing a CBAM attention mechanism into the YOLOv9 network header, building a building shape recognition training sample library is built and training, the problem of difficult to identify and classify complex building shapes in the existing technology is solved, and higher classification accuracy and recognition capabilities are achieved.

CN119863692APending Publication Date: 2025-04-22Chinese People's Liberation Army Cyberspace Force Information Engineering University
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411743842.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-30
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

The prior art is difficult to effectively identify and classify building shape types with complex contours and geometric deformations.

Method used

A building shape recognition and classification method based on YOLO and CBAM attention mechanism is adopted. By adding the CBAM attention mechanism to the head of the YOLOv9 network, a building shape recognition training sample library is constructed, and the recognition and classification network is used to train the recognition and classification network to obtain a building shape recognition and classification model.

Benefits of technology

Improves the classification accuracy of different types of building shapes, improves the recognition ability of building shape types with complex outlines, and enhances detection performance, especially when dealing with small targets and complex scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119863692A_ABST
    Figure CN119863692A_ABST
Patent Text Reader

Abstract

The invention provides a building shape recognition and classification method and system based on YOLO and CBAM attention mechanisms, and relates to the technical field of map synthesis. The method comprises the following steps: adding a CBAM attention mechanism at the head of a YOLOv9 network to obtain a building shape recognition and classification network; building a building shape recognition training sample library, and training the building shape recognition and classification network by using the building shape recognition training sample library to obtain a building shape recognition and classification model; and inputting a target building picture into the building shape recognition and classification model to obtain a shape recognition result of the target building. According to the method, the problems of identification and classification of building contour shapes with multiple types, multiple forms and complex contour features can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of map synthesis technology, and in particular to a building shape recognition and classification method and system based on YOLO and CBAM attention mechanism. Background Art

[0002] Whether it is the existing geometric method (such as the Fourier description algorithm) or the intelligent algorithm (graph convolutional neural network method), it is necessary to start from the building outline itself and establish corresponding judgment criteria for identification and classification by describing the building outline characteristics. However, the shape of the building is complex and it is difficult to express it in a relatively unified form. Therefore, for the shape types of buildings with complex outlines and geometric deformations, the existing methods may not be able to effectively and correctly identify them. Summary of the invention

[0003] In order to solve the problem of recognition and classification of building contour shapes with multiple types, multiple forms and complex contour features, the present invention provides a building shape recognition and classification method and system based on YOLO and CBAM attention mechanism, which provides strong support for map comprehensiveness.

[0004] The present invention provides a building shape recognition and classification method based on YOLO and CBAM attention mechanism, comprising:

[0005] Add CBAM attention mechanism to the YOLOv9 network head to obtain the building shape recognition and classification network;

[0006] Constructing a building shape recognition training sample library and using it to train the building shape recognition and classification network to obtain a building shape recognition and classification model;

[0007] The target building image is input into the building shape recognition and classification model to obtain the shape recognition result of the target building.

[0008] Furthermore, a building shape recognition training sample library is constructed according to preset rules; the preset rules include:

[0009] Principle 1: The buildings selected should have a certain type of standard shape;

[0010] Principle 2: The selected buildings should have a certain type of standard shape as a whole, but with complex convex and / or concave forms in their outlines;

[0011] Principle 3: The selected building should be similar to a certain type of standard shape as a whole, but with partial or overall stretching and / or distortion;

[0012] Principle 4: Choose buildings that have both the complex outlines described in Principle 2 and the deformations described in Principle 3.

[0013] Furthermore, during the training process, the pre-trained training weights provided by the YOLOv9 network are used as initial weights for training.

[0014] Furthermore, a CBAM attention mechanism is added to the head of the YOLOv9 network, specifically including: adding a CBAM attention mechanism after the 37th layer of the YOLOv9 network.

[0015] In a second aspect, the present invention provides a building shape recognition and classification system based on YOLO and CBAM attention mechanism, comprising:

[0016] The network building module is used to add the CBAM attention mechanism to the YOLOv9 network head to obtain the building shape recognition and classification network;

[0017] A training module, used to construct a building shape recognition training sample library and use it to train the building shape recognition and classification network to obtain a building shape recognition and classification model;

[0018] The recognition and classification module is used to input the target building image into the building shape recognition and classification model to obtain the shape recognition result of the target building.

[0019] In a third aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the program.

[0020] In a fourth aspect, the present invention provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method described in the first aspect.

[0021] Beneficial effects of the present invention:

[0022] (1) Improving the accuracy of building shape classification: The present invention can improve the accuracy of classification of different types of building shapes and ensure the accuracy of detection.

[0023] (2) Improve the recognition ability of building shapes with complex contours. The present invention simulates the characteristics of human visual cognition, extracts the main morphological features of buildings, avoids the interference of local complex contours on recognition, and improves the shape recognition ability of buildings with complex protrusions and depressions in the local contours.

[0024] (3) Stronger detection performance. By introducing the CBAM attention mechanism, the present invention can increase the number of detected targets, improve the recall rate, and achieve higher recognition accuracy for small targets. It also ensures the accuracy of detection while ensuring the recall rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 A flow chart of a building shape recognition and classification method based on YOLO and CBAM attention mechanism provided in an embodiment of the present invention;

[0026] Figure 2 Schematic diagram of 8 typical building shapes provided by the embodiment of the present invention;

[0027] Figure 3 Examples of training data of buildings of different shapes and types provided for embodiments of the present invention;

[0028] Figure 4 The YOLOv9 model network structure provided by the embodiment of the present invention;

[0029] Figure 5 The CBAM attention mechanism module provided by the embodiment of the present invention;

[0030] Figure 6 The CBAM attention mechanism position integrated in YOLOv9 provided by the embodiment of the present invention;

[0031] Figure 7 An example of a single building shape recognition result using different models provided in an embodiment of the present invention;

[0032] Figure 8 Examples of building shape recognition results for complex scenes using different models provided by the embodiments of the present invention;

[0033] Fig. 9 Examples of building shape recognition results for a wide range of scenes using different models provided by the embodiments of the present invention;

[0034] Fig.10 An example of the prediction results of a building with complex contours using the YOLOv9e+CBAM model provided in an embodiment of the present invention;

[0035] Fig.11 A schematic diagram of the structure of a building shape recognition and classification system based on YOLO and CBAM attention mechanism provided in an embodiment of the present invention;

[0036] Fig.12 A structural block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0037] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution in the embodiment of the present invention will be clearly described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0038] like Figure 1 As shown, the embodiment of the present invention provides a building shape recognition and classification method based on YOLO and CBAM attention mechanism, comprising the following steps:

[0039] S101: Add CBAM attention mechanism to the YOLOv9 network head to obtain the building shape recognition and classification network;

[0040] S102: constructing a building shape recognition training sample library and using it to train the building shape recognition and classification network to obtain a building shape recognition and classification model;

[0041] Specifically, since there is currently no public building shape detection dataset, the training sample library is mainly collected and labeled manually.

[0042] S103: Inputting the target building image into the building shape recognition and classification model to obtain a shape recognition result of the target building.

[0043] The method of the present invention relies on the YOLO series model, a representative single-stage detection method in the field of target detection, to realize the recognition and classification of typical building shape types. Based on the YOLOv9 target detection model, the CBAM attention mechanism is introduced at the head position of the model network. By constructing a building shape recognition training sample library, the YOLOv9e target detection model integrating the CBAM attention mechanism is trained using the training sample library, and finally the corresponding building shape recognition model is obtained.

[0044] In order to verify the effectiveness of the solution of the present invention, the present invention also provides the following experimental data.

[0045] 1. Implementation Environment

[0046] The experimental operating system is Windows 11 64-bit operating system, the CPU version is Inter(R) Core(TM) i9-14900HX CPU@2.20GHz, 32GB RAM, and the GPU is NVIDIA GeForce RTX 4090laptop GPU.

[0047] II. Identified Building Types

[0048] The building shapes that need to be identified all have typical shape characteristics. By checking and analyzing a large amount of building data, Figure 2 The types of buildings shown in the figure are identified, mainly including "E-shaped, F-shaped, H-shaped, L-shaped, T-shaped, Y-shaped, and Z-shaped" among letter-shaped buildings, and "cross-shaped" among Chinese character-shaped buildings. Buildings of other shapes, such as basic primitive types and special types, are not involved for the time being. The characteristic of the method of the present invention is that the identified building types can be expanded. If it is necessary to increase the recognition of a certain type of building, it is only necessary to increase the training data accordingly.

[0049] 3. Usage Data

[0050] The building data of major European countries (Germany, France, the United Kingdom, etc.) were obtained from the GeoFabrik data download module in OSM (Openstreetmap), and the building data of different shapes were obtained by manual screening and sampling. In order to ensure the balance of the training effect of buildings of various shapes, the number of buildings of each shape type should be consistent. When selecting building training sample data, the following four principles are mainly followed:

[0051] Principle 1: The buildings selected should have a certain type of standard shape;

[0052] Principle 2: The selected building should have a standard shape as a whole, but with complex shapes such as convexities and concavities in its outline;

[0053] Principle 3: The selected building should be similar to a certain type of standard shape as a whole, but with a certain degree of stretching, twisting and other deformations in part or as a whole;

[0054] Principle 4: Select buildings that have both the complex outlines in Principle 2 and the shape deformations in Principle 3.

[0055] Examples of training data for buildings of different shapes and types are as follows Figure 3 shown.

[0056] 4. Specific methods

[0057] (1) Model selection and improvement

[0058] The YOLOv9 model is used as the basic target detection model for building shape recognition and type judgment. The YOLOv9 model adopts programmable gradient information (PGI) to solve the information loss problem of deep networks in the forward propagation process of traditional target detection models, ensuring that the deep neural network can maintain complete input information during the learning process, thereby obtaining reliable gradient information to update weights and improve the accuracy of weight updates. Figure 4The network structure of the YOLOv9 model, PGI mainly includes three components: main branch, auxiliary reverse branch, and multi-level auxiliary information.

[0059] The attention mechanism is a detection mechanism proposed in the image field to simulate the human visual attention processing method. It is widely used in many fields such as natural language processing, object detection, and semantic segmentation. The attention mechanism can help the model better focus on the key information in the input data and improve the model performance. By introducing the attention mechanism, the deep learning model in the object detection task can focus on the key information in the image and filter out irrelevant information, thereby improving the model detection effect (especially the detection effect of small objects) and saving computing resources.

[0060] The CBAM (Convolutional Block Attention Mechanism) attention mechanism mainly includes two sub-modules: channel attention module (CAM) and spatial attention module (SAM). Figure 5 This is the main structure of the CBAM attention mechanism module.

[0061] The two independent sub-modules included in CBAM are designed to overcome the limitations of traditional convolutional neural networks in processing information of different scales, shapes, and directions, and to improve the feature expression capabilities of convolutional neural networks. By combining channel attention and spatial attention, the CBAM module can capture the correlation between features in different dimensions, thereby improving the performance of detection tasks. At the same time, the CBAM attention mechanism can not only save parameters and computing power, but also ensure that it can be integrated into the existing network architecture as a plug-and-play module. This method adds the CBAM attention mechanism module to the head position of the YOLOv9 network, specifically after the 37th layer, that is, as the 38th layer, such as Figure 6 shown.

[0062] (2) Model training

[0063] The pre-trained training weights provided by YOLOv9 are used as the initial weights for training. The pre-trained weights are a set of optimal recognition effect parameters obtained through training on the COCO dataset, weight files. The hyperparameter values ​​in training are set as follows: the learning rate is set to 0.01, the number of pictures passed into the network each time (batch size) is -1, the model automatically determines the number, the image size is 640*640, and the number of training epochs is 400.

[0064] 5. Results of this method

[0065] In order to verify the practicality and effectiveness of this method, YOLOv5, YOLOv8, and the original YOLOv9 model are selected to compare with this method. The comparison results are as follows:

[0066] This method achieved the best detection results in three test datasets of different complexity (the detection results are shown in Figure 7 , Figure 8 and Fig. 9 As shown in Table 1, as the detection scene becomes more complex, YOLOv5, YOLOv8, and the original YOLOv9 model have more false detections in some specific scenes, and the detection effect is not ideal. In contrast, this method can always maintain a high detection accuracy (as shown in Table 1), especially in test data set 3, under the normal map browsing situation, this method can still maintain a detection accuracy of 95%. The recall rate of this method in the three data sets can also be guaranteed to a certain extent, and it can stably maintain the top three rankings in a series of models, indicating that this method can ensure the accuracy while ensuring the number of detections.

[0067] At the same time, a test data set was constructed for buildings with complex contours. The building contours in this data set have many protrusions, depressions, and varying degrees of local or overall geometric deformation, which makes detection extremely difficult. Fig.10 ) and statistical data (Table 2), it can be seen that this method can achieve better detection results than other models, and the detection accuracy reaches 80.0%.

[0068] Table 1 Evaluation indicators of building recognition results of different size models

[0069]

[0070] Table 2 Evaluation indicators of different size models for building shape recognition with complex contours

[0071]

[0072] Corresponding to the above method, such as Fig.11 As shown, an embodiment of the present invention also provides a building shape recognition and classification system based on YOLO and CBAM attention mechanism, including: a network construction module, a training module and a recognition and classification module.

[0073] Among them, the network construction module is used to add the CBAM attention mechanism to the YOLOv9 network head to obtain a building shape recognition and classification network; the training module is used to construct a building shape recognition training sample library and use it to train the building shape recognition and classification network to obtain a building shape recognition and classification model; the recognition and classification module is used to input the target building image into the building shape recognition and classification model to obtain the shape recognition result of the target building.

[0074] The building shape recognition and classification system provided in the embodiment of the present invention is for realizing the above method. The specific functions thereof can be referred to the above method embodiment, which will not be described in detail here.

[0075] Fig.12 An example of a physical structure diagram of an electronic device is shown in FIG. Fig.12 As shown, the electronic device may include: a processor 1201, a communication interface 1202, a memory 1203 and a communication bus 1204, wherein the processor 1201, the communication interface 1202 and the memory 1203 communicate with each other through the communication bus 1204. The processor 1201 may call the logic instructions in the memory 1203 to execute the building shape recognition and classification method based on the YOLO and CBAM attention mechanism, for example, including: adding the CBAM attention mechanism to the YOLOv9 network head to obtain a building shape recognition and classification network; constructing a building shape recognition training sample library and using it to train the building shape recognition and classification network to obtain a building shape recognition and classification model; inputting the target building picture into the building shape recognition and classification model to obtain the shape recognition result of the target building.

[0076] In addition, when the logic instructions in the above-mentioned memory 1203 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0077] An embodiment of the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the methods provided by the above-mentioned method embodiments, for example, including: adding a CBAM attention mechanism to the head of the YOLOv9 network to obtain a building shape recognition and classification network; constructing a building shape recognition training sample library and using it to train the building shape recognition and classification network to obtain a building shape recognition and classification model; inputting a target building image into the building shape recognition and classification model to obtain a shape recognition result of the target building.

[0078] An embodiment of the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the methods provided by the above-mentioned method embodiments are implemented, for example, including: adding a CBAM attention mechanism to the head of the YOLOv9 network to obtain a building shape recognition and classification network; constructing a building shape recognition training sample library and using it to train the building shape recognition and classification network to obtain a building shape recognition and classification model; inputting a target building image into the building shape recognition and classification model to obtain a shape recognition result of the target building.

[0079] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0080] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. Building shape recognition and classification method based on YOLO and CBAM attention mechanism, characterized by: include: Add CBAM attention mechanism to the YOLOv9 network head to obtain the building shape recognition and classification network; Constructing a building shape recognition training sample library and using it to train the building shape recognition and classification network to obtain a building shape recognition and classification model; The target building image is input into the building shape recognition and classification model to obtain the shape recognition result of the target building.

2. The building shape recognition and classification method based on YOLO and CBAM attention mechanism according to claim 1, characterized in that: Construct a building shape recognition training sample library according to preset rules; The preset rules include: Principle 1: The buildings selected should have a certain type of standard shape; Principle 2: The selected building should have a certain type of standard shape as a whole, but with complex convex and / or concave forms in its outline; Principle 3: The selected building should be similar to a certain type of standard shape as a whole, but with partial or overall stretching and / or distortion; Principle 4: Choose buildings that have both the complex outlines described in Principle 2 and the deformations described in Principle 3.

3. The building shape recognition and classification method based on YOLO and CBAM attention mechanism according to claim 1, characterized in that: During the training process, the pre-trained training weights provided by the YOLOv9 network are used as the initial weights for training.

4. The building shape recognition and classification method based on YOLO and CBAM attention mechanism according to any one of claims 1 to 3, characterized in that: Add the CBAM attention mechanism to the head of the YOLOv9 network, specifically including: adding the CBAM attention mechanism after the 37th layer of the YOLOv9 network.

5. Building shape recognition and classification system based on YOLO and CBAM attention mechanism, characterized by: include: The network building module is used to add the CBAM attention mechanism to the YOLOv9 network head to obtain the building shape recognition and classification network; A training module, used to construct a building shape recognition training sample library and use it to train the building shape recognition and classification network to obtain a building shape recognition and classification model; The recognition and classification module is used to input the target building image into the building shape recognition and classification model to obtain the shape recognition result of the target building.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 4 is implemented.

7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Cited By

  • Building update type identification method and device based on time sequence streetscape image

    CN120913084A