Disclosure of Invention
The invention solves the technical problems in the prior art and provides an automatic acquisition method of a deep learning sample library corresponding to remote sensing image land type identification.
In order to solve the problems, the technical scheme of the invention is as follows:
an automatic acquisition method of a deep learning sample library corresponding to remote sensing image land type identification comprises the following steps,
the method comprises the steps of segmenting a remote sensing image into image spots by overlapping a current land utilization vector diagram and a remote sensing diagram and utilizing the image spot boundary information of vector data, extracting mark points from the image spots, filling the image spots with water, classifying and extracting the image spots, and arranging the image spots to obtain a large number of training sample libraries required by training of remote sensing image recognition deep neural networks corresponding to different land types.
Preferably, the method for automatically acquiring the deep learning sample library corresponding to the remote sensing image land type identification comprises the following steps,
step 1: edge mapping, namely superposing a current land use state vector diagram and a remote sensing diagram under the same coordinate system, and then mapping the boundary of the current land use state vector diagram into a closed edge consisting of continuous pixels in the remote sensing diagram;
step 2: extracting the mark points, and selecting the mark points inside the closed edge; and step 3: filling flooding water, namely performing flooding water filling through the mark points, and assigning values to the masks corresponding to each filling area and storing land information;
and 4, step 4: and (4) image classification extraction, namely extracting the segmented images according to the mask, and performing classification storage according to the land type information of the land utilization status stored by the mask to form a sample library.
Preferably, the acquisition time of the land use status vector diagram and the acquisition time of the remote sensing diagram in the step 1 are the same.
Preferably, the mapping of the boundary of the land use status vector diagram to the closed edge consisting of the continuous pixels in the remote sensing diagram is realized by a linear rasterization method (numerical differentiation method).
Preferably, the pixels on the closed edge are marked as edge pixels, and the edge pixels are set to have higher pixel values, so as to ensure that the edge pixels have larger gradient values.
Preferably, in step 2, the following formula is used to extract the marked points:
in the formula: h and l are respectively the row number and the column number of the pixel; g (h, l) is the gradient value of the pixel; t (h, l) is a threshold value corresponding to the pixel; when the value of m (h, l) is 1, a marked point is represented, and when the value of m (h, l) is 0, an unmarked point is represented.
The mark points are internal points in the image, and the gradient value is small; unmarked points are points at the edge and the vicinity of the edge in the image, and have larger gradient values; therefore, a certain threshold value can be set to distinguish the two according to the above formula.
Preferably, in the step 3, each closed region is correspondingly assigned with a mask, and all pixel values are set to 0, and each mask is used to record the classification hierarchy structure and the name of the corresponding closed region in the present land use situation in the form of a file path.
Preferably, in step 3, the obtained mark point is used as a seed point to perform flood filling on the area in each closed edge until all the pixels in the edge constraint are marked, because the constraint boundary has a higher pixel value and a larger gradient value, the whole constraint area is obtained after the flood filling.
Preferably, in the step 3, the mark point with the smallest gradient value is selected as the seed point.
Preferably, in step 3, in the filling process of the overflowing water, for the mask corresponding to each closed region, the mask pixel value corresponding to the marked image element is set to be 1, and the remaining mask pixel values are 0.
Preferably, in the step 4, the image of each closed region is extracted according to the obtained mask, and each image is saved according to the file path and the name recorded by the mask, so as to finally generate training sample libraries corresponding to different categories.
Compared with the prior art, the invention has the advantages that,
the invention provides an automatic acquisition method for automatically acquiring a land type identification sample library required for remote sensing image interpretation by superposing the current land utilization situation and a remote sensing image, which realizes the automatic collection of remote sensing image feature libraries corresponding to different land types by superposing and comparing the current land utilization situation data and the remote sensing data at the same time phase, and uses the information in the current land utilization situation for extracting the remote sensing image land sample, thereby solving the problem of insufficient machine learning training samples in the task of remote sensing image land classification identification; compared with the defects of large workload and difficult acquisition of sample regions in the traditional method for manually acquiring samples, the method for acquiring the samples is faster and more accurate, and the labor cost is obviously reduced.
Detailed Description
Example 1:
for a better understanding of the technical content of the present invention, specific embodiments are described below in conjunction with the appended drawings:
as shown in fig. 1, according to a preferred embodiment of the present invention, the method for automatically obtaining the deep learning sample library corresponding to the remote sensing image land type identification includes the following steps:
step 1: edge mapping, namely firstly, overlapping the current land use situation and a remote sensing image under the same coordinate system, and then mapping the boundary of a vector image of the current land use situation into a closed edge consisting of continuous pixels in the remote sensing image;
step 2: extracting the marking points, namely marking the points with smaller gradient values in the remote sensing image as the marking points by setting a threshold value;
and step 3: filling flooding water, namely performing flooding water filling through the mark points, and assigning values to the masks corresponding to each filling area and storing land information;
and 4, step 4: and (4) image classification extraction, namely extracting the segmented images according to the mask, and performing classification storage according to the land type information of the land utilization status stored by the mask to form a sample library.
In this embodiment, in step 1, the proposed method for superimposing the current land utilization situation and the remote sensing image first needs to uniformly convert the two data into the same coordinate system, so as to ensure that the current land utilization situation is completely matched with the remote sensing image, and ensure that incomplete or even wrong samples cannot be obtained, which causes the obtained samples to hardly help training the learner, and therefore, it is necessary to unify the two data into the same coordinate system.
In this embodiment, in step 1, the superposed and analyzed current land utilization state and the time for acquiring the remote sensing image are consistent, because the current land utilization state and the remote sensing image of different phases are updated later than the remote sensing image, and the changed land type information in the remote sensing image is not updated in the current land utilization state, which results in obtaining a wrong land sample subsequently, so that the current land utilization state and the remote sensing image which are actually the same are required to reduce errors caused by inconsistency between the current land utilization state and the remote sensing image.
Referring to fig. 2, in the foregoing step 1, the edge mapping maps the boundary of the area in the current land utilization vector diagram onto the remote sensing image to form a closed edge constraint, so that flood is limited inside the constrained area in the subsequent flood filling process, which is a key for implementing image segmentation under the vector diagram constraint. The method comprises the steps of mapping vector boundaries to a remote sensing image by superposing a current vector diagram and the remote sensing diagram on the land, then mapping the boundaries of the vector diagrams to closed edges consisting of continuous pixels by utilizing a linear rasterization algorithm in computer graphics, namely a numerical differentiation method, marking the pixels on the closed edges as the edge pixels and setting higher pixel values, for example, setting the pixel values to be maximum pixel (RGB) (255 x 255) so as to ensure that the pixels have larger gradient values, and forming a subsequent constraint area filled with the overflowing water.
Referring to fig. 2, in the step 2, after the edge mapping in the step 1, the image pixels are divided into 2 types of edge pixels and non-edge pixels. The markers are a set of spatially adjacent pixels of the non-edge pixels with smaller gradient values, corresponding to the interior regions of the image. The key of the extraction of the constraint area is the extraction of the mark point.
The marked points are internal points in the image, and the gradient value is smaller (as shown in figure 3); unmarked points are points at the edge and the vicinity of the edge in the image, and have larger gradient values; therefore, by setting a certain threshold T, the two can be distinguished according to the following formula.
In the formula: h and l are respectively the row number and the column number of the pixel; g (h, l) is the gradient value of the pixel; t (h, l) is a threshold corresponding to the pixel, and can be a global threshold irrelevant to the position or a local threshold relevant to the position. When the value of m (h, l) is 1, a marked point is represented, and when the value of m (h, l) is 0, an unmarked point is represented.
The threshold T is selected according to the actual image under the premise of ensuring that each constraint area has a mark point, and the method comprises the following steps:
1. first, the gradient value distribution of image elements, the minimum and maximum gradient values are calculated
Image gradient: g (x, y) ═ dx (i, j) + dy (i, j);
dx(i,j)=|(i+1,j)-|(i,j);
dy(i,j)=l(i,j+1)-l(i,j);
where l is the value of an image pixel (e.g., RGB value) and i, j is the coordinate of the pixel
2. The midpoint value of the maximum and minimum gradient values is chosen as T, and all points in the image where the gradient values are equal to or close (within 1 pixel value of error) to T are chosen,
3. searching a local minimum value point of the gradient value by using a point of which the gradient value is equal to or close to T as a starting point according to a gradient descent method,
4. judging whether a plurality of minimum value points belong to the same constraint area (no edge point exists between the two minimum values), and selecting the minimum gradient value as the seed point of the area.
Because the mark point will be used as the seed point of the following flood filling operation, but the mark point of each constraint area may be more than one due to the size of the threshold T, after the appropriate threshold T is set, if more than one mark point of a certain constraint area is used, the seed point with the smallest gradient value is selected.
In the step 3, after the marking is completed, it is first required to correspondingly allocate a mask to each closed region, and set all pixel values to 0, and record the classification hierarchy structure and the name of the land class to which the corresponding closed region belongs in the present land use situation in the form of a file path by using each mask. Such as: corresponding land type information in the land use current situation graph, the first-level classification is as follows: residential land, the second class classification is: in the rural homestead, the mask recording path information is as follows: "G: \ residential land \ rural homestead ", name: "rural homestead 001. jpg".
Referring to fig. 4, in the foregoing step 3, the obtained mark point is used as a seed point to perform flood filling on the area in each closed edge until all the pixels in the edge constraint are marked, because the constraint boundary has a higher pixel value and a larger gradient value, the whole constraint area is obtained after the flood filling.
Referring to fig. 5, in step 3, in the filling process of the overflowing water, for the mask corresponding to each closed region, the mask pixel value corresponding to the marked pixel is set to 1, and the remaining mask pixel values are still 0. Firstly, the mask pixel value of the seed point is 1, the pixels marked with 1 mask extend to the edge along with the process of filling the flood until all the mask pixel values of the constraint area are 1, and therefore, the mask can be used for extracting the complete image in the constraint area in the next step.
In the step 4, the image of each closed region is extracted according to the mask obtained in the previous step, and the region with the mask pixel value of 1 is the region of the image to be extracted (as shown in fig. 5), so that a complete image of each region is obtained, then each image is stored according to the file path and the name recorded by the mask in the step 3, and finally, training sample libraries corresponding to different categories are generated. Such as: the mask recording path information is: g, land for residence, rural homestead, name: and if a plurality of images of the same type exist, the images are sequentially ordered and named according to the storage sequence after the naming: the 'rural homestead 002. jpg' and 'rural homestead 003. jpg' … form a sample library finally.
It should be noted that the above-mentioned embodiments are only preferred embodiments of the present invention, and are not intended to limit the scope of the present invention, and all equivalent substitutions or substitutions made on the above-mentioned embodiments are included in the scope of the present invention.