imgaug
Use when working with imgaug image augmentation pipelines, aligned annotations, stochastic parameters, dtype/data utilities, or multicore augmentation for computer-vision data.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- imgaug
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use when working with imgaug image augmentation pipelines, aligned annotations, stochastic parameters, dtype/data utilities, or multicore augmentation for computer-vision data.
- disable-model-invocation
- true
02 资源文件 6
- 参考文档references/package-overview.md3.7 KB
- 参考文档references/repo-provenance.md1.3 KB
- 参考文档references/repo-routing-metadata.json310 B
- 参考文档references/troubleshooting.md5.5 KB
- 脚本scripts/check_imgaug_env.py2.2 KB
- 脚本scripts/smoke_imgaug_workflows.py2.7 KB
03 SKILL.md 正文
imgaug Repo Skill
Use this skill when a task involves the Python package imgaug: building image augmentation pipelines, applying identical transforms to annotations, choosing stochastic parameters, debugging dtype/shape issues, or running background augmentation for computer-vision training data.
This is a self-contained operating guide. Do not rely on the original repository checkout being available; use the bundled references and scripts in this skill.
First checks
For a fresh environment, install a compatible runtime before using examples:
python -m pip install "imgaug==0.4.0" "numpy<2" "opencv-python-headless<4.12"
If installing from a local clone of imgaug 0.4.0, modern build isolation can fail because setup.py imports pkg_resources. Use a private environment and, only when needed, install setuptools<81 before a no-build-isolation local install. Prefer the public package install above for ordinary use.
Run the bundled environment check whenever installation, imports, optional dependencies, or compatibility are uncertain:
python scripts/check_imgaug_env.py
Run a short end-to-end smoke that adapts imgaug's documented examples without display, network, or large data:
python scripts/smoke_imgaug_workflows.py
Route by task
| Task signal | Read next |
|---|---|
Build iaa.Sequential, SomeOf, OneOf, Sometimes, WithChannels, image-only augmentation, or choose augmenter families such as affine, blur, color, contrast, dropout, weather, superpixels, or PIL-like effects |
sub-skills/augmentation-pipelines/SKILL.md |
Apply one transform consistently to keypoints, bounding boxes, polygons, line strings, heatmaps, segmentation maps, or mixed Batch/UnnormalizedBatch objects |
sub-skills/augmentables-and-batches/SKILL.md |
| Control random sampling, seeds, deterministic replay, stochastic parameter distributions, dtype conversion, example quokka data, image resizing, grids, or display helpers | sub-skills/parameters-random-and-utilities/SKILL.md |
Speed up augmentation with augment_batches(..., background=True), Augmenter.pool(), imgaug.multicore.Pool, BatchLoader, or debug multiprocessing/performance issues |
sub-skills/multicore-and-diagnostics/SKILL.md |
Core usage pattern
Most workflows start with NumPy arrays in image shape (N, H, W, C) or a list of (H, W, C) arrays. Images should usually be RGB uint8 with values 0..255; convert BGR images loaded by OpenCV before color augmentations.
import numpy as np
import imgaug.augmenters as iaa
images = np.zeros((8, 64, 64, 3), dtype=np.uint8)
seq = iaa.Sequential([
iaa.Fliplr(0.5),
iaa.Affine(rotate=(-10, 10)),
iaa.GaussianBlur(sigma=(0.0, 1.0)),
])
images_aug = seq(images=images)
When images have annotations, pass them in the same call so geometric parameters are sampled once and applied consistently:
images_aug, keypoints_aug = seq(images=images, keypoints=keypoints)
Use to_deterministic() when you must apply the same sampled transform in separate calls, but prefer a single call containing all aligned augmentables when possible.
Bundled references
references/package-overview.mdgives the package map, supported workflows, dependencies, and source-artifact replacement map.references/troubleshooting.mdcovers cross-cutting install/import, NumPy/OpenCV, dtype/shape, optional dependency, display, and multiprocessing failures.references/repo-provenance.mdrecords the source snapshot used to build this skill; read it before deciding whether a checkout needsrefresh-repo-skill.references/repo-routing-metadata.jsonis structured metadata for managed repo-skill routing.
What this skill does not cover
- It does not teach general computer-vision model training frameworks beyond preparing augmented arrays/batches for them.
- It does not run long visual/performance checks from the source repository; bundled scripts use tiny deterministic fixtures.
- It does not verify optional
imagecorruptionsornumbaacceleration unless the current task explicitly requires them.
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).