albumentations
Build, debug, serialize, and integrate Albumentations 2.x augmentation pipelines for images, masks, bboxes, keypoints, volumes, and PyTorch-style datasets.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- albumentations
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Build, debug, serialize, and integrate Albumentations 2.x augmentation pipelines for images, masks, bboxes, keypoints, volumes, and PyTorch-style datasets.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/installation-and-maintenance.md2.1 KB
- 参考文档references/repo-provenance.md1.3 KB
- 参考文档references/repo-routing-metadata.json340 B
- 参考文档references/troubleshooting.md2.5 KB
- 脚本scripts/albumentations_smoke_check.py1.4 KB
03 SKILL.md 正文
Albumentations Repo Skill
Use this skill when a coding agent needs to work with Albumentations 2.x augmentation pipelines, choose transforms, validate targets, serialize/replay pipelines, or integrate augmentations into PyTorch-style data loading.
Albumentations is a NumPy/OpenCV-based augmentation library for computer vision and medical-imaging workflows. This skill covers the MIT-licensed albumentations package at version 2.0.8. The upstream README states that the original Albumentations repository is no longer maintained and points users to AlbumentationsX for active development; keep that maintenance status in mind when recommending new dependencies or migrations.
Quick Start
For deterministic/offline agent checks, suppress the package's import-time update check:
NO_ALBUMENTATIONS_UPDATE=1 python - <<'PY'
import albumentations as A
print(A.__version__)
PY
Minimal image pipeline:
import albumentations as A
transform = A.Compose(
[
A.Resize(256, 256),
A.HorizontalFlip(p=0.5),
A.RandomBrightnessContrast(p=0.2),
],
strict=True,
seed=137,
)
result = transform(image=image_np)
augmented = result["image"]
Install the base package for NumPy/OpenCV augmentation:
pip install albumentations
Install optional integrations only when needed:
pip install "albumentations[pytorch]" # ToTensorV2 / ToTensor3D
pip install "albumentations[hub]" # Hugging Face Hub helpers
pip install "albumentations[text]" # text rendering helpers
Route By Task
- Use
sub-skills/pipeline-composition/to build or debugCompose,ReplayCompose,OneOf,SomeOf,RandomOrder,Sequential,OneOrOther,SelectiveChannelTransform, strict validation, additional targets, seeds, and pipeline operator edits. - Use
sub-skills/transform-catalog/to choose transform families and parameters for pixel/color/noise/blur, crop/resize/pad/geometric, dropout, domain adaptation, spectrogram, text, and segmentation-safe pipelines. - Use
sub-skills/targets-and-formats/to handle input/output keys, masks, bboxes, keypoints, labels, additional targets, multiple images, volumes, and 3D masks. - Use
sub-skills/serialization-and-reproducibility/to save/load JSON or YAML configs, replay exact random choices, inspect applied parameters, handle customLambdaobjects, and reason about reproducibility. - Use
sub-skills/framework-integration/for PyTorch-styleDatasetintegration,ToTensorV2,ToTensor3D, optional extras, tensor shapes, dtype/range expectations, and DataLoader worker seeding.
Shared References And Helpers
references/installation-and-maintenance.md: package version, Python/dependency expectations, optional extras, maintenance status, and import/update-check behavior.references/troubleshooting.md: cross-cutting install/import, OpenCV, optional dependency, offline, validation, and migration troubleshooting.references/repo-provenance.md: source snapshot, evidence paths, and refresh baseline for staleness checks.scripts/albumentations_smoke_check.py: tiny safe import and pipeline smoke check for installed environments.
Common Decision Points
- Keep images as NumPy arrays in
H,W,Cuntil a final framework tensor transform; route tensor issues toframework-integration. - Use
strict=Truewhile developing pipelines to catch unknown keys and invalid transform arguments early; route Compose-level validation topipeline-composition. - Declare
bbox_paramsandkeypoint_paramsonComposewhenever calls includebboxesorkeypoints; route coordinate issues totargets-and-formats. - For segmentation masks, prefer nearest-neighbor mask interpolation and explicit
fill_mask; route transform support decisions totransform-catalog. - For reproducible debugging, use
seed,ReplayCompose, orsave_applied_params=Truedepending on whether you need repeatable streams, exact replay, or sampled-parameter inspection. - Do not assume optional PyTorch, Hub, or text helpers are available from a base install; check extras and imports first.
Safety And Self-Containment
This generated skill is self-contained. Runtime instructions, references, and helper scripts live inside this skill directory and do not require opening the original repository checkout. Treat original tests and source files as provenance evidence only; use the bundled sub-skills and helpers for future work.
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).