7 LULC Map Generation
Module Overview
This module performs supervised Random Forest classification to generate a land cover map. It includes input review, hyperparameter definition, feature extraction, model training, hard/soft classification, feature importance, and accuracy evaluation using test data.
Input
| Name of input | Input type | Details |
|---|---|---|
| Sample data split proportion | User’s input | Optional, if not set then use default value |
| Random Forest (RF) parameters | User’s input | Optional, if not set then use default value |
| Satellite imagery within the AOI | Input from other modules | Module 1 |
| LULC classes | Input from other modules | Module 2, including the selection of the classes of interest if the user uses the default classification scheme. |
| Sample data | Input from other modules | Module 3 |
Output
- Trained LULC classification model.
- Model accuracy report if validation data available (including overall accuracy, precision, recall, F1-score, Kappa, model error matrix). This output is only available if the user has a validation data from the splitted the sample data
- Classified LULC raster map.
Process
This module cannot be accessed if the system is missing the required inputs from the Input from Other Modules
7.1 Checking Prerequisites from Previous Modules
This is a part of System Response 6.1: Reviewing input specifications for model training
7.1.1 Checking Prerequisites from Previous Modules
Luma User Journey
- The user is displayed a verification of the required inputs stored in the system.
Luma Geospatial Engine
- The system validates availability of the required inputs.
7.2 Extracting spectral feature from sample data
7.2.1 Splitting the sample data
Luma User Journey
The user defines the proportion to split the sample data into training and validation dataset.
If the user does not split the sample data, the system shows a warning that all the sample data will be used as training data.
The user is required to set feature extraction parameter, including class label column and the pixel size.
NoteSuccess NotificationThe system shows a confirmation that feature extraction has been completed, and the summary of the number of training data and validation data split.
Luma Geospatial Engine
The system conducts feature extraction for both training and validation data accordingly to the proportion set by the user.
The system uses stratified random split method to conduct the data splitting. This method randomly selects samples within each class to proportionally create training and testing sets while preserving class distribution.
TipRelated Functionsclassification.FeatureExtraction.stratified_split(): performs stratified random split of sample data based on LULC class labels.
7.3 Creating classification model
7.3.1 Creating classification model
Luma User Journey
This is a part of User Journey 6.2: Determining classification’s specification
The user is given the option to use default value of the RF parameters. The default value are as the following:
- Number of trees: 50, 100, or 150 are given as options
- Variables per split: square root of total spectral band features used
- Minimum leaf population: 1
The user is given the option to manually configure the classification parameter:
- Number of trees
- Variables per split: square root of total spectral band features used, or can adjust manually
- Minimum leaf population
The user is prompted to verify the inputs and run the process to create the classification model.
ImportantError Handling NotificationThe process to create a classification model is disabled if the user has not extracted the spectral feature
NoteSuccess NotificationThe system shows a confirmation that a classification model has been created.
Luma Geospatial Engine
This is a part of System Response 6.2: Classification process
The system create the classification model using hard classification method.
TipRelated Functionsclassification.Generate_LULC.hard_classification(): trains a RF classifier (smileRandomForest) using extracted training data and applies it to the input imagery to produce a hard (pixel-level) multiclass.
7.3.2 Reviewing classification model’s quality
Luma User Journey
This is a part of User Journey 6.3: Review classification result
The user is shown a feature-importance graph displaying each variable used to train the classification model. In this development phase, only spectral bands are used as classification variables.
The user is prompted to begin the process of calculating the model’s accuracy assessment.
NoteSuccess NotificationThe system shows a confirmation of the completion of model accuracy assessment.
The user is shown the results of the model’s accuracy assessment, presented in the following structure:
Overall model accuracy (overall accuracy percentage, kappa coefficient, average F1-score, and G-Mean score)
Class-level accuracy (producer’s accuracy, user’s accuracy, F1-score, and G-Mean score), also visualized in a confusion matrix with an accompanying highlight summary of the LULC classes with the lowest accuracy.
Luma Geospatial Engine
This is a part of System Response 6.3: Testing model’s accuracy
The system extracts feature importance from the trained Random Forest model and presents a ranked table of bands (or a fallback equal-weight estimate if true importance is unavailable).
TipRelated Functionsclassification.Generate_LULC.get_feature_importance(): extracts and returns model feature importance as a dataframe; if the model explanation is not available, falls back to an equal-weight estimate.The system calculates model evaluation metrics on the validation dataset. This option only available if the user perform data split.
TipRelated Functionsclassification.Generate_LULC.evaluate_model():classifies the validation data with the trained classifier, builds the confusion matrix, and returns a dictionary of accuracy metricsConfusion matrix and model accuracy summary are then rendered in the user-interface.
7.3.3 Visualizing LULC classification map result
Luma User Journey
The user can visualizes the LULC classification result on a canvas map along with the training data layer.
The user is given the option to adjust the class color visualization, or to reset it accordingly with the saved determined color saved in Module 2.
If the user selected a subset of classes of the default classes in Module 2, the map will only show the classes of the user’s interest. The rest of the default classes that are not selected will be shown as “Others”.
Luma Geospatial Engine
The system loads the user’s class of interest stored from Module 2.
The system reclassifies the default classification scheme’s map into a map that only shows the user’s class of interest and an additional class labeled as “Others”.
TipRelated Functionsclassification.Generate_LULC.reclassify_map_by_classes(): reclassifies the default classification scheme final map to only show the user’s class of interest and show the other classes as “Others”.
7.3.4 Downloading the LULC classification map result
Luma User Journey
This step is optional for the user.
The user can download the classified LULC map through two options:
- Direct download: Downloads the image locally in the user’s device. This option is only available if the classification map result is less than 32 MB.
NoteSuccess NotificationThe system shows a confirmation if the URL for direct download of classified LULC map is successfully made.
ImportantError Handling NotificationThe system provides an error notification if the system fails to create the URL for direct download and suggests the user to use Google Cloud Storage instead.
- Export to Google Cloud Storage: Downloads the image to Google Cloud Storage.
NoteSuccess NotificationThe system shows a confirmation if the classified LULC map is successfully saved to Google Cloud Storage.
ImportantError Handling NotificationThe system provides an error notification if the system fails to export the classified LULC map to Google Cloud Storage.
Luma Geospatial Engine
This sub-step does not involve any operations from Luma Geospatial Engine. Direct download settings are defined from Streamlit, using the same workflow as defined in Section 2.5.
For details on exporting to Google Cloud Storage, refer to Earth Engine Initialization and Authentication page.