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
- 参考文档references/api-reference.md7.8 KB
- 参考文档references/data-formats-and-resampling.md5.6 KB
- 参考文档references/reader-workflows.md6.2 KB
- 参考文档references/troubleshooting.md5.4 KB
- 脚本scripts/preprocessing_smoke.py5.1 KB
- 脚本scripts/validate_reader_contract.py6.4 KB
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
- Freeze the sample contract. Define the row layout in
file_references, themode,params, spatial patchexample_size, channel count, label shape/dtype, and whether a full volume or patches are emitted. A custom reader has the exact signatureread_fn(file_references, mode, params=None)and yields dictionaries, normally withfeaturesand (outside PREDICT)labels. - 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 originalsitk.Imagemetadata outside TensorFlow if output reslicing is needed. - 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. - 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
paramshas defaults before indexingparams['extract_examples']. - Extract patches with a label policy. For ordinary patches use
extract_random_example_array; for segmentation useextract_class_balanced_example_arraywith image shape[spatial..., C]and label shape[spatial...]. Verify every requested class exists and expect fewer thann_exampleswhen class availability/weights cannot supply all requested patches. - Bind the nested TensorFlow contract. Construct
dtypesandexample_shapeswith the same dictionary/list structure as each yielded example. Shapes describe one unbatched element;Reader.get_inputsadds 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. - 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. - Validate on synthetic data first. Run
scripts/preprocessing_smoke.pyandscripts/validate_reader_contract.pyfrom 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
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.
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.
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.
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.
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.
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).