A fine-tuning pipeline for the Galileo Pretrained Remote Sensing Model to classify crop types using pixel-wise segmentation with multi-temporal Sentinel-1 and Sentinel-2 data in Rwanda.
git clone <repo-url>
cd galileoWith conda:
conda env create -f environment.yml
conda activate galileo-envUse the script below to export Sentinel-1/ Sentinel-2 images over your area of interest for specific session (Season A or Season B):
python run_export_rwanda.pyAfter GEE completes your export tasks, download the resulting GeoTIFF tiles::
python download_tiles_from_gee.pyUse preprocessed Sentinel-1/Sentinel-2 tiles and polygon labels to generate 8×8 pixel-wise training patches:
python extract_patches_from_tiles.pyThis script will:
- Read raster tiles and label masks
- Extract valid 8×8 image and mask patches
- Save
.npzpatch datasets fortrain,val, andtestsplits
data/
patches/
train/
inputs/
masks/
val/
test/
Train the pixel-wise classifier using the Galileo encoder:
python finetune_rwanda.py \
--data_dir data/patches/ \
--encoder_ckpt data/models/nano/ \
--save_dir checkpoints/ \
--batch_size 8 \
--epochs 50 \
--lr 0.0001Run inference on prepared raster tiles:
python inference.pyThis script will:
- Load each tile (60-band: 5 timesteps × 12 bands)
- Apply a sliding window to generate 8×8 predictions
- Merge predictions and output a GeoTIFF (
merged_prediction.tif)
- Your input tiles must have 60 bands (5 months × 12 bands).
- Invalid or low-confidence pixels are masked using a configurable
confidence_threshold.