A method for correcting and extracting building semantic segmentation results with self-optimizing parameters
Through the self-optimization method of parameter self-optimization, polar coordinate inverse transformation and mean drift, combined with sliding window and color block area threshold optimization, the problem of inaccurate debris extraction in building semantic segmentation is solved, and the accuracy and efficiency of building contour extraction is improved.
Patent Information
- Application Number
- CN202211172880.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-26
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2042-09-26
AI Technical Summary
The prior art has the problem of inaccurate extraction of non-building debris in semantic segmentation of buildings, and the reliance on parameter selection is time-consuming and labor-consuming, making it difficult to improve work efficiency.
The self-optimization method is adopted to eliminate small debris and improve the accuracy of building contour extraction through polar coordinate inverse transformation, mean drift and color clustering, combining sliding windows and color block area threshold optimization.
Effectively eliminate small debris features, improve the accuracy of target profile extraction of building cluster maps, and achieve efficient building semantic correction and extraction.
Smart Images

Figure CN115457278B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image segmentation, and in particular to a method for correcting and extracting semantic segmentation results of buildings with self-optimizing parameters. Background Art
[0002] Due to the limitation of the model size in the field of deep learning semantic segmentation, there are always non-building sundries around the extracted buildings. Especially for large buildings, the extraction results are always inaccurate or even completely wrong. Therefore, the correction of the semantic segmentation results of buildings is a difficult problem that urgently needs to be solved in the post-processing field of remote sensing image building semantic segmentation. Since the elimination of incorrect small sundries in the semantic segmentation results of buildings and the correction of target buildings are mostly carried out manually nowadays, and the parameters of most algorithms are also selected according to experience, the correction and extraction of the semantic segmentation results of buildings are time-consuming and laborious, not efficient enough, and it is difficult to improve work efficiency. Summary of the Invention
[0003] In view of the problem that the existing methods have poor processing of local color difference regions, the present invention provides a method for correcting and extracting semantic segmentation results of buildings with self-optimizing parameters, which specifically includes the following steps:
[0004] S1: Read the source building map;
[0005] S2: Perform an inverse polar transformation on the source building map to obtain an inverse polar transformation map;
[0006] S3: Fix the sliding window size as c x c, initialize the color similarity threshold CR; initialize the color block area threshold minRegion; initialize the upper boundary maxMR of the color block area threshold; initialize the change step MRStep of the color block area threshold; where c is a preset value;
[0007] S4: Perform mean shift on the source building map and the inverse polar transformation map to obtain the number a of clustered color blocks of the source building map and the number b of clustered color blocks of the inverse polar transformation map;
[0008] S5: Calculate the absolute value rd of the difference between the number a of clustered color blocks of the source building map and the number b of clustered color blocks of the inverse polar transformation map;
[0009] S6: Pair the current rd value and the color block area threshold in ascending order of the color block area threshold and put them into the set T;
[0010] S7: Judge whether minRegion is less than or equal to maxMR. If so, minRegion is incremented by MRStep, and steps S4 to S6 are repeated; if not, step S8 is executed;
[0011] S8: Determine whether the current MRStep is the preset value d. If so, execute step S12; otherwise, execute step S9;
[0012] S9: Traverse the set T, calculate the second-order absolute difference sd between adjacent rds, and form key-value pairs with the two corresponding color block area thresholds. The key is sd, and the value is the two color block area thresholds, and put them into the set H;
[0013] S10: Traverse the set H, obtain the minimum sd, obtain the two corresponding color block area thresholds, and use these two color block area thresholds as the upper and lower boundaries of the change of minRegion, denoted as [j, k];
[0014] S11: Assign the color block area threshold minRegion to j, the upper boundary maxMR of the color block area threshold to k, and the color block area threshold change step MRStep to the preset value d; clear the sets T and H, and repeat steps S4 to S7;
[0015] S12: Traverse the set T to find the minimum rd value, and the corresponding color block area threshold is the optimal color block area threshold;
[0016] S13: Perform mean shift on the source building map with the optimal color block area threshold as a parameter to obtain the building color clustering result map;
[0017] S14: Set the color pixel area ratio threshold to e, and perform color clustering target extraction on the building color clustering result map to obtain the building semantic correction extraction map; where e is a preset value.
[0018] The beneficial effects provided by the present invention are: It can significantly eliminate the features of small sundries and eliminate small non-target color blocks generated during the color clustering process, so as to improve the accuracy of the target contour extraction of the building clustering map and effectively and accurately obtain the contour of the building. Description of the Drawings
[0019] Figure 1 is the schematic flowchart of the method of the present invention;
[0020] Figure 2 is the source building map;
[0021] Figure 3 is the source building clustering map;
[0022] Figure 4 is the semantic segmentation result map;
[0023] Figure 5 is the building semantic correction extraction map. Detailed Embodiments
[0024] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be further described below in conjunction with the accompanying drawings.
[0025] Please refer to Figure 1 , Figure 1 which is the flowchart of the method of the present invention;
[0026] A method for correcting and extracting the semantic segmentation results of a building with self-optimizing parameters provided by the present invention specifically includes the following steps:
[0027] S1: Read the source building map; in the present invention, the source building map is read through the API: imread() function of the OpenCV library; please refer to Figure 2 , Figure 2 which is the source building map;
[0028] S2: Perform an inverse polar transformation on the source building map to obtain an inverse polar transformation map; in the present invention, the inverse polar transformation of the source building map is performed through the API: warpPolar() function of the OpenCV library to obtain an inverse polar transformation map;
[0029] S3: Fix the sliding window size to c x c, initialize the color similarity threshold CR; initialize the color block area threshold minRegion; initialize the upper boundary maxMR of the color block area threshold; initialize the change step MRStep of the color block area threshold; where c is a preset value;
[0030] In the embodiment of the present invention, c is taken as 3; the initial value of minRegion is 50; the initial value of maxMR is 950; the initial value of MRStep is defaulted to 50;
[0031] S4: Perform mean shift on the source building map and the inverse polar transformation map to obtain the number a of clustered color blocks of the source building map and the number b of clustered color blocks of the inverse polar transformation map;
[0032] S5: Calculate the absolute value rd of the difference between the number a of clustered color blocks of the source building map and the number b of clustered color blocks of the inverse polar transformation map;
[0033] S6: Pair the current rd value and the color block area threshold in ascending order of the color block area threshold and put them into the set T;
[0034] S7: Determine whether minRegion is less than or equal to maxMR. If so, minRegion is incremented by MRStep, and steps S4 to S6 are repeated; if not, step S8 is executed;
[0035] S8: Determine whether the current MRStep is the preset value d. If so, step S12 is executed; if not, step S9 is executed;
[0036] S9: Traverse the set T, calculate the second-order absolute difference sd between adjacent rds, and form key-value pairs with the area thresholds of the two corresponding color blocks. The key is sd, and the value is the area thresholds of the two color blocks, and put them into the set H;
[0037] S10: Traverse the set H, obtain the minimum sd, obtain the area thresholds of the two corresponding color blocks, and use the area thresholds of the two color blocks as the upper and lower boundaries of the change of minRegion, denoted as [j, k];
[0038] S11: Assign the area threshold of the color block minRegion to j, the upper boundary of the area threshold of the color block maxMR to k, and the step size of the change of the area threshold of the color block MRStep to the preset value d; clear the sets T and H, and repeat steps S4 to S7;
[0039] S12: Traverse the set T, find the minimum rd value, and the area threshold of the corresponding color block is the optimal area threshold of the color block;
[0040] S13: Perform mean shift on the source building map with the optimal area threshold of the color block as a parameter to obtain a building color clustering result map;
[0041] S14: Set the threshold of the proportion of the area of color pixels to e, and perform color clustering target extraction on the building color clustering result map to obtain a building semantic correction extraction map; where e is a preset value.
[0042] It should be noted that the specific process of color clustering target extraction in step S14 is as follows:
[0043] S41: Read the building color clustering result map; please refer to Figure 3 , Figure 3 is the building color clustering result map;
[0044] S42: Input the threshold of the proportion of color area e; in the present invention, the value of e is 30%;
[0045] S43: Input the source building map into the building extraction model based on deep learning to obtain a semantic segmentation result map; please refer to Figure 4 , Figure 4 is the semantic segmentation result map;
[0046] Overlay the semantic segmentation result map and the building color clustering result map, take the intersection, and obtain an overlay map;
[0047] S44: Judge the percentage w of the total number of pixels of each color block in the overlay map to the total number of pixels of the corresponding color block in the building color clustering result map;
[0048] S45: Determine whether w is greater than e. If it is greater, retain all pixels with this color; otherwise, discard them to obtain a preliminary extraction map of source building clustering.
[0049] S46: Binarize the preliminary extraction map of source building clustering to obtain a corrected extraction map of building semantics. Please refer to Figure 5 , Figure 5 which is the corrected extraction map of building semantics.
[0050] Generally speaking, the beneficial effects of the present invention are as follows: It can significantly eliminate the features of small sundries and eliminate small non-target color blocks generated during the color clustering process, so as to improve the accuracy of extracting the target contour of the building clustering map and effectively and accurately obtain the contour of the building.
[0051] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for correcting and extracting building semantic segmentation results with self-optimizing parameters, characterized in that: It includes the following steps: S1: Read the source building map; S2: Perform inverse polar transformation on the source building map to obtain an inverse polar transformation map; S3: Fix the sliding window size as c x c, initialize the color similarity threshold CR; initialize the color block area threshold minRegion; initialize the upper boundary maxMR of the color block area threshold; initialize the change step MRStep of the color block area threshold; where c is a preset value; S4: Perform mean shift on the source building map and the inverse polar transformation map to obtain the number a of color blocks clustered in the source building map and the number b of color blocks clustered in the inverse polar transformation map; S5: Calculate the absolute value rd of the difference between the number a of color blocks clustered in the source building map and the number b of color blocks clustered in the inverse polar transformation map; S6: Pair the current rd value and the color block area threshold in ascending order of the color block area threshold and put them into the set T; S7: Judge whether minRegion is less than or equal to maxMR. If so, minRegion is incremented by MRStep, and repeat steps S4 to S6; if not, execute step S8; S8: Judge whether the current MRStep is the preset value d. If so, execute step S12; If not, execute step S9; S9: Traverse the set T, calculate the second-order absolute difference sd between adjacent rds, and form a key-value pair with the two corresponding color block area thresholds. The key is sd and the value is the two color block area thresholds, and put them into the set H; S10: Traverse the set H, obtain the smallest sd, obtain the two corresponding color block area thresholds, and use these two color block area thresholds as the upper and lower boundaries of the change of minRegion, denoted as [j, k]; S11: Assign the color block area threshold minRegion to j, the upper boundary maxMR of the color block area threshold to k, and the change step MRStep of the color block area threshold to the preset value d; clear the sets T and H, and repeat steps S4 to S7; S12: Traverse the set T to find the smallest rd value, and the corresponding color block area threshold is the optimal color block area threshold; S13: Perform mean shift on the source building map with the optimal color block area threshold as a parameter to obtain a building color clustering result map; S14: Set the color pixel area ratio threshold as e, and perform color clustering target extraction on the building color clustering result map to obtain a building semantic correction extraction map; where e is a preset value.
2. The method for correcting and extracting semantic segmentation results of a building with self-optimizing parameters according to claim 1, characterized in that: The specific process of performing color clustering target extraction in step S14 is as follows: S41: Read the building color clustering result map; S42: Input the color area ratio threshold e; S43: Input the source building map into a building extraction model based on deep learning to obtain a semantic segmentation result map; superimpose the semantic segmentation result map and the building color clustering result map, and take the intersection to obtain a superimposed map; S44: Judge the percentage w of the total number of pixels in each color block in the superimposed map accounting for the total number of pixels in the corresponding color block in the building color clustering result map; S45: Judge whether w is greater than e. If it is greater, retain all pixels with that color, otherwise discard them to obtain a preliminary extraction map of the source building clustering; S46: Binarize the preliminary extraction graph of the source building clusters to obtain the corrected extraction graph of building semantics.
3. A method for correcting and extracting the semantic segmentation results of a building with self-optimizing parameters, as described in claim 1, characterized in that: In step S9, the second-order absolute difference is specifically defined as: the second-order absolute difference is the absolute value of the result of taking the difference of two first-order absolute differences again.
Citation Information
Patent Citations
A method and system for detecting building changes in an unmanned aerial vehicle image
CN109670515A
Building extraction method and device, terminal equipment, and readable storage medium
CN113920420A