Albumentations Pipeline Composition
Use this sub-skill when an agent needs to assemble or modify an Albumentations pipeline, reason about pipeline-level validation, or debug pipeline randomness and target routing.
Route Here For
- Building
A.Compose / A.ReplayCompose pipelines around existing transforms.
- Choosing composition blocks:
OneOf, SomeOf, RandomOrder, Sequential, OneOrOther, and SelectiveChannelTransform.
- Enabling
strict, is_check_shapes, additional_targets, mask_interpolation, seed, or save_applied_params on a pipeline.
- Editing a pipeline with
+, left-+, or - while preserving compose configuration.
- Debugging invalid keys, shape mismatches, bad operator operands, seed expectations, label-field routing, or mask interpolation surprises.
Route Elsewhere
- Transform family choice and transform parameter recipes:
../transform-catalog/.
- Bbox, keypoint, label, volume, and 3D target formats:
../targets-and-formats/.
- Replay dictionaries, save/load, JSON/YAML, and reproducibility artifacts:
../serialization-and-reproducibility/.
- Tensor conversion and dataloader placement:
../framework-integration/.
References And Helpers
references/composition-api.md: API signatures, composition semantics, validation options, seed behavior, target routing, operator edits, and worked examples.
references/troubleshooting.md: Symptom-driven fixes for invalid keys, mismatched shapes, single-transform warnings, missing labels, seed confusion, operator failures, and mask interpolation issues.
scripts/check_pipeline_contract.py: A tiny self-contained checker that exercises strict keys, shape checks, additional depth targets, mask interpolation propagation, operator metadata preservation, and seed independence from global NumPy seeding.
Default Composition Pattern
Prefer an explicit, strict top-level Compose while developing, then relax only the checks that are intentionally incompatible with the data:
import albumentations as A
pipeline = A.Compose(
[
A.Resize(256, 256, p=1),
A.OneOf([A.HorizontalFlip(p=1), A.VerticalFlip(p=1)], p=0.5),
],
additional_targets={"depth": "mask"},
is_check_shapes=True,
strict=True,
mask_interpolation=0,
seed=137,
save_applied_params=True,
)
result = pipeline(image=image, mask=mask, depth=depth)
Keep Compose calls keyword-only: use pipeline(image=image, mask=mask), not pipeline(image).
1---2name: pipeline-composition3description: "Build, edit, validate, seed, and debug Albumentations augmentation4 pipelines with Compose and composition combinators."5disable-model-invocation: true6metadata:7 source: https://skillmd.com/skills/vectorspacelab/pipeline-composition8 disco-role: operating9license: MIT10---1112# Albumentations Pipeline Composition1314Use this sub-skill when an agent needs to assemble or modify an Albumentations pipeline, reason about pipeline-level validation, or debug pipeline randomness and target routing.1516## Route Here For1718- Building `A.Compose` / `A.ReplayCompose` pipelines around existing transforms.19- Choosing composition blocks: `OneOf`, `SomeOf`, `RandomOrder`, `Sequential`, `OneOrOther`, and `SelectiveChannelTransform`.20- Enabling `strict`, `is_check_shapes`, `additional_targets`, `mask_interpolation`, `seed`, or `save_applied_params` on a pipeline.21- Editing a pipeline with `+`, left-`+`, or `-` while preserving compose configuration.22- Debugging invalid keys, shape mismatches, bad operator operands, seed expectations, label-field routing, or mask interpolation surprises.2324## Route Elsewhere2526- Transform family choice and transform parameter recipes: `../transform-catalog/`.27- Bbox, keypoint, label, volume, and 3D target formats: `../targets-and-formats/`.28- Replay dictionaries, save/load, JSON/YAML, and reproducibility artifacts: `../serialization-and-reproducibility/`.29- Tensor conversion and dataloader placement: `../framework-integration/`.3031## References And Helpers3233- `references/composition-api.md`: API signatures, composition semantics, validation options, seed behavior, target routing, operator edits, and worked examples.34- `references/troubleshooting.md`: Symptom-driven fixes for invalid keys, mismatched shapes, single-transform warnings, missing labels, seed confusion, operator failures, and mask interpolation issues.35- `scripts/check_pipeline_contract.py`: A tiny self-contained checker that exercises strict keys, shape checks, additional depth targets, mask interpolation propagation, operator metadata preservation, and seed independence from global NumPy seeding.3637## Default Composition Pattern3839Prefer an explicit, strict top-level `Compose` while developing, then relax only the checks that are intentionally incompatible with the data:4041```python42import albumentations as A4344pipeline = A.Compose(45 [46 A.Resize(256, 256, p=1),47 A.OneOf([A.HorizontalFlip(p=1), A.VerticalFlip(p=1)], p=0.5),48 ],49 additional_targets={"depth": "mask"},50 is_check_shapes=True,51 strict=True,52 mask_interpolation=0,53 seed=137,54 save_applied_params=True,55)56result = pipeline(image=image, mask=mask, depth=depth)57```5859Keep `Compose` calls keyword-only: use `pipeline(image=image, mask=mask)`, not `pipeline(image)`.