A method, device and electronic equipment for repairing shadow areas of remote sensing images
The multi-task neural network model is combined with the ground object classification and shadow detection branches to perform shadow area repair on remote sensing images, which solves the problems of low shadow area repair efficiency and unsatisfactory effects in the existing technology, and achieves high-quality shadow repair and extensive application.
Patent Information
- Application Number
- CN202410903223.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-08
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2044-07-08
AI Technical Summary
Existing methods for repairing shadow areas in remote sensing images are inefficient and unsatisfactory. Traditional computer vision technology is prone to misidentification. Neural network models require a large amount of training data and have limited application fields. Methods based on spectral libraries lead to inaccurate features of ground objects.
A multi-task neural network model is used, combined with the ground object classification branch and the shadow detection branch, and the standard semantic segmentation structure is enhanced through the self-attention module to obtain the ground object mask and area mask, perform super-pixel segmentation and matching pair processing, and use non-shadow Area features map shadow area features for repair.
It improves the effect and data quality of shadow area repair in remote sensing images, expands the scope of application fields, and achieves better shadow repair effects and versatility.
Smart Images

Figure CN118446938B
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to image processing technology, and more particularly to a method, device, and electronic device for repairing shadow areas of remote sensing images. Background Art
[0002] There are some shadow areas in remote sensing images. In order to improve the data quality of remote sensing images and expand the scope of application of remote sensing images, it is necessary to repair the shadow areas of remote sensing images. At present, the shadow area repair methods are generally carried out. One is to use traditional computer vision technology to repair the image. Since remote sensing images are relatively large and complex, this method is prone to misidentification. One is to train a neural network model through learning a large amount of data, and directly input the shadow image into the neural network model for processing and repair. This method requires a large amount of training data, the repair efficiency is low, and the model can be applied in a limited field. One is to reconstruct the shadow area image based on the spectral library. This method will reconstruct all shadow area objects into the typical ones in the spectral library, which may be different from the actual object features. Therefore, the existing shadow area repair methods are not ideal for the actual repair effect of shadow areas in remote sensing images. Summary of the invention
[0003] In order to solve the above problems, one or more embodiments of this specification describe a method, device and electronic device for repairing shadow areas of remote sensing images.
[0004] According to a first aspect, a method for repairing a shadow area of a remote sensing image is provided, the method comprising:
[0005] Acquire a remote sensing image to be restored, process the remote sensing image based on a multi-task neural network model, obtain a first object mask and a first region mask, the first region mask includes a shadow region mask and a non-shadow region mask, the multi-task neural network model has an object classification branch and a shadow detection branch, the structure of the object classification branch is a standard semantic segmentation branch structure, and the structure of the shadow detection branch is a structure obtained by adding a self-attention module to the standard semantic segmentation branch structure;
[0006] Based on the object categories of the first object mask, the first region mask is respectively segmented into superpixels to obtain shadow superpixel masks and non-shadow superpixel masks of each object category;
[0007] For any shadow superpixel region of any of the above-mentioned ground object categories, searching for a non-shadow superpixel region of the same type of ground object that is the nearest neighbor to the shadow superpixel region, and forming a matching pair between the shadow superpixel region and the non-shadow superpixel region of the same type of ground object;
[0008] For any of the matching pairs, the shadow area statistics of the matching pair are mapped into non-shadow area statistics to obtain a regional restoration image corresponding to the shadow superpixel area;
[0009] After all the matching pairs are processed, the inpainted images of each region and the non-shadow superpixel region images are integrated to obtain the shadow inpainted image corresponding to the remote sensing image.
[0010] Preferably, before processing the remote sensing image based on the multi-task neural network model, the method further includes:
[0011] Randomly extract each target image from a preset ground object image library, and perform ground object mask annotation and shadow area mask annotation on the target image;
[0012] Segmenting the labeled target image to construct a sample set, wherein the sample set includes a training set and a test set;
[0013] A deep learning model to be trained is constructed, and the deep learning model is trained based on the sample set to obtain a multi-task neural network model, wherein the deep learning model is provided with a ground object classification branch and a shadow detection branch.
[0014] Preferably, the step of acquiring a remote sensing image to be restored and processing the remote sensing image based on a multi-task neural network model to obtain a first object mask and a first region mask includes:
[0015] Acquire a remote sensing image to be restored, and acquire meta information of the remote sensing image;
[0016] Dividing the remote sensing image into at least one first image based on a first preset size, and dividing each of the first images into a plurality of second images based on a second preset size and a preset overlap ratio;
[0017] After normalizing each of the second images based on the meta-information, processing each of the second images based on a multi-task neural network model to obtain each second ground object mask and second region mask;
[0018] For each of the first images, regional fusion is performed on each of the second object masks and the second region masks to obtain a first object mask and a first region mask.
[0019] Preferably, performing regional fusion on each of the second feature masks and the second region masks to obtain the first feature mask and the first region mask comprises:
[0020] Determine the non-overlapping area and the overlapping area in each of the second feature mask and the second area mask based on the preset overlapping rate;
[0021] For each of the second images, retaining a preset proportion area in the overlapping area close to the non-overlapping area;
[0022] Regional fusion is performed on each non-overlapping area and the area with a preset ratio to obtain a first feature mask and a first regional mask.
[0023] Preferably, the method of performing superpixel segmentation on the first region mask based on the object category of the first object mask to obtain a shadow superpixel mask and a non-shadow superpixel mask of each object category includes:
[0024] For any ground object category, extract a binary mask of the ground object category from the first ground object mask, and obtain a third mask for the shadow area and a fourth mask for the non-shadow area based on multiplying the binary mask by the first area mask;
[0025] Perform superpixel segmentation on the mask area images corresponding to the third mask and the fourth mask to obtain a shadow superpixel mask and a non-shadow superpixel mask for each of the ground object categories, and determine the shadow superpixel area image corresponding to the shadow superpixel mask and the non-shadow superpixel area image corresponding to the non-shadow superpixel mask.
[0026] Preferably, the searching for the non-shadow superpixel region of the same type of ground object that is the nearest neighbor to the shadow superpixel region comprises:
[0027] The centroids of the shadow superpixel region and each non-shadow superpixel region are calculated respectively, and a non-shadow superpixel region of the same type of ground object having the shortest distance to the centroid of the shadow superpixel region is determined in each non-shadow superpixel region.
[0028] Preferably, the method further comprises:
[0029] Based on the edge feathering algorithm, the edge areas between the repaired images of each area and the images of the non-shadow superpixel area are feathered and fused.
[0030] According to a second aspect, a shadow area repair device for a remote sensing image is provided, the device comprising:
[0031] An acquisition module is used to acquire a remote sensing image to be restored, and process the remote sensing image based on a multi-task neural network model to obtain a first object mask and a first region mask, wherein the first region mask includes a shadow region mask and a non-shadow region mask, and the multi-task neural network model has an object classification branch and a shadow detection branch, wherein the structure of the object classification branch is a standard semantic segmentation branch structure, and the structure of the shadow detection branch is a structure obtained by adding a self-attention module to the standard semantic segmentation branch structure;
[0032] a segmentation module, configured to perform superpixel segmentation on the first region mask based on the object category of the first object mask, to obtain a shadow superpixel mask and a non-shadow superpixel mask of each object category;
[0033] A search module is used to search for a non-shadow superpixel region of the same type of ground object that is the nearest neighbor of any shadow superpixel region of any of the ground object categories, and to form a matching pair between the shadow superpixel region and the non-shadow superpixel region of the same type of ground object;
[0034] A mapping module, for mapping the shadow area statistics of any of the matching pairs into non-shadow area statistics, to obtain a regional restoration image corresponding to the shadow superpixel area;
[0035] The integration module is used to integrate the repaired images of each region and the non-shadow superpixel region images after all the matching pairs are processed to obtain the shadow repaired image corresponding to the remote sensing image.
[0036] According to a third aspect, there is provided an electronic device, comprising a processor and a memory;
[0037] The processor is connected to the memory;
[0038] The memory is used to store executable program code;
[0039] The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the steps of the method provided in the first aspect or any possible implementation manner of the first aspect.
[0040] According to a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and the computer-readable storage medium stores instructions, which, when the instructions are executed on a computer or a processor, cause the computer or the processor to execute the method provided in the first aspect or any possible implementation of the first aspect.
[0041] The method and device provided in the embodiments of this specification can use a multi-task neural network model to simultaneously determine the object mask and the regional mask of the remote sensing image, and perform superpixel segmentation on the regional mask according to the category of the object mask, and then determine the non-shadow superpixel area of the same object corresponding to each shadow superpixel area by the nearest neighbor search, and use the non-shadow area features to enhance the information of the shadow area features according to the matching algorithm, and finally integrate and generate a shadow repair image. Through the above method, the shadow area repair effect of the remote sensing image is better, the repaired image obtained has high data quality, and is universal, and can be applied in a wide range of fields. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1 It is a flowchart of a method for repairing a shadow area of a remote sensing image in one embodiment of the present specification.
[0044] Figure 2 It is a schematic diagram of the structure of a shadow area repair device for a remote sensing image in one embodiment of the present specification.
[0045] Figure 3 It is a structural diagram of an electronic device in one embodiment of this specification. DETAILED DESCRIPTION
[0046] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0047] In the following introduction, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance. The following introduction provides multiple embodiments of the present application, and different embodiments can be replaced or combined, so the present application can also be considered to include all possible combinations of the same and / or different embodiments recorded. Therefore, if one embodiment includes features A, B, and C, and another embodiment includes features B and D, then the present application should also be considered to include embodiments containing one or more of all other possible combinations of A, B, C, and D, although the embodiment may not be clearly recorded in the following text.
[0048] The following description provides examples and does not limit the scope, applicability or examples set forth in the claims. Changes may be made to the functions and arrangements of the elements described without departing from the scope of the present application. Various processes or components may be appropriately omitted, substituted or added to each example. For example, the described method may be performed in an order different from the order described, and various steps may be added, omitted or combined. In addition, features described in some examples may be combined in other examples.
[0049] See also Figure 1 , Figure 1 : is a flowchart of a method for repairing shadow areas of remote sensing images provided in an embodiment of the present application. In the embodiment of the present application, the method includes:
[0050] S101, obtaining a remote sensing image to be restored, and processing the remote sensing image based on a multi-task neural network model to obtain a first object mask and a first region mask.
[0051] Among them, the first area mask includes a shadow area mask and a non-shadow area mask, the multi-task neural network model has a land object classification branch and a shadow detection branch, the structure of the land object classification branch is a standard semantic segmentation branch structure, and the structure of the shadow detection branch is a structure after adding a self-attention module to the standard semantic segmentation branch structure.
[0052] The execution entity of this application can be a cloud server.
[0053] In the embodiment of this specification, a multi-task neural network model will be pre-built and trained in the cloud server. The multi-task neural network model can be obtained by training models such as DeepLabv3 and U-Net as basic models, and DeepLabv3 can be preferably used as the basic model. In order to make the model finally trained suitable for the recognition of objects and shadows in remote sensing images, in each branch of the neural network model, it is necessary to set a ground object classification branch and a shadow detection branch. The ground object classification branch can directly use the existing standard semantic segmentation branch structure in the neural network model, and the shadow detection branch can be an additional branch set in the model structure. Its specific structure is based on the standard semantic segmentation branch structure, and one of the convolution modules is replaced with a self-attention module or a self-attention module is added to enhance the model's modeling ability for the overall features of the image, so as to better distinguish shadows from non-shadows. In addition, different task branches in the model can share a feature extraction module. Through the processing of the multi-task neural network model, the first ground object mask and the first regional mask in the remote sensing image can be determined, wherein the ground object mask is used to distinguish different types of typical objects, such as buildings, water bodies, grasslands, trees, roads, etc., and the first regional mask is used to distinguish shadow areas from non-shadow areas. The range covered by each mask can be regarded as a mask area.
[0054] In one possible implementation, before processing the remote sensing image based on the multi-task neural network model, the method further includes:
[0055] Randomly extract each target image from a preset ground object image library, and perform ground object mask annotation and shadow area mask annotation on the target image;
[0056] Segmenting the labeled target image to construct a sample set, wherein the sample set includes a training set and a test set;
[0057] A deep learning model to be trained is constructed, and the deep learning model is trained based on the sample set to obtain a multi-task neural network model, wherein the deep learning model is provided with a ground object classification branch and a shadow detection branch.
[0058] In an embodiment of the present specification, a cloud server is pre-set with a land object image library, which stores various image data corresponding to different typical land objects. In order to train the model, it is necessary to produce a land object classification data set. The cloud server will randomly extract different target images from the land object image library, and use the SAM model as an auxiliary tool to annotate the target image with land object masks and shadow area masks. After the annotation is completed, the cloud server will segment the land object mask, shadow area mask and target image together, and convert these annotated target images into a sample set required for deep learning model training. After the sample set is constructed, deep learning models such as DeepLabv3 and U-Net will be selected as the basic model, and the basic model will be structurally adjusted so that it has land object classification branches and shadow detection branches. The basic model is trained to finally obtain a trained multi-task neural network model.
[0059] In one possible implementation, the acquiring of the remote sensing image to be restored, and processing of the remote sensing image based on a multi-task neural network model to obtain a first object mask and a first region mask include:
[0060] Acquire a remote sensing image to be restored, and acquire meta information of the remote sensing image;
[0061] Dividing the remote sensing image into at least one first image based on a first preset size, and dividing each of the first images into a plurality of second images based on a second preset size and a preset overlap ratio;
[0062] After normalizing each of the second images based on the meta-information, processing each of the second images based on a multi-task neural network model to obtain each second ground object mask and second region mask;
[0063] For each of the first images, regional fusion is performed on each of the second object masks and the second region masks to obtain a first object mask and a first region mask.
[0064] In the embodiment of the present specification, since the remote sensing image is usually very large, in order to ensure the detection and repair effect and speed of the super large image, the remote sensing image will be processed in blocks. Specifically, the cloud server will first obtain the metadata of the remote sensing image, which includes image resolution, size, number of bands, and the effective value range of each band. At the same time, the cloud server will construct a tif to save the image based on the metadata, and the geographic information of the saved image is consistent with the original image of the remote sensing image. Then, the cloud server will divide the remote sensing image according to the first preset size to obtain at least one first image, that is, to obtain at least one block, and calculate and obtain the coordinate range of each block, and then take the first image as a whole, and process each first image in turn in a loop, that is, after completing the repair process of the shadow area of a certain first image, continue to process the next first image. For each first image, the cloud server will continue to divide the first image according to the second preset size and the preset overlap rate to obtain multiple second images, that is, multiple patches, wherein the preset overlap rate is set to reduce the inaccuracy of the model's prediction at the edge of each patch image, so that the overall accuracy of a block area can be improved by fusion area later. After normalizing each second image by reading the meta information, the cloud server will input each second image into the multi-task neural network model for processing to obtain the second object mask and the second region mask corresponding to each second image. As an example, the object mask can be a two-dimensional matrix with values of 1, 2, 3, ..., n (1, 2, 3, etc. are indexes of different object categories), and the region mask can be a two-dimensional matrix with values of 0, 1, where 1 represents the shadow area. After obtaining the second object masks and the second region masks corresponding to all the second images in the first image, the second object masks and the second region masks will be regionally fused to obtain the first object mask and the first region mask corresponding to the first image. During the fusion process, the image pixel value of the overlapping area can be calculated according to the pixel mean or pixel weight value of the overlapping part of the two images, or it can be determined by other feasible implementation methods. Before the first object mask and the first region mask are used for subsequent processing, the first object mask and the first region mask will be post-processed by the expansion algorithm and the erosion algorithm to optimize the edges and holes of the detection results.
[0065] In one possible implementation, performing regional fusion on each of the second feature masks and the second region masks to obtain the first feature mask and the first region mask includes:
[0066] Determine the non-overlapping area and the overlapping area in each of the second feature mask and the second area mask based on the preset overlapping rate;
[0067] For each of the second images, retaining a preset proportion area in the overlapping area close to the non-overlapping area;
[0068] Regional fusion is performed on each non-overlapping area and the area with a preset ratio to obtain a first feature mask and a first regional mask.
[0069] In an embodiment of the present specification, the cloud server will determine the overlapping areas and non-overlapping areas in each second feature mask and the second regional mask according to the preset overlap rate and the coordinate range corresponding to each second image. For each non-overlapping area and overlapping area determined in the second image, only the portion of the non-overlapping area and the preset proportion area in the overlapping area close to the non-overlapping area will be trusted. Generally speaking, the preset proportion will be set to one-half, so that in the two regional images corresponding to the overlapping area, the one-half of the content closer to the center of the image will be trusted respectively, and a complete image will be obtained after the final fusion. In other possible implementations, other preset proportions can also be selected, and regional fusion can be achieved by taking the average of the pixel values at the overlapping proportion positions.
[0070] S102 . Perform superpixel segmentation on the first region mask based on the object categories of the first object mask to obtain shadow superpixel masks and non-shadow superpixel masks of each object category.
[0071] In the embodiment of the present specification, the first object mask has only one overall prediction result for a large area of connected objects, but there may be different features inside it. In order to distinguish these small areas with different features, the cloud server will perform superpixel segmentation on the first object mask. Specifically, the cloud server will determine the first object mask corresponding to each object category, and perform superpixel segmentation on the first area mask part within the mask area corresponding to the first object mask to obtain the shadow superpixel mask and non-shadow superpixel mask corresponding to this part of the first area mask. The image corresponding to the shadow superpixel mask is the shadow superpixel area image, and the image corresponding to the non-shadow superpixel mask is the non-shadow superpixel area image.
[0072] In one possible implementation, the first region mask is subjected to superpixel segmentation based on the object categories of the first object mask to obtain shadow superpixel masks and non-shadow superpixel masks of each object category, respectively, including:
[0073] For any ground object category, extract a binary mask of the ground object category from the first ground object mask, and obtain a third mask for the shadow area and a fourth mask for the non-shadow area based on multiplying the binary mask by the first area mask;
[0074] Perform superpixel segmentation on the mask area images corresponding to the third mask and the fourth mask to obtain a shadow superpixel mask and a non-shadow superpixel mask for each of the ground object categories, and determine the shadow superpixel area image corresponding to the shadow superpixel mask and the non-shadow superpixel area image corresponding to the non-shadow superpixel mask.
[0075] In the embodiment of this specification, it is assumed that the shadow area mask is , the non-shadow area mask is , the feature mask is For example, assuming that the object category is a building category, the cloud server first extracts the binary mask of the object category from the first object mask:
[0076]
[0077] Among them, 1 represents the feature classification index corresponding to the building.
[0078] Next, the binary mask is multiplied by the first area mask to obtain the building mask corresponding to the shadow area, which is the third mask. , and the building mask corresponding to the non-shadow area, which is the fourth mask :
[0079]
[0080] Then, the first image and the third and fourth masks are input into the superpixel segmentation algorithm to perform superpixel segmentation on the shadow area and the non-shadow area, respectively, to obtain the shadow superpixel mask and the non-shadow superpixel mask of the building area, where the third and fourth masks are the effective areas of the superpixel segmentation algorithm. In the process of superpixel segmentation, the number of seeds for superpixel segmentation is calculated according to the following formula:
[0081]
[0082] in, Indicates the total number of seeds in the first image. The total number of seeds is the total number of preset superpixels in the current processed image, which is mainly related to the size of the processed image, the complexity of the objects, and the speed of the algorithm. Each seed is used to initialize the pixel point of the clustering process. This is the binary mask input into the superpixel algorithm, also known as the third mask or the fourth mask.
[0083] As an example, for a 512*512 image, the total number of seeds is preset to 100. After calculation, the number of seeds calculated in the building shadow area is 15, and the number of seeds calculated in the building non-shadow area is 43. Then, the seeds are clustered by the superpixel segmentation algorithm to obtain the shadow superpixel mask. and non-shadow superpixel masks .
[0084] S103. For any shadow superpixel region of any of the above-mentioned ground object categories, search for a non-shadow superpixel region of the same type of ground object that is the nearest neighbor to the shadow superpixel region, and form a matching pair between the shadow superpixel region and the non-shadow superpixel region of the same type of ground object.
[0085] In the embodiments of the present specification, for each shadow superpixel area under each feature category, the nearest neighbor non-shadow superpixel area of the same feature will be determined from the non-shadow superpixel areas near the shadow superpixel area by the nearest neighbor similar search method, and the target non-shadow superpixel area will be used as a template superpixel to form a matching superpixel pair with the shadow superpixel area, and its index in the superpixel segmentation mask will be recorded. Subsequently, image enhancement processing will be performed in units of matching pairs. Among them, the nearest neighbor search algorithm can select different algorithms according to different actual needs, for example, Brute Force, kd Tree, Approximate Nearest Neighbor (ANN) Algorithms, etc. can be used.
[0086] In one possible implementation, the searching for a non-shadow superpixel region of a similar ground object that is the nearest neighbor to the shadow superpixel region includes:
[0087] The centroids of the shadow superpixel region and each non-shadow superpixel region are calculated respectively, and a non-shadow superpixel region of the same type of ground object having the shortest distance to the centroid of the shadow superpixel region is determined in each non-shadow superpixel region.
[0088] In an embodiment of the present specification, the cloud server will calculate the centroid of each superpixel area, including the shadow superpixel area and the non-shadow superpixel area, and then use the shadow superpixel area as the area to be corrected and the non-shadow superpixel area as the template area, and find the non-shadow superpixel area with the smallest distance from the centroid of each area to be corrected, which is the template area.
[0089] S104. For any of the matching pairs, map the shadow area statistics of the matching pair into non-shadow area statistics to obtain a regional restoration image corresponding to the shadow superpixel area.
[0090] In the embodiment of this specification, the cloud server will process each area to be corrected in turn, and after obtaining the matching template area through the nearest neighbor search method, the non-shadow area features in the matching pair are mapped to the shadow area features using the statistical function relationship mapping, so as to achieve image enhancement of the shadow area and obtain the regional repair image corresponding to the shadow superpixel area. After each area to be corrected is repaired, it can also be used as a candidate template area and as a matching template for the next area to be corrected to enhance the overall consistency of the corrected image.
[0091] As an example, before performing the statistical function mapping, the original image is first converted from the RGB color space to the HSV color space, and then the mean and variance of the HSV channel of the image in the template area and the mean and variance of the HSV channel of the image in the area to be corrected are calculated respectively, and the mean variance of the area to be corrected is converted to the mean variance of the template area by the following formula:
[0092]
[0093] in, , Respectively represent the mean of the template area and the mean of the area to be corrected, , Respectively represent the variance of the template area and the variance of the area to be corrected, , , They represent the data of the template area, the data of the area to be corrected, and the data of the regional repaired image. In order to ensure that the color is not distorted after correction, you can choose to only perform color mapping on the V channel or SV channel during correction, and keep the other channels unchanged. At the same time, you need to constrain the data of each channel to keep it within the valid range. After the correction is completed, the image is transferred from the HSV space to the RGB space.
[0094] In one embodiment, the method further comprises:
[0095] Based on the edge feathering algorithm, the edge areas between the repaired images of each area and the images of the non-shadow superpixel area are feathered and fused.
[0096] In the embodiments of the present specification, there may be significant edge lines between the corrected area restoration image and the uncorrected non-shadow superpixel area image. Therefore, it is necessary to feather the edge area where the edge lines are located according to the edge feathering algorithm to finally obtain the shadow restoration image of the remote sensing image.
[0097] As an example, the processing process of the edge feathering algorithm can be to first copy the entire image of the first image before correction , use the corrected data in the correction area, that is, the regional repair image to cover it and obtain a temporary image Next, obtain the binary mask of the feathered area, that is, the mask of the area to be corrected , use a 9*9 operator to perform mean blurring on it, and constrain the blurred matrix values to ensure that the range is between 0 and 1. This matrix is called the correction fusion matrix , and obtain the relative original image fusion matrix . Multiply the original image and the corrected image with the fusion matrix respectively to obtain the feathered image:
[0098]
[0099] S105 . After all the matching pairs are processed, the inpainted images of each region and the non-shadow superpixel region images are integrated to obtain the shadow inpainted image corresponding to the remote sensing image.
[0100] In the embodiment of the present specification, after all matching pairs have been processed, the cloud server integrates the repaired images of each area and the non-shadow superpixel area images through the coordinate range to obtain the shadow repaired image of the entire remote sensing image. Among them, if the remote sensing image is divided into various first images because it is too large, the matching pairs in the first image will be processed and integrated based on the first image to obtain the shadow repaired image of the first image. Finally, after all the first images have been processed, the shadow repaired image corresponding to the remote sensing image can be obtained by coordinate splicing.
[0101] The following will be combined with the attached Figure 2 , the shadow area repair device of the remote sensing image provided by the embodiment of the present application is introduced in detail. It should be noted that the attached Figure 2 The shadow area repair device of the remote sensing image shown is used to implement the present application Figure 1 For the convenience of explanation, only the part related to the embodiment of the present application is shown. For the specific technical details not disclosed, please refer to the present application. Figure 1 The embodiment shown.
[0102] See also Figure 2 , Figure 2 Schematic diagram of a shadow area repair device for remote sensing images provided in an embodiment of the present application. Figure 2 As shown, the device comprises:
[0103] An acquisition module 201 is used to acquire a remote sensing image to be restored, and process the remote sensing image based on a multi-task neural network model to obtain a first object mask and a first region mask, wherein the first region mask includes a shadow region mask and a non-shadow region mask, and the multi-task neural network model has an object classification branch and a shadow detection branch, wherein the structure of the object classification branch is a standard semantic segmentation branch structure, and the structure of the shadow detection branch is a structure obtained by adding a self-attention module to the standard semantic segmentation branch structure;
[0104] A segmentation module 202 is used to perform superpixel segmentation on the first region mask based on the object category of the first object mask, to obtain a shadow superpixel mask and a non-shadow superpixel mask of each object category;
[0105] A search module 203 is used to search for a non-shadow superpixel region of the same type of ground object that is the nearest neighbor of the shadow superpixel region for any shadow superpixel region of any of the ground object categories, and form a matching pair between the shadow superpixel region and the non-shadow superpixel region of the same type of ground object;
[0106] A mapping module 204 is used for mapping the shadow area statistics of any of the matching pairs into non-shadow area statistics to obtain a regional restoration image corresponding to the shadow superpixel area;
[0107] The integration module 205 is used to integrate the inpainted images of each region and the non-shadow superpixel region images after all the matching pairs are processed, so as to obtain the shadow inpainted image corresponding to the remote sensing image.
[0108] In one possible implementation, the acquisition module 201 is specifically used for:
[0109] Randomly extract each target image from a preset ground object image library, and perform ground object mask annotation and shadow area mask annotation on the target image;
[0110] Segmenting the labeled target image to construct a sample set, wherein the sample set includes a training set and a test set;
[0111] A deep learning model to be trained is constructed, and the deep learning model is trained based on the sample set to obtain a multi-task neural network model, wherein the deep learning model is provided with a ground object classification branch and a shadow detection branch.
[0112] In one possible implementation, the acquisition module 201 is further specifically used for:
[0113] Acquire a remote sensing image to be restored, and acquire meta information of the remote sensing image;
[0114] Dividing the remote sensing image into at least one first image based on a first preset size, and dividing each of the first images into a plurality of second images based on a second preset size and a preset overlap ratio;
[0115] After normalizing each of the second images based on the meta-information, processing each of the second images based on a multi-task neural network model to obtain each second ground object mask and second region mask;
[0116] For each of the first images, regional fusion is performed on each of the second object masks and the second region masks to obtain a first object mask and a first region mask.
[0117] In one possible implementation, the acquisition module 201 is further specifically used for:
[0118] Determine the non-overlapping area and the overlapping area in each of the second feature mask and the second area mask based on the preset overlapping rate;
[0119] For each of the second images, retaining a preset proportion area in the overlapping area close to the non-overlapping area;
[0120] Regional fusion is performed on each non-overlapping area and the area with a preset ratio to obtain a first feature mask and a first regional mask.
[0121] In one embodiment, the segmentation module 202 is specifically configured to:
[0122] For any ground object category, extract a binary mask of the ground object category from the first ground object mask, and obtain a third mask for the shadow area and a fourth mask for the non-shadow area based on multiplying the binary mask by the first area mask;
[0123] Perform superpixel segmentation on the mask area images corresponding to the third mask and the fourth mask to obtain a shadow superpixel mask and a non-shadow superpixel mask for each of the ground object categories, and determine the shadow superpixel area image corresponding to the shadow superpixel mask and the non-shadow superpixel area image corresponding to the non-shadow superpixel mask.
[0124] In one possible implementation, the search module 203 is specifically used for:
[0125] The centroids of the shadow superpixel region and each non-shadow superpixel region are calculated respectively, and a non-shadow superpixel region of the same type of ground object having the shortest distance to the centroid of the shadow superpixel region is determined in each non-shadow superpixel region.
[0126] In one possible implementation, the integration module 205 is further configured to:
[0127] Based on the edge feathering algorithm, the edge areas between the repaired images of each area and the images of the non-shadow superpixel area are feathered and fused.
[0128] Those skilled in the art can clearly understand that the technical solutions of the embodiments of the present application can be implemented with the help of software and / or hardware. The "unit" and "module" in this specification refer to software and / or hardware that can independently complete or cooperate with other components to complete specific functions, where the hardware can be, for example, a field programmable gate array (Field-Programmable Gate Array, FPGA), an integrated circuit (Integrated Circuit, IC), etc.
[0129] Each processing unit and / or module of the embodiments of the present application may be implemented by an analog circuit that implements the functions described in the embodiments of the present application, or may be implemented by software that executes the functions described in the embodiments of the present application.
[0130] See also Figure 3 , which shows a schematic diagram of the structure of an electronic device involved in an embodiment of the present application, the electronic device can be used to implement Figure 1 The method in the embodiment shown. Figure 3 As shown, the electronic device 300 may include: at least one processor 301 , at least one network interface 304 , a user interface 303 , a memory 305 , and at least one communication bus 302 .
[0131] The communication bus 302 is used to realize the connection and communication between these components.
[0132] The user interface 303 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 303 may also include a standard wired interface and a wireless interface.
[0133] The network interface 304 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0134] Among them, the processor 301 may include one or more processing cores. The processor 301 uses various interfaces and lines to connect various parts of the entire electronic device 300, and executes various functions and processes data of the electronic device 300 by running or executing instructions, programs, code sets or instruction sets stored in the memory 305, and calling data stored in the memory 305. Optionally, the processor 301 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 301 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics central processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 301, and it can be implemented separately through a chip.
[0135] Among them, the memory 305 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 305 includes a non-transitory computer-readable storage medium. The memory 305 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 305 may optionally be at least one storage device located away from the aforementioned processor 301. As Figure 3 As shown, the memory 305 as a computer storage medium may include an operating system, a network communication module, a user interface module, and program instructions.
[0136] exist Figure 3In the electronic device 300 shown, the user interface 303 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 301 can be used to call the shadow area repair application of the remote sensing image stored in the memory 305, and specifically perform the following operations:
[0137] Acquire a remote sensing image to be restored, process the remote sensing image based on a multi-task neural network model, obtain a first object mask and a first region mask, the first region mask includes a shadow region mask and a non-shadow region mask, the multi-task neural network model has an object classification branch and a shadow detection branch, the structure of the object classification branch is a standard semantic segmentation branch structure, and the structure of the shadow detection branch is a structure obtained by adding a self-attention module to the standard semantic segmentation branch structure;
[0138] Based on the object categories of the first object mask, the first region mask is respectively segmented into superpixels to obtain shadow superpixel masks and non-shadow superpixel masks of each object category;
[0139] For any shadow superpixel region of any of the above-mentioned ground object categories, searching for a non-shadow superpixel region of the same type of ground object that is the nearest neighbor to the shadow superpixel region, and forming a matching pair between the shadow superpixel region and the non-shadow superpixel region of the same type of ground object;
[0140] For any of the matching pairs, the shadow area statistics of the matching pair are mapped into non-shadow area statistics to obtain a regional restoration image corresponding to the shadow superpixel area;
[0141] After all the matching pairs are processed, the inpainted images of each region and the non-shadow superpixel region images are integrated to obtain the shadow inpainted image corresponding to the remote sensing image.
[0142] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of the above method are implemented. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a micro drive, and a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, a nanosystem (including a molecular memory IC), or any type of medium or device suitable for storing instructions and / or data.
[0143] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0144] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0145] In the several embodiments provided in the present application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the units, which is only a logical function division. There may be other division methods in actual implementation, such as 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 through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0146] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0147] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0148] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, 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. The computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM), random access memory (RAM), mobile hard disk, disk or optical disk and other media that can store program codes.
[0149] A person skilled in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by entering a program to instruct related hardware, and the program may be stored in a computer-readable memory, which may include a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0150] The above is only an exemplary embodiment of the present disclosure, and the scope of the present disclosure cannot be limited thereto. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the specification and practicing the disclosure here, those skilled in the art will easily think of the implementation scheme of the present disclosure. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the technical field not recorded in the present disclosure. The description and examples are regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.
Claims
1. A method for repairing shadow areas of remote sensing images, characterized in that: The method comprises: Acquire a remote sensing image to be restored, process the remote sensing image based on a multi-task neural network model, obtain a first object mask and a first region mask, the first region mask includes a shadow region mask and a non-shadow region mask, the multi-task neural network model has an object classification branch and a shadow detection branch, the structure of the object classification branch is a standard semantic segmentation branch structure, and the structure of the shadow detection branch is a structure obtained by adding a self-attention module to the standard semantic segmentation branch structure; Based on the object categories of the first object mask, the first region mask is respectively segmented into superpixels to obtain shadow superpixel masks and non-shadow superpixel masks of each object category; For any shadow superpixel region of any of the above-mentioned ground object categories, searching for a non-shadow superpixel region of the same type of ground object that is the nearest neighbor to the shadow superpixel region, and forming a matching pair between the shadow superpixel region and the non-shadow superpixel region of the same type of ground object; For any of the matching pairs, the shadow area statistics of the matching pair are mapped into non-shadow area statistics to obtain a regional restoration image corresponding to the shadow superpixel area; After all the matching pairs are processed, the inpainted images of each region and the non-shadow superpixel region images are integrated to obtain the shadow inpainted image corresponding to the remote sensing image; The step of acquiring the remote sensing image to be restored and processing the remote sensing image based on a multi-task neural network model to obtain a first object mask and a first region mask includes: Acquire a remote sensing image to be restored, and acquire meta information of the remote sensing image; Dividing the remote sensing image into at least one first image based on a first preset size, and dividing each of the first images into a plurality of second images based on a second preset size and a preset overlap ratio; After normalizing each of the second images based on the meta-information, processing each of the second images based on a multi-task neural network model to obtain each second ground object mask and second region mask; For each of the first images, regional fusion is performed on each of the second object masks and the second region masks to obtain a first object mask and a first region mask.
2. The method according to claim 1, characterized in that Before processing the remote sensing image based on the multi-task neural network model, the method further includes: Randomly extract each target image from a preset ground object image library, and perform ground object mask annotation and shadow area mask annotation on the target image; Segmenting the labeled target image to construct a sample set, wherein the sample set includes a training set and a test set; A deep learning model to be trained is constructed, and the deep learning model is trained based on the sample set to obtain a multi-task neural network model, wherein the deep learning model is provided with a ground object classification branch and a shadow detection branch.
3. The method according to claim 1, characterized in that The performing regional fusion on each of the second object masks and the second regional masks to obtain the first object mask and the first regional mask includes: Determine the non-overlapping area and the overlapping area in each of the second feature mask and the second area mask based on the preset overlapping rate; For each of the second images, retaining a preset proportion area in the overlapping area close to the non-overlapping area; Regional fusion is performed on each non-overlapping area and the area with a preset ratio to obtain a first feature mask and a first regional mask.
4. The method according to claim 1, characterized in that The first region mask is subjected to superpixel segmentation based on the ground object category of the first ground object mask to obtain a shadow superpixel mask and a non-shadow superpixel mask of each ground object category, including: For any ground object category, extract a binary mask of the ground object category from the first ground object mask, and obtain a third mask for the shadow area and a fourth mask for the non-shadow area based on multiplying the binary mask by the first area mask; Perform superpixel segmentation on the mask area images corresponding to the third mask and the fourth mask to obtain a shadow superpixel mask and a non-shadow superpixel mask for each of the ground object categories, and determine the shadow superpixel area image corresponding to the shadow superpixel mask and the non-shadow superpixel area image corresponding to the non-shadow superpixel mask.
5. The method according to claim 1, characterized in that The searching for a non-shadow superpixel region of the same type of ground object that is the nearest neighbor to the shadow superpixel region includes: The centroids of the shadow superpixel region and each non-shadow superpixel region are calculated respectively, and a non-shadow superpixel region of the same type of ground object having the shortest distance to the centroid of the shadow superpixel region is determined in each non-shadow superpixel region.
6. The method according to claim 1, characterized in that The method further comprises: Based on the edge feathering algorithm, the edge areas between the repaired images of each area and the images of the non-shadow superpixel area are feathered and fused.
7. A shadow area repair device for remote sensing images, characterized in that: The device comprises: An acquisition module is used to acquire a remote sensing image to be restored, and process the remote sensing image based on a multi-task neural network model to obtain a first object mask and a first region mask, wherein the first region mask includes a shadow region mask and a non-shadow region mask, and the multi-task neural network model has an object classification branch and a shadow detection branch, wherein the structure of the object classification branch is a standard semantic segmentation branch structure, and the structure of the shadow detection branch is a structure obtained by adding a self-attention module to the standard semantic segmentation branch structure; a segmentation module, configured to perform superpixel segmentation on the first region mask based on the object category of the first object mask, to obtain a shadow superpixel mask and a non-shadow superpixel mask of each object category; A search module is used to search for a non-shadow superpixel region of the same type of ground object that is the nearest neighbor of any shadow superpixel region of any of the ground object categories, and to form a matching pair between the shadow superpixel region and the non-shadow superpixel region of the same type of ground object; A mapping module, for mapping the shadow area statistics of any of the matching pairs into non-shadow area statistics, to obtain a regional restoration image corresponding to the shadow superpixel area; An integration module is used to integrate the inpainted images of each region and the non-shadow superpixel region images after all the matching pairs are processed, so as to obtain the shadow inpainted image corresponding to the remote sensing image; Wherein, the acquisition module is specifically used for: Acquire a remote sensing image to be restored, and acquire meta information of the remote sensing image; Dividing the remote sensing image into at least one first image based on a first preset size, and dividing each of the first images into a plurality of second images based on a second preset size and a preset overlap ratio; After normalizing each of the second images based on the meta-information, processing each of the second images based on a multi-task neural network model to obtain each second ground object mask and second region mask; For each of the first images, regional fusion is performed on each of the second object masks and the second region masks to obtain a first object mask and a first region mask.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, wherein the computer-readable storage medium has instructions stored therein, and when the instructions are executed on a computer or a processor, the computer or the processor executes the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
High-resolution remote sensing image thick cloud removing method based on step-by-step correction
CN110335208A
Superpixel-based remote sensing image terrain classification method, system and device and medium
CN111860208A
Remote sensing image cloud and shadow restoration method based on gated convolution
CN112288647A
Remote sensing image weak supervision building extraction method based on multi-scale CAM and superpixels
CN113505670A
SAR-assisted optical remote sensing image restoration method
CN116309150A
