AGENT SKILL

datasets-and-samplers

Use for TorchGeo GeoDataset/NonGeoDataset usage, dataset composition, raster/vector dataset implementation, sample dictionaries, collate functions, and patch samplers.

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
datasets-and-samplers
license
MIT
metadata
{ "disco-role": "operating" }
description
Use for TorchGeo GeoDataset/NonGeoDataset usage, dataset composition, raster/vector dataset implementation, sample dictionaries, collate functions, and patch samplers.
disable-model-invocation
true

02 资源文件 1

03 SKILL.md 正文

TorchGeo datasets and samplers

Use this sub-skill for dataset selection, custom dataset implementation, geospatial composition, patch sampling, data loader collation, and dataset tests.

Choose the dataset family

  • Use GeoDataset when samples are queried by geospatial extent/time and the dataset has CRS/resolution/geometry metadata. These datasets support spatial/temporal indexing and composition.
  • Use NonGeoDataset for torchvision-style benchmark datasets indexed by integer sample id and usually stored under a root directory.
  • Raster-like geospatial datasets should normally subclass TorchGeo raster/vector helpers rather than manually reimplementing file indexing. Confirm the expected base class in the adjacent dataset source and tests before editing.

Compose geospatial datasets

  • dataset_a & dataset_b creates an IntersectionDataset: every query must be available in both datasets. Use this for image + mask/label/elevation/data-fusion workflows.
  • dataset_a | dataset_b creates a UnionDataset: a query may be satisfied by either dataset. Use this for alternate sensors or adjacent regions.
  • Composition is meaningful only when the participating indexes share compatible CRS/resolution/time assumptions. If outputs look empty, inspect bounds, CRS, resolution, and time interval overlap.

Sample dictionary expectations

Common keys:

  • image: tensor shaped like (C, H, W) for a single sample or batched by a collate function.
  • mask: semantic/change/instance segmentation target.
  • label: classification/regression target.
  • bbox_xyxy: object detection boxes in xyxy format.
  • metadata keys such as crs, bounds, dates, filenames, or dataset-specific attributes.

Always read the dataset test fixture before assuming keys. Use stack_samples for ordinary tensor dictionaries; use detection-specific collate helpers when boxes/masks are variable length.

Sampler selection

  • Use RandomPatchSampler(dataset, size=..., length=...) for stochastic training chips from a GeoDataset.
  • Use gridded samplers for deterministic tiling, validation, or prediction over a region.
  • Use batch samplers when the sampler should yield lists of geospatial windows directly.
  • Pass roi for a spatial region of interest and toi for a time interval of interest. Verify that ROI and TOI intersect dataset.index.
  • Check the units argument where available: pixel units are converted using dataset resolution, while CRS units are already in projected units.

Dataset implementation checklist

  1. Add or update the dataset class in torchgeo/datasets/<name>.py with the TorchGeo license header.
  2. Choose GeoDataset, NonGeoDataset, raster, or vector base class based on indexing semantics.
  3. Keep root='data' default when adding a new dataset unless an existing nearby class uses a different convention.
  4. Implement _verify()/download/checksum behavior consistently with adjacent datasets.
  5. Return a sample dictionary with documented keys and stable tensor shapes.
  6. Add import/export wiring in torchgeo/datasets/__init__.py.
  7. Add fake fixture generation under tests/data/<dataset>/ and a focused tests/datasets/test_<dataset>.py with plot/download/checksum/error coverage as applicable.
  8. Update docs tables and RST pages when the public dataset catalog changes.

Read next

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351