TerraScan: EfficientNet-B0 for land use in Gujarat, India (Sentinel-2)

An EfficientNet-B0 that sorts small Sentinel-2 satellite patches (64 x 64 px, 10 m per pixel, so 640 m x 640 m) into the 10 EuroSAT land-use classes. It was first trained on European images (EuroSAT), then fine-tuned on a small set of hand-checked Indian patches. Part of the TerraScan project.

Read "Limitations" before using it. It is a portfolio / learning project, not a mapping product. The Indian test set is tiny (81 patches), and the model gets about 32% of them wrong there (3-seed mean).

Result in one table

Indian test = 81 patches from 2 areas the model never saw (Vadodara outskirts, Sanand farmland), from viranshul/terrascan-india-gujarat. Values are mean ± std over 3 training seeds (42, 43, 44). Source: results/india_after.json in the repo.

Before fine-tuning (Europe only) After fine-tuning
Indian test accuracy 0.4486 ± 0.0071 0.6831 ± 0.0311
Indian test macro-F1 0.3729 ± 0.0028 0.4749 ± 0.0126
EuroSAT test accuracy (4050 images) 0.9869 ± 0.0013 0.9828 ± 0.0006
  • Fine-tuning moved Indian test accuracy by 23.5 percentage points. The two ranges do not overlap.
  • EuroSAT test accuracy went down by 0.4 percentage points. That is small, but the ranges do not overlap either, so the drop is probably real (3 seeds only).
  • The uploaded file is seed 42 only. Its own Indian test accuracy is 0.7160 after fine-tuning (95% bootstrap range 0.62-0.81, which is wide because there are only 81 patches). Use the 3-seed numbers above for "how good is this recipe"; seed 42 is one draw from that spread.
  • Macro-F1 on the Indian test set is only averaged over classes that appear there (River and SeaLake have 0 test patches).

Seed 42, per class (Indian test, after fine-tuning)

Classes with 1 to 5 test patches give very unreliable F1 scores.

Class Test patches Predicted as this class F1
AnnualCrop 25 22 0.68
Forest 4 1 0.40
HerbaceousVegetation 5 7 0.50
Highway 8 11 0.84
Industrial 6 8 0.57
Pasture 1 0 0.00
PermanentCrop 2 5 0.00
Residential 30 27 0.91

What the model is

  • EfficientNet-B0 (4,020,358 parameters), start weights efficientnet_b0.ra_in1k from timm (ImageNet-1k, Apache-2.0), last layer replaced by 10 outputs.
  • Input: RGB patch scaled up from 64 x 64 to 128 x 128 (bilinear), values 0-1, then ImageNet mean/std. Output: 10 class scores.
  • Classes (in this order): AnnualCrop, Forest, HerbaceousVegetation, Highway, Industrial, Pasture, PermanentCrop, Residential, River, SeaLake (onnx_info.json lists them too).
  • Files: model.onnx (CPU inference with onnxruntime, no PyTorch), best.pt (PyTorch state dict; load it with timm.create_model("efficientnet_b0", pretrained=False, num_classes=10)), config.yaml, onnx_info.json.
  • The ONNX file matches the PyTorch weights: largest difference in the scores on 20 Indian test patches is 7.2e-06 (results/onnx_check.json).
  • Speed on one CPU thread, batch 1, model only (no image reading), EuroSAT-trained version of this network on the training laptop: 7.7 ms per patch (results/efficientnet_b0.json). The fine-tuned model has the same size.

How it was trained

  1. EuroSAT (RGB version, 27,000 images, 10 classes), split 70 / 15 / 15 once and reused by every model. AdamW, learning rate 0.001, weight decay 0.05, cosine schedule, label smoothing 0.1, 50 epochs, batch size 64, flips and 90-degree rotations plus a little colour jitter. The epoch with the lowest validation loss is kept. The test split was used for final reporting only.
  2. Fine-tuning on India: 149 labelled patches from 3 areas (Ahmedabad city, Narmada at Bharuch, Ankleshwar industrial). All layers, learning rate 0.0001, 10 epochs, batch size 32. Every epoch also mixes in 600 fresh EuroSAT training images, because an Indian-only first try made the model forget Europe (EuroSAT validation accuracy fell to between 0.64 and 0.77; kept in the repo as evidence). Nothing was tuned on the Indian test areas; there is no Indian validation set, so the last epoch is kept.

The Indian split is by area, so look-alike neighbouring patches never sit on both sides.

How to use it

The model expects images that look like EuroSAT, which was made from Sentinel-2 Level-1C. Level-2A scenes (from Microsoft Planetary Computer) need the colour adjustment in src/imagery.py (fitted numbers: results/imagery_calibration.json) and the EuroSAT stretch before they go in. Skip this and the colours are off, and so are the predictions.

# pip install onnxruntime numpy huggingface_hub   (and clone the TerraScan repo for src/onnx_predict.py)
import numpy as np
from huggingface_hub import hf_hub_download
from src.onnx_predict import load_model, predict

onnx_path = hf_hub_download("viranshul/terrascan-efficientnet-b0-india", "model.onnx")
info_path = hf_hub_download("viranshul/terrascan-efficientnet-b0-india", "onnx_info.json")
session, info = load_model(onnx_path, info_path)

patches = np.zeros((1, 64, 64, 3), dtype=np.uint8)   # replace with real uint8 RGB patches, shape (N, 64, 64, 3)
class_numbers, confidence = predict(session, info, patches)
print(info["classes"][class_numbers[0]], confidence[0])

Change study (Ahmedabad, 2018 vs 2026)

The model was run on 2112 patches (a box of about 30 x 28 km around Ahmedabad) in Dec-Feb 2017/18 and Dec-Feb 2025/26. For the map from this model (seed 42) it reported 319 km2 where the predicted class changed. To check, 50 random "changed" patches were looked at as before/after pairs: 51% of the judged pairs showed a real change (95% range 37%-65%), so the likely real change is about 163 km2 (95% range 119-207 km2). Roughly half of what the model calls change is the model changing its mind, not the land (results/change_check.json).

Limitations

  • Small, uneven Indian test set. 81 patches, 8 classes present, some with 1 to 5 patches. Only 3 seeds. Accuracy has a wide uncertainty range; do not compare it to other papers' numbers.
  • Narrow data. 5 areas in one state (Gujarat), dry season only (January-February 2026), one scene per area. It has not been tested on other Indian regions, monsoon scenes, or other countries.
  • Patches that fit no class were left out of the Indian data (bare plots, construction, mudflats, scrub), so real performance on "any Indian land" is lower than the test number suggests.
  • Fine-tuned on very few patches. Some classes have 0 or 1 Indian training patch (Pasture 0, Forest 1, HerbaceousVegetation 1), so the model has barely seen them in India.
  • Slightly worse in Europe after fine-tuning (see the table).
  • Colour pipeline matters. The Level-2A to Level-1C colour fit used only 3 European summer scenes. India in January still looked a bit brighter and bluer than EuroSAT after it (results/imagery_check.json).
  • Labels are a judgement call. All labels were reviewed by a human (one reviewer, no second opinion). Details are in the dataset card.
  • Change maps over-report. About half of the squares the model marks as changed show no real change.
  • RGB only, one 10 m patch at a time, no time series, no cloud mask beyond picking clear scenes.
  • Not for decisions about land, property, safety or policy.

Credits and licence

Model files and this card: Apache-2.0. Start weights: timm efficientnet_b0.ra_in1k, Apache-2.0 (ImageNet-1k training data). EuroSAT: MIT licence, Helber et al. (2019), EuroSAT: A Novel Dataset and Deep Learning Benchmark for Land Use and Land Cover Classification. Contains modified Copernicus Sentinel data 2017, 2018, 2025 and 2026.

Downloads last month
30
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for viranshul/terrascan-efficientnet-b0-india

Quantized
(4)
this model

Dataset used to train viranshul/terrascan-efficientnet-b0-india

Paper for viranshul/terrascan-efficientnet-b0-india