Building semantic segmentation post-processing method, system and device based on edge detection
By combining edge detection and semantic segmentation, the problem of edge jaggedness in building segmentation results in remote sensing images is solved, achieving more accurate building contour recognition and supporting data reference and research for urban development.
Patent Information
- Application Number
- CN202210629306.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-02
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2042-06-02
Smart Images

Figure CN114998612B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of optical remote sensing image processing and deep learning technology, and in particular to a building semantic segmentation post-processing method, system and equipment based on edge detection. Background Art
[0002] Building extraction from high-resolution remote sensing images is a hot research topic in the field of photogrammetry and remote sensing. For a long time, many scholars have conducted extensive research on related issues. This includes methods that use spectral characteristics to directly calculate building indexes and extract building objects through the distance relationship between buildings and shadows. And traditional image processing methods for segmentation, such as watershed algorithms, active contour models, statistical region fusion, etc. These methods all require empirically establishing a low-rank feature space, and on this basis, applying mathematical tools to establish a segmentation model with explicit algebraic expressions. Since the features of segmented targets in remote sensing images often present high-dimensional nonlinear characteristics, it is difficult to describe them with simple algebraic relationships. Therefore, machine learning methods such as neural networks and support vector machines are used to replace the manual modeling process, but due to the limited calculation parameters of such methods, the final segmentation accuracy is still insufficient.
[0003] In recent years, the research and application of image processing has made great progress due to the ability of deep learning to automatically extract the required effective features and establish high-dimensional strong nonlinear models through deep neural network structures. Convolutional neural network (CNN) is the basic framework for image feature extraction in deep learning, and its extracted features can be used to achieve regional image segmentation tasks. However, these methods all have a common problem, that is, the edges of the segmentation results generally have burrs.
[0004] In summary, the existing segmentation results of buildings in remote sensing images generally have edge burrs. Summary of the invention
[0005] The invention solves the problem that the segmentation results of buildings in existing remote sensing images generally have edge burrs.
[0006] The building semantic segmentation post-processing method based on edge detection of the present invention comprises the following steps:
[0007] Step S1, performing building segmentation by semantic segmentation method;
[0008] Step S2, obtaining building edge information through the canny operator, and connecting the building edge terminal nodes;
[0009] Step S3, enlarging the obtained building edge information by a certain multiple in both length and width dimensions;
[0010] Step S4, enlarging the original image by a certain multiple in both length and width dimensions by a bilinear interpolation method;
[0011] Step S5, calculating the edge information of the expanded original image by using the canny operator, and connecting the image edge terminal nodes;
[0012] Step S6, superimposing the edge information obtained in step S3 and step S5;
[0013] Step S7, filtering the superimposed edge information to obtain edge information with an edge thickness of 1 pixel;
[0014] Step S8, fusing the edge information in step S7 and the result of building segmentation in step S1;
[0015] Step S9, merging the fused edge information into adjacent connected domains through image closing operation;
[0016] Step S10, deleting the connected domain of the specified pixel to obtain a small bifurcation of the building outline;
[0017] Step S11, filling the small bifurcations of the building outline obtained by image closing operation to obtain the final building segmentation result.
[0018] Further, in one embodiment of the present invention, in step S2, the step of connecting the building edge terminal nodes comprises the following steps:
[0019] Step S201, finding the leaf nodes that obtain the building edge information through the canny operator;
[0020] Step S202, connecting the leaf nodes that are closest to the leaf nodes and are not in the current region.
[0021] Furthermore, in one embodiment of the present invention, in step S3, the enlargement by a certain multiple is 2 times.
[0022] Furthermore, in one embodiment of the present invention, in step S4, the enlargement by a certain multiple is 2 times.
[0023] Further, in one embodiment of the present invention, in step S5, the step of connecting the image edge terminal nodes comprises the following steps:
[0024] Step S501, finding the leaf node whose edge information of the expanded original image is calculated by the canny operator;
[0025] Step S502, connecting the leaf nodes that are closest to the leaf nodes and are not in the current region.
[0026] Further, in an embodiment of the present invention, in step S7, filtering the superimposed edge information includes the following steps:
[0027] Step S701, converting the superimposed edge information into a binary image and segmenting it according to connected components;
[0028] Step S702, each connected domain is regarded as an object, and the object is shrunk into a line by deleting pixels from the object boundary, and the object without holes is shrunk into a line with minimum connectivity, and the object with holes is shrunk into a connected ring between each hole and the outer boundary, thereby obtaining an edge skeleton;
[0029] Step S703, deleting the skeleton lines with less than 5 pixels in the edge skeleton.
[0030] Further, in one embodiment of the present invention, in step S8, the fusion of the edge information in step S7 and the result of building segmentation in step S1 includes the following steps:
[0031] Step S801, inverting the edge information of one pixel obtained in step S7, and segmenting according to connected components;
[0032] In step S802, the connected domains obtained are judged one by one. If the building coverage ratio obtained in step S1 exceeds 80%, it is determined that the connected domains are all buildings. If the coverage ratio is less than 30%, it is determined that the connected domains are not buildings. If the coverage ratio exceeds 30% and is less than 80%, it is determined to be a building according to the result of step S1.
[0033] Furthermore, in one embodiment of the present invention, in step S10, the designated pixels are less than 200 pixels.
[0034] The building semantic segmentation post-processing system based on edge detection of the present invention comprises:
[0035] Segmentation module, which performs building segmentation through effective semantic segmentation methods;
[0036] The connection module obtains the building edge information through the canny operator and connects the building edge terminal nodes;
[0037] The building module enlarges the obtained building edge information by a certain multiple in both length and width dimensions;
[0038] The image module uses bilinear interpolation to enlarge the original image by a certain multiple in both length and width dimensions;
[0039] The edge module calculates the edge information of the expanded original image through the canny operator and connects the edge end nodes of the image;
[0040] The superposition module superimposes the edge information obtained by the edge module and the building module;
[0041] A filtering module filters the superimposed edge information to obtain edge information with an edge thickness of 1 pixel;
[0042] A fusion module, which fuses the edge information in the filtering module and the building segmentation results in the segmentation module;
[0043] The closing operation module merges the edge information obtained by fusion into adjacent connected domains through image closing operation;
[0044] Connected domain module, deletes the connected domain of the specified pixel and obtains the small bifurcation of the building outline;
[0045] The result module fills the small bifurcations of the building outline through image closing operation to obtain the final building segmentation result.
[0046] An electronic device described in the present invention comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0047] Memory, used to store computer programs;
[0048] The processor is used to implement any method step described in the above method when executing the program stored in the memory.
[0049] The present invention solves the problem that the segmentation results of buildings in existing remote sensing images generally have edge burrs. Specific beneficial effects include:
[0050] The building semantic segmentation post-processing method based on edge detection of the present invention is a method for building semantic segmentation post-processing based on edge detection, which fuses the image edge information identified by the classic edge detection method with the contour identified by the semantic segmentation method. The method can be used as a post-processing process of any semantic segmentation result, effectively improves the building contour recognition accuracy, realizes more accurate building extraction, makes the final building contour smoother, and provides data reference and method support for policy formulation and research directions related to urban development. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0052] Figure 1It is a flow chart of the post-processing method of building semantic segmentation based on edge detection described in a specific implementation method.
[0053] Figure 2 It is a leaf node schematic diagram described in the specific implementation method.
[0054] Figure 3 This is the diagram before the leaf nodes are connected as described in the specific implementation method.
[0055] Figure 4 This is the graph after the leaf nodes are connected as described in the specific implementation method.
[0056] Figure 5 The coverage ratio described in the specific implementation manner is less than 30%.
[0057] Figure 6 The coverage ratio described in the specific implementation manner is greater than 30% and less than 80%.
[0058] Figure 7 This is a diagram showing a coverage ratio greater than 80% as described in a specific implementation manner.
[0059] Figure 8 It is a specific embodiment diagram described in the specific implementation method.
[0060] Fig. 9 It is a schematic diagram of the determination situation described in the specific implementation method.
[0061] Fig.10 It is a schematic diagram of the determination situation described in the specific implementation method. DETAILED DESCRIPTION
[0062] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of 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.
[0063] The building semantic segmentation post-processing method based on edge detection described in this embodiment comprises the following steps:
[0064] Step S1, performing building segmentation by semantic segmentation method;
[0065] Step S2, obtaining building edge information through the canny operator, and connecting the building edge terminal nodes;
[0066] Step S3, enlarging the obtained building edge information by a certain multiple in both length and width dimensions;
[0067] Step S4, enlarging the original image by a certain multiple in both length and width dimensions by a bilinear interpolation method;
[0068] Step S5, calculating the edge information of the expanded original image by using the canny operator, and connecting the image edge terminal nodes;
[0069] Step S6, superimposing the edge information obtained in step S3 and step S5;
[0070] Step S7, filtering the superimposed edge information to obtain edge information with an edge thickness of 1 pixel;
[0071] Step S8, fusing the edge information in step S7 and the result of building segmentation in step S1;
[0072] Step S9, merging the fused edge information into adjacent connected domains through image closing operation;
[0073] Step S10, deleting the connected domain of the specified pixel to obtain a small bifurcation of the building outline;
[0074] Step S11, filling the small bifurcations of the building outline obtained by image closing operation to obtain the final building segmentation result.
[0075] In this implementation manner, in step S2, the step of connecting the building edge terminal nodes includes the following steps:
[0076] Step S201, finding the leaf nodes that obtain the building edge information through the canny operator;
[0077] Step S202, connecting the leaf nodes that are closest to the leaf nodes and are not in the current region.
[0078] In this implementation manner, in step S3, the enlargement by a certain multiple is 2 times.
[0079] In this implementation manner, in step S4, the enlargement by a certain multiple is 2 times.
[0080] In this implementation manner, in step S5, the step of connecting the image edge terminal nodes includes the following steps:
[0081] Step S501, finding the leaf node whose edge information of the expanded original image is calculated by the canny operator;
[0082] Step S502, connecting the leaf nodes that are closest to the leaf nodes and are not in the current region.
[0083] In this implementation manner, in step S7, filtering the superimposed edge information includes the following steps:
[0084] Step S701, converting the superimposed edge information into a binary image and segmenting it according to connected components;
[0085] Step S702, each connected domain is regarded as an object, and the object is shrunk into a line by deleting pixels from the object boundary, and the object without holes is shrunk into a line with minimum connectivity, and the object with holes is shrunk into a connected ring between each hole and the outer boundary, thereby obtaining an edge skeleton;
[0086] Step S703, deleting the skeleton lines with less than 5 pixels in the edge skeleton.
[0087] In this embodiment, in step S8, the fusion of the edge information in step S7 and the result of building segmentation in step S1 includes the following steps:
[0088] Step S801, inverting the edge information of one pixel obtained in step S7, and segmenting according to connected components;
[0089] In step S802, the connected domains obtained are judged one by one. If the building coverage ratio obtained in step S1 exceeds 80%, it is determined that the connected domains are all buildings. If the coverage ratio is less than 30%, it is determined that the connected domains are not buildings. If the coverage ratio exceeds 30% and is less than 80%, it is determined to be a building according to the result of step S1.
[0090] In this implementation manner, in the step S10, the designated pixels are less than 200 pixels.
[0091] The building semantic segmentation post-processing system based on edge detection described in this embodiment includes:
[0092] Segmentation module, which performs building segmentation through effective semantic segmentation methods;
[0093] The connection module obtains the building edge information through the canny operator and connects the building edge terminal nodes;
[0094] The building module enlarges the obtained building edge information by a certain multiple in both length and width dimensions;
[0095] The image module uses bilinear interpolation to enlarge the original image by a certain multiple in both length and width dimensions;
[0096] The edge module calculates the edge information of the expanded original image through the canny operator and connects the edge end nodes of the image;
[0097] The superposition module superimposes the edge information obtained by the edge module and the building module;
[0098] A filtering module filters the superimposed edge information to obtain edge information with an edge thickness of 1 pixel;
[0099] A fusion module, which fuses the edge information in the filtering module and the building segmentation results in the segmentation module;
[0100] The closing operation module merges the edge information obtained by fusion into adjacent connected domains through image closing operation;
[0101] Connected domain module, deletes the connected domain of the specified pixel and obtains the small bifurcation of the building outline;
[0102] The result module fills the small bifurcations of the building outline through image closing operation to obtain the final building segmentation result.
[0103] An electronic device described in this embodiment includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0104] Memory, used to store computer programs;
[0105] The processor is used to implement any method step described in the above implementation mode when executing the program stored in the memory.
[0106] This implementation is based on the building semantic segmentation post-processing method based on edge detection described in the present invention, and provides a practical implementation method in combination with a specific object:
[0107] Building semantic segmentation post-processing methods based on edge detection, such as Figure 1 As shown, the following steps are included:
[0108] Step S1: Segment the building using any effective semantic segmentation method;
[0109] Step S2: Obtain basic edge information through the canny operator and connect the edge end nodes therein;
[0110] Step S3: enlarge the edge information obtained in step S2 by 2 times in both length and width dimensions;
[0111] Step S4: enlarge the original image by 2 times in both length and width dimensions by bilinear interpolation;
[0112] Step S5: Calculate the basic edge information of the image obtained in step S4 by using the canny operator, and connect the edge end nodes therein;
[0113] Step S6: superimposing the edge information obtained in step S3 and step S5;
[0114] Step S7: filtering the edge information obtained in step S6 to obtain edge information with an edge thickness of 1 pixel;
[0115] Step S8: Fusion the edge information in step S7 with the building segmentation result in step S1;
[0116] Step S9: Merge the adjacent connected domains by performing image closing operation on the edge information obtained in step S8;
[0117] Step S10: Delete the connected domains with an area less than 200 pixels in step S9;
[0118] Step S11: Fill the small bifurcations of the building outline obtained in step S10 through an image closing operation to obtain the final building segmentation result.
[0119] The implementation process of step S2 includes the following sub-steps:
[0120] Step S201: obtaining basic edge information through the canny operator;
[0121] Step S202: Find the leaf nodes in step S201. Figure 2 As shown;
[0122] Step S203: Link all leaf nodes to the nearest non-region nodes. The connection process is as follows: Figure 3 and Figure 4 shown.
[0123] The implementation process of step S5 includes the following sub-steps:
[0124] Step S501: obtaining basic edge information through the canny operator;
[0125] Step S502: Find the leaf node in step 501;
[0126] Step S503: Link all leaf nodes to the nearest non-region nodes.
[0127] The implementation process of step S7 includes the following sub-steps:
[0128] Step S701: convert the edge information obtained in step S6 into a binary image and segment it according to connected components;
[0129] Step S702: Treat each connected domain in step S701 as an object, and shrink the object into a line by deleting pixels from the object boundary. Ensure that objects without holes are shrunk into lines with minimum connectivity, and objects with holes are shrunk into connected loops between each hole and the outer boundary, and obtain an edge skeleton;
[0130] Step S703: Delete the skeleton lines with less than 5 pixels in the edge skeleton to obtain an edge skeleton containing only key edge information.
[0131] The implementation process of step S8 includes the following sub-steps:
[0132] Step S801: invert the binary edge skeleton image obtained in step S7 to achieve 0-1 swap;
[0133] Step S802: segmenting the binary image obtained in step S801 according to connected components;
[0134] Step S803: The connected domains obtained in step S802 are judged one by one. If the coverage ratio of the buildings obtained in step 1 exceeds 80%, it is judged that the connected domains are all buildings; if the coverage ratio is less than 30%, it is judged that the connected domains are not buildings; if the coverage ratio exceeds 30% and is less than 80%, it is judged as a building according to the result of step 1. The three judgment situations are as follows: Figure 5-7 shown.
[0135] This implementation is based on the building semantic segmentation post-processing method based on edge detection described in the present invention, and provides a practical implementation method in combination with a specific object:
[0136] like Figure 8 As described above, the edge detection result is used as the preliminary outline, and the semantic segmentation result is used as the voting weight to determine the type of ground object to which each closed area belongs one by one.
[0137] Definition 1: Img En_C is the edge detection result, then Img En_C The set of closed regions in is in For collection The elements in
[0138] like When the proportion of the area covered by the semantic segmentation result is greater than a certain threshold (upper threshold), it is judged As the target, if the ratio is less than a certain threshold (lower threshold), it is judged is a non-target, and the others are identified as candidate targets, that is, the semantic segmentation result is used as the target identification result. Finally, all adjacent results are fused to obtain the final segmentation target. After summarizing a large number of experimental conclusions, the upper and lower limits of the threshold set in this paper are 0.8 and 0.3 respectively. The above three cases are obtained by using this as the threshold. Fig. 9 and 10 As shown, the red area is the semantic segmentation result and the white line is the edge information.
[0139] Fig. 9 There are several target areas, non-target areas and candidate target areas in , for example, area 1 is the target area, area 2 is the non-target area, and area 3 is the candidate target area. The results obtained after post-processing are as follows Fig.10 shown.
[0140] The above is a detailed introduction to the post-processing method, system and device for semantic segmentation of buildings based on edge detection proposed in the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A post-processing method for building semantic segmentation based on edge detection, characterized in that: The following steps are involved: Step S1, performing building segmentation by semantic segmentation method; Step S2, obtaining building edge information through the canny operator, and connecting the building edge terminal nodes; Step S3, enlarging the obtained building edge information by a certain multiple in both length and width dimensions; Step S4, enlarging the original image by a certain multiple in both length and width dimensions by a bilinear interpolation method; Step S5, calculating the edge information of the expanded original image by using the canny operator, and connecting the image edge terminal nodes; Step S6, superimposing the edge information obtained in step S3 and step S5; Step S7, filtering the superimposed edge information to obtain edge information with an edge thickness of 1 pixel; Step S8, fusing the edge information in step S7 and the result of building segmentation in step S1; Step S9, merging the fused edge information into adjacent connected domains through image closing operation; Step S10, deleting the connected domain of the specified pixel to obtain a small bifurcation of the building outline; Step S11, filling the small bifurcations of the obtained building outline through an image closing operation to obtain a final building segmentation result; In step S7, filtering the superimposed edge information includes the following steps: Step S701, converting the superimposed edge information into a binary image and segmenting it according to connected components; Step S702, each connected domain is regarded as an object, and the object is shrunk into a line by deleting pixels from the object boundary, and the object without holes is shrunk into a line with minimum connectivity, and the object with holes is shrunk into a connected ring between each hole and the outer boundary, thereby obtaining an edge skeleton; Step S703, deleting the skeleton lines with less than 5 pixels in the edge skeleton; In the step S8, the edge information in step S7 and the result of building segmentation in step S1 are merged, including the following steps: Step S801, inverting the edge information of one pixel obtained in step S7, and segmenting according to connected components; In step S802, the connected domains obtained are judged one by one. If the building coverage ratio obtained in step S1 exceeds 80%, it is determined that the connected domains are all buildings. If the coverage ratio is less than 30%, it is determined that the connected domains are not buildings. If the coverage ratio exceeds 30% and is less than 80%, it is determined to be a building according to the result of step S1.
2. The building semantic segmentation post-processing method based on edge detection according to claim 1 is characterized in that: In step S2, the step of connecting the building edge terminal nodes comprises the following steps: Step S201, finding the leaf nodes that obtain the building edge information through the canny operator; Step S202, connecting the leaf nodes that are closest to the leaf nodes and are not in the current region.
3. The building semantic segmentation post-processing method based on edge detection according to claim 1 is characterized in that: In the step S3, the enlargement by a certain multiple is 2 times.
4. The building semantic segmentation post-processing method based on edge detection according to claim 1 is characterized in that: In the step S4, the enlargement by a certain multiple is 2 times.
5. The building semantic segmentation post-processing method based on edge detection according to claim 1 is characterized in that: In the step S5, the step of connecting the image edge terminal nodes comprises the following steps: Step S501, finding the leaf node whose edge information of the expanded original image is calculated by the canny operator; Step S502, connecting the leaf nodes that are closest to the leaf nodes and are not in the current region.
6. The building semantic segmentation post-processing method based on edge detection according to claim 1 is characterized in that: In the step S10, the designated pixel is less than 200 pixels.
7. Building semantic segmentation post-processing system based on edge detection, characterized in that: The system comprises: Segmentation module, which performs building segmentation through effective semantic segmentation methods; The connection module obtains the building edge information through the canny operator and connects the building edge terminal nodes; The building module enlarges the obtained building edge information by a certain multiple in both length and width dimensions; The image module uses bilinear interpolation to enlarge the original image by a certain multiple in both length and width dimensions; The edge module calculates the edge information of the expanded original image through the canny operator and connects the edge end nodes of the image; The superposition module superimposes the edge information obtained by the edge module and the building module; A filtering module filters the superimposed edge information to obtain edge information with an edge thickness of 1 pixel; A fusion module, which fuses the edge information in the filtering module and the building segmentation results in the segmentation module; The closing operation module merges the edge information obtained by fusion into adjacent connected domains through image closing operation; Connected domain module, deletes the connected domain of the specified pixel and obtains the small bifurcation of the building outline; The result module fills the small bifurcations of the building outline through image closing operation to obtain the final building segmentation result; In the filtering module, the filtering of the superimposed edge information includes the following modules: Module S701, converting the superimposed edge information into a binary image and segmenting it according to connected domains; Module S702, each connected domain is regarded as an object, and the object is shrunk into a line by deleting pixels from the object boundary, and the object without holes is shrunk into a line with minimum connectivity, and the object with holes is shrunk into a connected ring between each hole and the outer boundary, thereby obtaining an edge skeleton; Module S703, deleting the skeleton lines with less than 5 pixels in the edge skeleton; In the fusion module, the edge information in the filtering module and the building segmentation result in the segmentation module are fused, including the following modules: Module S801, inverting the edge information of one pixel obtained in the filtering module and segmenting it according to connected domains; Module S802 judges the connected domains one by one. If the building coverage ratio obtained in the segmented module exceeds 80%, it is determined that the connected domains are all buildings. If the coverage ratio is less than 30%, it is determined that the connected domains are not buildings. If the coverage ratio exceeds 30% and is less than 80%, it is determined to be a building according to the result of the segmentation module.
8. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 6 when executing a program stored in a memory.
Citation Information
Patent Citations
Remote sensing image semantic segmentation method and device fusing edge detection
CN110570427A
Semantic segmentation auxiliary labeling method and device
CN110866930A
