Skip to main content
GIS-Schools GIS-Schools
Classification ยท GeoAI

Synthetic Land-cover Classifier - Learning Demo

Learn the complete train-and-predict workflow with a small, transparent model and synthetic land-cover samples. Includes Python code, data and a downloadable JSON model.

Classification task illustration
Family: Statistical machine learningArchitecture: Nearest-centroid classifierVersion: 1.0License: CC0 1.0 - original code, model and synthetic data
Synthetic Land-cover Classifier - Learning Demo

What this model does

This original educational demo classifies four synthetic reflectance values as Water, Vegetation or Bare soil. It is a small statistical nearest-centroid model, not a pretrained satellite foundation model.

Inputs and outputs

Provide blue, green, red and near-infrared values between 0 and 1 in CSV columns named blue, green, red and nir. The output is a predicted class for each sample.

Requirements

Python 3.9 or later. Standard library only: no GPU, account or paid service is required.

How to train

Download and extract the resource ZIP. Open a terminal in that folder and run:

python train.py --data training.csv --output model.json

The supplied training.csv contains 180 synthetic labelled samples. Training calculates the average band values for each class and saves a readable JSON model.

How to run a prediction

python predict.py --model model.json --data samples.csv --output predictions.csv

The included three samples provide a basic smoke test. They are not an independent accuracy evaluation.

Use your own data

Prepare labelled CSV samples with the same band order and reflectance scaling, then retrain. Use independent spatial training, validation and test regions. Satellite imagery also needs cloud masking, no-data handling and sensor-specific preparation. These scripts do not read GeoTIFFs or preserve a coordinate reference system.

Limitations

All training data and illustrations are synthetic. This model has not been validated on real satellite imagery. It always selects one of the three classes and provides no calibrated confidence or unknown class. Do not use its synthetic centroids for operational mapping.

Included files

  • model.json - trained synthetic demo model
  • train.py and predict.py - runnable Python scripts
  • training.csv and samples.csv - synthetic data
  • README.md and predictions.csv - instructions and example output

Examples and images

Downloads and resources

Hosted on GISSchoolsDemo model, training code and synthetic dataset (ZIP)
Download Model
Discussion

Comments

0

No comments yet. Start the discussion.

Join the discussion

Leave a reply

Your email address will not be published. Required fields are marked.