augmentor
Use Augmentor for Pillow-based image augmentation pipelines, operation selection, mask-safe augmentation, array/generator workflows, and package-specific troubleshooting.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- augmentor
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use Augmentor for Pillow-based image augmentation pipelines, operation selection, mask-safe augmentation, array/generator workflows, and package-specific troubleshooting.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/quickstart.md3.6 KB
- 参考文档references/repo-provenance.md1.7 KB
- 参考文档references/repo-routing-metadata.json319 B
- 参考文档references/troubleshooting.md4.3 KB
- 脚本scripts/augmentor_env_smoke.py3.5 KB
03 SKILL.md 正文
Augmentor Repo Skill
Use this skill when a task names Augmentor or asks for Augmentor-style image augmentation: stochastic Pipeline construction, Pillow/NumPy operations, class-folder scanning, generated image output, ground-truth/mask pairing, in-memory DataPipeline arrays, Keras-style batches, or torchvision transform callables.
Augmentor is a CPU/Pillow/NumPy package. It does not require CUDA, ROCm, MPS, Keras/TensorFlow, or torch/torchvision for core package workflows.
First checks
-
Install the package in the task environment:
pip install AugmentorFor Augmentor 0.2.x compatibility-sensitive work, prefer:
pip install 'Augmentor==0.2.12' 'Pillow<10' 'numpy<2' tqdm -
Verify the import:
python -c "import Augmentor; print(Augmentor.__version__)" -
For a safe end-to-end check, run the bundled smoke helper:
python scripts/augmentor_env_smoke.py --samples 2 --size 24 -
If the task uses masks, framework generators, or optional pandas/torch/Keras integrations, route to the matching sub-skill before giving final code.
Route by task
| User task or signal | Read next |
|---|---|
Create a Pipeline from a folder, scan class subfolders, write augmented files, choose sample() vs process(), control output directories, seeds, or multithreading. |
sub-skills/pipeline-augmentation/SKILL.md |
Choose operations, fix probability/range errors, understand rotate/crop/zoom/skew/distortion/color operations, or write custom Operation subclasses. |
sub-skills/operation-reference/SKILL.md |
Apply identical transforms to images and masks, use ground_truth(), verify matched filenames/classes/dimensions, or build grouped in-memory original+mask arrays. |
sub-skills/masks-and-arrays/SKILL.md |
Use keras_generator, keras_generator_from_array, keras_preprocess_func, torch_transform, or DataFramePipeline; debug batch shapes or optional framework dependencies. |
sub-skills/generators-and-frameworks/SKILL.md |
| Diagnose install/import, Pillow/PIL, save-format, dependency, stochastic reproducibility, or optional dependency issues that span several workflows. | references/troubleshooting.md |
| Check whether this skill matches a local Augmentor checkout or package version. | references/repo-provenance.md |
Minimal examples
Disk-backed augmentation
import Augmentor
p = Augmentor.Pipeline("train_images", output_directory="output")
p.rotate(probability=0.7, max_left_rotation=10, max_right_rotation=10)
p.flip_left_right(probability=0.5)
p.resize(probability=1.0, width=224, height=224)
p.set_save_format("PNG")
p.sample(100, multi_threaded=False)
Outputs are written under the source directory's output folder. If the source directory has immediate subdirectories, Augmentor treats those subdirectories as class labels. Read pipeline-augmentation before changing layouts or counting class outputs.
Mask-safe augmentation
import Augmentor
p = Augmentor.Pipeline("images")
p.ground_truth("masks")
p.rotate(probability=1.0, max_left_rotation=5, max_right_rotation=5)
p.sample(20)
Use masks-and-arrays to validate matched names, class subfolders, equal dimensions, and multiple masks per image.
Generator batches
import Augmentor
p = Augmentor.Pipeline("train_images")
g = p.keras_generator(batch_size=32, scaled=True, image_data_format="channels_last")
images, labels = next(g)
The direct Augmentor generator APIs return NumPy arrays and do not import Keras/TensorFlow. Read generators-and-frameworks before promising external framework behavior.
Compatibility caveats
- Augmentor 0.2.x predates newer Pillow and NumPy APIs. For legacy behavior,
Pillow<10andnumpy<2are safer than latest-only installs. DataFramePipelineis optional and legacy. This checkout'sscan_dataframe()path failed with pandas 1.5.3 and 3.0.5 because it callsCategorical.get_values(). Prefer ordinaryPipelineorDataPipelineunless maintaining or patching Augmentor.torch_transform()returns a PIL-image callable; torchvision is optional and only needed fortorchvision.transforms.ComposeorToTensor().- Do not assert exact output filenames in tests or examples. Augmentor uses UUID filenames; assert counts, dimensions, formats, labels, and readable images.
Bundled references and scripts
references/quickstart.mdgives a compact route map and common snippets.references/troubleshooting.mdcovers cross-cutting install/import, dependency, save-format, optional dependency, and reproducibility issues.references/repo-provenance.mdrecords the source version and evidence baseline for refresh decisions.references/repo-routing-metadata.jsonprovides managed repo-skills-router metadata for import tooling.scripts/augmentor_env_smoke.pyruns a safe generated-fixture smoke check for the active Python environment.
Boundaries
Use this skill for using Augmentor as a package. For maintainer tasks that modify Augmentor source code, packaging, CI, or docs, combine this usage skill with a Python repository maintenance workflow and run focused source tests after editing.
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).