Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Splitting large rasters into paired image and mask tiles

Open In Colab

1. Motivation

A single satellite or aerial scene can span tens of thousands of pixels in each direction, while most deep learning models expect inputs of a few hundred pixels, commonly 256×256 or 512×512. Tiling, sometimes called “chipping,” slices these large scenes into pieces that actually fit into GPU memory and match your model’s expected input size.


2. Core idea

Tiling has two main parameters: tile size, the width and height of each chip, and stride, the step size between consecutive chips. When stride equals tile size, chips do not overlap; when stride is smaller, chips overlap.

Overlap is useful because objects near chip edges may otherwise be cut in half, which can confuse a model during training. The trade-off is that overlap creates more chips, uses more storage and takes more processing time.


3. Workflow

A. Choose tile size and stride

Use tile size and stride as project parameters.

OverlapStride for 256 px tilesStride for 512 px tilesTypical use
0%256512Simple classification or large uniform areas.
25%192384General-purpose tiling with moderate boundary issues.
50%128256Dense objects, buildings or small features.
75%64128Maximum coverage, but many more chips.

For a first project prototype, start simple. Use a small area and a moderate overlap (e.g. 25%) before scaling up.

B. Generate tiles from one image

The export_geotiff_tiles() function can tile imagery, rasterise vector labels and save paired image-mask tiles in one workflow.

In this example:

  • tile_size=512 creates 512 × 512 pixel chips,

  • stride=384 creates 25% overlap,

  • create_overview=True creates an overview image showing tile boundaries,

  • buffer_radius=0 means polygon labels are not expanded,

  • quiet=True suppresses the function’s per-tile progress output, so only the final result prints instead of a line for every chip generated.

C. Inspect image-mask pairs

Before moving on, inspect the overview image and a handful of individual image/mask pairs to confirm that tiles were generated where you expect and that labels align correctly within each one.

<Figure size 1800x1000 with 1 Axes>
<Figure size 1800x1000 with 8 Axes>

4. Common pitfalls

PitfallHow to avoid it
Tile size is chosen randomlyMatch it to model input size and feature size.
No overlap is used for boundary-sensitive objectsUse overlap when objects are often cut at tile edges.
Too much overlap creates too many filesStart with a small prototype and check chip count.
Overview image is ignoredUse it to check coverage and empty areas.
Image chips and masks do not matchInspect several image-mask pairs before training.
Tiling parameters are not documentedRecord tile size, stride, overlap and filtering choices.

5. Mini task

Using your own image/mask pair (or the sample data here), generate tiles at two different overlap settings (for example, 0% and 50%) and compare the total tile counts.


6. Key takeaways

  • Tiling turns large rasters into model-ready image chips.

  • Stride controls overlap between neighbouring chips.

  • Overlap helps with edge objects but increases storage and processing time.

  • The overview image checks spatial coverage.

  • Image-mask pair previews are a required quality check before training.