Crop automatic classification method and system for generating samples based on model migration
By extracting crop sample data from historical crop thematic maps and historical remote sensing images of multiple historical years, training models of multiple historical years, and generating high confidence samples for target years using integrated learning, the problem of cross-year samples in the existing technology cannot be directly reused and insufficient mapping accuracy is achieved, and high-precision crop mapping for target years is achieved.
Patent Information
- Application Number
- CN202411886778.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-05-09
AI Technical Summary
When using historical crop information to map crops for target year, the existing technology faces the influence of factors such as complex crop rotation mode and agricultural disasters, which leads to the inability to directly reuse samples from across years and insufficient mapping accuracy.
By extracting crop sample data from historical crop thematic maps and historical remote sensing images of multiple historical years, models of multiple historical years are trained, and high confidence samples of target years are generated based on multiple crop probability maps, and the model is retrained to achieve automatic crop classification of target years.
It effectively solved the problem that cross-year samples cannot be reused directly under the complex crop rotation mode, improved the growth period abnormality handling ability caused by crop disasters in the target year, and achieved high-precision crop mapping for target year.
Smart Images

Figure CN119963875A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image recognition technology, and in particular to a method and system for automatically classifying crops based on generating samples through model migration. Background Art
[0002] Crop mapping based on machine learning relies on a large number of samples of the current year (target year). Using the historical crop information in the historical crop thematic map to generate the crop distribution of the target year can significantly save the manpower and time costs required for field surveys to obtain samples.
[0003] There are two major challenges in using historical crop information to map crops in the target year: first, the complexity of crop rotation patterns makes it impossible to directly reuse samples across years; second, agricultural disasters or growing season images are affected by factors such as cloud cover, making it difficult to match phenological characteristics between years, thus affecting the mapping effect of direct migration of historical models.
[0004] In the prior art, there are two ways to migrate historical crop information to the target year: sample migration and model migration. Sample migration is based on historical samples generated by existing historical samples or historical crop thematic maps. The samples of historical years are directly converted into samples of the target year by calculating the spectral information of historical years and target years. The model is then trained by machine learning to classify the target year. However, this method is easily affected by crop rotation, resulting in the inability to migrate most samples of historical years to the target year, and the mapping accuracy is low. Model migration is to directly train a historical classification model based on historical samples generated by existing historical samples or historical thematic maps, and migrate the historical classification model to the target year for classification. However, the traditional model migration method usually migrates the model of a single year to the target year, which is difficult to apply to areas where crop growth images are easily affected by cloudy weather, and cannot handle growth period anomalies caused by crop disasters. The accuracy of crop mapping in the target year is still insufficient and difficult to meet actual application needs.
[0005] Therefore, it is necessary to provide an improved technical solution to address the above-mentioned deficiencies in the prior art. Summary of the invention
[0006] The purpose of this application is to provide a method and system for automatic classification of crops based on sample generation by model migration, so as to solve or alleviate the problems existing in the above-mentioned prior art.
[0007] In order to achieve the above objectives, this application provides the following technical solutions:
[0008] In a first aspect, the present application provides a method for automatically classifying crops based on generating samples through model migration, comprising:
[0009] Extract the crop sample data of each historical year in the study area from the historical crop thematic maps and historical remote sensing images of multiple historical years;
[0010] Inputting the crop sample data of each historical year into a machine learning model for training to obtain models of multiple historical years;
[0011] Inputting the remote sensing images of the target year into the models of the multiple historical years respectively, predicting the crop distribution of the target year, and obtaining multiple crop probability maps of the target year;
[0012] Calculate the mean of multiple probability values belonging to the same crop category at the same pixel position in the plurality of crop probability maps to obtain the mean probability of each crop category in each pixel in the target year;
[0013] Based on the probability mean and a preset probability segmentation threshold, determine the crop classification label of each pixel in the target year, and combine the probability mean of each pixel with the crop classification label to obtain a probability integration map;
[0014] Based on the probability integration map and the remote sensing image of the target year, sample data of the target year is generated, and the sample data of the target year is used to retrain the machine learning model to obtain the model of the target year, and then the model of the target year is used to obtain the automatic classification result of crops in the target year.
[0015] In combination with the first aspect, in some possible implementations, determining the crop classification label of each pixel in the target year based on the probability mean and a preset probability segmentation threshold is specifically as follows:
[0016] The probability mean of each crop category in the target year at the same pixel position is compared with the preset probability segmentation threshold one by one. If the first probability mean is greater than or equal to the probability segmentation threshold, the crop category corresponding to the first probability mean is used as the crop classification label of the pixel in the target year;
[0017] The first probability mean is any one of the probability means of each crop category at the pixel location.
[0018] In combination with the first aspect, in some possible implementations, determining the crop classification label of each pixel in the target year based on the probability mean and a preset probability segmentation threshold is specifically as follows:
[0019] Obtain the maximum value of the probability mean of each crop category in the target year at the same pixel location, recorded as the second probability mean;
[0020] The second probability mean is compared with a preset probability segmentation threshold. If the second probability mean is greater than the probability segmentation threshold, the crop category corresponding to the second probability mean is used as the crop classification label of the pixel in the target year.
[0021] In conjunction with the first aspect, in some possible implementations, extracting the crop sample data of each historical year in the study area from the historical crop thematic maps and historical remote sensing images of multiple historical years includes:
[0022] For each historical crop thematic map of a historical year, a morphological method is used to determine the minimum homogeneous area of each crop on the historical crop thematic map, and samples of each category of crops in the historical year are generated within the scope of the minimum homogeneous area in combination with the historical remote sensing image;
[0023] Performing normalized vegetation index time series analysis and filtering on samples of various categories of crops in historical years to obtain purified samples, and using the purified samples as the final crop samples of each historical year in the study area;
[0024] Wherein, the normalized vegetation index is calculated using the spectral information of the historical remote sensing image.
[0025] In conjunction with the first aspect, in some possible implementations, using a morphological method to determine the minimum homogeneous area of each crop on the historical crop thematic map includes:
[0026] Determine a plurality of focal radii, and generate a corresponding homogeneous area in the historical crop thematic map based on each of the focal radii;
[0027] Randomly generate random points on the historical crop thematic map, and extract points falling within each homogeneous area to obtain homogeneous points of different crops;
[0028] Calculating the normalized vegetation index of all homogeneous points of each crop category at different focal radii during the vigorous growth period using the spectral information of the historical remote sensing images, and calculating the mean and standard deviation of the normalized vegetation index during the vigorous growth period;
[0029] Draw relationship curves between different focal radii, the mean value and the standard deviation respectively;
[0030] The focal radius corresponding to when the relationship curve initially reaches stability is determined as the optimal radius, and morphological operations are performed based on the optimal radius to obtain a corresponding neighborhood range as the minimum homogeneous area of each crop.
[0031] In combination with the first aspect, in some possible implementations, the samples of various categories of crops in historical years are subjected to normalized vegetation index time series analysis and filtering to obtain purified samples, including:
[0032] The mean and standard deviation of the normalized vegetation index of each category of crop samples were calculated on a monthly basis, and the normalized vegetation index mean curve was drawn. The crop samples whose normalized vegetation index values deviated from the mean curve by more than or equal to one standard deviation were filtered out to obtain purified samples.
[0033] In combination with the first aspect, in some possible implementations, the machine learning model is a random forest model.
[0034] In a second aspect, this embodiment provides an automatic crop classification system for generating samples based on model migration, including:
[0035] An extraction unit is configured to extract crop sample data of each historical year in the study area from historical crop thematic maps and historical remote sensing images of multiple historical years;
[0036] A training unit is configured to input the crop sample data of each historical year into a machine learning model for training to obtain models of multiple historical years;
[0037] A first prediction unit is configured to input the remote sensing images of the target year into the models of the multiple historical years respectively, predict the crop distribution of the target year, and obtain multiple crop probability maps of the target year;
[0038] The first integration unit is configured to average multiple probability values belonging to the same crop category at the same pixel position in the plurality of crop probability maps to obtain the probability average of each crop category in the target year;
[0039] A second integration unit is configured to determine the crop classification label of each pixel in the target year based on the probability mean and a preset probability segmentation threshold, and merge the probability mean of each pixel with the crop classification label to obtain a probability integration map;
[0040] The second prediction unit is configured to generate sample data of the target year based on the probability integration map and the remote sensing image of the target year, and use the sample data of the target year to retrain the machine learning model to obtain the model of the target year, and then use the model of the target year to obtain the automatic classification result of crops in the target year.
[0041] In a third aspect, this embodiment provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for automatically classifying crops based on generating samples based on model migration provided in any of the above embodiments is implemented.
[0042] In a fourth aspect, this embodiment provides an electronic device, comprising: a memory, a processor, and a program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for automatic classification of crops based on generating samples based on model migration provided in any of the above embodiments is implemented.
[0043] The technical solution of the embodiment of the present application has the following beneficial effects:
[0044] Historical crop information of each historical year is obtained through historical crop thematic maps, and crop sample data is obtained in combination with historical remote sensing images. Models for multiple historical years are trained, and an integrated learning method is used to generate high-confidence samples for the target year based on multiple crop probability maps. This effectively solves the problem of the inability to directly reuse cross-year samples due to complex crop rotation patterns and the problem of abnormal growth periods caused by crop disasters in the target year, thereby achieving high-precision crop mapping for the target year. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 A flowchart of a method for automatic classification of crops based on generating samples based on model migration according to some embodiments of the present disclosure.
[0046] Figure 2 A technical logic block diagram of a method for automatic classification of crops based on sample generation based on model migration according to some embodiments of the present disclosure.
[0047] Figure 3 Schematic diagram of relationship curves between different focal radii and NDVI_mean, NDVI_std provided in some embodiments.
[0048] Figure 4 Schematic diagram of the historical year sample generation and purification process provided for some embodiments.
[0049] Figure 5 A schematic diagram of a process for determining crop labels for a target year provided in some embodiments.
[0050] Figure 6 Schematic diagram of sample migration and model migration process provided for existing technologies.
[0051] Figure 7 This is a schematic diagram of the crop classification results for the target year in the study area using the method provided in this application.
[0052] Figure 8 This is a schematic diagram comparing the classification results of the method of this embodiment, the existing sample migration, and the model migration method in the study area. DETAILED DESCRIPTION
[0053] To facilitate understanding, the relevant concepts are exemplified below.
[0054] A historical year refers to a year in the past. Crop information from historical years can be used to build models to understand past patterns, or to train machine learning models to predict future trends.
[0055] The target year refers to a year in the future that needs to be predicted or paid attention to, relative to the historical years. The crop distribution information of the target year is usually unknown, and it is necessary to obtain a model or sample through historical year training to infer the characteristics or trends of the target year.
[0056] A machine learning model is a mathematical model that predicts, classifies, or makes decisions about new data by learning patterns and rules in the data. It is the core part of machine learning. It automatically extracts knowledge from data through algorithms and makes judgments or predictions based on this. Machine learning models can be built based on different algorithms, assumptions, and methods. Their purpose is usually to enable the model to perform well on unknown and unseen data.
[0057] A historical crop thematic map is a map specifically used to display crop distribution information in different regions during a certain historical period (such as a historical year). Unlike conventional maps, a historical crop thematic map focuses on expressing crop distribution information in a specific historical period, and uses colors, symbols, and scales to visualize the information to help users analyze and understand the distribution status, changing trends, and relationships of crops during that period.
[0058] Historical remote sensing images refer to image data obtained through remote sensing technology (such as satellites or aerial sensors) that reflect the surface or land features of a certain historical period or multiple historical periods. These images can be satellite images, aerial images or other sensor data from different time points. They are used to review and analyze changes in the earth's surface over a certain period of time in the past, such as changes in crop planting, natural disasters, etc.
[0059] The terms "first", "second", "third" and "fourth" etc. in the specification and claims of the present application and the drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0060] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0061] The embodiments of the present application are described below in conjunction with the accompanying drawings.
[0062] Embodiment 1:
[0063] This embodiment discloses a method for automatically classifying crops based on generating samples through model migration. Figure 1 As shown, the method includes steps S101 to S106, which are specifically as follows:
[0064] Step S101: extracting crop sample data of each historical year in the study area from historical crop thematic maps and historical remote sensing images of multiple historical years;
[0065] Step S102: inputting the crop sample data of each historical year into a machine learning model for training to obtain models of multiple historical years;
[0066] Step S103: inputting the remote sensing images of the target year into the models of multiple historical years respectively, predicting the crop distribution of the target year, and obtaining multiple crop probability maps of the target year;
[0067] Step S104: Calculate the mean of multiple probability values belonging to the same crop category at the same pixel position in multiple crop probability maps to obtain the probability mean of each crop category in each pixel in the target year;
[0068] Step S105: based on the probability mean and the preset probability segmentation threshold, determine the crop classification label of each pixel in the target year, and merge the probability mean of each pixel with the crop classification label to obtain a probability integration map;
[0069] Step S106: Based on the probability integration map and the remote sensing image of the target year, generate sample data of the target year, and use the sample data of the target year to retrain the machine learning model to obtain the model of the target year, and then use the model of the target year to obtain the automatic classification result of crops in the target year.
[0070] In this embodiment, the machine learning model may adopt a support vector machine (SVM), a random forest model, or a neural network model.
[0071] Preferably, the machine learning model is a random forest model, that is, a random forest classifier is selected to classify corn and soybeans in the study area. The advantages of this are: the random forest classifier shows excellent performance and effect in crop remote sensing classification applications. The random forest classifier is a non-parametric classification model composed of many decision trees, so it has better classification performance than a single decision tree (DT) classifier. In addition, the random forest classifier has strong robustness and is usually not prone to overfitting, so it has strong versatility and transferability.
[0072] In machine learning, crop sample data from historical years are used to train models and make predictions. The model builds an algorithm that can make predictions about unknown data by learning from the training data (sample data). These sample data contain input features and crop classification labels, which are the basis for machine learning algorithms to learn and make predictions.
[0073] Automatic crop classification uses machine learning technology to automatically identify different types of crops, such as corn, soybeans or other crops.
[0074] Model migration to generate samples refers to the technology of applying the trained historical year model to the automatic classification task of crops in the target year, so as to generate samples of the target year or expand the samples of the target year.
[0075] In this embodiment, the study area may be a geographical area of any scope, such as a provincial, municipal, or county administrative area, or a national scope. This embodiment does not limit the geographical location and scope of the study area.
[0076] In order to verify that the method provided in this embodiment can be applied to abnormal growth period caused by crop disasters in the target year and improve the mapping accuracy, preferably, the study area can be set in an area where crops are susceptible to frost disasters, pests and diseases, and pesticide disasters, such as a county in Northeast China or other similar areas. Of course, the method provided in this application is also applicable to areas that are not affected by disasters and have no abnormal growth period, and obtains the technical effect of improved accuracy.
[0077] In this embodiment, the crop sample data includes input features and crop classification labels, wherein the input features are spectral information extracted from historical remote sensing images, and these spectral information are used to describe the relevant feature expressions of crop distribution. The crop classification labels are extracted from historical crop thematic maps and represent the types of crops planted in different regions or plots.
[0078] For example, the historical remote sensing images may be Sentinel-2 images from 2017 to 2020. Furthermore, after the historical remote sensing images are processed and analyzed (such as preprocessing, image segmentation, feature extraction, time series analysis, etc.), various features that can reflect the growth status, physical properties, spatial distribution, etc. of crops can be extracted and used as the input of the model.
[0079] It should be noted that the acquisition and preprocessing of Sentinel-2 images can be performed on the Google Earth Engine (GEE) platform. It should also be noted that the Sentinel-2 images used in this embodiment are Level 1-C data, which are geometrically corrected images and are conducive to further analysis on geographic information systems (GIS) or other software.
[0080] Specifically, taking the classification of corn, soybeans and other crops as an example, the following two types of spectral information can be used as input features of the model: (1) reflectance information of three bands; (2) seven spectral index information.
[0081] Among them, the three bands include: red edge band (RE2, central wavelength is 740.2nm), shortwave infrared band 1 (SWIR1, central wavelength is 1613.7nm) and shortwave infrared band 2 (SWIR2, central wavelength is 2202.4nm). Selecting these three bands as input features can effectively distinguish corn and soybeans and improve classification accuracy.
[0082] Seven spectral index information, including: Normalized Difference Vegetation Index (NDVI), Enhanced Vegetation Index (EVI), Land Surface Water Index (LSWI), Normalized Difference Tillage Index (NDTI), Normalized Differential Senescent Vegetation Index (NDSVI), Red Edge NDVI (RENDVI) and Red Edge Position (REP). The comprehensive use of the above spectral indexes can help the machine learning model to more accurately identify crop types and improve the performance of the model.
[0083] The calculation method of the above spectral index can be performed with reference to the prior art and will not be described in detail in this embodiment.
[0084] In this embodiment, the historical crop thematic map contains the types of crops, reflecting the planting areas and types of various crops in a certain area at a specific time. That is, in the historical crop thematic map, each pixel or area has an attribute indicating which crop is planted in the area (for example, wheat, corn, rice, etc.). By extracting labels from these historical thematic maps, the corresponding real category is provided for each sample data (i.e., the feature set of each remote sensing image), thereby providing a target label (i.e., crop type) for the supervised learning algorithm.
[0085] For example, the historical crop thematic map is made by using the Sentinel-2 growing period time series data of the corresponding year combined with the crop sample points obtained from the field survey of that year. The historical years may include 2017, 2018 and 2019, and the target year may be set to 2020.
[0086] The thematic maps of various historical years are organized in the form of raster data with a spatial resolution of 10 meters. After verification of field data, the user accuracy and producer accuracy of the historical crop thematic maps of the above three years have reached more than 80%, providing a guarantee for the quality of historical crop samples.
[0087] In the process of extracting the true categories of agricultural crops, the non-corn and non-soybean pixel categories in the crop thematic maps of each historical year can be marked as other crops, and historical samples of corn, soybeans and other crops can be generated based on the marked historical crop thematic maps, thereby ensuring that the generated historical year sample data has high reliability.
[0088] In addition, in order to verify the accuracy of the model, optionally, the method provided in this embodiment also includes the step of obtaining ground truth data, namely: obtaining ground truth sample data of the target year (2020) by ground survey and high-resolution Google Earth image interpretation, and these ground truth sample data are used to evaluate the classification accuracy of the model in the target year.
[0089] The purpose of step S102 is to train models for multiple historical years using the crop sample data of each historical year. The crop sample data of the study area is organized according to historical years, and each historical year corresponds to a crop sample. This organization method can train machine learning models for each historical year, obtain a model corresponding to each historical year, and finally form models for multiple historical years.
[0090] The purpose of step S103 is to predict the crop distribution of the target year separately using the models of each historical year based on the input features provided by the remote sensing image of the target year, and obtain multiple crop probability maps.
[0091] The crop probability map refers to a grid map composed of the probabilities of each pixel belonging to different crop categories predicted by each model. In this embodiment, there are multiple crop probability maps, and the model prediction of each historical year obtains a crop probability map, that is, for the target year, the model of each historical year predicts the probability of each pixel belonging to each type of crop in the target year.
[0092] For example, the models of the three historical years of 2017, 2018 and 2019 predict three crop probability maps for the target year 2020. The pixels in each crop probability map can be set to an array type. Each array includes three elements, and the value of each element is the probability value of the pixel being classified into a certain crop category (corn, soybeans or other crops).
[0093] Considering that the phenological information of the same crop between years cannot be completely matched, the integration of phenological information of multiple years can ensure that it is similar to the phenological information of the target year. The target year probability integration map generated by the migration of multiple historical year models can reflect the crop distribution of the target year to a certain extent. Therefore, in step S104, the averaging calculation is performed by multiple probability values belonging to the same crop category at the same pixel position to achieve the fusion of model prediction results of different historical years, obtain the probability mean, and input the fusion result (i.e., the probability mean) into step S105, and compare it with the preset probability segmentation threshold to obtain the crop classification, and finally generate a probability integration map containing classification labels and probability mean. The pixels marked as corn, soybeans and other crops in the probability integration map of the target year can be consistent with the ground truth category of the target year to a certain extent, which helps to reduce the impact of crop rotation on the prediction results, reduce the error of a single model, and also weaken the impact of abnormal growth period on the accuracy of model prediction, thereby improving the accuracy and reliability of crop classification.
[0094] Specifically, the mean probability of the target year is calculated as follows:
[0095]
[0096] In the formula, is the mean probability that pixel i eventually belongs to crop type k (k∈[corn, soybean, other crops]); The probability that pixel i will eventually belong to crop type k is predicted by migrating the j-th historical year model to the target year; N is the total number of historical year models used.
[0097] Exemplarily, the number of models N can be set to 3, i.e., a total of three historical years: 2017, 2018 and 2019.
[0098] Figure 5 A schematic diagram of a process for determining crop labels for a target year provided in some embodiments. Figure 5 As shown in the figure, the remote sensing image of 2020 is input into the model of 2017, 2018 and 2019, and three crop probability maps of 2020 are predicted. Assuming that crops are divided into A = corn, B = soybeans, and C = other crops, each pixel in the crop probability map contains three probability values belonging to A, B, and C. The three probabilities of the same pixel being classified as a crop of type A are averaged to obtain the probability mean of the pixel belonging to a crop of type A. For example, Figure 5 For pixel 1 marked by the red dotted line, the probabilities of the pixel belonging to Class A crops are 0.3, 0.2, and 0.05, respectively, and the mean probability is the average of 0.3, 0.2, and 0.05, i.e., 0.18; the probabilities of the pixel belonging to Class B crops are 0.5, 0.7, and 0.9, respectively, and the mean probability is 0.7; the probabilities of the pixel belonging to Class C crops are 0.2, 0.1, and 0.05, respectively, and the mean probability is 0.12.
[0099] After obtaining the probability mean of the target year, the crop classification label of each pixel in the target year is determined based on the probability mean and the preset probability segmentation threshold, that is, by comparing the probability mean with the probability segmentation threshold.
[0100] It should be noted that each pixel in the probability integration map includes two attributes: a probability mean and a crop classification label. The merging of the probability mean and the crop classification label can be implemented as follows:
[0101] The probability mean and crop classification label are stored in the form of raster layers. That is, the probability integrated map includes two layers. The pixel values of one layer are the probability mean, and the pixel values of the other layer are the crop categories (crop classification labels, such as corn, soybeans, etc.).
[0102] Through the probability integration map, a high-confidence crop classification label for the target year can be obtained, and then the model for the target year is retrained through step S106. Finally, the remote sensing image of the target year is input into the model, and the crops of the target year are automatically classified based on the retrained model of the target year.
[0103] In summary, the method provided in this embodiment integrates multiple historical year models to generate samples of the target year, and performs crop mapping of the target year on the basis of retraining the model. This method does not require field survey samples, reduces the time required for sample data production, and improves the efficiency of automatic crop classification. At the same time, by using many years of crop sample data to train models of multiple historical years, a probability integration map of the target year's crops is obtained by ensemble learning, and a high-confidence target year sample is generated on the probability integration map. The target year sample is used for classification, which can effectively use the crop phenology information of the year to compensate for sample quality problems caused by abnormal growth periods and improve classification accuracy.
[0104] In order to improve the stability and representativeness of crop samples in historical years, as a preferred solution, in step S101, crop sample data of each historical year in the study area is extracted from historical crop thematic maps and historical remote sensing images of multiple historical years, including the following technical steps:
[0105] Step S111: for each historical crop thematic map, use morphological methods to determine the minimum homogeneous area of each crop on the historical crop thematic map, and generate samples of each category of crops in the historical year within the minimum homogeneous area in combination with historical remote sensing images.
[0106] In the field of geographic information systems (GIS), homogeneous areas refer to areas that have consistency or similarity in a specific attribute or feature. Within these areas, pixels show the same or very similar characteristics in certain specific aspects (such as spectral characteristics), so they can be classified as homogeneous areas.
[0107] A crop homogeneous region refers to a geographical area where crop planting characteristics show spatial consistency. For example, a continuous corn field, rice field or wheat field can be regarded as a crop homogeneous region. The minimum homogeneous region of crops has a high degree of spatial consistency and attribute consistency, and is used to identify the spatial scale of crop planting or the area of analysis granularity. Therefore, based on the minimum homogeneous region of each crop and combined with remote sensing image data to generate crop samples, it can more accurately reflect the growth characteristics of crops in the region and improve the representativeness of training samples.
[0108] In this embodiment, the minimum homogeneous area of each crop is determined by a morphological method, that is, the historical crop thematic map is locally processed based on morphological structural elements, and morphological operations such as corrosion, expansion, opening and closing operations are used to identify the minimum homogeneous area of each crop.
[0109] Specifically, in the erosion operation for each pixel in the historical crop thematic map, if there is an overlap between the structural element and the target area, the pixel value is retained, otherwise it is deleted. Through the erosion operation, small noise can be removed and the stray parts in the image can be reduced.
[0110] After the morphological operation, the morphological characteristics of the crop area are checked. If the crop area shows spatial connectivity and its internal characteristics are consistent after the morphological operation, then the area can be regarded as the minimum homogeneous area. Combined with historical remote sensing images, suitable pixels in this area are selected as training samples.
[0111] On the historical crop thematic map, the accurate delineation of the minimum homogeneous area of each crop directly affects the stability and reliability of the sample. Through morphological processing, crop samples are automatically generated and purified from the historical crop thematic map, and the quality of sample data is optimized. Based on the historical crop thematic map with high accuracy, stable and representative historical samples can be obtained, making them more accurate and consistent, thereby ensuring that the samples can truly reflect the spatial distribution and characteristics of crops.
[0112] Step S121: Performing normalized difference vegetation index (NDVI) time series analysis and filtering on samples of various categories of crops in historical years to obtain purified samples, and using the purified samples as the final crop samples of each historical year in the study area.
[0113] The normalized vegetation index is calculated using the spectral information of historical remote sensing images. The specific calculation formula can refer to the prior art, and this embodiment will not be described in detail here.
[0114] The goal of step S121 is to reduce the impact of the classification accuracy error of the historical crop thematic map itself on the historical crop samples, and to purify the samples by means of time series analysis so that the purified samples have better representativeness.
[0115] That is to say, by the two-step approach of sample generation and sample purification in steps S111 to S121, stable and representative samples of historical years can be automatically obtained. By generating and purifying samples of historical years based on historical thematic maps and crop phenological information, stable and representative samples of historical years can be obtained, which can further improve the prediction accuracy of the model.
[0116] Furthermore, in order to ensure the stability of the samples, all generated samples must fall on homogeneous areas with low fragmentation and high connectivity. In some optional embodiments, the minimum homogeneous area of each crop is obtained by searching for the optimal focus radius to ensure the stability of the generated samples. Therefore, step S111 specifically includes the following steps:
[0117] Step S111a: determining a number of focus radii, and generating a corresponding homogeneous area in the historical crop thematic map based on each focus radius;
[0118] Step S111b: randomly generate random points on the historical crop thematic map, and extract points falling within each homogeneous area to obtain homogeneous points of different crops;
[0119] Step S111c: using the spectral information of the historical remote sensing images to calculate the normalized vegetation index of all homogeneous points of each crop category at different focal radii during the vigorous growth period, and calculating the mean and standard deviation of the normalized vegetation index during the vigorous growth period;
[0120] Step S111d: drawing relationship curves of different focal radii, mean values and standard deviations respectively;
[0121] Step S111e: Determine the focal radius corresponding to when the relationship curve initially reaches stability as the optimal radius, and perform morphological operations based on the optimal radius to obtain a corresponding neighborhood range as the minimum homogeneous area of each crop.
[0122] It should be noted that various operations of morphological processing are based on the structural element. The structural element is a small, usually binary matrix, which is used to determine which pixels in the local area should participate in various morphological operations. The focal radius refers to the size of the structural element.
[0123] In this embodiment, the morphological processing only uses an erosion operation, that is, the crop plot is eroded inwardly using the focus radius, and the width of the inward erosion of the plot boundary is equal to the size of the focus radius.
[0124] In step S111a, for different types of crop plots (such as corn, soybeans and other crops) on the historical crop thematic map, corresponding homogeneous regions are generated by determining different focus radii.
[0125] Exemplarily, 10 groups of focal radii (with values ranging from 0 to 10) can be set, and then morphological operations are used to process the crop plots in the historical crop thematic map respectively to obtain 10 processed crop distribution maps. The plot ranges on these processed crop distribution maps represent the homogeneous area ranges of crops at different focal radii.
[0126] Subsequently, in step S111b, points are randomly generated within the study area of the above 10 processed crop distribution maps, and points falling within the homogeneous area of a certain crop are extracted. These points falling within the homogeneous area of a certain crop are regarded as homogeneous points of the crop.
[0127] The purpose of step S111c is to use the homogeneous points within each homogeneous area to calculate the NDVI mean and standard deviation of all homogeneous points in the vigorous growth period of a crop (such as corn, soybean), and to use the mean of all homogeneous points to reflect the average level of crop growth in the homogeneous area, and to use the standard deviation to reflect the degree of dispersion of the homogeneous points. In other words, by calculating the NDVI mean (abbreviated as: NDVI_mean) and standard deviation (abbreviated as: NDVI_std) of all homogeneous points, the optimal radius of the crop is determined to obtain the minimum homogeneous area.
[0128] Specifically, first determine the vigorous growth period of each crop. Calculate the NDVI time series of homogeneous points of each crop (corn and soybean) when the focal radius is 0, and draw a time series curve. Observe the time series curve, and determine the time period when the NDVI value reflected by the curve has a significant increase as the vigorous growth period. For example, by observing the time series curve, it is found that the NDVI values of corn and soybeans in the study area in July have increased significantly, so July can be set as the vigorous growth period of corn and soybeans in the study area.
[0129] Then, the spectral information of historical remote sensing images was used to calculate the NDVI values of all homogeneous points at different focal radii for each crop category during the peak growth period (e.g., July), and the crop distribution after 10 treatments was calculated. Figure 7 Mean and standard deviation of NDVI for homogeneous points in the month.
[0130] The purpose of step S111d and step S111e is to determine the optimal radius and the minimum homogeneous area using the NDVI mean and standard deviation.
[0131] For example, based on the historical crop thematic map of the study area in 2019, the NDVI mean (NDVI_mean) and NDVI standard deviation (NDVI_std) of homogeneous points under different focal radii were calculated, and the relationship curve between the focal radius and NDVI_mean and NDVI_std was plotted. The results are as follows: Figure 3 shown. Figure 3 The mean and standard deviation shown in the figure are from the statistical calculation results of 10 groups of focal radius corresponding to homogeneous points, where (a) represents the calculation result of soybean focal radius and (b) represents the calculation result of corn focal radius. Figure 3 It can be seen that as the focal radius increases, the NDVI mean (NDVI_mean) and NDVI standard deviation (NDVI_std) of homogeneous points eventually tend to be stable. Therefore, the focal radius corresponding to the initial stability of the relationship curve is determined as the optimal radius. In other words, the focal radius corresponding to the first stability in the relationship curve is the optimal focal radius of the crop, and the homogeneous area obtained under this focal radius is the smallest and most accurate homogeneous area. Specifically, Figure 3(a) shows that soybeans reach stability at a focal radius of 6, and (b) shows that corn reaches stability at a focal radius of 3. Therefore, for the soybean and corn plots in the 2019 historical crop thematic map of the study area, focal radii of 6 and 3 were selected as the optimal radii, respectively, and the optimal radius was used as the local neighborhood range considered in each morphological operation to obtain the minimum homogeneous area of corn and soybeans, and then generate historical crop (corn and soybean) samples on the processed crop thematic map.
[0132] In the process of generating samples, the minimum radius determines the size of the morphological operation structure element. For example, if the minimum radius is 6, the corresponding structure element size is a 6×6 matrix, which will cover a 6×6 pixel area. Similarly, if the minimum radius is 3, the corresponding structure element size is a 3×3 matrix, which will cover a 3×3 pixel area.
[0133] For the homogeneous regional pixels that are ultimately used to generate soybean or corn samples, all pixels within their 6×6 neighborhood (6×6N) or 3×3 neighborhood (3×3N) are required to be soybean or corn types, as expressed as follows:
[0134]
[0135] In the formula, Sample Pixel is the pixel in the minimum homogeneous area, i is the size of the optimal radius, N is the abbreviation of the neighborhood, i×iN=i 2 The meaning is that if the focus radius is set to i, all pixels within the i×i range must be of the same type. For example, if i=3, then all pixels within the pixel range of 3×3=9 must be of the same type. Only then can the central pixel be retained and the central pixel is assigned a value of 1. The overall meaning of this formula is: assign 1 to the pixels within the minimum homogeneous area, and assign 0 to the remaining pixels. Subsequent sample generation is only in Sample Pixel The calculation is performed on pixels with a value of 1.
[0136] It should be noted that, except for corn and soybeans, the plots of other crops are small in size and highly fragmented, so a focal radius of 0 is selected as the optimal radius to process them and generate samples of other crops.
[0137] After generating stable samples of corn, soybeans and other crops within the minimum homogeneous area, considering that the historical crop thematic map itself also has certain classification errors, in order to further improve the quality of the samples, the samples of each category of crops in historical years can be subjected to NDVI time series analysis to purify more representative samples of corn, soybeans and other crops. Specifically, in step S121, the samples of each category of crops in historical years are subjected to normalized vegetation index time series analysis and filtering to obtain purified samples, including: calculating the mean and standard deviation of the normalized vegetation index of each category of crop samples on a monthly basis, drawing the normalized vegetation index mean curve, and filtering the crop samples whose normalized vegetation index values deviate from the mean curve by more than or equal to one standard deviation to obtain purified samples.
[0138] Let's take corn as an example. Figure 4 The generation and purification process of historical year samples in this embodiment is further described.
[0139] Figure 4 In the figure, (a) is to calculate the focal radius based on the historical crop thematic map, (b) is to use the optimal radius to perform morphological processing on the historical crop thematic map and generate crop samples of the historical year, obtain representative and stable samples, and form a crop sample database of the historical year. (c) is to purify the crop samples of the historical year based on the NDVI mean curve.
[0140] The classification error of the historical crop thematic map itself leads to a decline in sample quality, which is reflected in the NDVI mean curve as the NDVI values of the sample points deviate seriously from the mean curve. Figure 4 In part (c), the black curve is the NDVI mean curve, and the blue curve is the NDVI mean curve of different samples. By calculating the NDVI mean (μ) and standard deviation (σ) of each type of crop sample on a monthly basis, those samples that deviate seriously from the NDVI mean curve are filtered out, and only those samples whose monthly NDVI time series values fall within the range of μ±σ are retained to obtain purified samples. That is, all purified samples need to satisfy the following expression:
[0141]
[0142] In the formula, i is the serial number of the crop sample, A is the NDVI value of the crop sample, k is the crop type, t is the monthly time series number, T is the month range of the crop growth period time series, T = [5, 6, 7, 8, 9], μ k,t is the mean NDVI value of all sample points of crop k at time series t, σ k,t is the NDVI standard deviation of all sample points of crop k at time series t.
[0143] Based on the probability mean and the preset probability segmentation threshold, the crop classification label of each pixel in the target year can be determined in a variety of specific ways.
[0144] In one implementation, in step S105, the crop classification label of each pixel in the target year is determined based on the probability mean and the preset probability segmentation threshold, specifically: the probability means of each crop category in the target year at the same pixel position are compared one by one with the preset probability segmentation threshold, if the first probability mean is greater than the probability segmentation threshold, the crop category corresponding to the first probability mean is used as the crop classification label of the pixel in the target year; the first probability mean is any one of the probability means of each crop category at the pixel position.
[0145] The crop classification labels of the target year can be obtained as follows:
[0146]
[0147] In the formula, Type i is the final category of pixel i, that is, the final crop classification label of pixel i, soybean is soybean, maize is corn, and othercrop is other crops. The crop classification labels of the above pixels can be represented by different codes, such as 1-soybean, 2-maize, 3-othercrop. If it is impossible to determine what crop type the pixel belongs to, that is, the type is uncertain, the pixel is assigned a value of 0; N p is the probability segmentation threshold; are the mean probabilities that pixel i belongs to corn, soybean and other crops respectively.
[0148] From the above formula, it can be seen that if are all less than the probability segmentation threshold N p , it is impossible to determine which crop type the pixel belongs to, and it is assigned a value of 0, making it an invalid pixel. In other words, the probability segmentation threshold is used to control the validity of the pixel. If the probability of the pixel belonging to each crop type is relatively average, it can be considered that the pixel has no dominant crop type, and the value is assigned to 0, making it an invalid pixel, and it will not participate in the generation of historical crop samples in the later stage. Such processing can further improve the quality of the sample.
[0149] It should be noted that in order to ensure that the pixels have unique categories, N p Set to N p ≥0.5.
[0150] Furthermore, in this embodiment, N p The specific setting is 0.7.
[0151] Refer to the following Figure 5 The above process is described. Figure 5 The probability mean of pixel 1 belonging to Class A crops is 0.18, the probability mean of pixel 1 belonging to Class B crops is 0.7, and the probability mean of pixel 1 belonging to Class C crops is 0.12. The first probability mean refers to any one of the three probability means. The three probability means are compared with the probability segmentation threshold of 0.7 one by one. Only the probability mean of Class B crops is 0.7, which satisfies the condition that it is greater than or equal to the probability segmentation threshold. Therefore, the crop classification label of pixel 1 in the target year is finally marked as Class B crops. Similarly, the crop types of pixels 2 and 3 can be determined according to the above steps.
[0152] In the above embodiment, the method of determining the crop classification label by comparing each probability mean of each pixel with the probability segmentation threshold one by one can determine the crop classification label, but the execution process requires more cyclic comparison operations and is slightly inefficient.
[0153] To improve computational efficiency, as another optional implementation method, in step S105, the crop classification label of each pixel in the target year is determined based on the probability mean and the preset probability segmentation threshold, specifically: the maximum value of the probability mean of each crop category in the target year at the same pixel position is obtained, recorded as the second probability mean; the second probability mean is compared with the preset probability segmentation threshold, if the second probability mean is greater than the probability segmentation threshold, the crop category corresponding to the second probability mean is used as the crop classification label of the pixel in the target year.
[0154] Refer again Figure 5 . Figure 5 The mean probability of pixel 1 belonging to crop A is 0.18, the mean probability of pixel 1 belonging to crop B is 0.7, and the mean probability of pixel 1 belonging to crop C is 0.12. The maximum mean probability of the three types of crops A, B, and C is P(B) = 0.7, and the mean probability is greater than or equal to the preset probability segmentation threshold N. p =0.7, so the final crop classification label of this pixel is Class B crop. The crop classification labels of other pixels are determined in the same way. For example, the green-marked pixel 2 is finally marked as Class A crop, and the yellow-marked pixel 3 is finally marked as Class C crop.
[0155] This embodiment adopts a method of first extracting the maximum value of the probability mean and then comparing it with the probability segmentation threshold to determine the crop classification label of the target year, which can make the calculation process more concise and improve the calculation efficiency.
[0156] Combine the following Figure 2 The overall technical steps of the method for automatic classification of crops based on generating samples by model migration provided in this application are exemplified.
[0157] like Figure 2 As shown, the method for automatic classification of crops based on model migration and sample generation provided in this application can be performed in the following steps:
[0158] Step (a): Data input. The acquired data include crop thematic maps of the three historical years of 2017, 2018, and 2019 and Sentinel-2 remote sensing images (time series data) of 2017, 2018, 2019, and 2020. Among them, the crop thematic maps of the three historical years of 2017, 2018, and 2019 are used to generate crop samples of historical years, and the Sentinel-2 remote sensing images of 2017, 2018, 2019, and 2020 are used to provide input features of the corresponding years for model training.
[0159] Step (b): Historical sample generation and purification. Specifically, the following steps are included: defining the optimal focal radius (optimal radius), generating historical crop samples, and purifying samples, and finally obtaining crop sample data for three historical years, 2017, 2018, and 2019.
[0160] Step (c): Model migration and target year sample generation. Specifically, the following steps are included: using the crop sample data of the three historical years of 2017, 2018, and 2019 and the Sentinel-2 remote sensing data of the three historical years of 2017, 2018, and 2019, the models of the three historical years of 2017, 2018, and 2019 are trained, and the Sentinel-2 remote sensing data of 2020 are respectively input into the trained models of the three historical years to obtain the three crop probability maps of 2020, and the sample data of 2020 is generated using the crop probability maps, and then the model of 2020 is trained based on the sample data of 2020.
[0161] Step (d): Mapping and accuracy evaluation of classification results for the target year. Use the 2020 (target year) model to classify crops, visually interpret them in combination with ground reference data, and then perform accuracy evaluation.
[0162] In order to verify the effectiveness of the method provided in this embodiment, the relevant experiments are described in detail below.
[0163] In this embodiment, a county in Northeast China that was affected by the disaster was selected as the study area, and the target year samples were generated and classified by random forest classification based on the Sentinel-2 time series data and historical crop thematic maps. First, the three-year historical crop thematic maps of the study area in 2017, 2018 and 2019 were obtained through field survey data of each historical year, and historical year samples were generated and purified to extract stable and representative crop samples in 2017, 2018 and 2019. Secondly, model migration and target year sample generation were performed. The models of multiple historical years were applied to the target year to generate the probability map of the target year, and then multiple probability maps were integrated to generate high-confidence samples of the target year. Finally, the target year classification and accuracy evaluation were performed. The model of the target year was trained using high-confidence target year samples, the target year was classified, and the accuracy of the classification results was evaluated using ground truth samples.
[0164] Among them, the indicators of accuracy evaluation mainly include the overall accuracy (OA) obtained from the confusion matrix, the producer accuracy (PA), the user accuracy (UA) and the F1 score. The calculation formula of each indicator can be carried out with reference to the prior art, and this embodiment will not be described one by one here.
[0165] The experimental results of using the method provided in this application to classify crops in the target year of the study area are as follows: Figure 7 As shown, (a) is an overview of corn and soybeans in the study area. It can be seen from the figure that corn and soybeans are densely distributed in the southwestern part of the study area and sparsely distributed in the eastern and northern regions. Three typical sub-areas (Site1, Site2, Site3) in the study area are selected for local zooming, and local zoomed views as shown in (b) to (g) are obtained. From these local zoomed views, it can be seen that even when crops suffer from disasters and have abnormal growth periods, the method provided in this embodiment can still accurately classify corn and soybeans in sparsely and densely distributed areas of crops, and achieve good recognition results.
[0166] In order to verify the technical effect of the crop automatic classification method based on model migration and sample generation provided in this embodiment compared with the prior art, this embodiment also carried out a comparative experiment. Figure 6As shown, the prior art provides two ways to migrate historical crop information to the target year, one is sample migration and the other is model migration. In the comparative experiment, the implementation process of sample migration is as follows: 2019 is selected as the comparison year, and on the basis of the 2019 historical samples, the spectral angle (SAD) calculation method is used to migrate the 2019 samples to 2020, generate 2020 samples and classify the crops in 2020. The implementation process of model migration is as follows: the random forest model of the historical year (2019) is trained using the time series data of the historical year (2019) and the crop samples of the historical year (2019), and the model is directly applied to the time series data of the target year to obtain the crop classification results of the target year.
[0167] The classification results of sample migration and model migration were compared with the false color synthetic images of Sentinel-2, and compared with the experimental results of the method provided in this application. The results are as follows: Figure 8 As shown. Through visual observation, it is found that in the results generated by the existing sample migration and model migration, corn and soybeans at the edges of some plots are misclassified and missed to varying degrees (the areas circled by red lines in the figure), while the classification results of the method provided in this embodiment can accurately identify corn and soybeans in this area, and there is a clear classification boundary between corn, soybeans and other crops.
[0168] Using the same set of validation sample point data, the accuracy of the classification results of the existing sample migration, model migration, and the method provided by this application are evaluated respectively. The results are compared as follows:
[0169] Table 1 Comparison of classification accuracy of three methods in the study area
[0170]
[0171] As can be seen from Table 1, compared with sample migration and model migration, the method provided by this application shows higher accuracy in almost all indicators. By comparing with the other two methods (existing sample migration and model migration), it is proved that when the rotation pattern is complex or the phenological information of a single historical year does not match, the method of this application to generate samples of the target year can more accurately achieve crop mapping of the target year.
[0172] In summary, the automatic crop classification method based on model migration to generate samples provided in this embodiment obtains stable and representative crop samples of each historical year based on historical crop thematic maps of multiple historical years, and uses random forest classifiers to train models of multiple historical years. In the absence of samples of the target year, the prior art uses the method of migrating historical year models to the target year to achieve the classification of crops in the target year. Since crops are susceptible to frost disasters, pests and diseases, and pesticide disasters, it may cause the phenological information of corn or soybeans to be mismatched between years. The method of directly using a single year's historical crop classification model to migrate to the target year classification will result in low classification accuracy of crops in the target year. In order to avoid this influence, this embodiment does not use a single year's random forest model when performing model migration, but uses historical sample information of multiple historical years to train multiple random forest models, and migrates to the target year to obtain multiple target year's crop probability maps. The probability integrated map of the target year is obtained by integrating the crop probability maps of multiple target years. This method fully takes into account the problem that the phenological information of the same crop between years cannot be completely matched, resulting in a decrease in mapping accuracy. By integrating the phenological information of multiple historical years, it is ensured that the integration result (i.e., the probability integrated map) is similar to the phenological information of the target year. The probability integrated map of the target year generated by migrating models of multiple historical years can reflect the crop distribution of the target year to a certain extent, thereby improving the crop mapping accuracy of the target year.
[0173] The method provided in this embodiment does not require precise manual alignment of crop phenology between years, and can realize automatic generation of samples in the target year and automation of crop mapping. Compared with the existing model migration and sample migration methods, the method provided in this embodiment has achieved stable classification results in different study areas.
[0174] Embodiment 2:
[0175] This embodiment discloses an automatic crop classification system for generating samples based on model migration, including:
[0176] An extraction unit is configured to extract crop sample data of each historical year in the study area from historical crop thematic maps and historical remote sensing images of multiple historical years;
[0177] A training unit is configured to input the crop sample data of each historical year into the machine learning model for training, so as to obtain models of multiple historical years;
[0178] A first prediction unit is configured to input the remote sensing images of the target year into the models of multiple historical years respectively, predict the distribution of crops in the target year, and obtain multiple crop probability maps of the target year;
[0179] The first integration unit is configured to average multiple probability values belonging to the same crop category at the same pixel position in the multiple crop probability maps to obtain the probability average of each crop category in the target year;
[0180] The second integration unit is configured to determine the crop classification label of each pixel in the target year based on the probability mean and a preset probability segmentation threshold, and merge the probability mean of each pixel with the crop classification label to obtain a probability integration map;
[0181] The second prediction unit is configured to generate sample data of the target year based on the probability integration map and the remote sensing image of the target year, and use the sample data of the target year to retrain the machine learning model to obtain the model of the target year, and then use the model of the target year to obtain the automatic classification result of crops in the target year.
[0182] The automatic crop classification system for generating samples based on model migration disclosed in this embodiment can implement the steps and processes of the automatic crop classification method for generating samples based on model migration disclosed in any of the above embodiments, and achieve the same technical effects, which will not be repeated here one by one.
[0183] Embodiment three:
[0184] Based on the same technical concept, this embodiment provides an electronic device, the electronic device comprising:
[0185] one or more processors;
[0186] The computer-readable storage medium may be configured to store one or more programs, and when one or more processors execute the one or more programs, the following steps are implemented:
[0187] Extract the crop sample data of each historical year in the study area from the historical crop thematic maps and historical remote sensing images of multiple historical years;
[0188] Inputting the crop sample data of each historical year into a machine learning model for training to obtain models of multiple historical years;
[0189] Inputting the remote sensing images of the target year into the models of the multiple historical years respectively, predicting the crop distribution of the target year, and obtaining multiple crop probability maps of the target year;
[0190] Calculate the mean of multiple probability values belonging to the same crop category at the same pixel position in the plurality of crop probability maps to obtain the mean probability of each crop category in each pixel in the target year;
[0191] Based on the probability mean and a preset probability segmentation threshold, determine the crop classification label of each pixel in the target year, and combine the probability mean of each pixel with the crop classification label to obtain a probability integration map;
[0192] Based on the probability integration map and the remote sensing image of the target year, sample data of the target year is generated, and the sample data of the target year is used to retrain the machine learning model to obtain the model of the target year, and then the model of the target year is used to obtain the automatic classification result of crops in the target year.
[0193] This embodiment provides an electronic device, and the hardware structure of the electronic device may include: a processor, a communication interface, a computer-readable storage medium (also called a memory), and a communication bus.
[0194] The processor, the communication interface, and the computer-readable storage medium communicate with each other via a communication bus.
[0195] A computer-readable storage medium may be configured to store one or more programs.
[0196] Optionally, the communication interface may be an interface of a communication module, such as an interface of a GSM module.
[0197] The processor executes one or more programs, which implement the following steps: extracting crop sample data of each historical year in the study area from historical crop thematic maps and historical remote sensing images of multiple historical years;
[0198] Inputting the crop sample data of each historical year into a machine learning model for training to obtain models of multiple historical years;
[0199] Inputting the remote sensing images of the target year into the models of the multiple historical years respectively, predicting the crop distribution of the target year, and obtaining multiple crop probability maps of the target year;
[0200] Calculate the mean of multiple probability values belonging to the same crop category at the same pixel position in the plurality of crop probability maps to obtain the mean probability of each crop category in each pixel in the target year;
[0201] Based on the probability mean and a preset probability segmentation threshold, determine the crop classification label of each pixel in the target year, and combine the probability mean of each pixel with the crop classification label to obtain a probability integration map;
[0202] Based on the probability integration map and the remote sensing image of the target year, sample data of the target year is generated, and the sample data of the target year is used to retrain the machine learning model to obtain the model of the target year, and then the model of the target year is used to obtain the automatic classification result of crops in the target year.
[0203] The processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc. It may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0204] The electronic device of the embodiment of the present application exists in various forms, including but not limited to:
[0205] (1) Mobile communication devices: These devices are characterized by their mobile communication functions and their main purpose is to provide voice and data communications. These terminals include: smart phones (e.g., iPhone), multimedia phones, functional phones, and low-end phones.
[0206] (2) Ultra-mobile personal computer devices: These devices fall into the category of personal computers, have computing and processing capabilities, and generally also have mobile Internet access features. These terminals include: PDA, MID and UMPC devices, such as iPad.
[0207] (3) Portable entertainment devices: These devices can display and play multimedia content. They include audio and video players (such as iPods), handheld game consoles, e-books, smart toys, and portable car navigation devices.
[0208] (4) Server: A device that provides computing services. The server consists of a processor, hard disk, memory, system bus, etc. The server is similar to a general computer architecture, but because it needs to provide highly reliable services, it has higher requirements in terms of processing power, stability, reliability, security, scalability, and manageability.
[0209] (5) Other electronic devices with data interaction functions.
[0210] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.
[0211] The above-mentioned method according to the embodiment of the present application can be implemented in hardware, firmware, or implemented as software or computer code that can be stored in a recording medium (such as a CD ROM, RAM, floppy disk, hard disk or magneto-optical disk), or implemented as a computer code originally stored in a remote recording medium or a non-temporary machine storage medium downloaded through a network and to be stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor or programmable or dedicated hardware (such as an ASIC or FPGA). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method for automatic classification of crops based on model migration generation samples described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the method shown herein, the execution of the code converts the general-purpose computer into a dedicated computer for executing the method shown herein.
[0212] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and constraints involved in the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.
[0213] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0214] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for automatic classification of crops based on sample generation based on model migration, characterized in that: The steps include: Extract the crop sample data of each historical year in the study area from the historical crop thematic maps and historical remote sensing images of multiple historical years; Inputting the crop sample data of each historical year into a machine learning model for training to obtain models of multiple historical years; Inputting the remote sensing images of the target year into the models of the multiple historical years respectively, predicting the crop distribution of the target year, and obtaining multiple crop probability maps of the target year; Calculate the mean of multiple probability values belonging to the same crop category at the same pixel position in the plurality of crop probability maps to obtain the mean probability of each crop category in each pixel in the target year; Based on the probability mean and a preset probability segmentation threshold, determine the crop classification label of each pixel in the target year, and combine the probability mean of each pixel with the crop classification label to obtain a probability integration map; Based on the probability integration map and the remote sensing image of the target year, sample data of the target year is generated, and the sample data of the target year is used to retrain the machine learning model to obtain the model of the target year, and then the model of the target year is used to obtain the automatic classification result of crops in the target year.
2. The method according to claim 1, characterized in that The method of determining the crop classification label of each pixel in the target year based on the probability mean and the preset probability segmentation threshold is as follows: The probability mean of each crop category in the target year at the same pixel position is compared with the preset probability segmentation threshold one by one. If the first probability mean is greater than or equal to the probability segmentation threshold, the crop category corresponding to the first probability mean is used as the crop classification label of the pixel in the target year; The first probability mean is any one of the probability means of each crop category at the pixel location.
3. The method according to claim 1, characterized in that The method of determining the crop classification label of each pixel in the target year based on the probability mean and the preset probability segmentation threshold is as follows: Obtain the maximum value of the probability mean of each crop category in the target year at the same pixel location, recorded as the second probability mean; The second probability mean is compared with a preset probability segmentation threshold. If the second probability mean is greater than the probability segmentation threshold, the crop category corresponding to the second probability mean is used as the crop classification label of the pixel in the target year.
4. The method according to claim 1, characterized in that: The crop sample data of each historical year in the study area are extracted from the historical crop thematic maps and historical remote sensing images of multiple historical years, including: For each historical crop thematic map of a historical year, a morphological method is used to determine the minimum homogeneous area of each crop on the historical crop thematic map, and samples of each category of crops in the historical year are generated within the scope of the minimum homogeneous area in combination with the historical remote sensing image; Performing normalized vegetation index time series analysis and filtering on samples of various categories of crops in historical years to obtain purified samples, and using the purified samples as the final crop samples of each historical year in the study area; Wherein, the normalized vegetation index is calculated using the spectral information of the historical remote sensing image.
5. The method according to claim 4, characterized in that The morphological method is used to determine the minimum homogeneous area of each crop on the historical crop thematic map, including: Determine a plurality of focal radii, and generate a corresponding homogeneous area in the historical crop thematic map based on each of the focal radii; Randomly generate random points on the historical crop thematic map, and extract points falling within each homogeneous area to obtain homogeneous points of different crops; Calculating the normalized vegetation index of all homogeneous points of each crop category at different focal radii during the vigorous growth period using the spectral information of the historical remote sensing images, and calculating the mean and standard deviation of the normalized vegetation index during the vigorous growth period; Draw relationship curves between different focal radii, the mean value and the standard deviation respectively; The focal radius corresponding to when the relationship curve initially reaches stability is determined as the optimal radius, and morphological operations are performed based on the optimal radius to obtain a corresponding neighborhood range as the minimum homogeneous area of each crop.
6. The method according to claim 4, characterized in that The samples of various types of crops in historical years were analyzed and filtered using the normalized vegetation index time series to obtain purified samples, including: The mean and standard deviation of the normalized vegetation index of each category of crop samples were calculated on a monthly basis, and the normalized vegetation index mean curve was drawn. The crop samples whose normalized vegetation index values deviated from the mean curve by more than or equal to one standard deviation were filtered out to obtain purified samples.
7. The method according to claim 1, characterized in that The machine learning model is a random forest model.
8. An automatic crop classification system based on model migration to generate samples, characterized in that: include: An extraction unit is configured to extract crop sample data of each historical year in the study area from historical crop thematic maps and historical remote sensing images of multiple historical years; A training unit is configured to input the crop sample data of each historical year into a machine learning model for training to obtain models of multiple historical years; A first prediction unit is configured to input the remote sensing images of the target year into the models of the multiple historical years respectively, predict the crop distribution of the target year, and obtain multiple crop probability maps of the target year; The first integration unit is configured to average multiple probability values belonging to the same crop category at the same pixel position in the plurality of crop probability maps to obtain the probability average of each crop category in the target year; A second integration unit is configured to determine the crop classification label of each pixel in the target year based on the probability mean and a preset probability segmentation threshold, and merge the probability mean of each pixel with the crop classification label to obtain a probability integration map; The second prediction unit is configured to generate sample data of the target year based on the probability integration map and the remote sensing image of the target year, and use the sample data of the target year to retrain the machine learning model to obtain the model of the target year, and then use the model of the target year to obtain the automatic classification result of crops in the target year.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for automatic classification of crops based on generating samples based on model migration as described in any one of claims 1 to 7 is implemented.
10. An electronic device, characterized in that: include: A memory, a processor, and a program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for automatically classifying crops based on generating samples based on model migration as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Remote sensing classification method combining full convolutional neural network and ensemble learning
CN115147730A
Crop pest identification method and system based on deep integration model
CN116524246A
Sample-free crop classification method and device based on multi-source satellite remote sensing
CN116664959A
Crop disease image identification method and system
CN116758412A
Farmland abandoned land identification method and system
CN118247651A