This case demonstrates building classification through binary classification, utilizing machine learning to automatically extract building vector surfaces from regional image data. It outlines the workflow from Python environment configuration to data preparation, model training, and final binary classification execution when no pre-existing model is available.
1. Prepare Sample Data
Label partial zonal data in source imagery for binary classification to generate training samples. Key steps include:
- Open Image Files: Access TIF data via file database at resources_ml\example_data\training\binary_CLS_train_data\raw. Display imagery in map window.
- Prepare Sample Imagery: Create file datasource Sample.udbx. Crop two color building images into LabelDatasource, naming results as SampleImage_1 and SampleImage_2. Export cropped images as TIFFs. Open these TIFFs in workspace via file database and add to map windows.
- Prepare Sample Labels: Create new region dataset SampleLabel_1. Add to SampleImage_1 and SampleImage_2 maps. With SampleLabel_1 and SampleImage_2 layers editable, use Object Operation → Drawing → Polygon to vectorize buildings. Results shown below:
2. Generate Training Data
Generate training datasets from labeled data and imagery, storing in unified path:
First Training Dataset
- Entry: Toolbox → Machine Learning → Imagery Analysis → Generate Training Data.
- Sources: Image Data = SampleImage_1, Label Data = SampleLabel_1
- Tile size: 512×512 pixels
- Purpose: Binary Classification
- Output: E:\AI\Data\TrainingData\building_training_data
- Output includes tiled imagery/labels and configuration file building_training_data.sda.
Second Training Dataset
- Reopen Generate Training Data tool
- Sources: Image Data = SampleImage_2, Label Data = SampleLabel_2
- Consistent parameters: 512×512 tiles, Binary Classification, same output path/name
- Merged results shown:
3. Model Training
- Training data path: E:\AI\data\training\building_training_data
- Config file: resources_ml\trainer_config\binary_CLS_train_config.sdt
- Purpose: Binary Classification
- Epochs: 10
- Log path: E:\AI\Data\TrainingModel\log
- Model path: E:\AI\Data\TrainingModel\Model\building_model
- Execution time: 10-70 minutes (GPU). Output: building_model.sdm
4. Model Application: Building Extraction
- Source Data: Target imagery
- Model File: E:\AI\Data\TrainingModel\Model\building_model\building_model.sdm
- Tile overlap: 60 pixels
- GPU processing (~15 mins) produces building extraction results:
Related Topics
Machine Learning Environment Configuration