Remote sensing image segmentation post-processing method and device, equipment and medium
By performing connected component partitioning and morphological dilation processing on remote sensing images, the accuracy and complexity issues of small, isolated, and discontinuous regions in remote sensing image segmentation are solved, achieving efficient remote sensing image segmentation results.
Patent Information
- Application Number
- CN202511477062.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-16
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2045-10-16
AI Technical Summary
Existing technologies in remote sensing image segmentation suffer from poor initial label image segmentation results due to complex backgrounds and noise, and also have problems such as high algorithm complexity and high computational resource requirements.
By dividing the initial label map into connected components, the second connected region with a value less than the processing threshold is selected. Adjacent pixels are extracted using morphological dilation, and the initial labels of the adjacent pixels are used to replace the labels of the pixels to be processed, thus obtaining the target connected region.
It improves the accuracy and consistency of remote sensing image segmentation, reduces algorithm complexity, increases response speed, and meets segmentation requirements.
Smart Images

Figure CN120953311B_ABST
Abstract
Description
Technical Field
[0001] This application relates to, but is not limited to, the fields of image processing and computer vision technology, and in particular to a method, apparatus, device, and medium for post-processing of remote sensing images after segmentation. Background Technology
[0002] In the fields of image processing and computer vision, operations such as medical image analysis, remote sensing image processing, and target detection require the identification and separation of specific regions in remote sensing images. The demands for accuracy and efficiency in remote sensing image segmentation are increasingly high. However, because actual remote sensing images are obtained through aircraft, satellites, and drones that detect surface information, they are easily affected by clouds or lighting conditions, resulting in poor data quality. Furthermore, the algorithms or models used for segmenting remote sensing images inevitably contain errors, leading to small, isolated, and discontinuous regions in the initial label map after segmentation—in other words, noise or pseudo-classification in the initial label map. Existing techniques, such as Otsu's method, employ histogram-based automatic threshold selection, determining the optimal threshold by maximizing inter-class variance. However, when processing initial label images with complex backgrounds and noise, the automatic threshold selection often needs to be adjusted for specific application scenarios, lacking generalization ability in complex background and noise conditions, resulting in poor segmentation performance. If a fast binary image dilation and erosion algorithm is used to segment the initial label image, utilizing morphological operations such as erosion and dilation to eliminate small, isolated, and discontinuous regions, this can alter the effective information in the segmentation result, leading to poor segmentation performance. Furthermore, methods based on region growing and edge detection to handle small, isolated, and discontinuous regions in the initial label image suffer from high algorithm complexity and computational resource requirements, failing to meet the requirements for remote sensing image segmentation performance. Summary of the Invention
[0003] This application provides a method, apparatus, device, and medium for post-processing of remote sensing image segmentation, which can improve the segmentation effect of remote sensing images and meet the segmentation requirements of remote sensing images.
[0004] In a first aspect, embodiments of this application provide a post-processing method for segmenting remote sensing images, applied to a remote sensing image segmentation system. The post-processing method for segmenting remote sensing images includes:
[0005] The initial label map is obtained after segmenting the remote sensing image;
[0006] The initial label graph is partitioned into connected components based on the same label to obtain a set of second connected regions consisting of a first connected region with the largest area corresponding to the same label and multiple second connected regions with non-maximum areas.
[0007] Select second connected regions with an area smaller than the processing threshold from the second connected region set as the connected regions to be processed, and extract the adjacent pixels of the connected regions to be processed by morphological dilation.
[0008] The target connected region is obtained by replacing the initial label of each pixel in the connected region with the initial label of the adjacent pixels, thereby obtaining the target label map.
[0009] Secondly, a post-processing device for segmenting remote sensing images, applied to a remote sensing image segmentation system, the post-processing device for segmenting remote sensing images includes:
[0010] The data acquisition module is used to acquire the initial label map obtained after the remote sensing image is segmented.
[0011] An independent module is used to partition the initial label graph based on the same label to obtain a set of second connected regions consisting of a first connected region with the largest area corresponding to the same label and multiple second connected regions with non-maximum areas.
[0012] The calculation module is used to filter the second connected regions with an area smaller than the processing threshold from the second connected region set as the connected regions to be processed, and to extract the adjacent pixels of the connected regions to be processed through morphological dilation;
[0013] The replacement module is used to replace the label of each pixel to be processed in the connected region to be processed with the initial label of the adjacent pixels to obtain the target connected region, thereby obtaining the target label map.
[0014] Thirdly, an electronic device provided according to an embodiment of this application includes:
[0015] At least one processor;
[0016] At least one memory for storing at least one program;
[0017] When at least one of the programs is executed by at least one of the processors, the post-processing method for segmentation of remote sensing images according to any one of the first aspects is implemented.
[0018] Fourthly, according to the embodiments of the application, a computer-readable storage medium is provided, storing computer-executable instructions, which are used to execute the post-processing method for segmentation of remote sensing images as described in any of the first aspects.
[0019] In summary, the post-processing method for remote sensing image segmentation according to the above embodiments of this application includes: obtaining an initial label map after segmenting the remote sensing image; dividing the initial label map into connected components based on the same label to obtain a set of second connected regions consisting of a first connected region with the largest area corresponding to the same label and multiple second connected regions with non-maximum areas; selecting second connected regions with areas smaller than a processing threshold from the set of second connected regions as connected regions to be processed, and extracting adjacent pixels of the connected regions to be processed through morphological dilation; replacing the unprocessed label of each unprocessed pixel in the connected regions to be processed with the initial labels of adjacent pixels to obtain the target connected region, thereby obtaining the target label map. This application first divides the initial label map into connected components based on the same label, obtaining a set of second connected regions consisting of the largest area of the first connected region corresponding to the same label and multiple second connected regions with non-largest areas. This connected component division allows for independent differentiation of discontinuous first connected regions and multiple second connected regions belonging to the same label, providing an accurate data foundation for subsequent processing operations. Then, second connected regions with areas smaller than a processing threshold are selected from the set of second connected regions as the unprocessed connected regions. Further, based on the processing threshold, small, isolated, and discontinuous unprocessed connected regions are accurately located. Next, morphological dilation is used to extract neighboring pixels of the unprocessed connected regions, and the initial labels of these neighboring pixels are used to replace the unprocessed labels of each pixel in the unprocessed connected region, resulting in the target connected region. Compared to existing technologies that rely on region growing and edge detection algorithms to eliminate small, isolated, and discontinuous regions, this approach, combining morphological dilation with label replacement, accurately eliminates small, isolated, and discontinuous unprocessed connected regions while preserving the effective information of the first connected regions, thereby reducing algorithm complexity, improving response speed, and ensuring the continuity and accuracy of the target connected region. This improves the segmentation effect of the obtained target label map and meets the segmentation requirements. Attached Figure Description
[0020] Figure 1 This is a flowchart of the steps of a remote sensing image segmentation post-processing method provided in one embodiment of this application;
[0021] Figure 2 This is a flowchart of a post-processing method for segmentation of remote sensing images provided in one embodiment of this application;
[0022] Figure 3 This application provides an initial label image in one embodiment;
[0023] Figure 4 This is a schematic diagram of the initial label graph after connected component partitioning based on the same label, provided in one embodiment of this application;
[0024] Figure 5 This application provides a target label image in one embodiment;
[0025] Figure 6 This is a hardware schematic diagram of an electronic device provided in one embodiment of this application. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0027] It is understandable that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, or the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0028] In the fields of image processing and computer vision, operations such as medical image analysis, remote sensing image processing, and target detection require the identification and separation of specific regions in remote sensing images. The demands for accuracy and efficiency in remote sensing image segmentation are increasingly high. However, because actual remote sensing images are obtained through aircraft, satellites, and drones that detect surface information, they are easily affected by clouds or lighting conditions, resulting in poor data quality. Furthermore, the algorithms or models used for segmenting remote sensing images inevitably contain errors, leading to small, isolated, and discontinuous regions in the initial label map after segmentation—in other words, noise or pseudo-classification in the initial label map. Existing techniques, such as Otsu's method, employ histogram-based automatic threshold selection, determining the optimal threshold by maximizing inter-class variance. However, when processing initial label images with complex backgrounds and noise, the automatic threshold selection often needs to be adjusted for specific application scenarios, lacking generalization ability in complex background and noise conditions, resulting in poor segmentation performance. If a fast binary image dilation and erosion algorithm is used to segment the initial label image, utilizing morphological operations such as erosion and dilation to eliminate small, isolated, and discontinuous regions, this can alter the effective information in the segmentation result, leading to poor segmentation performance. Furthermore, methods based on region growing and edge detection to handle small, isolated, and discontinuous regions in the initial label image suffer from high algorithm complexity and computational resource requirements, failing to meet the requirements for remote sensing image segmentation performance.
[0029] Based on this, this application provides a method, apparatus, device, and medium for post-processing of remote sensing image segmentation. In this embodiment, the initial label image is first divided into connected components based on the same label, resulting in a set of second connected regions consisting of the largest area of the first connected region corresponding to the same label and multiple second connected regions with non-largest areas. This division allows for independent differentiation of discontinuous first connected regions and multiple second connected regions belonging to the same label, providing an accurate data foundation for subsequent processing operations. Then, second connected regions with areas smaller than a processing threshold are selected from the set of second connected regions as the connected regions to be processed. Further, based on the processing threshold, small, isolated, and discontinuous connected regions to be processed are accurately located. The process involves first identifying the region; then, morphological dilation is used to extract neighboring pixels of the connected region to be processed, and the initial labels of these neighboring pixels are used to replace the labels of each pixel in the connected region to be processed, thus obtaining the target connected region. Compared to existing technologies that rely on region growing and edge detection algorithms to eliminate small, isolated, and discontinuous regions, this method, through morphological dilation combined with label replacement, accurately eliminates small, isolated, and discontinuous regions to be processed while preserving the effective information of the first connected region, thereby reducing algorithm complexity, improving response speed, and ensuring the coherence and accuracy of the target connected region. This results in improved segmentation of the target label map, meeting the segmentation requirements.
[0030] Furthermore, it is understandable that, compared to existing technologies where erosion via conventional morphological operations results in the loss of effective information in the segmentation results, and dilation operations further amplify noise, leading to a decrease in segmentation performance, this application extracts neighboring pixels of the connected region to be processed through morphological dilation, and replaces the unprocessed label of each pixel in the connected region with the initial label of the neighboring pixels to obtain the target connected region. This method can accurately eliminate small, isolated, and discontinuous connected regions to be processed while preserving the effective information of the first connected region, thereby improving the reliability of the target connected region.
[0031] This application provides a post-processing method for segmenting remote sensing images, applied to a remote sensing image segmentation system, with reference to... Figure 1 as well as Figure 2 As shown, the post-processing method for remote sensing image segmentation includes, but is not limited to, the following steps:
[0032] Step S100: Obtain the initial label map obtained after segmenting the remote sensing image.
[0033] For example, remote sensing images are image data obtained by detecting information about the Earth's surface using equipment such as aircraft, satellites, and drones. (Refer to...) Figure 3As shown, embodiments of this application can segment remote sensing images using threshold segmentation algorithms, edge detection segmentation algorithms, and the SAM (SegmentAnythingModel) algorithm. Leveraging the high accuracy of these segmentation algorithms, an initial label map with a certain degree of accuracy can be obtained after processing. Embodiments of this application do not limit the segmentation processing method.
[0034] Specifically, the process begins by acquiring a SAM model, which includes an image encoder, a cue encoder, and a mask decoder. Then, the image encoder extracts global features from the remote sensing image to obtain a feature map. Next, the cue encoder samples the feature map using an equally spaced grid to obtain cue points corresponding to the feature map. A bidirectional cross-attention mechanism interacts the feature map and cue points, effectively fusing spatial and semantic information to adapt to complex scenes in remote sensing images, thus improving the accuracy of the candidate masks corresponding to the feature map. Finally, the mask decoder filters and merges the candidate masks to obtain an initial label map. Based on accurate candidate masks, this process further improves the accuracy of the initial label map obtained through filtering and merging candidate masks by the mask decoder.
[0035] Step S110: The initial label graph is divided into connected components based on the same label to obtain a set of second connected regions consisting of the first connected region with the largest area corresponding to the same label and multiple second connected regions with non-maximum areas.
[0036] For example, since remote sensing images are image data obtained by detecting surface information through equipment such as aircraft, satellites, and drones, they are easily affected by clouds or light, resulting in poor data quality. Furthermore, algorithms or models for segmenting remote sensing images inevitably contain errors. Thus, referring to... Figure 3 As shown (in) Figure 3 (The fragmented connected components are not displayed), resulting in the initial label map after remote sensing image segmentation containing first connected regions and multiple second connected regions belonging to the same label. These first and second connected regions are discontinuous, and the second connected regions are fragmented, representing noise or pseudo-classification in the initial label map, leading to poor segmentation results. (Refer to...) Figure 4 As shown, in this embodiment, the connected components within the same label can first be further partitioned using the Two-Pass algorithm or the Seed-Filling algorithm, so that the connected components within the same label can be distinguished. Then, the area corresponding to each connected component is calculated, thereby obtaining a set of second connected regions consisting of a first connected region with the largest area corresponding to the same label and multiple second connected regions with non-largest areas.
[0037] Understandably, since threshold segmentation, edge detection segmentation, and SAM (SegmentAnythingModel) algorithms for segmenting remote sensing images have a certain degree of accuracy, the first connected region with the largest area is considered to meet the segmentation requirements, and no processing is required for the first connected region. However, the fragmented second connected region is considered to not meet the segmentation requirements and requires further processing.
[0038] For example, firstly, a mask is generated for each initial pixel in the initial label map belonging to the same label; then, the masks belonging to the same connected region are marked by the connected region marking algorithm to obtain multiple initial connected regions corresponding to the same label; finally, the multiple initial connected regions are arranged in descending order of area to obtain a set of second connected regions consisting of the first connected region with the largest area corresponding to the same label and multiple second connected regions with non-largest areas.
[0039] For example, firstly, all masks involved in the initial label map are traversed, and each unlabeled mask is labeled to obtain the mask label corresponding to the mask; then, the mask with mask label is used as the first intermediate mask, and the unlabeled masks located in the neighborhood of the first intermediate mask are used as masks to be processed, and then the masks to be processed are labeled with the first intermediate label corresponding to the first intermediate mask, until all masks involved in the initial label map are labeled, thereby obtaining multiple initial connected regions corresponding to the same label.
[0040] Specifically, the initial label image is stored in the form of an array, text, and a structured database. When the initial label image is a grayscale image, it indicates that the initial label image has two color channels, and the initial label image is stored in the form of a two-dimensional array. When the initial label image is a color image, it indicates that the initial label image has three color channels, and the initial label image is stored in the form of a three-dimensional array.
[0041] Specifically, taking the initial label image stored in a first array as an example, the initial label image includes multiple initial pixels, each with a corresponding label. Therefore, in this embodiment, the two-dimensional first array is first flattened to obtain a one-dimensional second array. Then, initial pixels with duplicate labels in the second array are removed to obtain a third array, ensuring that each initial pixel in the third array is unique, meeting the uniqueness requirement of a set. Furthermore, since the initial label image is obtained by segmenting a remote sensing image, an initial pixel with a zero label represents the background of the remote sensing image, and an initial pixel with a non-zero label represents the foreground. In this embodiment, the background is not considered; only the foreground segmentation is post-processed, thus improving both the effectiveness and efficiency of post-segmentation. Therefore, this embodiment first extracts all initial pixels with non-zero labels from the third array as a pixel set, where each initial pixel in the pixel set corresponds to a label.
[0042] Specifically, the first array is shown in the following expression:
[0043] ;
[0044] Where I is the first array, This is the nth initial pixel.
[0045] Specifically, the pixel set is shown in the following expression:
[0046] ;
[0047] in, A set of pixels This is the nth initial pixel.
[0048] Specifically, firstly, an initial pixel is selected from the pixel set. Taking the initial pixel T as an example, a mask M is generated for each initial pixel in the first array. When the initial pixel in the i-th row and j-th column of the first array is the same as T, that is, when the expression I(i,j) = T is satisfied, the mask M(i,j) is assigned the value 1, that is, M(i,j) = 1. Otherwise, the mask M(i,j) is assigned the value 0, that is, M(i,j) = 0. Then, the masks M belonging to the same connected region are marked by the Two-Pass algorithm or the Seed-Filling algorithm to obtain multiple initial connected regions corresponding to the same label. Finally, the multiple initial connected regions are sorted in descending order of area to obtain the first connected region with the largest area corresponding to the same label and the second connected region set consisting of multiple second connected regions with non-largest areas. This process is repeated until all initial pixels in the pixel set have undergone the above operation.
[0049] For example, first initialize a mask set. Iterate through all masks in the initial label image. If a mask is unlabeled, label each unlabeled mask with a randomly generated value 'a' to obtain the mask label, and save the value 'a' to the mask set. It is important to note that before marking, the randomly generated value 'a' must not exist in the mask set or pixel set. Then, the mask with the mask label is used as the first intermediate mask, and the unlabeled masks in the surrounding neighborhood of the first intermediate mask are searched in the form of four-neighbor or eight-neighbor as the mask to be processed. That is, the mask to be processed actually belongs to the same second connected region as the first intermediate mask. Then, the mask to be processed is labeled with the first intermediate label corresponding to the first intermediate mask, until all interconnected masks are labeled, thus obtaining multiple initial connected regions corresponding to the same label. Then, the next unlabeled mask is traversed until all masks involved in the initial label map are labeled. Finally, the multiple initial connected regions are sorted in descending order of area to obtain the first connected region with the largest area corresponding to the same label and the second connected region set consisting of multiple second connected regions with non-largest areas.
[0050] Step S120: Select second connected regions with areas smaller than the processing threshold from the second connected region set as connected regions to be processed, and extract the adjacent pixels of the connected regions to be processed through morphological dilation.
[0051] For example, refer to Figure 3 As shown, due to the poor data quality of remote sensing images, combined with the unavoidable errors in the algorithms or models used for segmentation processing of remote sensing images, the initial label map obtained after segmentation processing contains noise and pseudo-classification. Then, the initial label map is divided into connected components based on the same label, resulting in a first connected region and a set of second connected regions composed of multiple second connected regions. First, a processing threshold is preset according to actual needs. It is assumed that the area of the second connected region is less than the processing threshold, which means that the second connected region is a fragmented connected region. Then, the second connected region with an area less than the processing threshold is taken as the connected region to be processed. This application embodiment does not limit the processing threshold. It is detected whether there are adjacent pixels in the neighborhood of the processed connected region. When there are adjacent pixels in the neighborhood of the processed connected region, the fragmented connected region to be processed is usually attached to the edge part of the first connected region or mixed in inside the first connected region as a pseudo-classification. That is, the adjacent pixels of the connected region to be processed are the first connected region. Then, it is necessary to further extract the adjacent pixels of the connected region to be processed through morphological dilation. When there are no adjacent pixels in the neighborhood of the processed connected region, the connected region to be processed remains unchanged.
[0052] For example, firstly, the number of second pixels in the second connected region is calculated as the area, and second connected regions with an area less than the processing threshold are selected from the set of second connected regions as the connected regions to be processed; then, if there are adjacent pixels in the neighborhood of the connected region to be processed, the connected region to be processed is expanded according to morphological dilation in the first and second connected regions to obtain the adjacent pixels corresponding to the connected region to be processed.
[0053] It is understandable that second connected regions with an area greater than or equal to the processing threshold of 700 are selected from the set of second connected regions as retained connected regions. In other words, the retained connected regions are considered to meet the segmentation accuracy requirements, and the retained connected regions are kept unchanged.
[0054] Specifically, the morphologically dilated structuring element is first traversed through the first and second connected regions; then, when the coverage area corresponding to the structuring element overlaps with the connected region to be processed, the dilated pixel corresponding to the connected region to be processed is determined based on the coverage area corresponding to the structuring element; finally, differential extraction is performed based on the connected region to be processed and the dilated pixel to obtain the adjacent pixels of the connected region to be processed.
[0055] For example, the target array W, consisting of the first connected region and the second connected region set corresponding to the initial label graph, is traversed, and the target array W satisfies... The expression, where, For the nth target pixel, the number of second pixels contained in the second connected region is calculated as the area of the second connected region. In each traversal, a Boolean mask is first created to identify the second pixels of the second connected region. Second connected regions with an area less than a processing threshold are identified as connected regions to be processed. Then, a morphological dilation operation is used to expand the connected regions to be processed, thereby obtaining the dilated pixels containing the connected regions to be processed from the target array W. Next, since the target set W consists of the pixel set U and the mask set... The union of the target array W, the pixel set U, and the mask set. satisfy The expression, that is, the dilated pixel includes the connected region to be processed, and by comparing the dilated pixel and the connected region to be processed, the newly added neighboring pixels of the connected region to be processed are extracted by difference.
[0056] Step S130: Replace the unprocessed label of each unprocessed pixel in the unprocessed connected region with the initial label of the adjacent pixels to obtain the target connected region, thereby obtaining the target label map.
[0057] Understandably, referring to Figure 5As shown, since considering the first connected region as having the largest area as the first connected region to ensure the accuracy of segmentation meets the segmentation requirements, the initial labels of adjacent pixels can be used as a reference to replace the labels of each pixel in the connected region to be processed to obtain the target connected region, thereby improving the accuracy of the target connected region. Alternatively, the adjacent pixels can be further processed and used as a reference to replace the labels of each pixel in the connected region to be processed to obtain the target connected region, thereby further improving the accuracy of the target connected region. Then, the target label map is obtained, which includes the target connected region, the retained connected region, the unchanging connected region to be processed, and the first connected region. Based on the accurate target connected region, the accuracy of the obtained target label map is improved.
[0058] For example, firstly, the adjacent pixels with non-zero initial label values are taken as intermediate pixels; then, the intermediate label with the highest frequency among the intermediate pixels is counted, and the intermediate label is used to replace the label of each pixel to be processed in the connected region to be processed, thus obtaining the target connected region.
[0059] Exemplary, this application provides a remote sensing image segmentation post-processing device, applied to a remote sensing image segmentation system. The remote sensing image segmentation post-processing device includes: a data acquisition module, used to acquire an initial label map obtained after segmenting a remote sensing image; an independent module, used to divide the initial label map into connected components based on the same label, obtaining a first connected region with the largest area corresponding to the same label and a set of second connected regions consisting of multiple second connected regions with non-maximum areas; a calculation module, used to select second connected regions with areas smaller than a processing threshold from the set of second connected regions as connected regions to be processed, and to extract adjacent pixels of the connected regions to be processed through morphological dilation; and a replacement module, used to replace the label of each pixel to be processed in the connected regions to be processed with the initial label of adjacent pixels to obtain a target connected region, thereby obtaining a target label map.
[0060] It is understood that the specific implementation of the remote sensing image segmentation post-processing device is basically the same as the specific implementation of the remote sensing image segmentation post-processing method described above, and will not be repeated here.
[0061] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described remote sensing image segmentation post-processing method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0062] Please see Figure 6 , Figure 6The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes:
[0063] The processor 601 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.
[0064] The memory 602 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 602 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 602 and is called and executed by the processor 601 to execute the remote sensing image segmentation post-processing method of the embodiments of this application.
[0065] The input / output interface 603 is used to implement information input and output;
[0066] The communication interface 604 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0067] Bus 605 transmits information between various components of the device (e.g., processor 601, memory 602, input / output interface 603, and communication interface 604);
[0068] The processor 601, memory 602, input / output interface 603, and communication interface 604 are connected to each other within the device via bus 605.
[0069] In some embodiments, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described remote sensing image segmentation post-processing method.
[0070] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0071] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0072] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0073] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0074] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0075] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0076] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0077] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0078] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0079] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0080] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
Claims
1. A method for post-processing segmentation of remote sensing images, characterized in that, The post-processing method for segmenting remote sensing images, applied to a remote sensing image segmentation system, includes: The initial label map is obtained after segmenting the remote sensing image; The initial label graph is partitioned into connected components based on the same label to obtain a set of second connected regions consisting of a first connected region with the largest area corresponding to the same label and multiple second connected regions with non-maximum areas. Select second connected regions with an area smaller than the processing threshold from the second connected region set as the connected regions to be processed, and extract the adjacent pixels of the connected regions to be processed by morphological dilation. The target connected region is obtained by replacing the initial label of each pixel in the connected region with the initial label of the adjacent pixels, thereby obtaining the target label map.
2. The post-processing method for segmenting remote sensing images according to claim 1, characterized in that, The step of partitioning the initial label graph based on the same label to obtain a set of second connected regions consisting of a first connected region with the largest area corresponding to the same label and multiple second connected regions with non-maximum areas includes: Generate a mask for each initial pixel in the initial label map belonging to the same label; The masks belonging to the same connected region are marked by a connected region marking algorithm to obtain multiple initial connected regions corresponding to the same label; Arrange the initial connected regions in descending order of area to obtain a set of second connected regions consisting of the first connected region with the largest area corresponding to the same label and multiple second connected regions with non-largest areas.
3. The post-processing method for segmenting remote sensing images according to claim 2, characterized in that, The step of marking the masks belonging to the same connected region using a connected component labeling algorithm to obtain multiple initial connected regions corresponding to the same label includes: Traverse all the masks involved in the initial label image, and label each unlabeled mask to obtain the mask label corresponding to the mask; The mask marked by the mask is used as the first intermediate mask, and the unmarked mask located in the neighborhood of the first intermediate mask is used as the mask to be processed. Then, the mask to be processed is marked with the first intermediate mark corresponding to the first intermediate mask, until all the masks involved in the initial label map are marked, thereby obtaining multiple initial connected regions corresponding to the same label.
4. The post-processing method for segmenting remote sensing images according to claim 1, characterized in that, The step of selecting second connected regions with an area smaller than a processing threshold from the second connected region set as connected regions to be processed, and extracting adjacent pixels of the connected regions to be processed through morphological dilation, includes: The number of second pixels in the second connected region is calculated as the area, and second connected regions with an area less than the processing threshold are selected from the set of second connected regions as the connected regions to be processed. If the neighboring pixels exist in the neighborhood of the connected region to be processed, the connected region to be processed is dilated in the first connected region and the second connected region according to the morphological dilation to obtain the neighboring pixels corresponding to the connected region to be processed.
5. The post-processing method for segmenting remote sensing images according to claim 4, characterized in that, The step of dilating the connected region to be processed in the first and second connected regions according to the morphological dilation to obtain the adjacent pixels corresponding to the connected region to be processed includes: The morphologically dilated structural element is traversed through the first connected region and the second connected region. When the coverage area corresponding to the structural element overlaps with the connected region to be processed, the dilated pixel corresponding to the connected region to be processed is determined according to the coverage area corresponding to the structural element. Based on the connected region to be processed and the dilated pixels, differential extraction is performed to obtain the adjacent pixels of the connected region to be processed.
6. The post-processing method for segmenting remote sensing images according to claim 1, characterized in that, The step of replacing the unprocessed label of each pixel in the connected region to be processed with the initial label of the adjacent pixels to obtain the target connected region includes: The adjacent pixels with non-zero initial label values are used as intermediate pixels; The most frequently occurring intermediate label among the intermediate pixels is counted, and this intermediate label is used to replace the label of each pixel in the connected region to be processed, thus obtaining the target connected region.
7. The post-processing method for segmenting remote sensing images according to claim 1, characterized in that, The initial label map obtained after segmenting the remote sensing image includes: Obtain the SAM model, wherein the SAM model includes an image encoder, a cue encoder, and a mask decoder; The image encoder extracts global features from the remote sensing image to obtain a feature map; The cue encoder samples the feature map using equally spaced grids to obtain cue points corresponding to the feature map, and then interacts the feature map and the cue points through a bidirectional cross-attention mechanism to obtain the candidate mask corresponding to the feature map. The candidate masks are filtered and merged by the mask decoder to obtain the initial label map.
8. A remote sensing image segmentation post-processing device, characterized in that, The remote sensing image segmentation post-processing device, applied to a remote sensing image segmentation system, includes: The data acquisition module is used to acquire the initial label map obtained after the remote sensing image is segmented. An independent module is used to partition the initial label graph based on the same label to obtain a set of second connected regions consisting of a first connected region with the largest area corresponding to the same label and multiple second connected regions with non-maximum areas. The calculation module is used to filter the second connected regions with an area smaller than the processing threshold from the second connected region set as the connected regions to be processed, and to extract the adjacent pixels of the connected regions to be processed through morphological dilation; The replacement module is used to replace the label of each pixel to be processed in the connected region to be processed with the initial label of the adjacent pixels to obtain the target connected region, thereby obtaining the target label map.
9. An electronic device, characterized in that, include: At least one processor; At least one memory for storing at least one program; When at least one of the programs is executed by at least one of the processors, the post-processing method for segmentation of remote sensing images as described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing computer-executable instructions, characterized in that, The computer-executable instructions are used to execute the segmentation post-processing method for any one of the remote sensing images according to claims 1 to 7.
Citation Information
Patent Citations
Object-oriented remote sensing image segmentation method, device, equipment and medium
CN115239746A
Data processing method, device and equipment after skeleton segmentation and readable storage medium
CN116523938A