Disclosure of Invention
The invention provides a remote sensing image classification method and a remote sensing image classification device, which are used for solving the defect that an object-oriented image classification method and an image classification method based on deep learning in the prior art cannot be fully combined and applied, and realizing effective combination of the object-oriented image classification method and the image classification method based on deep learning.
The invention provides a remote sensing image classification method, which comprises the following steps:
acquiring an image object to be classified;
inputting the image object to be classified into a classification model to obtain a classification result output by the classification model;
the classification model is obtained by training based on the object features and the depth features of the sample image objects and the class labels of the sample image objects.
According to the remote sensing image classification method provided by the invention, the classification model is obtained based on object features and depth features of sample image objects and class label training of the sample image objects, and specifically comprises the following steps:
acquiring the sample image object;
extracting object features of the sample image object;
extracting depth features of the sample image object;
superposing the object features and the depth features to obtain comprehensive features of the sample image object;
and training to obtain the classification model through the comprehensive characteristics of the sample image object and the class label of the sample image object.
According to the remote sensing image classification method provided by the invention, the extracting of the depth feature of the sample image object specifically comprises the following steps:
dividing grids on the sample image object by an image grid expression method to obtain a grid image set, wherein the grid image set comprises a plurality of sub-grid images with consistent grid sizes;
respectively carrying out depth feature extraction on each sub-grid image to obtain corresponding sub-depth features, wherein the sub-depth features are obtained by inputting the sub-grid images into a depth convolution neural network model;
and aggregating the sub-depth features by a depth feature aggregation method to obtain the depth features of the sample image object.
According to the remote sensing image classification method provided by the invention, the image grid expression method is used for dividing grids on the sample image object to obtain a grid image set, wherein the grid image set comprises a plurality of sub-grid images with consistent grid sizes, and the method specifically comprises the following steps:
determining a unit moving grid size, wherein the unit moving grid size is consistent with a sub-grid image size;
determining an initial grid of sample image objects;
taking the initial grid as a center, taking the size of a unit moving grid as a moving unit to move, and when the unit moving grid contains pixels of a sample image object, determining an image of the position of the unit moving grid as the sub-grid image;
determining the weight of each sub-grid image.
According to the remote sensing image classification method provided by the invention, the determining of the initial grid of the sample image object specifically comprises the following steps:
determining the center of gravity of a sample image object;
and taking the unit moving grid with the gravity center as the initial grid.
According to the remote sensing image classification method provided by the invention, the depth features of the sample image object are obtained by aggregating the sub-depth features through a depth feature aggregation method, and the method specifically comprises the following steps: and aggregating to form the depth features of the sample image object according to the weight of each sub-grid image and the corresponding sub-depth features.
According to the remote sensing image classification method provided by the invention, the sub-depth features are obtained by inputting the sub-grid images into a depth convolution neural network model, and the method specifically comprises the following steps: and inputting the sub-grid image into a depth convolution neural network model, and taking the last convolution layer of the depth convolution neural network model as the sub-depth feature and outputting the sub-depth feature.
The invention also provides a remote sensing image classification device, comprising:
the image object acquisition unit is used for acquiring an image object to be classified;
the image object classification unit is used for inputting the image object to be classified into a classification model to obtain a classification result output by the classification model;
the classification model is obtained by training based on the object features and the depth features of the sample image objects and the class labels of the sample image objects.
The invention also provides an electronic device, which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor executes the program to realize the steps of any one of the remote sensing image classification methods.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of any of the remote sensing image classification methods described above.
According to the remote sensing image classification method and device provided by the invention, model training is carried out by combining an object-oriented image classification method for extracting object features and a deep learning image classification method for extracting depth features better through a classification model trained on the basis of the object features of the characterization image shape, the space and other features of a sample image object and the deep learning depth features, so that the classification result of the image object to be classified can be better obtained, the rapid and accurate classification of the remote sensing image is realized, and the method and device can be applied to land coverage/utilization mapping based on the remote sensing image.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Remote sensing image classification essentially needs to solve four problems: what are the classification units? What are the classification samples? How are classification features extracted? How is the classification model selected? In the actual classification process, the samples are generally determined. Therefore, for different remote sensing image classification methods, different places are classification units, feature extraction and classification models.
The main differences of object-oriented image classification methods compared to pixel-based image analysis methods are classification units and feature extraction. When the image spatial resolution is high, a feature is often composed of a plurality of pixels, and at this time, heterogeneity often exists inside the feature, and the image classification method based on the pixels cannot completely classify the feature. Therefore, before classification, it is necessary to group adjacent and similar pixels in an image into an image object, which is called image segmentation. In addition, the object-oriented image classification method can extract features such as shapes and spatial relationships of image objects for image classification, and the features cannot be extracted on the basis of pixels, so that the object-oriented image classification method is more advantageous than the pixel-based image classification method in classifying high-resolution remote sensing images.
The image classification method based on deep learning is mainly different from the two methods in feature extraction, the image classification method based on pixel and the image classification method facing to the object both need to define some features manually, then the features are used for image classification, and the image classification method based on deep learning automatically learns effective classification features under the guidance of a sample. Compared with the artificial definition of the features, the classification features automatically learned under the guidance of the samples can represent the implicit information of the original data, and classification of the remote sensing images is facilitated.
In conclusion, the object-oriented image classification method and the deep learning-based image classification method are more suitable for high-resolution remote sensing image classification. Because the object-oriented image analysis method uses insufficient feature expression capability caused by manually defined features and the image analysis method based on deep learning cannot effectively model geographic objects caused by pixel-based classification, the two image classification methods are combined to realize quick and accurate classification of remote sensing images and can be applied to land coverage/utilization mapping based on the remote sensing images.
As shown in fig. 1, the present invention provides a remote sensing image classification method combining an object-oriented image classification method and a deep learning-based remote sensing image classification method, including:
step 110: acquiring an image object to be classified;
in the embodiment of the invention, the remote sensing image which is subjected to land covering/utilization classification in advance is subjected to image segmentation to obtain the image object to be classified. Preferably, multi-resolution segmentation is adopted when the remote sensing image is segmented, namely, different remote sensing image areas are segmented by adopting different resolutions according to actual needs.
Step 120: inputting the image object to be classified into a classification model to obtain a classification result output by the classification model;
the classification model is obtained by training based on the object features and the depth features of the sample image objects and the class labels of the sample image objects.
In this step, each image object to be classified obtained by segmenting the remote sensing image is respectively input into the trained classification model, and corresponding classification results are respectively output.
In the embodiment of the present invention, as shown in fig. 2, the training process of the classification model specifically includes:
step 210: acquiring the sample image object;
step 220: extracting object features of the sample image object;
the step is to extract object characteristics such as spectrum, geometry, texture and the like of the obtained image by an image analysis oriented method.
Step 230: extracting depth features of the sample image object;
step 240: superposing the object features and the depth features to obtain comprehensive features of the sample image object;
step 250: and training to obtain the classification model through the comprehensive characteristics of the sample image object and the class label of the sample image object.
In the embodiment of the invention, the object characteristics of the sample image object are extracted by an object-oriented image classification method, the depth characteristics of the sample image object are extracted based on a depth learning method, a classification model is trained based on the fused depth characteristics and object characteristics, for example, the classification model adopts a random forest model, and the classification of each image object is identified by the trained classification model, so that a land cover/utilization thematic map is obtained.
In the embodiment of the present invention, as shown in fig. 3, step 230 specifically includes:
step 310: dividing grids on the sample image object by an image grid expression method to obtain a grid image set, wherein the grid image set comprises a plurality of sub-grid images with consistent grid sizes; fig. 4 is a schematic diagram illustrating a sample image object as a grid image set. This step is the mesh representation of the sample image object.
Step 320: respectively carrying out depth feature extraction on each sub-grid image to obtain corresponding sub-depth features, wherein the sub-depth features are obtained by inputting the sub-grid images into a depth convolution neural network model;
as shown in fig. 5, the deep convolutional neural network model is generally composed of convolutional layers, pooling layers, and fully-connected layers. The sample image objects with the class labels can be used for training a deep convolutional neural network model after grid expression.
The sub-grid images are input into a trained deep convolutional neural network model, and the sub-depth features of the sub-grid images can be extracted by selecting the last convolutional layer as the depth features.
Step 330: and aggregating the sub-depth features by a depth feature aggregation method to obtain the depth features of the sample image object.
Fig. 6 is a schematic diagram of a depth feature aggregation process.
In the embodiment of the present invention, since the sample image object is irregular and has multiple deformations, and the input of the depth convolutional neural network model used in step 230 is generally a regular image block in order to obtain the depth features of the image object, the main purpose of the mesh expression of the sample image object is to solve the gap between the irregular shape of the sample image object and the regular image block required by the input of the depth convolutional neural network model. The size of the mesh of each sub-mesh image in the set of mesh images obtained in step 310 thus corresponds to the size of the input image required by the deep convolutional neural network model.
In the embodiment of the present invention, as shown in fig. 7, step 310 specifically includes:
step 710: determining a unit moving grid size, wherein the unit moving grid size is consistent with a sub-grid image size;
step 720: determining an initial grid of sample image objects;
specifically, as shown in the figure, step 720 specifically includes:
step 810: determining the center of gravity of a sample image object;
step 820: and taking the unit moving grid with the gravity center as the initial grid.
Specifically, the initial grid determining process is as follows: let the boundary of the sample image object be composed of n points, and the coordinate sequence thereof be { (x)
1,y
1),(x
2,y
2),…,(x
n,y
n),(x
n+1,y
n+1) Therein ofx
1=x
n+1And y is
1=y
n+1Then the center of gravity of the sample image object
The angle θ between the principal direction of the sample image object and the x-axis can be calculated by the following formula:
wherein Q isxRepresenting the moment, Q, of the image object about the x-axisyRepresenting the moment of the image object about the y-axis, IxxRepresenting the moment of inertia of the image object about the x-axis, IyyRepresenting the moment of inertia of the image object about the y-axis, IxyThe product of inertia of the image object is represented, and a represents the area of the image object.
A local coordinate system can be established by taking the gravity center of the sample image object as a coordinate origin and the main direction of the sample image object as an x-axis, a straight line with x equal to 0 is taken, the straight line has a plurality of intersection points with the boundary of the sample image object, and the vertical coordinate value is { y'
1,y′
2,…y′
nGet the mean value of two adjacent ordinate values
If point
Within the sample image object, a mesh of size sxs (i.e., the unit motion mesh has a size sxs) is created at the point center, which serves as an initial mesh expressed by the sample image object mesh.
Step 730: taking the initial grid as a center, taking the size of a unit moving grid as a moving unit to move, and when the unit moving grid contains pixels of a sample image object, determining an image of the position of the unit moving grid as the sub-grid image;
and searching other grids around the initial grid as the center, and adding the grid into a grid image set of the sample image object if the grid contains the pixels of the sample image object.
Step 740: determining the weight of each sub-grid image.
In this step, the weight of the sub-grid image is the number of pixels belonging to the sample image object in the grid divided by the total number of pixels of the sample image object.
In the embodiment of the present invention, in combination with step 330 and step 740, the process of performing the aggregation on the sub-depth features specifically includes: the shape of the sub-depth feature extracted from each sub-grid image is s × s × m, where s is the length and width of the sub-depth feature, and m is the dimension of the sub-depth feature. The depth features of each sub-grid image can be aggregated into an m-dimensional feature vector by aggregating an aggregation operator on the length and width of the sub-depth features, wherein the aggregation operator can be a mean value, a maximum value and the like. And finally, weighting and summing the feature vectors of all the sub-grid images of the sample image object to obtain the depth feature of the sample image object.
The remote sensing image classification device provided in the embodiment of the present invention is described below, and the remote sensing image classification device described below and the remote sensing image classification method described above may be referred to in correspondence with each other, as shown in fig. 9, and an embodiment of the present invention provides a remote sensing image classification device including:
an image object obtaining unit 910, configured to obtain an image object to be classified;
in the embodiment of the invention, the remote sensing image which is subjected to land covering/utilization classification in advance is subjected to image segmentation to obtain the image object to be classified. Preferably, multi-resolution segmentation is adopted when the remote sensing image is segmented, namely, different remote sensing image areas are segmented by adopting different resolutions according to actual needs.
The image object classification unit 920 is configured to input the image object to be classified into a classification model, so as to obtain a classification result output by the classification model;
the classification model is obtained by training based on the object features and the depth features of the sample image objects and the class labels of the sample image objects.
In the embodiment of the invention, each image object to be classified obtained by segmenting the remote sensing image is respectively input into the trained classification model, and the corresponding classification results are respectively output.
In the embodiment of the present invention, the image object classifying unit 920 includes a classification model training subunit, and the classification model training subunit specifically includes:
the sample acquisition subunit is used for acquiring a sample image object;
an object feature extraction subunit, configured to extract an object feature of the sample image object;
the object feature extraction subunit extracts object features such as spectrum, geometry, texture and the like of the obtained image by a face-to-face image analysis method.
A depth feature extraction subunit, configured to extract a depth feature of the sample image object;
the characteristic synthesis subunit is used for superposing the object characteristics and the depth characteristics to obtain the synthesis characteristics of the sample image object;
and the training subunit is used for training to obtain the classification model through the comprehensive characteristics of the sample image object and the class label of the sample image object.
In the embodiment of the invention, the object characteristics of the sample image object are extracted by an object-oriented image analysis method, the depth characteristics of the sample image object are extracted based on a depth learning method, a classification model is trained based on the depth characteristics and the object characteristics which are fused, for example, the classification model adopts a random forest model, and the classification of each image object is identified by the trained classification model, so that a land cover/utilization thematic map is obtained.
Wherein, the depth feature extraction subunit specifically includes:
and a mesh dividing subunit, configured to divide a mesh on the sample image object by using an image mesh expression method to obtain a mesh image set, where the mesh image set includes a plurality of sub-mesh images with the same mesh size.
The sub-depth feature extraction subunit is used for respectively carrying out depth feature extraction on each sub-grid image to obtain corresponding sub-depth features, wherein the sub-depth features are obtained by inputting the sub-grid images into a depth convolution neural network model; the sub-grid images are input into a trained deep convolutional neural network model, and the sub-depth features of the sub-grid images can be extracted by selecting the last convolutional layer as the depth features.
And the self-depth feature aggregation subunit is used for aggregating the sub-depth features by a depth feature aggregation method to obtain the depth features of the sample image object.
In the embodiment of the present invention, because the sample image object has multiple irregular deformations, and in the embodiment of the present invention, in order to obtain the depth features of the image object, the input of the adopted depth convolution neural network model is generally a regular image block, so the main purpose of the mesh expression of the sample image object is to solve the gap between the irregular shape of the sample image object and the regular image block required to be input by the input of the depth convolution neural network model. Therefore, the size of the grid of each sub-grid image in the grid image set obtained by the grid dividing and dividing unit is consistent with the size of the input image required by the deep convolutional neural network model.
Wherein, the grid planning molecule unit specifically includes:
a unit moving grid size determining subunit, configured to determine a unit moving grid size, where the unit moving grid size is consistent with a sub-grid image size;
an initial mesh determining subunit of the sample image object, configured to determine an initial mesh of the sample image object;
specifically, the determining the initial grid subunit of the sample image object specifically includes:
the sample image object gravity center determining subunit is used for determining the gravity center of the sample image object;
an initial grid determining subunit, configured to use a unit moving grid with the center of gravity as the initial grid.
A grid searching subunit, configured to use the initial grid as a center, use the unit moving grid size as a moving unit, and determine, when a unit moving grid includes pixels of a sample image object, an image at the unit moving grid position as the sub-grid image;
and searching other grids around the initial grid as the center, and adding the grid into a grid image set of the sample image object if the grid contains the pixels of the sample image object.
And the sub-grid image weight determining subunit is used for determining the sub-grid image weight.
In an embodiment of the present invention, the weight of the sub-grid image is the number of pixels belonging to the sample image object in the grid divided by the total number of pixels of the sample image object.
An entity structure schematic diagram of an electronic device provided in an embodiment of the present invention is described below with reference to fig. 10, and as shown in fig. 10, the electronic device may include: a processor (processor)1010, a communication Interface (Communications Interface)1020, a memory (memory)1030, and a communication bus 1040, wherein the processor 1010, the communication Interface 1020, and the memory 1030 communicate with each other via the communication bus 1040. Processor 1010 may invoke logic instructions in memory 1030 to perform a method of remote sensing image classification, the method comprising: acquiring an image object to be classified; inputting the image object to be classified into a classification model to obtain a classification result output by the classification model; the classification model is obtained by training based on the object features and the depth features of the sample image objects and the class labels of the sample image objects.
Furthermore, the logic instructions in the memory 1030 can be implemented in software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solutions of the embodiments of the present invention may be essentially implemented or make a contribution to the prior art, or may be implemented in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the methods described in the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, an embodiment of the present invention further provides a computer program product, where the computer program product includes a computer program stored on a non-transitory computer-readable storage medium, the computer program includes program instructions, and when the program instructions are executed by a computer, the computer is capable of executing the remote sensing image classification method provided by the above methods, where the method includes: acquiring an image object to be classified; inputting the image object to be classified into a classification model to obtain a classification result output by the classification model; the classification model is obtained by training based on the object features and the depth features of the sample image objects and the class labels of the sample image objects.
In another aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program is implemented to, when executed by a processor, perform the foregoing remote sensing image classification method: acquiring an image object to be classified; inputting the image object to be classified into a classification model to obtain a classification result output by the classification model; the classification model is obtained by training based on the object features and the depth features of the sample image objects and the class labels of the sample image objects.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.