Datasets:
Tasks:
Image Segmentation
Formats:
imagefolder
Size:
10K - 100K
Tags:
remote-sensing
land-cover
satellite-imagery
aerial-imagery
semantic-segmentation
weak-supervision
License:
Download scripts/chesapeake/make_csv.py from rishabh-sat/walkability-project: direct link, hf CLI and curl.
- Browser
- Download file 1.37 kB
-
https://huggingface.co/datasets/rishabh-sat/walkability-project/resolve/main/scripts/chesapeake/make_csv.py
- Command line
-
hf download hf://datasets/rishabh-sat/walkability-project/scripts/chesapeake/make_csv.py
-
curl -L -o make_csv.py https://huggingface.co/datasets/rishabh-sat/walkability-project/resolve/main/scripts/chesapeake/make_csv.py
1.37 kB
| """Build Paraformer CSV lists (image_fn,label_fn) from the downloaded Chesapeake tiles. | |
| usage: python make_csv.py <data_root> <out_dir> | |
| Writes per-split CSVs (train/val/test) for all states, plus per-state CSVs.""" | |
| import sys, glob, os, csv | |
| root, out = sys.argv[1], sys.argv[2] | |
| STATES = ["de", "ny", "md", "pa", "va", "wv"] | |
| SPLITS = ["train", "val", "test"] | |
| os.makedirs(out, exist_ok=True) | |
| rows = {s: [] for s in SPLITS} | |
| for st in STATES: | |
| for sp in SPLITS: | |
| naips = sorted(glob.glob(f"{root}/{st}/{st}_1m_*_extended-debuffered-{sp}_tiles/*_naip-new.tif")) | |
| pairs = [] | |
| for n in naips: | |
| l = n.replace("_naip-new.tif", "_nlcd.tif"); g = n.replace("_naip-new.tif", "_lc.tif") | |
| assert os.path.exists(l) and os.path.exists(g), n | |
| pairs.append((os.path.abspath(n), os.path.abspath(l), os.path.abspath(g))) | |
| rows[sp] += pairs | |
| with open(f"{out}/Chesapeake_{st}_{sp}.csv", "w", newline="") as f: | |
| w = csv.writer(f); w.writerow(["image_fn", "label_fn", "gt_fn"]); w.writerows(pairs) | |
| print(f"{st} {sp:5s} {len(pairs):4d}") | |
| for sp in SPLITS: | |
| with open(f"{out}/Chesapeake_all_{sp}.csv", "w", newline="") as f: | |
| w = csv.writer(f); w.writerow(["image_fn", "label_fn", "gt_fn"]); w.writerows(rows[sp]) | |
| print(f"ALL {sp:5s} {len(rows[sp]):4d} -> {out}/Chesapeake_all_{sp}.csv") | |