A satellite tile of 1.2 km by 1.2 km holds forest, pasture, a river and a village at once. Near-infrared light shows the plants your eye misses, and a sigmoid head names every cover in the tile, not only the biggest.
Switch the view between natural colour, near-infrared and NDVI. Then switch the output head from softmax to sigmoid, and turn the river off. Then we build, piece by piece, the pixels, the bands, the classifier, the pretraining and the score.
You need a little Python and what a probability is. A rough idea of a neural network helps. We build the rest from zero.
Datasets and models named on this page: EuroSAT (Helber et al.), BigEarthNet (Sumbul et al.), NWPU-RESISC45 (Cheng et al.), AID (Xia et al.), UC Merced (Yang and Newsam), SatMAE (Cong et al.) and Prithvi (Jakubik et al.).
Illustrative. The tile is drawn from made-up reflectance numbers of the right size for each cover, and the "model" scores a cover from its true share of the tile. The 1.2 km size is a BigEarthNet patch: 120 pixels at 10 m.
Chapter 0
See why an overhead tile defeats an ordinary photo classifier, and which two surprises fix it
A satellite passes 786 km above Europe. It sends down one huge image. You cut it into small squares, called tiles, and put one word on each: forest, pasture, river, residential. A farm agency counts lost fields this way. A climate team counts lost forest.
Remote-sensing scene classification is that job: give a land-use or land-cover label to an overhead tile. It is a cousin of ordinary scene classification, which names "kitchen" or "beach" in a phone photo. But the view is straight down. There is no horizon and no familiar object at a familiar size. A flat roof and a parking lot are both grey squares.
Two surprises shape this lesson. First, the sensor sees light your eye cannot. Sentinel-2 records 13 bands (slices of the light spectrum), including near-infrared (NIR), where healthy leaves shine bright. Second, a tile is rarely one thing. The honest answer is a set of labels.
Each pair looks alike in natural colour. Pick a pair, then switch the view and see which pairs the invisible band separates.
Illustrative reflectances (share of sunlight sent back, 0 to 1), chosen to match the usual shape of each surface. Real values vary with season, sensor and soil.
NIR splits water from shadowed grass and real grass from plastic turf. It does not split forest from a maize field: both are healthy plants. There, the model needs texture, such as crop rows. So the craft is to combine bands and texture into one decision.
The failure to avoid: run an off-the-shelf RGB photo model on satellite tiles. The symptom is confusion between water, shadow and dark crops. To measure it, read the confusion matrix for those classes. The fix is to feed the model the extra bands.
Chapter 1
Measure how much land one pixel covers, and count the tiles in one satellite scene
One pixel of a satellite image is a patch of ground. How big a patch? That number is the ground sampling distance (GSD): the width of ground that one pixel covers, in metres. Sentinel-2's sharpest bands have a GSD of 10 m. An aerial camera on a plane can reach 0.3 m.
A 120 m by 120 m street with houses, trees, a car and a pond. Pick a GSD and watch which objects survive.
Illustrative scene: 12 m houses, an 8 m road, a 4.5 m car, a 20 m pond. Each pixel is the average of the ground it covers.
At 10 m a house is about one pixel. "Residential" stops being a set of roofs and becomes a texture. So the GSD changes what a class looks like.
How much land does one tile show? Call the tile width in pixels p and the ground sampling distance g. The tile's width on the ground is the footprint, F.
F equals p times g.
Count the pixels across the tile, p. Multiply by the metres each pixel covers, g. The result F is the tile's width on the ground.
A EuroSAT tile has p = 64 at g = 10 m, so F = 640 m. A BigEarthNet patch has p = 120 at 10 m, so F = 1,200 m. A UC Merced image has p = 256 at 0.3 m, so F = 77 m: one city block.
A Sentinel-2 product comes in squares of 109.8 km, which is 10,980 pixels at 10 m. Call that scene width in pixels L. How many tiles, N, of width p fit in it without overlap?
N equals the floor of L over p, all squared.
Divide the scene width L by the tile width p and round down. That is the tiles in one row. Square it to get the tiles in the scene, N.
With p = 64: 10,980 / 64 = 171.6, round down to 171, so N = 171 × 171 = 29,241 tiles, and a 36-pixel strip is left over. With p = 120: 91 × 91 = 8,281 tiles.
One scene gives about 29,000 EuroSAT-sized tiles. Satellites send thousands of scenes a day, so pixels are cheap. Labels are not, and that gap drives Chapter 6.
Chapter 2
Place five public datasets by pixel size and tile size, and read what each one tests
Two words first. Land cover is the material on the ground: water, trees, concrete. Land use is what people do there: housing, industry, farming. A grass field is one cover, but it can be a park, a lawn or a golf course. Land use is harder, because the model must guess purpose from appearance.
Five datasets come up again and again. They differ in sensor, GSD, tile size and label structure.
| Dataset | Images | Classes | Sensor and GSD | Tile | Labels |
|---|---|---|---|---|---|
| UC Merced (2010) | 2,100 | 21 | aerial RGB, 0.3 m | 256 px | one per image |
| AID (2017) | 10,000 | 30 | Google Earth RGB, 0.5 to 8 m | 600 px | one per image |
| NWPU-RESISC45 (2017) | 31,500 | 45 | Google Earth RGB, 0.2 to 30 m | 256 px | one per image |
| EuroSAT (2019) | 27,000 | 10 | Sentinel-2, 13 bands, 10 m | 64 px | one per image |
| BigEarthNet (2019) | 590,326 | 43 or 19 | Sentinel-2, 12 bands, 10 m | 120 px | several per image |
Across: metres per pixel. Up: metres per tile. A bar means the GSD varies inside the dataset. Pick one to read it.
Counts, classes, GSD and tile sizes come from the dataset papers. The chart uses F = p × g from Chapter 1. Dot size grows with the number of classes.
The three aerial sets (UC Merced, AID, NWPU) are RGB land-use sets with fine pixels. They test fine distinctions such as "freeway" against "overpass". EuroSAT is the clean starter: 64-pixel Sentinel-2 tiles, one of ten covers each. Its paper reports 98.57% overall accuracy with a fine-tuned CNN.
BigEarthNet is the realistic one. Each 1.2 km patch carries every cover from the CORINE Land Cover map, 43 classes in the first release and a 19-class grouping later. A patch can be "coniferous forest", "pastures" and "water bodies" at once.
Chapter 3
Read the 13 Sentinel-2 bands as a stack, and turn two of them into a vegetation number
A multispectral sensor splits light into named bands and records one grey image per band. A Sentinel-2 tile is a stack of shape (13, H, W): 13 aligned grey images. An RGB photo gives a network 3 numbers per pixel. This gives 13.
| Group | Bands | Wavelength | GSD | Good for |
|---|---|---|---|---|
| Visible and NIR | B2 blue, B3 green, B4 red, B8 NIR | 490 to 842 nm | 10 m | colour, plants |
| Red edge and SWIR | B5, B6, B7, B8A, B11, B12 | 705 to 2190 nm | 20 m | plant health, soil, water |
| Atmosphere | B1 aerosol, B9 water vapour, B10 cirrus | 443, 945, 1375 nm | 60 m | correcting the air, finding clouds |
The bands come at three GSDs, so a pipeline resamples them to one grid first. BigEarthNet leaves out B10: the cirrus band sees thin cloud, not the ground.
Chlorophyll absorbs red light to drive photosynthesis. The cell structure of a leaf sends most NIR light back. So a healthy plant is dark in red and bright in NIR. Soil and concrete are similar in both. Water is dark in both, and darkest in NIR.
One number captures this. Call the NIR reflectance NIR and the red reflectance RED, each the share of sunlight sent back, from 0 to 1. The normalized difference vegetation index is NDVI.
NDVI equals NIR minus RED, divided by NIR plus RED.
Subtract RED from NIR: plants make this large. Divide by NIR plus RED, the pixel's total brightness. A shaded field and a sunny field of the same crop then give the same NDVI.
With made-up numbers: forest, NIR = 0.40 and RED = 0.04, gives 0.36 / 0.44 = 0.82. Bare soil, 0.30 and 0.22, gives 0.08 / 0.52 = 0.15. Water, 0.02 and 0.05, gives −0.03 / 0.07 = −0.43.
Set NIR and red for one pixel. Then dim the light, as a cloud shadow does, and watch the bars shrink while NDVI stays still.
The ruler's bands (water below 0, soil and concrete near 0.1, dense plants above 0.6) are typical ranges. The light knob scales both bands by the same factor.
The light knob shows the denominator's job. Halve the light and NIR minus RED halves too, but so does NIR plus RED. The ratio stays. Haze is different: it adds light to every band, and that does move NDVI. Chapter 8 breaks the classifier with it.
Other indices follow the same pattern. NDWI uses green and NIR to find water. NDBI uses SWIR and NIR to find built-up land.
Chapter 4
Widen one layer to take 13 bands, pool each feature over the tile, and turn scores into probabilities
The baseline is an ordinary convolutional neural network (CNN) with one change at the input. A photo CNN takes (3, 224, 224); this one takes (13, 64, 64). Only the first convolution changes: its weights go from (out, 3, k, k) to (out, 13, k, k).
Later layers shrink the grid to a feature map such as (256, 4, 4). Each channel lights up where one learned pattern appears, such as a grid of roofs.
Where the forest sits does not matter; how much there is does. So the network averages each channel over the grid. Call the feature map value of channel c at row h and column w Ac,h,w, the grid height H and width W. The pooled value is vc.
v-c equals one over H times W, times the sum over h and w of A-c-h-w.
Take one channel c. Add its value A-c-h-w in every cell. Divide by the number of cells, H times W. That average is v-c. Do it for every channel.
With made-up numbers on a 3 by 3 grid: 0.8, 0.9, 0.7, 0.1, 0.85, 0.6, 0.2, 0.75, 0.5 add to 5.4. Divide by 9: v-c = 0.60. The (256, 4, 4) map becomes a (256,) vector.
A linear layer then gives one score per class, a logit. Call the logit of class k zk, and the number of classes K. Softmax turns the logits into probabilities pk that add to 1.
p-k equals e to the z-k, divided by the sum over j of e to the z-j.
Raise e to each logit z-k. Add the results over all classes. Divide each by the total. The probabilities p-k add to 1, so one class goes up only if others go down.
With made-up logits, forest 4.0, pasture 2.5, herbaceous 2.0: ez = 54.60, 12.18, 7.39, total 74.17. So p = 0.736, 0.164, 0.100. The answer is forest at 74%.
Two channels of a 5 by 5 feature map: green fires on bright NIR, warm fires on roofs. Tap cells to switch them on or off and watch pooling, logits and softmax follow.
Illustrative weights. Logits: forest 4v1 − 2v2, pasture 2.5v1 − v2 + 0.5, residential 4v2 − v1, water 1.5 − 3v1 − 2v2.
Move the lit cells to another corner and nothing changes: pooling drops position on purpose. In PyTorch the whole change is one line, net.conv1 = nn.Conv2d(13, 64, 7, 2, 3, bias=False) on a ResNet. The catch: ImageNet weights exist only for 3 channels, so the new stem starts fresh or copies its RGB weights into the extra bands.
Chapter 5
Name the three shifts that a clean benchmark holds still and a real deployment does not
EuroSAT scores near 99%. So is the job done? No. That number comes from clean, single-label tiles of Europe at one GSD. A deployment changes all three.
| Shift | What changes | Example | Fix |
|---|---|---|---|
| Geography | the same class looks different | red-tile roofs in Germany, flat tan roofs and pools in Arizona | train on many regions; test on unseen ones |
| Resolution | the GSD, so what a class looks like | "industrial" is a texture at 10 m and a set of buildings at 0.5 m | match the GSD, or pretrain across scales |
| Mixed tiles | the label structure | a 1.2 km patch with forest, pasture, road and water | a multi-label head (Chapter 7) |
The left tile is "residential" in the training region. Drag the distance and watch the test tile change style while accuracy falls.
Illustrative curve, from 96% at home to 62% on another continent. Real drops depend on the model and the regions; the shape is the point.
Put a number on the mixed-tile problem. A tile is 50% forest, 30% pasture, 15% water and 5% road. A single-label dataset writes "forest". The model learns to say forest, and the grader marks it right. It also learns to push pasture, water and road down, though all three are there. The label format teaches the model to deny what it sees.
The failure: a model posts 96% on its own region and 64% abroad. The symptom is a field team that finds wrong maps. To measure it, test on a geographically disjoint split: train and test tiles from different regions. The fix is data from more places, not only a bigger network.
Chapter 6
Hide most of a tile, train a network to fill it in, and see why satellites add new ways to hide
Labels need experts or field visits, so they are scarce. Unlabelled pixels are almost free: Chapter 1 found 29,000 tiles in one scene. So learn from the unlabelled pixels first. Then fine-tune on the few labelled tiles. This is self-supervised pretraining, and it produces geospatial foundation models.
The main recipe is the masked autoencoder (MAE, He et al.). Cut the tile into square patches. Hide 75% of them. Give the network the rest and train it to rebuild the hidden pixels. The image is its own label. To fill a hidden forest patch, the network must learn what forest looks like.
Satellite data has axes a photo lacks: band groups and dates. SatMAE (Cong et al., 2022) groups the bands and masks each group on its own. It also masks patches across time. Its paper reports gains of up to 7% on benchmark datasets and up to 14% in transfer to land-cover classification. Prithvi (Jakubik et al., 2023) is a 100-million-parameter MAE from NASA and IBM, pretrained on more than 1 TB of Harmonized Landsat Sentinel-2 imagery and released openly. SpectralGPT masks 3-D cubes of space and spectrum.
Three band groups of one 6 by 6 tile. Set the mask ratio, then switch between one shared mask and an independent mask per group. The bottom grid marks places where some group is still visible.
Illustrative: 3 groups and 36 patches. SatMAE's real grouping and patch sizes differ; the counting is exact for any random mask.
With one shared mask at 75%, a hidden place is hidden in every group. With independent masks, the chance that a place is hidden in all three groups is 0.75 × 0.75 × 0.75 = 0.42. So 58% of places still show some band. To fill the hidden group there, the network must learn how bands relate, such as "bright NIR goes with dark red".
| Mode | What you train | When |
|---|---|---|
| Linear probe | a linear head on frozen features | few labels, little compute |
| Fine-tune | the whole network | many labels, the last points of accuracy |
| Few-shot | a tiny head on a handful of examples | a new region or class with almost no labels |
The failure: you mask 15%, as a text model does. The symptom is a low reconstruction loss but weak features. To measure it, run a linear probe on a small labelled set. The fix is a high ratio: fields and forests are smooth, so a hidden patch is easy to copy from its neighbours unless most of them are hidden too.
Chapter 7
Swap softmax for one sigmoid per cover, and train each cover as its own yes or no question
Softmax makes the probabilities add to 1, which says "exactly one class is right". For a tile of forest, pasture and water, that is false: if forest goes up, water goes down.
The fix scores each cover on its own. Call the logit of one cover z. The sigmoid turns it into a probability σ(z) that the cover is present, with no link to the other covers.
sigma of z equals one divided by one plus e to the minus z.
Take one cover's logit z. Compute e to the minus z, add 1, and divide 1 by the result. A logit of 0 gives 0.5. Do this for every cover; the answers need not add to 1.
With made-up logits forest 2.0, pasture 1.0, water 0.5: sigmoid gives 1/(1 + 0.135) = 0.881, 1/(1 + 0.368) = 0.731, 1/(1 + 0.607) = 0.622. They add to 2.23. Softmax on the same logits gives 0.629, 0.231, 0.140.
Set three logits. Under softmax the bars pull on each other. Under sigmoid each bar moves alone, and the threshold line picks the predicted set.
Training needs a loss to match. Each cover is a yes or no question. Call the true answer for cover k yk (1 if present, 0 if not), the predicted probability pk, and the number of covers K. The binary cross-entropy loss is L.
L equals minus one over K, times the sum over k of y-k times log p-k, plus one minus y-k times log of one minus p-k.
For each cover k, take the log of the chance the model gave to the true answer: p-k if y-k is 1, one minus p-k if y-k is 0. Average these logs over the K covers and flip the sign. A confident wrong answer costs the most.
With made-up numbers: forest y = 1, p = 0.9 costs 0.105; pasture y = 1, p = 0.6 costs 0.511; water y = 0, p = 0.2 costs 0.223; road y = 0, p = 0.05 costs 0.051. The average is L = 0.223. The weak pasture call costs the most.
The sigmoid adds one knob: a threshold per cover. A rare cover such as "beaches" may need a lower one to be caught. Softmax with one argmax has no such knob.
The failure: you take the top three softmax classes as the set. The symptom is a tile with one cover that gets three labels, and a tile with five that gets three. To measure it, compare the number of predicted labels with the true count per tile. The fix is the sigmoid head with tuned thresholds.
Chapter 8
Paint a tile, let a toy model read every pixel and name the covers, then break it with haze
This device puts the chapters together. You paint a 16 by 16 tile with five covers. The toy model reads each pixel's four bands (blue, green, red, NIR), matches it to the nearest known cover, and counts each cover's share. A sigmoid turns each share into a probability. Your threshold draws the predicted set. Yellow marks the truth: every cover that fills at least 5% of the tile.
Pick a brush and drag on the tile. Then raise the haze and watch covers fall out of the predicted set.
Illustrative toy model: nearest reference spectrum per pixel, then probability = sigmoid(60 × (share − 0.05)). Haze mixes each pixel with grey air light and adds noise. Real models learn their features, but they fail under haze in the same way.
Try three things.
Haze shows why NDVI's ratio is not enough. Dimming light scales both bands, and the ratio survives. Haze adds the same light to both bands, so NIR minus RED stays but NIR plus RED grows. NDVI falls. Real pipelines correct for the atmosphere first and mask clouds with bands such as B10.
With the numbers from the toy: a forest pixel has NIR 0.40 and red 0.04, so NDVI = 0.82. At 30% haze, NIR = 0.7 × 0.40 + 0.3 × 0.24 = 0.35 and red = 0.7 × 0.04 + 0.3 × 0.26 = 0.11. NDVI falls to 0.24 / 0.46 = 0.54, below pasture's 0.64.
Chapter 9
See why accuracy flatters a multi-label model, and rank tiles to compute average precision
With one label per tile, accuracy is the share of tiles you got right. With 19 covers, you could count the share of the 19 yes or no answers you got right. That number flatters. A tile has 3 of 19 covers. A model that says "nothing is here" is right on 16 of 19 answers: 84%. It found nothing.
The standard metric ranks instead. For one cover, sort all tiles by the model's score. A good model puts the tiles that truly have the cover at the top.
Precision at rank i is the share of the top i tiles that truly have the cover. Call it P(i). Mark rel(i) = 1 if the tile at rank i has the cover, 0 if not. Call the number of tiles that have it R. The average precision is AP.
A-P equals one over R, times the sum over i of P of i times rel of i.
Walk down the ranked tiles. At each tile that truly has the cover, write down the precision so far, P of i. Add those precisions and divide by R. The mean average precision (mAP) is the average of AP over all covers.
Five tiles ranked by water score; the truth in rank order is yes, yes, no, yes, no. The hits are at ranks 1, 2 and 4: precisions 1/1, 2/2, 3/4. AP = (1.00 + 1.00 + 0.75) / 3 = 0.917. A perfect order gives 1.00.
Eight tiles, ranked by the model's water score. Yellow tiles truly contain water. Tap a tile to move it up one place.
Illustrative ranking of eight tiles, four with water.
AP reads the whole ranking, so one bad threshold cannot spoil it. Averaging per cover gives a rare cover the same weight as a common one. BigEarthNet papers report results this way.
The failure: a 90% mAP on a random split of Europe. The symptom is a drop in a new country. To measure it, report mAP on a geographically disjoint split as well. The fix is to quote both numbers and the per-cover AP for rare covers.
Chapter 10
Keep the numbers, the checklist and the core code in one place, and find where to go next
Remote-sensing scene classification is scene classification with three changes: more bands than RGB, a view from above with no object cues, and tiles that hold several covers. Fix the input, the pooling and the head, and test where the model has never been.
| Term | What it is | Number to remember |
|---|---|---|
| GSD | ground width of one pixel | 10 m for Sentinel-2's sharpest bands |
| Footprint | F = p × g | 64 px × 10 m = 640 m |
| Tiles per scene | N = ⌊L / p⌋2 | 29,241 tiles of 64 px per 10,980 px scene |
| Sentinel-2 | multispectral satellite pair | 13 bands at 10, 20 and 60 m |
| NDVI | (NIR − RED) / (NIR + RED) | plants above 0.6, water below 0 |
| GAP | average of each channel over the grid | (256, 4, 4) to (256,) |
| Sigmoid head | one independent probability per cover | logit 0 gives 0.5 |
| MAE | hide patches, rebuild them | 75% hidden; independent masks over 3 groups hide 42% of places fully |
| AP, mAP | precision at each hit, averaged; then over covers | yes, yes, no, yes, no gives 0.917 |
| EuroSAT | 27,000 tiles, 10 covers | 98.57% overall accuracy in its paper |
| BigEarthNet | 590,326 multi-label patches | 120 px at 10 m = 1.2 km |
pythonimport numpy as np def ndvi(nir, red): # two (H, W) reflectance bands return (nir - red) / (nir + red + 1e-6) def gap(fmap): # (C, H, W) feature map return fmap.mean(axis=(1, 2)) # (C,) where is gone, how much stays def multilabel_head(v, W, b, thr): # v (C,), W (K, C), b (K,), thr (K,) p = 1 / (1 + np.exp(-(W @ v + b))) # one sigmoid per cover return p, p > thr # probabilities and the predicted set def bce(p, y): # p, y: (K,) p = np.clip(p, 1e-7, 1 - 1e-7) return -np.mean(y * np.log(p) + (1 - y) * np.log(1 - p)) def average_precision(scores, truth): # (N,) scores and 0/1 truth for one cover t = truth[np.argsort(-scores)] # truth in rank order prec = np.cumsum(t) / np.arange(1, len(t) + 1) # P(i) at every rank return (prec * t).sum() / max(t.sum(), 1) # average at the hits
| Approach | Input | Labels | Best when |
|---|---|---|---|
| Multispectral CNN | 13-band tile | one, softmax | clean single-label sets such as EuroSAT |
| Multi-label CNN | multispectral tile | many, sigmoid and BCE | real patches such as BigEarthNet |
| Geospatial MAE | bands and dates | either, by probe or fine-tune | few labels, new regions |
| Remote-sensing CLIP | tile and a text prompt | open, written in text | no labels, or a class list that changes |
Now press Present or Teach and explain from memory: the footprint of a tile, why NDVI survives shadow but not haze, what pooling throws away, and why a tile needs one sigmoid per cover. Then go back to the hero, switch it to sigmoid and turn the river off.