
Choosing Training Patches in TorchGeo: Sampling, Patch Size and Class Imbalance
1 for classification, segmentation and object detection. It starts with the basics: what a patch is, why models train on patches, and where patch selection happens in TorchGeo.
Notes
This video explains how to choose training patches in TorchGeo 0.10.1 for classification, segmentation and object detection. It starts with the basics: what a patch is, why models train on patches, and where patch selection happens in TorchGeo. It then covers the new 0.10 samplers (RandomPatchSampler, GriddedPatchSampler and the temporal samplers), regions of interest, epoch length, and how to match patch size to the size of the feature you map. The task section looks at mixed labels in classification, nodata in segmentation, clipped boxes and empty patches in detection, and date pairs for change detection. The longest section deals with rare features and class imbalance: aiming the sampler with a region of interest, mixing targeted and background patches, weighting candidate patches, hard negatives, loss options, and honest evaluation. It ends with spatial train/test splits and four ready-to-use setups. The maps in the video come from a synthetic scene made for illustration.