kabiriitb's picture
Upload folder using huggingface_hub
820fab0 verified
Raw History Blame Contribute Delete
2.67 kB
"""
Default configuration for the RockGlacierNet dataset-building pipeline.
Everything here can be overridden on the command line in run_pipeline.py
(--raster, --shp, --out, --patch, --stride). Paths are relative to the repo
root unless absolute.
Design choices baked in (from hard-won experience on earlier datasets):
* features and masks are cropped from the SAME pixel window on the SAME grid
-> feature/mask alignment is structurally guaranteed (no mismatch),
* the mask is rasterised from ALL glaciers on the raster grid, so any
neighbouring glacier inside a window is labelled (no label noise),
* min_window = patch_size, so crops never need destructive up-padding
(the bug that poisoned the first 30 m dataset),
* NaN / no-data is imputed to the per-band TRAIN mean (normalises to ~0),
* the train/val/test split is BY CROP, so overlapping patches never leak.
"""
DEFAULTS = {
# ── inputs ────────────────────────────────────────────────────────────────
"raster": "35_band/band_feature", # a GeoTIFF/VRT file OR a folder
"shp": "Final_merged01/Final_merged01.shp",
"out": "all_data", # output root (git-ignored data)
# ── cropping ──────────────────────────────────────────────────────────────
"padding_m": 200, # context buffer around each glacier bbox
"background_ratio": 0.10, # pure-background crops as a fraction of dataset
"min_valid_fraction": 0.6, # drop crops whose band-0 is >40% no-data
"all_touched": True, # rasterise: keep any pixel a polygon touches
# ── patching (patch_size overridden by --patch) ──────────────────────────
"patch_size": 128, # 64, 128, ... (set per run)
"stride": None, # None -> patch_size // 2
"min_glacier_pct": 1.0, # a patch counts as glacier above this %
"background_keep_ratio": 0.10, # fraction of pure-bg patches to keep
"padding_mode": "reflect", # feature AND mask padded identically
# ── split ─────────────────────────────────────────────────────────────────
"train_ratio": 0.70,
"val_ratio": 0.15,
"seed": 42,
}