AGENT SKILL

data-pipelines

Implement and validate DLTK TensorFlow 1.x medical-image readers, preprocessing, augmentation, patch extraction, and NIfTI/CSV input contracts.

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

01 前言 Front Matter

name
data-pipelines
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Implement and validate DLTK TensorFlow 1.x medical-image readers, preprocessing, augmentation, patch extraction, and NIfTI/CSV input contracts.
disable-model-invocation
true

02 资源文件 6

03 SKILL.md 正文

DLTK data pipelines

Use this route when a task must turn medical-image files or synthetic arrays into DLTK Reader/Estimator inputs. It covers dltk.io.preprocessing, dltk.io.augmentation, dltk.io.abstract_reader, SimpleITK/NIfTI layouts, CSV-driven file references, serving placeholders, and safe resampling choices. It does not cover network architecture, optimizer/Estimator orchestration, or exported-model prediction/stitching; route those to model-building, training-and-estimators, or the inference route.

Compatibility gate

The public package baseline is DLTK 0.2.1 (provenance: commit f94d3bb509eb0741164149acbef0788769a869e4). Its reader uses TensorFlow 1.x graph/session APIs (tf.Session, tf.data.Dataset.from_generator, tf.train.SessionRunHook, and tf.estimator). For source-compatible execution, provision Python 3.7 with TensorFlow 1.15 and dependency versions that expose those APIs. Do not imply that the code is TensorFlow 2.x compatible: NumPy-only preprocessing/augmentation checks can run without TensorFlow, while abstract_reader requires the TF1 hook API. SimpleITK, NIfTI data, and any dataset permissions are separate prerequisites.

Operating sequence

  1. Freeze the sample contract. Define the row layout in file_references, the mode, params, spatial patch example_size, channel count, label shape/dtype, and whether a full volume or patches are emitted. A custom reader has the exact signature read_fn(file_references, mode, params=None) and yields dictionaries, normally with features and (outside PREDICT) labels.
  2. Read and orient data explicitly. Read NIfTI with SimpleITK, convert with sitk.GetArrayFromImage, and add/stack channels last so a 3-D volume is [z, y, x, channels] for the TensorFlow examples. Keep the original sitk.Image metadata outside TensorFlow if output reslicing is needed.
  3. Normalize before training augmentation. Choose whitening, [0, 1], or [-1, 1] based on the model contract. Copy an array before using the in-place Gaussian offset/noise helpers. Use the safe crop/pad logic in the reference rather than assuming the legacy list-indexing implementation works with modern NumPy 2.x.
  4. Augment only where valid. Apply random flips to every synchronized image and label with the same decision; apply intensity noise/offset only to image channels. Elastic deformation in the legacy helper is not a label interpolation contract. In a training reader, ensure params has defaults before indexing params['extract_examples'].
  5. Extract patches with a label policy. For ordinary patches use extract_random_example_array; for segmentation use extract_class_balanced_example_array with image shape [spatial..., C] and label shape [spatial...]. Verify every requested class exists and expect fewer than n_examples when class availability/weights cannot supply all requested patches.
  6. Bind the nested TensorFlow contract. Construct dtypes and example_shapes with the same dictionary/list structure as each yielded example. Shapes describe one unbatched element; Reader.get_inputs adds the batch dimension. Extra keys are recursively removed by the legacy cleaner, while missing keys or dict/list mismatches fail. Do not put arbitrary SimpleITK objects in a TensorFlow dtype tree.
  7. Treat PREDICT as a separate branch. Yield exactly one prediction record containing only feature keys declared for prediction, then return. Several source application readers yield their prediction record and continue into label/patch code; copying that pattern can duplicate examples or dereference absent labels/params. Test PREDICT independently from TRAIN/EVAL.
  8. Validate on synthetic data first. Run scripts/preprocessing_smoke.py and scripts/validate_reader_contract.py from any working directory. Then use a small, permissioned fixture and a bounded TF1 session/Estimator check. Do not download, delete, extract untrusted archives, or start full training from this route.

Handoffs

  • Pass feature rank/channel and label shape facts to model-building.
  • Pass Reader.get_inputs, hook, mode, batch, and serving contracts to training-and-estimators.
  • Keep metadata-preserving output and sliding-window stitching in the sibling inference/deployment route.

For exact signatures and mutation/shape caveats, read references/api-reference.md. For complete reader and serving wiring, read references/reader-workflows.md. For CSV, SimpleITK, IXI/MRBrainS conventions, and resampling boundaries, read references/data-formats-and-resampling.md. Use references/troubleshooting.md when a contract or compatibility check fails.

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