A method, device and system for sample selection of remote sensing images
By segmenting the hyperspectral image and label image into square windows with equal sizes and non-overlapping, and randomly sorting the training set and test sets according to the number of category pixels, and training a full convolutional network with data augmentation method, the problem of overlapping test data in remote sensing image training is solved, and sampling equality and performance evaluation accuracy are improved.
Patent Information
- Application Number
- CN202211065425.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-01
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2042-09-01
AI Technical Summary
In the prior art, the training and testing data of remote sensing images overlap each other, resulting in a leakage of training-test information, affecting classification accuracy and feature learning.
By segmenting the hyperspectral image and the label image into square windows of equal size and non-overlapping, it is sorted according to the number of category pixels, and randomly divided into training sets and test sets, and the full convolutional network is trained through data augmentation method.
It improves the sampling balance of remote sensing images, avoids overlap between training data and test data, and provides objective and accurate performance evaluation support.
Smart Images

Figure CN115409810B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of sample selection for remote sensing images, and particularly to a method, device, computer-readable storage medium, and system for sample selection of remote sensing images. Background Art
[0002] Hyperspectral remote sensing can not only obtain the geometric shape information of the observed ground objects in the spatial dimension, but also obtain the continuous spectral curves reflecting the true physical and chemical characteristics of the ground objects. These characteristics make hyperspectral remote sensing widely used in fields such as resource environment investigation and national defense security. Hyperspectral image classification is an important basis for these applications.
[0003] In recent years, the rapid development of deep learning has provided new solutions for hyperspectral image classification and has become the mainstream method in this field. Compared with other deep learning algorithms, the characteristics of local connection and weight sharing of convolutional neural network (CNN) enable it to extract deep spectral and spatial features of images with a relatively small number of parameters and computational complexity. Existing CNN-based hyperspectral image classification methods mainly include: patch-based CNN and fully convolutional network (FCN)-based methods. Due to the lack of labeled data for hyperspectral images, in order to facilitate spatial feature extraction and classifier training, early research mainly adopted patch-based classification methods. This method first generates patches centered on sampled pixels, and then inputs the patches into the network to extract features and predict the classes of the sampled pixels. Since adjacent patches overlap with each other, redundant calculations are inevitable. To reduce the computational complexity, many FCN-based methods have been proposed. This method can input the original data into the network and then perform semantic segmentation in a pixel-to-pixel manner. Compared with patch-based CNN, this method usually produces better results with higher efficiency.
[0004] However, the existing technology still has the following defects: most of them adopt a random sampling strategy, in which training and test samples are randomly selected on the same image, resulting in the overlap of training and test data. Subsequently, during the training stage, some information from the test data is also integrated to train the network, resulting in an overestimated classification accuracy in evaluation. Training-test information leakage not only overestimates the performance of spatial feature-based classification methods, but also may distort the boundaries of objects. Therefore, the pixel-based random sampling strategy will wrongly affect the feature learning and performance evaluation of spatial feature extraction methods.
[0005] Therefore, there is a current need for a method, device, computer-readable storage medium, and system for sample selection of remote sensing images to overcome the above-mentioned defects existing in the prior art. Summary of the Invention
[0006] An embodiment of the present invention provides a method, an apparatus, a computer-readable storage medium, and a system for sample selection of remote sensing images, which improves the sampling balance of remote sensing images and avoids potential overlap between training data and test data, thereby providing data support for subsequent objective and accurate performance evaluation.
[0007] An embodiment of the present invention provides a method for sample selection of remote sensing images. The sample selection method includes: obtaining a hyperspectral image to be sample-selected and a corresponding label image, segmenting the hyperspectral image and the label image according to a preset segmentation method to obtain a plurality of square windows; each square window includes one or more pixels with class labels, and each class label corresponds to a class; according to a preset partitioning method, the square windows, and the classes, collect each class in turn to correspondingly obtain square window groups, and randomly divide the square windows in each square window group into a training set or a test set; through a preset data augmentation method, perform data augmentation on the training set to obtain an augmented training set, train a preset fully convolutional network with the augmented training set to obtain a segmentation network, and evaluate the segmentation network with the test set to obtain an evaluation result.
[0008] As an improvement of the above solution, according to a preset partitioning method, the square windows, and the classes, collect each class in turn to correspondingly obtain square window groups, and randomly divide the square windows in each square window group into a training set or a test set, which specifically includes: obtaining the number of pixels corresponding to each class, and sorting all classes according to the number of pixels and a preset sorting method to obtain a collection order; according to the collection order, collect each class in turn to correspondingly obtain square window groups; each square window group includes a plurality of square windows; according to a preset ratio partitioning method, divide each square window group into training windows and test windows respectively, and obtain a training set and a test set according to the training windows and the test windows.
[0009] As an improvement of the above solution, sorting all classes according to the number of pixels and a preset sorting method to obtain a collection order specifically includes: sorting all classes according to the number of pixels and in ascending order to obtain a collection order.
[0010] As an improvement to the above solution, according to a preset ratio division method, each group of square windows is divided into training windows and test windows respectively, and a training set and a test set are obtained corresponding to the training windows and the test windows. Specifically, it includes: obtaining the number of windows of the square windows in the group of square windows, determining a first ratio according to a preset ratio determination method and the number of windows; randomly selecting square windows with a first ratio number from the group of square windows as training windows, taking the square windows other than the training windows as test windows, taking all the training windows as the training set, and taking all the test windows as the test set.
[0011] As an improvement to the above solution, according to a preset segmentation method, the hyperspectral image group and the label image group are segmented to obtain a number of square windows. Specifically, it includes: using a preset fishing net segmentation method to segment the hyperspectral image and the corresponding label image into a number of square windows of equal size and non-overlapping; the square windows include one or more pixels with class labels; the label image includes a number of classes labeled with class labels; the hyperspectral image and the label image correspond.
[0012] As an improvement to the above solution, through a preset data augmentation method, the training set is augmented to obtain an augmented training set. Specifically, it includes: rotating each training window in the training set at a preset rotation angle to obtain a first training window; horizontally flipping each training window in the training set to obtain a second training window; vertically flipping each training window in the training set to obtain a third training window; adding noise or changing the brightness to each training window in the training set to obtain a fourth training window; outputting the first training window, the second training window, the third training window, the fourth training window and the training window as the augmented training set.
[0013] As an improvement to the above solution, the augmented training set is used to train a preset fully convolutional network to obtain a segmentation network. Specifically, it includes: performing pixel-to-pixel classification on the augmented training set according to the preset fully convolutional network to obtain a classification result; calculating a loss function and performing error backpropagation according to the classes of the pixels in each square window in the augmented training set and the corresponding classification result to obtain a first fully convolutional network; repeating the above steps until the first fully convolutional network converges, and outputting the first fully convolutional network as the segmentation network.
[0014] Another embodiment of the present invention correspondingly provides a sample selection device for remote sensing images. The sample selection device includes a segmentation and acquisition unit, a window division unit, and a training and output unit. Among them, the segmentation and acquisition unit is used to obtain a hyperspectral image to be selected for samples and a corresponding label image, and segment the hyperspectral image and the label image according to a preset segmentation method to obtain a number of square windows; each square window includes one or more pixels with class labels, and each class label corresponds to a class; the window division unit is used to collect each class in turn according to a preset division method, the square window, and the class to correspondingly obtain a group of square windows, and randomly divide the square windows in each group of square windows into a training set or a test set; the training and output unit is used to perform data augmentation on the training set through a preset data augmentation method to obtain an augmented training set, train a preset fully convolutional network with the augmented training set to obtain a segmentation network, and evaluate the segmentation network with the test set to obtain an evaluation result.
[0015] As an improvement of the above solution, the window division unit is further used to: obtain the number of pixels corresponding to each class, and sort all classes according to the number of pixels and a preset sorting method to obtain a collection order; collect each class in turn according to the collection order to correspondingly obtain a group of square windows; the group of square windows includes a number of square windows; according to a preset ratio division method, divide each group of square windows into training windows and test windows respectively, and obtain a training set and a test set according to the training windows and the test windows.
[0016] As an improvement of the above solution, the window division unit is further used to: sort all classes according to the number of pixels and the order from small to large to obtain a collection order.
[0017] As an improvement of the above solution, the window division unit is further used to: obtain the number of windows of the square windows in the group of square windows, determine a first ratio according to a preset ratio determination method and the number of windows; randomly select a number of square windows equal to the first ratio from the group of square windows as training windows, use the square windows other than the training windows as test windows, use all training windows as the training set, and use all test windows as the test set.
[0018] As an improvement of the above solution, the segmentation and acquisition unit is further used to: segment the hyperspectral image and the corresponding label image into a number of square windows with equal size and non-overlapping using a preset fishing net segmentation method; the square window includes one or more pixels with class labels; the label image includes a number of classes labeled with class labels; the hyperspectral image and the label image correspond.
[0019] As an improvement to the above solution, the training output unit is further configured to: rotate each training window in the training set at a preset rotation angle to obtain a first training window; horizontally flip each training window in the training set to obtain a second training window; vertically flip each training window in the training set to obtain a third training window; add noise or change the brightness of each training window in the training set to obtain a fourth training window; and output the first training window, the second training window, the third training window, the fourth training window, and the training window as an enhanced training set.
[0020] As an improvement to the above solution, the training output unit is further configured to: perform pixel-to-pixel classification on the enhanced training set according to a preset fully convolutional network to obtain a classification result; calculate a loss function based on the categories of pixels in each square window in the enhanced training set and the corresponding classification results, and perform error backpropagation to obtain a first fully convolutional network; repeat the above steps until the first fully convolutional network converges, and output the first fully convolutional network as a segmentation network.
[0021] Another embodiment of the present invention provides a computer-readable storage medium, which includes a stored computer program. When the computer program runs, it controls the device where the computer-readable storage medium is located to execute the method for selecting samples of remote sensing images as described above.
[0022] Another embodiment of the present invention provides a system for selecting samples of remote sensing images. The sample selection system includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the method for selecting samples of remote sensing images as described above.
[0023] Compared with the prior art, the present technical solution has the following beneficial effects:
[0024] The present invention provides a method, apparatus, computer-readable storage medium, and system for sample selection of remote sensing images. According to a segmentation method, a hyperspectral image and a corresponding label image are segmented into a number of square windows of equal size and non-overlapping; then, sorting is performed according to the number of pixels corresponding to each category from smallest to largest to obtain a collection order; according to this collection order, windows containing the first sorted category are collected first, and a predetermined proportion of windows are randomly selected for training, and the rest are used for testing; then, the corresponding positions of the hyperspectral image and the corresponding label image containing such windows are set to zero, and are used to collect windows containing the second sorted category, and this process is repeated until all categories have completed this operation; data augmentation is performed on the training set by a preset data augmentation method, and the preset fully convolutional network is trained with the augmented training set. The trained network is used to predict the test set and perform accuracy evaluation. This sample selection method, apparatus, computer-readable storage medium, and system improve the sampling balance of remote sensing images, avoid potential overlap between training data and test data, and thus provide data support for subsequent objective and accurate performance evaluation. Description of the Drawings
[0025] Figure 1 is a flowchart of a method for sample selection of remote sensing images provided by an embodiment of the present invention;
[0026] Figure 2 is a structural diagram of an apparatus for sample selection of remote sensing images provided by an embodiment of the present invention. Detailed Embodiments
[0027] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention. Specific Embodiment 1
[0029] The embodiment of the present invention first describes a method for sample selection of remote sensing images. The sample selection model output by the method provided in the embodiment of the present invention is applicable not only to hyperspectral data, but also to other data, especially data with class imbalance. Figure 1 is a flowchart of a method for sample selection of remote sensing images provided by an embodiment of the present invention.
[0030] For the design of a reasonable sample selection method, the method provided by the embodiments of the present invention follows several basic principles during design: 1. Abide by the independent assumption that any area contributing to the extraction of training data features cannot be used for testing; 2. Abide by the assumption of the same distribution. To achieve an unbiased estimate of the generalization error, the test data and the actual application data should be of the same distribution; 3. Balance sampling to avoid certain categories that do not exist in the training set or the test set; 4. Random sampling because we do not know which samples are more representative; 5. Make full use of the existing data and avoid directly discarding the data with class labels. As Figure 1 shown, the sample selection method includes:
[0031] S1: Obtain the hyperspectral image to be selected for samples and the corresponding label image, and according to a preset segmentation method, segment the hyperspectral image and the label image to obtain a number of square windows.
[0032] In the actual implementation process, since many space feature-based methods require square blocks as input, it is necessary to divide the hyperspectral image and its corresponding label image into square windows of equal size. Since the length and width of the image may not be exactly divisible by the window size, and some methods in the prior art directly discard the edges that cannot form square windows, failing to make full use of the data; in one embodiment, before this step, the lower side and the right side of the hyperspectral image and the corresponding label image can also be mirrored to make their length and width divisible by the window size, so as to make full use of the edge data. For example: the width of the image is 11, the length is 13, and the window size is 3. To make the length and width of the image divisible by the window size, it is necessary to mirror 1 pixel outward on the right side of the image to make the width 12; mirror 2 pixels outward on the lower side of the image to make the length 15.
[0033] For the window size, it should be ensured that at least two windows contain the labeled pixels of each category, and a trade-off should be made between the window size and the number of windows to meet the balanced sampling (because the smaller the window, the more the number of windows; the larger the window, the fewer the number of windows; if the window is too small, it will limit the classification method to extract spatial features and limit the performance of methods with strong spatial feature extraction capabilities; if the window is too large, some categories will only exist in one square window, resulting in no training window or no test window for this category). To make full use of the existing data, first mirror the pixels on the right side and the lower boundary outward to create corresponding windows for the original boundary pixels; then, use the fishing net segmentation method to segment the hyperspectral image and its label image into square windows of equal size and non-overlapping.
[0034] In one embodiment, the hyperspectral image and the corresponding label image are segmented into a number of square windows of equal size and non-overlapping using a preset fishing net segmentation method. The square window includes one or more pixels with class labels; the label image includes a number of classes labeled with class labels; the hyperspectral image and the label image correspond to each other.
[0035] S2: According to the preset partitioning method, the square window, and the class, collect each class in turn to correspondingly obtain a group of square windows, and randomly divide the square windows in each group of square windows into a training set or a test set.
[0036] In one embodiment, according to the preset partitioning method, the square window, and the class, collect each class in turn to correspondingly obtain a group of square windows, and randomly divide the square windows in each group of square windows into a training set or a test set, which specifically includes: obtaining the number of pixels corresponding to each class, and sorting all classes according to the number of pixels and the preset sorting method to obtain a collection order; sampling each class in turn according to the collection order to correspondingly obtain a group of square windows; the group of square windows includes a number of square windows; according to the preset ratio partitioning method, randomly divide each group of square windows into training windows and test windows respectively, and obtain a training set and a test set according to the training windows and the test windows.
[0037] In one embodiment, sorting all classes according to the number of pixels and the preset sorting method to obtain a collection order specifically includes: sorting all classes according to the number of pixels and in ascending order to obtain a collection order.
[0038] As an improvement to the above solution, randomly dividing each group of square windows into training windows and test windows respectively according to the preset ratio partitioning method, and obtaining a training set and a test set according to the training windows and the test windows specifically includes: obtaining the number of square windows in each group of square windows, determining a first ratio according to the preset ratio determination method and the number of windows; randomly selecting a number of square windows equal to the first ratio from the group of square windows as training windows, taking the square windows other than the training windows as test windows, taking all training windows as the training set, and taking all test windows as the test set.
[0039] In one embodiment, if the number of windows is less than 10, the preset ratio number is 50% of the number of square windows in the class window group; if the number of windows is greater than 10, the preset ratio number is 10% of the number of square windows in the class window group.
[0040] S3: Use a preset data augmentation method to augment the training set to obtain an augmented training set, use the augmented training set to train a preset fully convolutional network to obtain a segmentation network, and use the test set to evaluate the segmentation network to obtain an evaluation result.
[0041] In one embodiment, using a preset data augmentation method to augment the training set to obtain an augmented training set specifically includes: rotating each training window in the training set at a preset rotation angle to obtain a first training window; horizontally flipping each training window in the training set to obtain a second training window; vertically flipping each training window in the training set to obtain a third training window; adding noise or changing the brightness to each training window in the training set to obtain a fourth training window; output the first training window, the second training window, the third training window, the fourth training window, and the training window as the augmented training set. Among them, adding noise or changing the brightness can enhance the robustness of the method under different conditions, for example: different sensors, light changes, and atmospheric interference.
[0042] In one embodiment, using the augmented training set to train a preset fully convolutional network to obtain a segmentation network specifically includes: performing pixel-to-pixel classification on the augmented training set according to the preset fully convolutional network to obtain a classification result; calculating a loss function and performing error backpropagation based on the categories of pixels in each square window in the augmented training set and the corresponding classification results to obtain a first fully convolutional network; repeating the above steps until the first fully convolutional network converges, and output the first fully convolutional network as the segmentation network.
[0043] The embodiment of the present invention describes a method for selecting samples of remote sensing images. According to the segmentation method, the hyperspectral image and the corresponding label image are segmented into a number of equal-sized and non-overlapping square windows; then, sort them in ascending order according to the number of labeled pixels in each category to obtain a collection order; first collect the windows containing the first-sorted category according to this collection order, and randomly select a predetermined proportion of the windows for training, and the rest are used for testing; then, set to zero the corresponding positions of the hyperspectral image and the corresponding label image containing the windows of this category, and use them to collect the windows containing the second-sorted category, and repeat this process until all categories have completed this operation; after augmenting the training set by a preset data augmentation method, use the augmented training set to train a preset fully convolutional network, use the trained network to predict the test set and perform accuracy evaluation. This sample selection method improves the sampling balance of remote sensing images, avoids potential overlap between training data and test data, and thus provides data support for subsequent objective and accurate performance evaluation. Specific Embodiment Two
[0045] In addition to the above methods, the embodiments of the present invention also disclose a sample selection device for remote sensing images. Figure 2 FIG. is a schematic structural diagram of a sample selection device for remote sensing images provided by an embodiment of the present invention.
[0046] As Figure 2 shown, the sample selection device includes a segmentation acquisition unit 11, a window division unit 12, and a training output unit 13.
[0047] Among them, the segmentation acquisition unit 11 is used to obtain a hyperspectral image to be sample selected and a corresponding label image, and segment the hyperspectral image and the label image according to a preset segmentation method to obtain a plurality of square windows; each square window includes one or more pixels with class labels, and each class label corresponds to a class.
[0048] In one embodiment, the segmentation acquisition unit 11 is further used to: segment the hyperspectral image and the corresponding label image into a plurality of square windows of equal size and non-overlapping using a preset fishing net segmentation method; the square window includes one or more pixels with class labels; the label image includes a plurality of classes labeled with class labels; the hyperspectral image and the label image correspond.
[0049] The window division unit 12 is used to collect each class in turn according to a preset division method, the square window, and the class to obtain a corresponding square window group, and randomly divide the square windows in each square window group into a training set or a test set.
[0050] In one embodiment, the window division unit 12 is further used to: obtain the number of pixels corresponding to each class, and sort all classes according to the number of pixels and a preset sorting method to obtain a collection order; collect each class in turn according to the collection order to obtain a corresponding square window group; the square window group includes a plurality of square windows; according to a preset ratio division method, divide each square window group into training windows and test windows respectively, and obtain a training set and a test set according to the training windows and the test windows.
[0051] In one embodiment, the window division unit 12 is further used to: sort all classes according to the number of pixels and in ascending order to obtain a collection order.
[0052] In one embodiment, the window partitioning unit 12 is further configured to: obtain the number of windows in the square window group, determine a first ratio according to a preset ratio determination method and the number of windows; for each square window in the square window group, randomly select a number of square windows equal to the first ratio from the square window group as training windows, use the square windows other than the training windows as test windows, use all the training windows as a training set, and use all the test windows as a test set.
[0053] In one embodiment, the training output unit 13 is further configured to: rotate each training window in the training set at a preset rotation angle to obtain a first training window; horizontally flip each training window in the training set to obtain a second training window; vertically flip each training window in the training set to obtain a third training window; add noise or change the brightness of each training window in the training set to obtain a fourth training window; output the first training window, the second training window, the third training window, the fourth training window, and the training window as an enhanced training set.
[0054] The training output unit 13 is configured to perform data augmentation on the training set through a preset data augmentation method to obtain an enhanced training set, train a preset fully convolutional network with the enhanced training set to obtain a segmentation network, and evaluate the segmentation network with the test set to obtain an evaluation result.
[0055] In one embodiment, the training output unit 13 is further configured to: perform pixel-to-pixel classification on the test set according to the trained preset fully convolutional network to obtain a classification result; calculate a loss function according to the categories of the test set and the corresponding classification results and perform error backpropagation to obtain a first fully convolutional network; repeat the above steps until the first fully convolutional network converges, and output the first fully convolutional network as the segmentation network.
[0056] Another embodiment of the present invention provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program runs, it controls the device where the computer-readable storage medium is located to execute the sample selection method for remote sensing images as described above.
[0057] Among them, if the units integrated in the sample selection device are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, to implement all or part of the processes in the above-described embodiment methods of the present invention, it can also be completed by a computer program instructing relevant hardware. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-described various method embodiments can be implemented. Another embodiment of the present invention provides a computer-readable storage medium, which includes a stored computer program. Among them, when the computer program runs, it controls the device where the computer-readable storage medium is located to execute the sample selection method of the remote sensing image as described above.
[0058] The computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.
[0059] It should be noted that the device embodiments described above are only illustrative. 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 to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the attached drawings of the device embodiments provided by the present invention, the connection relationship between the units indicates that they have a communication connection, which can be specifically implemented as one or more communication buses or signal lines. Those of ordinary skill in the art can understand and implement it without creative effort.
[0060] Embodiments of the present invention describe a sample selection device and a computer-readable storage medium for remote sensing images. According to the segmentation method, a hyperspectral image and a corresponding label image are segmented into a number of square windows of equal size and non-overlapping; then, sorting is performed in ascending order according to the number of pixels corresponding to each category to obtain the collection order; according to this collection order, first collect the windows containing the first sorted category, and randomly select a predetermined proportion of the windows for training, and the rest are used for testing; then, set to zero the corresponding positions of the windows containing this category in the hyperspectral image group and the corresponding label image group, and use them to collect the windows containing the second sorted category, and repeat this process until all categories complete this sample selection; after performing data augmentation on the training set through a preset data augmentation method, use the augmented training set to train a preset fully convolutional network, use the trained network to predict the test set and perform accuracy evaluation. This sample selection device and computer-readable storage medium improve the sampling balance of remote sensing images, thereby providing data support for subsequent objective and accurate performance evaluation. Specific Embodiment III
[0062] In addition to the above methods and devices, embodiments of the present invention also describe a sample selection system for remote sensing images.
[0063] The sample selection system includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the sample selection method for remote sensing images as described above.
[0064] The so-called processor may be a central processing unit (CPU), or may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The processor is the control center of the device, connecting various parts of the entire device through various interfaces and lines.
[0065] The memory can be used to store the computer programs and / or modules. By running or executing the computer programs and / or modules stored in the memory and calling the data stored in the memory, the various functions of the device can be realized. The memory mainly includes a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created according to the use of the mobile phone (such as audio data, phone book, etc.). In addition, the memory can include high-speed random access memory, and can also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a FlashCard, at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0066] An embodiment of the present invention describes a sample selection system for remote sensing images. By according to a segmentation method, a hyperspectral image and a corresponding label image are segmented into a number of square windows of equal size and non-overlapping; then, sorting is performed according to the number of pixels corresponding to each category from small to large to obtain a collection order; according to this collection order, the windows containing the first sorted category are collected first, and a predetermined proportion of windows are randomly selected for training, and the rest are used for testing; then, the corresponding positions of the windows containing this category in the hyperspectral image group and the corresponding label image group are set to zero, and are used to collect the windows containing the second sorted category, and this process is repeated until all categories complete this sample selection; after data augmentation is performed on the training set by a preset data augmentation method, the preset fully convolutional network is trained with the augmented training set, and the trained network is used to predict the test set and perform accuracy evaluation. This sample selection system improves the sampling balance of remote sensing images, thereby providing data support for subsequent objective and accurate performance evaluation.
[0067] The above is the preferred implementation manner of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements are also regarded as the protection scope of the present invention.
Claims
1. A method for sample selection of remote sensing images, characterized in that The sample selection method includes: Obtain the hyperspectral image to be selected for samples and the corresponding label image. According to a preset segmentation method, segment the hyperspectral image and the label image to obtain a number of square windows; each square window includes one or more pixels with class labels, and each class label corresponds to a class. According to a preset partitioning method, the square windows, and the classes, collect each class in sequence to correspondingly obtain groups of square windows, and randomly divide the square windows in each group of square windows into a training set or a test set. Through a preset data augmentation method, perform data augmentation on the training set to obtain an augmented training set, use the augmented training set to train a preset fully convolutional network to obtain a segmentation network, and use the test set to evaluate the segmentation network to obtain an evaluation result. Among them, according to a preset partitioning method, the square windows, and the classes, collecting each class in sequence to correspondingly obtain groups of square windows, and randomly dividing the square windows in each group of square windows into a training set or a test set specifically includes: obtaining the number of pixels corresponding to each class, and according to the number of pixels and a preset sorting method, sorting all classes to obtain a collection order; according to the collection order, collecting each class in sequence to correspondingly obtain groups of square windows; each group of square windows includes a number of square windows; according to a preset ratio partitioning method, divide each group of square windows into training windows and test windows respectively, and obtain a training set and a test set according to the training windows and the test windows.
2. The method for selecting samples of remote sensing images according to claim 1, wherein Sorting all classes according to the number of pixels and a preset sorting method to obtain a collection order specifically includes: Sorting all classes according to the number of pixels and in ascending order to obtain a collection order.
3. The method for selecting samples of remote sensing images according to claim 2, characterized in that, Dividing each group of square windows into training windows and test windows respectively according to a preset ratio partitioning method, and obtaining a training set and a test set according to the training windows and the test windows specifically includes: Obtain the number of windows of the square windows in the group of square windows, and determine a first ratio according to a preset ratio determination method and the number of windows. Randomly select square windows with the number of the first ratio from the group of square windows as training windows, take the square windows other than the training windows as test windows, take all training windows as the training set, and take all test windows as the test set.
4. The method for selecting samples of remote sensing images according to claim 3, wherein Segmenting the hyperspectral image and the label image according to a preset segmentation method to obtain a number of square windows specifically includes: Use a preset fishing net segmentation method to segment the hyperspectral image and the corresponding label image into a number of square windows with equal size and non-overlapping; each square window includes one or more pixels with class labels; the label image includes a number of classes labeled with class labels; the hyperspectral image and the label image correspond.
5. The method for selecting samples of remote sensing images according to claim 4, wherein, Performing data augmentation on the training set through a preset data augmentation method to obtain an augmented training set specifically includes: Rotate each training window in the training set at a preset rotation angle to obtain a first training window; Horizontally flip each training window in the training set to obtain a second training window; Vertically flip each training window in the training set to obtain a third training window; Add noise or change the brightness of each training window in the training set to obtain a fourth training window; Output the first training window, the second training window, the third training window, the fourth training window, and the training window as an enhanced training set.
6. The method for selecting samples of remote sensing images according to claim 5, characterized in that Train a preset fully convolutional network with the enhanced training set to obtain a segmentation network, specifically including: Perform pixel-to-pixel classification on the enhanced training set according to the preset fully convolutional network to obtain a classification result; Calculate a loss function and perform error backpropagation based on the categories of pixels in each square window in the enhanced training set and the corresponding classification results to obtain a first fully convolutional network; Repeat the above steps until the first fully convolutional network converges, and output the first fully convolutional network as the segmentation network.
7. A sample selection device for remote sensing images, characterized in that, The sample selection device includes a segmentation and acquisition unit, a window division unit, and a training and output unit, where The segmentation and acquisition unit is used to obtain a hyperspectral image to be sample selected and the corresponding label image, and segment the hyperspectral image and the label image according to a preset segmentation method to obtain a number of square windows; each square window includes one or more pixels with class labels, and each class label corresponds to a class; The window division unit is used to collect each class in turn according to a preset division method, the square windows, and the classes to correspondingly obtain square window groups, and randomly divide the square windows in each square window group into a training set or a test set; The training and output unit is used to perform data augmentation on the training set through a preset data augmentation method to obtain an enhanced training set, train a preset fully convolutional network with the enhanced training set to obtain a segmentation network, and evaluate the segmentation network with the test set to obtain an evaluation result; Among them, collecting each class in turn according to a preset division method, the square windows, and the classes to correspondingly obtain square window groups, and randomly dividing the square windows in each square window group into a training set or a test set specifically includes: obtaining the number of pixels corresponding to each class, and sorting all classes according to the number of pixels and a preset sorting method to obtain a collection order; collecting each class in turn according to the collection order to correspondingly obtain square window groups; the square window group includes a number of square windows; according to a preset ratio division method, divide each square window group into training windows and test windows respectively, and obtain a training set and a test set according to the training windows and the test windows.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein when the computer program runs, it controls the device where the computer-readable storage medium is located to execute the method for selecting samples of remote sensing images according to any one of claims 1 to 6.
9. A sample selection system for remote sensing images, characterized in that, The sample selection system includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the method for selecting samples of remote sensing images according to any one of claims 1 to 6.