Target segmentation method and related equipment for remote sensing images
By segmenting and optimizing targets in remote sensing images, the problem of low target segmentation accuracy in the existing technology is solved, and the segmentation accuracy and connectivity of targets in remote sensing images are improved, making it suitable for applications such as electronic map production.
Patent Information
- Application Number
- CN202111663826.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-31
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-12-31
AI Technical Summary
Existing remote sensing image target segmentation methods are not very accurate, resulting in target segmentation results with problems such as poor connectivity, uneven edges, and adhesion in application scenarios such as electronic map production and precision agriculture.
By acquiring remote sensing images, perform target segmentation and optimize the segmentation results, including determining connected domains, removing small areas, using road network extraction networks and building base extraction networks for post-processing, optimizing the segmentation results of roads and buildings, and improving target segmentation accuracy.
It improves the accuracy of remote sensing image target segmentation results, enhances road connectivity and building visual effects, and is suitable for electronic map production and other application scenarios.
Smart Images

Figure CN114463337B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and in particular to a method for segmenting a remote sensing image target, an electronic device, and a computer-readable storage medium. Background Art
[0002] Remote sensing images are obtained by detecting objects on the earth's surface through sensors from different working platforms far away from the ground, such as towers, balloons, airplanes, rockets, artificial satellites, spacecraft and space shuttles. The bands used by sensors to detect objects can be visible light bands, ultraviolet bands, infrared bands and microwave bands, etc. Remote sensing images are widely used in many fields (electronic map production, urban planning, transportation and road facilities, environmental assessment, precision agriculture, forestry measurement).
[0003] By performing target segmentation on remote sensing images, we can obtain the target area required in the remote sensing image for subsequent applications. However, the current target segmentation method has low accuracy. Summary of the invention
[0004] The present application provides a remote sensing image target segmentation method, electronic equipment and computer-readable storage medium, which can solve the problem of low accuracy of current target segmentation methods.
[0005] In order to solve the above technical problems, a technical solution adopted by the present application is to provide a method for target segmentation of remote sensing images. The method includes: acquiring remote sensing images; performing target segmentation on the remote sensing images to obtain target segmentation results; optimizing the first segmentation result of at least one type of target in the target segmentation results to update the target segmentation results.
[0006] To solve the above technical problems, another technical solution adopted in the present application is: to provide an electronic device, which includes a processor and a memory connected to the processor, wherein the memory stores program instructions; the processor is used to execute the program instructions stored in the memory to implement the above method.
[0007] In order to solve the above technical problems, another technical solution adopted by the present application is: providing a computer-readable storage medium storing program instructions, which can implement the above method when executed.
[0008] Through the above-mentioned method, after obtaining the target segmentation result, the present application further optimizes the first segmentation result of at least one type of target in the target segmentation result, thereby being able to improve the accuracy of the final target segmentation result. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 It is a flowchart of an embodiment of a method for object segmentation of remote sensing images of the present application;
[0010] Figure 2 It is a flowchart of another embodiment of the method for object segmentation of remote sensing images of the present application;
[0011] Figure 3 It is a flowchart of another embodiment of the method for object segmentation of remote sensing images of the present application;
[0012] Figure 4 It is a schematic diagram of the structure of the road network extraction network;
[0013] Figure 5 It is a flowchart of another embodiment of the method for object segmentation of remote sensing images of the present application;
[0014] Figure 6 It is a flowchart of another embodiment of the method for object segmentation of remote sensing images of the present application;
[0015] Figure 7 It is a flowchart of another embodiment of the method for object segmentation of remote sensing images of the present application;
[0016] Figure 8 It is a flowchart of another embodiment of the method for object segmentation of remote sensing images of the present application;
[0017] Fig. 9 is a schematic diagram of a specific example of a method for object segmentation of remote sensing images of the present application;
[0018] Fig.10 is a schematic diagram of another specific example of the target segmentation method of remote sensing images of the present application;
[0019] Fig.11 This is a diagram showing the effect of implementing the target segmentation method of remote sensing images in this application;
[0020] Fig.12 It is a flowchart of an embodiment of a method for object segmentation of remote sensing images of the present application;
[0021] Fig.13 It is a schematic diagram of multiple sub-images obtained by continuous cropping;
[0022] Fig.14 It is a schematic diagram of multiple sub-images obtained by overlapping cropping;
[0023] Fig.15 It is a structural schematic diagram of an embodiment of the electronic device of the present application;
[0024] Fig.16 It is a structural schematic diagram of an embodiment of a computer-readable storage medium of the present application; DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0026] The terms "first", "second", and "third" in this application are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first", "second", and "third" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0027] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments without conflict.
[0028] Figure 1 FIG. 1 is a flow chart of an embodiment of the method for segmenting a remote sensing image. It should be noted that if there are substantially the same results, this embodiment is not limited to the above. Figure 1 The process sequence shown is limited. Figure 1 As shown, this embodiment may include:
[0029] S11: Acquire remote sensing images.
[0030] Remote sensing images can be single-spectral band / single-channel remote sensing images or multi-spectral band / multi-channel remote sensing images. For example, remote sensing images can be three-band RGB remote sensing images, four-band remote sensing images with near-infrared, etc. The size of a remote sensing image is H×W×C, where H is the height, W is the width, and C is the channel.
[0031] In some embodiments, the acquired remote sensing image can be directly applied to target segmentation.
[0032] In some embodiments, after acquiring the remote sensing image, the remote sensing image may be preprocessed, and the preprocessing may include but is not limited to cropping, scaling, channel expansion, and denoising.
[0033] Taking channel expansion as an example, it can be determined whether the channel of the remote sensing image is a preset channel; if so, the remote sensing image is expanded, and the channel of the expanded remote sensing image is the preset channel; otherwise, the remote sensing image is not expanded. The preset channel can cover all channels of the remote sensing image, or can cover the commonly used channels of the remote sensing image. The channel of the remote sensing image is a preset channel, which means that the channel type of the remote sensing image is the preset channel type and the number of channels is the preset number of channels.
[0034] For example, the preset channel types are visible light channel (3 channels) and near infrared channel (1 channel), the preset channel number is 4, and the remote sensing image supported by the segmentation network is a 4-channel visible light + near infrared remote sensing image (H×W×4). If the remote sensing image is a 3-channel visible light remote sensing image (H×W×3), then an array of H×W×1 with a value of 0 is spliced on the remote sensing image to form a remote sensing image of size H×W×4.
[0035] It is understandable that the generalization of the same target segmentation network is insufficient and cannot be compatible with the processing of remote sensing images of different channels. Therefore, the target segmentation network needs to adapt to the change of channels in order to achieve target segmentation of remote sensing images of different channels. To this end, the channels supported by the target segmentation network are set as preset channels. When the channels of the remote sensing images are not preset channels, the channels of the remote sensing images are expanded to obtain the expanded remote sensing images, and the expanded remote sensing images are applied to target segmentation. Therefore, the target segmentation of remote sensing images of different channels can be achieved through the same target segmentation network, reducing the complexity of target segmentation.
[0036] S12: Perform target segmentation on the remote sensing image to obtain a target segmentation result.
[0037] Target segmentation is the pixel-level classification of remote sensing images. Target segmentation can be one or more target categories, depending on the application scenario. For example, in the application scenario of electronic map production, the target categories for target segmentation include water bodies, roads, buildings, vegetation, and others. For another example, in the application scenario of precision agriculture, the target categories for target segmentation include various types of crops.
[0038] In some embodiments, a first feature map of the remote sensing image may be extracted, and the first feature map may be predicted to obtain a target segmentation result.
[0039] In some embodiments, a first feature map of a remote sensing image may be extracted, and the boundary of the target in the first feature map may be repaired to obtain a second feature map, and the second feature map may be predicted to obtain a target segmentation result. Boundary repair may be achieved through operations such as corrosion and expansion. Due to the target boundary repair, the target segmentation result obtained is more accurate.
[0040] The target segmentation result includes the first segmentation result of one or more types of targets, which is used to characterize the locations of each type of target in the remote sensing image. Specifically, the target segmentation result may include the probability that each pixel belongs to each target category, and the target category corresponding to the maximum probability is the target category to which the pixel belongs.
[0041] S13: Optimizing a first segmentation result of at least one type of target in the target segmentation results to update the target segmentation results.
[0042] It is understandable that, because the target segmentation follows the WYSIWYG principle, the prediction of the target segmentation result corresponds to the category represented by the actual pixel one by one. Therefore, the target determined according to the first segmentation result of the same type of target in the target segmentation result may have problems such as poor connectivity, uneven edges, and adhesion. For example, in the application scenario of electronic map production, roads may be blocked by vegetation, buildings, etc., resulting in problems such as disconnected roads, uneven road edges, and the coexistence of roads of different levels (such as main roads and side roads). Buildings have problems such as adhesion between buildings due to insufficient prediction. Therefore, the first segmentation result of at least one type of target that may have the above problems in the target segmentation result can be optimized to achieve the update of the target segmentation result.
[0043] The optimization method may be to determine the connected domain of a certain type of target based on the first segmentation result of the target, and optimize the target with the connected domain as the smallest unit. The optimization method may also be to segment a certain type of target separately based on the remote sensing image, and obtain the second segmentation result of the target to replace the first segmentation result of the target. Of course, other implementation methods are also possible.
[0044] Through the implementation of this embodiment, after obtaining the target segmentation result, the present application also optimizes the first segmentation result of at least one type of target in the target segmentation result, thereby being able to improve the accuracy of the final target segmentation result.
[0045] Figure 2 FIG. 1 is a flow chart of another embodiment of the method for segmenting a remote sensing image. It should be noted that if the results are substantially the same, this embodiment is not limited to the above. Figure 2 The process sequence shown is limited. This embodiment is a further extension of S13, and the first segmentation result of at least one type of target includes the first segmentation result of the road. Figure 2 As shown, this embodiment may include:
[0046] S21: Based on the first segmentation result of the road, determine a plurality of first connected domains included in the road.
[0047] The first segmentation result indicates which pixels in the remote sensing image belong to the target category of roads, thereby determining the roads in the remote sensing image. The remote sensing image can be binarized to convert the pixel values of the roads to 255 and the pixel values of the remaining areas to 0 to obtain a binary image. The first connected domain is calculated for the binary image to obtain the total number, number (the pixel values in the same first connected domain are converted to the number of the first connected domain), area and outer contour of the road.
[0048] S22: taking each first connected domain as a current first connected domain in turn, and if the area of the current first connected domain is smaller than the area threshold, removing the current first connected domain to update the first segmentation result of the road.
[0049] Removing the current first connected domain may include: expanding the current first connected domain; in the expanded current first connected domain, determining the remaining target categories whose occurrence frequencies meet the requirements (for example, the highest occurrence frequency), wherein the remaining target categories are categories other than roads; and replacing the target category to which the current first connected domain belongs with the determined remaining target categories.
[0050] It can be understood that the road objects targeted for segmentation are roads of all levels (including main roads and side roads). The first connected domain with an area smaller than the area threshold represents the side road, which is not required when making an electronic map. Therefore, through the implementation of this embodiment, the first connected domain with an area smaller than the area threshold is removed, which can facilitate the production of electronic maps.
[0051] Figure 3 FIG. 1 is a flow chart of another embodiment of the method for segmenting a remote sensing image. It should be noted that if there are substantially the same results, this embodiment is not limited to the above. Figure 3 In this embodiment, the first segmentation result of at least one type of target is optimized using the road network extraction network (road network post-processing). Figure 3 As shown, this embodiment may include:
[0052] S31: Perform road segmentation on the remote sensing image to obtain a second road segmentation result.
[0053] The road network extraction network can be any neural network that can achieve road segmentation. Figure 4 The road network extraction network shown is used as an example to illustrate this step:
[0054] Example 1: Figure 4As shown, the road network extraction network adopts the CascadeEncoderDecoder framework, including the Encoder module, the Neck module and the Decoder module. The Encoder module adopts the Swin Transformer structure, which consists of 4 stages. The remote sensing image (H×W×C) is sent to the target segmentation network, and the remote sensing image is processed by the Encoder module, the Neck module and the Decoder module in turn to obtain the target segmentation result. It should be noted that the naming in different examples of this application is independent of each other, and even if there is the same naming, it will not affect each other.
[0055] 1) First, a convolutional layer is used to encode the remote sensing image into adjacent 2*2 original feature maps of H / 4*wH / 4*W / 4*(16*C) according to the size of 4, and then sent to the Encoder module.
[0056] 2) The Encoder module adopts the Swin Transformer structure, which consists of 4 stages. The input of each stage is the output of the previous stage. Stage 1 includes a linear coding layer and 2 Swin Transformer Blocks. Stage 2 to stage 4 include a Patch Merging layer and 2, 18, and 2 Swin Transformer Block layers respectively. The Swin Transformer Block layer uses a window-based multi-head self-attention module or a moving window-based multi-head self-attention module and a multi-layer perceptron for feature extraction. The Patch Merging layer, on the one hand, concatenates and fuses adjacent 2*2 original feature maps, and on the other hand, deepens the number of channels. Therefore, the outputs of the four stages are feature maps of 1 / 4, 1 / 8, 1 / 16, and 1 / 32 of the original feature maps, respectively. The output results of the four stages are sent to the Neck module.
[0057] 3) The Neck module uses the FPN structure to concatenate and fuse the output results of the four stages. The Neck module consists of four stages. The input of each stage is the output of the previous stage and the output of the corresponding stage of the Encoder module. First, the output of the corresponding stage of the Encoder module is processed by a 3*3 convolution layer to obtain a feature map of 256 channels. Secondly, after upsampling the output of the previous stage to the same size as the feature map of 256 channels, the upsampling result of the output of the previous stage is concatenated with the feature map of 256 channels. Finally, the concatenation result is processed by a 3*3 convolution layer to obtain a concatenated fusion result. Among them, the feature map output by Stage4 is the result of the output feature map of the Encoder module Stage4 passing through the convolution layer; the feature map of Stage3 is the result of the fusion of the feature map output by Stage4 and the feature map output by the Encoder module Stage3; the feature map output by Stage2 is the result of the fusion of the feature map output by Stage3 and the feature map output by the Encoder module Stage2; the feature map output by Stage1 is the result of the fusion of the feature map output by Stage2 and the feature map output by the Encoder module Stage1.
[0058] 4) The decoder module uses the FPN structure to predict the second segmentation result of the road. The structure is the same as the Neck module. First, the feature map output by each stage is extracted as a feature map with 128 channels. Then, all 128 feature maps are bilinearly interpolated to a size of 1 / 8H*1 / 8W and added together. Finally, a convolution layer with a convolution kernel of 1*1 and the number of channels as the number of categories is used to predict the second segmentation result of the road.
[0059] S32: Superimpose the second segmentation result of the road onto the target segmentation result.
[0060] In some embodiments, the second segmentation result of the road can be directly superimposed on the target segmentation result. The superposition process is: traversing the target category of each pixel represented by the second segmentation result of the road, if the target category of the pixel is road, then modifying the category of the corresponding pixel in the target segmentation result to road.
[0061] In some embodiments, in order to avoid creating new disconnected road areas, the second segmentation result of the road may be optimized before being superimposed on the target segmentation result.
[0062] Through the implementation of this embodiment, it is possible to optimize the first segmentation result of the road in the target segmentation result by using the second segmentation result of the road, so as to enhance the connectivity of the road and improve the visual effect of the road.
[0063] Figure 5 FIG. 1 is a flow chart of another embodiment of the method for segmenting a remote sensing image. It should be noted that if there are substantially the same results, this embodiment is not limited to the above. Figure 5 The process sequence shown is limited. In this embodiment, S41 to S45 are steps that can be included before S32 to optimize the second segmentation result of the road. Figure 5 As shown, this embodiment may include:
[0064] S41: Based on the second segmentation result of the road, expand the road according to the first expansion parameter.
[0065] The second segmentation result of the road can indicate whether each pixel in the remote sensing image belongs to the road, so that the road in the remote sensing image can be determined based on the second segmentation result of the road. The road is expanded according to the first expansion parameter to reconnect the disconnected road. For example, the first expansion parameter can be 3 for the structural element and 2 for the iteration number.
[0066] S42: Refine the road.
[0067] By thinning the road area, the center line of the road area can be extracted.
[0068] S43: Determine a number of second connected domains included in the road.
[0069] The method of determining the second connected domain is similar to the method of determining the first connected domain, and is not described in detail here.
[0070] S44: taking each second connected domain as a current second connected domain in turn, and removing the current second connected domain if the area of the current second connected domain is smaller than the area threshold.
[0071] By removing the current second connected domain, the disconnected side roads in the road can be removed. The method of removing the current second connected domain is similar to the method of removing the current first connected domain, except that the target category for road segmentation is road and others, and when removing the current second connected domain, there is no need to calculate the replacement category, but directly change the pixel category in the current second connected domain to others.
[0072] S45: dilating the road area according to the second dilation parameter to update the second segmentation result of the road.
[0073] The width of the road can be restored by dilating the road according to the second dilation parameter. For example, the second dilation parameter can be 3 structural element size and 1 iteration number.
[0074] The dilation and thinning involved in S41 to S45 include but are not limited to being implemented using operators in opencv.
[0075] Figure 6 FIG. 1 is a flow chart of another embodiment of the method for segmenting a remote sensing image. It should be noted that if there are substantially the same results, this embodiment is not limited to the above. Figure 6 In this embodiment, the first segmentation result of at least one type of target includes the first segmentation result of the building, and the first segmentation result of at least one type of target is optimized using the building base extraction network (building base post-processing). Figure 6 As shown, this embodiment may include:
[0076] S51: Based on the first segmentation result of the building, determine a plurality of third connected domains included in the building.
[0077] The first segmentation result of the building can indicate whether each pixel in the remote sensing image belongs to a building, so the building in the remote sensing image can be determined based on the first segmentation result of the building. The method of determining the third connected domain is similar to the process of determining the first connected domain, which will not be repeated here.
[0078] S52: removing a plurality of third connected domains.
[0079] The method of removing the third connected domain is similar to the process of removing the current first connected domain, which is not described here in detail. The difference is that the area of the second connected domain does not need to be compared with the area threshold and is directly removed.
[0080] S53: Segment the remote sensing image into a building base to obtain a second segmentation result of the building base.
[0081] The processing process of remote sensing images by the building base extraction network is similar to that of remote sensing images by the road network extraction network, which will not be repeated here.
[0082] S54: Superimpose the second segmentation result of the building base onto the target segmentation result.
[0083] In some embodiments, the second segmentation result of the building base can be directly superimposed on the target segmentation result. The superposition process is: traverse the category of each pixel point represented by the second segmentation result of the building base, and if the category of the pixel point is the building base, then modify the category of the corresponding pixel in the target segmentation result to the building category.
[0084] In some embodiments, due to reasons such as vegetation planted on the building, there are holes in the building base. Therefore, before the second segmentation result of the building base is superimposed on the target segmentation result, the second segmentation result of the building base can be optimized to remove the holes in the building base.
[0085] It is understandable that when making an electronic map, it is not necessary to use the parts of the building other than the building base. Therefore, in this embodiment, the first segmentation result of the building in the target segmentation result is first removed, and then the second segmentation result of the building base is superimposed on the target segmentation result, thereby replacing the first segmentation result of the building with the second segmentation result of the building base to facilitate subsequent electronic map production.
[0086] Figure 7 FIG. 1 is a flow chart of another embodiment of the method for segmenting a remote sensing image. It should be noted that if there are substantially the same results, this embodiment is not limited to the above. Figure 7 In this embodiment, S61-S62 are steps that may be included before S54 to optimize the second segmentation result of the building base. Figure 7 As shown, this embodiment may include:
[0087] S61: Determine a plurality of fourth connected domains in the non-building base based on the second segmentation result of the building base.
[0088] The second segmentation result of the building base indicates whether each pixel in the remote sensing image belongs to the building base, so that the building base and the non-building base in the remote sensing image can be determined based on the second segmentation result of the building base. The determination method of the fourth connected domain is similar to the determination method of the first connected domain, which is not repeated here.
[0089] S62: taking each fourth connected domain as the current fourth connected domain in turn, and if the area of the current fourth connected domain is smaller than the area threshold, removing the current fourth connected domain to update the second segmentation result of the building base.
[0090] The method of removing the current fourth connected domain is similar to the method of removing the current first connected domain, except that: the target category for building base segmentation is building base and others, and when removing the current fourth connected domain, there is no need to calculate the replacement category, but directly change the pixel category in the current fourth connected domain to the building base.
[0091] Through the implementation of this embodiment, it is possible to use the second segmentation result of the building base to correct the first segmentation result of the building, thereby removing the voids in the building base and improving the segmentation effect and visual effect of the building base.
[0092] Figure 8 FIG. 1 is a flow chart of another embodiment of the method for segmenting a remote sensing image. It should be noted that if there are substantially the same results, this embodiment is not limited to the above. Figure 8In this embodiment, S71-S72 is a further extension of S13, which may be performed on the basis of road network post-processing / building base post-processing or not, so as to enhance the connectivity of each type of target. Figure 8 As shown, this embodiment may include:
[0093] S71: sequentially taking the first segmentation result of each type of target in the target segmentation results as the first segmentation result of the current type of target, and determining a plurality of fifth connected domains of the current type of target based on the first segmentation result of the current type of target.
[0094] S72: taking each fifth connected domain as the current fifth connected domain in turn, and if the area of the current fifth connected domain is smaller than the area threshold, removing the current fifth connected domain to update the target segmentation result.
[0095] The method of removing the current fifth connected domain is similar to the method of removing the current first connected domain, which will not be described in detail here.
[0096] In order to better demonstrate the removal methods of different connected domains involved, the following combination Fig. 9 Take the removal of the fifth connected domain as an example:
[0097] Example 2: 1) The number of target categories to be traversed is t, and the current target category is j. Set the corresponding area threshold for each target category, and start traversing from j=0.
[0098] 2) Determine whether j is less than or equal to t; if so, determine the n fifth connected domains of j based on the first segmentation result of j, and execute 4); otherwise, end. Let i represent the current fifth connected domain, and start traversal from i=0.
[0099] 3) Determine whether i is less than n; if so, execute 4); otherwise, j++, jump to 2).
[0100] 4) For a given area threshold, if the area of the current fifth connected domain is smaller than the area threshold, the outer contour of the current fifth connected domain is expanded outward by one pixel, the occurrence frequencies of the targets of each category in the expanded current fifth connected domain are sorted, and the category with the highest occurrence frequency except category j is taken as the replacement category m, and each pixel in the current fifth connected domain is traversed one by one to replace the pixel category in the current first connected domain with m.
[0101] 5)i++, jump to 3).
[0102] Combine as follows Fig.10 , the optimization of the target segmentation result is explained by a specific example:
[0103] Example 3: 1) Building base post-processing: using the building base extraction network to process the remote sensing image, obtain the second segmentation result of the building base, and remove the small area that is not the building base.
[0104] 2) Road network post-processing: that is, using the road network extraction network to process the remote sensing image, obtain the second segmentation result of the road, and remove the small area of the road.
[0105] 3) Multi-classification post-processing. That is, based on the first segmentation result of the road in the target segmentation result, remove the small area of the road. Based on the first segmentation result of the building in the target segmentation result, remove the building.
[0106] 4) Superimpose the building base post-processing results and the road network post-processing results to obtain the multi-classification post-processing results.
[0107] 5) Post-processing of the superposition results. That is, small areas of all types of targets are removed based on the superposition results to obtain the final post-processing results.
[0108] Fig.11 The first row from top to bottom shows the remote sensing image (2048*2048 four-band remote sensing image) on the left, the target segmentation result on the right, the multi-classification post-processing result on the left, the multi-classification post-processing result on the right, the building base post-processing result on the left, the multi-classification post-processing result on the right, the optimization result on the left, and the optimization result on the right.
[0109] Furthermore, considering that high-resolution remote sensing images occupy a large amount of memory space, directly using them for target segmentation will reduce processing efficiency. Therefore, after obtaining the remote sensing image, the remote sensing image is cropped into multiple sub-images, and the multiple sub-images are applied to target segmentation. Thus, the above embodiment can be further expanded:
[0110] Fig.12 FIG. 1 is a flow chart of another embodiment of the method for segmenting a remote sensing image. It should be noted that if there are substantially the same results, this embodiment is not limited to the above. Fig.12 In this embodiment, S81 is a step that can be included before S12, and S82 to S83 are further expansions of S12. Fig.12 As shown, this embodiment may include:
[0111] S81: Crop the remote sensing image according to a preset cropping method to obtain multiple sub-images of the remote sensing image.
[0112] The geographical range covered by multiple sub-images is equivalent to the geographical range covered by the remote sensing image. The preset cropping method can be a continuous cropping method or an overlapping cropping method. In the continuous cropping method, there is no overlap between adjacent sub-images. In the overlapping cropping method, there is partial overlap between adjacent sub-images. For example, the size of the sub-image is 512×512, and the partial overlap ratio is 50%. See the example of multiple sub-images obtained by the continuous cropping method. Fig.13 ,like Fig.13 As shown in Figure 1, the remote sensing image is cropped into four consecutive sub-images. For an example of multiple sub-images obtained by overlapping cropping, see Fig.14 ,like Fig.14 As shown, the remote sensing image is cropped into 9 sub-images, and the overlapping ratio of adjacent sub-images is 50%.
[0113] S82: Perform target segmentation on the multiple sub-images respectively to obtain target segmentation results for the multiple sub-images.
[0114] The target segmentation result of the sub-image includes the probability that each pixel in the sub-image belongs to each target category, and the target category corresponding to the maximum probability is the target category to which the pixel belongs.
[0115] S83: splicing the target segmentation results of multiple sub-images to obtain the target segmentation result of the remote sensing image.
[0116] In the continuous cropping method, the probability of the pixel points in each sub-image can be used as the probability of the corresponding pixel points in the remote sensing image.
[0117] In the overlapping cropping mode, for the overlapping areas of adjacent sub-images, if the target segmentation results of the pixels corresponding to the same position are different, the target categories representing the pixels are different. Therefore, if the probabilities of the pixels in each sub-image are directly used as the probabilities of the corresponding pixels in the remote sensing image, there may be a patchwork situation. Therefore, in this case, the probabilities of the corresponding pixels in the overlapping areas of adjacent sub-images can be added as the probability of the corresponding pixels in the remote sensing image, and the probabilities of the pixels in each sub-image that do not belong to the overlapping areas can be used as the probability of the corresponding pixels in the remote sensing image to obtain the target segmentation result of the remote sensing image.
[0118] Fig.15 Schematic diagram of the structure of an embodiment of the electronic device of the present application. Fig.15 As shown, the electronic device includes a processor 21 and a memory 22 coupled to the processor 21 .
[0119] The memory 22 stores program instructions for implementing the method of any of the above embodiments; the processor 21 is used to execute the program instructions stored in the memory 22 to implement the steps of the above method embodiments. The processor 21 may also be referred to as a CPU (Central Processing Unit). The processor 21 may be an integrated circuit chip with signal processing capabilities. The processor 21 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0120] The electronic device mentioned in this embodiment may be an access management node, or may be other device connected to the access management node.
[0121] Fig.16 Schematic diagram of the structure of an embodiment of a computer-readable storage medium of the present application. Fig.16 As shown, the computer-readable storage medium 30 of the embodiment of the present application stores program instructions 31, and the program instructions 31 are executed to implement the method provided in the above embodiment of the present application. Among them, the program instructions 31 can form a program file and be stored in the above computer-readable storage medium 30 in the form of a software product, so that a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) executes all or part of the steps of each implementation method of the present application. The aforementioned computer-readable storage medium 30 includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk, or a terminal device such as a computer, a server, a mobile phone, and a tablet.
[0122] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0123] In addition, each functional unit in each embodiment of the present 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 above integrated unit can be implemented in the form of hardware or in the form of software functional units. The above is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made by using the description and drawings of this application, or directly or indirectly used in other related technical fields, is also included in the patent protection scope of the present application.
Claims
1. A method for target segmentation of remote sensing images, characterized in that: include: Acquisition of remote sensing images; Performing target segmentation on the remote sensing image to obtain a target segmentation result; Optimizing a first segmentation result of at least one type of target in the target segmentation results to update the target segmentation results; The first segmentation result of at least one type of target includes a first segmentation result of a road, and the first segmentation result of at least one type of target in the target segmentation result is optimized to update the target segmentation result, including: determining a plurality of first connected domains included in the road based on the first segmentation result of the road; taking each of the first connected domains as a current first connected domain in turn, and if the area of the current first connected domain is less than an area threshold, removing the current first connected domain to update the first segmentation result of the road; The removing of the current first connected domain comprises: expanding the current first connected domain; determining the remaining target categories with the highest occurrence frequency in the expanded current first connected domain, wherein the remaining target categories are categories other than the road; and replacing the target category to which the current first connected domain belongs with the determined remaining target categories.
2. The method according to claim 1, characterized in that The step of optimizing the first segmentation result of at least one type of target in the target segmentation results to update the target segmentation results includes: Performing road segmentation on the remote sensing image to obtain a second segmentation result of the road; The second segmentation result of the road is superimposed on the target segmentation result.
3. The method according to claim 2, characterized in that Before superimposing the second segmentation result of the road onto the target segmentation result, the method further includes: Based on the second segmentation result of the road, dilating the road according to a first dilation parameter; refining said roads; Determining a plurality of second connected domains included in the road; Taking each of the second connected domains as a current second connected domain in turn, and if the area of the current second connected domain is smaller than an area threshold, removing the current second connected domain; The road is expanded according to a second expansion parameter to update a second segmentation result of the road.
4. The method according to claim 1, characterized in that: The first segmentation result of at least one type of target includes a first segmentation result of a building, and the first segmentation result of at least one type of target in the target segmentation results is optimized. To update the target segmentation result, including: Based on the first segmentation result of the building, determining a plurality of third connected domains included in the building; removing the plurality of third connected domains; Performing building base segmentation on the remote sensing image to obtain a second segmentation result of the building base; The second segmentation result of the building substrate is superimposed on the target segmentation result.
5. The method according to claim 4, characterized in that Before superimposing the second segmentation result of the building base onto the target segmentation result, the method further includes: Based on the second segmentation result of the building substrate, determining a plurality of fourth connected domains in the non-building substrate; Each of the fourth connected domains is sequentially used as a current fourth connected domain. If the area of the current fourth connected domain is smaller than an area threshold, the current fourth connected domain is removed to update the second segmentation result of the building base.
6. The method according to claim 2 or 4, characterized in that: The method further comprises: sequentially taking the first segmentation result of each type of target in the target segmentation results as the first segmentation result of the current type of target, and determining a plurality of fifth connected domains of the current type of target based on the first segmentation result of the current type of target; Each of the fifth connected domains is sequentially used as a current fifth connected domain. If the area of the current fifth connected domain is smaller than an area threshold, the current fifth connected domain is removed to update the target segmentation result.
7. The method according to claim 1, characterized in that Before performing target segmentation on the remote sensing image to obtain the target segmentation result, the method further includes: In response to the channel of the remote sensing image not being a preset channel, expanding the channel of the remote sensing image, and the channel of the expanded remote sensing image being a preset channel; The performing target segmentation on the remote sensing image to obtain a target segmentation result includes: Performing target segmentation on the expanded remote sensing image to obtain the target segmentation result.
8. The method according to claim 1, characterized in that Before performing target segmentation on the remote sensing image to obtain the target segmentation result, the method further includes: Cropping the remote sensing image according to a preset cropping method to obtain multiple sub-images of the remote sensing image; The performing target segmentation on the remote sensing image to obtain a target segmentation result includes: Performing target segmentation on the multiple sub-images respectively to obtain target segmentation results of the multiple sub-images; The target segmentation results of the multiple sub-images are spliced to obtain the target segmentation result of the remote sensing image.
9. The method according to claim 8, characterized in that The preset cropping method is a continuous cropping method, and there is no overlap between adjacent sub-images.
10. The method according to claim 9, characterized in that The preset cropping method is an overlapping cropping method, adjacent sub-images partially overlap, and the target segmentation results of the sub-images include the probabilities that the pixels in the sub-images belong to each category; The step of splicing the target segmentation results of the plurality of sub-images to obtain the target segmentation result of the remote sensing image includes: The probabilities of the corresponding pixel points in the overlapping areas of the adjacent sub-images are added as the probability of the corresponding pixel points in the remote sensing image, and the probability of the pixel points in each sub-image that do not belong to the overlapping area is used as the probability of the corresponding pixel points in the remote sensing image to obtain the target segmentation result of the remote sensing image.
11. An electronic device, characterized in that: comprising a processor and a memory connected to the processor, wherein the memory stores program instructions; The processor is configured to execute the program instructions stored in the memory to implement the method according to any one of claims 1 to 10.
12. A computer-readable storage medium, characterized in that: The storage medium stores program instructions, and when the program instructions are executed, the method according to any one of claims 1 to 10 is implemented.
